diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2016-12-18 14:31:14 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-12-19 07:26:24 +0000 |
commit | bf5f6df9e47bd31dc052c6411f6f88ec2d4e3cea (patch) | |
tree | f573562af0d55e5cdb0bfe405db2967efd72d2e8 /vcl/source/image | |
parent | f9a97a5d5aca8473845bca2e17c5826b772b8f3c (diff) |
vcl: separate ImplImageTree - ImageTree singleton and public iface
ImplImageTree was used outside of VCL which is not consistent with
the name and the header also contains a lot of implementation
detail. This separates the implementation to ImplImageTree and
the public interface and singleton to ImageTree only.
Change-Id: I3a26444f0f6971a6b1d83472e9cef19c93192d3e
Reviewed-on: https://gerrit.libreoffice.org/32134
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/image')
-rw-r--r-- | vcl/source/image/Image.cxx | 2 | ||||
-rw-r--r-- | vcl/source/image/ImageArrayData.cxx | 4 | ||||
-rw-r--r-- | vcl/source/image/ImageList.cxx | 2 | ||||
-rw-r--r-- | vcl/source/image/ImageRepository.cxx | 6 | ||||
-rw-r--r-- | vcl/source/image/ImageTree.cxx | 56 | ||||
-rw-r--r-- | vcl/source/image/ImplImageTree.cxx | 19 |
6 files changed, 66 insertions, 23 deletions
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index 22b6fbc451de..51dcca4ed94e 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -30,7 +30,7 @@ #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/imagerepository.hxx> -#include <vcl/implimagetree.hxx> +#include <vcl/ImageTree.hxx> #include <sal/types.h> #include <image.h> diff --git a/vcl/source/image/ImageArrayData.cxx b/vcl/source/image/ImageArrayData.cxx index bd2f1dfec1d7..543543804a70 100644 --- a/vcl/source/image/ImageArrayData.cxx +++ b/vcl/source/image/ImageArrayData.cxx @@ -26,7 +26,7 @@ #include <vcl/image.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> -#include <vcl/implimagetree.hxx> +#include <vcl/ImageTree.hxx> #include <image.h> #include <memory> @@ -70,7 +70,7 @@ void ImageAryData::Load(const OUString &rPrefix) OUString aFileName = rPrefix; aFileName += maName; - bool bSuccess = ImplImageTree::get().loadImage(aFileName, aIconTheme, maBitmapEx, true); + bool bSuccess = ImageTree::get().loadImage(aFileName, aIconTheme, maBitmapEx, true); if (bSuccess) {} diff --git a/vcl/source/image/ImageList.cxx b/vcl/source/image/ImageList.cxx index f72ee83c0f4e..572bc6bbb2ce 100644 --- a/vcl/source/image/ImageList.cxx +++ b/vcl/source/image/ImageList.cxx @@ -30,7 +30,7 @@ #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/imagerepository.hxx> -#include <vcl/implimagetree.hxx> +#include <vcl/ImageTree.hxx> #include <image.h> ImageList::ImageList() diff --git a/vcl/source/image/ImageRepository.cxx b/vcl/source/image/ImageRepository.cxx index 855ae80c6306..7b9255f32348 100644 --- a/vcl/source/image/ImageRepository.cxx +++ b/vcl/source/image/ImageRepository.cxx @@ -19,7 +19,7 @@ #include <vcl/bitmapex.hxx> #include <vcl/imagerepository.hxx> -#include <vcl/implimagetree.hxx> +#include <vcl/ImageTree.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -29,13 +29,13 @@ namespace vcl { OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); - return ImplImageTree::get().loadImage( _rName, sIconTheme, _out_rImage, _bSearchLanguageDependent ); + return ImageTree::get().loadImage( _rName, sIconTheme, _out_rImage, _bSearchLanguageDependent ); } bool ImageRepository::loadDefaultImage( BitmapEx& _out_rImage) { OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); - return ImplImageTree::get().loadDefaultImage( sIconTheme,_out_rImage); + return ImageTree::get().loadDefaultImage( sIconTheme,_out_rImage); } } // namespace vcl diff --git a/vcl/source/image/ImageTree.cxx b/vcl/source/image/ImageTree.cxx new file mode 100644 index 000000000000..0c9dcac957a6 --- /dev/null +++ b/vcl/source/image/ImageTree.cxx @@ -0,0 +1,56 @@ +/* -*- 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 <vcl/ImageTree.hxx> +#include "implimagetree.hxx" +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/container/XNameAccess.hpp> + +ImageTree & ImageTree::get() { + static ImageTree s_ImageTree; + return s_ImageTree; +} + +ImageTree::ImageTree() + : mpImplImageTree(new ImplImageTree) +{ +} + +OUString ImageTree::getImageUrl(OUString const & rName, OUString const & rStyle, OUString const & rLang) + +{ + return mpImplImageTree->getImageUrl(rName, rStyle, rLang); +} + +bool ImageTree::loadImage(OUString const & rName, OUString const & rStyle, + BitmapEx & rBitmap, bool bLocalized, + const ImageLoadFlags eFlags) +{ + return mpImplImageTree->loadImage(rName, rStyle, rBitmap, bLocalized, eFlags); +} + +bool ImageTree::loadDefaultImage(OUString const & rStyle, BitmapEx& rBitmap, + const ImageLoadFlags eFlags) +{ + return mpImplImageTree->loadDefaultImage(rStyle, rBitmap, eFlags); +} + +css::uno::Reference<css::container::XNameAccess> ImageTree::getNameAccess() +{ + return mpImplImageTree->getNameAccess(); +} + +void ImageTree::shutdown() +{ + mpImplImageTree->shutdown(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 28d0427ba3d7..452164577517 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -37,13 +37,13 @@ #include "tools/stream.hxx" #include "tools/urlobj.hxx" +#include "implimagetree.hxx" + #include <vcl/bitmapex.hxx> #include <vcl/dibtools.hxx> -#include <vcl/implimagetree.hxx> #include <vcl/pngread.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> -#include <vcldemo-debug.hxx> #include <vcl/BitmapProcessor.hxx> #include <vcl/BitmapTools.hxx> @@ -171,11 +171,6 @@ void loadImageFromStream(std::shared_ptr<SvStream> const & xStream, OUString con } -ImplImageTree & ImplImageTree::get() { - static ImplImageTree s_ImplImageTree; - return s_ImplImageTree; -} - ImplImageTree::ImplImageTree() { } @@ -368,7 +363,7 @@ bool ImplImageTree::doLoadImage(OUString const & name, OUString const & style, B return found; } -void ImplImageTree::shutDown() +void ImplImageTree::shutdown() { maCurrentStyle.clear(); maIconSets.clear(); @@ -545,12 +540,4 @@ css::uno::Reference<css::container::XNameAccess> ImplImageTree::getNameAccess() return getCurrentIconSet().maNameAccess; } -/// Recursively dump all names ... -css::uno::Sequence<OUString> ImageTree_getAllImageNames() -{ - css::uno::Reference<css::container::XNameAccess> xRef(ImplImageTree::get().getNameAccess()); - - return xRef->getElementNames(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |