LibreOffice Module sc (master)  1
undostyl.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <memory>
23 #include <optional>
24 #include <svl/style.hxx>
25 #include <svl/itemset.hxx>
26 #include "undobase.hxx"
27 
28 class ScDocShell;
29 
31 {
32 private:
33  OUString aName;
34  OUString aParent;
35  std::optional<SfxItemSet> moItems;
36 
37 public:
39  ScStyleSaveData( const ScStyleSaveData& rOther );
40  ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
41 
42  void InitFromStyle( const SfxStyleSheetBase* pSource );
43 
44  const OUString& GetName() const { return aName; }
45  const OUString& GetParent() const { return aParent; }
46  const std::optional<SfxItemSet>& GetItems() const { return moItems; }
47 };
48 
50 {
51 private:
55 
56  static void DoChange( ScDocShell* pDocSh,
57  const OUString& rName, SfxStyleFamily eStyleFamily,
58  const ScStyleSaveData& rData );
59 
60 public:
62  SfxStyleFamily eFam,
63  const ScStyleSaveData& rOld,
64  const ScStyleSaveData& rNew );
65  virtual ~ScUndoModifyStyle() override;
66 
67  virtual void Undo() override;
68  virtual void Redo() override;
69  virtual void Repeat(SfxRepeatTarget& rTarget) override;
70  virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
71 
72  virtual OUString GetComment() const override;
73 };
74 
76 {
77 public:
78  ScUndoApplyPageStyle( ScDocShell* pDocSh, const OUString& rNewStyle );
79  virtual ~ScUndoApplyPageStyle() override;
80 
81  void AddSheetAction( SCTAB nTab, const OUString& rOld );
82 
83  virtual void Undo() override;
84  virtual void Redo() override;
85  virtual void Repeat(SfxRepeatTarget& rTarget) override;
86  virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
87 
88  virtual OUString GetComment() const override;
89 
90 private:
92  {
94  OUString maOldStyle;
95  explicit ApplyStyleEntry( SCTAB nTab, const OUString& rOldStyle );
96  };
97  typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
98 
99  ApplyStyleVec maEntries;
100  OUString maNewStyle;
101 };
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString aParent
Definition: undostyl.hxx:34
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undostyl.cxx:275
::std::vector< ApplyStyleEntry > ApplyStyleVec
Definition: undostyl.hxx:97
FilterGroup & rTarget
virtual OUString GetComment() const override
Definition: undostyl.cxx:243
ScStyleSaveData aOldData
Definition: undostyl.hxx:53
virtual void Redo() override
Definition: undostyl.cxx:259
SfxStyleFamily eFamily
Definition: undostyl.hxx:52
ScStyleSaveData & operator=(const ScStyleSaveData &rOther)
Definition: undostyl.cxx:48
const OUString & GetParent() const
Definition: undostyl.hxx:45
virtual void Redo() override
Definition: undostyl.cxx:204
SfxStyleFamily
void InitFromStyle(const SfxStyleSheetBase *pSource)
Definition: undostyl.cxx:62
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undostyl.cxx:211
const OUString & GetName() const
Definition: undostyl.hxx:44
virtual void Undo() override
Definition: undostyl.cxx:248
ScStyleSaveData aNewData
Definition: undostyl.hxx:54
virtual void Undo() override
Definition: undostyl.cxx:197
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undostyl.cxx:270
std::optional< SfxItemSet > moItems
Definition: undostyl.hxx:35
ScUndoModifyStyle(ScDocShell *pDocSh, SfxStyleFamily eFam, const ScStyleSaveData &rOld, const ScStyleSaveData &rNew)
Definition: undostyl.cxx:78
void AddSheetAction(SCTAB nTab, const OUString &rOld)
Definition: undostyl.cxx:238
ApplyStyleVec maEntries
Definition: undostyl.hxx:99
OUString aName
Definition: undostyl.hxx:33
const std::optional< SfxItemSet > & GetItems() const
Definition: undostyl.hxx:46
virtual OUString GetComment() const override
Definition: undostyl.cxx:91
virtual ~ScUndoModifyStyle() override
Definition: undostyl.cxx:87
static void DoChange(ScDocShell *pDocSh, const OUString &rName, SfxStyleFamily eStyleFamily, const ScStyleSaveData &rData)
Definition: undostyl.cxx:115
ApplyStyleEntry(SCTAB nTab, const OUString &rOldStyle)
Definition: undostyl.cxx:222
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undostyl.cxx:215
sal_Int16 SCTAB
Definition: types.hxx:22
virtual ~ScUndoApplyPageStyle() override
Definition: undostyl.cxx:234
ScUndoApplyPageStyle(ScDocShell *pDocSh, const OUString &rNewStyle)
Definition: undostyl.cxx:228