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