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