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

Constructor & Destructor Documentation

◆ DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::DefaultToolTextPropertiesInterface ( DefaultTool * parent)

Definition at line 2366 of file DefaultTool.cpp.

2368 , d(new Private(parent))
2369{
2370 connect(&d->compressor, SIGNAL(timeout()), this, SIGNAL(textSelectionChanged()));
2371}
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 2373 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 2425 of file DefaultTool.cpp.

2426{
2427 return false;
2428}

◆ clearSelection()

void DefaultToolTextPropertiesInterface::clearSelection ( )

Definition at line 2449 of file DefaultTool.cpp.

2450{
2451 Q_FOREACH(KoShape *shape, d->shapes) {
2452 shape->removeShapeChangeListener(this);
2453 }
2454 d->shapes.clear();
2455}
void removeShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1160

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

2395{
2397}

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

◆ getSelectedProperties()

QList< KoSvgTextProperties > DefaultToolTextPropertiesInterface::getSelectedProperties ( )
overridevirtual

getSelectedProperties

Returns
all KoSvgTextProperties for the given selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2378 of file DefaultTool.cpp.

2379{
2381 if (!d->parent->selection()->hasSelection()) return props;
2382
2383 QList<KoShape*> shapes = d->shapes;
2384 for (auto it = shapes.begin(); it != shapes.end(); it++) {
2385 KoSvgTextShape *textShape = dynamic_cast<KoSvgTextShape*>(*it);
2386 if (!textShape) continue;
2387 KoSvgTextProperties p = textShape->textProperties();
2388 props.append(p);
2389 }
2390
2391 return props;
2392}
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 2430 of file DefaultTool.cpp.

2431{
2432 Q_UNUSED(pos)
2433 Q_UNUSED(anchor)
2434 d->compressor.start();
2435}

References d.

◆ notifyMarkupChanged()

void DefaultToolTextPropertiesInterface::notifyMarkupChanged ( )
overridevirtual

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2437 of file DefaultTool.cpp.

2438{
2439 d->compressor.start();
2440}

References d.

◆ notifyShapeChanged()

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

Implements KoShape::ShapeChangeListener.

Definition at line 2442 of file DefaultTool.cpp.

2443{
2444 Q_UNUSED(type)
2445 Q_UNUSED(shape)
2446 d->compressor.start();
2447}

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

2414{
2415 Q_UNUSED(properties)
2416 Q_UNUSED(removeProperties)
2417 return;
2418}

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

2405{
2406 if (d->shapes.isEmpty()) return;
2407 KUndo2Command *cmd = new KoShapeMergeTextPropertiesCommand(d->shapes, properties, removeProperties);
2408 if (cmd) {
2409 d->parent->canvas()->addCommand(cmd);
2410 }
2411}
The KoShapeMergeTextPropertiesCommand class This sets text properties on given text shapes....

References d.

◆ slotSelectionChanged

void DefaultToolTextPropertiesInterface::slotSelectionChanged ( )
slot

Definition at line 2457 of file DefaultTool.cpp.

2458{
2459 if (d->parent->updateTextContourMode()) return;
2460 Q_FOREACH(KoShape *shape, d->shapes) {
2461 if (!shape) continue;
2462 shape->removeShapeChangeListener(this);
2463 }
2464
2465 auto *textShapeGroup = d->parent->tryFetchCurrentShapeManagerOwnerTextShape();
2466
2467 if (textShapeGroup) {
2468 d->shapes = {textShapeGroup};
2469 } else {
2470 d->shapes = d->parent->canvas()->selectedShapesProxy()->selection()->selectedEditableShapes();
2471 }
2472
2473 Q_FOREACH(KoShape *shape, d->shapes) {
2474 if (!shape) continue;
2475 shape->addShapeChangeListener(this);
2476 }
2477 d->compressor.start();
2478}
void addShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1152

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

2421{
2422 return false;
2423}

Member Data Documentation

◆ compressor

KisSignalCompressor DefaultToolTextPropertiesInterface::compressor

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

◆ shapes

QList<KoShape*> DefaultToolTextPropertiesInterface::shapes

Definition at line 2362 of file DefaultTool.cpp.


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