Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_UNDOSTYL_HXX
30 : : #define SC_UNDOSTYL_HXX
31 : :
32 : : #include <rsc/rscsfx.hxx>
33 : : #include "undobase.hxx"
34 : :
35 : : class ScDocShell;
36 : : class SfxStyleSheetBase;
37 : :
38 : : //----------------------------------------------------------------------------
39 : :
40 : : class ScStyleSaveData
41 : : {
42 : : private:
43 : : String aName;
44 : : String aParent;
45 : : SfxItemSet* pItems;
46 : :
47 : : public:
48 : : ScStyleSaveData();
49 : : ScStyleSaveData( const ScStyleSaveData& rOther );
50 : : ~ScStyleSaveData();
51 : : ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
52 : :
53 : : void InitFromStyle( const SfxStyleSheetBase* pSource );
54 : :
55 : 0 : const String& GetName() const { return aName; }
56 : 0 : const String& GetParent() const { return aParent; }
57 : 0 : const SfxItemSet* GetItems() const { return pItems; }
58 : : };
59 : :
60 : : class ScUndoModifyStyle: public ScSimpleUndo
61 : : {
62 : : private:
63 : : SfxStyleFamily eFamily;
64 : : ScStyleSaveData aOldData;
65 : : ScStyleSaveData aNewData;
66 : :
67 : : static void DoChange( ScDocShell* pDocSh,
68 : : const String& rName, SfxStyleFamily eStyleFamily,
69 : : const ScStyleSaveData& rData );
70 : :
71 : : public:
72 : : TYPEINFO();
73 : : ScUndoModifyStyle( ScDocShell* pDocSh,
74 : : SfxStyleFamily eFam,
75 : : const ScStyleSaveData& rOld,
76 : : const ScStyleSaveData& rNew );
77 : : virtual ~ScUndoModifyStyle();
78 : :
79 : : virtual void Undo();
80 : : virtual void Redo();
81 : : virtual void Repeat(SfxRepeatTarget& rTarget);
82 : : virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
83 : :
84 : : virtual rtl::OUString GetComment() const;
85 : : };
86 : :
87 : : class ScUndoApplyPageStyle: public ScSimpleUndo
88 : : {
89 : : public:
90 : : TYPEINFO();
91 : : ScUndoApplyPageStyle( ScDocShell* pDocSh, const String& rNewStyle );
92 : : virtual ~ScUndoApplyPageStyle();
93 : :
94 : : void AddSheetAction( SCTAB nTab, const String& rOld );
95 : :
96 : : virtual void Undo();
97 : : virtual void Redo();
98 : : virtual void Repeat(SfxRepeatTarget& rTarget);
99 : : virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
100 : :
101 : : virtual rtl::OUString GetComment() const;
102 : :
103 : : private:
104 : 0 : struct ApplyStyleEntry
105 : : {
106 : : SCTAB mnTab;
107 : : String maOldStyle;
108 : : explicit ApplyStyleEntry( SCTAB nTab, const String& rOldStyle );
109 : : };
110 : : typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
111 : :
112 : : ApplyStyleVec maEntries;
113 : : String maNewStyle;
114 : : };
115 : :
116 : :
117 : : #endif
118 : :
119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|