diff options
-rw-r--r-- | include/sfx2/StyleManager.hxx | 4 | ||||
-rw-r--r-- | include/svx/CommonStyleManager.hxx | 4 | ||||
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/styles/StyleManager.cxx | 38 | ||||
-rw-r--r-- | svx/source/styles/CommonStyleManager.cxx | 23 |
5 files changed, 40 insertions, 30 deletions
diff --git a/include/sfx2/StyleManager.hxx b/include/sfx2/StyleManager.hxx index badc39caea3c..c6e7c238537a 100644 --- a/include/sfx2/StyleManager.hxx +++ b/include/sfx2/StyleManager.hxx @@ -35,9 +35,7 @@ public: virtual ~StyleManager() {} - virtual StylePreviewRenderer* CreateStylePreviewRenderer( - OutputDevice& rOutputDev, OUString const & rName, - SfxStyleFamily eFamily, long nMaxHeight = 32) = 0; + SfxStyleSheetBase* Search(const OUString& rStyleName, SfxStyleFamily eFamily); virtual StylePreviewRenderer* CreateStylePreviewRenderer( OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, diff --git a/include/svx/CommonStyleManager.hxx b/include/svx/CommonStyleManager.hxx index 1fc22a60d1e8..97f1de9e4f42 100644 --- a/include/svx/CommonStyleManager.hxx +++ b/include/svx/CommonStyleManager.hxx @@ -30,10 +30,6 @@ public: {} virtual sfx2::StylePreviewRenderer* CreateStylePreviewRenderer( - OutputDevice& rOutputDev, OUString const & rName, - SfxStyleFamily eFamily, long nMaxHeight = 32) SAL_OVERRIDE; - - virtual sfx2::StylePreviewRenderer* CreateStylePreviewRenderer( OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, long nMaxHeight = 32) SAL_OVERRIDE; }; diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 5db89dd2444b..b56f7f5c7726 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -289,6 +289,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/sidebar/UnoDecks \ sfx2/source/sidebar/UnoSidebar \ sfx2/source/statbar/stbitem \ + sfx2/source/styles/StyleManager \ sfx2/source/toolbox/imgmgr \ sfx2/source/toolbox/tbxitem \ sfx2/source/view/frame \ diff --git a/sfx2/source/styles/StyleManager.cxx b/sfx2/source/styles/StyleManager.cxx new file mode 100644 index 000000000000..aea80be43cfb --- /dev/null +++ b/sfx2/source/styles/StyleManager.cxx @@ -0,0 +1,38 @@ +/* -*- 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 <sfx2/StyleManager.hxx> + +namespace sfx2 +{ + +SfxStyleSheetBase* StyleManager::Search(const OUString& rStyleName, SfxStyleFamily eFamily) +{ + SfxStyleSheetBasePool* pPool = mrShell.GetStyleSheetPool(); + if (!pPool) + return nullptr; + + pPool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL); + SfxStyleSheetBase* pStyle = nullptr; + pStyle = pPool->First(); + + while (pStyle) + { + if (rStyleName == pStyle->GetName()) + return pStyle; + + pStyle = pPool->Next(); + } + + return nullptr; +} + +} // end namespace sfx2 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/styles/CommonStyleManager.cxx b/svx/source/styles/CommonStyleManager.cxx index 0cabafd46b59..2dd825bcecef 100644 --- a/svx/source/styles/CommonStyleManager.cxx +++ b/svx/source/styles/CommonStyleManager.cxx @@ -15,29 +15,6 @@ namespace svx { sfx2::StylePreviewRenderer* CommonStyleManager::CreateStylePreviewRenderer( - OutputDevice& rOutputDev, OUString const & rName, - SfxStyleFamily eFamily, long nMaxHeight) -{ - SfxStyleSheetBasePool* pPool = mrShell.GetStyleSheetPool(); - if (!pPool) - return nullptr; - - pPool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL); - SfxStyleSheetBase* pStyle = nullptr; - pStyle = pPool->First(); - - while (pStyle) - { - if (rName == pStyle->GetName()) - return CreateStylePreviewRenderer(rOutputDev, pStyle, nMaxHeight); - - pStyle = pPool->Next(); - } - - return nullptr; -} - -sfx2::StylePreviewRenderer* CommonStyleManager::CreateStylePreviewRenderer( OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, long nMaxHeight) { |