From 5d463c719bb2881d63da68d0752e4086c265876d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 24 Jan 2011 16:34:14 +0100 Subject: vcl2gnumake: #i116589# header cleanup: linux,solaris,macos --- vcl/inc/impimagetree.hxx | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 vcl/inc/impimagetree.hxx (limited to 'vcl/inc/impimagetree.hxx') diff --git a/vcl/inc/impimagetree.hxx b/vcl/inc/impimagetree.hxx new file mode 100644 index 000000000000..9649fe2f5ec8 --- /dev/null +++ b/vcl/inc/impimagetree.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ***********************************************************************/ + +#ifndef INCLUDED_VCL_IMPIMAGETREE_HXX +#define INCLUDED_VCL_IMPIMAGETREE_HXX + +#include "sal/config.h" + +#include +#include +#include + +#include + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "rtl/ustring.hxx" +#include "salhelper/singletonref.hxx" + +namespace com { namespace sun { namespace star { namespace container { + class XNameAccess; +} } } } +class BitmapEx; + +class ImplImageTree: private boost::noncopyable { +public: + ImplImageTree(); + + ~ImplImageTree(); + + // check whether the icon style is installed + bool checkStyle(rtl::OUString const & style); + + bool loadImage( + rtl::OUString const & name, rtl::OUString const & style, + BitmapEx & bitmap, bool localized = false ); + + void shutDown(); + // a crude form of life cycle control (called from DeInitVCL; otherwise, + // if the ImplImageTree singleton were destroyed during exit that would + // be too late for the destructors of the bitmaps in m_iconCache) + +private: + typedef std::list< + std::pair< + rtl::OUString, + com::sun::star::uno::Reference< + com::sun::star::container::XNameAccess > > > Zips; + + typedef std::hash_map< + rtl::OUString, bool, rtl::OUStringHash > CheckStyleCache; + typedef std::hash_map< + rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache; + + rtl::OUString m_style; + Zips m_zips; + CheckStyleCache m_checkStyleCache; + IconCache m_iconCache; + + void setStyle(rtl::OUString const & style ); + + void resetZips(); + + bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists ); + bool iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap ); + + bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap ); +}; + +typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef; + +#endif -- cgit