ooo-build r14403 - in trunk: . patches/dev300 patches/vba



Author: pflin
Date: Thu Oct 23 09:22:54 2008
New Revision: 14403
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14403&view=rev

Log:
2008-10-23  Fong Lin  <pflin novell com>
	* patches/vba/vba-fix-commandbar-submenu.diff,
	* patches/dev300/apply: Fixed for n#434214, n#437157. 



Added:
   trunk/patches/vba/vba-fix-commandbar-submenu.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Thu Oct 23 09:22:54 2008
@@ -1714,6 +1714,8 @@
 vba-fix-font-attribute-access.diff, n#433292
 # add Font.FontStyle and Font.OutlineFont, fix Font.getItalic.
 vba-font-api.diff, Fong
+# fix core issue in Commandbar
+vba-fix-commandbar-submenu.diff, n#434214, n#437157, Fong
 [ VBAUntested ]
 SectionOwner => noelpwer
 vba-basic-null.diff i#85349, jjiao

Added: trunk/patches/vba/vba-fix-commandbar-submenu.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-fix-commandbar-submenu.diff	Thu Oct 23 09:22:54 2008
@@ -0,0 +1,157 @@
+diff -urp sc.bak/source/ui/vba/vbacommandbarcontrol.cxx sc/source/ui/vba/vbacommandbarcontrol.cxx
+--- sc.bak/source/ui/vba/vbacommandbarcontrol.cxx	2008-10-10 12:21:53.000000000 +0800
++++ sc/source/ui/vba/vbacommandbarcontrol.cxx	2008-10-23 17:05:05.000000000 +0800
+@@ -69,6 +69,7 @@ ScVbaCommandBarControl::ScVbaCommandBarC
+     // exsiting CommandBarBarControl
+     m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
+     initObjects();
++    m_nPosition = -1;
+     if( m_xBarSettings->hasElements() )
+     {
+         ScVbaCommandBarControl* pParentCommandBarControl = m_pCommandBarControls->GetParentCommandBarControl();
+@@ -161,12 +162,13 @@ ScVbaCommandBarControl::initObjects() th
+     m_xBarSettings.set( m_pCommandBarControls->GetBarSettings(), uno::UNO_QUERY_THROW );
+     m_bIsMenu = m_pCommandBarControls->IsMenu();
+     m_sName = rtl::OUString::createFromAscii( "Custom" );
+-    m_nPosition = -1;
+ }
+ 
+ void
+ ScVbaCommandBarControl::createNewMenuBarControl()
+ {
++    uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
++
+     uno::Sequence< beans::PropertyValue > aPropertys(4);
+     aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
+     aPropertys[0].Value <<= m_sCommand; 
+@@ -175,13 +177,13 @@ ScVbaCommandBarControl::createNewMenuBar
+     aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
+     aPropertys[2].Value <<= m_nType; 
+     aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
+-
++    aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext ); ;
++    /*
+     m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
+     uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
+     rtl::OUString sUIName;
+     xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName;
+-
+-    uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
++    */
+     if( m_pCommandBarControls->GetParentCommandBar() != NULL )
+     {
+         // create a new menu
+@@ -191,7 +193,6 @@ ScVbaCommandBarControl::createNewMenuBar
+     else if( m_pCommandBarControls->GetParentCommandBarControl() != NULL )
+     {
+         // create a new menu entry
+-        // change the parent MenuItem to a PopupMenu
+         ScVbaCommandBarControl* pPc = m_pCommandBarControls->GetParentCommandBarControl();
+         beans::PropertyValues aPropertyValues;
+         pPc->GetCurrentSettings()->getByIndex( pPc->GetPosition() ) >>= aPropertyValues;
+@@ -204,7 +205,7 @@ ScVbaCommandBarControl::createNewMenuBar
+             pPc->GetCurrentSettings()->replaceByIndex( pPc->GetPosition(), uno::makeAny( pPc->GetPropertyValues() ) );
+         }
+         m_xCurrentSettings.set( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY_THROW );
+-        m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( m_aPropertyValues ) );
++        m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
+     }
+     if( m_xUICfgManager->hasSettings( m_sBarName ) )
+     {
+diff -urp sc.bak/source/ui/vba/vbacommandbarcontrol.hxx sc/source/ui/vba/vbacommandbarcontrol.hxx
+--- sc.bak/source/ui/vba/vbacommandbarcontrol.hxx	2008-10-10 12:21:53.000000000 +0800
++++ sc/source/ui/vba/vbacommandbarcontrol.hxx	2008-10-21 11:37:30.000000000 +0800
+@@ -66,6 +66,10 @@ private:
+ public:
+     ScVbaCommandBarControl( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName ) throw (css::uno::RuntimeException);
+     ScVbaCommandBarControl( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, rtl::OUString sCommand, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
++    css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
++    css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
++    css::uno::Reference< css::container::XIndexContainer >  GetBarSettings() { return m_xBarSettings; };
++    sal_Bool IsMenu() { return m_bIsMenu; };
+     sal_Int32 GetPosition() { return m_nPosition; };
+     css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; };
+     css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; };
+diff -urp sc.bak/source/ui/vba/vbacommandbarcontrols.cxx sc/source/ui/vba/vbacommandbarcontrols.cxx
+--- sc.bak/source/ui/vba/vbacommandbarcontrols.cxx	2008-10-10 12:21:55.000000000 +0800
++++ sc/source/ui/vba/vbacommandbarcontrols.cxx	2008-10-23 15:54:22.000000000 +0800
+@@ -38,6 +38,8 @@
+ using namespace com::sun::star;
+ using namespace org::openoffice;
+ 
++uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
++
+ typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE;
+ class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
+ {
+@@ -89,6 +91,24 @@ ScVbaCommandBarControls::ScVbaCommandBar
+     }
+     else if( m_pCommandBarControl )
+     {
++        m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
++        m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
++        beans::PropertyValues aPropertyValues;
++        m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
++        m_pCommandBarControl->SetPropertyValues( aPropertyValues );
++        m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
++
++        uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
++        if( aValue.hasValue() )
++        {
++            m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
++            m_bHasElements = sal_True;
++        }
++        else
++        {
++            m_bHasElements = sal_False;
++        }
++        m_bIsMenu = m_pCommandBarControl->IsMenu();
+     }
+     else
+     {
+@@ -138,7 +158,7 @@ ScVbaCommandBarControls::getCount() thro
+     sal_Int32 nCount = 0;
+     if( m_bHasElements )
+     {
+-        sal_Int32 nBarSettingsCount = m_xBarSettings->getCount();
++        sal_Int32 nBarSettingsCount = m_xCurrentSettings->getCount();
+         for( sal_Int32 i = 0; i < nBarSettingsCount; i++ )
+         {
+             beans::PropertyValues aMenuValues;
+@@ -214,10 +234,22 @@ ScVbaCommandBarControls::Add( const uno:
+             // evalute the action of the new control
+         }
+     if( Before.hasValue() )
+-        if( Before >>= nPosition )
+-        {
+-            // evalute the position of the new Control
++        Before >>= nPosition;
++    else
++    {
++        // if Before is ignore, the new control should be placed at the end of the commandbars;
++        if( m_pCommandBar )
++            nPosition = getCount();
++        else if ( m_pCommandBarControl )
++        {
++            css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
++            xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
++            if( xCurrentSettings.is() )
++            {
++                nPosition = xCurrentSettings->getCount();
++            }
+         }
++    }
+     if( Temporary.hasValue() )
+         if( Temporary >>= bTemporary )
+         {
+diff -urp sc.bak/source/ui/vba/vbacommandbarcontrols.hxx sc/source/ui/vba/vbacommandbarcontrols.hxx
+--- sc.bak/source/ui/vba/vbacommandbarcontrols.hxx	2008-10-10 12:21:55.000000000 +0800
++++ sc/source/ui/vba/vbacommandbarcontrols.hxx	2008-10-23 13:35:40.000000000 +0800
+@@ -56,6 +56,7 @@ private:
+     css::uno::Reference< css::ui::XUIConfigurationManager >         m_xUICfgManager;
+     css::uno::Reference< css::ui::XUIConfigurationPersistence >     m_xUICfgPers;
+     css::uno::Reference< css::container::XIndexContainer >          m_xBarSettings;
++    css::uno::Reference< css::container::XIndexContainer >          m_xCurrentSettings;
+ 
+ public:
+     ScVbaCommandBarControls( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ) throw( css::uno::RuntimeException );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]