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