LCOV - code coverage report
Current view: top level - libreoffice/framework/source/uiconfiguration - imagemanager.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 63 30.2 %
Date: 2012-12-27 Functions: 8 30 26.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <uiconfiguration/imagemanager.hxx>
      22             : #include <threadhelp/resetableguard.hxx>
      23             : #include <xml/imagesconfiguration.hxx>
      24             : #include <uiconfiguration/graphicnameaccess.hxx>
      25             : #include <services.h>
      26             : #include "imagemanagerimpl.hxx"
      27             : 
      28             : #include "properties.h"
      29             : 
      30             : #include <com/sun/star/ui/UIElementType.hpp>
      31             : #include <com/sun/star/ui/ConfigurationEvent.hpp>
      32             : #include <com/sun/star/lang/DisposedException.hpp>
      33             : #include <com/sun/star/beans/XPropertySet.hpp>
      34             : #include <com/sun/star/beans/PropertyValue.hpp>
      35             : #include <com/sun/star/embed/ElementModes.hpp>
      36             : #include <com/sun/star/io/XStream.hpp>
      37             : #include <com/sun/star/ui/ImageType.hpp>
      38             : 
      39             : #include <vcl/svapp.hxx>
      40             : #include <rtl/ustrbuf.hxx>
      41             : #include <osl/mutex.hxx>
      42             : #include <comphelper/sequence.hxx>
      43             : #include <unotools/ucbstreamhelper.hxx>
      44             : #include <vcl/pngread.hxx>
      45             : #include <vcl/pngwrite.hxx>
      46             : #include <rtl/logfile.hxx>
      47             : 
      48             : //_________________________________________________________________________________________________________________
      49             : //  namespaces
      50             : //_________________________________________________________________________________________________________________
      51             : 
      52             : using ::rtl::OUString;
      53             : using ::com::sun::star::uno::Sequence;
      54             : using ::com::sun::star::uno::XInterface;
      55             : using ::com::sun::star::uno::Exception;
      56             : using ::com::sun::star::uno::RuntimeException;
      57             : using ::com::sun::star::uno::UNO_QUERY;
      58             : using ::com::sun::star::uno::Any;
      59             : using ::com::sun::star::uno::makeAny;
      60             : using ::com::sun::star::graphic::XGraphic;
      61             : using namespace ::com::sun::star;
      62             : using namespace ::com::sun::star::io;
      63             : using namespace ::com::sun::star::embed;
      64             : using namespace ::com::sun::star::lang;
      65             : using namespace ::com::sun::star::container;
      66             : using namespace ::com::sun::star::beans;
      67             : using namespace ::com::sun::star::ui;
      68             : 
      69             : // Image sizes for our toolbars/menus
      70             : const sal_Int32 IMAGE_SIZE_NORMAL         = 16;
      71             : const sal_Int32 IMAGE_SIZE_LARGE          = 26;
      72             : const sal_Int16 MAX_IMAGETYPE_VALUE       = ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST|
      73             :                                             ::com::sun::star::ui::ImageType::SIZE_LARGE;
      74             : 
      75             : namespace framework
      76             : {
      77             : 
      78             : //*****************************************************************************************************************
      79             : //  XInterface, XTypeProvider, XServiceInfo
      80             : //*****************************************************************************************************************
      81          38 : DEFINE_XSERVICEINFO_MULTISERVICE        (   ImageManager                        ,
      82             :                                             ::cppu::OWeakObject                 ,
      83             :                                             SERVICENAME_IMAGEMANAGER            ,
      84             :                                             IMPLEMENTATIONNAME_IMAGEMANAGER
      85             :                                         )
      86             : 
      87           0 : DEFINE_INIT_SERVICE                     (   ImageManager, {} )
      88             : 
      89         236 : ImageManager::ImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
      90         236 :     ThreadHelpBase( &Application::GetSolarMutex() )
      91         236 :     , m_pImpl( new ImageManagerImpl(comphelper::getComponentContext(xServiceManager),this,false) )
      92             : {
      93         236 : }
      94             : 
      95         189 : ImageManager::~ImageManager()
      96             : {
      97          63 :     m_pImpl->clear();
      98         126 : }
      99             : 
     100             : // XComponent
     101           0 : void SAL_CALL ImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
     102             : {
     103           0 :     m_pImpl->dispose();
     104           0 : }
     105             : 
     106           0 : void SAL_CALL ImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
     107             : {
     108           0 :     m_pImpl->addEventListener(xListener);
     109           0 : }
     110             : 
     111           0 : void SAL_CALL ImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
     112             : {
     113             :     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     114           0 :     m_pImpl->removeEventListener(xListener);
     115           0 : }
     116             : 
     117             : // Non-UNO methods
     118           0 : void ImageManager::setStorage( const uno::Reference< XStorage >& Storage )
     119             : throw (::com::sun::star::uno::RuntimeException)
     120             : {
     121           0 :     ResetableGuard aLock( m_pImpl->m_aLock );
     122             : 
     123           0 :     m_pImpl->m_xUserConfigStorage = Storage;
     124           0 :     m_pImpl->implts_initialize();
     125           0 : }
     126             : 
     127             : // XInitialization
     128         236 : void SAL_CALL ImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
     129             : {
     130         236 :     m_pImpl->initialize(aArguments);
     131         236 : }
     132             : 
     133             : // XImageManager
     134           0 : void SAL_CALL ImageManager::reset()
     135             : throw (::com::sun::star::uno::RuntimeException)
     136             : {
     137             : 
     138             :     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     139           0 :     m_pImpl->reset();
     140           0 : }
     141             : 
     142           0 : Sequence< ::rtl::OUString > SAL_CALL ImageManager::getAllImageNames( ::sal_Int16 nImageType )
     143             : throw (::com::sun::star::uno::RuntimeException)
     144             : {
     145           0 :     return m_pImpl->getAllImageNames( nImageType );
     146             : }
     147             : 
     148           0 : ::sal_Bool SAL_CALL ImageManager::hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL )
     149             : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     150             : {
     151           0 :     return m_pImpl->hasImage(nImageType,aCommandURL);
     152             : }
     153             : 
     154        2360 : Sequence< uno::Reference< XGraphic > > SAL_CALL ImageManager::getImages(
     155             :     ::sal_Int16 nImageType,
     156             :     const Sequence< ::rtl::OUString >& aCommandURLSequence )
     157             : throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
     158             : {
     159        2360 :     return m_pImpl->getImages(nImageType,aCommandURLSequence);
     160             : }
     161             : 
     162           0 : void SAL_CALL ImageManager::replaceImages(
     163             :     ::sal_Int16 nImageType,
     164             :     const Sequence< ::rtl::OUString >& aCommandURLSequence,
     165             :     const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
     166             : throw ( ::com::sun::star::lang::IllegalArgumentException,
     167             :         ::com::sun::star::lang::IllegalAccessException,
     168             :         ::com::sun::star::uno::RuntimeException)
     169             : {
     170           0 :     m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
     171           0 : }
     172             : 
     173           0 : void SAL_CALL ImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
     174             : throw ( ::com::sun::star::lang::IllegalArgumentException,
     175             :         ::com::sun::star::lang::IllegalAccessException,
     176             :         ::com::sun::star::uno::RuntimeException)
     177             : {
     178           0 :     m_pImpl->removeImages(nImageType,aCommandURLSequence);
     179           0 : }
     180             : 
     181           0 : void SAL_CALL ImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
     182             : throw ( ::com::sun::star::container::ElementExistException,
     183             :         ::com::sun::star::lang::IllegalArgumentException,
     184             :         ::com::sun::star::lang::IllegalAccessException,
     185             :         ::com::sun::star::uno::RuntimeException)
     186             : {
     187           0 :     m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
     188           0 : }
     189             : 
     190             : // XUIConfiguration
     191         236 : void SAL_CALL ImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
     192             : throw (::com::sun::star::uno::RuntimeException)
     193             : {
     194         236 :     m_pImpl->addConfigurationListener(xListener);
     195         236 : }
     196             : 
     197          63 : void SAL_CALL ImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
     198             : throw (::com::sun::star::uno::RuntimeException)
     199             : {
     200             :     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
     201          63 :     m_pImpl->removeConfigurationListener(xListener);
     202          63 : }
     203             : 
     204             : // XUIConfigurationPersistence
     205           0 : void SAL_CALL ImageManager::reload()
     206             : throw ( ::com::sun::star::uno::Exception,
     207             :         ::com::sun::star::uno::RuntimeException )
     208             : {
     209           0 :     m_pImpl->reload();
     210           0 : }
     211             : 
     212           0 : void SAL_CALL ImageManager::store()
     213             : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
     214             : {
     215           0 :     m_pImpl->store();
     216           0 : }
     217             : 
     218           0 : void SAL_CALL ImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
     219             : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
     220             : {
     221           0 :     m_pImpl->storeToStorage(Storage);
     222           0 : }
     223             : 
     224           0 : sal_Bool SAL_CALL ImageManager::isModified()
     225             : throw (::com::sun::star::uno::RuntimeException)
     226             : {
     227           0 :     return m_pImpl->isModified();
     228             : }
     229             : 
     230           0 : sal_Bool SAL_CALL ImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
     231             : {
     232           0 :     return m_pImpl->isReadOnly();
     233             : }
     234             : 
     235             : } // namespace framework
     236             : 
     237             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10