diff options
author | obo <obo@openoffice.org> | 2010-06-15 10:26:12 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-15 10:26:12 +0200 |
commit | 11ca51711d56f1606f0b113bef4811b4d20d4128 (patch) | |
tree | 871678a5a009d17b63ea1b8fa3c5b2ca8119120a /svtools | |
parent | 96e2acd4ec40ff2948c09ca17229feb793208e0d (diff) | |
parent | a812215af2cee88810d128e50d65448b99ef1cc0 (diff) |
CWS-TOOLING: integrate CWS fwk139
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/toolboxcontroller.hxx | 27 | ||||
-rw-r--r-- | svtools/source/misc/langtab.src | 2 | ||||
-rw-r--r-- | svtools/source/uno/toolboxcontroller.cxx | 141 |
3 files changed, 102 insertions, 68 deletions
diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index 96e48a399831..f636178881d0 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -42,7 +42,13 @@ #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/broadcasthelper.hxx> #include <com/sun/star/util/XURLTransformer.hpp> - +//shizhoubo for ToolbarController Visiable +#include <comphelper/proparrhlp.hxx> +#include <comphelper/property.hxx> +#include <comphelper/propertycontainer.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +//end #ifndef INCLUDED_HASH_MAP #include <hash_map> #define INCLUDED_HASH_MAP @@ -59,9 +65,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL public ::com::sun::star::lang::XInitialization, public ::com::sun::star::util::XUpdatable, public ::com::sun::star::lang::XComponent, - public ::comphelper::OBaseMutex, + public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo + public ::comphelper::OPropertyContainer,//shizhoubo + public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo public ::cppu::OWeakObject { + private: + sal_Bool m_bSupportVisiable; //shizhoubo public: ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, @@ -93,6 +103,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); // XEventListener + using cppu::OPropertySetHelper::disposing; virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); // XStatusListener @@ -104,6 +115,15 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + // OPropertySetHelper //shizhoubo + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception); + virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException); + // XPropertySet //shizhoubo + virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + // OPropertyArrayUsageHelper //shizhoubo + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + const rtl::OUString& getCommandURL() const { return m_aCommandURL; } const rtl::OUString& getModuleName() const; @@ -113,8 +133,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL void enable( bool bEnable ); protected: - bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ); - + void setSupportVisiableProperty(sal_Bool bValue); //shizhoubo struct Listener { Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) : diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 0b83cb535ec4..1cb20d27fc12 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -138,7 +138,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Lithuanian" ; LANGUAGE_LITHUANIAN ; > ; < "Macedonian" ; LANGUAGE_MACEDONIAN ; > ; < "Malay (Malaysia)" ; LANGUAGE_MALAY_MALAYSIA ; > ; - < "Malay (Brunei Darusalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ; + < "Malay (Brunei Darussalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ; < "Malayalam" ; LANGUAGE_MALAYALAM ; > ; < "Manipuri" ; LANGUAGE_MANIPURI ; > ; < "Marathi" ; LANGUAGE_MARATHI ; > ; diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index d9b84aa2e356..36c1374ba9fb 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -42,6 +42,12 @@ #include <toolkit/unohlp.hxx> #endif #include <vcl/toolbox.hxx> +//shizhobo +#include <com/sun/star/beans/PropertyAttribute.hpp> +const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE = 1; +const int TOOLBARCONTROLLER_PROPCOUNT = 1; +const rtl::OUString TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" )); +//end using ::rtl::OUString; @@ -82,10 +88,12 @@ struct ToolboxController_Impl }; ToolboxController::ToolboxController( + const Reference< XMultiServiceFactory >& rServiceManager, const Reference< XFrame >& xFrame, const ::rtl::OUString& aCommandURL ) : - OWeakObject() + OPropertyContainer(GetBroadcastHelper()) + , OWeakObject() , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_xFrame(xFrame) @@ -93,6 +101,10 @@ ToolboxController::ToolboxController( , m_aCommandURL( aCommandURL ) , m_aListenerContainer( m_aMutex ) { + //registger Propertyh by shizhoubo + registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY, + &m_bSupportVisiable, getCppuType(&m_bSupportVisiable)); + m_pImpl = new ToolboxController_Impl; try @@ -107,11 +119,16 @@ ToolboxController::ToolboxController( } ToolboxController::ToolboxController() : - OWeakObject() + OPropertyContainer(GetBroadcastHelper()) + , OWeakObject() , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_aListenerContainer( m_aMutex ) { + //registger Propertyh by shizhoubo + registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY, + &m_bSupportVisiable, getCppuType(&m_bSupportVisiable)); + m_pImpl = new ToolboxController_Impl; } @@ -167,11 +184,16 @@ throw ( RuntimeException ) static_cast< XInitialization* >( this ), static_cast< XComponent* >( this ), static_cast< XUpdatable* >( this )); - - if ( a.hasValue() ) - return a; - - return OWeakObject::queryInterface( rType ); + if ( !a.hasValue()) + { + a = ::cppu::queryInterface(rType + ,static_cast<XPropertySet*>(this) + ,static_cast<XMultiPropertySet*>(this) + ,static_cast<XFastPropertySet*>(this)); + if (!a.hasValue()) + return OWeakObject::queryInterface( rType ); + } + return a; } void SAL_CALL ToolboxController::acquire() throw () @@ -202,7 +224,8 @@ throw ( Exception, RuntimeException ) { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); m_bInitialized = sal_True; - + //shizhoubo add + m_bSupportVisiable = sal_False; PropertyValue aPropValue; for ( int i = 0; i < aArguments.getLength(); i++ ) { @@ -722,77 +745,69 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const { return m_pImpl->m_xParentWindow; } - -const rtl::OUString& ToolboxController::getModuleName() const +// +//------------------------------------------------------------------------- +// XPropertySet by shizhoubo +com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) { - return m_pImpl->m_sModuleName; + Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; } - -void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs ) +//------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper() { - try - { - Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW ); - URL aURL; - aURL.Complete = sCommandURL; - getURLTransformer()->parseStrict( aURL ); - - Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW ); - - Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) ); - - } - catch( Exception& ) - { - } + return *const_cast<ToolboxController*>(this)->getArrayHelper(); } - -//-------------------------------------------------------------------- - -IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo ) +//OPropertyArrayUsageHelper by shizhoubo +//------------------------------------------------------------------------------ +::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const { - pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs ); - delete pDispatchInfo; - return 0; + com::sun::star::uno::Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); } - -void ToolboxController::enable( bool bEnable ) +//shizhoubo for supportsvisiable +void ToolboxController::setSupportVisiableProperty(sal_Bool bValue) { - ToolBox* pToolBox = 0; - sal_uInt16 nItemId = 0; - if( getToolboxId( nItemId, &pToolBox ) ) - { - pToolBox->EnableItem( nItemId, bEnable ? TRUE : FALSE ); - } + m_bSupportVisiable = bValue; } - -bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) +//OPropertySetHelper by shizhoubo +sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue , + com::sun::star::uno::Any& aOldValue , + sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) { - if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) ) - return m_pImpl->m_nToolBoxId; - - ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); - - if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox ) + switch (nHandle) { - const sal_uInt16 nCount = pToolBox->GetItemCount(); - for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) + case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE: { - const sal_uInt16 nItemId = pToolBox->GetItemId( nPos ); - if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) ) + sal_Bool aNewValue; + aValue >>= aNewValue; + if (aNewValue != m_bSupportVisiable) { - m_pImpl->m_nToolBoxId = nItemId; - break; + aConvertedValue <<= aNewValue; + aOldValue <<= m_bSupportVisiable; + return sal_True; } + return sal_False; } } + return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue, nHandle, aValue); +} - if( ppToolBox ) - *ppToolBox = pToolBox; - - rItemId = m_pImpl->m_nToolBoxId; - - return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) ); +void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const com::sun::star::uno::Any& aValue ) +throw( com::sun::star::uno::Exception) +{ + OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue); + if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE == nHandle) + { + sal_Bool rValue(sal_False); + if (( aValue >>= rValue ) && m_bInitialized) + this->setSupportVisiableProperty( rValue ); + } } +//end } // svt |