1*6d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6d739b60SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6d739b60SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6d739b60SAndrew Rist  * distributed with this work for additional information
6*6d739b60SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6d739b60SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6d739b60SAndrew Rist  * "License"); you may not use this file except in compliance
9*6d739b60SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6d739b60SAndrew Rist  *
11*6d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6d739b60SAndrew Rist  *
13*6d739b60SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6d739b60SAndrew Rist  * software distributed under the License is distributed on an
15*6d739b60SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6d739b60SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6d739b60SAndrew Rist  * specific language governing permissions and limitations
18*6d739b60SAndrew Rist  * under the License.
19*6d739b60SAndrew Rist  *
20*6d739b60SAndrew Rist  *************************************************************/
21*6d739b60SAndrew Rist 
22*6d739b60SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir #include "uifactory/factoryconfiguration.hxx"
31cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx>
32cdf0e10cSrcweir #include "services.h"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //_________________________________________________________________________________________________________________
35cdf0e10cSrcweir //	interface includes
36cdf0e10cSrcweir //_________________________________________________________________________________________________________________
37cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
38cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
39cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
40cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
41cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //_________________________________________________________________________________________________________________
44cdf0e10cSrcweir //	includes of other projects
45cdf0e10cSrcweir //_________________________________________________________________________________________________________________
46cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
47cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
48cdf0e10cSrcweir #include <rtl/logfile.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir //_________________________________________________________________________________________________________________
51cdf0e10cSrcweir //	Defines
52cdf0e10cSrcweir //_________________________________________________________________________________________________________________
53cdf0e10cSrcweir //
54cdf0e10cSrcweir using namespace com::sun::star;
55cdf0e10cSrcweir using namespace com::sun::star::uno;
56cdf0e10cSrcweir using namespace com::sun::star::lang;
57cdf0e10cSrcweir using namespace com::sun::star::beans;
58cdf0e10cSrcweir using namespace com::sun::star::container;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //_________________________________________________________________________________________________________________
61cdf0e10cSrcweir //	Namespace
62cdf0e10cSrcweir //_________________________________________________________________________________________________________________
63cdf0e10cSrcweir //
64cdf0e10cSrcweir 
65cdf0e10cSrcweir namespace framework
66cdf0e10cSrcweir {
getHashKeyFromStrings(const rtl::OUString & aCommandURL,const rtl::OUString & aModuleName)67cdf0e10cSrcweir rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl::OUString& aModuleName )
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     rtl::OUStringBuffer aKey( aCommandURL );
70cdf0e10cSrcweir     aKey.appendAscii( "-" );
71cdf0e10cSrcweir     aKey.append( aModuleName );
72cdf0e10cSrcweir     return aKey.makeStringAndClear();
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir //*****************************************************************************************************************
76cdf0e10cSrcweir //	XInterface, XTypeProvider
77cdf0e10cSrcweir //*****************************************************************************************************************
ConfigurationAccess_ControllerFactory(Reference<XMultiServiceFactory> & rServiceManager,const::rtl::OUString & _sRoot,bool _bAskValue)78cdf0e10cSrcweir ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue ) :
79cdf0e10cSrcweir     ThreadHelpBase(),
80cdf0e10cSrcweir     m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )),
81cdf0e10cSrcweir     m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
82cdf0e10cSrcweir     m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )),
83cdf0e10cSrcweir     m_aPropValue( RTL_CONSTASCII_USTRINGPARAM( "Value" )),
84cdf0e10cSrcweir     m_sRoot(_sRoot),
85cdf0e10cSrcweir     m_xServiceManager( rServiceManager ),
86cdf0e10cSrcweir     m_bConfigAccessInitialized( sal_False ),
87cdf0e10cSrcweir     m_bAskValue(_bAskValue)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory" );
90cdf0e10cSrcweir     m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY );
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
~ConfigurationAccess_ControllerFactory()93cdf0e10cSrcweir ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory()
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     // SAFE
96cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
99cdf0e10cSrcweir     if ( xContainer.is() )
100cdf0e10cSrcweir         xContainer->removeContainerListener( this );
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
getServiceFromCommandModule(const rtl::OUString & rCommandURL,const rtl::OUString & rModule) const103cdf0e10cSrcweir rtl::OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::getServiceFromCommandModule" );
106cdf0e10cSrcweir     // SAFE
107cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
108cdf0e10cSrcweir     MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     if ( pIter != m_aMenuControllerMap.end() )
111cdf0e10cSrcweir         return pIter->second.m_aImplementationName;
112cdf0e10cSrcweir     else if ( rModule.getLength() )
113cdf0e10cSrcweir     {
114cdf0e10cSrcweir         // Try to detect if we have a generic popup menu controller
115cdf0e10cSrcweir         pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
116cdf0e10cSrcweir 
117cdf0e10cSrcweir         if ( pIter != m_aMenuControllerMap.end() )
118cdf0e10cSrcweir             return pIter->second.m_aImplementationName;
119cdf0e10cSrcweir     }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     return rtl::OUString();
122cdf0e10cSrcweir }
getValueFromCommandModule(const rtl::OUString & rCommandURL,const rtl::OUString & rModule) const123cdf0e10cSrcweir rtl::OUString ConfigurationAccess_ControllerFactory::getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::getValueFromCommandModule" );
126cdf0e10cSrcweir     // SAFE
127cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     if ( pIter != m_aMenuControllerMap.end() )
132cdf0e10cSrcweir         return pIter->second.m_aValue;
133cdf0e10cSrcweir     else if ( rModule.getLength() )
134cdf0e10cSrcweir     {
135cdf0e10cSrcweir         // Try to detect if we have a generic popup menu controller
136cdf0e10cSrcweir         pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rtl::OUString() ));
137cdf0e10cSrcweir 
138cdf0e10cSrcweir         if ( pIter != m_aMenuControllerMap.end() )
139cdf0e10cSrcweir             return pIter->second.m_aValue;
140cdf0e10cSrcweir     }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     return rtl::OUString();
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 
addServiceToCommandModule(const rtl::OUString & rCommandURL,const rtl::OUString & rModule,const rtl::OUString & rServiceSpecifier)146cdf0e10cSrcweir void ConfigurationAccess_ControllerFactory::addServiceToCommandModule(
147cdf0e10cSrcweir     const rtl::OUString& rCommandURL,
148cdf0e10cSrcweir     const rtl::OUString& rModule,
149cdf0e10cSrcweir     const rtl::OUString& rServiceSpecifier )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::addServiceToCommandModule" );
152cdf0e10cSrcweir     // SAFE
153cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
156cdf0e10cSrcweir     m_aMenuControllerMap.insert( MenuControllerMap::value_type( aHashKey,ControllerInfo(rServiceSpecifier,::rtl::OUString()) ));
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
removeServiceFromCommandModule(const rtl::OUString & rCommandURL,const rtl::OUString & rModule)159cdf0e10cSrcweir void ConfigurationAccess_ControllerFactory::removeServiceFromCommandModule(
160cdf0e10cSrcweir     const rtl::OUString& rCommandURL,
161cdf0e10cSrcweir     const rtl::OUString& rModule )
162cdf0e10cSrcweir {
163cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::removeServiceFromCommandModule" );
164cdf0e10cSrcweir     // SAFE
165cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     rtl::OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
168cdf0e10cSrcweir     m_aMenuControllerMap.erase( aHashKey );
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir // container.XContainerListener
elementInserted(const ContainerEvent & aEvent)172cdf0e10cSrcweir void SAL_CALL ConfigurationAccess_ControllerFactory::elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::elementInserted" );
175cdf0e10cSrcweir     rtl::OUString   aCommand;
176cdf0e10cSrcweir     rtl::OUString   aModule;
177cdf0e10cSrcweir     rtl::OUString   aService;
178cdf0e10cSrcweir     rtl::OUString   aValue;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     // SAFE
181cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
184cdf0e10cSrcweir     {
185cdf0e10cSrcweir         // Create hash key from command and module as they are together a primary key to
186cdf0e10cSrcweir         // the UNO service that implements the popup menu controller.
187cdf0e10cSrcweir         rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
188cdf0e10cSrcweir         ControllerInfo& rControllerInfo = m_aMenuControllerMap[ aHashKey ];
189cdf0e10cSrcweir         rControllerInfo.m_aImplementationName = aService;
190cdf0e10cSrcweir         rControllerInfo.m_aValue = aValue;
191cdf0e10cSrcweir     }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir 
elementRemoved(const ContainerEvent & aEvent)194cdf0e10cSrcweir void SAL_CALL ConfigurationAccess_ControllerFactory::elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
195cdf0e10cSrcweir {
196cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::elementRemoved" );
197cdf0e10cSrcweir     rtl::OUString   aCommand;
198cdf0e10cSrcweir     rtl::OUString   aModule;
199cdf0e10cSrcweir     rtl::OUString   aService;
200cdf0e10cSrcweir     rtl::OUString   aValue;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     // SAFE
203cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         // Create hash key from command and module as they are together a primary key to
208cdf0e10cSrcweir         // the UNO service that implements the popup menu controller.
209cdf0e10cSrcweir         rtl::OUString aHashKey( getHashKeyFromStrings( aCommand, aModule ));
210cdf0e10cSrcweir         m_aMenuControllerMap.erase( aHashKey );
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
elementReplaced(const ContainerEvent & aEvent)214cdf0e10cSrcweir void SAL_CALL ConfigurationAccess_ControllerFactory::elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::elementReplaced" );
217cdf0e10cSrcweir     elementInserted(aEvent);
218cdf0e10cSrcweir }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir // lang.XEventListener
disposing(const EventObject &)221cdf0e10cSrcweir void SAL_CALL ConfigurationAccess_ControllerFactory::disposing( const EventObject& ) throw(RuntimeException)
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::disposing" );
224cdf0e10cSrcweir     // SAFE
225cdf0e10cSrcweir     // remove our reference to the config access
226cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
227cdf0e10cSrcweir     m_xConfigAccess.clear();
228cdf0e10cSrcweir }
229cdf0e10cSrcweir 
readConfigurationData()230cdf0e10cSrcweir void ConfigurationAccess_ControllerFactory::readConfigurationData()
231cdf0e10cSrcweir {
232cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::readConfigurationData" );
233cdf0e10cSrcweir     // SAFE
234cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
235cdf0e10cSrcweir 
236cdf0e10cSrcweir     if ( !m_bConfigAccessInitialized )
237cdf0e10cSrcweir     {
238cdf0e10cSrcweir         Sequence< Any > aArgs( 1 );
239cdf0e10cSrcweir         PropertyValue   aPropValue;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir         aPropValue.Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
242cdf0e10cSrcweir         aPropValue.Value <<= m_sRoot;
243cdf0e10cSrcweir         aArgs[0] <<= aPropValue;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         try
246cdf0e10cSrcweir         {
247cdf0e10cSrcweir             m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ), UNO_QUERY );
248cdf0e10cSrcweir         }
249cdf0e10cSrcweir         catch ( WrappedTargetException& )
250cdf0e10cSrcweir         {
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir         m_bConfigAccessInitialized = sal_True;
254cdf0e10cSrcweir     }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     if ( m_xConfigAccess.is() )
257cdf0e10cSrcweir     {
258cdf0e10cSrcweir         // Read and update configuration data
259cdf0e10cSrcweir         updateConfigurationData();
260cdf0e10cSrcweir 
261cdf0e10cSrcweir         uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
262cdf0e10cSrcweir         // UNSAFE
263cdf0e10cSrcweir         aLock.unlock();
264cdf0e10cSrcweir 
265cdf0e10cSrcweir         if ( xContainer.is() )
266cdf0e10cSrcweir             xContainer->addContainerListener( this );
267cdf0e10cSrcweir     }
268cdf0e10cSrcweir }
269cdf0e10cSrcweir 
updateConfigurationData()270cdf0e10cSrcweir void ConfigurationAccess_ControllerFactory::updateConfigurationData()
271cdf0e10cSrcweir {
272cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::updateConfigurationData" );
273cdf0e10cSrcweir     // SAFE
274cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
275cdf0e10cSrcweir     if ( m_xConfigAccess.is() )
276cdf0e10cSrcweir     {
277cdf0e10cSrcweir         Sequence< rtl::OUString >   aPopupMenuControllers = m_xConfigAccess->getElementNames();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir         rtl::OUString aCommand;
280cdf0e10cSrcweir         rtl::OUString aModule;
281cdf0e10cSrcweir         rtl::OUString aService;
282cdf0e10cSrcweir         rtl::OUString aHashKey;
283cdf0e10cSrcweir         rtl::OUString aValue;
284cdf0e10cSrcweir 
285cdf0e10cSrcweir         m_aMenuControllerMap.clear();
286cdf0e10cSrcweir         for ( sal_Int32 i = 0; i < aPopupMenuControllers.getLength(); i++ )
287cdf0e10cSrcweir         {
288cdf0e10cSrcweir             try
289cdf0e10cSrcweir             {
290cdf0e10cSrcweir                 if ( impl_getElementProps( m_xConfigAccess->getByName( aPopupMenuControllers[i] ), aCommand, aModule, aService,aValue ))
291cdf0e10cSrcweir                 {
292cdf0e10cSrcweir                     // Create hash key from command and module as they are together a primary key to
293cdf0e10cSrcweir                     // the UNO service that implements the popup menu controller.
294cdf0e10cSrcweir                     aHashKey = getHashKeyFromStrings( aCommand, aModule );
295cdf0e10cSrcweir                     m_aMenuControllerMap.insert( MenuControllerMap::value_type( aHashKey, ControllerInfo(aService,aValue) ));
296cdf0e10cSrcweir                 }
297cdf0e10cSrcweir             }
298cdf0e10cSrcweir             catch ( NoSuchElementException& )
299cdf0e10cSrcweir             {
300cdf0e10cSrcweir             }
301cdf0e10cSrcweir             catch ( WrappedTargetException& )
302cdf0e10cSrcweir             {
303cdf0e10cSrcweir             }
304cdf0e10cSrcweir         }
305cdf0e10cSrcweir     }
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
impl_getElementProps(const Any & aElement,rtl::OUString & aCommand,rtl::OUString & aModule,rtl::OUString & aServiceSpecifier,rtl::OUString & aValue) const308cdf0e10cSrcweir sal_Bool ConfigurationAccess_ControllerFactory::impl_getElementProps( const Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue  ) const
309cdf0e10cSrcweir {
310cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::impl_getElementProps" );
311cdf0e10cSrcweir     Reference< XPropertySet > xPropertySet;
312cdf0e10cSrcweir     aElement >>= xPropertySet;
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     if ( xPropertySet.is() )
315cdf0e10cSrcweir     {
316cdf0e10cSrcweir         try
317cdf0e10cSrcweir         {
318cdf0e10cSrcweir             xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
319cdf0e10cSrcweir             xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
320cdf0e10cSrcweir             xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
321cdf0e10cSrcweir             if ( m_bAskValue )
322cdf0e10cSrcweir                 xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
323cdf0e10cSrcweir         }
324cdf0e10cSrcweir         catch ( com::sun::star::beans::UnknownPropertyException& )
325cdf0e10cSrcweir         {
326cdf0e10cSrcweir             return sal_False;
327cdf0e10cSrcweir         }
328cdf0e10cSrcweir         catch ( com::sun::star::lang::WrappedTargetException& )
329cdf0e10cSrcweir         {
330cdf0e10cSrcweir             return sal_False;
331cdf0e10cSrcweir         }
332cdf0e10cSrcweir     }
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     return sal_True;
335cdf0e10cSrcweir }
336cdf0e10cSrcweir } // namespace framework
337