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

Constructor & Destructor Documentation

◆ DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::DefaultToolTextPropertiesInterface ( DefaultTool * parent)

Definition at line 2369 of file DefaultTool.cpp.

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

2429{
2430 return false;
2431}

◆ clearSelection()

void DefaultToolTextPropertiesInterface::clearSelection ( )

Definition at line 2452 of file DefaultTool.cpp.

2453{
2454 Q_FOREACH(KoShape *shape, d->shapes) {
2455 shape->removeShapeChangeListener(this);
2456 }
2457 d->shapes.clear();
2458}
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 2397 of file DefaultTool.cpp.

2398{
2400}

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

◆ getSelectedProperties()

QList< KoSvgTextProperties > DefaultToolTextPropertiesInterface::getSelectedProperties ( )
overridevirtual

getSelectedProperties

Returns
all KoSvgTextProperties for the given selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2381 of file DefaultTool.cpp.

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

2434{
2435 Q_UNUSED(pos)
2436 Q_UNUSED(anchor)
2437 d->compressor.start();
2438}

References d.

◆ notifyMarkupChanged()

void DefaultToolTextPropertiesInterface::notifyMarkupChanged ( )
overridevirtual

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2440 of file DefaultTool.cpp.

2441{
2442 d->compressor.start();
2443}

References d.

◆ notifyShapeChanged()

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

Implements KoShape::ShapeChangeListener.

Definition at line 2445 of file DefaultTool.cpp.

2446{
2447 Q_UNUSED(type)
2448 Q_UNUSED(shape)
2449 d->compressor.start();
2450}

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

2417{
2418 Q_UNUSED(properties)
2419 Q_UNUSED(removeProperties)
2420 return;
2421}

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

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

References d.

◆ slotSelectionChanged

void DefaultToolTextPropertiesInterface::slotSelectionChanged ( )
slot

Definition at line 2460 of file DefaultTool.cpp.

2461{
2462 if (d->parent->updateTextContourMode()) return;
2463 Q_FOREACH(KoShape *shape, d->shapes) {
2464 if (!shape) continue;
2465 shape->removeShapeChangeListener(this);
2466 }
2467
2468 auto *textShapeGroup = d->parent->tryFetchCurrentShapeManagerOwnerTextShape();
2469
2470 if (textShapeGroup) {
2471 d->shapes = {textShapeGroup};
2472 } else {
2473 d->shapes = d->parent->canvas()->selectedShapesProxy()->selection()->selectedEditableShapes();
2474 }
2475
2476 Q_FOREACH(KoShape *shape, d->shapes) {
2477 if (!shape) continue;
2478 shape->addShapeChangeListener(this);
2479 }
2480 d->compressor.start();
2481}
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 2423 of file DefaultTool.cpp.

2424{
2425 return false;
2426}

Member Data Documentation

◆ compressor

KisSignalCompressor DefaultToolTextPropertiesInterface::compressor

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

◆ shapes

QList<KoShape*> DefaultToolTextPropertiesInterface::shapes

Definition at line 2365 of file DefaultTool.cpp.


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