From 53c40258d3572152b46e5ff5f51496ae6f32879b Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Wed, 15 Jul 2015 16:19:12 +0900 Subject: StyleManager: move style search to its own method And remove obsolete CreateStylePreviewRenderer method with style name as input parameter. Change-Id: I0fdf54fd40148b417250b5a6bf2453994eb83634 --- sfx2/Library_sfx.mk | 1 + sfx2/source/styles/StyleManager.cxx | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 sfx2/source/styles/StyleManager.cxx (limited to 'sfx2') 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 + +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: */ -- cgit