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

Generated by: LCOV version 1.10