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< KoSvgTextProperties > getCharacterProperties () 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< KoSvgTextProperties > getSelectedProperties () 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
 
DefaultTool * parent
 
QList< KoShape * > shapes
 
- Public Attributes inherited from Private
KisCanvas2 * canvas
 
int displayedFrame
 
int intendedFrame
 

Private Attributes

const QScopedPointer< Private > d
 

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 2361 of file DefaultTool.cpp.

Constructor & Destructor Documentation

◆ DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::DefaultToolTextPropertiesInterface ( DefaultTool * parent)

Definition at line 2372 of file DefaultTool.cpp.

2374 , d(new Private(parent))
2375{
2376 connect(&d->compressor, SIGNAL(timeout()), this, SIGNAL(textSelectionChanged()));
2377}
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 2379 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 2431 of file DefaultTool.cpp.

2432{
2433 return false;
2434}

◆ clearSelection()

void DefaultToolTextPropertiesInterface::clearSelection ( )

Definition at line 2456 of file DefaultTool.cpp.

2457{
2458 Q_FOREACH(KoShape *shape, d->shapes) {
2459 shape->removeShapeChangeListener(this);
2460 }
2461 d->shapes.clear();
2462}
void removeShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1163

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 2400 of file DefaultTool.cpp.

2401{
2403}

◆ 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 2405 of file DefaultTool.cpp.

◆ getSelectedProperties()

QList< KoSvgTextProperties > DefaultToolTextPropertiesInterface::getSelectedProperties ( )
overridevirtual

getSelectedProperties

Returns
all KoSvgTextProperties for the given selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2384 of file DefaultTool.cpp.

2385{
2387 if (!d->parent->selection()->hasSelection()) return props;
2388
2389 QList<KoShape*> shapes = d->shapes;
2390 for (auto it = shapes.begin(); it != shapes.end(); it++) {
2391 KoSvgTextShape *textShape = dynamic_cast<KoSvgTextShape*>(*it);
2392 if (!textShape) continue;
2393 KoSvgTextProperties p = textShape->textProperties();
2394 props.append(p);
2395 }
2396
2397 return props;
2398}
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 2436 of file DefaultTool.cpp.

2437{
2438 Q_UNUSED(pos)
2439 Q_UNUSED(anchor)
2440 d->compressor.start();
2441}

References d.

◆ notifyMarkupChanged()

void DefaultToolTextPropertiesInterface::notifyMarkupChanged ( )
overridevirtual

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2443 of file DefaultTool.cpp.

2444{
2445 d->compressor.start();
2446}

References d.

◆ notifyShapeChanged()

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

Implements KoShape::ShapeChangeListener.

Definition at line 2448 of file DefaultTool.cpp.

2449{
2450 if (type == KoShape::Deleted)
2451 d->shapes.removeAll(shape);
2452
2453 d->compressor.start();
2454}
@ Deleted
the shape was deleted
Definition KoShape.h:101

References d, and KoShape::Deleted.

◆ 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 2419 of file DefaultTool.cpp.

2420{
2421 Q_UNUSED(properties)
2422 Q_UNUSED(removeProperties)
2423 return;
2424}

◆ 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 2410 of file DefaultTool.cpp.

2411{
2412 if (d->shapes.isEmpty()) return;
2413 KUndo2Command *cmd = new KoShapeMergeTextPropertiesCommand(d->shapes, properties, removeProperties);
2414 if (cmd) {
2415 d->parent->canvas()->addCommand(cmd);
2416 }
2417}
The KoShapeMergeTextPropertiesCommand class This sets text properties on given text shapes....

References d.

◆ slotSelectionChanged

void DefaultToolTextPropertiesInterface::slotSelectionChanged ( )
slot

Definition at line 2464 of file DefaultTool.cpp.

2465{
2466 if (d->parent->updateTextContourMode()) return;
2467 Q_FOREACH(KoShape *shape, d->shapes) {
2468 if (!shape) continue;
2469 shape->removeShapeChangeListener(this);
2470 }
2471
2472 auto *textShapeGroup = d->parent->tryFetchCurrentShapeManagerOwnerTextShape();
2473
2474 if (textShapeGroup) {
2475 d->shapes = {textShapeGroup};
2476 } else {
2477 d->shapes = d->parent->canvas()->selectedShapesProxy()->selection()->selectedEditableShapes();
2478 }
2479
2480 Q_FOREACH(KoShape *shape, d->shapes) {
2481 if (!shape) continue;
2482 shape->addShapeChangeListener(this);
2483 }
2484 d->compressor.start();
2485}
void addShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1155

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 2426 of file DefaultTool.cpp.

2427{
2428 return false;
2429}

Member Data Documentation

◆ compressor

KisSignalCompressor DefaultToolTextPropertiesInterface::compressor

Definition at line 2369 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 2367 of file DefaultTool.cpp.

◆ shapes

QList<KoShape*> DefaultToolTextPropertiesInterface::shapes

Definition at line 2368 of file DefaultTool.cpp.


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