LCOV - code coverage report
Current view: top level - framework/source/uiconfiguration - windowstateconfiguration.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 593 0.0 %
Date: 2014-04-14 Functions: 0 40 0.0 %
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             : #include <uiconfiguration/windowstateproperties.hxx>
      21             : #include <helper/mischelper.hxx>
      22             : 
      23             : #include <com/sun/star/beans/PropertyValue.hpp>
      24             : #include <com/sun/star/beans/XPropertySet.hpp>
      25             : #include <com/sun/star/configuration/theDefaultProvider.hpp>
      26             : #include <com/sun/star/container/XNameAccess.hpp>
      27             : #include <com/sun/star/container/XNameContainer.hpp>
      28             : #include <com/sun/star/container/XContainer.hpp>
      29             : #include <com/sun/star/lang/XServiceInfo.hpp>
      30             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      31             : #include <com/sun/star/frame/ModuleManager.hpp>
      32             : #include <com/sun/star/frame/XModuleManager2.hpp>
      33             : #include <com/sun/star/awt/Point.hpp>
      34             : #include <com/sun/star/awt/Size.hpp>
      35             : #include <com/sun/star/ui/DockingArea.hpp>
      36             : #include <com/sun/star/util/XChangesBatch.hpp>
      37             : #include <com/sun/star/uno/XComponentContext.hpp>
      38             : 
      39             : #include <cppuhelper/basemutex.hxx>
      40             : #include <cppuhelper/compbase2.hxx>
      41             : #include <cppuhelper/implbase2.hxx>
      42             : #include <cppuhelper/supportsservice.hxx>
      43             : #include <tools/debug.hxx>
      44             : 
      45             : #include <vector>
      46             : #include <boost/unordered_map.hpp>
      47             : 
      48             : using namespace com::sun::star::uno;
      49             : using namespace com::sun::star::lang;
      50             : using namespace com::sun::star::beans;
      51             : using namespace com::sun::star::util;
      52             : using namespace com::sun::star::configuration;
      53             : using namespace com::sun::star::container;
      54             : using namespace ::com::sun::star::frame;
      55             : using namespace ::com::sun::star::ui;
      56             : using namespace framework;
      57             : 
      58             : #undef WINDOWSTATE_MASK_POS
      59             : 
      60             : namespace {
      61             : 
      62             : // Zero based indexes, order must be the same as WindowStateMask && CONFIGURATION_PROPERTIES!
      63             : static const sal_Int16 PROPERTY_LOCKED                  = 0;
      64             : static const sal_Int16 PROPERTY_DOCKED                  = 1;
      65             : static const sal_Int16 PROPERTY_VISIBLE                 = 2;
      66             : static const sal_Int16 PROPERTY_CONTEXT                 = 3;
      67             : static const sal_Int16 PROPERTY_HIDEFROMMENU            = 4;
      68             : static const sal_Int16 PROPERTY_NOCLOSE                 = 5;
      69             : static const sal_Int16 PROPERTY_SOFTCLOSE               = 6;
      70             : static const sal_Int16 PROPERTY_CONTEXTACTIVE           = 7;
      71             : static const sal_Int16 PROPERTY_DOCKINGAREA             = 8;
      72             : static const sal_Int16 PROPERTY_POS                     = 9;
      73             : static const sal_Int16 PROPERTY_SIZE                    = 10;
      74             : static const sal_Int16 PROPERTY_UINAME                  = 11;
      75             : static const sal_Int16 PROPERTY_INTERNALSTATE           = 12;
      76             : static const sal_Int16 PROPERTY_STYLE                   = 13;
      77             : static const sal_Int16 PROPERTY_DOCKPOS                 = 14;
      78             : static const sal_Int16 PROPERTY_DOCKSIZE                = 15;
      79             : 
      80             : // Order must be the same as WindowStateMask!!
      81             : static const char* CONFIGURATION_PROPERTIES[]           =
      82             : {
      83             :     WINDOWSTATE_PROPERTY_LOCKED,
      84             :     WINDOWSTATE_PROPERTY_DOCKED,
      85             :     WINDOWSTATE_PROPERTY_VISIBLE,
      86             :     WINDOWSTATE_PROPERTY_CONTEXT,
      87             :     WINDOWSTATE_PROPERTY_HIDEFROMENU,
      88             :     WINDOWSTATE_PROPERTY_NOCLOSE,
      89             :     WINDOWSTATE_PROPERTY_SOFTCLOSE,
      90             :     WINDOWSTATE_PROPERTY_CONTEXTACTIVE,
      91             :     WINDOWSTATE_PROPERTY_DOCKINGAREA,
      92             :     WINDOWSTATE_PROPERTY_POS,
      93             :     WINDOWSTATE_PROPERTY_SIZE,
      94             :     WINDOWSTATE_PROPERTY_UINAME,
      95             :     WINDOWSTATE_PROPERTY_INTERNALSTATE,
      96             :     WINDOWSTATE_PROPERTY_STYLE,
      97             :     WINDOWSTATE_PROPERTY_DOCKPOS,
      98             :     WINDOWSTATE_PROPERTY_DOCKSIZE,
      99             :     0
     100             : };
     101             : 
     102             : //  Configuration access class for WindowState supplier implementation
     103             : 
     104             : class ConfigurationAccess_WindowState : public  ::cppu::WeakImplHelper2< XNameContainer, XContainerListener >
     105             : {
     106             :     public:
     107             :                                   ConfigurationAccess_WindowState( const OUString& aWindowStateConfigFile, const Reference< XComponentContext >& rxContext );
     108             :         virtual                   ~ConfigurationAccess_WindowState();
     109             : 
     110             :         // XNameAccess
     111             :         virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
     112             :             throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             : 
     114             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
     115             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             : 
     117             :         virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
     118             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :         // XNameContainer
     121             :         virtual void SAL_CALL removeByName( const OUString& sName )
     122             :             throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     123             : 
     124             :         virtual void SAL_CALL insertByName( const OUString& sName, const css::uno::Any&   aPropertySet )
     125             :             throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     126             : 
     127             :         // XNameReplace
     128             :         virtual void SAL_CALL replaceByName( const OUString& sName, const css::uno::Any& aPropertySet )
     129             :             throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     130             : 
     131             :         // XElementAccess
     132             :         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     133             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             : 
     135             :         virtual sal_Bool SAL_CALL hasElements()
     136             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             : 
     138             :         // container.XContainerListener
     139             :         virtual void SAL_CALL     elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
     140             :         virtual void SAL_CALL     elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
     141             :         virtual void SAL_CALL     elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
     142             : 
     143             :         // lang.XEventListener
     144             :         virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
     145             : 
     146             :     protected:
     147             :         enum WindowStateMask
     148             :         {
     149             :             WINDOWSTATE_MASK_LOCKED         = 1,
     150             :             WINDOWSTATE_MASK_DOCKED         = 2,
     151             :             WINDOWSTATE_MASK_VISIBLE        = 4,
     152             :             WINDOWSTATE_MASK_CONTEXT        = 8,
     153             :             WINDOWSTATE_MASK_HIDEFROMMENU   = 16,
     154             :             WINDOWSTATE_MASK_NOCLOSE        = 32,
     155             :             WINDOWSTATE_MASK_SOFTCLOSE      = 64,
     156             :             WINDOWSTATE_MASK_CONTEXTACTIVE  = 128,
     157             :             WINDOWSTATE_MASK_DOCKINGAREA    = 256,
     158             :             WINDOWSTATE_MASK_POS            = 512,
     159             :             WINDOWSTATE_MASK_SIZE           = 1024,
     160             :             WINDOWSTATE_MASK_UINAME         = 2048,
     161             :             WINDOWSTATE_MASK_INTERNALSTATE  = 4096,
     162             :             WINDOWSTATE_MASK_STYLE          = 8192,
     163             :             WINDOWSTATE_MASK_DOCKPOS        = 16384,
     164             :             WINDOWSTATE_MASK_DOCKSIZE       = 32768
     165             :         };
     166             : 
     167             :         // Cache structure. Valid values are described by the eMask member. All other values should not be
     168             :         // provided to outside code!
     169           0 :         struct WindowStateInfo
     170             :         {
     171           0 :             WindowStateInfo()
     172             :                 : bLocked(false)
     173             :                 , bDocked(false)
     174             :                 , bVisible(false)
     175             :                 , bContext(false)
     176             :                 , bHideFromMenu(false)
     177             :                 , bNoClose(false)
     178             :                 , bSoftClose(false)
     179             :                 , bContextActive(false)
     180             :                 , aDockingArea(::com::sun::star::ui::DockingArea_DOCKINGAREA_TOP)
     181             :                 , aDockPos(0, 0)
     182             :                 , aPos(0, 0)
     183             :                 , aSize(0, 0)
     184             :                 , nInternalState(0)
     185             :                 , nStyle(0)
     186           0 :                 , nMask(0)
     187             :             {
     188           0 :             }
     189             : 
     190             :             bool                                    bLocked : 1,
     191             :                                                     bDocked : 1,
     192             :                                                     bVisible : 1,
     193             :                                                     bContext : 1,
     194             :                                                     bHideFromMenu : 1,
     195             :                                                     bNoClose : 1,
     196             :                                                     bSoftClose : 1,
     197             :                                                     bContextActive : 1;
     198             :             ::com::sun::star::ui::DockingArea       aDockingArea;
     199             :             com::sun::star::awt::Point              aDockPos;
     200             :             com::sun::star::awt::Size               aDockSize;
     201             :             com::sun::star::awt::Point              aPos;
     202             :             com::sun::star::awt::Size               aSize;
     203             :             OUString                           aUIName;
     204             :             sal_uInt32                              nInternalState;
     205             :             sal_uInt16                              nStyle;
     206             :             sal_uInt32                              nMask; // see WindowStateMask
     207             :         };
     208             : 
     209             :         void                      impl_putPropertiesFromStruct( const WindowStateInfo& rWinStateInfo, Reference< XPropertySet >& xPropSet );
     210             :         Any                       impl_insertCacheAndReturnSequence( const OUString& rResourceURL, Reference< XNameAccess >& rNameAccess );
     211             :         WindowStateInfo&          impl_insertCacheAndReturnWinState( const OUString& rResourceURL, Reference< XNameAccess >& rNameAccess );
     212             :         Any                       impl_getSequenceFromStruct( const WindowStateInfo& rWinStateInfo );
     213             :         void                      impl_fillStructFromSequence( WindowStateInfo& rWinStateInfo, const Sequence< PropertyValue >& rSeq );
     214             :         Any                       impl_getWindowStateFromResourceURL( const OUString& rResourceURL );
     215             :         bool                  impl_initializeConfigAccess();
     216             : 
     217             :     private:
     218             :         typedef ::boost::unordered_map< OUString,
     219             :                                  WindowStateInfo,
     220             :                                  OUStringHash,
     221             :                                  ::std::equal_to< OUString > > ResourceURLToInfoCache;
     222             : 
     223             :         osl::Mutex m_aMutex;
     224             :         OUString                     m_aConfigWindowAccess;
     225             :         Reference< XMultiServiceFactory > m_xConfigProvider;
     226             :         Reference< XNameAccess >          m_xConfigAccess;
     227             :         Reference< XContainerListener >   m_xConfigListener;
     228             :         ResourceURLToInfoCache            m_aResourceURLToInfoCache;
     229             :         bool                          m_bConfigAccessInitialized : 1,
     230             :                                           m_bModified : 1;
     231             :         std::vector< OUString >           m_aPropArray;
     232             : };
     233             : 
     234           0 : ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const OUString& aModuleName, const Reference< XComponentContext >& rxContext ) :
     235             :     m_aConfigWindowAccess( "/org.openoffice.Office.UI." ),
     236             :     m_bConfigAccessInitialized( false ),
     237           0 :     m_bModified( false )
     238             : {
     239             :     // Create configuration hierachical access name
     240           0 :     m_aConfigWindowAccess += aModuleName;
     241           0 :     m_aConfigWindowAccess += "/UIElements/States";
     242           0 :     m_xConfigProvider = theDefaultProvider::get( rxContext );
     243             : 
     244             :     // Initialize access array with property names.
     245           0 :     sal_Int32 n = 0;
     246           0 :     while ( CONFIGURATION_PROPERTIES[n] )
     247             :     {
     248           0 :         m_aPropArray.push_back( OUString::createFromAscii( CONFIGURATION_PROPERTIES[n] ));
     249           0 :         ++n;
     250             :     }
     251           0 : }
     252             : 
     253           0 : ConfigurationAccess_WindowState::~ConfigurationAccess_WindowState()
     254             : {
     255             :     // SAFE
     256           0 :     osl::MutexGuard g(m_aMutex);
     257           0 :     Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
     258           0 :     if ( xContainer.is() )
     259           0 :         xContainer->removeContainerListener(m_xConfigListener);
     260           0 : }
     261             : 
     262             : // XNameAccess
     263           0 : Any SAL_CALL ConfigurationAccess_WindowState::getByName( const OUString& rResourceURL )
     264             : throw ( NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
     265             : {
     266             :     // SAFE
     267           0 :     osl::MutexGuard g(m_aMutex);
     268             : 
     269           0 :     ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     270           0 :     if ( pIter != m_aResourceURLToInfoCache.end() )
     271           0 :         return impl_getSequenceFromStruct( pIter->second );
     272             :     else
     273             :     {
     274           0 :         Any a( impl_getWindowStateFromResourceURL( rResourceURL ) );
     275           0 :         if ( a == Any() )
     276           0 :             throw NoSuchElementException();
     277             :         else
     278           0 :             return a;
     279           0 :     }
     280             : }
     281             : 
     282           0 : Sequence< OUString > SAL_CALL ConfigurationAccess_WindowState::getElementNames()
     283             : throw ( RuntimeException, std::exception )
     284             : {
     285             :     // SAFE
     286           0 :     osl::MutexGuard g(m_aMutex);
     287             : 
     288           0 :     if ( !m_bConfigAccessInitialized )
     289             :     {
     290           0 :         impl_initializeConfigAccess();
     291           0 :         m_bConfigAccessInitialized = true;
     292             :     }
     293             : 
     294           0 :     if ( m_xConfigAccess.is() )
     295           0 :         return m_xConfigAccess->getElementNames();
     296             :     else
     297           0 :         return Sequence< OUString > ();
     298             : }
     299             : 
     300           0 : sal_Bool SAL_CALL ConfigurationAccess_WindowState::hasByName( const OUString& rResourceURL )
     301             : throw (::com::sun::star::uno::RuntimeException, std::exception)
     302             : {
     303             :     // SAFE
     304           0 :     osl::MutexGuard g(m_aMutex);
     305             : 
     306           0 :     ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     307           0 :     if ( pIter != m_aResourceURLToInfoCache.end() )
     308           0 :         return sal_True;
     309             :     else
     310             :     {
     311           0 :         Any a( impl_getWindowStateFromResourceURL( rResourceURL ) );
     312           0 :         if ( a == Any() )
     313           0 :             return sal_False;
     314             :         else
     315           0 :             return sal_True;
     316           0 :     }
     317             : }
     318             : 
     319             : // XElementAccess
     320           0 : Type SAL_CALL ConfigurationAccess_WindowState::getElementType()
     321             : throw ( RuntimeException, std::exception )
     322             : {
     323           0 :     return( ::getCppuType( (const Sequence< PropertyValue >*)NULL ) );
     324             : }
     325             : 
     326           0 : sal_Bool SAL_CALL ConfigurationAccess_WindowState::hasElements()
     327             : throw ( RuntimeException, std::exception )
     328             : {
     329             :     // SAFE
     330           0 :     osl::MutexGuard g(m_aMutex);
     331             : 
     332           0 :     if ( !m_bConfigAccessInitialized )
     333             :     {
     334           0 :         impl_initializeConfigAccess();
     335           0 :         m_bConfigAccessInitialized = true;
     336             :     }
     337             : 
     338           0 :     if ( m_xConfigAccess.is() )
     339           0 :         return m_xConfigAccess->hasElements();
     340             :     else
     341           0 :         return sal_False;
     342             : }
     343             : 
     344             : // XNameContainer
     345           0 : void SAL_CALL ConfigurationAccess_WindowState::removeByName( const OUString& rResourceURL )
     346             : throw( NoSuchElementException, WrappedTargetException, RuntimeException, std::exception )
     347             : {
     348             :     // SAFE
     349           0 :     osl::ResettableMutexGuard g(m_aMutex);
     350             : 
     351           0 :     ResourceURLToInfoCache::iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     352           0 :     if ( pIter != m_aResourceURLToInfoCache.end() )
     353           0 :         m_aResourceURLToInfoCache.erase( pIter );
     354             : 
     355           0 :     if ( !m_bConfigAccessInitialized )
     356             :     {
     357           0 :         impl_initializeConfigAccess();
     358           0 :         m_bConfigAccessInitialized = true;
     359             :     }
     360             : 
     361             :     try
     362             :     {
     363             :         // Remove must be write-through => remove element from configuration
     364           0 :         Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
     365           0 :         if ( xNameContainer.is() )
     366             :         {
     367           0 :             g.clear();
     368             : 
     369           0 :             xNameContainer->removeByName( rResourceURL );
     370           0 :             Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
     371           0 :             if ( xFlush.is() )
     372           0 :                 xFlush->commitChanges();
     373           0 :         }
     374             :     }
     375           0 :     catch ( const com::sun::star::lang::WrappedTargetException& )
     376             :     {
     377           0 :     }
     378           0 : }
     379             : 
     380           0 : void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rResourceURL, const css::uno::Any& aPropertySet )
     381             : throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception )
     382             : {
     383             :     // SAFE
     384           0 :     osl::ResettableMutexGuard g(m_aMutex);
     385             : 
     386           0 :     Sequence< PropertyValue > aPropSet;
     387           0 :     if ( aPropertySet >>= aPropSet )
     388             :     {
     389           0 :         ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     390           0 :         if ( pIter != m_aResourceURLToInfoCache.end() )
     391           0 :             throw ElementExistException();
     392             :         else
     393             :         {
     394           0 :             if ( !m_bConfigAccessInitialized )
     395             :             {
     396           0 :                 impl_initializeConfigAccess();
     397           0 :                 m_bConfigAccessInitialized = true;
     398             :             }
     399             : 
     400             :             // Try to ask our configuration access
     401           0 :             if ( m_xConfigAccess.is() )
     402             :             {
     403           0 :                 if ( m_xConfigAccess->hasByName( rResourceURL ) )
     404           0 :                     throw ElementExistException();
     405             :                 else
     406             :                 {
     407           0 :                     WindowStateInfo aWinStateInfo;
     408           0 :                     impl_fillStructFromSequence( aWinStateInfo, aPropSet );
     409           0 :                     m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWinStateInfo ));
     410             : 
     411             :                     // insert must be write-through => insert element into configuration
     412           0 :                     Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
     413           0 :                     if ( xNameContainer.is() )
     414             :                     {
     415           0 :                         Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
     416           0 :                         g.clear();
     417             : 
     418             :                         try
     419             :                         {
     420           0 :                             Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
     421           0 :                             if ( xPropSet.is() )
     422             :                             {
     423           0 :                                 Any a;
     424           0 :                                 impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
     425           0 :                                 a <<= xPropSet;
     426           0 :                                 xNameContainer->insertByName( rResourceURL, a );
     427           0 :                                 Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
     428           0 :                                 if ( xFlush.is() )
     429           0 :                                     xFlush->commitChanges();
     430           0 :                             }
     431             :                         }
     432           0 :                         catch ( const Exception& )
     433             :                         {
     434           0 :                         }
     435           0 :                     }
     436             :                 }
     437             :             }
     438             :         }
     439             :     }
     440             :     else
     441           0 :         throw IllegalArgumentException();
     442           0 : }
     443             : 
     444             : // XNameReplace
     445           0 : void SAL_CALL ConfigurationAccess_WindowState::replaceByName( const OUString& rResourceURL, const css::uno::Any& aPropertySet )
     446             : throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception )
     447             : {
     448             :     // SAFE
     449           0 :     osl::ResettableMutexGuard g(m_aMutex);
     450             : 
     451           0 :     Sequence< PropertyValue > aPropSet;
     452           0 :     if ( aPropertySet >>= aPropSet )
     453             :     {
     454           0 :         ResourceURLToInfoCache::iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     455           0 :         if ( pIter != m_aResourceURLToInfoCache.end() )
     456             :         {
     457           0 :             WindowStateInfo& rWinStateInfo = pIter->second;
     458           0 :             impl_fillStructFromSequence( rWinStateInfo, aPropSet );
     459           0 :             m_bModified = true;
     460             :         }
     461             :         else
     462             :         {
     463           0 :             if ( !m_bConfigAccessInitialized )
     464             :             {
     465           0 :                 impl_initializeConfigAccess();
     466           0 :                 m_bConfigAccessInitialized = true;
     467             :             }
     468             : 
     469             :             // Try to ask our configuration access
     470           0 :             Reference< XNameAccess > xNameAccess;
     471           0 :             Any a( m_xConfigAccess->getByName( rResourceURL ));
     472             : 
     473           0 :             if ( a >>= xNameAccess )
     474             :             {
     475           0 :                 WindowStateInfo& rWinStateInfo( impl_insertCacheAndReturnWinState( rResourceURL, xNameAccess ));
     476           0 :                 impl_fillStructFromSequence( rWinStateInfo, aPropSet );
     477           0 :                 m_bModified = true;
     478           0 :                 pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     479             :             }
     480             :             else
     481           0 :                 throw NoSuchElementException();
     482             :         }
     483             : 
     484           0 :         if ( m_bModified && pIter != m_aResourceURLToInfoCache.end() )
     485             :         {
     486           0 :             Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
     487           0 :             if ( xNameContainer.is() )
     488             :             {
     489           0 :                 WindowStateInfo aWinStateInfo( pIter->second );
     490           0 :                 OUString        aResourceURL( pIter->first );
     491           0 :                 m_bModified = false;
     492           0 :                 g.clear();
     493             : 
     494             :                 try
     495             :                 {
     496           0 :                     Reference< XPropertySet > xPropSet;
     497           0 :                     if ( xNameContainer->getByName( aResourceURL ) >>= xPropSet )
     498             :                     {
     499           0 :                         impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
     500             : 
     501           0 :                         Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
     502           0 :                         if ( xFlush.is() )
     503           0 :                             xFlush->commitChanges();
     504           0 :                     }
     505             :                 }
     506           0 :                 catch ( const Exception& )
     507             :                 {
     508           0 :                 }
     509           0 :             }
     510             :         }
     511             :     }
     512             :     else
     513           0 :         throw IllegalArgumentException();
     514           0 : }
     515             : 
     516             : // container.XContainerListener
     517           0 : void SAL_CALL ConfigurationAccess_WindowState::elementInserted( const ContainerEvent& ) throw(RuntimeException, std::exception)
     518             : {
     519             :     // do nothing - next time someone wants to retrieve this node we will find it in the configuration
     520           0 : }
     521             : 
     522           0 : void SAL_CALL ConfigurationAccess_WindowState::elementRemoved ( const ContainerEvent& ) throw(RuntimeException, std::exception)
     523             : {
     524           0 : }
     525             : 
     526           0 : void SAL_CALL ConfigurationAccess_WindowState::elementReplaced( const ContainerEvent& ) throw(RuntimeException, std::exception)
     527             : {
     528           0 : }
     529             : 
     530             : // lang.XEventListener
     531           0 : void SAL_CALL ConfigurationAccess_WindowState::disposing( const EventObject& aEvent ) throw(RuntimeException, std::exception)
     532             : {
     533             :     // SAFE
     534             :     // remove our reference to the config access
     535           0 :     osl::MutexGuard g(m_aMutex);
     536             : 
     537           0 :     Reference< XInterface > xIfac1( aEvent.Source, UNO_QUERY );
     538           0 :     Reference< XInterface > xIfac2( m_xConfigAccess, UNO_QUERY );
     539           0 :     if ( xIfac1 == xIfac2 )
     540           0 :         m_xConfigAccess.clear();
     541           0 : }
     542             : 
     543             : // private helper methods
     544           0 : Any ConfigurationAccess_WindowState::impl_getSequenceFromStruct( const WindowStateInfo& rWinStateInfo )
     545             : {
     546           0 :     sal_Int32                 i( 0 );
     547           0 :     sal_Int32                 nCount( m_aPropArray.size() );
     548           0 :     Sequence< PropertyValue > aPropSeq;
     549             : 
     550           0 :     for ( i = 0; i < nCount; i++ )
     551             :     {
     552           0 :         if ( rWinStateInfo.nMask & ( 1 << i ))
     553             :         {
     554             :             // put value into the return sequence
     555           0 :             sal_Int32 nIndex( aPropSeq.getLength());
     556           0 :             aPropSeq.realloc( nIndex+1 );
     557           0 :             aPropSeq[nIndex].Name = m_aPropArray[i];
     558             : 
     559           0 :             switch ( i )
     560             :             {
     561             :                 case PROPERTY_LOCKED:
     562           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bLocked ); break;
     563             :                 case PROPERTY_DOCKED:
     564           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bDocked ); break;
     565             :                 case PROPERTY_VISIBLE:
     566           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bVisible ); break;
     567             :                 case PROPERTY_CONTEXT:
     568           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bContext ); break;
     569             :                 case PROPERTY_HIDEFROMMENU:
     570           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bHideFromMenu ); break;
     571             :                 case PROPERTY_NOCLOSE:
     572           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bNoClose ); break;
     573             :                 case PROPERTY_SOFTCLOSE:
     574           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bSoftClose ); break;
     575             :                 case PROPERTY_CONTEXTACTIVE:
     576           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bContextActive ); break;
     577             :                 case PROPERTY_DOCKINGAREA:
     578           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockingArea ); break;
     579             :                 case PROPERTY_POS:
     580           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aPos ); break;
     581             :                 case PROPERTY_SIZE:
     582           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aSize ); break;
     583             :                 case PROPERTY_UINAME:
     584           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aUIName ); break;
     585             :                 case PROPERTY_INTERNALSTATE:
     586           0 :                     aPropSeq[nIndex].Value = makeAny( sal_Int32( rWinStateInfo.nInternalState )); break;
     587             :                 case PROPERTY_STYLE:
     588           0 :                     aPropSeq[nIndex].Value = makeAny( sal_Int16( rWinStateInfo.nStyle )); break;
     589             :                 case PROPERTY_DOCKPOS:
     590           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockPos ); break;
     591             :                 case PROPERTY_DOCKSIZE:
     592           0 :                     aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockSize ); break;
     593             :                 default:
     594             :                     DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
     595             :             }
     596             :         }
     597             :     }
     598             : 
     599           0 :     return makeAny( aPropSeq );
     600             : }
     601             : 
     602           0 : Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OUString& rResourceURL, Reference< XNameAccess >& xNameAccess )
     603             : {
     604           0 :     sal_Int32                 nMask( 0 );
     605           0 :     sal_Int32                 nCount( m_aPropArray.size() );
     606           0 :     sal_Int32                 i( 0 );
     607           0 :     sal_Int32                 nIndex( 0 );
     608           0 :     Sequence< PropertyValue > aPropSeq;
     609           0 :     WindowStateInfo           aWindowStateInfo;
     610             : 
     611           0 :     for ( i = 0; i < nCount; i++ )
     612             :     {
     613             :         try
     614             :         {
     615           0 :             bool    bAddToSeq( false );
     616           0 :             Any     a( xNameAccess->getByName( m_aPropArray[i] ) );
     617           0 :             switch ( i )
     618             :             {
     619             :                 case PROPERTY_LOCKED:
     620             :                 case PROPERTY_DOCKED:
     621             :                 case PROPERTY_VISIBLE:
     622             :                 case PROPERTY_CONTEXT:
     623             :                 case PROPERTY_HIDEFROMMENU:
     624             :                 case PROPERTY_NOCLOSE:
     625             :                 case PROPERTY_SOFTCLOSE:
     626             :                 case PROPERTY_CONTEXTACTIVE:
     627             :                 {
     628             :                     bool bValue;
     629           0 :                     if ( a >>= bValue )
     630             :                     {
     631           0 :                         sal_Int32 nValue( 1 << i );
     632           0 :                         nMask |= nValue;
     633           0 :                         bAddToSeq = true;
     634           0 :                         switch ( i )
     635             :                         {
     636             :                             case PROPERTY_LOCKED:
     637           0 :                                 aWindowStateInfo.bLocked = bValue; break;
     638             :                             case PROPERTY_DOCKED:
     639           0 :                                 aWindowStateInfo.bDocked = bValue; break;
     640             :                             case PROPERTY_VISIBLE:
     641           0 :                                 aWindowStateInfo.bVisible = bValue; break;
     642             :                             case PROPERTY_CONTEXT:
     643           0 :                                 aWindowStateInfo.bContext = bValue; break;
     644             :                             case PROPERTY_HIDEFROMMENU:
     645           0 :                                 aWindowStateInfo.bHideFromMenu = bValue; break;
     646             :                             case PROPERTY_NOCLOSE:
     647           0 :                                 aWindowStateInfo.bNoClose = bValue; break;
     648             :                             case PROPERTY_SOFTCLOSE:
     649           0 :                                 aWindowStateInfo.bSoftClose = bValue; break;
     650             :                             case PROPERTY_CONTEXTACTIVE:
     651           0 :                                 aWindowStateInfo.bContextActive = bValue; break;
     652             :                         }
     653             :                     }
     654             :                 }
     655           0 :                 break;
     656             : 
     657             :                 case PROPERTY_DOCKINGAREA:
     658             :                 {
     659           0 :                     sal_Int32 nDockingArea = 0;
     660           0 :                     if ( a >>= nDockingArea )
     661             :                     {
     662           0 :                         if (( nDockingArea >= 0 ) &&
     663           0 :                             ( nDockingArea <= sal_Int32( DockingArea_DOCKINGAREA_RIGHT )))
     664             :                         {
     665           0 :                             aWindowStateInfo.aDockingArea = (DockingArea)nDockingArea;
     666           0 :                             nMask |= WINDOWSTATE_MASK_DOCKINGAREA;
     667           0 :                             a = makeAny( aWindowStateInfo.aDockingArea );
     668           0 :                             bAddToSeq = true;
     669             :                         }
     670             :                     }
     671             :                 }
     672           0 :                 break;
     673             : 
     674             :                 case PROPERTY_POS:
     675             :                 case PROPERTY_DOCKPOS:
     676             :                 {
     677           0 :                     OUString aString;
     678           0 :                     if ( a >>= aString )
     679             :                     {
     680           0 :                         sal_Int32 nToken( 0 );
     681           0 :                         OUString aXStr = aString.getToken( 0, ',', nToken );
     682           0 :                         if ( nToken > 0 )
     683             :                         {
     684           0 :                             com::sun::star::awt::Point aPos;
     685           0 :                             aPos.X = aXStr.toInt32();
     686           0 :                             aPos.Y = aString.getToken( 0, ',', nToken ).toInt32();
     687             : 
     688           0 :                             if ( i == PROPERTY_POS )
     689             :                             {
     690           0 :                                 aWindowStateInfo.aPos = aPos;
     691           0 :                                 nMask |= WINDOWSTATE_MASK_POS;
     692             :                             }
     693             :                             else
     694             :                             {
     695           0 :                                 aWindowStateInfo.aDockPos = aPos;
     696           0 :                                 nMask |= WINDOWSTATE_MASK_DOCKPOS;
     697             :                             }
     698             : 
     699           0 :                             a <<= aPos;
     700           0 :                             bAddToSeq = true;
     701           0 :                         }
     702           0 :                     }
     703             :                 }
     704           0 :                 break;
     705             : 
     706             :                 case PROPERTY_SIZE:
     707             :                 case PROPERTY_DOCKSIZE:
     708             :                 {
     709           0 :                     OUString aString;
     710           0 :                     if ( a >>= aString )
     711             :                     {
     712           0 :                         sal_Int32 nToken( 0 );
     713           0 :                         OUString aStr = aString.getToken( 0, ',', nToken );
     714           0 :                         if ( nToken > 0 )
     715             :                         {
     716           0 :                             com::sun::star::awt::Size aSize;
     717           0 :                             aSize.Width = aStr.toInt32();
     718           0 :                             aSize.Height = aString.getToken( 0, ',', nToken ).toInt32();
     719           0 :                             if ( i == PROPERTY_SIZE )
     720             :                             {
     721           0 :                                 aWindowStateInfo.aSize = aSize;
     722           0 :                                 nMask |= WINDOWSTATE_MASK_SIZE;
     723             :                             }
     724             :                             else
     725             :                             {
     726           0 :                                 aWindowStateInfo.aDockSize = aSize;
     727           0 :                                 nMask |= WINDOWSTATE_MASK_DOCKSIZE;
     728             :                             }
     729             : 
     730           0 :                             a <<= aSize;
     731           0 :                             bAddToSeq = true;
     732           0 :                         }
     733           0 :                     }
     734             :                 }
     735           0 :                 break;
     736             : 
     737             :                 case PROPERTY_UINAME:
     738             :                 {
     739           0 :                     OUString aValue;
     740           0 :                     if ( a >>= aValue )
     741             :                     {
     742           0 :                         nMask |= WINDOWSTATE_MASK_UINAME;
     743           0 :                         aWindowStateInfo.aUIName = aValue;
     744           0 :                         bAddToSeq = true;
     745           0 :                     }
     746             :                 }
     747           0 :                 break;
     748             : 
     749             :                 case PROPERTY_INTERNALSTATE:
     750             :                 {
     751           0 :                     sal_uInt32 nValue = 0;
     752           0 :                     if ( a >>= nValue )
     753             :                     {
     754           0 :                         nMask |= WINDOWSTATE_MASK_INTERNALSTATE;
     755           0 :                         aWindowStateInfo.nInternalState = nValue;
     756           0 :                         bAddToSeq = true;
     757             :                     }
     758             :                 }
     759           0 :                 break;
     760             : 
     761             :                 case PROPERTY_STYLE:
     762             :                 {
     763           0 :                     sal_Int32 nValue = 0;
     764           0 :                     if ( a >>= nValue )
     765             :                     {
     766           0 :                         nMask |= WINDOWSTATE_MASK_STYLE;
     767           0 :                         aWindowStateInfo.nStyle = sal_uInt16( nValue );
     768           0 :                         bAddToSeq = true;
     769             :                     }
     770             :                 }
     771           0 :                 break;
     772             : 
     773             :                 default:
     774             :                     DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
     775             :             }
     776             : 
     777           0 :             if ( bAddToSeq )
     778             :             {
     779             :                 // put value into the return sequence
     780           0 :                 nIndex = aPropSeq.getLength();
     781           0 :                 aPropSeq.realloc( nIndex+1 );
     782           0 :                 aPropSeq[nIndex].Name  = m_aPropArray[i];
     783           0 :                 aPropSeq[nIndex].Value = a;
     784           0 :             }
     785             :         }
     786           0 :         catch( const com::sun::star::container::NoSuchElementException& )
     787             :         {
     788             :         }
     789           0 :         catch ( const com::sun::star::lang::WrappedTargetException& )
     790             :         {
     791             :         }
     792             :     }
     793             : 
     794           0 :     aWindowStateInfo.nMask = nMask;
     795           0 :     m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWindowStateInfo ));
     796           0 :     return makeAny( aPropSeq );
     797             : }
     798             : 
     799           0 : ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowState::impl_insertCacheAndReturnWinState( const OUString& rResourceURL, Reference< XNameAccess >& rNameAccess )
     800             : {
     801           0 :     sal_Int32                 nMask( 0 );
     802           0 :     sal_Int32                 nCount( m_aPropArray.size() );
     803           0 :     sal_Int32                 i( 0 );
     804           0 :     WindowStateInfo           aWindowStateInfo;
     805             : 
     806           0 :     for ( i = 0; i < nCount; i++ )
     807             :     {
     808             :         try
     809             :         {
     810           0 :             Any     a( rNameAccess->getByName( m_aPropArray[i] ) );
     811           0 :             switch ( i )
     812             :             {
     813             :                 case PROPERTY_LOCKED:
     814             :                 case PROPERTY_DOCKED:
     815             :                 case PROPERTY_VISIBLE:
     816             :                 case PROPERTY_CONTEXT:
     817             :                 case PROPERTY_HIDEFROMMENU:
     818             :                 case PROPERTY_NOCLOSE:
     819             :                 case PROPERTY_SOFTCLOSE:
     820             :                 case PROPERTY_CONTEXTACTIVE:
     821             :                 {
     822             :                     bool bValue;
     823           0 :                     if ( a >>= bValue )
     824             :                     {
     825           0 :                         sal_Int32 nValue( 1 << i );
     826           0 :                         nMask |= nValue;
     827           0 :                         switch ( i )
     828             :                         {
     829             :                             case PROPERTY_LOCKED:
     830           0 :                                 aWindowStateInfo.bLocked = bValue; break;
     831             :                             case PROPERTY_DOCKED:
     832           0 :                                 aWindowStateInfo.bDocked = bValue; break;
     833             :                             case PROPERTY_VISIBLE:
     834           0 :                                 aWindowStateInfo.bVisible = bValue; break;
     835             :                             case PROPERTY_CONTEXT:
     836           0 :                                 aWindowStateInfo.bContext = bValue; break;
     837             :                             case PROPERTY_HIDEFROMMENU:
     838           0 :                                 aWindowStateInfo.bHideFromMenu = bValue; break;
     839             :                             case PROPERTY_NOCLOSE:
     840           0 :                                 aWindowStateInfo.bNoClose = bValue; break;
     841             :                             case PROPERTY_SOFTCLOSE:
     842           0 :                                 aWindowStateInfo.bNoClose = bValue; break;
     843             :                             case PROPERTY_CONTEXTACTIVE:
     844           0 :                                 aWindowStateInfo.bContextActive = bValue; break;
     845             :                             default:
     846             :                                 DBG_ASSERT( false, "Unknown boolean property in WindowState found!" );
     847             :                         }
     848             :                     }
     849             :                 }
     850           0 :                 break;
     851             : 
     852             :                 case PROPERTY_DOCKINGAREA:
     853             :                 {
     854           0 :                     sal_Int32 nDockingArea = 0;
     855           0 :                     if ( a >>= nDockingArea )
     856             :                     {
     857           0 :                         if (( nDockingArea >= 0 ) &&
     858           0 :                             ( nDockingArea <= sal_Int32( DockingArea_DOCKINGAREA_RIGHT )))
     859             :                         {
     860           0 :                             aWindowStateInfo.aDockingArea = (DockingArea)nDockingArea;
     861           0 :                             nMask |= WINDOWSTATE_MASK_DOCKINGAREA;
     862             :                         }
     863             :                     }
     864             :                 }
     865           0 :                 break;
     866             : 
     867             :                 case PROPERTY_POS:
     868             :                 case PROPERTY_DOCKPOS:
     869             :                 {
     870           0 :                     OUString aString;
     871           0 :                     if ( a >>= aString )
     872             :                     {
     873           0 :                         sal_Int32 nToken( 0 );
     874           0 :                         OUString aXStr = aString.getToken( 0, ',', nToken );
     875           0 :                         if ( nToken > 0 )
     876             :                         {
     877           0 :                             com::sun::star::awt::Point aPos;
     878           0 :                             aPos.X = aXStr.toInt32();
     879           0 :                             aPos.Y = aString.getToken( 0, ',', nToken ).toInt32();
     880             : 
     881           0 :                             if ( i == PROPERTY_POS )
     882             :                             {
     883           0 :                                 aWindowStateInfo.aPos = aPos;
     884           0 :                                 nMask |= WINDOWSTATE_MASK_POS;
     885             :                             }
     886             :                             else
     887             :                             {
     888           0 :                                 aWindowStateInfo.aDockPos = aPos;
     889           0 :                                 nMask |= WINDOWSTATE_MASK_DOCKPOS;
     890             :                             }
     891           0 :                         }
     892           0 :                     }
     893             :                 }
     894           0 :                 break;
     895             : 
     896             :                 case PROPERTY_SIZE:
     897             :                 case PROPERTY_DOCKSIZE:
     898             :                 {
     899           0 :                     OUString aString;
     900           0 :                     if ( a >>= aString )
     901             :                     {
     902           0 :                         sal_Int32 nToken( 0 );
     903           0 :                         OUString aStr = aString.getToken( 0, ',', nToken );
     904           0 :                         if ( nToken > 0 )
     905             :                         {
     906           0 :                             com::sun::star::awt::Size aSize;
     907           0 :                             aSize.Width  = aStr.toInt32();
     908           0 :                             aSize.Height = aString.getToken( 0, ',', nToken ).toInt32();
     909           0 :                             if ( i == PROPERTY_SIZE )
     910             :                             {
     911           0 :                                 aWindowStateInfo.aSize = aSize;
     912           0 :                                 nMask |= WINDOWSTATE_MASK_SIZE;
     913             :                             }
     914             :                             else
     915             :                             {
     916           0 :                                 aWindowStateInfo.aDockSize = aSize;
     917           0 :                                 nMask |= WINDOWSTATE_MASK_DOCKSIZE;
     918             :                             }
     919           0 :                         }
     920           0 :                     }
     921             :                 }
     922           0 :                 break;
     923             : 
     924             :                 case PROPERTY_UINAME:
     925             :                 {
     926           0 :                     OUString aValue;
     927           0 :                     if ( a >>= aValue )
     928             :                     {
     929           0 :                         nMask |= WINDOWSTATE_MASK_UINAME;
     930           0 :                         aWindowStateInfo.aUIName = aValue;
     931           0 :                     }
     932             :                 }
     933           0 :                 break;
     934             : 
     935             :                 case PROPERTY_INTERNALSTATE:
     936             :                 {
     937           0 :                     sal_Int32 nValue = 0;
     938           0 :                     if ( a >>= nValue )
     939             :                     {
     940           0 :                         nMask |= WINDOWSTATE_MASK_INTERNALSTATE;
     941           0 :                         aWindowStateInfo.nInternalState = sal_uInt32( nValue );
     942             :                     }
     943             :                 }
     944           0 :                 break;
     945             : 
     946             :                 case PROPERTY_STYLE:
     947             :                 {
     948           0 :                     sal_Int32 nValue = 0;
     949           0 :                     if ( a >>= nValue )
     950             :                     {
     951           0 :                         nMask |= WINDOWSTATE_MASK_STYLE;
     952           0 :                         aWindowStateInfo.nStyle = sal_uInt16( nValue );
     953             :                     }
     954             :                 }
     955           0 :                 break;
     956             : 
     957             :                 default:
     958             :                     DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
     959           0 :             }
     960             :         }
     961           0 :         catch( const com::sun::star::container::NoSuchElementException& )
     962             :         {
     963             :         }
     964           0 :         catch ( const com::sun::star::lang::WrappedTargetException& )
     965             :         {
     966             :         }
     967             :     }
     968             : 
     969           0 :     aWindowStateInfo.nMask = nMask;
     970           0 :     ResourceURLToInfoCache::iterator pIter = (m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWindowStateInfo ))).first;
     971           0 :     return pIter->second;
     972             : }
     973             : 
     974           0 : Any ConfigurationAccess_WindowState::impl_getWindowStateFromResourceURL( const OUString& rResourceURL )
     975             : {
     976           0 :     if ( !m_bConfigAccessInitialized )
     977             :     {
     978           0 :         impl_initializeConfigAccess();
     979           0 :         m_bConfigAccessInitialized = true;
     980             :     }
     981             : 
     982             :     try
     983             :     {
     984             :         // Try to ask our configuration access
     985           0 :         if ( m_xConfigAccess.is() && m_xConfigAccess->hasByName( rResourceURL ) )
     986             :         {
     987             : 
     988           0 :             Reference< XNameAccess > xNameAccess( m_xConfigAccess->getByName( rResourceURL ), UNO_QUERY );
     989           0 :             if ( xNameAccess.is() )
     990           0 :                 return impl_insertCacheAndReturnSequence( rResourceURL, xNameAccess );
     991             :         }
     992             :     }
     993           0 :     catch( const com::sun::star::container::NoSuchElementException& )
     994             :     {
     995             :     }
     996           0 :     catch ( const com::sun::star::lang::WrappedTargetException& )
     997             :     {
     998             :     }
     999             : 
    1000           0 :     return Any();
    1001             : }
    1002             : 
    1003           0 : void ConfigurationAccess_WindowState::impl_fillStructFromSequence( WindowStateInfo& rWinStateInfo, const Sequence< PropertyValue >& rSeq )
    1004             : {
    1005           0 :     sal_Int32 nCompareCount( m_aPropArray.size() );
    1006           0 :     sal_Int32 nCount( rSeq.getLength() );
    1007           0 :     sal_Int32 i( 0 );
    1008             : 
    1009           0 :     for ( i = 0; i < nCount; i++ )
    1010             :     {
    1011           0 :         for ( sal_Int32 j = 0; j < nCompareCount; j++ )
    1012             :         {
    1013           0 :             if ( rSeq[i].Name.equals( m_aPropArray[j] ))
    1014             :             {
    1015           0 :                 switch ( j )
    1016             :                 {
    1017             :                     case PROPERTY_LOCKED:
    1018             :                     case PROPERTY_DOCKED:
    1019             :                     case PROPERTY_VISIBLE:
    1020             :                     case PROPERTY_CONTEXT:
    1021             :                     case PROPERTY_HIDEFROMMENU:
    1022             :                     case PROPERTY_NOCLOSE:
    1023             :                     case PROPERTY_SOFTCLOSE:
    1024             :                     case PROPERTY_CONTEXTACTIVE:
    1025             :                     {
    1026             :                         bool bValue;
    1027           0 :                         if ( rSeq[i].Value >>= bValue )
    1028             :                         {
    1029           0 :                             sal_Int32 nValue( 1 << j );
    1030           0 :                             rWinStateInfo.nMask |= nValue;
    1031           0 :                             switch ( j )
    1032             :                             {
    1033             :                                 case PROPERTY_LOCKED:
    1034           0 :                                     rWinStateInfo.bLocked = bValue;
    1035           0 :                                     break;
    1036             :                                 case PROPERTY_DOCKED:
    1037           0 :                                     rWinStateInfo.bDocked = bValue;
    1038           0 :                                     break;
    1039             :                                 case PROPERTY_VISIBLE:
    1040           0 :                                     rWinStateInfo.bVisible = bValue;
    1041           0 :                                     break;
    1042             :                                 case PROPERTY_CONTEXT:
    1043           0 :                                     rWinStateInfo.bContext = bValue;
    1044           0 :                                     break;
    1045             :                                 case PROPERTY_HIDEFROMMENU:
    1046           0 :                                     rWinStateInfo.bHideFromMenu = bValue;
    1047           0 :                                     break;
    1048             :                                 case PROPERTY_NOCLOSE:
    1049           0 :                                     rWinStateInfo.bNoClose = bValue;
    1050           0 :                                     break;
    1051             :                                 case PROPERTY_SOFTCLOSE:
    1052           0 :                                     rWinStateInfo.bSoftClose = bValue;
    1053           0 :                                     break;
    1054             :                                 case PROPERTY_CONTEXTACTIVE:
    1055           0 :                                     rWinStateInfo.bContextActive = bValue;
    1056           0 :                                     break;
    1057             :                             }
    1058             :                         }
    1059             :                     }
    1060           0 :                     break;
    1061             : 
    1062             :                     case PROPERTY_DOCKINGAREA:
    1063             :                     {
    1064             :                         ::com::sun::star::ui::DockingArea eDockingArea;
    1065           0 :                         if ( rSeq[i].Value >>= eDockingArea )
    1066             :                         {
    1067           0 :                             rWinStateInfo.aDockingArea = eDockingArea;
    1068           0 :                             rWinStateInfo.nMask |= WINDOWSTATE_MASK_DOCKINGAREA;
    1069             :                         }
    1070             :                     }
    1071           0 :                     break;
    1072             : 
    1073             :                     case PROPERTY_POS:
    1074             :                     case PROPERTY_DOCKPOS:
    1075             :                     {
    1076           0 :                         com::sun::star::awt::Point aPoint;
    1077           0 :                         if ( rSeq[i].Value >>= aPoint )
    1078             :                         {
    1079           0 :                             if ( j == PROPERTY_POS )
    1080             :                             {
    1081           0 :                                 rWinStateInfo.aPos = aPoint;
    1082           0 :                                 rWinStateInfo.nMask |= WINDOWSTATE_MASK_POS;
    1083             :                             }
    1084             :                             else
    1085             :                             {
    1086           0 :                                 rWinStateInfo.aDockPos = aPoint;
    1087           0 :                                 rWinStateInfo.nMask |= WINDOWSTATE_MASK_DOCKPOS;
    1088             :                             }
    1089             :                         }
    1090             :                     }
    1091           0 :                     break;
    1092             : 
    1093             :                     case PROPERTY_SIZE:
    1094             :                     case PROPERTY_DOCKSIZE:
    1095             :                     {
    1096           0 :                         com::sun::star::awt::Size aSize;
    1097           0 :                         if ( rSeq[i].Value >>= aSize )
    1098             :                         {
    1099           0 :                             if ( j == PROPERTY_SIZE )
    1100             :                             {
    1101           0 :                                 rWinStateInfo.aSize = aSize;
    1102           0 :                                 rWinStateInfo.nMask |= WINDOWSTATE_MASK_SIZE;
    1103             :                             }
    1104             :                             else
    1105             :                             {
    1106           0 :                                 rWinStateInfo.aDockSize = aSize;
    1107           0 :                                 rWinStateInfo.nMask |= WINDOWSTATE_MASK_DOCKSIZE;
    1108             :                             }
    1109             :                         }
    1110             :                     }
    1111           0 :                     break;
    1112             : 
    1113             :                     case PROPERTY_UINAME:
    1114             :                     {
    1115           0 :                         OUString aValue;
    1116           0 :                         if ( rSeq[i].Value >>= aValue )
    1117             :                         {
    1118           0 :                             rWinStateInfo.aUIName = aValue;
    1119           0 :                             rWinStateInfo.nMask |= WINDOWSTATE_MASK_UINAME;
    1120           0 :                         }
    1121             :                     }
    1122           0 :                     break;
    1123             : 
    1124             :                     case PROPERTY_INTERNALSTATE:
    1125             :                     {
    1126           0 :                         sal_Int32 nValue = 0;
    1127           0 :                         if ( rSeq[i].Value >>= nValue )
    1128             :                         {
    1129           0 :                             rWinStateInfo.nInternalState = sal_uInt32( nValue );
    1130           0 :                             rWinStateInfo.nMask |= WINDOWSTATE_MASK_INTERNALSTATE;
    1131             :                         }
    1132             :                     }
    1133           0 :                     break;
    1134             : 
    1135             :                     case PROPERTY_STYLE:
    1136             :                     {
    1137           0 :                         sal_Int32 nValue = 0;
    1138           0 :                         if ( rSeq[i].Value >>= nValue )
    1139             :                         {
    1140           0 :                             rWinStateInfo.nStyle = sal_uInt16( nValue );
    1141           0 :                             rWinStateInfo.nMask |= WINDOWSTATE_MASK_STYLE;
    1142             :                         }
    1143             :                     }
    1144           0 :                     break;
    1145             : 
    1146             :                     default:
    1147             :                         DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
    1148             :                 }
    1149             : 
    1150           0 :                 break;
    1151             :             }
    1152             :         }
    1153             :     }
    1154           0 : }
    1155             : 
    1156           0 : void ConfigurationAccess_WindowState::impl_putPropertiesFromStruct( const WindowStateInfo& rWinStateInfo, Reference< XPropertySet >& xPropSet )
    1157             : {
    1158           0 :     sal_Int32                 i( 0 );
    1159           0 :     sal_Int32                 nCount( m_aPropArray.size() );
    1160           0 :     OUString                  aDelim( "," );
    1161             : 
    1162           0 :     for ( i = 0; i < nCount; i++ )
    1163             :     {
    1164           0 :         if ( rWinStateInfo.nMask & ( 1 << i ))
    1165             :         {
    1166             :             try
    1167             :             {
    1168             :                 // put values into the property set
    1169           0 :                 switch ( i )
    1170             :                 {
    1171             :                     case PROPERTY_LOCKED:
    1172           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bLocked ) ); break;
    1173             :                     case PROPERTY_DOCKED:
    1174           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bDocked ) ); break;
    1175             :                     case PROPERTY_VISIBLE:
    1176           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bVisible ) ); break;
    1177             :                     case PROPERTY_CONTEXT:
    1178           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bContext ) ); break;
    1179             :                     case PROPERTY_HIDEFROMMENU:
    1180           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bHideFromMenu ) ); break;
    1181             :                     case PROPERTY_NOCLOSE:
    1182           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bNoClose ) ); break;
    1183             :                     case PROPERTY_SOFTCLOSE:
    1184           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bSoftClose ) ); break;
    1185             :                     case PROPERTY_CONTEXTACTIVE:
    1186           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.bContextActive ) ); break;
    1187             :                     case PROPERTY_DOCKINGAREA:
    1188           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( sal_Int16( rWinStateInfo.aDockingArea ) ) ); break;
    1189             :                     case PROPERTY_POS:
    1190             :                     case PROPERTY_DOCKPOS:
    1191             :                     {
    1192           0 :                         OUString aPosStr;
    1193           0 :                         if ( i == PROPERTY_POS )
    1194           0 :                             aPosStr = OUString::number( rWinStateInfo.aPos.X );
    1195             :                         else
    1196           0 :                             aPosStr = OUString::number( rWinStateInfo.aDockPos.X );
    1197           0 :                         aPosStr += aDelim;
    1198           0 :                         if ( i == PROPERTY_POS )
    1199           0 :                             aPosStr += OUString::number( rWinStateInfo.aPos.Y );
    1200             :                         else
    1201           0 :                             aPosStr += OUString::number( rWinStateInfo.aDockPos.Y );
    1202           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( aPosStr ) );
    1203           0 :                         break;
    1204             :                     }
    1205             :                     case PROPERTY_SIZE:
    1206             :                     case PROPERTY_DOCKSIZE:
    1207             :                     {
    1208           0 :                         OUString aSizeStr;
    1209           0 :                         if ( i == PROPERTY_SIZE )
    1210           0 :                             aSizeStr = ( OUString::number( rWinStateInfo.aSize.Width ));
    1211             :                         else
    1212           0 :                             aSizeStr = ( OUString::number( rWinStateInfo.aDockSize.Width ));
    1213           0 :                         aSizeStr += aDelim;
    1214           0 :                         if ( i == PROPERTY_SIZE )
    1215           0 :                             aSizeStr += OUString::number( rWinStateInfo.aSize.Height );
    1216             :                         else
    1217           0 :                             aSizeStr += OUString::number( rWinStateInfo.aDockSize.Height );
    1218           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( aSizeStr ) );
    1219           0 :                         break;
    1220             :                     }
    1221             :                     case PROPERTY_UINAME:
    1222           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( rWinStateInfo.aUIName ) ); break;
    1223             :                     case PROPERTY_INTERNALSTATE:
    1224           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( sal_Int32( rWinStateInfo.nInternalState )) ); break;
    1225             :                     case PROPERTY_STYLE:
    1226           0 :                         xPropSet->setPropertyValue( m_aPropArray[i], makeAny( sal_Int32( rWinStateInfo.nStyle )) ); break;
    1227             :                     default:
    1228             :                         DBG_ASSERT( false, "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" );
    1229             :                 }
    1230             :             }
    1231           0 :             catch( const Exception& )
    1232             :             {
    1233             :             }
    1234             :         }
    1235           0 :     }
    1236           0 : }
    1237             : 
    1238           0 : bool ConfigurationAccess_WindowState::impl_initializeConfigAccess()
    1239             : {
    1240           0 :     Sequence< Any > aArgs( 2 );
    1241           0 :     PropertyValue   aPropValue;
    1242             : 
    1243             :     try
    1244             :     {
    1245           0 :         aPropValue.Name  = "nodepath";
    1246           0 :         aPropValue.Value <<= m_aConfigWindowAccess;
    1247           0 :         aArgs[0] <<= aPropValue;
    1248           0 :         aPropValue.Name = "lazywrite";
    1249           0 :         aPropValue.Value <<= sal_True;
    1250           0 :         aArgs[1] <<= aPropValue;
    1251             : 
    1252           0 :         m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
    1253           0 :                     "com.sun.star.configuration.ConfigurationUpdateAccess", aArgs ), UNO_QUERY );
    1254           0 :         if ( m_xConfigAccess.is() )
    1255             :         {
    1256             :             // Add as container listener
    1257           0 :             Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
    1258           0 :             if ( xContainer.is() )
    1259             :             {
    1260           0 :                 m_xConfigListener = new WeakContainerListener(this);
    1261           0 :                 xContainer->addContainerListener(m_xConfigListener);
    1262           0 :             }
    1263             :         }
    1264             : 
    1265           0 :         return true;
    1266             :     }
    1267           0 :     catch ( const WrappedTargetException& )
    1268             :     {
    1269             :     }
    1270           0 :     catch ( const Exception& )
    1271             :     {
    1272             :     }
    1273             : 
    1274           0 :     return false;
    1275             : }
    1276             : 
    1277             : typedef ::cppu::WeakComponentImplHelper2< css::container::XNameAccess,
    1278             :         css::lang::XServiceInfo> WindowStateConfiguration_BASE;
    1279             : 
    1280             : class WindowStateConfiguration : private cppu::BaseMutex,
    1281             :                                  public WindowStateConfiguration_BASE
    1282             : {
    1283             : public:
    1284             :     WindowStateConfiguration( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
    1285             :     virtual ~WindowStateConfiguration();
    1286             : 
    1287           0 :     virtual OUString SAL_CALL getImplementationName()
    1288             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1289             :     {
    1290           0 :         return OUString("com.sun.star.comp.framework.WindowStateConfiguration");
    1291             :     }
    1292             : 
    1293           0 :     virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
    1294             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1295             :     {
    1296           0 :         return cppu::supportsService(this, ServiceName);
    1297             :     }
    1298             : 
    1299           0 :     virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
    1300             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
    1301             :     {
    1302           0 :         css::uno::Sequence< OUString > aSeq(1);
    1303           0 :         aSeq[0] = OUString("com.sun.star.ui.WindowStateConfiguration");
    1304           0 :         return aSeq;
    1305             :     }
    1306             : 
    1307             :     // XNameAccess
    1308             :     virtual css::uno::Any SAL_CALL getByName( const OUString& aName )
    1309             :         throw ( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1310             : 
    1311             :     virtual css::uno::Sequence< OUString > SAL_CALL getElementNames()
    1312             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1313             : 
    1314             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
    1315             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1316             : 
    1317             :     // XElementAccess
    1318             :     virtual css::uno::Type SAL_CALL getElementType()
    1319             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1320             :     virtual sal_Bool SAL_CALL hasElements()
    1321             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
    1322             : 
    1323             :     typedef ::boost::unordered_map< OUString,
    1324             :                              OUString,
    1325             :                              OUStringHash,
    1326             :                              ::std::equal_to< OUString > > ModuleToWindowStateFileMap;
    1327             : 
    1328             :     typedef ::boost::unordered_map< OUString,
    1329             :                              css::uno::Reference< css::container::XNameAccess >,
    1330             :                              OUStringHash,
    1331             :                              ::std::equal_to< OUString > > ModuleToWindowStateConfigHashMap;
    1332             : 
    1333             : private:
    1334             :     css::uno::Reference< css::uno::XComponentContext>         m_xContext;
    1335             :     ModuleToWindowStateFileMap                                m_aModuleToFileHashMap;
    1336             :     ModuleToWindowStateConfigHashMap                          m_aModuleToWindowStateHashMap;
    1337             : };
    1338             : 
    1339           0 : WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentContext >& rxContext ) :
    1340             :     WindowStateConfiguration_BASE(m_aMutex),
    1341           0 :     m_xContext( rxContext )
    1342             : {
    1343             :     css::uno::Reference< css::frame::XModuleManager2 > xModuleManager =
    1344           0 :         ModuleManager::create( m_xContext );
    1345           0 :     Reference< XNameAccess > xEmptyNameAccess;
    1346           0 :     Sequence< OUString > aElementNames;
    1347             :     try
    1348             :     {
    1349           0 :         aElementNames = xModuleManager->getElementNames();
    1350             :     }
    1351           0 :     catch (const ::com::sun::star::uno::RuntimeException &)
    1352             :     {
    1353             :     }
    1354           0 :     Sequence< PropertyValue > aSeq;
    1355           0 :     OUString                  aModuleIdentifier;
    1356             : 
    1357           0 :     for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
    1358             :     {
    1359           0 :         aModuleIdentifier = aElementNames[i];
    1360           0 :         if ( xModuleManager->getByName( aModuleIdentifier ) >>= aSeq )
    1361             :         {
    1362           0 :             OUString aWindowStateFileStr;
    1363           0 :             for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
    1364             :             {
    1365           0 :                 if ( aSeq[y].Name == "ooSetupFactoryWindowStateConfigRef" )
    1366             :                 {
    1367           0 :                     aSeq[y].Value >>= aWindowStateFileStr;
    1368           0 :                     break;
    1369             :                 }
    1370             :             }
    1371             : 
    1372           0 :             if ( !aWindowStateFileStr.isEmpty() )
    1373             :             {
    1374             :                 // Create first mapping ModuleIdentifier ==> Window state configuration file
    1375           0 :                 m_aModuleToFileHashMap.insert( ModuleToWindowStateFileMap::value_type( aModuleIdentifier, aWindowStateFileStr ));
    1376             : 
    1377             :                 // Create second mapping Command File ==> Window state configuration instance
    1378           0 :                 ModuleToWindowStateConfigHashMap::iterator pIter = m_aModuleToWindowStateHashMap.find( aWindowStateFileStr );
    1379           0 :                 if ( pIter == m_aModuleToWindowStateHashMap.end() )
    1380           0 :                     m_aModuleToWindowStateHashMap.insert( ModuleToWindowStateConfigHashMap::value_type( aWindowStateFileStr, xEmptyNameAccess ));
    1381           0 :             }
    1382             :         }
    1383           0 :     }
    1384           0 : }
    1385             : 
    1386           0 : WindowStateConfiguration::~WindowStateConfiguration()
    1387             : {
    1388           0 :     osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
    1389           0 :     m_aModuleToFileHashMap.clear();
    1390           0 :     m_aModuleToWindowStateHashMap.clear();
    1391           0 : }
    1392             : 
    1393           0 : Any SAL_CALL WindowStateConfiguration::getByName( const OUString& aModuleIdentifier )
    1394             : throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
    1395             : {
    1396           0 :     osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
    1397             : 
    1398           0 :     ModuleToWindowStateFileMap::const_iterator pIter = m_aModuleToFileHashMap.find( aModuleIdentifier );
    1399           0 :     if ( pIter != m_aModuleToFileHashMap.end() )
    1400             :     {
    1401           0 :         Any a;
    1402           0 :         OUString aWindowStateConfigFile( pIter->second );
    1403             : 
    1404           0 :         ModuleToWindowStateConfigHashMap::iterator pModuleIter = m_aModuleToWindowStateHashMap.find( aWindowStateConfigFile );
    1405           0 :         if ( pModuleIter != m_aModuleToWindowStateHashMap.end() )
    1406             :         {
    1407           0 :             if ( pModuleIter->second.is() )
    1408           0 :                 a = makeAny( pModuleIter->second );
    1409             :             else
    1410             :             {
    1411           0 :                 Reference< XNameAccess > xResourceURLWindowState;
    1412           0 :                 ConfigurationAccess_WindowState* pModuleWindowState = new ConfigurationAccess_WindowState( aWindowStateConfigFile, m_xContext );
    1413           0 :                 xResourceURLWindowState = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pModuleWindowState ),UNO_QUERY );
    1414           0 :                 pModuleIter->second = xResourceURLWindowState;
    1415           0 :                 a <<= xResourceURLWindowState;
    1416             :             }
    1417             : 
    1418           0 :             return a;
    1419           0 :         }
    1420             :     }
    1421             : 
    1422           0 :     throw NoSuchElementException();
    1423             : }
    1424             : 
    1425           0 : Sequence< OUString > SAL_CALL WindowStateConfiguration::getElementNames()
    1426             : throw (::com::sun::star::uno::RuntimeException, std::exception)
    1427             : {
    1428           0 :     osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
    1429             : 
    1430           0 :     Sequence< OUString > aSeq( m_aModuleToFileHashMap.size() );
    1431             : 
    1432           0 :     sal_Int32 n = 0;
    1433           0 :     ModuleToWindowStateFileMap::const_iterator pIter = m_aModuleToFileHashMap.begin();
    1434           0 :     while ( pIter != m_aModuleToFileHashMap.end() )
    1435             :     {
    1436           0 :         aSeq[n] = pIter->first;
    1437           0 :         ++pIter;
    1438             :     }
    1439             : 
    1440           0 :     return aSeq;
    1441             : }
    1442             : 
    1443           0 : sal_Bool SAL_CALL WindowStateConfiguration::hasByName( const OUString& aName )
    1444             : throw (::com::sun::star::uno::RuntimeException, std::exception)
    1445             : {
    1446           0 :     osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
    1447             : 
    1448           0 :     ModuleToWindowStateFileMap::const_iterator pIter = m_aModuleToFileHashMap.find( aName );
    1449           0 :     return ( pIter != m_aModuleToFileHashMap.end() );
    1450             : }
    1451             : 
    1452             : // XElementAccess
    1453           0 : Type SAL_CALL WindowStateConfiguration::getElementType()
    1454             : throw (::com::sun::star::uno::RuntimeException, std::exception)
    1455             : {
    1456           0 :     return( ::getCppuType( (const Reference< XNameAccess >*)NULL ) );
    1457             : }
    1458             : 
    1459           0 : sal_Bool SAL_CALL WindowStateConfiguration::hasElements()
    1460             : throw (::com::sun::star::uno::RuntimeException, std::exception)
    1461             : {
    1462             :     // We always have at least one module. So it is valid to return true!
    1463           0 :     return sal_True;
    1464             : }
    1465             : 
    1466           0 : struct Instance {
    1467           0 :     explicit Instance(
    1468             :         css::uno::Reference<css::uno::XComponentContext> const & context):
    1469             :         instance(static_cast<cppu::OWeakObject *>(
    1470           0 :                     new WindowStateConfiguration(context)))
    1471             :     {
    1472           0 :     }
    1473             : 
    1474             :     css::uno::Reference<css::uno::XInterface> instance;
    1475             : };
    1476             : 
    1477             : struct Singleton:
    1478             :     public rtl::StaticWithArg<
    1479             :         Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
    1480             : {};
    1481             : 
    1482             : }
    1483             : 
    1484             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1485           0 : com_sun_star_comp_framework_WindowStateConfiguration_get_implementation(
    1486             :     css::uno::XComponentContext *context,
    1487             :     css::uno::Sequence<css::uno::Any> const &)
    1488             : {
    1489             :     return cppu::acquire(static_cast<cppu::OWeakObject *>(
    1490           0 :                 Singleton::get(context).instance.get()));
    1491             : }
    1492             : 
    1493             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10