bump product version to 4.1.6.2
[LibreOffice.git] / sw / inc / IDocumentContentOperations.hxx
blob6f0bf4067b537f172ed0a56cdf1fea0062249c6f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
21 #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
23 #include <sal/types.h>
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;
40 namespace utl { class TransliterationWrapper; }
41 namespace svt { class EmbeddedObjectRef; }
43 /** Text operation/manipulation interface
45 class IDocumentContentOperations
47 public:
48 enum SwMoveFlags
50 DOC_MOVEDEFAULT = 0x00,
51 DOC_MOVEALLFLYS = 0x01,
52 DOC_CREATEUNDOOBJ = 0x02,
53 DOC_MOVEREDLINES = 0x04,
54 DOC_NO_DELFRMS = 0x08
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
65 public:
66 /** Copying of a range within or to another document.
67 The position can also be within the range!
69 virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0;
71 /** Delete section containing the node.
73 virtual void DeleteSection(SwNode* pNode) = 0;
75 /** Delete a range SwFlyFrmFmt.
77 virtual bool DeleteRange(SwPaM&) = 0;
79 /** Delete full paragraphs.
81 virtual bool DelFullPara(SwPaM&) = 0;
83 /** complete delete of a given PaM
85 #i100466#
86 Add optional parameter <bForceJoinNext>, default value <false>
87 Needed for hiding of deletion redlines
89 virtual bool DeleteAndJoin( SwPaM&,
90 const bool bForceJoinNext = false ) = 0;
92 virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
94 virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
96 /** Move a range.
98 virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0;
100 /** Overwrite string in an existing text node.
102 virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0;
104 /** Insert string into existing text node at position rRg.Point().
106 virtual bool InsertString(const SwPaM &rRg, const String&,
107 const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0;
109 /** change text to Upper/Lower/Hiragana/Katagana/...
111 virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
113 /** Insert graphic or formula. The XXXX are copied.
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;
118 virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
119 const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
121 /** Transpose graphic (with undo)
123 virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0;
125 /** Insert a DrawObject. The object must be already registered
126 in DrawModel.
128 virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*) = 0;
130 /** Insert OLE-objects.
132 virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
133 const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
135 virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
136 const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
138 /** Split a node at rPos (implemented only for TxtNode).
140 virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
142 virtual bool AppendTxtNode(SwPosition& rPos) = 0;
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..&"
150 virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
151 const bool bRegExReplace) = 0;
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.
165 virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
166 const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0;
168 virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
169 const sal_uInt16 nFlags) = 0;
171 /** Removes any leading white space from the paragraph
173 virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
175 protected:
176 virtual ~IDocumentContentOperations() {};
179 #endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */