Hi Carsten,
i have finished the patches , Please review it.
Coud you help me to resolve why not the patches work correctly?

Thank you

Best Regards.

Shizhoubo
diff -urN svtools_old/inc/svtools/toolboxcontroller.hxx 
svtools_new/inc/svtools/toolboxcontroller.hxx
--- svtools_old/inc/svtools/toolboxcontroller.hxx       2009-03-11 
17:08:40.000000000 +0800
+++ svtools_new/inc/svtools/toolboxcontroller.hxx       2009-02-20 
09:55:58.000000000 +0800
@@ -45,7 +45,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
@@ -60,9 +66,13 @@
                           public ::com::sun::star::lang::XInitialization,
                           public ::com::sun::star::util::XUpdatable,
                           public ::com::sun::star::lang::XComponent,
-                          public ::comphelper::OBaseMutex,
-                          public ::cppu::OWeakObject
+                          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,
@@ -105,8 +115,18 @@
         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;
+ 
 
     protected:
+               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 -urN svtools_old/source/uno/toolboxcontroller.cxx 
svtools_new/source/uno/toolboxcontroller.cxx
--- svtools_old/source/uno/toolboxcontroller.cxx        2009-03-11 
17:04:40.000000000 +0800
+++ svtools_new/source/uno/toolboxcontroller.cxx        2009-03-11 
13:19:04.000000000 +0800
@@ -45,6 +45,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 namespace ::cppu;
 using namespace ::com::sun::star::awt;
@@ -64,10 +70,12 @@
 };
 
 ToolboxController::ToolboxController(
+    
     const Reference< XMultiServiceFactory >& rServiceManager,
     const Reference< XFrame >& xFrame,
     const ::rtl::OUString& aCommandURL ) :
     OWeakObject()
+       ,OPropertyContainer(GetBroadcastHelper())//shizhoubo
     ,   m_bInitialized( sal_False )
     ,   m_bDisposed( sal_False )
        ,       m_xFrame(xFrame)
@@ -75,6 +83,10 @@
     ,   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
@@ -90,10 +102,15 @@
 
 ToolboxController::ToolboxController() :
     OWeakObject()
+    ,OPropertyContainer(GetBroadcastHelper())//shizhoubo
     ,   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;
 }
 
@@ -149,11 +166,16 @@
                                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 ()
@@ -175,7 +197,7 @@
     const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( 
"ParentWindow" ));
 
     bool bInitialized( true );
-
+    
     {
         vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
 
@@ -189,7 +211,8 @@
     {
         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++ )
         {
@@ -224,13 +247,13 @@
 
 void SAL_CALL ToolboxController::update()
 throw ( RuntimeException )
-{
+{ 
     {
         vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
         if ( m_bDisposed )
             throw DisposedException();
     }
-
+   
     // Bind all registered listeners to their dispatch objects
     bindListener();
 }
@@ -707,4 +730,70 @@
 {
        return m_pImpl->m_xParentWindow;
 }
+//
+//-------------------------------------------------------------------------
+// XPropertySet by shizhoubo
+com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >  
SAL_CALL ToolboxController::getPropertySetInfo() 
throw(::com::sun::star::uno::RuntimeException)
+{
+       Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( 
getInfoHelper() ) );
+       return xInfo;
+}
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper()
+{
+               return *const_cast<ToolboxController*>(this)->getArrayHelper();
+}
+//OPropertyArrayUsageHelper by shizhoubo
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const
+{
+               com::sun::star::uno::Sequence< Property > aProps;
+               describeProperties(aProps);
+               return new ::cppu::OPropertyArrayHelper(aProps);
+}
+//shizhoubo for supportsvisiable
+void ToolboxController::setSupportVisiableProperty(sal_Bool bValue)
+{
+       m_bSupportVisiable = bValue;
+}
+//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 )
+{
+
+       switch (nHandle)
+       {
+               case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE:
+               {
+                       sal_Bool aNewValue;
+                       aValue >>= aNewValue;
+                       if (aNewValue != m_bSupportVisiable)
+                       {
+                               aConvertedValue <<= aNewValue;
+                               aOldValue <<= m_bSupportVisiable;
+                               return sal_True;
+                       }
+                       return sal_False;
+               }
+       }
+       return OPropertyContainer::convertFastPropertyValue(aConvertedValue, 
aOldValue, nHandle, aValue);
+
+
+}
+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;
+           aValue >>= rValue;
+               if (m_bInitialized)
+                       this->setSupportVisiableProperty(rValue);
+       }
+
+}
+//end
+
 } // svt
diff -urN framework_old/inc/uielement/toolbarmanager.hxx 
framework_new/inc/uielement/toolbarmanager.hxx
--- framework_old/inc/uielement/toolbarmanager.hxx      2009-02-20 
15:30:00.000000000 +0800
+++ framework_new/inc/uielement/toolbarmanager.hxx      2009-02-20 
15:35:28.000000000 +0800
@@ -58,6 +58,9 @@
 #include <com/sun/star/frame/XSubToolbarController.hpp>
 #include <com/sun/star/ui/ItemStyle.hpp>
 
+//shizhoubo
+#include <com/sun/star/frame/XToolbarController.hpp>
+//end
 
//_________________________________________________________________________________________________________________
 //     other includes
 
//_________________________________________________________________________________________________________________
@@ -180,6 +183,9 @@
         rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL );
         void CreateControllers();
         void UpdateControllers();
+               //for update controller via Support Visiable by shizhoubo
+               void UpdateController( ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XToolbarController > xController);
+               //end
         void AddFrameActionListener();
         void AddImageOrientationListener();
         void UpdateImageOrientation();
diff -urN framework_old/source/uielement/toolbarmanager.cxx 
framework_new/source/uielement/toolbarmanager.cxx
--- framework_old/source/uielement/toolbarmanager.cxx   2009-02-17 
21:32:32.000000000 +0800
+++ framework_new/source/uielement/toolbarmanager.cxx   2009-03-09 
14:49:56.000000000 +0800
@@ -490,7 +490,47 @@
     }
     m_bUpdateControllers = sal_False;
 }
+//for update toolbar controller via Support Visible by shizhoubo
+void ToolBarManager::UpdateController( ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XToolbarController > xController)
+{
+       RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) 
::ToolBarManager::UpdateControllers" );
+
+    if ( !m_bUpdateControllers )
+    {
+               m_bUpdateControllers = sal_True;
+               try
+        {   if(xController.is())
+                       {
+                               Reference< XUpdatable > xUpdatable( 
xController, UNO_QUERY );
+                               if ( xUpdatable.is() )
+                                       xUpdatable->update();
+                       }
+         }
+         catch ( Exception& )
+         {
+         }
+
+       /* m_bUpdateControllers = sal_True;
+        ToolBarControllerMap::iterator pIter = m_aControllerMap.begin();
 
+        while ( pIter != m_aControllerMap.end() )
+        {
+            try
+            {
+                Reference< XUpdatable > xUpdatable( pIter->second, UNO_QUERY );
+                if ( xUpdatable.is() )
+                    xUpdatable->update();
+            }
+            catch ( Exception& )
+            {
+            }
+            ++pIter;
+        }*/
+
+    }
+    m_bUpdateControllers = sal_False;
+}
+//end
 void ToolBarManager::frameAction( const FrameActionEvent& Action )
 throw ( RuntimeException )
 {
@@ -1088,6 +1128,19 @@
 
                 Sequence< Any > aArgs( comphelper::containerToSequence( 
aPropertyVector ));
                 xInit->initialize( aArgs );
+                               //for Support Visiblitly by shizhoubo
+                               if (pController)  
+                               {
+                               //      rtl::OUString aCommandURL = 
pController->m_aCommandURL;
+                                       if(aCommandURL == rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( ".uno:SwitchXFormsDesignMode" )) || 
+                                          aCommandURL == rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( ".uno:ViewDataSourceBrowser" )) || 
+                                          aCommandURL == rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( ".uno:ParaLeftToRight" )) || 
+                                          aCommandURL == rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( ".uno:ParaRightToLeft" )) 
+                                          )
+                                               
pController->setFastPropertyValue_NoBroadcast(1,makeAny(sal_True));
+                               }
+                               
+                               //end
             }
 
             // Request a item window from the toolbar controller and set it at 
the VCL toolbar
@@ -1108,6 +1161,31 @@
                 }
             }
         }
+               //for update Controller via support visiable state by shizhoubo
+               Reference< XPropertySet > xPropSet( xController, UNO_QUERY );
+               if ( xPropSet.is() )
+               {
+                       try
+                       {
+                               sal_Bool bSupportVisiable = sal_True;
+                               Any a( xPropSet->getPropertyValue( 
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" ))) );
+                               a >>= bSupportVisiable;
+                               if ( bSupportVisiable )
+                               {
+                                       Reference< XToolbarController > 
xTbxController( xController, UNO_QUERY );
+                                       UpdateController(xTbxController);
+                               }
+                       }
+                       catch ( RuntimeException& )
+                       {
+                               throw;
+                       }
+                       catch ( Exception& )
+                       {
+                       }
+               }
+               //end
+
     }
 
     AddFrameActionListener();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@framework.openoffice.org
For additional commands, e-mail: dev-h...@framework.openoffice.org

Reply via email to