Krita Source Code Documentation
Loading...
Searching...
No Matches
DefaultToolTextPropertiesInterface Class Reference

Interface to interact with the text property manager. More...

#include <DefaultTool.h>

+ Inheritance diagram for DefaultToolTextPropertiesInterface:

Public Slots

void slotSelectionChanged ()
 

Public Member Functions

virtual bool characterPropertiesEnabled () override
 Whether character selections are possible at all.
 
void clearSelection ()
 
 DefaultToolTextPropertiesInterface (DefaultTool *parent)
 
virtual QList< KoSvgTextPropertiesgetCharacterProperties () override
 getSelectedProperties
 
virtual KoSvgTextProperties getInheritedProperties () override
 getInheritedProperties The properties that should be visible when a given property isn't available in common properties. This is typically the paragraph properties.
 
virtual QList< KoSvgTextPropertiesgetSelectedProperties () override
 getSelectedProperties
 
virtual void notifyCursorPosChanged (int pos, int anchor) override
 
virtual void notifyMarkupChanged () override
 
virtual void notifyShapeChanged (KoShape::ChangeType type, KoShape *shape) override
 
 Private (DefaultTool *parent)
 
virtual void setCharacterPropertiesOnSelected (KoSvgTextProperties properties, QSet< KoSvgTextProperties::PropertyId > removeProperties=QSet< KoSvgTextProperties::PropertyId >()) override
 setCharacterPropertiesOnSelected This sets the properties for a character selection instead of the full text shape. Typically the selection of characters. The implementation is responsible for handling the undo states.
 
virtual void setPropertiesOnSelected (KoSvgTextProperties properties, QSet< KoSvgTextProperties::PropertyId > removeProperties=QSet< KoSvgTextProperties::PropertyId >()) override
 setPropertiesOnSelected This sets the properties on the selection. The implementation is responsible for handling the undo states.
 
virtual bool spanSelection () override
 Whether the tool is currently selecting a set of characters instead of whole paragraphs.
 
 ~DefaultToolTextPropertiesInterface ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KoSvgTextPropertiesInterface
 KoSvgTextPropertiesInterface (QObject *parent=nullptr)
 
- Public Member Functions inherited from KoSvgTextShape::TextCursorChangeListener
void notifyShapeChanged (ChangeType type, KoShape *shape) override
 
- Public Member Functions inherited from KoShape::ShapeChangeListener
virtual ~ShapeChangeListener ()
 

Public Attributes

KisSignalCompressor compressor
 
DefaultToolparent
 
QList< KoShape * > shapes
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Private Attributes

const QScopedPointer< Privated
 

Additional Inherited Members

- Signals inherited from KoSvgTextPropertiesInterface
void textCharacterSelectionChanged ()
 
void textSelectionChanged ()
 Emit to signal to KisTextPropertiesManager to call getSelectedProperties.
 

Detailed Description

Interface to interact with the text property manager.

Definition at line 2331 of file DefaultTool.cpp.

Constructor & Destructor Documentation

◆ DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::DefaultToolTextPropertiesInterface ( DefaultTool * parent)

Definition at line 2342 of file DefaultTool.cpp.

2344 , d(new Private(parent))
2345{
2346 connect(&d->compressor, SIGNAL(timeout()), this, SIGNAL(textSelectionChanged()));
2347}
void textSelectionChanged()
Emit to signal to KisTextPropertiesManager to call getSelectedProperties.
KoSvgTextPropertiesInterface(QObject *parent=nullptr)
const QScopedPointer< Private > d

References d, and KoSvgTextPropertiesInterface::textSelectionChanged().

◆ ~DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::~DefaultToolTextPropertiesInterface ( )

Definition at line 2349 of file DefaultTool.cpp.

References clearSelection().

Member Function Documentation

◆ characterPropertiesEnabled()

bool DefaultToolTextPropertiesInterface::characterPropertiesEnabled ( )
overridevirtual

Whether character selections are possible at all.

Implements KoSvgTextPropertiesInterface.

Definition at line 2401 of file DefaultTool.cpp.

2402{
2403 return false;
2404}

◆ clearSelection()

void DefaultToolTextPropertiesInterface::clearSelection ( )

Definition at line 2425 of file DefaultTool.cpp.

2426{
2427 Q_FOREACH(KoShape *shape, d->shapes) {
2428 shape->removeShapeChangeListener(this);
2429 }
2430 d->shapes.clear();
2431}
void removeShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1165

References d, and KoShape::removeShapeChangeListener().

◆ getCharacterProperties()

QList< KoSvgTextProperties > DefaultToolTextPropertiesInterface::getCharacterProperties ( )
overridevirtual

getSelectedProperties

Returns
all KoSvgTextProperties for the given character selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2370 of file DefaultTool.cpp.

2371{
2373}

◆ getInheritedProperties()

KoSvgTextProperties DefaultToolTextPropertiesInterface::getInheritedProperties ( )
overridevirtual

getInheritedProperties The properties that should be visible when a given property isn't available in common properties. This is typically the paragraph properties.

Returns
what counts as the inherited properties for the given selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2375 of file DefaultTool.cpp.

◆ getSelectedProperties()

QList< KoSvgTextProperties > DefaultToolTextPropertiesInterface::getSelectedProperties ( )
overridevirtual

getSelectedProperties

Returns
all KoSvgTextProperties for the given selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2354 of file DefaultTool.cpp.

2355{
2357 if (!d->parent->selection()->hasSelection()) return props;
2358
2359 QList<KoShape*> shapes = d->shapes;
2360 for (auto it = shapes.begin(); it != shapes.end(); it++) {
2361 KoSvgTextShape *textShape = dynamic_cast<KoSvgTextShape*>(*it);
2362 if (!textShape) continue;
2363 KoSvgTextProperties p = textShape->textProperties();
2364 props.append(p);
2365 }
2366
2367 return props;
2368}
const Params2D p
KoSvgTextProperties textProperties() const

References d, p, shapes, and KoSvgTextShape::textProperties().

◆ notifyCursorPosChanged()

void DefaultToolTextPropertiesInterface::notifyCursorPosChanged ( int pos,
int anchor )
overridevirtual

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2406 of file DefaultTool.cpp.

2407{
2408 Q_UNUSED(pos)
2409 Q_UNUSED(anchor)
2410 d->compressor.start();
2411}

References d.

◆ notifyMarkupChanged()

void DefaultToolTextPropertiesInterface::notifyMarkupChanged ( )
overridevirtual

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2413 of file DefaultTool.cpp.

2414{
2415 d->compressor.start();
2416}

References d.

◆ notifyShapeChanged()

void DefaultToolTextPropertiesInterface::notifyShapeChanged ( KoShape::ChangeType type,
KoShape * shape )
overridevirtual

Implements KoShape::ShapeChangeListener.

Definition at line 2418 of file DefaultTool.cpp.

2419{
2420 Q_UNUSED(type)
2421 Q_UNUSED(shape)
2422 d->compressor.start();
2423}

References d.

◆ Private()

DefaultToolTextPropertiesInterface::Private ( DefaultTool * parent)
inline

◆ setCharacterPropertiesOnSelected()

void DefaultToolTextPropertiesInterface::setCharacterPropertiesOnSelected ( KoSvgTextProperties properties,
QSet< KoSvgTextProperties::PropertyId > removeProperties = QSet< KoSvgTextProperties::PropertyId >() )
overridevirtual

setCharacterPropertiesOnSelected This sets the properties for a character selection instead of the full text shape. Typically the selection of characters. The implementation is responsible for handling the undo states.

Parameters
properties– the properties to set.
removeProperties– properties to remove.

Implements KoSvgTextPropertiesInterface.

Definition at line 2389 of file DefaultTool.cpp.

2390{
2391 Q_UNUSED(properties)
2392 Q_UNUSED(removeProperties)
2393 return;
2394}

◆ setPropertiesOnSelected()

void DefaultToolTextPropertiesInterface::setPropertiesOnSelected ( KoSvgTextProperties properties,
QSet< KoSvgTextProperties::PropertyId > removeProperties = QSet< KoSvgTextProperties::PropertyId >() )
overridevirtual

setPropertiesOnSelected This sets the properties on the selection. The implementation is responsible for handling the undo states.

Parameters
properties– the properties to set.
removeProperties– properties to remove.

Implements KoSvgTextPropertiesInterface.

Definition at line 2380 of file DefaultTool.cpp.

2381{
2382 if (d->shapes.isEmpty()) return;
2383 KUndo2Command *cmd = new KoShapeMergeTextPropertiesCommand(d->shapes, properties, removeProperties);
2384 if (cmd) {
2385 d->parent->canvas()->addCommand(cmd);
2386 }
2387}
The KoShapeMergeTextPropertiesCommand class This sets text properties on given text shapes....

References d.

◆ slotSelectionChanged

void DefaultToolTextPropertiesInterface::slotSelectionChanged ( )
slot

Definition at line 2433 of file DefaultTool.cpp.

2434{
2435 if (d->parent->updateTextContourMode()) return;
2436 Q_FOREACH(KoShape *shape, d->shapes) {
2437 if (!shape) continue;
2438 shape->removeShapeChangeListener(this);
2439 }
2440
2441 auto *textShapeGroup = d->parent->tryFetchCurrentShapeManagerOwnerTextShape();
2442
2443 if (textShapeGroup) {
2444 d->shapes = {textShapeGroup};
2445 } else {
2446 d->shapes = d->parent->canvas()->selectedShapesProxy()->selection()->selectedEditableShapes();
2447 }
2448
2449 Q_FOREACH(KoShape *shape, d->shapes) {
2450 if (!shape) continue;
2451 shape->addShapeChangeListener(this);
2452 }
2453 d->compressor.start();
2454}
void addShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1157

References KoShape::addShapeChangeListener(), d, and KoShape::removeShapeChangeListener().

◆ spanSelection()

bool DefaultToolTextPropertiesInterface::spanSelection ( )
overridevirtual

Whether the tool is currently selecting a set of characters instead of whole paragraphs.

Implements KoSvgTextPropertiesInterface.

Definition at line 2396 of file DefaultTool.cpp.

2397{
2398 return false;
2399}

Member Data Documentation

◆ compressor

KisSignalCompressor DefaultToolTextPropertiesInterface::compressor

Definition at line 2339 of file DefaultTool.cpp.

◆ d

const QScopedPointer<Private> DefaultToolTextPropertiesInterface::d
private

Definition at line 249 of file DefaultTool.h.

◆ parent

DefaultTool* DefaultToolTextPropertiesInterface::parent

Definition at line 2337 of file DefaultTool.cpp.

◆ shapes

QList<KoShape*> DefaultToolTextPropertiesInterface::shapes

Definition at line 2338 of file DefaultTool.cpp.


The documentation for this class was generated from the following files: