Kaydet (Commit) 53c40258 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

StyleManager: move style search to its own method

And remove obsolete CreateStylePreviewRenderer method with style
name as input parameter.

Change-Id: I0fdf54fd40148b417250b5a6bf2453994eb83634
üst 76360c8d
...@@ -35,9 +35,7 @@ public: ...@@ -35,9 +35,7 @@ public:
virtual ~StyleManager() virtual ~StyleManager()
{} {}
virtual StylePreviewRenderer* CreateStylePreviewRenderer( SfxStyleSheetBase* Search(const OUString& rStyleName, SfxStyleFamily eFamily);
OutputDevice& rOutputDev, OUString const & rName,
SfxStyleFamily eFamily, long nMaxHeight = 32) = 0;
virtual StylePreviewRenderer* CreateStylePreviewRenderer( virtual StylePreviewRenderer* CreateStylePreviewRenderer(
OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle,
......
...@@ -29,10 +29,6 @@ public: ...@@ -29,10 +29,6 @@ public:
virtual ~CommonStyleManager() virtual ~CommonStyleManager()
{} {}
virtual sfx2::StylePreviewRenderer* CreateStylePreviewRenderer(
OutputDevice& rOutputDev, OUString const & rName,
SfxStyleFamily eFamily, long nMaxHeight = 32) SAL_OVERRIDE;
virtual sfx2::StylePreviewRenderer* CreateStylePreviewRenderer( virtual sfx2::StylePreviewRenderer* CreateStylePreviewRenderer(
OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle,
long nMaxHeight = 32) SAL_OVERRIDE; long nMaxHeight = 32) SAL_OVERRIDE;
......
...@@ -289,6 +289,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ ...@@ -289,6 +289,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/UnoDecks \ sfx2/source/sidebar/UnoDecks \
sfx2/source/sidebar/UnoSidebar \ sfx2/source/sidebar/UnoSidebar \
sfx2/source/statbar/stbitem \ sfx2/source/statbar/stbitem \
sfx2/source/styles/StyleManager \
sfx2/source/toolbox/imgmgr \ sfx2/source/toolbox/imgmgr \
sfx2/source/toolbox/tbxitem \ sfx2/source/toolbox/tbxitem \
sfx2/source/view/frame \ sfx2/source/view/frame \
......
/* -*- 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: */
...@@ -14,29 +14,6 @@ ...@@ -14,29 +14,6 @@
namespace svx 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( sfx2::StylePreviewRenderer* CommonStyleManager::CreateStylePreviewRenderer(
OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle,
long nMaxHeight) long nMaxHeight)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment