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 | |
parent | 96e2acd4ec40ff2948c09ca17229feb793208e0d (diff) | |
parent | a812215af2cee88810d128e50d65448b99ef1cc0 (diff) |
CWS-TOOLING: integrate CWS fwk139
-rw-r--r-- | comphelper/inc/comphelper/propertycontainerhelper.hxx | 2 | ||||
-rw-r--r-- | comphelper/inc/comphelper/stillreadwriteinteraction.hxx | 69 | ||||
-rw-r--r-- | comphelper/source/misc/makefile.mk | 1 | ||||
-rw-r--r-- | comphelper/source/misc/mediadescriptor.cxx | 121 | ||||
-rw-r--r-- | comphelper/source/misc/stillreadwriteinteraction.cxx | 144 | ||||
-rw-r--r-- | svl/source/items/nranges.cxx | 2 | ||||
-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 |
9 files changed, 320 insertions, 189 deletions
diff --git a/comphelper/inc/comphelper/propertycontainerhelper.hxx b/comphelper/inc/comphelper/propertycontainerhelper.hxx index 247e1a678e02..82848203699c 100644 --- a/comphelper/inc/comphelper/propertycontainerhelper.hxx +++ b/comphelper/inc/comphelper/propertycontainerhelper.hxx @@ -42,7 +42,7 @@ namespace comphelper //......................................................................... // infos about one single property -struct COMPHELPER_DLLPRIVATE PropertyDescription +struct COMPHELPER_DLLPUBLIC PropertyDescription { // the possibilities where a property holding object may be located enum LocationType diff --git a/comphelper/inc/comphelper/stillreadwriteinteraction.hxx b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx new file mode 100644 index 000000000000..1ade47220c6f --- /dev/null +++ b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx @@ -0,0 +1,69 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef _COMPHELPER_STILLREADWRITEINTERACTION_HXX_ +#define _COMPHELPER_STRILLREADWRITEINTERACTION_HXX_ + +//_______________________________________________ +// includes +#include <ucbhelper/interceptedinteraction.hxx> + +#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__ +#include <com/sun/star/task/XInteractionHandler.hpp> +#endif + +#include <ucbhelper/interceptedinteraction.hxx> +#include "comphelper/comphelperdllapi.h" + +//_______________________________________________ +// namespace + +namespace comphelper{ +class COMPHELPER_DLLPUBLIC StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction +{ +private: + static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0; + static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1; + + sal_Bool m_bUsed; + sal_Bool m_bHandledByMySelf; + sal_Bool m_bHandledByInternalHandler; + +public: + StillReadWriteInteraction(const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler); + + void resetInterceptions(); + void resetErrorStates(); + sal_Bool wasWriteError(); + +private: + virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest); + +}; +} +#endif diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index 94837ce49df9..5ad7e3ed289e 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -92,6 +92,7 @@ SLOFILES= \ $(SLO)$/comphelper_module.obj \ $(SLO)$/comphelper_services.obj \ $(SLO)$/componentbase.obj \ + $(SLO)$/stillreadwriteinteraction.obj \ # --- Targets ---------------------------------- diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 1710a43027cf..1bc40a454d43 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" #include <comphelper/mediadescriptor.hxx> +#include <comphelper/stillreadwriteinteraction.hxx> //_______________________________________________ // includes @@ -59,22 +60,10 @@ #include <com/sun/star/util/XURLTransformer.hpp> #endif -#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__ -#include <com/sun/star/ucb/InteractiveIOException.hpp> -#endif - -#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__ -#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> -#endif - #ifndef __COM_SUN_STAR_UCB_COMMANDFAILEDEXCEPTION_HPP__ #include <com/sun/star/ucb/CommandFailedException.hpp> #endif -#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__ -#include <com/sun/star/task/XInteractionAbort.hpp> -#endif - #ifndef __COM_SUN_STAR_URI_XURIREFERENCEFACTORY_HPP__ #include <com/sun/star/uri/XUriReferenceFactory.hpp> #endif @@ -673,114 +662,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference } /*-----------------------------------------------*/ -class StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction -{ - private: - static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0; - static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1; - - sal_Bool m_bUsed; - sal_Bool m_bHandledByMySelf; - sal_Bool m_bHandledByInternalHandler; - - public: - StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler) - : m_bUsed (sal_False) - , m_bHandledByMySelf (sal_False) - , m_bHandledByInternalHandler(sal_False) - { - ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions; - ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest; - - aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION; - aInterceptedRequest.Request <<= css::ucb::InteractiveIOException(); - aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); - aInterceptedRequest.MatchExact = sal_False; - lInterceptions.push_back(aInterceptedRequest); - - aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION; - aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException(); - aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); - aInterceptedRequest.MatchExact = sal_False; - lInterceptions.push_back(aInterceptedRequest); - - setInterceptedHandler(xHandler); - setInterceptions(lInterceptions); - } - - void resetInterceptions() - { - setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >()); - } - - void resetErrorStates() - { - m_bUsed = sal_False; - m_bHandledByMySelf = sal_False; - m_bHandledByInternalHandler = sal_False; - } - - sal_Bool wasWriteError() - { - return (m_bUsed && m_bHandledByMySelf); - } - - private: - virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest) - { - // we are used! - m_bUsed = sal_True; - - // check if its a real interception - might some parameters are not the right ones ... - sal_Bool bAbort = sal_False; - switch(aRequest.Handle) - { - case HANDLE_INTERACTIVEIOEXCEPTION: - { - css::ucb::InteractiveIOException exIO; - xRequest->getRequest() >>= exIO; - bAbort = ( - (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) - || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION ) -#ifdef MACOSX - // this is a workaround for MAC, on this platform if the file is locked - // the returned error code looks to be wrong - || (exIO.Code == css::ucb::IOErrorCode_GENERAL ) -#endif - ); - } - break; - - case HANDLE_UNSUPPORTEDDATASINKEXCEPTION: - { - bAbort = sal_True; - } - break; - } - - // handle interaction by ourself - if (bAbort) - { - m_bHandledByMySelf = sal_True; - css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation( - xRequest->getContinuations(), - ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0))); - if (!xAbort.is()) - return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND; - xAbort->select(); - return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; - } - - // Otherwhise use internal handler. - if (m_xInterceptedHandler.is()) - { - m_bHandledByInternalHandler = sal_True; - m_xInterceptedHandler->handle(xRequest); - } - return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; - } -}; /*----------------------------------------------- 25.03.2004 12:29 diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx new file mode 100644 index 000000000000..9054f0754b5e --- /dev/null +++ b/comphelper/source/misc/stillreadwriteinteraction.cxx @@ -0,0 +1,144 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_comphelper.hxx" +#include <comphelper/stillreadwriteinteraction.hxx> + +#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__ +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#endif + +#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__ +#include <com/sun/star/task/XInteractionAbort.hpp> +#endif + +#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__ +#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> +#endif + +namespace comphelper{ + + namespace css = ::com::sun::star; + +StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler) + : m_bUsed (sal_False) + , m_bHandledByMySelf (sal_False) + , m_bHandledByInternalHandler(sal_False) +{ + ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions; + ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest; + + aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION; + aInterceptedRequest.Request <<= css::ucb::InteractiveIOException(); + aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); + aInterceptedRequest.MatchExact = sal_False; + lInterceptions.push_back(aInterceptedRequest); + + aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION; + aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException(); + aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); + aInterceptedRequest.MatchExact = sal_False; + lInterceptions.push_back(aInterceptedRequest); + + setInterceptedHandler(xHandler); + setInterceptions(lInterceptions); +} + +void StillReadWriteInteraction::resetInterceptions() +{ + setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >()); +} + +void StillReadWriteInteraction::resetErrorStates() +{ + m_bUsed = sal_False; + m_bHandledByMySelf = sal_False; + m_bHandledByInternalHandler = sal_False; +} + +sal_Bool StillReadWriteInteraction::wasWriteError() +{ + return (m_bUsed && m_bHandledByMySelf); +} + +ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction::intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest) +{ + // we are used! + m_bUsed = sal_True; + + // check if its a real interception - might some parameters are not the right ones ... + sal_Bool bAbort = sal_False; + switch(aRequest.Handle) + { + case HANDLE_INTERACTIVEIOEXCEPTION: + { + css::ucb::InteractiveIOException exIO; + xRequest->getRequest() >>= exIO; + bAbort = ( + (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) + || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION ) + || (exIO.Code == css::ucb::IOErrorCode_NOT_EXISTING ) +#ifdef MACOSX + // this is a workaround for MAC, on this platform if the file is locked + // the returned error code looks to be wrong + || (exIO.Code == css::ucb::IOErrorCode_GENERAL ) +#endif + ); + } + break; + + case HANDLE_UNSUPPORTEDDATASINKEXCEPTION: + { + bAbort = sal_True; + } + break; + } + + // handle interaction by ourself + if (bAbort) + { + m_bHandledByMySelf = sal_True; + css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation( + xRequest->getContinuations(), + ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0))); + if (!xAbort.is()) + return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND; + xAbort->select(); + return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; + } + + // Otherwhise use internal handler. + if (m_xInterceptedHandler.is()) + { + m_bHandledByInternalHandler = sal_True; + m_xInterceptedHandler->handle(xRequest); + } + return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; +} +} diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx index ae633276300f..813c1fec8ebd 100644 --- a/svl/source/items/nranges.cxx +++ b/svl/source/items/nranges.cxx @@ -480,6 +480,7 @@ SfxNumRanges& SfxNumRanges::operator -= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; + memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; @@ -689,6 +690,7 @@ SfxNumRanges& SfxNumRanges::operator /= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; + memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; 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 |