19 #include "qgis_core.h"
59 #define QGSCLIPBOARD_STYLE_MIME "application/qgis.style"
233 bool addTextFormat(
const QString &name,
const QgsTextFormat &format,
bool update =
false );
245 bool addLabelSettings(
const QString &name,
const QgsPalLayerSettings &settings,
bool update =
false );
257 bool addLegendPatchShape(
const QString &name,
const QgsLegendPatchShape &shape,
bool update =
false );
265 int addTag(
const QString &tagName );
290 int addSmartgroup(
const QString &name,
const QString &op,
const QStringList &matchTag,
const QStringList &noMatchTag,
291 const QStringList &matchName,
const QStringList &noMatchName );
299 QStringList tags()
const;
311 int colorRampCount();
314 QStringList colorRampNames()
const;
317 const QgsColorRamp *colorRampRef(
const QString &name )
const;
323 int colorrampId(
const QString &name );
336 int textFormatCount()
const;
342 QStringList textFormatNames()
const;
350 int textFormatId(
const QString &name );
370 int legendPatchShapesCount()
const;
394 int labelSettingsCount()
const;
400 QStringList labelSettingsNames()
const;
408 int labelSettingsId(
const QString &name );
414 static void cleanDefaultStyle()
SIP_SKIP;
425 bool tagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
436 bool detagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
446 bool detagSymbol( StyleEntity type, const QString &symbol );
449 bool removeSymbol( const QString &name );
458 bool renameEntity( StyleEntity type, const QString &oldName, const QString &newName );
465 bool renameSymbol( const QString &oldName, const QString &newName );
471 const
QgsSymbol *symbolRef( const QString &name ) const;
477 QStringList symbolNames() const;
483 int symbolId( const QString &name );
489 int entityId( StyleEntity type, const QString &name );
492 int tagId( const QString &tag );
494 int smartgroupId( const QString &smartgroup );
500 QStringList allNames( StyleEntity type ) const;
508 QStringList symbolsOfFavorite( StyleEntity type ) const;
517 QStringList symbolsWithTag( StyleEntity type,
int tagid ) const;
526 bool addFavorite( StyleEntity type, const QString &name );
535 bool removeFavorite( StyleEntity type, const QString &name );
544 bool rename( StyleEntity type,
int id, const QString &newName );
554 bool remove( StyleEntity type,
int id );
562 bool removeEntityByName( StyleEntity type, const QString &name );
573 bool saveSymbol( const QString &name,
QgsSymbol *symbol,
bool favorite, const QStringList &tags );
584 bool saveColorRamp( const QString &name,
QgsColorRamp *ramp,
bool favorite, const QStringList &tags );
587 bool removeColorRamp( const QString &name );
590 bool renameColorRamp( const QString &oldName, const QString &newName );
601 bool saveTextFormat( const QString &name, const
QgsTextFormat &format,
bool favorite, const QStringList &tags );
607 bool removeTextFormat( const QString &name );
614 bool renameTextFormat( const QString &oldName, const QString &newName );
625 bool saveLabelSettings( const QString &name, const
QgsPalLayerSettings &settings,
bool favorite, const QStringList &tags );
631 bool removeLabelSettings( const QString &name );
638 bool renameLabelSettings( const QString &oldName, const QString &newName );
651 bool saveLegendPatchShape( const QString &name, const
QgsLegendPatchShape &shape,
bool favorite, const QStringList &tags );
658 bool renameLegendPatchShape( const QString &oldName, const QString &newName );
664 QStringList legendPatchShapeNames() const;
689 QList< QList< QPolygonF > > defaultPatchAsQPolygonF(
QgsSymbol::SymbolType type, QSizeF size ) const;
699 bool createDatabase( const QString &filename );
709 bool createMemoryDatabase();
729 bool load( const QString &filename );
732 bool save( QString filename = QString() );
735 QString errorString() {
return mErrorString; }
747 QStringList findSymbols( StyleEntity type,
const QString &qword );
756 QStringList tagsOfSymbol( StyleEntity type,
const QString &symbol );
764 bool isFavorite( StyleEntity type,
const QString &name );
774 bool symbolHasTag( StyleEntity type,
const QString &symbol,
const QString &tag );
777 QString tag(
int id )
const;
783 QStringList smartgroupNames()
const;
791 QString smartgroupOperator(
int id );
794 QStringList symbolsOfSmartgroup( StyleEntity type,
int id );
797 bool exportXml(
const QString &filename );
800 bool importXml(
const QString &filename );
810 static bool isXmlStyleFile(
const QString &path );
822 void symbolSaved(
const QString &name,
QgsSymbol *symbol );
832 void symbolChanged(
const QString &name );
835 void groupsModified();
842 void entityTagsChanged(
QgsStyle::StyleEntity entity,
const QString &name,
const QStringList &newTags );
887 void symbolRemoved(
const QString &name );
894 void symbolRenamed(
const QString &oldName,
const QString &newName );
901 void rampRenamed(
const QString &oldName,
const QString &newName );
910 void rampAdded(
const QString &name );
919 void rampRemoved(
const QString &name );
929 void rampChanged(
const QString &name );
937 void textFormatRenamed(
const QString &oldName,
const QString &newName );
946 void textFormatAdded(
const QString &name );
955 void textFormatRemoved(
const QString &name );
965 void textFormatChanged(
const QString &name );
972 void labelSettingsRenamed(
const QString &oldName,
const QString &newName );
981 void labelSettingsAdded(
const QString &name );
990 void labelSettingsRemoved(
const QString &name );
1000 void labelSettingsChanged(
const QString &name );
1008 QMap<QString, QgsLegendPatchShape > mLegendPatchShapes;
1010 QHash< QgsStyle::StyleEntity, QHash< QString, QStringList > > mCachedTags;
1011 QHash< QgsStyle::StyleEntity, QHash< QString, bool > > mCachedFavorites;
1013 QString mErrorString;
1018 std::unique_ptr< QgsSymbol > mPatchMarkerSymbol;
1019 std::unique_ptr< QgsSymbol > mPatchLineSymbol;
1020 std::unique_ptr< QgsSymbol > mPatchFillSymbol;
1022 mutable QHash< QgsSymbol::SymbolType, QHash< QSizeF, QgsLegendPatchShape > > mDefaultPatchCache;
1023 mutable QHash< QgsSymbol::SymbolType, QHash< QSizeF, QList< QList< QPolygonF > > > > mDefaultPatchQPolygonFCache;
1028 bool openDatabase(
const QString &filename );
1031 bool importXml(
const QString &filename,
int sinceVersion );
1039 bool runEmptyQuery(
const QString &query );
1042 int getId(
const QString &table,
const QString &name );
1045 QString getName(
const QString &table,
int id )
const;
1055 bool updateSymbol( StyleEntity type,
const QString &name );
1057 void clearCachedTags( StyleEntity type,
const QString &name );
1060 void upgradeIfRequired();
1065 static QString entityTableName( StyleEntity type );
1070 static QString tagmapTableName( StyleEntity type );
1075 static QString tagmapEntityIdFieldName( StyleEntity type );
1091 switch ( sipCpp->type() )
1094 sipType = sipType_QgsStyleSymbolEntity;
1098 sipType = sipType_QgsStyleColorRampEntity;
1102 sipType = sipType_QgsStyleTextFormatEntity;
1106 sipType = sipType_QgsStyleLabelSettingsEntity;
1235 : mSettings( settings )