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 SC_UNDOSTYL_HXX
21 : #define SC_UNDOSTYL_HXX
22 :
23 : #include <rsc/rscsfx.hxx>
24 : #include "undobase.hxx"
25 :
26 : class ScDocShell;
27 : class SfxStyleSheetBase;
28 :
29 : //----------------------------------------------------------------------------
30 :
31 : class ScStyleSaveData
32 : {
33 : private:
34 : String aName;
35 : String aParent;
36 : SfxItemSet* pItems;
37 :
38 : public:
39 : ScStyleSaveData();
40 : ScStyleSaveData( const ScStyleSaveData& rOther );
41 : ~ScStyleSaveData();
42 : ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
43 :
44 : void InitFromStyle( const SfxStyleSheetBase* pSource );
45 :
46 0 : const String& GetName() const { return aName; }
47 0 : const String& GetParent() const { return aParent; }
48 0 : const SfxItemSet* GetItems() const { return pItems; }
49 : };
50 :
51 : class ScUndoModifyStyle: public ScSimpleUndo
52 : {
53 : private:
54 : SfxStyleFamily eFamily;
55 : ScStyleSaveData aOldData;
56 : ScStyleSaveData aNewData;
57 :
58 : static void DoChange( ScDocShell* pDocSh,
59 : const String& rName, SfxStyleFamily eStyleFamily,
60 : const ScStyleSaveData& rData );
61 :
62 : public:
63 : TYPEINFO();
64 : ScUndoModifyStyle( ScDocShell* pDocSh,
65 : SfxStyleFamily eFam,
66 : const ScStyleSaveData& rOld,
67 : const ScStyleSaveData& rNew );
68 : virtual ~ScUndoModifyStyle();
69 :
70 : virtual void Undo();
71 : virtual void Redo();
72 : virtual void Repeat(SfxRepeatTarget& rTarget);
73 : virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
74 :
75 : virtual rtl::OUString GetComment() const;
76 : };
77 :
78 : class ScUndoApplyPageStyle: public ScSimpleUndo
79 : {
80 : public:
81 : TYPEINFO();
82 : ScUndoApplyPageStyle( ScDocShell* pDocSh, const String& rNewStyle );
83 : virtual ~ScUndoApplyPageStyle();
84 :
85 : void AddSheetAction( SCTAB nTab, const String& rOld );
86 :
87 : virtual void Undo();
88 : virtual void Redo();
89 : virtual void Repeat(SfxRepeatTarget& rTarget);
90 : virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
91 :
92 : virtual rtl::OUString GetComment() const;
93 :
94 : private:
95 0 : struct ApplyStyleEntry
96 : {
97 : SCTAB mnTab;
98 : String maOldStyle;
99 : explicit ApplyStyleEntry( SCTAB nTab, const String& rOldStyle );
100 : };
101 : typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
102 :
103 : ApplyStyleVec maEntries;
104 : String maNewStyle;
105 : };
106 :
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|