21#ifndef KFORMULACOMMAND_H
22#define KFORMULACOMMAND_H
27#include <tqvaluevector.h>
32#include "kformulacontainer.h"
33#include "formulacursor.h"
35KFORMULA_NAMESPACE_BEGIN
75 static int evilDestructionCount;
92 Command(
const TQString&
name, Container* document);
101 FormulaCursor* getExecuteCursor();
107 FormulaCursor* getUnexecuteCursor();
112 void setExecuteCursor(FormulaCursor* cursor);
120 void setUnexecuteCursor(FormulaCursor* cursor);
126 FormulaCursor* getActiveCursor() {
return doc->activeCursor(); }
132 void testDirty() { doc->testDirty(); }
137 Container* getDocument()
const {
return doc; }
141 void destroyUndoCursor() {
delete undocursor; undocursor = 0; }
146 FormulaCursor::CursorData* cursordata;
151 FormulaCursor::CursorData* undocursor;
163class KFCAdd :
public Command
183 TQPtrList<BasicElement> addList;
199 Direction dir = beforeCursor);
210 TQPtrList<BasicElement> removedList;
220class KFCReplace :
public KFCAdd
241class KFCAddToken :
public Command
259 contentList.find( element )->append( content );
268 TQPtrList< BasicElement > tokenList;
273 TQPtrDict< TQPtrList< BasicElement > > contentList;
280class KFCReplaceToken :
public KFCAddToken
305class KFCSplitToken :
public KFCAddToken
330 TQPtrList< BasicElement > splitList;
369 TQPtrList<BasicElement> removedList;
390class KFCRemoveEnclosing :
public Command
393 KFCRemoveEnclosing(
Container* document, Direction dir);
394 ~KFCRemoveEnclosing();
410class KFCAddReplacing :
public Command
434class KFCAddGenericIndex :
public KFCAdd
438 KFCAddGenericIndex(
Container* document, ElementIndexPtr &index);
439 KFCAddGenericIndex(KFCAddGenericIndex
const &) =
delete;
440 KFCAddGenericIndex& operator=(KFCAddGenericIndex
const &) =
delete;
445 ElementIndexPtr index;
454class KFCAddIndex :
public KFCAddReplacing
490class FontCommand :
public Command {
506 TQPtrList<TextElement>& childrenList() {
return list; }
508 void collectChildren();
510 void parseSequences(
const TQMap<SequenceElement*, int>& parents );
518 TQPtrList<TextElement> list;
520 TQPtrList<BasicElement> elementList;
527class CharStyleCommand :
public FontCommand {
529 CharStyleCommand( CharStyle cs,
const TQString&
name,
Container* document );
536 typedef TQValueVector<CharStyle> StyleList;
546class CharFamilyCommand :
public FontCommand {
548 CharFamilyCommand( CharFamily cf,
const TQString&
name,
Container* document );
555 typedef TQValueVector<CharFamily> FamilyList;
557 FamilyList familyList;
558 CharFamily charFamily;
562KFORMULA_NAMESPACE_END
Basis of every formula element.
void addTextElement(TextElement *element)
Collects all elements that are to be modified.
void addElement(BasicElement *element)
Collects all parent elements those children are to be changend.
The element with up to four indexes in the four corners.
virtual TQString name() const=0
virtual void unexecute()=0
void addContent(BasicElement *element, BasicElement *content)
Collect content for each token.
void addToken(BasicElement *element)
Collect all tokens that are to be added.
void addElement(BasicElement *element)
Collects all elements that are to be added.
Command that is used to remove the current selection if we want to replace it with another element.
KFCRemoveSelection(Container *document, Direction dir=beforeCursor)
generic add command, default implementation do nothing
KFCRemove(Container *document, Direction dir)
generic add command, default implementation do nothing
void addCursor(FormulaCursor *cursor)
Collect cursor data that will be needed to do the stuff properly.
virtual TQString name() const
KNamedCommand(const TQString &name)
Base for all kformula commands.
PlainCommand(const TQString &name)
Sets up the command.
static int getEvilDestructionCount()
debug only.
An element that represents one char.