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