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

void clearSelection ()
 
 DefaultToolTextPropertiesInterface (DefaultTool *parent)
 
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 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 textSelectionChanged ()
 

Detailed Description

Interface to interact with the text property manager.

Definition at line 1991 of file DefaultTool.cpp.

Constructor & Destructor Documentation

◆ DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::DefaultToolTextPropertiesInterface ( DefaultTool * parent)

Definition at line 2002 of file DefaultTool.cpp.

2004 , d(new Private(parent))
2005{
2006 connect(&d->compressor, SIGNAL(timeout()), this, SIGNAL(textSelectionChanged()));
2007}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KoSvgTextPropertiesInterface(QObject *parent=nullptr)
const QScopedPointer< Private > d

References connect(), d, and KoSvgTextPropertiesInterface::textSelectionChanged().

◆ ~DefaultToolTextPropertiesInterface()

DefaultToolTextPropertiesInterface::~DefaultToolTextPropertiesInterface ( )

Definition at line 2009 of file DefaultTool.cpp.

References clearSelection().

Member Function Documentation

◆ clearSelection()

void DefaultToolTextPropertiesInterface::clearSelection ( )

Definition at line 2067 of file DefaultTool.cpp.

2068{
2069 Q_FOREACH(KoShape *shape, d->shapes) {
2070 shape->removeShapeChangeListener(this);
2071 }
2072 d->shapes.clear();
2073}
void removeShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1368

References d, and KoShape::removeShapeChangeListener().

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

◆ getSelectedProperties()

QList< KoSvgTextProperties > DefaultToolTextPropertiesInterface::getSelectedProperties ( )
overridevirtual

getSelectedProperties

Returns
all KoSvgTextProperties for the given selection.

Implements KoSvgTextPropertiesInterface.

Definition at line 2014 of file DefaultTool.cpp.

2015{
2017 if (!d->parent->selection()->hasSelection()) return props;
2018
2019 for (auto it = d->shapes.begin(); it != d->shapes.end(); it++) {
2020 KoSvgTextShape *textShape = dynamic_cast<KoSvgTextShape*>(*it);
2021 if (!textShape) continue;
2022 KoSvgTextProperties p = textShape->textProperties();
2023 props.append(p);
2024 }
2025
2026 return props;
2027}
const Params2D p
KoSvgTextProperties textProperties() const

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

◆ notifyCursorPosChanged()

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

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2048 of file DefaultTool.cpp.

2049{
2050 Q_UNUSED(pos)
2051 Q_UNUSED(anchor)
2052 d->compressor.start();
2053}

References d.

◆ notifyMarkupChanged()

void DefaultToolTextPropertiesInterface::notifyMarkupChanged ( )
overridevirtual

Implements KoSvgTextShape::TextCursorChangeListener.

Definition at line 2055 of file DefaultTool.cpp.

2056{
2057 d->compressor.start();
2058}

References d.

◆ notifyShapeChanged()

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

Implements KoShape::ShapeChangeListener.

Definition at line 2060 of file DefaultTool.cpp.

2061{
2062 Q_UNUSED(type)
2063 Q_UNUSED(shape)
2064 d->compressor.start();
2065}

References d.

◆ Private()

DefaultToolTextPropertiesInterface::Private ( DefaultTool * parent)
inline

◆ 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.

Implements KoSvgTextPropertiesInterface.

Definition at line 2034 of file DefaultTool.cpp.

2035{
2036 if (d->shapes.isEmpty()) return;
2037 KUndo2Command *cmd = new KoShapeMergeTextPropertiesCommand(d->shapes, properties, removeProperties);
2038 if (cmd) {
2039 d->parent->canvas()->addCommand(cmd);
2040 }
2041}
The KoShapeMergeTextPropertiesCommand class This sets text properties on given text shapes....

References d.

◆ slotSelectionChanged

void DefaultToolTextPropertiesInterface::slotSelectionChanged ( )
slot

Definition at line 2075 of file DefaultTool.cpp.

2076{
2077 Q_FOREACH(KoShape *shape, d->shapes) {
2078 shape->removeShapeChangeListener(this);
2079 }
2080 QList<KoShape*> shapes = d->parent->canvas()->selectedShapesProxy()->selection()->selectedEditableShapes();
2081 d->shapes = shapes;
2082
2083 Q_FOREACH(KoShape *shape, d->shapes) {
2084 shape->addShapeChangeListener(this);
2085 }
2086 d->compressor.start();
2087}
void addShapeChangeListener(ShapeChangeListener *listener)
Definition KoShape.cpp:1360

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

◆ spanSelection()

bool DefaultToolTextPropertiesInterface::spanSelection ( )
overridevirtual

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

Implements KoSvgTextPropertiesInterface.

Definition at line 2043 of file DefaultTool.cpp.

2044{
2045 return false;
2046}

Member Data Documentation

◆ compressor

KisSignalCompressor DefaultToolTextPropertiesInterface::compressor

Definition at line 1999 of file DefaultTool.cpp.

◆ d

const QScopedPointer<Private> DefaultToolTextPropertiesInterface::d
private

Definition at line 234 of file DefaultTool.h.

◆ parent

DefaultTool* DefaultToolTextPropertiesInterface::parent

Definition at line 1997 of file DefaultTool.cpp.

◆ shapes

QList<KoShape*> DefaultToolTextPropertiesInterface::shapes

Definition at line 1998 of file DefaultTool.cpp.


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