1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: IDocumentContentOperations.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
32 #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
35 #include <sal/types.h>
53 namespace utl
{ class TransliterationWrapper
; }
54 namespace svt
{ class EmbeddedObjectRef
; }
56 /** Text operation/manipulation interface
58 class IDocumentContentOperations
63 DOC_MOVEDEFAULT
= 0x00,
64 DOC_MOVEALLFLYS
= 0x01,
65 DOC_CREATEUNDOOBJ
= 0x02,
66 DOC_MOVEREDLINES
= 0x04,
71 /** Kopieren eines Bereiches im oder in ein anderes Dokument !
72 Die Position kann auch im Bereich liegen !!
74 virtual bool Copy(SwPaM
&, SwPosition
&) const = 0;
76 /** Loesche die Section, in der der Node steht.
78 virtual void DeleteSection(SwNode
* pNode
) = 0;
80 /** loeschen eines BereichesSwFlyFrmFmt
82 virtual bool Delete(SwPaM
&) = 0;
84 /** loeschen gesamter Absaetze
86 virtual bool DelFullPara(SwPaM
&) = 0;
88 /** komplett loeschen eines Bereiches
90 virtual bool DeleteAndJoin(SwPaM
&) = 0;
92 /** verschieben eines Bereiches
94 virtual bool Move(SwPaM
&, SwPosition
&, SwMoveFlags
) = 0;
96 /** verschieben ganzer Nodes
98 virtual bool Move(SwNodeRange
&, SwNodeIndex
&, SwMoveFlags
) = 0;
100 /** verschieben eines Bereiches
102 virtual bool MoveAndJoin(SwPaM
&, SwPosition
&, SwMoveFlags
) = 0;
104 /** Ueberschreiben eines einzelnen Zeichens. rRg.Start() bezeichnet
105 den Node und die Position in dem Node, an der eingefuegt wird,
107 virtual bool Overwrite(const SwPaM
&rRg
, sal_Unicode c
) = 0;
109 /** Ueberschreiben eines Strings in einem bestehenden Textnode.
111 virtual bool Overwrite(const SwPaM
&rRg
, const String
& rStr
) = 0;
113 /** Einfuegen eines einzelnen Zeichens. rRg.Start() bezeichnet
114 den Node und die Position in dem Node, an der eingefuegt wird.
116 virtual bool Insert(const SwPaM
&rRg
, sal_Unicode c
) = 0;
118 /** Einfuegen eines Strings in einen bestehenden
119 Textnode. Der Text wird kopiert.
121 virtual bool Insert(const SwPaM
&rRg
, const String
&, bool bHintExpand
) = 0;
123 /** change text to Upper/Lower/Hiragana/Katagana/...
125 virtual void TransliterateText(const SwPaM
& rPaM
, utl::TransliterationWrapper
&) = 0;
127 /** Einfuegen einer Grafik, Formel. Die XXXX werden kopiert.
129 virtual SwFlyFrmFmt
* Insert(const SwPaM
&rRg
, const String
& rGrfName
, const String
& rFltName
, const Graphic
* pGraphic
,
130 const SfxItemSet
* pFlyAttrSet
, const SfxItemSet
* pGrfAttrSet
, SwFrmFmt
*) = 0;
134 virtual SwFlyFrmFmt
* Insert(const SwPaM
& rRg
, const GraphicObject
& rGrfObj
, const SfxItemSet
* pFlyAttrSet
,
135 const SfxItemSet
* pGrfAttrSet
, SwFrmFmt
*) = 0;
137 /** austauschen einer Grafik (mit Undo)
139 virtual void ReRead(SwPaM
&, const String
& rGrfName
, const String
& rFltName
, const Graphic
* pGraphic
, const GraphicObject
* pGrfObj
) = 0;
141 /** Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel
144 virtual SwDrawFrmFmt
* Insert(const SwPaM
&rRg
, SdrObject
& rDrawObj
, const SfxItemSet
* pFlyAttrSet
, SwFrmFmt
*) = 0;
146 /** Einfuegen von OLE-Objecten.
148 virtual SwFlyFrmFmt
* Insert(const SwPaM
&rRg
, const svt::EmbeddedObjectRef
& xObj
, const SfxItemSet
* pFlyAttrSet
,
149 const SfxItemSet
* pGrfAttrSet
, SwFrmFmt
*) = 0;
151 virtual SwFlyFrmFmt
* InsertOLE(const SwPaM
&rRg
, const String
& rObjName
, sal_Int64 nAspect
, const SfxItemSet
* pFlyAttrSet
,
152 const SfxItemSet
* pGrfAttrSet
, SwFrmFmt
*) = 0;
154 /** Aufspalten eines Nodes an rPos (nur fuer den TxtNode implementiert)
156 virtual bool SplitNode(const SwPosition
&rPos
, bool bChkTableStart
) = 0;
160 virtual bool AppendTxtNode(SwPosition
& rPos
) = 0;
162 /** Ersetz einen selektierten Bereich in einem TextNode mit dem
163 String. Ist fuers Suchen&Ersetzen gedacht.
164 bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String
166 z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&"
167 --> "xx\t<Tab>..zzz..&"
169 virtual bool Replace(SwPaM
& rPam
, const String
& rNewStr
, bool bRegExpRplc
) = 0;
171 /** Einfuegen eines Attributs. Erstreckt sich rRg ueber
172 mehrere Nodes, wird das Attribut aufgespaltet, sofern
173 dieses Sinn macht. Nodes, in denen dieses Attribut keinen
174 Sinn macht, werden ignoriert. In vollstaendig in der
175 Selektion eingeschlossenen Nodes wird das Attribut zu
176 harter Formatierung, in den anderen (Text-)Nodes wird das
177 Attribut in das Attributearray eingefuegt. Bei einem
178 Zeichenattribut wird ein "leerer" Hint eingefuegt,
180 vorliegt; andernfalls wird das Attribut als harte
181 Formatierung dem durch rRg.Start() bezeichneten Node
182 hinzugefuegt. Wenn das Attribut nicht eingefuegt werden
183 konnte, liefert die Methode sal_False.
185 virtual bool Insert(const SwPaM
&rRg
, const SfxPoolItem
&, sal_uInt16 nFlags
) = 0;
189 virtual bool Insert(const SwPaM
&rRg
, const SfxItemSet
&, sal_uInt16 nFlags
) = 0;
191 /** Removes any leading white space from the paragraph
193 virtual void RemoveLeadingWhiteSpace(const SwPosition
& rPos
) = 0;
196 virtual ~IDocumentContentOperations() {};
199 #endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED