tdf#35361 Add a Quick Look plugins for .od* files on macOS
[LibreOffice.git] / sw / source / core / undo / UndoThemeChange.cxx
blob8e26106873e736d88b6cb96f7da03f2021c52a9c
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/.
8 */
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>
17 #include <memory>
19 namespace sw
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)
31 UndoThemeChange::~UndoThemeChange() {}
33 void UndoThemeChange::UndoImpl(UndoRedoContext& /*rUndoRedoContext*/)
35 SdrModel* pModel = mrDocument.getIDocumentDrawModelAccess().GetDrawModel();
36 auto pTheme = pModel->getTheme();
37 pTheme->setColorSet(mpOldColorSet);
40 void UndoThemeChange::RedoImpl(UndoRedoContext& /*rUndoRedoContext*/)
42 SdrModel* pModel = mrDocument.getIDocumentDrawModelAccess().GetDrawModel();
43 auto pTheme = pModel->getTheme();
44 pTheme->setColorSet(mpNewColorSet);
48 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */