LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/inc - UndoInsert.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 5 40.0 %
Date: 2013-07-09 Functions: 3 5 60.0 %
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 SW_UNDO_INSERT_HXX
      21             : #define SW_UNDO_INSERT_HXX
      22             : 
      23             : #include <undobj.hxx>
      24             : #include <tools/mempool.hxx>
      25             : #include <swtypes.hxx>
      26             : #include <IDocumentContentOperations.hxx>
      27             : 
      28             : class Graphic;
      29             : class SwGrfNode;
      30             : class SwUndoDelete;
      31             : class SwUndoFmtAttr;
      32             : 
      33             : class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt
      34             : {
      35             :     /// start of Content in UndoNodes for Redo
      36             :     ::boost::scoped_ptr<SwNodeIndex> m_pUndoNodeIndex;
      37             :     String *pTxt, *pUndoTxt;
      38             :     SwRedlineData* pRedlData;
      39             :     sal_uLong nNode;
      40             :     xub_StrLen nCntnt, nLen;
      41             :     sal_Bool bIsWordDelim : 1;
      42             :     sal_Bool bIsAppend : 1;
      43             :     sal_Bool m_bWithRsid : 1;
      44             : 
      45             :     const IDocumentContentOperations::InsertFlags m_nInsertFlags;
      46             : 
      47             :     friend class SwDoc;     // eigentlich nur SwDoc::Insert( String )
      48             :     sal_Bool CanGrouping( sal_Unicode cIns );
      49             :     sal_Bool CanGrouping( const SwPosition& rPos );
      50             : 
      51             :     SwDoc * pDoc;
      52             : 
      53             :     void Init(const SwNodeIndex & rNode);
      54             :     String * GetTxtFromDoc() const;
      55             : 
      56             : public:
      57             :     SwUndoInsert( const SwNodeIndex& rNode, xub_StrLen nCntnt, xub_StrLen nLen,
      58             :                   const IDocumentContentOperations::InsertFlags nInsertFlags,
      59             :                   sal_Bool bWDelim = sal_True );
      60             :     SwUndoInsert( const SwNodeIndex& rNode );
      61             :     virtual ~SwUndoInsert();
      62             : 
      63             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
      64             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
      65             :     virtual void RepeatImpl( ::sw::RepeatContext & );
      66             : 
      67             :     /**
      68             :        Returns rewriter for this undo object.
      69             : 
      70             :        The returned rewriter has the following rule:
      71             : 
      72             :            $1 -> '<inserted text>'
      73             : 
      74             :        <inserted text> is shortened to a length of nUndoStringLength.
      75             : 
      76             :        @return rewriter for this undo object
      77             :      */
      78             :     virtual SwRewriter GetRewriter() const;
      79             : 
      80           5 :     void SetWithRsid() { m_bWithRsid = true; }
      81             : 
      82        7248 :     DECL_FIXEDMEMPOOL_NEWDEL(SwUndoInsert)
      83             : };
      84             : 
      85             : SwRewriter SW_DLLPRIVATE
      86             : MakeUndoReplaceRewriter(sal_uLong const ocurrences,
      87             :     OUString const& sOld, OUString const& sNew);
      88             : 
      89             : class SwUndoReplace
      90             :     : public SwUndo
      91             : {
      92             : public:
      93             :     SwUndoReplace(SwPaM const& rPam,
      94             :             OUString const& rInsert, bool const bRegExp);
      95             : 
      96             :     virtual ~SwUndoReplace();
      97             : 
      98             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
      99             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     100             : 
     101             :     /**
     102             :        Returns the rewriter of this undo object.
     103             : 
     104             :        If this undo object represents several replacements the
     105             :        rewriter contains the following rules:
     106             : 
     107             :            $1 -> <number of replacements>
     108             :            $2 -> occurrences of
     109             :            $3 -> <replaced text>
     110             : 
     111             :        If this undo object represents one replacement the rewriter
     112             :        contains these rules:
     113             : 
     114             :            $1 -> <replaced text>
     115             :            $2 -> "->"                   (STR_YIELDS)
     116             :            $3 -> <replacing text>
     117             : 
     118             :        @return the rewriter of this undo object
     119             :     */
     120             :     virtual SwRewriter GetRewriter() const;
     121             : 
     122             :     void SetEnd( const SwPaM& rPam );
     123             : 
     124             : private:
     125             :     class Impl;
     126             :     ::std::auto_ptr<Impl> m_pImpl;
     127             : };
     128             : 
     129             : class SwUndoReRead : public SwUndo
     130             : {
     131             :     Graphic *pGrf;
     132             :     String *pNm, *pFltr;
     133             :     sal_uLong nPos;
     134             :     sal_uInt16 nMirr;
     135             : 
     136             :     void SaveGraphicData( const SwGrfNode& );
     137             :     void SetAndSave( ::sw::UndoRedoContext & );
     138             : 
     139             : public:
     140             :     SwUndoReRead( const SwPaM& rPam, const SwGrfNode& pGrfNd );
     141             : 
     142             :     virtual ~SwUndoReRead();
     143             : 
     144             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     145             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     146             : };
     147             : 
     148             : class SwUndoInsertLabel : public SwUndo
     149             : {
     150             :     union {
     151             :         struct {
     152             :             // for NoTxtFrms
     153             :             SwUndoInsLayFmt* pUndoFly;
     154             :             SwUndoFmtAttr* pUndoAttr;
     155             :         } OBJECT;
     156             :         struct {
     157             :             // for tables or TxtFrms
     158             :             SwUndoDelete* pUndoInsNd;
     159             :             sal_uLong nNode;
     160             :         } NODE;
     161             :     };
     162             : 
     163             :     String sText;
     164             :     // #i39983# the separator is drawn with a character style
     165             :     String sSeparator;
     166             :     String sNumberSeparator;
     167             :     String sCharacterStyle;
     168             :     // #i26791# - re-store of drawing object position no longer needed
     169             :     sal_uInt16 nFldId;
     170             :     SwLabelType eType;
     171             :     sal_uInt8 nLayerId;              // for character objects
     172             :     sal_Bool bBefore        :1;
     173             :     sal_Bool bUndoKeep      :1;
     174             :     sal_Bool bCpyBrd        :1;
     175             : 
     176             : public:
     177             :     SwUndoInsertLabel( const SwLabelType eTyp, const String &rText,
     178             :     // #i39983# the separator is drawn with a character style
     179             :                         const String& rSeparator,
     180             :                         const String& rNumberSeparator, //#i61007# order of captions
     181             :                         const sal_Bool bBefore, const sal_uInt16 nId,
     182             :                         const String& rCharacterStyle,
     183             :                         const sal_Bool bCpyBrd );
     184             :     virtual ~SwUndoInsertLabel();
     185             : 
     186             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     187             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     188             :     virtual void RepeatImpl( ::sw::RepeatContext & );
     189             : 
     190             :     /**
     191             :        Returns the rewriter of this undo object.
     192             : 
     193             :        The rewriter contains this rule:
     194             : 
     195             :            $1 -> '<text of inserted label>'
     196             : 
     197             :        <text of inserted label> is shortened to nUndoStringLength
     198             :        characters.
     199             : 
     200             :        @return the rewriter of this undo object
     201             :      */
     202             :     virtual SwRewriter GetRewriter() const;
     203             : 
     204           0 :     void SetNodePos( sal_uLong nNd )
     205           0 :         { if( LTYPE_OBJECT != eType ) NODE.nNode = nNd; }
     206             : 
     207           0 :     void SetUndoKeep()  { bUndoKeep = sal_True; }
     208             :     void SetFlys( SwFrmFmt& rOldFly, SfxItemSet& rChgSet, SwFrmFmt& rNewFly );
     209             :     void SetDrawObj( sal_uInt8 nLayerId );
     210             : };
     211             : 
     212             : #endif // SW_UNDO_INSERT_HXX
     213             : 
     214             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10