LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - UndoAttribute.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 8 0.0 %
Date: 2012-12-27 Functions: 0 10 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_ATTRIBUTE_HXX
      21             : #define SW_UNDO_ATTRIBUTE_HXX
      22             : 
      23             : #include <undobj.hxx>
      24             : #include <memory>
      25             : #include <svl/itemset.hxx>
      26             : #include <swtypes.hxx>
      27             : #include <calbck.hxx>
      28             : #include <set>
      29             : 
      30             : class SvxTabStopItem;
      31             : class SwFmt;
      32             : class SwFtnInfo;
      33             : class SwEndNoteInfo;
      34             : 
      35             : class SwUndoAttr : public SwUndo, private SwUndRng
      36             : {
      37             :     SfxItemSet m_AttrSet;                           // attributes for Redo
      38             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
      39             :     const ::std::auto_ptr<SwHistory> m_pHistory;    // History for Undo
      40             :     ::std::auto_ptr<SwRedlineData> m_pRedlineData;  // Redlining
      41             :     ::std::auto_ptr<SwRedlineSaveDatas> m_pRedlineSaveData;
      42             :     SAL_WNODEPRECATED_DECLARATIONS_POP
      43             :     sal_uLong m_nNodeIndex;                         // Offset: for Redlining
      44             :     const SetAttrMode m_nInsertFlags;               // insert flags
      45             : 
      46             :     void RemoveIdx( SwDoc& rDoc );
      47             : 
      48             : public:
      49             :     SwUndoAttr( const SwPaM&, const SfxItemSet &, const SetAttrMode nFlags );
      50             :     SwUndoAttr( const SwPaM&, const SfxPoolItem&, const SetAttrMode nFlags );
      51             : 
      52             :     virtual ~SwUndoAttr();
      53             : 
      54             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
      55             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
      56             :     virtual void RepeatImpl( ::sw::RepeatContext & );
      57             : 
      58             :     void SaveRedlineData( const SwPaM& rPam, sal_Bool bInsCntnt );
      59             : 
      60           0 :     SwHistory& GetHistory() { return *m_pHistory; }
      61             : };
      62             : 
      63             : class SwUndoResetAttr : public SwUndo, private SwUndRng
      64             : {
      65             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
      66             :     const ::std::auto_ptr<SwHistory> m_pHistory;
      67             :     SAL_WNODEPRECATED_DECLARATIONS_POP
      68             :     std::set<sal_uInt16> m_Ids;
      69             :     const sal_uInt16 m_nFormatId;             // Format-Id for Redo
      70             : 
      71             : public:
      72             :     SwUndoResetAttr( const SwPaM&, sal_uInt16 nFmtId );
      73             :     SwUndoResetAttr( const SwPosition&, sal_uInt16 nFmtId );
      74             : 
      75             :     virtual ~SwUndoResetAttr();
      76             : 
      77             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
      78             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
      79             :     virtual void RepeatImpl( ::sw::RepeatContext & );
      80             : 
      81             :     void SetAttrs( const std::set<sal_uInt16> &rAttrs );
      82             : 
      83           0 :     SwHistory& GetHistory() { return *m_pHistory; }
      84             : };
      85             : 
      86             : class SwUndoFmtAttr : public SwUndo
      87             : {
      88             :     friend class SwUndoDefaultAttr;
      89             :     SwFmt * m_pFmt;
      90             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
      91             :     ::std::auto_ptr<SfxItemSet> m_pOldSet;    // old attributes
      92             :     SAL_WNODEPRECATED_DECLARATIONS_POP
      93             :     sal_uLong m_nNodeIndex;
      94             :     const sal_uInt16 m_nFmtWhich;
      95             :     const bool m_bSaveDrawPt;
      96             : 
      97             :     bool IsFmtInDoc( SwDoc* );   //is the attribute format still in the Doc?
      98             :     void SaveFlyAnchor( bool bSaveDrawPt = false );
      99             :     // #i35443# - Add return value, type <bool>.
     100             :     // Return value indicates, if anchor attribute is restored.
     101             :     // Notes: - If anchor attribute is restored, all other existing attributes
     102             :     //          are also restored.
     103             :     //        - Anchor attribute isn't restored successfully, if it contains
     104             :     //          an invalid anchor position and all other existing attributes
     105             :     //          aren't restored.
     106             :     //          This situation occurs for undo of styles.
     107             :     bool RestoreFlyAnchor(::sw::UndoRedoContext & rContext);
     108             :     // --> OD 2008-02-27 #refactorlists# - removed <rAffectedItemSet>
     109             :     void Init();
     110             : 
     111             : public:
     112             :     // register at the Format and save old attributes
     113             :     // --> OD 2008-02-27 #refactorlists# - removed <rNewSet>
     114             :     SwUndoFmtAttr( const SfxItemSet& rOldSet,
     115             :                    SwFmt& rFmt,
     116             :                    bool bSaveDrawPt = true );
     117             :     SwUndoFmtAttr( const SfxPoolItem& rItem,
     118             :                    SwFmt& rFmt,
     119             :                    bool bSaveDrawPt = true );
     120             : 
     121             :     virtual ~SwUndoFmtAttr();
     122             : 
     123             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     124             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     125             :     virtual void RepeatImpl( ::sw::RepeatContext & );
     126             : 
     127             :     virtual SwRewriter GetRewriter() const;
     128             : 
     129             :     void PutAttr( const SfxPoolItem& rItem );
     130             :     SwFmt* GetFmt( SwDoc& rDoc );   // checks if it is still in the Doc!
     131             : };
     132             : 
     133             : // --> OD 2008-02-12 #newlistlevelattrs#
     134             : class SwUndoFmtResetAttr : public SwUndo
     135             : {
     136             :     public:
     137             :         SwUndoFmtResetAttr( SwFmt& rChangedFormat,
     138             :                             const sal_uInt16 nWhichId );
     139             :         ~SwUndoFmtResetAttr();
     140             : 
     141             :         virtual void UndoImpl( ::sw::UndoRedoContext & );
     142             :         virtual void RedoImpl( ::sw::UndoRedoContext & );
     143             : 
     144             :     private:
     145             :         // format at which a certain attribute is reset.
     146             :         SwFmt * const m_pChangedFormat;
     147             :         // which ID of the reset attribute
     148             :         const sal_uInt16 m_nWhichId;
     149             :         // old attribute which has been reset - needed for undo.
     150             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     151             :         ::std::auto_ptr<SfxPoolItem> m_pOldItem;
     152             :         SAL_WNODEPRECATED_DECLARATIONS_POP
     153             : };
     154             : 
     155           0 : class SwUndoDontExpandFmt : public SwUndo
     156             : {
     157             :     const sal_uLong m_nNodeIndex;
     158             :     const xub_StrLen m_nContentIndex;
     159             : 
     160             : public:
     161             :     SwUndoDontExpandFmt( const SwPosition& rPos );
     162             : 
     163             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     164             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     165             :     virtual void RepeatImpl( ::sw::RepeatContext & );
     166             : };
     167             : 
     168             : // helper class to receive changed attribute sets
     169           0 : class SwUndoFmtAttrHelper : public SwClient
     170             : {
     171             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     172             :     ::std::auto_ptr<SwUndoFmtAttr> m_pUndo;
     173             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     174             :     const bool m_bSaveDrawPt;
     175             : 
     176             : public:
     177             :     SwUndoFmtAttrHelper( SwFmt& rFmt, bool bSaveDrawPt = true );
     178             : 
     179             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
     180             : 
     181           0 :     SwUndoFmtAttr* GetUndo() const  { return m_pUndo.get(); }
     182             :     // release the undo object (so it is not deleted here), and return it
     183           0 :     SwUndoFmtAttr* ReleaseUndo()    { return m_pUndo.release(); }
     184             : };
     185             : 
     186             : class SwUndoMoveLeftMargin : public SwUndo, private SwUndRng
     187             : {
     188             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     189             :     const ::std::auto_ptr<SwHistory> m_pHistory;
     190             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     191             :     const bool m_bModulus;
     192             : 
     193             : public:
     194             :     SwUndoMoveLeftMargin( const SwPaM&, sal_Bool bRight, bool bModulus );
     195             : 
     196             :     virtual ~SwUndoMoveLeftMargin();
     197             : 
     198             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     199             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     200             :     virtual void RepeatImpl( ::sw::RepeatContext & );
     201             : 
     202           0 :     SwHistory& GetHistory() { return *m_pHistory; }
     203             : 
     204             : };
     205             : 
     206             : class SwUndoDefaultAttr : public SwUndo
     207             : {
     208             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     209             :     ::std::auto_ptr<SfxItemSet> m_pOldSet;        // the old attributes
     210             :     ::std::auto_ptr<SvxTabStopItem> m_pTabStop;
     211             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     212             : 
     213             : public:
     214             :     // registers at the format and saves old attributes
     215             :     SwUndoDefaultAttr( const SfxItemSet& rOldSet );
     216             : 
     217             :     virtual ~SwUndoDefaultAttr();
     218             : 
     219             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     220             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     221             : };
     222             : 
     223             : class SwUndoChangeFootNote : public SwUndo, private SwUndRng
     224             : {
     225             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     226             :     const ::std::auto_ptr<SwHistory> m_pHistory;
     227             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     228             :     const String m_Text;
     229             :     const sal_uInt16 m_nNumber;
     230             :     const bool m_bEndNote;
     231             : 
     232             : public:
     233             :     SwUndoChangeFootNote( const SwPaM& rRange, const String& rTxt,
     234             :                           sal_uInt16 nNum, bool bIsEndNote );
     235             :     virtual ~SwUndoChangeFootNote();
     236             : 
     237             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     238             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     239             :     virtual void RepeatImpl( ::sw::RepeatContext & );
     240             : 
     241           0 :     SwHistory& GetHistory() { return *m_pHistory; }
     242             : };
     243             : 
     244             : class SwUndoFootNoteInfo : public SwUndo
     245             : {
     246             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     247             :     ::std::auto_ptr<SwFtnInfo> m_pFootNoteInfo;
     248             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     249             : 
     250             : public:
     251             :     SwUndoFootNoteInfo( const SwFtnInfo &rInfo );
     252             : 
     253             :     virtual ~SwUndoFootNoteInfo();
     254             : 
     255             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     256             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     257             : };
     258             : 
     259             : class SwUndoEndNoteInfo : public SwUndo
     260             : {
     261             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     262             :     ::std::auto_ptr<SwEndNoteInfo> m_pEndNoteInfo;
     263             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     264             : 
     265             : public:
     266             :     SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo );
     267             : 
     268             :     virtual ~SwUndoEndNoteInfo();
     269             : 
     270             :     virtual void UndoImpl( ::sw::UndoRedoContext & );
     271             :     virtual void RedoImpl( ::sw::UndoRedoContext & );
     272             : };
     273             : 
     274             : #endif // SW_UNDO_ATTRIBUTE_HXX
     275             : 
     276             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10