1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Defines atomic action performed on NoteCase document
7
// (base for Undo/Redo framework)
8
////////////////////////////////////////////////////////////////////////////
15
#endif // _MSC_VER > 1000
17
#include "lib/DocActionBase.h"
18
#include "lib/NoteDocument.h"
21
#pragma warning(disable: 4786)
25
//TOFIX separate class for each action?
27
//define all atomic actions in document editing
28
#define ACT_UNDEFINED 0
29
#define ACT_TEXT_INSERT 1
30
#define ACT_TEXT_DELETE 2
31
#define ACT_NODE_INSERT 3
32
#define ACT_NODE_RENAME 4
33
#define ACT_TREE_DELETE 5 //delete branch of nodes
34
#define ACT_TREE_MOVE 6 //move branch of nodes
35
#define ACT_TREE_IMPORT 7 //multiple nodes inserted
36
#define ACT_TREE_DND 8 //drag and drop (move branch of nodes) TOFIX merge with ACT_TREE_MOVE algorithm
37
#define ACT_TEXT_REPLACE 9 //replace text operation
38
#define ACT_TEXT_LINK_ADD 10
39
#define ACT_TEXT_LINK_REMOVE 11
41
//define move directions
48
class DocAction : public DocActionBase
54
virtual void Exec(bool bInteractive = false);
56
//virtual void std::string GetDescription();
58
void SetType(int nType){ m_nType = nType; }
59
int GetType(){ return m_nType; }
67
void DoNodeUnrename();
71
void DoTreeUnimport();
72
void DoTreeDND(bool bForward = false);
74
void DoTextUnreplace();
77
void DoTreeFinished();
78
void DoTreeUnfinished();
81
int m_nType; //type of action, see defines above
87
std::string m_strNodeText; //store inserted/deleted text
88
int m_nTextStartPos; //text offset inside the node
89
bool m_bSelected; //was text in case selected
91
//additional data for node text deleting
92
std::vector<PixInfo> m_lstPictures;
93
std::vector<FmtInfo> m_lstFmt;
94
LinkInfoList m_lstLinks;
96
// node renaming/inserting/deleting
97
int m_nNodeIndex; //node position (placement)
98
int m_nNodeSibling; //sibling index (index in the )
99
int m_nNodeID; //node ID
100
int m_nNodePID; //node ID
101
std::string m_strNodeNameNew; //store new node name (for rename/redo only)
102
std::string m_strNodeNameOld; //store old node name (for rename/undo only)
105
std::string m_strFind; //
106
std::string m_strReplace; //
110
//additional data for node moving
111
int m_nMoveDirection;
115
int m_nNodeNewPID; //node position (placement)
116
int m_nNodeNewSibling; //sibling index (index in the )
120
std::string m_strLinkTitle;
121
std::string m_strLinkUrl;
124
NoteDocument m_objSubTree; //when working with nodes
127
#endif // DOCACTION_H_
1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Defines atomic action performed on NoteCase document
7
// (base for Undo/Redo framework)
8
////////////////////////////////////////////////////////////////////////////
15
#endif // _MSC_VER > 1000
17
#include "lib/DocActionBase.h"
18
#include "lib/NoteDocument.h"
21
#pragma warning(disable: 4786)
25
//TOFIX separate class for each action?
27
//define all atomic actions in document editing
28
#define ACT_UNDEFINED 0
29
#define ACT_TEXT_INSERT 1
30
#define ACT_TEXT_DELETE 2
31
#define ACT_NODE_INSERT 3
32
#define ACT_NODE_RENAME 4
33
#define ACT_TREE_DELETE 5 //delete branch of nodes
34
#define ACT_TREE_MOVE 6 //move branch of nodes
35
#define ACT_TREE_IMPORT 7 //multiple nodes inserted
36
#define ACT_TREE_DND 8 //drag and drop (move branch of nodes) TOFIX merge with ACT_TREE_MOVE algorithm
37
#define ACT_TEXT_REPLACE 9 //replace text operation
38
#define ACT_TEXT_LINK_ADD 10
39
#define ACT_TEXT_LINK_REMOVE 11
41
//define move directions
48
class DocAction : public DocActionBase
54
virtual void Exec(bool bInteractive = false);
56
//virtual void std::string GetDescription();
58
void SetType(int nType){ m_nType = nType; }
59
int GetType(){ return m_nType; }
67
void DoNodeUnrename();
71
void DoTreeUnimport();
72
void DoTreeDND(bool bForward = false);
74
void DoTextUnreplace();
77
void DoTreeFinished();
78
void DoTreeUnfinished();
81
int m_nType; //type of action, see defines above
87
std::string m_strNodeText; //store inserted/deleted text
88
int m_nTextStartPos; //text offset inside the node
89
bool m_bSelected; //was text in case selected
91
//additional data for node text deleting
92
std::vector<PixInfo> m_lstPictures;
93
std::vector<FmtInfo> m_lstFmt;
94
LinkInfoList m_lstLinks;
96
// node renaming/inserting/deleting
97
int m_nNodeIndex; //node position (placement)
98
int m_nNodeSibling; //sibling index (index in the )
99
int m_nNodeID; //node ID
100
int m_nNodePID; //node ID
101
std::string m_strNodeNameNew; //store new node name (for rename/redo only)
102
std::string m_strNodeNameOld; //store old node name (for rename/undo only)
105
std::string m_strFind; //
106
std::string m_strReplace; //
110
//additional data for node moving
111
int m_nMoveDirection;
115
int m_nNodeNewPID; //node position (placement)
116
int m_nNodeNewSibling; //sibling index (index in the )
120
std::string m_strLinkTitle;
121
std::string m_strLinkUrl;
124
NoteDocument m_objSubTree; //when working with nodes
127
#endif // DOCACTION_H_