LibreOffice Module sw (master)
1
sw
source
core
undo
UndoThemeChange.cxx
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
10
#include <UndoThemeChange.hxx>
11
#include <
svx/svdpage.hxx
>
12
#include <
docmodel/theme/Theme.hxx
>
13
#include <
doc.hxx
>
14
#include <drawdoc.hxx>
15
#include <
IDocumentDrawModelAccess.hxx
>
16
17
#include <memory>
18
19
namespace
sw
20
{
21
UndoThemeChange::UndoThemeChange
(
SwDoc
& rDocument,
22
std::shared_ptr<model::ColorSet>
const
& pOldColorSet,
23
std::shared_ptr<model::ColorSet>
const
& pNewColorSet)
24
:
SwUndo
(
SwUndoId
::
CHANGE_THEME
, &rDocument)
25
, mrDocument(rDocument)
26
, mpOldColorSet(pOldColorSet)
27
, mpNewColorSet(pNewColorSet)
28
{
29
}
30
31
UndoThemeChange::~UndoThemeChange
() {}
32
33
void
UndoThemeChange::UndoImpl
(
UndoRedoContext
&
/*rUndoRedoContext*/
)
34
{
35
SdrPage
* pPage =
mrDocument
.
getIDocumentDrawModelAccess
().
GetDrawModel
()->
GetPage
(0);
36
auto
pTheme = pPage->
getSdrPageProperties
().
GetTheme
();
37
pTheme->setColorSet(
mpOldColorSet
);
38
}
39
40
void
UndoThemeChange::RedoImpl
(
UndoRedoContext
&
/*rUndoRedoContext*/
)
41
{
42
SdrPage
* pPage =
mrDocument
.
getIDocumentDrawModelAccess
().
GetDrawModel
()->
GetPage
(0);
43
auto
pTheme = pPage->
getSdrPageProperties
().
GetTheme
();
44
pTheme->setColorSet(
mpNewColorSet
);
45
}
46
}
47
48
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
IDocumentDrawModelAccess.hxx
Theme.hxx
IDocumentDrawModelAccess::GetDrawModel
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
SdrModel::GetPage
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrPageProperties::GetTheme
std::shared_ptr< model::Theme > const & GetTheme() const
SdrPage
SdrPage::getSdrPageProperties
SdrPageProperties & getSdrPageProperties()
SwDoc
Definition:
doc.hxx:197
SwDoc::getIDocumentDrawModelAccess
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition:
doc.cxx:169
SwUndo
Definition:
undobj.hxx:55
sw::UndoRedoContext
Definition:
UndoCore.hxx:86
sw::UndoThemeChange::RedoImpl
virtual void RedoImpl(UndoRedoContext &rUndoRedoContext) override
Definition:
UndoThemeChange.cxx:40
sw::UndoThemeChange::mpOldColorSet
std::shared_ptr< model::ColorSet > mpOldColorSet
Definition:
UndoThemeChange.hxx:22
sw::UndoThemeChange::mpNewColorSet
std::shared_ptr< model::ColorSet > mpNewColorSet
Definition:
UndoThemeChange.hxx:23
sw::UndoThemeChange::~UndoThemeChange
virtual ~UndoThemeChange() override
Definition:
UndoThemeChange.cxx:31
sw::UndoThemeChange::mrDocument
SwDoc & mrDocument
Definition:
UndoThemeChange.hxx:21
sw::UndoThemeChange::UndoThemeChange
UndoThemeChange(SwDoc &rDocument, std::shared_ptr< model::ColorSet > const &pOld, std::shared_ptr< model::ColorSet > const &pNew)
Definition:
UndoThemeChange.cxx:21
sw::UndoThemeChange::UndoImpl
virtual void UndoImpl(UndoRedoContext &rUndoRedoContext) override
Definition:
UndoThemeChange.cxx:33
doc.hxx
sw
Dialog to specify the properties of date form field.
Definition:
AccessibilityCheck.cxx:48
svdpage.hxx
SwUndoId
SwUndoId
Definition:
swundo.hxx:30
SwUndoId::CHANGE_THEME
@ CHANGE_THEME
Generated on Sun Jul 30 2023 04:29:01 for LibreOffice Module sw (master) by
1.9.3