11d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 51d2dbeb0SAndrew Rist * distributed with this work for additional information 61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 171d2dbeb0SAndrew Rist * specific language governing permissions and limitations 181d2dbeb0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED 25cdf0e10cSrcweir #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _SAL_TYPES_H_ 28cdf0e10cSrcweir #include <sal/types.h> 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir class SwPaM; 32cdf0e10cSrcweir struct SwPosition; 33cdf0e10cSrcweir class SwNode; 34cdf0e10cSrcweir class SwNodeRange; 35cdf0e10cSrcweir class String; 36cdf0e10cSrcweir class Graphic; 37cdf0e10cSrcweir class SfxItemSet; 38cdf0e10cSrcweir class SfxPoolItem; 39cdf0e10cSrcweir class GraphicObject; 40cdf0e10cSrcweir class SdrObject; 41cdf0e10cSrcweir class SwFrmFmt; 42cdf0e10cSrcweir class SwDrawFrmFmt; 43cdf0e10cSrcweir class SwFlyFrmFmt; 44cdf0e10cSrcweir class SwNodeIndex; 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace utl { class TransliterationWrapper; } 47cdf0e10cSrcweir namespace svt { class EmbeddedObjectRef; } 48cdf0e10cSrcweir 49cdf0e10cSrcweir /** Text operation/manipulation interface 50cdf0e10cSrcweir */ 51cdf0e10cSrcweir class IDocumentContentOperations 52cdf0e10cSrcweir { 53cdf0e10cSrcweir public: 54cdf0e10cSrcweir enum SwMoveFlags 55cdf0e10cSrcweir { 56cdf0e10cSrcweir DOC_MOVEDEFAULT = 0x00, 57cdf0e10cSrcweir DOC_MOVEALLFLYS = 0x01, 58cdf0e10cSrcweir DOC_CREATEUNDOOBJ = 0x02, 59cdf0e10cSrcweir DOC_MOVEREDLINES = 0x04, 60cdf0e10cSrcweir DOC_NO_DELFRMS = 0x08 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir // constants for inserting text 64cdf0e10cSrcweir enum InsertFlags 65cdf0e10cSrcweir { INS_DEFAULT = 0x00 // no extras 66cdf0e10cSrcweir , INS_EMPTYEXPAND = 0x01 // expand empty hints at insert position 67cdf0e10cSrcweir , INS_NOHINTEXPAND = 0x02 // do not expand any hints at insert pos 68cdf0e10cSrcweir , INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position 69cdf0e10cSrcweir }; 70cdf0e10cSrcweir 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir /** Kopieren eines Bereiches im oder in ein anderes Dokument ! 73cdf0e10cSrcweir Die Position kann auch im Bereich liegen !! 74cdf0e10cSrcweir */ 75cdf0e10cSrcweir virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0; 76cdf0e10cSrcweir 77cdf0e10cSrcweir /** Loesche die Section, in der der Node steht. 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir virtual void DeleteSection(SwNode* pNode) = 0; 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** loeschen eines BereichesSwFlyFrmFmt 82cdf0e10cSrcweir */ 83cdf0e10cSrcweir virtual bool DeleteRange(SwPaM&) = 0; 84cdf0e10cSrcweir 85cdf0e10cSrcweir /** loeschen gesamter Absaetze 86cdf0e10cSrcweir */ 87cdf0e10cSrcweir virtual bool DelFullPara(SwPaM&) = 0; 88cdf0e10cSrcweir 89cdf0e10cSrcweir /** complete delete of a given PaM 90cdf0e10cSrcweir 91cdf0e10cSrcweir OD 2009-08-20 #i100466# 92cdf0e10cSrcweir Add optional parameter <bForceJoinNext>, default value <false> 93cdf0e10cSrcweir Needed for hiding of deletion redlines 94cdf0e10cSrcweir */ 95cdf0e10cSrcweir virtual bool DeleteAndJoin( SwPaM&, 96cdf0e10cSrcweir const bool bForceJoinNext = false ) = 0; 97cdf0e10cSrcweir 98cdf0e10cSrcweir /** verschieben eines Bereiches 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0; 101cdf0e10cSrcweir 102cdf0e10cSrcweir /** verschieben ganzer Nodes 103cdf0e10cSrcweir */ 104cdf0e10cSrcweir virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0; 105cdf0e10cSrcweir 106cdf0e10cSrcweir /** verschieben eines Bereiches 107cdf0e10cSrcweir */ 108cdf0e10cSrcweir virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0; 109cdf0e10cSrcweir 110cdf0e10cSrcweir /** Ueberschreiben eines Strings in einem bestehenden Textnode. 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0; 113cdf0e10cSrcweir 114cdf0e10cSrcweir /** Insert string into existing text node at position rRg.Point(). 115cdf0e10cSrcweir */ 116cdf0e10cSrcweir virtual bool InsertString(const SwPaM &rRg, const String&, 117cdf0e10cSrcweir const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0; 118cdf0e10cSrcweir 119cdf0e10cSrcweir /** change text to Upper/Lower/Hiragana/Katagana/... 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0; 122cdf0e10cSrcweir 123cdf0e10cSrcweir /** Einfuegen einer Grafik, Formel. Die XXXX werden kopiert. 124cdf0e10cSrcweir */ 125cdf0e10cSrcweir virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, 126cdf0e10cSrcweir const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 127cdf0e10cSrcweir 128cdf0e10cSrcweir /** 129cdf0e10cSrcweir */ 130cdf0e10cSrcweir virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet, 131cdf0e10cSrcweir const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 132cdf0e10cSrcweir 133cdf0e10cSrcweir /** austauschen einer Grafik (mit Undo) 134cdf0e10cSrcweir */ 135cdf0e10cSrcweir virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0; 136cdf0e10cSrcweir 137cdf0e10cSrcweir /** Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel 138cdf0e10cSrcweir angemeldet sein. 139cdf0e10cSrcweir */ 140cdf0e10cSrcweir virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*) = 0; 141cdf0e10cSrcweir 142cdf0e10cSrcweir /** Einfuegen von OLE-Objecten. 143cdf0e10cSrcweir */ 144cdf0e10cSrcweir virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet, 145cdf0e10cSrcweir const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 146cdf0e10cSrcweir 147cdf0e10cSrcweir virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet, 148cdf0e10cSrcweir const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 149cdf0e10cSrcweir 150cdf0e10cSrcweir /** Aufspalten eines Nodes an rPos (nur fuer den TxtNode implementiert) 151cdf0e10cSrcweir */ 152cdf0e10cSrcweir virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0; 153cdf0e10cSrcweir 154cdf0e10cSrcweir /** 155cdf0e10cSrcweir */ 156cdf0e10cSrcweir virtual bool AppendTxtNode(SwPosition& rPos) = 0; 157cdf0e10cSrcweir 158cdf0e10cSrcweir /** Ersetz einen selektierten Bereich in einem TextNode mit dem 159cdf0e10cSrcweir String. Ist fuers Suchen&Ersetzen gedacht. 160cdf0e10cSrcweir bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String 161cdf0e10cSrcweir ein ( nicht \& ) 162cdf0e10cSrcweir z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&" 163cdf0e10cSrcweir --> "xx\t<Tab>..zzz..&" 164cdf0e10cSrcweir */ 165cdf0e10cSrcweir virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr, 166cdf0e10cSrcweir const bool bRegExReplace) = 0; 167cdf0e10cSrcweir 168cdf0e10cSrcweir /** Einfuegen eines Attributs. Erstreckt sich rRg ueber 169cdf0e10cSrcweir mehrere Nodes, wird das Attribut aufgespaltet, sofern 170cdf0e10cSrcweir dieses Sinn macht. Nodes, in denen dieses Attribut keinen 171cdf0e10cSrcweir Sinn macht, werden ignoriert. In vollstaendig in der 172cdf0e10cSrcweir Selektion eingeschlossenen Nodes wird das Attribut zu 173cdf0e10cSrcweir harter Formatierung, in den anderen (Text-)Nodes wird das 174cdf0e10cSrcweir Attribut in das Attributearray eingefuegt. Bei einem 175cdf0e10cSrcweir Zeichenattribut wird ein "leerer" Hint eingefuegt, 176cdf0e10cSrcweir wenn keine Selektion 177cdf0e10cSrcweir vorliegt; andernfalls wird das Attribut als harte 178cdf0e10cSrcweir Formatierung dem durch rRg.Start() bezeichneten Node 179cdf0e10cSrcweir hinzugefuegt. Wenn das Attribut nicht eingefuegt werden 180cdf0e10cSrcweir konnte, liefert die Methode sal_False. 181cdf0e10cSrcweir */ 182*abbaf3ecSJian Hong Cheng //Modify here for #119405, by chengjh, 2012-08-16 183*abbaf3ecSJian Hong Cheng //Add a para for the char attribute exp... 184cdf0e10cSrcweir virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, 185*abbaf3ecSJian Hong Cheng const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0; 186*abbaf3ecSJian Hong Cheng //End 187cdf0e10cSrcweir 188cdf0e10cSrcweir /** 189cdf0e10cSrcweir */ 190cdf0e10cSrcweir virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&, 191cdf0e10cSrcweir const sal_uInt16 nFlags) = 0; 192cdf0e10cSrcweir 193cdf0e10cSrcweir /** Removes any leading white space from the paragraph 194cdf0e10cSrcweir */ 195cdf0e10cSrcweir virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0; 196cdf0e10cSrcweir 197cdf0e10cSrcweir protected: 198cdf0e10cSrcweir virtual ~IDocumentContentOperations() {}; 199cdf0e10cSrcweir }; 200cdf0e10cSrcweir 201cdf0e10cSrcweir #endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED 202cdf0e10cSrcweir 203