/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include namespace sd { UndoThemeChange::UndoThemeChange(SdDrawDocument* pDocument, SdrPage* pMasterPage, std::shared_ptr const& pOldColorSet, std::shared_ptr const& pNewColorSet) : SdUndoAction(pDocument) , mpMasterPage(pMasterPage) , mpOldColorSet(pOldColorSet) , mpNewColorSet(pNewColorSet) { SetComment(SvxResId(RID_SVXSTR_UNDO_THEME_COLOR_CHANGE)); } namespace { std::shared_ptr getTheme(SdrPage* pMasterPage) { auto pTheme = pMasterPage->getSdrPageProperties().getTheme(); if (!pTheme) { pTheme = std::make_shared("Office"); pMasterPage->getSdrPageProperties().setTheme(pTheme); } return pTheme; } } void UndoThemeChange::Undo() { auto pTheme = getTheme(mpMasterPage); pTheme->setColorSet(mpOldColorSet); } void UndoThemeChange::Redo() { auto pTheme = getTheme(mpMasterPage); pTheme->setColorSet(mpNewColorSet); } } // end sd namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */