LCOV - code coverage report
Current view: top level - include/svx - svdundo.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 30 51 58.8 %
Date: 2014-11-03 Functions: 30 58 51.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_SVX_SVDUNDO_HXX
      21             : #define INCLUDED_SVX_SVDUNDO_HXX
      22             : 
      23             : #include <svl/solar.hrc>
      24             : #include <svl/undo.hxx>
      25             : #include <svl/style.hxx>
      26             : #include <tools/gen.hxx>
      27             : #include <svx/svdtypes.hxx>
      28             : #include <svx/svdsob.hxx>
      29             : #include <svx/svxdllapi.h>
      30             : 
      31             : class SfxItemSet;
      32             : class SfxStyleSheet;
      33             : class SdrView;
      34             : class SdrPageView;
      35             : class SdrModel;
      36             : class SdrObject;
      37             : class SdrPage;
      38             : class SdrObjList;
      39             : class SdrLayer;
      40             : class SdrLayerAdmin;
      41             : class SdrObjGeoData;
      42             : class OutlinerParaObject;
      43             : 
      44             : /**
      45             :  * Abstract base class (ABC) for all UndoActions of DrawingEngine
      46             :  */
      47             : 
      48             : class SVX_DLLPUBLIC SdrUndoAction : public SfxUndoAction
      49             : {
      50             : protected:
      51             :     SdrModel&                   rMod;
      52             : 
      53             : protected:
      54       16771 :     SdrUndoAction(SdrModel& rNewMod)
      55       16771 :     :   rMod(rNewMod)
      56       16771 :     {}
      57             : 
      58             : public:
      59             :     TYPEINFO_OVERRIDE();
      60             :     virtual ~SdrUndoAction();
      61             : 
      62             :     virtual bool CanRepeat(SfxRepeatTarget& rView) const SAL_OVERRIDE;
      63             :     virtual void Repeat(SfxRepeatTarget& rView) SAL_OVERRIDE;
      64             : 
      65             :     virtual OUString GetRepeatComment(SfxRepeatTarget& rView) const SAL_OVERRIDE;
      66             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const;
      67             : 
      68             :     virtual bool CanSdrRepeat(SdrView& rView) const;
      69             :     virtual void SdrRepeat(SdrView& rView);
      70             : };
      71             : 
      72             : /**
      73             :  * Aggregation of arbitrarily many UndoActions to a single UndoAction.
      74             :  * Undo() executes the single UndoActions backwards (LIFO, first the last
      75             :  * ones attached), Redo() executes the UndoActions in the order they were
      76             :  * added (FIFO).
      77             :  */
      78             : 
      79             : class SVX_DLLPUBLIC SdrUndoGroup : public SdrUndoAction
      80             : {
      81             : protected:
      82             :     std::vector<SdrUndoAction*> aBuf;
      83             : 
      84             :     // No expanded description of the Action (contains %O)
      85             :     OUString                    aComment;
      86             :     OUString                    aObjDescription;
      87             : 
      88             :     SdrRepeatFunc               eFunction;
      89             : 
      90             : public:
      91             :     SdrUndoGroup(SdrModel& rNewMod);
      92             :     virtual ~SdrUndoGroup();
      93             : 
      94             :     void Clear();
      95        1156 :     sal_uIntPtr GetActionCount() const { return aBuf.size(); }
      96         484 :     SdrUndoAction* GetAction(sal_uIntPtr nNum) const { return aBuf[nNum]; }
      97             :     void AddAction(SdrUndoAction* pAct);
      98             : 
      99         286 :     void SetComment(const OUString& rStr) { aComment=rStr; }
     100          18 :     void SetObjDescription(const OUString& rStr) { aObjDescription=rStr; }
     101             :     virtual OUString GetComment() const SAL_OVERRIDE;
     102             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     103             : 
     104             :     virtual void Undo() SAL_OVERRIDE;
     105             :     virtual void Redo() SAL_OVERRIDE;
     106             : 
     107             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     108             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     109          14 :     void SetRepeatFunction(SdrRepeatFunc eFunc) { eFunction=eFunc; }
     110             :     SdrRepeatFunc GetRepeatFunction() const { return eFunction; }
     111             : };
     112             : 
     113             : /**
     114             :  * Abstract base class for all UndoActions that handle objects.
     115             :  */
     116             : 
     117        3666 : class SVX_DLLPUBLIC SdrUndoObj : public SdrUndoAction
     118             : {
     119             : protected:
     120             :     SdrObject*                  pObj;
     121             : 
     122             : protected:
     123             :     SdrUndoObj(SdrObject& rNewObj);
     124             : 
     125             :     void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& rStr, bool bRepeat = false) const;
     126             : 
     127             :     static SAL_WARN_UNUSED_RESULT OUString GetDescriptionStringForObject( const SdrObject& _rForObject, sal_uInt16 nStrCacheID, bool bRepeat = false );
     128             : 
     129             :     // #94278# new method for evtl. PageChange at UNDO/REDO
     130             :     void ImpShowPageOfThisObject();
     131             : };
     132             : 
     133             : /**
     134             :  * Changing the object attributes.
     135             :  * Create Action right before setting the new attributes.
     136             :  * Also for StyleSheets.
     137             :  */
     138             : 
     139             : class SVX_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj
     140             : {
     141             : protected:
     142             :     SfxItemSet*                 pUndoSet;
     143             :     SfxItemSet*                 pRedoSet;
     144             :     SfxItemSet*                 pRepeatSet;
     145             : 
     146             :     // FIXME: Or should we better remember the StyleSheetNames?
     147             :     rtl::Reference< SfxStyleSheetBase > mxUndoStyleSheet;
     148             :     rtl::Reference< SfxStyleSheetBase > mxRedoStyleSheet;
     149             :     bool                        bStyleSheet;
     150             :     bool                        bHaveToTakeRedoSet;
     151             : 
     152             :     // When assigning TextItems to a drawing object with text:
     153             :     OutlinerParaObject*         pTextUndo;
     154             :     // #i8508#
     155             :     // The text rescue mechanism needs also to be implemented for redo actions.
     156             :     OutlinerParaObject*         pTextRedo;
     157             : 
     158             :     // If we have a group object:
     159             :     SdrUndoGroup*               pUndoGroup;
     160             : 
     161             :     // Helper to ensure StyleSheet is in pool (provided by SdrModel from SdrObject)
     162             :     void ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rStyleSheetPool, SfxStyleSheet& rSheet);
     163             : 
     164             : public:
     165             :     SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1 = false, bool bSaveText = false);
     166             :     virtual ~SdrUndoAttrObj();
     167             :     virtual void Undo() SAL_OVERRIDE;
     168             :     virtual void Redo() SAL_OVERRIDE;
     169             : 
     170             :     virtual OUString GetComment() const SAL_OVERRIDE;
     171             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     172             : 
     173             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     174             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     175             : };
     176             : 
     177             : /**
     178             :  * Only moving of an object.
     179             :  * Create Action right before moving.
     180             :  */
     181             : 
     182             : class SVX_DLLPUBLIC SdrUndoMoveObj : public SdrUndoObj
     183             : {
     184             : protected:
     185             :     Size                        aDistance;     // Distance by which we move
     186             : 
     187             : public:
     188           0 :     SdrUndoMoveObj(SdrObject& rNewObj): SdrUndoObj(rNewObj) {}
     189           0 :     SdrUndoMoveObj(SdrObject& rNewObj, const Size& rDist): SdrUndoObj(rNewObj),aDistance(rDist) {}
     190             :     virtual ~SdrUndoMoveObj();
     191             : 
     192             :     void SetDistance(const Size& rDist) { aDistance=rDist; }
     193             :     const Size& GetDistance() const { return aDistance; }
     194             : 
     195             :     virtual void Undo() SAL_OVERRIDE;
     196             :     virtual void Redo() SAL_OVERRIDE;
     197             : 
     198             :     virtual OUString GetComment() const SAL_OVERRIDE;
     199             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     200             : 
     201             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     202             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     203             : };
     204             : 
     205             : /**
     206             :  * Changing the geometry of an object.
     207             :  * Create Action right before the geometric transformation.
     208             :  */
     209             : 
     210             : class SVX_DLLPUBLIC SdrUndoGeoObj : public SdrUndoObj
     211             : {
     212             : protected:
     213             :     SdrObjGeoData*              pUndoGeo;
     214             :     SdrObjGeoData*              pRedoGeo;
     215             :     // If we have a group object:
     216             :     SdrUndoGroup*               pUndoGroup;
     217             : 
     218             : public:
     219             :     SdrUndoGeoObj(SdrObject& rNewObj);
     220             :     virtual ~SdrUndoGeoObj();
     221             : 
     222             :     virtual void Undo() SAL_OVERRIDE;
     223             :     virtual void Redo() SAL_OVERRIDE;
     224             : 
     225             :     virtual OUString GetComment() const SAL_OVERRIDE;
     226             : };
     227             : 
     228             : /**
     229             :  * Manipulation of an ObjList: New Object, DeleteObj, SetObjZLevel, Grouping, ...
     230             :  * Abstract base class.
     231             :  */
     232             : 
     233             : class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj {
     234             :     class ObjListListener;
     235             :     friend class ObjListListener;
     236             : 
     237             : private:
     238             :     bool                        bOwner;
     239             : 
     240             : protected:
     241             :     SdrObjList*                 pObjList;
     242             :     SdrView*                    pView;      // To be able to re-create the selection for a
     243             :     SdrPageView*                pPageView;  // for a ObjDel, Undo
     244             :     sal_uInt32                      nOrdNum;
     245             :     // It's possible that the object is re-assigned during a Undo/Redo.
     246             :     // The object is deleted in the dtor, if bOwner==TRUE
     247             :     ObjListListener*            m_pListener;
     248             : 
     249             : protected:
     250             :     SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect = false);
     251             :     virtual ~SdrUndoObjList();
     252             : 
     253             :     void SetView(SdrView* pView1, SdrPageView* pPageView1) { pView=pView1; pPageView=pPageView1; }
     254        1852 :     bool IsOwner() { return bOwner; }
     255             :     void SetOwner(bool bNew);
     256             : 
     257             : private:
     258         186 :     sal_uInt32 GetOrdNum() const { return nOrdNum;}
     259             :     void SetOrdNum(sal_uInt32 nOrdNum_);
     260             : };
     261             : 
     262             : /**
     263             :  * Removing an Object from an ObjectList.
     264             :  * To be used with corresponding Inserts within a UndoGroup.
     265             :  *
     266             :  * Create Action before removing from the ObjList.
     267             :  */
     268             : 
     269             : class SVX_DLLPUBLIC SdrUndoRemoveObj : public SdrUndoObjList
     270             : {
     271             : public:
     272        1298 :     SdrUndoRemoveObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
     273        1298 :     : SdrUndoObjList(rNewObj,bOrdNumDirect) {}
     274             : 
     275             :     virtual void Undo() SAL_OVERRIDE;
     276             :     virtual void Redo() SAL_OVERRIDE;
     277             : 
     278             :     virtual ~SdrUndoRemoveObj();
     279             : };
     280             : 
     281             : /**
     282             :  * Inserting Objects into a ObjectList.
     283             :  * Use with corresponding Removes within an UndoGroup.
     284             :  * Create Action before removal from ObjList.
     285             :  */
     286             : 
     287         888 : class SVX_DLLPUBLIC SdrUndoInsertObj : public SdrUndoObjList
     288             : {
     289             : public:
     290         554 :     SdrUndoInsertObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
     291         554 :     :   SdrUndoObjList(rNewObj,bOrdNumDirect) {}
     292             : 
     293             :     virtual void Undo() SAL_OVERRIDE;
     294             :     virtual void Redo() SAL_OVERRIDE;
     295             : };
     296             : 
     297             : /**
     298             :  * Deleting an Object.
     299             :  * Create Action before removing from ObjList.
     300             :  */
     301             : 
     302         998 : class SVX_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj
     303             : {
     304             : private:
     305             :     void TryToFlushGraphicContent();
     306             : 
     307             : public:
     308             :     SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect = false);
     309             : 
     310             :     virtual void Undo() SAL_OVERRIDE;
     311             :     virtual void Redo() SAL_OVERRIDE;
     312             : 
     313             :     virtual OUString GetComment() const SAL_OVERRIDE;
     314             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     315             : 
     316             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     317             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     318             : };
     319             : 
     320             : /**
     321             :  * Inserting a NEW Object.
     322             :  * Create Actio after insertion into the ObjList.
     323             :  */
     324             : 
     325         440 : class SVX_DLLPUBLIC SdrUndoNewObj : public SdrUndoInsertObj
     326             : {
     327             : public:
     328         220 :     SdrUndoNewObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
     329         220 :     :   SdrUndoInsertObj(rNewObj,bOrdNumDirect) {}
     330             : 
     331             :     virtual void Undo() SAL_OVERRIDE;
     332             :     virtual void Redo() SAL_OVERRIDE;
     333             : 
     334             :     virtual OUString GetComment() const SAL_OVERRIDE;
     335             : 
     336             :     static  OUString GetComment(const SdrObject& _rForObject);
     337             : };
     338             : 
     339             : /**
     340             :  * Replacing an Object.
     341             :  * Create Action before Replace in ObjList.
     342             :  */
     343             : 
     344             : class SVX_DLLPUBLIC SdrUndoReplaceObj : public SdrUndoObj
     345             : {
     346             :     bool                        bOldOwner;
     347             :     bool                        bNewOwner;
     348             : 
     349             : protected:
     350             :     SdrObjList*                 pObjList;
     351             :     sal_uInt32                      nOrdNum;
     352             :     SdrObject*                  pNewObj;
     353             : 
     354             : public:
     355             :     SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1, bool bOrdNumDirect = false);
     356             :     virtual ~SdrUndoReplaceObj();
     357             : 
     358             :     virtual void Undo() SAL_OVERRIDE;
     359             :     virtual void Redo() SAL_OVERRIDE;
     360             : 
     361          40 :     bool IsNewOwner() { return bNewOwner; }
     362             :     void SetNewOwner(bool bNew);
     363             : 
     364          40 :     bool IsOldOwner() { return bOldOwner; }
     365             :     void SetOldOwner(bool bNew);
     366             : };
     367             : 
     368             : /**
     369             :  * Copying an Object.
     370             :  * Create Action before inserting into the ObjList.
     371             :  */
     372             : 
     373           0 : class SdrUndoCopyObj : public SdrUndoNewObj
     374             : {
     375             : public:
     376           0 :     SdrUndoCopyObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
     377           0 :     :   SdrUndoNewObj(rNewObj,bOrdNumDirect) {}
     378             : 
     379             :     virtual OUString GetComment() const SAL_OVERRIDE;
     380             : };
     381             : 
     382           0 : class SdrUndoObjOrdNum : public SdrUndoObj
     383             : {
     384             : protected:
     385             :     sal_uInt32                      nOldOrdNum;
     386             :     sal_uInt32                      nNewOrdNum;
     387             : 
     388             : public:
     389             :     SdrUndoObjOrdNum(SdrObject& rNewObj, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
     390             : 
     391             :     virtual void Undo() SAL_OVERRIDE;
     392             :     virtual void Redo() SAL_OVERRIDE;
     393             : 
     394             :     virtual OUString GetComment() const SAL_OVERRIDE;
     395             : };
     396             : 
     397             : 
     398             : // #i11702#
     399             : 
     400           0 : class SVX_DLLPUBLIC SdrUndoObjectLayerChange : public SdrUndoObj
     401             : {
     402             : protected:
     403             :     SdrLayerID                  maOldLayer;
     404             :     SdrLayerID                  maNewLayer;
     405             : 
     406             : public:
     407             :     SdrUndoObjectLayerChange(SdrObject& rObj, SdrLayerID aOldLayer, SdrLayerID aNewLayer);
     408             : 
     409             :     virtual void Undo() SAL_OVERRIDE;
     410             :     virtual void Redo() SAL_OVERRIDE;
     411             : };
     412             : 
     413             : class SVX_DLLPUBLIC SdrUndoObjSetText : public SdrUndoObj
     414             : {
     415             : protected:
     416             :     OutlinerParaObject*         pOldText;
     417             :     OutlinerParaObject*         pNewText;
     418             :     bool                        bNewTextAvailable;
     419             :     bool                        bEmptyPresObj;
     420             :     sal_Int32                   mnText;
     421             : 
     422             : public:
     423             :     SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText );
     424             :     virtual ~SdrUndoObjSetText();
     425             : 
     426           0 :     bool IsDifferent() const { return pOldText!=pNewText; }
     427             :     void AfterSetText();
     428             : 
     429             :     virtual void Undo() SAL_OVERRIDE;
     430             :     virtual void Redo() SAL_OVERRIDE;
     431             : 
     432             :     virtual OUString GetComment() const SAL_OVERRIDE;
     433             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     434             : 
     435             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     436             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     437             : };
     438             : 
     439             : /**
     440             :  * Implement Title/Description Elements UI for Writer
     441             :  * text frames, graphics and embedded objects (#i73249#)
     442             :  */
     443        2168 : class SdrUndoObjStrAttr : public SdrUndoObj
     444             : {
     445             : public:
     446             :     enum ObjStrAttrType
     447             :     {
     448             :         OBJ_NAME,
     449             :         OBJ_TITLE,
     450             :         OBJ_DESCRIPTION
     451             :     };
     452             : 
     453             : protected:
     454             :     const ObjStrAttrType meObjStrAttr;
     455             :     const OUString msOldStr;
     456             :     const OUString msNewStr;
     457             : 
     458             : public:
     459             :     SdrUndoObjStrAttr( SdrObject& rNewObj,
     460             :                        const ObjStrAttrType eObjStrAttr,
     461             :                        const OUString& sOldStr,
     462             :                        const OUString& sNewStr);
     463             : 
     464             :     virtual void Undo() SAL_OVERRIDE;
     465             :     virtual void Redo() SAL_OVERRIDE;
     466             : 
     467             :     virtual OUString GetComment() const SAL_OVERRIDE;
     468             : };
     469             : 
     470             : 
     471             : /*
     472             :  * Layer
     473             :  */
     474             : 
     475             : /**
     476             :  * Abstract base class for all UndoActions that have something to do with SdrLayer.
     477             :  */
     478             : 
     479             : class SdrUndoLayer : public SdrUndoAction
     480             : {
     481             : protected:
     482             :     SdrLayer*                   pLayer;
     483             :     SdrLayerAdmin*              pLayerAdmin;
     484             :     sal_uInt16                      nNum;
     485             :     bool                        bItsMine;
     486             : 
     487             : protected:
     488             :     SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
     489             :     virtual ~SdrUndoLayer();
     490             : };
     491             : 
     492             : /**
     493             :  * Inserting a new Layer.
     494             :  * Create Action after Insertion.
     495             :  */
     496             : 
     497           0 : class SdrUndoNewLayer : public SdrUndoLayer
     498             : {
     499             : public:
     500           0 :     SdrUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
     501           0 :     : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) {}
     502             : 
     503             :     virtual void Undo() SAL_OVERRIDE;
     504             :     virtual void Redo() SAL_OVERRIDE;
     505             : 
     506             :     virtual OUString GetComment() const SAL_OVERRIDE;
     507             : };
     508             : 
     509             : /**
     510             :  * Deleting a Layer.
     511             :  * Create Action before the Remove.
     512             :  */
     513             : 
     514           4 : class SdrUndoDelLayer : public SdrUndoLayer
     515             : {
     516             : public:
     517           2 :     SdrUndoDelLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
     518           2 :     : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) { bItsMine=true; }
     519             : 
     520             :     virtual void Undo() SAL_OVERRIDE;
     521             :     virtual void Redo() SAL_OVERRIDE;
     522             : 
     523             :     virtual OUString GetComment() const SAL_OVERRIDE;
     524             : };
     525             : 
     526             : /**
     527             :  * Moving a Layer.
     528             :  * Create Action before the Move.
     529             :  */
     530             : 
     531           0 : class SdrUndoMoveLayer : public SdrUndoLayer
     532             : {
     533             :     sal_uInt16                      nNeuPos;
     534             : 
     535             : public:
     536           0 :     SdrUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
     537           0 :     :   SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel), nNeuPos(nNeuPos1) {}
     538             : 
     539             :     virtual void Undo() SAL_OVERRIDE;
     540             :     virtual void Redo() SAL_OVERRIDE;
     541             : 
     542             :     virtual OUString GetComment() const SAL_OVERRIDE;
     543             : };
     544             : 
     545             : 
     546             : /*
     547             :  * Pages
     548             :  */
     549             : 
     550             : /**
     551             :  * ABC for all UndoActions that have something to do with SdrPages.
     552             :  */
     553             : 
     554         598 : class SVX_DLLPUBLIC SdrUndoPage : public SdrUndoAction
     555             : {
     556             : protected:
     557             :     SdrPage&                    mrPage;
     558             : 
     559             : protected:
     560             :     void ImpInsertPage(sal_uInt16 nNum);
     561             :     void ImpRemovePage(sal_uInt16 nNum);
     562             :     void ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum);
     563             : 
     564             : protected:
     565             :     SdrUndoPage(SdrPage& rNewPg);
     566             : 
     567             :     void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& rStr, sal_uInt16 n=0, bool bRepeat = false) const;
     568             : };
     569             : 
     570             : /**
     571             :  * ABC for manipulation of a PageList: New Page, DeletePage, MovePage (ChangePageNum).
     572             :  */
     573             : 
     574             : class SVX_DLLPUBLIC SdrUndoPageList : public SdrUndoPage
     575             : {
     576             : protected:
     577             :     sal_uInt16                      nPageNum;
     578             : 
     579             :     // It's possible that the object is re-assigned during a Undo/Redo.
     580             :     // The Page is deleted in the dtor, if bItsMine==TRUE
     581             :     bool                        bItsMine;
     582             : 
     583             : protected:
     584             :     SdrUndoPageList(SdrPage& rNewPg);
     585             :     virtual ~SdrUndoPageList();
     586             : };
     587             : 
     588             : /**
     589             :  * Deleting a Page.
     590             :  * Create Action before removing from the List.
     591             :  */
     592             : 
     593             : class SVX_DLLPUBLIC SdrUndoDelPage : public SdrUndoPageList
     594             : {
     595             :     // When deleting a MasterPage, we remember all relations of the
     596             :     // Character Page with the MasterPage in this UndoGroup.
     597             :     SdrUndoGroup*               pUndoGroup;
     598             : 
     599             : public:
     600             :     SdrUndoDelPage(SdrPage& rNewPg);
     601             :     virtual ~SdrUndoDelPage();
     602             : 
     603             :     virtual void Undo() SAL_OVERRIDE;
     604             :     virtual void Redo() SAL_OVERRIDE;
     605             : 
     606             :     virtual OUString GetComment() const SAL_OVERRIDE;
     607             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     608             : 
     609             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     610             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     611             : };
     612             : 
     613             : /**
     614             :  * Inserting a new Page.
     615             :  * Create Action after inserting into the List.
     616             :  */
     617             : 
     618         148 : class SVX_DLLPUBLIC SdrUndoNewPage : public SdrUndoPageList
     619             : {
     620             : public:
     621          74 :     SdrUndoNewPage(SdrPage& rNewPg): SdrUndoPageList(rNewPg) {}
     622             : 
     623             :     virtual void Undo() SAL_OVERRIDE;
     624             :     virtual void Redo() SAL_OVERRIDE;
     625             : 
     626             :     virtual OUString GetComment() const SAL_OVERRIDE;
     627             : };
     628             : 
     629             : /**
     630             :  * Copying a Page.
     631             :  * Create Action after inserting into the List.
     632             :  */
     633             : 
     634           0 : class SdrUndoCopyPage : public SdrUndoNewPage
     635             : {
     636             : public:
     637           0 :     SdrUndoCopyPage(SdrPage& rNewPg): SdrUndoNewPage(rNewPg) {}
     638             : 
     639             :     virtual OUString GetComment() const SAL_OVERRIDE;
     640             :     virtual OUString GetSdrRepeatComment(SdrView& rView) const SAL_OVERRIDE;
     641             : 
     642             :     virtual void SdrRepeat(SdrView& rView) SAL_OVERRIDE;
     643             :     virtual bool CanSdrRepeat(SdrView& rView) const SAL_OVERRIDE;
     644             : };
     645             : 
     646             : /**
     647             :  * Moving a Page within the List.
     648             :  * Create Action before moving the Page.
     649             :  */
     650             : 
     651           0 : class SVX_DLLPUBLIC SdrUndoSetPageNum : public SdrUndoPage
     652             : {
     653             : protected:
     654             :     sal_uInt16                      nOldPageNum;
     655             :     sal_uInt16                      nNewPageNum;
     656             : 
     657             : public:
     658           0 :     SdrUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
     659           0 :     :   SdrUndoPage(rNewPg),nOldPageNum(nOldPageNum1),nNewPageNum(nNewPageNum1) {}
     660             : 
     661             :     virtual void Undo() SAL_OVERRIDE;
     662             :     virtual void Redo() SAL_OVERRIDE;
     663             : 
     664             :     virtual OUString GetComment() const SAL_OVERRIDE;
     665             : };
     666             : 
     667             : 
     668             : /*
     669             :  * Masterpages
     670             :  */
     671             : 
     672             : /**
     673             :  * ABC for all UndoActions that have something to do with
     674             :  * MasterPage relationships.
     675             :  */
     676             : 
     677             : class SdrUndoPageMasterPage : public SdrUndoPage
     678             : {
     679             : protected:
     680             :     bool                        mbOldHadMasterPage;
     681             :     SetOfByte                   maOldSet;
     682             :     sal_uInt16                  maOldMasterPageNumber;
     683             : 
     684             : protected:
     685             :     SdrUndoPageMasterPage(SdrPage& rChangedPage);
     686             : 
     687             : public:
     688             :     SVX_DLLPUBLIC virtual ~SdrUndoPageMasterPage();
     689             : };
     690             : 
     691             : /**
     692             :  * Removal of a MasterPage from a Character Page.
     693             :  * Create Action before removing the MasterPageDescriptor.
     694             :  */
     695             : 
     696           0 : class SdrUndoPageRemoveMasterPage : public SdrUndoPageMasterPage
     697             : {
     698             : public:
     699             :     SdrUndoPageRemoveMasterPage(SdrPage& rChangedPage);
     700             : 
     701             :     virtual void Undo() SAL_OVERRIDE;
     702             :     virtual void Redo() SAL_OVERRIDE;
     703             : 
     704             :     virtual OUString GetComment() const SAL_OVERRIDE;
     705             : };
     706             : 
     707             : /**
     708             :  * Changing the MasterPageDescriptor (e.g. change of the VisibleLayer).
     709             :  * Create Action before changing the MasterPageDescriptors.
     710             :  */
     711             : 
     712           0 : class SVX_DLLPUBLIC SdrUndoPageChangeMasterPage : public SdrUndoPageMasterPage
     713             : {
     714             : protected:
     715             :     bool                        mbNewHadMasterPage;
     716             :     SetOfByte                   maNewSet;
     717             :     sal_uInt16                  maNewMasterPageNumber;
     718             : 
     719             : public:
     720             :     SdrUndoPageChangeMasterPage(SdrPage& rChangedPage);
     721             : 
     722             :     virtual void Undo() SAL_OVERRIDE;
     723             :     virtual void Redo() SAL_OVERRIDE;
     724             : 
     725             :     virtual OUString GetComment() const SAL_OVERRIDE;
     726             : };
     727             : 
     728             : 
     729             : 
     730             : /**
     731             :  * The SdrUndoFactory can be set and retrieved from the SdrModel.
     732             :  * It is used by the drawing layer implementations to create undo actions.
     733             :  * It can be used by applications to create application specific undo actions.
     734             :  */
     735         446 : class SVX_DLLPUBLIC SdrUndoFactory
     736             : {
     737             : public:
     738             :     // Shapes
     739             :     virtual ~SdrUndoFactory();
     740             :     virtual SdrUndoAction* CreateUndoMoveObject( SdrObject& rObject );
     741             :     virtual SdrUndoAction* CreateUndoMoveObject( SdrObject& rObject, const Size& rDist );
     742             :     virtual SdrUndoAction* CreateUndoGeoObject( SdrObject& rObject );
     743             :     virtual SdrUndoAction* CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false );
     744             :     virtual SdrUndoAction* CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect = false);
     745             :     virtual SdrUndoAction* CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false);
     746             :     virtual SdrUndoAction* CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false);
     747             :     virtual SdrUndoAction* CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false);
     748             :     virtual SdrUndoAction* CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false);
     749             : 
     750             :     virtual SdrUndoAction* CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
     751             : 
     752             :     virtual SdrUndoAction* CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect = false );
     753             :     virtual SdrUndoAction* CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer );
     754             :     virtual SdrUndoAction* CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
     755             : 
     756             :     // Implement Title/Description Elements UI for Writer text frames, graphics and embedded objects (#i73249#)
     757             :     virtual SdrUndoAction* CreateUndoObjectStrAttr( SdrObject& rObject,
     758             :                                                     SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
     759             :                                                     const OUString& sOldStr,
     760             :                                                     const OUString& sNewStr );
     761             : 
     762             :     // Layer
     763             :     virtual SdrUndoAction* CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
     764             :     virtual SdrUndoAction* CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
     765             :     virtual SdrUndoAction* CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1);
     766             : 
     767             :     // Page
     768             :     virtual SdrUndoAction*  CreateUndoDeletePage(SdrPage& rPage);
     769             :     virtual SdrUndoAction* CreateUndoNewPage(SdrPage& rPage);
     770             :     virtual SdrUndoAction* CreateUndoCopyPage(SdrPage& rPage);
     771             :     virtual SdrUndoAction* CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1);
     772             : 
     773             :     // Master page
     774             :     virtual SdrUndoAction* CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage);
     775             :     virtual SdrUndoAction* CreateUndoPageChangeMasterPage(SdrPage& rChangedPage);
     776             : };
     777             : 
     778             : #endif // INCLUDED_SVX_SVDUNDO_HXX
     779             : 
     780             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10