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; 4569a74367SOliver-Rainer Wittmann class SwFmtFld; 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace utl { class TransliterationWrapper; } 48cdf0e10cSrcweir namespace svt { class EmbeddedObjectRef; } 49cdf0e10cSrcweir 50cdf0e10cSrcweir /** Text operation/manipulation interface 51cdf0e10cSrcweir */ 52cdf0e10cSrcweir class IDocumentContentOperations 53cdf0e10cSrcweir { 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir enum SwMoveFlags 56cdf0e10cSrcweir { 57cdf0e10cSrcweir DOC_MOVEDEFAULT = 0x00, 58cdf0e10cSrcweir DOC_MOVEALLFLYS = 0x01, 59cdf0e10cSrcweir DOC_CREATEUNDOOBJ = 0x02, 60cdf0e10cSrcweir DOC_MOVEREDLINES = 0x04, 61cdf0e10cSrcweir DOC_NO_DELFRMS = 0x08 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // constants for inserting text 65cdf0e10cSrcweir enum InsertFlags 66cdf0e10cSrcweir { INS_DEFAULT = 0x00 // no extras 67cdf0e10cSrcweir , INS_EMPTYEXPAND = 0x01 // expand empty hints at insert position 68cdf0e10cSrcweir , INS_NOHINTEXPAND = 0x02 // do not expand any hints at insert pos 69cdf0e10cSrcweir , INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir public: 73cdf0e10cSrcweir /** Kopieren eines Bereiches im oder in ein anderes Dokument ! 74cdf0e10cSrcweir Die Position kann auch im Bereich liegen !! 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll ) const = 0; 77cdf0e10cSrcweir 78cdf0e10cSrcweir /** Loesche die Section, in der der Node steht. 79cdf0e10cSrcweir */ 80cdf0e10cSrcweir virtual void DeleteSection(SwNode* pNode) = 0; 81cdf0e10cSrcweir 82cdf0e10cSrcweir /** loeschen eines BereichesSwFlyFrmFmt 83cdf0e10cSrcweir */ 84cdf0e10cSrcweir virtual bool DeleteRange(SwPaM&) = 0; 85cdf0e10cSrcweir 86cdf0e10cSrcweir /** loeschen gesamter Absaetze 87cdf0e10cSrcweir */ 88cdf0e10cSrcweir virtual bool DelFullPara(SwPaM&) = 0; 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** complete delete of a given PaM 91cdf0e10cSrcweir 92cdf0e10cSrcweir OD 2009-08-20 #i100466# 93cdf0e10cSrcweir Add optional parameter <bForceJoinNext>, default value <false> 94cdf0e10cSrcweir Needed for hiding of deletion redlines 95cdf0e10cSrcweir */ 96cdf0e10cSrcweir virtual bool DeleteAndJoin( SwPaM&, 97cdf0e10cSrcweir const bool bForceJoinNext = false ) = 0; 98cdf0e10cSrcweir 99cdf0e10cSrcweir /** verschieben eines Bereiches 100cdf0e10cSrcweir */ 101cdf0e10cSrcweir virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0; 102cdf0e10cSrcweir 103cdf0e10cSrcweir /** verschieben ganzer Nodes 104cdf0e10cSrcweir */ 105cdf0e10cSrcweir virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0; 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** verschieben eines Bereiches 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0; 110cdf0e10cSrcweir 111cdf0e10cSrcweir /** Ueberschreiben eines Strings in einem bestehenden Textnode. 112cdf0e10cSrcweir */ 113cdf0e10cSrcweir virtual bool Overwrite(const SwPaM &rRg, const String& rStr) = 0; 114cdf0e10cSrcweir 115cdf0e10cSrcweir /** Insert string into existing text node at position rRg.Point(). 116cdf0e10cSrcweir */ 117cdf0e10cSrcweir virtual bool InsertString(const SwPaM &rRg, const String&, 118cdf0e10cSrcweir const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0; 119cdf0e10cSrcweir 120cdf0e10cSrcweir /** change text to Upper/Lower/Hiragana/Katagana/... 121cdf0e10cSrcweir */ 122cdf0e10cSrcweir virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0; 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** Einfuegen einer Grafik, Formel. Die XXXX werden kopiert. 125cdf0e10cSrcweir */ 126cdf0e10cSrcweir virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, 127cdf0e10cSrcweir const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 128cdf0e10cSrcweir 129cdf0e10cSrcweir /** 130cdf0e10cSrcweir */ 131cdf0e10cSrcweir virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet, 132cdf0e10cSrcweir const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 133cdf0e10cSrcweir 134cdf0e10cSrcweir /** austauschen einer Grafik (mit Undo) 135cdf0e10cSrcweir */ 136cdf0e10cSrcweir virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0; 137cdf0e10cSrcweir 138cdf0e10cSrcweir /** Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel 139cdf0e10cSrcweir angemeldet sein. 140cdf0e10cSrcweir */ 141*5222b95bSOliver-Rainer Wittmann virtual SwDrawFrmFmt* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) = 0; 142cdf0e10cSrcweir 143cdf0e10cSrcweir /** Einfuegen von OLE-Objecten. 144cdf0e10cSrcweir */ 145cdf0e10cSrcweir virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet, 146cdf0e10cSrcweir const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 147cdf0e10cSrcweir 148cdf0e10cSrcweir virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet, 149cdf0e10cSrcweir const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0; 150cdf0e10cSrcweir 151cdf0e10cSrcweir /** Aufspalten eines Nodes an rPos (nur fuer den TxtNode implementiert) 152cdf0e10cSrcweir */ 153cdf0e10cSrcweir virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0; 154cdf0e10cSrcweir 155cdf0e10cSrcweir /** 156cdf0e10cSrcweir */ 157cdf0e10cSrcweir virtual bool AppendTxtNode(SwPosition& rPos) = 0; 158cdf0e10cSrcweir 159cdf0e10cSrcweir /** Ersetz einen selektierten Bereich in einem TextNode mit dem 160cdf0e10cSrcweir String. Ist fuers Suchen&Ersetzen gedacht. 161cdf0e10cSrcweir bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String 162cdf0e10cSrcweir ein ( nicht \& ) 163cdf0e10cSrcweir z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&" 164cdf0e10cSrcweir --> "xx\t<Tab>..zzz..&" 165cdf0e10cSrcweir */ 166cdf0e10cSrcweir virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr, 167cdf0e10cSrcweir const bool bRegExReplace) = 0; 168cdf0e10cSrcweir 169cdf0e10cSrcweir /** Einfuegen eines Attributs. Erstreckt sich rRg ueber 170cdf0e10cSrcweir mehrere Nodes, wird das Attribut aufgespaltet, sofern 171cdf0e10cSrcweir dieses Sinn macht. Nodes, in denen dieses Attribut keinen 172cdf0e10cSrcweir Sinn macht, werden ignoriert. In vollstaendig in der 173cdf0e10cSrcweir Selektion eingeschlossenen Nodes wird das Attribut zu 174cdf0e10cSrcweir harter Formatierung, in den anderen (Text-)Nodes wird das 175cdf0e10cSrcweir Attribut in das Attributearray eingefuegt. Bei einem 176cdf0e10cSrcweir Zeichenattribut wird ein "leerer" Hint eingefuegt, 177cdf0e10cSrcweir wenn keine Selektion 178cdf0e10cSrcweir vorliegt; andernfalls wird das Attribut als harte 179cdf0e10cSrcweir Formatierung dem durch rRg.Start() bezeichneten Node 180cdf0e10cSrcweir hinzugefuegt. Wenn das Attribut nicht eingefuegt werden 181cdf0e10cSrcweir konnte, liefert die Methode sal_False. 182cdf0e10cSrcweir */ 183abbaf3ecSJian Hong Cheng //Modify here for #119405, by chengjh, 2012-08-16 184abbaf3ecSJian Hong Cheng //Add a para for the char attribute exp... 18569a74367SOliver-Rainer Wittmann virtual bool InsertPoolItem( 18669a74367SOliver-Rainer Wittmann const SwPaM &rRg, 18769a74367SOliver-Rainer Wittmann const SfxPoolItem&, 18869a74367SOliver-Rainer Wittmann const sal_uInt16 nFlags, 18969a74367SOliver-Rainer Wittmann const bool bExpandCharToPara=false ) = 0; 190abbaf3ecSJian Hong Cheng //End 191cdf0e10cSrcweir 192cdf0e10cSrcweir /** 193cdf0e10cSrcweir */ 194cdf0e10cSrcweir virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&, 195cdf0e10cSrcweir const sal_uInt16 nFlags) = 0; 196cdf0e10cSrcweir 197cdf0e10cSrcweir /** Removes any leading white space from the paragraph 198cdf0e10cSrcweir */ 199cdf0e10cSrcweir virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0; 200cdf0e10cSrcweir 201cdf0e10cSrcweir protected: ~IDocumentContentOperations()202cdf0e10cSrcweir virtual ~IDocumentContentOperations() {}; 203cdf0e10cSrcweir }; 204cdf0e10cSrcweir 205cdf0e10cSrcweir #endif // IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED 206cdf0e10cSrcweir 207