tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / undostyl.hxx
blob39b55c0bda817677556367a5b2f9be2cce5f4c5b
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 #pragma once
22 #include <optional>
23 #include <svl/style.hxx>
24 #include <svl/itemset.hxx>
25 #include "undobase.hxx"
27 class ScDocShell;
29 class ScStyleSaveData
31 private:
32 OUString aName;
33 OUString aParent;
34 std::optional<SfxItemSet> moItems;
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 std::optional<SfxItemSet>& GetItems() const { return moItems; }
48 class ScUndoModifyStyle: public ScSimpleUndo
50 private:
51 SfxStyleFamily eFamily;
52 ScStyleSaveData aOldData;
53 ScStyleSaveData 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, OUString aNewStyle );
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 maOldStyle;
94 explicit ApplyStyleEntry( SCTAB nTab, OUString aOldStyle );
96 typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
98 ApplyStyleVec maEntries;
99 OUString maNewStyle;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */