Hi Carsten,

Sorry! I forgot to send patch to you in last mail



First, Thank you for you help

I have finished the patch about the toolbarmanager , Please, review it.


Regards.
Shizhoubo.

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-02-20 
16:36:54.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 )
 {
@@ -1108,6 +1148,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