42 d->providerConnectionStore.clear();
43 d->provider = provider;
45 d->providerConnectionStore.addUniqueConnection(
d->provider, SIGNAL(sigTextPropertiesChanged()),
this, SLOT(
slotTextPropertiesChanged()));
52 d->interfaceConnectionStore.clear();
53 d->interface = interface;
66 for (
auto it = props.begin(); it != props.end(); it++) {
67 for (
int i = 0; i < propIds.size(); i++) {
69 if (it->hasProperty(
p)) {
84 QSet<KoSvgTextProperties::PropertyId> propIds;
86 for (
auto it = props.begin(); it != props.end(); it++) {
88 for (
int i = 0; i <
p.properties().size(); i++) {
89 propIds.insert(
p.properties().at(i));
96 if (!
d->interface || !
d->provider)
return;
99 if (props.isEmpty())
return;
101 QSet<KoSvgTextProperties::PropertyId> propIds =
getTristate(props);
107 d->lastSetTextData = textData;
108 d->provider->setTextPropertyData(textData);
114 if (!
d->interface || !
d->provider)
return;
116 if (
d->interface->characterPropertiesEnabled()) {
118 if (!charProps.isEmpty()) {
119 QSet<KoSvgTextProperties::PropertyId> charPropIds =
getTristate(charProps);
126 d->lastSetCharacterData = charData;
127 d->provider->setCharacterPropertyData(charData);
131 QSet<KoSvgTextProperties::PropertyId> removeProperties;
133 oldPropIds.append(oldProps.
tristate.values());
134 for (
auto it = oldPropIds.begin(); it != oldPropIds.end(); it++) {
137 removeProperties.insert(
p);
140 return removeProperties;
145 if (!
d->interface || !
d->provider)
return;
146 if (
d->lastSetTextData ==
d->provider->textPropertyData())
return;
151 QSet<KoSvgTextProperties::PropertyId> removeProperties =
removedProps(textData,
d->lastSetTextData);
153 if (newProps.
isEmpty() && removeProperties.isEmpty())
return;
154 d->interface->setPropertiesOnSelected(newProps, removeProperties);
159 if (!
d->interface || !
d->provider)
return;
160 if (!
d->interface->characterPropertiesEnabled())
return;
162 if (textData ==
d->lastSetCharacterData)
return;
165 QSet<KoSvgTextProperties::PropertyId> removeProperties =
removedProps(textData,
d->lastSetCharacterData);
167 if (newProps.
isEmpty() && removeProperties.isEmpty())
return;
168 d->interface->setCharacterPropertiesOnSelected(newProps, removeProperties);
QSet< KoSvgTextProperties::PropertyId > getTristate(QList< KoSvgTextProperties > props)
QSet< KoSvgTextProperties::PropertyId > removedProps(KoSvgTextPropertyData textData, KoSvgTextPropertyData oldProps)
KoSvgTextPropertyData textDataProperties(QList< KoSvgTextProperties > props, QSet< KoSvgTextProperties::PropertyId > propIds)
void slotCharacterInterfaceSelectionChanged()
KisTextPropertiesManager(QObject *parent=nullptr)
void setTextPropertiesInterface(KoSvgTextPropertiesInterface *interface)
setTextPropertiesInterface set the text properties interface. This should be done on tool activation....
QScopedPointer< Private > d
void slotInterfaceSelectionChanged()
void slotTextPropertiesChanged()
void setCanvasResourceProvider(KisCanvasResourceProvider *provider)
setCanvasResourceProvider set the canvas resource provider.
~KisTextPropertiesManager()
void slotCharacterPropertiesChanged()
The KoSvgTextPropertiesInterface class.
void removeProperty(PropertyId id)
QList< PropertyId > properties() const
QVariant property(PropertyId id, const QVariant &defaultValue=QVariant()) const
bool hasProperty(PropertyId id) const
KoSvgTextProperties ownProperties(const KoSvgTextProperties &parentProperties, bool keepFontSize=false) const
KoSvgTextPropertyData lastSetCharacterData
KoSvgTextPropertyData lastSetTextData
KisSignalAutoConnectionsStore interfaceConnectionStore
KisSignalAutoConnectionsStore providerConnectionStore
KisCanvasResourceProvider * provider
The KoSvgTextPropertyData struct.
KoSvgTextProperties commonProperties
The properties common between all the selected text.
QSet< KoSvgTextProperties::PropertyId > tristate
The properties that are not common (tri-state) between the selected text.
bool spanSelection
Whether we're currently selecting a span of text as opposed to editing the whole paragraph.
KoSvgTextProperties inheritedProperties
The properties that are inherited, so that widgets may be set correctly.