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