Hi Carsten,
I have finished the patch regarding controller "SupportVisiblity" property.
I have tested it ,but the patch cant resolve toolbar refresh problem.
Could you give me some advices?
Regards.
Shizhoubo.
Carsten Driesner 写道:
> ShiZhoubo wrote:
>
>> Hi Carsten,
>>
>> I have found four controllers regarding tool bar. There are
>> "uno:SwitchXFormsDesignMode", "uno:ViewDataSourceBrowser",
>> "uno:ParaLeftToRight" and "uno:ParaRightToLeft".
>>
>> So I think we can change these controllers "SupportVisiblilty" Property
>> via UnoCommand, Once them were created in the CreateControllers method
>> of the ToolbarManager.
>> after them were created and before not showed , we can go on to call the
>> "UpdateControllers(xController)" method;
>>
>> if we do what I said , we can not need changed father class
>> "sfxToolboxController".
>>
>> what do you think ?
>>
> Hi Shi Zhoubo,
>
> Yes, please go one with your idea.
>
> Regards,
> Carsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
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
17:19:24.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: [email protected]
For additional commands, e-mail: [email protected]