Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / undostyl.hxx
blob49e1ab654a44f6e69242d4c2c669afbbc917eae1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_UNDOSTYL_HXX
21 #define SC_UNDOSTYL_HXX
23 #include <rsc/rscsfx.hxx>
24 #include "undobase.hxx"
26 class ScDocShell;
27 class SfxStyleSheetBase;
29 //----------------------------------------------------------------------------
31 class ScStyleSaveData
33 private:
34 OUString aName;
35 OUString aParent;
36 SfxItemSet* pItems;
38 public:
39 ScStyleSaveData();
40 ScStyleSaveData( const ScStyleSaveData& rOther );
41 ~ScStyleSaveData();
42 ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
44 void InitFromStyle( const SfxStyleSheetBase* pSource );
46 const OUString& GetName() const { return aName; }
47 const OUString& GetParent() const { return aParent; }
48 const SfxItemSet* GetItems() const { return pItems; }
51 class ScUndoModifyStyle: public ScSimpleUndo
53 private:
54 SfxStyleFamily eFamily;
55 ScStyleSaveData aOldData;
56 ScStyleSaveData aNewData;
58 static void DoChange( ScDocShell* pDocSh,
59 const OUString& rName, SfxStyleFamily eStyleFamily,
60 const ScStyleSaveData& rData );
62 public:
63 TYPEINFO();
64 ScUndoModifyStyle( ScDocShell* pDocSh,
65 SfxStyleFamily eFam,
66 const ScStyleSaveData& rOld,
67 const ScStyleSaveData& rNew );
68 virtual ~ScUndoModifyStyle();
70 virtual void Undo();
71 virtual void Redo();
72 virtual void Repeat(SfxRepeatTarget& rTarget);
73 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
75 virtual OUString GetComment() const;
78 class ScUndoApplyPageStyle: public ScSimpleUndo
80 public:
81 TYPEINFO();
82 ScUndoApplyPageStyle( ScDocShell* pDocSh, const OUString& rNewStyle );
83 virtual ~ScUndoApplyPageStyle();
85 void AddSheetAction( SCTAB nTab, const OUString& rOld );
87 virtual void Undo();
88 virtual void Redo();
89 virtual void Repeat(SfxRepeatTarget& rTarget);
90 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
92 virtual OUString GetComment() const;
94 private:
95 struct ApplyStyleEntry
97 SCTAB mnTab;
98 OUString maOldStyle;
99 explicit ApplyStyleEntry( SCTAB nTab, const OUString& rOldStyle );
101 typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
103 ApplyStyleVec maEntries;
104 OUString maNewStyle;
108 #endif
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */