Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
21 : #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
22 :
23 : #include <sal/types.h>
24 :
25 : class SwPaM;
26 : struct SwPosition;
27 : class SwNode;
28 : class SwNodeRange;
29 : class String;
30 : class Graphic;
31 : class SfxItemSet;
32 : class SfxPoolItem;
33 : class GraphicObject;
34 : class SdrObject;
35 : class SwFrmFmt;
36 : class SwDrawFrmFmt;
37 : class SwFlyFrmFmt;
38 : class SwNodeIndex;
39 :
40 : namespace utl { class TransliterationWrapper; }
41 : namespace svt { class EmbeddedObjectRef; }
42 :
43 : /** Text operation/manipulation interface
44 : */
45 898 : class IDocumentContentOperations
46 : {
47 : public:
48 : enum SwMoveFlags
49 : {
50 : DOC_MOVEDEFAULT = 0x00,
51 : DOC_MOVEALLFLYS = 0x01,
52 : DOC_CREATEUNDOOBJ = 0x02,
53 : DOC_MOVEREDLINES = 0x04,
54 : DOC_NO_DELFRMS = 0x08
55 : };
56 :
57 : // constants for inserting text
58 : enum InsertFlags
59 : { INS_DEFAULT = 0x00 // no extras
60 : , INS_EMPTYEXPAND = 0x01 // expand empty hints at insert position
61 : , INS_NOHINTEXPAND = 0x02 // do not expand any hints at insert pos
62 : , INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position
63 : };
64 :
65 : public:
66 : /** Copying of a range within or to another document.
67 : The position can also be within the range!
68 : */
69 : virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0;
70 :
71 : /** Delete section containing the node.
72 : */
73 : virtual void DeleteSection(SwNode* pNode) = 0;
74 :
75 : /** Delete a range SwFlyFrmFmt.
76 : */
77 : virtual bool DeleteRange(SwPaM&) = 0;
78 :
79 : /** Delete full paragraphs.
80 : */
81 : virtual bool DelFullPara(SwPaM&) = 0;
82 :
83 : /** complete delete of a given PaM
84 :
85 : #i100466#
86 : Add optional parameter <bForceJoinNext>, default value <false>
87 : Needed for hiding of deletion redlines
88 : */
89 : virtual bool DeleteAndJoin( SwPaM&,
90 : const bool bForceJoinNext = false ) = 0;
91 :
92 : virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
93 :
94 : virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
95 :
96 : /** Move a range.
97 : */
98 : virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0;
99 :
100 : /** Overwrite string in an existing text node.
101 : */
102 : virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0;
103 :
104 : /** Insert string into existing text node at position rRg.Point().
105 : */
106 : virtual bool InsertString(const SwPaM &rRg, const String&,
107 : const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0;
108 :
109 : /** change text to Upper/Lower/Hiragana/Katagana/...
110 : */
111 : virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
112 :
113 : /** Insert graphic or formula. The XXXX are copied.
114 : */
115 : virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
116 : const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
117 :
118 : virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
119 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
120 :
121 : /** Transpose graphic (with undo)
122 : */
123 : virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0;
124 :
125 : /** Insert a DrawObject. The object must be already registered
126 : in DrawModel.
127 : */
128 : virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*) = 0;
129 :
130 : /** Insert OLE-objects.
131 : */
132 : virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
133 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
134 :
135 : virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
136 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
137 :
138 : /** Split a node at rPos (implemented only for TxtNode).
139 : */
140 : virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
141 :
142 : virtual bool AppendTxtNode(SwPosition& rPos) = 0;
143 :
144 : /** Replace selected range in a TxtNode with string.
145 : Intended for search & replace.
146 : bRegExpRplc - replace tabs (\\t) and insert the found string
147 : ( not \& ). E.g.: Find: "zzz", Replace: "xx\t\\t..&..\&"
148 : --> "xx\t<Tab>..zzz..&"
149 : */
150 : virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
151 : const bool bRegExReplace) = 0;
152 :
153 : /** Insert an attribute. If rRg spans several nodes the
154 : attribute is split, provided it makes sense.
155 : Nodes, where this attribute does not make sense are ignored.
156 : In nodes completely enclosed in the selection the attribute
157 : becomes hard-formated, in all other (text-) nodes the attribute
158 : is inserted into the attribute array.
159 : For a character attribute, in cases where no selection exists
160 : an "empty" hint is inserted. If there is a selection the attribute
161 : is hard-formated and added to the node at rRg.Start().
162 : If the attribute could not be inserted, the method returns
163 : sal_False.
164 : */
165 : virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
166 : const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0;
167 :
168 : virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
169 : const sal_uInt16 nFlags) = 0;
170 :
171 : /** Removes any leading white space from the paragraph
172 : */
173 : virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
174 :
175 : protected:
176 895 : virtual ~IDocumentContentOperations() {};
177 : };
178 :
179 : #endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|