LCOV - code coverage report
Current view: top level - sw/inc - IDocumentContentOperations.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
      21             : #define INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <rtl/ustring.hxx>
      25             : using rtl::OUString;
      26             : 
      27             : class SwPaM;
      28             : struct SwPosition;
      29             : class SwNode;
      30             : class SwNodeRange;
      31             : class Graphic;
      32             : class SfxItemSet;
      33             : class SfxPoolItem;
      34             : class GraphicObject;
      35             : class SdrObject;
      36             : class SwFrmFmt;
      37             : class SwDrawFrmFmt;
      38             : class SwFlyFrmFmt;
      39             : class SwNodeIndex;
      40             : class SwFmtFld;
      41             : 
      42             : namespace utl { class TransliterationWrapper; }
      43             : namespace svt { class EmbeddedObjectRef; }
      44             : 
      45             : /** Text operation/manipulation interface
      46             : */
      47        5052 : class IDocumentContentOperations
      48             : {
      49             : public:
      50             :     enum SwMoveFlags
      51             :     {
      52             :         DOC_MOVEDEFAULT = 0x00,
      53             :         DOC_MOVEALLFLYS = 0x01,
      54             :         DOC_CREATEUNDOOBJ = 0x02,
      55             :         DOC_MOVEREDLINES = 0x04,
      56             :         DOC_NO_DELFRMS = 0x08
      57             :     };
      58             : 
      59             :     // constants for inserting text
      60             :     enum InsertFlags
      61             :     {   INS_DEFAULT         = 0x00 // no extras
      62             :     ,   INS_EMPTYEXPAND     = 0x01 // expand empty hints at insert position
      63             :     ,   INS_NOHINTEXPAND    = 0x02 // do not expand any hints at insert pos
      64             :     ,   INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position
      65             :     };
      66             : 
      67             : public:
      68             :     /** Copy a selected content range to a position
      69             : 
      70             :         The position can be in the same or in an another document. It can also
      71             :         be within the range!
      72             : 
      73             :         Normally this function should work only with content nodes. But there
      74             :         is a special case used by SwDoc::Paste, which starts the SwPaM at the
      75             :         content start node. This position doesn't contain any content:
      76             : 
      77             :         @code
      78             :         SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 1 );
      79             :         @endcode
      80             : 
      81             :         This is important, because it prevents merging of the first node of
      82             :         the range into the node pointed to by \p rPos.
      83             :         As a result this keeps all properties of the first real content node,
      84             :         which is the 2nd, including the Flys and the page description. In this
      85             :         case the first (fake) node is silently dropped and all other nodes are
      86             :         just copied.
      87             : 
      88             :         @param rPam
      89             :         The source node range to copy
      90             : 
      91             :         @param rPos
      92             :         The target copy destination
      93             :      */
      94             :     virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const = 0;
      95             : 
      96             :     /** Delete section containing the node.
      97             :     */
      98             :     virtual void DeleteSection(SwNode* pNode) = 0;
      99             : 
     100             :     /** Delete a range SwFlyFrmFmt.
     101             :     */
     102             :     virtual bool DeleteRange(SwPaM&) = 0;
     103             : 
     104             :     /** Delete full paragraphs.
     105             :     */
     106             :     virtual bool DelFullPara(SwPaM&) = 0;
     107             : 
     108             :     /** complete delete of a given PaM
     109             : 
     110             :         #i100466#
     111             :         Add optional parameter <bForceJoinNext>, default value <false>
     112             :         Needed for hiding of deletion redlines
     113             :     */
     114             :     virtual bool DeleteAndJoin( SwPaM&,
     115             :         const bool bForceJoinNext = false ) = 0;
     116             : 
     117             :     virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
     118             : 
     119             :     virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
     120             : 
     121             :     /** Move a range.
     122             :     */
     123             :     virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) = 0;
     124             : 
     125             :     /** Overwrite string in an existing text node.
     126             :     */
     127             :     virtual bool Overwrite(const SwPaM &rRg, const OUString& rStr) = 0;
     128             : 
     129             :     /** Insert string into existing text node at position rRg.Point().
     130             :      */
     131             :     virtual bool InsertString(const SwPaM &rRg, const OUString&,
     132             :               const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0;
     133             : 
     134             :     /** change text to Upper/Lower/Hiragana/Katagana/...
     135             :      */
     136             :     virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
     137             : 
     138             :     /** Insert graphic or formula. The XXXX are copied.
     139             :      */
     140             :     virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic,
     141             :                         const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
     142             : 
     143             :     virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
     144             :         const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
     145             : 
     146             :     /** Transpose graphic (with undo)
     147             :      */
     148             :     virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0;
     149             : 
     150             :     /** Insert a DrawObject. The object must be already registered
     151             :         in DrawModel.
     152             :     */
     153             :     virtual SwDrawFrmFmt* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) = 0;
     154             : 
     155             :     /** Insert OLE-objects.
     156             :     */
     157             :     virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
     158             :         const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
     159             : 
     160             :     virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
     161             :                            const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
     162             : 
     163             :     /** Split a node at rPos (implemented only for TxtNode).
     164             :     */
     165             :     virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
     166             : 
     167             :     virtual bool AppendTxtNode(SwPosition& rPos) = 0;
     168             : 
     169             :     /** Replace selected range in a TxtNode with string.
     170             :         Intended for search & replace.
     171             :         bRegExpRplc - replace tabs (\\t) and insert the found string
     172             :         ( not \& ). E.g.: Find: "zzz", Replace: "xx\t\\t..&..\&"
     173             :         --> "xx\t<Tab>..zzz..&"
     174             :     */
     175             :     virtual bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
     176             :                               const bool bRegExReplace) = 0;
     177             : 
     178             :     /** Insert an attribute. If rRg spans several nodes the
     179             :         attribute is split, provided it makes sense.
     180             :         Nodes, where this attribute does not make sense are ignored.
     181             :         In nodes completely enclosed in the selection the attribute
     182             :         becomes hard-formated, in all other (text-) nodes the attribute
     183             :         is inserted into the attribute array.
     184             :         For a character attribute, in cases where no selection exists
     185             :         an "empty" hint is inserted. If there is a selection the attribute
     186             :         is hard-formated and added to the node at rRg.Start().
     187             :         If the attribute could not be inserted, the method returns
     188             :         sal_False.
     189             :     */
     190             :     virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
     191             :                                 const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0;
     192             : 
     193             :     virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
     194             :         const sal_uInt16 nFlags) = 0;
     195             : 
     196             :     /** Removes any leading white space from the paragraph
     197             :     */
     198             :     virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
     199             : 
     200             : protected:
     201        5045 :     virtual ~IDocumentContentOperations() {};
     202             : };
     203             : 
     204             : #endif // INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10