xref: /AOO41X/main/sw/inc/IDocumentContentOperations.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir  #ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
29*cdf0e10cSrcweir  #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir  #ifndef _SAL_TYPES_H_
32*cdf0e10cSrcweir  #include <sal/types.h>
33*cdf0e10cSrcweir  #endif
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir  class SwPaM;
36*cdf0e10cSrcweir  struct SwPosition;
37*cdf0e10cSrcweir  class SwNode;
38*cdf0e10cSrcweir  class SwNodeRange;
39*cdf0e10cSrcweir  class String;
40*cdf0e10cSrcweir  class Graphic;
41*cdf0e10cSrcweir  class SfxItemSet;
42*cdf0e10cSrcweir  class SfxPoolItem;
43*cdf0e10cSrcweir  class GraphicObject;
44*cdf0e10cSrcweir  class SdrObject;
45*cdf0e10cSrcweir  class SwFrmFmt;
46*cdf0e10cSrcweir  class SwDrawFrmFmt;
47*cdf0e10cSrcweir  class SwFlyFrmFmt;
48*cdf0e10cSrcweir  class SwNodeIndex;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir  namespace utl { class TransliterationWrapper; }
51*cdf0e10cSrcweir  namespace svt { class EmbeddedObjectRef; }
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir  /** Text operation/manipulation interface
54*cdf0e10cSrcweir  */
55*cdf0e10cSrcweir  class IDocumentContentOperations
56*cdf0e10cSrcweir  {
57*cdf0e10cSrcweir  public:
58*cdf0e10cSrcweir     enum SwMoveFlags
59*cdf0e10cSrcweir     {
60*cdf0e10cSrcweir         DOC_MOVEDEFAULT = 0x00,
61*cdf0e10cSrcweir         DOC_MOVEALLFLYS = 0x01,
62*cdf0e10cSrcweir         DOC_CREATEUNDOOBJ = 0x02,
63*cdf0e10cSrcweir         DOC_MOVEREDLINES = 0x04,
64*cdf0e10cSrcweir         DOC_NO_DELFRMS = 0x08
65*cdf0e10cSrcweir     };
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir     // constants for inserting text
68*cdf0e10cSrcweir     enum InsertFlags
69*cdf0e10cSrcweir     {   INS_DEFAULT         = 0x00 // no extras
70*cdf0e10cSrcweir     ,   INS_EMPTYEXPAND     = 0x01 // expand empty hints at insert position
71*cdf0e10cSrcweir     ,   INS_NOHINTEXPAND    = 0x02 // do not expand any hints at insert pos
72*cdf0e10cSrcweir     ,   INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position
73*cdf0e10cSrcweir     };
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir  public:
76*cdf0e10cSrcweir     /** Kopieren eines Bereiches im oder in ein anderes Dokument !
77*cdf0e10cSrcweir 	    Die Position kann auch im Bereich liegen !!
78*cdf0e10cSrcweir     */
79*cdf0e10cSrcweir     virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	/** Loesche die Section, in der der Node steht.
82*cdf0e10cSrcweir     */
83*cdf0e10cSrcweir 	virtual void DeleteSection(SwNode* pNode) = 0;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     /** loeschen eines BereichesSwFlyFrmFmt
86*cdf0e10cSrcweir     */
87*cdf0e10cSrcweir     virtual bool DeleteRange(SwPaM&) = 0;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir     /** loeschen gesamter Absaetze
90*cdf0e10cSrcweir     */
91*cdf0e10cSrcweir 	virtual bool DelFullPara(SwPaM&) = 0;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     /** complete delete of a given PaM
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir         OD 2009-08-20 #i100466#
96*cdf0e10cSrcweir         Add optional parameter <bForceJoinNext>, default value <false>
97*cdf0e10cSrcweir         Needed for hiding of deletion redlines
98*cdf0e10cSrcweir     */
99*cdf0e10cSrcweir     virtual bool DeleteAndJoin( SwPaM&,
100*cdf0e10cSrcweir                                 const bool bForceJoinNext = false ) = 0;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     /** verschieben eines Bereiches
103*cdf0e10cSrcweir     */
104*cdf0e10cSrcweir     virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     /** verschieben ganzer Nodes
107*cdf0e10cSrcweir     */
108*cdf0e10cSrcweir     virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     /** verschieben eines Bereiches
111*cdf0e10cSrcweir     */
112*cdf0e10cSrcweir 	virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	/** Ueberschreiben eines Strings in einem bestehenden Textnode.
115*cdf0e10cSrcweir     */
116*cdf0e10cSrcweir 	virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     /** Insert string into existing text node at position rRg.Point().
119*cdf0e10cSrcweir     */
120*cdf0e10cSrcweir     virtual bool InsertString(const SwPaM &rRg, const String&,
121*cdf0e10cSrcweir               const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 	/** change text to Upper/Lower/Hiragana/Katagana/...
124*cdf0e10cSrcweir     */
125*cdf0e10cSrcweir 	virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	/** Einfuegen einer Grafik, Formel. Die XXXX werden kopiert.
128*cdf0e10cSrcweir     */
129*cdf0e10cSrcweir 	virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
130*cdf0e10cSrcweir 						const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     /**
133*cdf0e10cSrcweir     */
134*cdf0e10cSrcweir 	virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj,	const SfxItemSet* pFlyAttrSet,
135*cdf0e10cSrcweir 						const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	/** austauschen einer Grafik (mit Undo)
138*cdf0e10cSrcweir     */
139*cdf0e10cSrcweir 	virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	/** Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel
142*cdf0e10cSrcweir 	    angemeldet sein.
143*cdf0e10cSrcweir     */
144*cdf0e10cSrcweir 	virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*) = 0;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	/** Einfuegen von OLE-Objecten.
147*cdf0e10cSrcweir     */
148*cdf0e10cSrcweir     virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
149*cdf0e10cSrcweir 						const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
152*cdf0e10cSrcweir                            const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir     /** Aufspalten eines Nodes an rPos (nur fuer den TxtNode implementiert)
155*cdf0e10cSrcweir     */
156*cdf0e10cSrcweir 	virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir     /**
159*cdf0e10cSrcweir     */
160*cdf0e10cSrcweir 	virtual bool AppendTxtNode(SwPosition& rPos) = 0;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	/** Ersetz einen selektierten Bereich in einem TextNode mit dem
163*cdf0e10cSrcweir 	    String. Ist fuers Suchen&Ersetzen gedacht.
164*cdf0e10cSrcweir         bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String
165*cdf0e10cSrcweir 				 ein ( nicht \& )
166*cdf0e10cSrcweir 	    			z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
167*cdf0e10cSrcweir 						--> "xx\t<Tab>..zzz..&"
168*cdf0e10cSrcweir     */
169*cdf0e10cSrcweir     virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
170*cdf0e10cSrcweir                               const bool bRegExReplace) = 0;
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     /** Einfuegen eines Attributs. Erstreckt sich rRg ueber
173*cdf0e10cSrcweir 	    mehrere Nodes, wird das Attribut aufgespaltet, sofern
174*cdf0e10cSrcweir         dieses Sinn macht. Nodes, in denen dieses Attribut keinen
175*cdf0e10cSrcweir         Sinn macht, werden ignoriert.  In vollstaendig in der
176*cdf0e10cSrcweir         Selektion eingeschlossenen Nodes wird das Attribut zu
177*cdf0e10cSrcweir         harter Formatierung, in den anderen (Text-)Nodes wird das
178*cdf0e10cSrcweir         Attribut in das Attributearray eingefuegt. Bei einem
179*cdf0e10cSrcweir         Zeichenattribut wird ein "leerer" Hint eingefuegt,
180*cdf0e10cSrcweir         wenn keine Selektion
181*cdf0e10cSrcweir         vorliegt; andernfalls wird das Attribut als harte
182*cdf0e10cSrcweir         Formatierung dem durch rRg.Start() bezeichneten Node
183*cdf0e10cSrcweir         hinzugefuegt.  Wenn das Attribut nicht eingefuegt werden
184*cdf0e10cSrcweir         konnte, liefert die Methode sal_False.
185*cdf0e10cSrcweir 	*/
186*cdf0e10cSrcweir     virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
187*cdf0e10cSrcweir                                 const sal_uInt16 nFlags) = 0;
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir     /**
190*cdf0e10cSrcweir     */
191*cdf0e10cSrcweir     virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
192*cdf0e10cSrcweir                                 const sal_uInt16 nFlags) = 0;
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     /** Removes any leading white space from the paragraph
195*cdf0e10cSrcweir     */
196*cdf0e10cSrcweir     virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir  protected:
199*cdf0e10cSrcweir     virtual ~IDocumentContentOperations() {};
200*cdf0e10cSrcweir };
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir #endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
203*cdf0e10cSrcweir 
204