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 #ifndef INCLUDED_SC_SOURCE_UI_INC_UNDOSTYL_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_UNDOSTYL_HXX
22 
23 #include <memory>
24 #include <svl/style.hxx>
25 #include "undobase.hxx"
26 
27 class ScDocShell;
28 
30 {
31 private:
32  OUString aName;
33  OUString aParent;
34  std::unique_ptr<SfxItemSet> xItems;
35 
36 public:
38  ScStyleSaveData( const ScStyleSaveData& rOther );
39  ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
40 
41  void InitFromStyle( const SfxStyleSheetBase* pSource );
42 
43  const OUString& GetName() const { return aName; }
44  const OUString& GetParent() const { return aParent; }
45  const SfxItemSet* GetItems() const { return xItems.get(); }
46 };
47 
49 {
50 private:
54 
55  static void DoChange( ScDocShell* pDocSh,
56  const OUString& rName, SfxStyleFamily eStyleFamily,
57  const ScStyleSaveData& rData );
58 
59 public:
61  SfxStyleFamily eFam,
62  const ScStyleSaveData& rOld,
63  const ScStyleSaveData& rNew );
64  virtual ~ScUndoModifyStyle() override;
65 
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;
70 
71  virtual OUString GetComment() const override;
72 };
73 
75 {
76 public:
77  ScUndoApplyPageStyle( ScDocShell* pDocSh, const OUString& rNewStyle );
78  virtual ~ScUndoApplyPageStyle() override;
79 
80  void AddSheetAction( SCTAB nTab, const OUString& rOld );
81 
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;
86 
87  virtual OUString GetComment() const override;
88 
89 private:
91  {
93  OUString maOldStyle;
94  explicit ApplyStyleEntry( SCTAB nTab, const OUString& rOldStyle );
95  };
96  typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
97 
98  ApplyStyleVec maEntries;
99  OUString maNewStyle;
100 };
101 
102 #endif
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString aParent
Definition: undostyl.hxx:33
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undostyl.cxx:268
::std::vector< ApplyStyleEntry > ApplyStyleVec
Definition: undostyl.hxx:96
FilterGroup & rTarget
std::unique_ptr< SfxItemSet > xItems
Definition: undostyl.hxx:34
const SfxItemSet * GetItems() const
Definition: undostyl.hxx:45
virtual OUString GetComment() const override
Definition: undostyl.cxx:236
ScStyleSaveData aOldData
Definition: undostyl.hxx:52
virtual void Redo() override
Definition: undostyl.cxx:252
SfxStyleFamily eFamily
Definition: undostyl.hxx:51
ScStyleSaveData & operator=(const ScStyleSaveData &rOther)
Definition: undostyl.cxx:48
const OUString & GetParent() const
Definition: undostyl.hxx:44
virtual void Redo() override
Definition: undostyl.cxx:197
SfxStyleFamily
void InitFromStyle(const SfxStyleSheetBase *pSource)
Definition: undostyl.cxx:59
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undostyl.cxx:204
const OUString & GetName() const
Definition: undostyl.hxx:43
virtual void Undo() override
Definition: undostyl.cxx:241
ScStyleSaveData aNewData
Definition: undostyl.hxx:53
virtual void Undo() override
Definition: undostyl.cxx:190
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undostyl.cxx:263
ScUndoModifyStyle(ScDocShell *pDocSh, SfxStyleFamily eFam, const ScStyleSaveData &rOld, const ScStyleSaveData &rNew)
Definition: undostyl.cxx:71
void AddSheetAction(SCTAB nTab, const OUString &rOld)
Definition: undostyl.cxx:231
ApplyStyleVec maEntries
Definition: undostyl.hxx:98
OUString aName
Definition: undostyl.hxx:32
virtual OUString GetComment() const override
Definition: undostyl.cxx:84
virtual ~ScUndoModifyStyle() override
Definition: undostyl.cxx:80
static void DoChange(ScDocShell *pDocSh, const OUString &rName, SfxStyleFamily eStyleFamily, const ScStyleSaveData &rData)
Definition: undostyl.cxx:108
ApplyStyleEntry(SCTAB nTab, const OUString &rOldStyle)
Definition: undostyl.cxx:215
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undostyl.cxx:208
sal_Int16 SCTAB
Definition: types.hxx:23
virtual ~ScUndoApplyPageStyle() override
Definition: undostyl.cxx:227
ScUndoApplyPageStyle(ScDocShell *pDocSh, const OUString &rNewStyle)
Definition: undostyl.cxx:221