Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / inc / undostyl.hxx
blob20e749f40c2009ab352d972f505940c317b5d9de
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 INCLUDED_SC_SOURCE_UI_INC_UNDOSTYL_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_UNDOSTYL_HXX
23 #include <memory>
24 #include <svl/style.hxx>
25 #include "undobase.hxx"
27 class ScDocShell;
29 class ScStyleSaveData
31 private:
32 OUString aName;
33 OUString aParent;
34 std::unique_ptr<SfxItemSet> xItems;
36 public:
37 ScStyleSaveData();
38 ScStyleSaveData( const ScStyleSaveData& rOther );
39 ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
41 void InitFromStyle( const SfxStyleSheetBase* pSource );
43 const OUString& GetName() const { return aName; }
44 const OUString& GetParent() const { return aParent; }
45 const SfxItemSet* GetItems() const { return xItems.get(); }
48 class ScUndoModifyStyle: public ScSimpleUndo
50 private:
51 SfxStyleFamily const eFamily;
52 ScStyleSaveData const aOldData;
53 ScStyleSaveData const aNewData;
55 static void DoChange( ScDocShell* pDocSh,
56 const OUString& rName, SfxStyleFamily eStyleFamily,
57 const ScStyleSaveData& rData );
59 public:
60 ScUndoModifyStyle( ScDocShell* pDocSh,
61 SfxStyleFamily eFam,
62 const ScStyleSaveData& rOld,
63 const ScStyleSaveData& rNew );
64 virtual ~ScUndoModifyStyle() override;
66 virtual void Undo() override;
67 virtual void Redo() override;
68 virtual void Repeat(SfxRepeatTarget& rTarget) override;
69 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
71 virtual OUString GetComment() const override;
74 class ScUndoApplyPageStyle: public ScSimpleUndo
76 public:
77 ScUndoApplyPageStyle( ScDocShell* pDocSh, const OUString& rNewStyle );
78 virtual ~ScUndoApplyPageStyle() override;
80 void AddSheetAction( SCTAB nTab, const OUString& rOld );
82 virtual void Undo() override;
83 virtual void Redo() override;
84 virtual void Repeat(SfxRepeatTarget& rTarget) override;
85 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
87 virtual OUString GetComment() const override;
89 private:
90 struct ApplyStyleEntry
92 SCTAB mnTab;
93 OUString const maOldStyle;
94 explicit ApplyStyleEntry( SCTAB nTab, const OUString& rOldStyle );
96 typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
98 ApplyStyleVec maEntries;
99 OUString const maNewStyle;
102 #endif
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */