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

Generated by: LCOV version 1.10