ooo-build r11729 - in trunk: . patches/vba
- From: jiaojh svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11729 - in trunk: . patches/vba
- Date: Thu, 28 Feb 2008 07:31:01 +0000 (GMT)
Author: jiaojh
Date: Thu Feb 28 07:31:01 2008
New Revision: 11729
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11729&view=rev
Log:
* patches/vba/vba-commandbar-bundle.diff: updated collection
with collection base.
Modified:
trunk/ChangeLog
trunk/patches/vba/vba-commandbar-bundle.diff
Modified: trunk/patches/vba/vba-commandbar-bundle.diff
==============================================================================
--- trunk/patches/vba/vba-commandbar-bundle.diff (original)
+++ trunk/patches/vba/vba-commandbar-bundle.diff Thu Feb 28 07:31:01 2008
@@ -1,5 +1,5 @@
---- oovbaapi/org/openoffice/vba/makefile.mk.orig 2008-01-21 14:43:02.000000000 +0800
-+++ oovbaapi/org/openoffice/vba/makefile.mk 2008-01-21 14:52:35.000000000 +0800
+--- oovbaapi/org/openoffice/vba/makefile.mk.orig 2008-02-22 10:42:57.000000000 +0800
++++ oovbaapi/org/openoffice/vba/makefile.mk 2008-02-22 10:43:03.000000000 +0800
@@ -52,6 +52,10 @@ IDLFILES=\
XPropValue.idl\
XHelperInterface.idl\
@@ -12,8 +12,8 @@
# ------------------------------------------------------------------
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ oovbaapi/org/openoffice/vba/XCommandBarControl.idl 2008-01-21 14:49:10.000000000 +0800
-@@ -0,0 +1,65 @@
++++ oovbaapi/org/openoffice/vba/XCommandBarControl.idl 2008-02-22 17:50:30.000000000 +0800
+@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -62,7 +62,6 @@
+
+module org { module openoffice { module vba {
+//=============================================================================
-+interface XCommandBarControls;
+
+interface XCommandBarControl
+{
@@ -73,15 +72,15 @@
+ [attribute] boolean Visible;
+
+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+ XCommandBarControls Controls() raises ( com::sun::star::script::BasicErrorException );
++ any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+}; }; };
+
+#endif
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ oovbaapi/org/openoffice/vba/XCommandBarControls.idl 2008-01-25 14:02:36.000000000 +0800
-@@ -0,0 +1,63 @@
++++ oovbaapi/org/openoffice/vba/XCommandBarControls.idl 2008-02-22 11:07:56.000000000 +0800
+@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -123,9 +122,10 @@
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
-+#ifndef __org_openoffice_vba_XHelperInterface_idl__
-+#include <org/openoffice/vba/XHelperInterface.idl>
++#ifndef __org_openoffice_vba_XCollection_idl__
++#include <org/openoffice/vba/XCollection.idl>
+#endif
++
+//=============================================================================
+
+module org { module openoffice { module vba {
@@ -134,10 +134,7 @@
+
+interface XCommandBarControls
+{
-+ interface XHelperInterface;
-+
-+ [attribute, readonly] long Count;
-+ XCommandBarControl Item( [in] any Index );
++ interface XCollection;
+
+ XCommandBarControl Add( [in] any Type, [in] any Id, [in] any Parameter, [in] any Before, [in] any Temporary ) raises ( com::sun::star::script::BasicErrorException );
+};
@@ -146,7 +143,7 @@
+
+#endif
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ oovbaapi/org/openoffice/vba/XCommandBar.idl 2008-01-21 14:49:16.000000000 +0800
++++ oovbaapi/org/openoffice/vba/XCommandBar.idl 2008-02-22 17:58:56.000000000 +0800
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
@@ -206,15 +203,15 @@
+ [attribute] boolean Visible;
+
+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+ XCommandBarControls Controls() raises ( com::sun::star::script::BasicErrorException );
++ any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+}; }; };
+
+#endif
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ oovbaapi/org/openoffice/vba/XCommandBars.idl 2008-01-25 14:02:58.000000000 +0800
-@@ -0,0 +1,63 @@
++++ oovbaapi/org/openoffice/vba/XCommandBars.idl 2008-02-22 17:58:46.000000000 +0800
+@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -256,8 +253,8 @@
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
-+#ifndef __org_openoffice_vba_XHelperInterface_idl__
-+#include <org/openoffice/vba/XHelperInterface.idl>
++#ifndef __org_openoffice_vba_XCollection_idl__
++#include <org/openoffice/vba/XCollection.idl>
+#endif
+
+//=============================================================================
@@ -268,18 +265,16 @@
+
+interface XCommandBars
+{
-+ interface XHelperInterface;
++ interface XCollection;
+
-+ [attribute, readonly] long Count;
-+ XCommandBar Item( [in] any Index );
+ XCommandBar Add( [in] any Name, [in] any Position, [in] any MenuBar, [in] any Temporary ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+}; }; };
+
+#endif
---- oovbaapi/org/openoffice/excel/XApplication.idl.orig 2008-01-21 17:34:01.000000000 +0800
-+++ oovbaapi/org/openoffice/excel/XApplication.idl 2008-01-24 14:32:11.000000000 +0800
+--- oovbaapi/org/openoffice/excel/XApplication.idl.orig 2008-02-22 10:42:57.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XApplication.idl 2008-02-22 10:43:03.000000000 +0800
@@ -47,6 +47,10 @@
#include <org/openoffice/vba/XAssistant.idl>
#endif
@@ -299,9 +294,9 @@
any Workbooks( [in] any aIndex );
any Worksheets( [in] any aIndex );
any Windows( [in] any aIndex );
---- sc/source/ui/vba/makefile.mk.orig 2008-01-21 14:42:17.000000000 +0800
-+++ sc/source/ui/vba/makefile.mk 2008-01-21 16:25:24.000000000 +0800
-@@ -116,6 +116,10 @@ SLOFILES= \
+--- sc/source/ui/vba/makefile.mk.orig 2008-02-22 10:42:57.000000000 +0800
++++ sc/source/ui/vba/makefile.mk 2008-02-22 10:43:03.000000000 +0800
+@@ -117,6 +117,10 @@ SLOFILES= \
$(SLO)$/vbastyle.obj \
$(SLO)$/vbastyles.obj \
$(SLO)$/vbaassistant.obj \
@@ -313,7 +308,7 @@
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbarcontrol.hxx 2008-01-28 15:40:00.000000000 +0800
++++ sc/source/ui/vba/vbacommandbarcontrol.hxx 2008-02-22 17:49:48.000000000 +0800
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
@@ -398,7 +393,7 @@
+
+ // Methods
+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< oo::vba::XCommandBarControls > SAL_CALL Controls( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
++ virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
@@ -406,8 +401,8 @@
+};
+#endif//SC_VBA_COMMANDBARCONTROL_HXX
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbarcontrol.cxx 2008-01-28 17:12:23.000000000 +0800
-@@ -0,0 +1,391 @@
++++ sc/source/ui/vba/vbacommandbarcontrol.cxx 2008-02-27 12:59:51.000000000 +0800
+@@ -0,0 +1,403 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -777,10 +772,22 @@
+ }
+ }
+}
-+uno::Reference< vba::XCommandBarControls > SAL_CALL
-+ScVbaCommandBarControl::Controls( ) throw (script::BasicErrorException, uno::RuntimeException)
++uno::Any SAL_CALL
++ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
+{
-+ return uno::Reference< vba::XCommandBarControls >( new ScVbaCommandBarControls( this, mxContext ) );
++ sal_Int32 nIndex;
++ uno::Reference< vba::XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
++ if( aIndex.hasValue() )
++ {
++ if( aIndex >>= nIndex )
++ {
++ uno::Reference< vba::XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
++ return uno::makeAny( xCommandBarControl );
++ }
++ else
++ throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() );
++ }
++ return uno::makeAny( xCommandBarControls );
+}
+rtl::OUString&
+ScVbaCommandBarControl::getServiceImplName()
@@ -800,8 +807,8 @@
+ return aServiceNames;
+}
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbarcontrols.hxx 2008-01-28 16:33:52.000000000 +0800
-@@ -0,0 +1,84 @@
++++ sc/source/ui/vba/vbacommandbarcontrols.hxx 2008-02-27 15:51:23.000000000 +0800
+@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -843,10 +850,11 @@
+
+#include "vbahelperinterface.hxx"
+#include "vbacommandbar.hxx"
++#include "vbacollectionimpl.hxx"
+
+class ScVbaCommandBarControl;
+
-+typedef InheritedHelperInterfaceImpl1< oo::vba::XCommandBarControls > CommandBarControls_BASE;
++typedef CollTestImplHelper< oo::vba::XCommandBarControls > CommandBarControls_BASE;
+
+class ScVbaCommandBarControls : public CommandBarControls_BASE
+{
@@ -861,7 +869,7 @@
+ css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
+
+public:
-+ ScVbaCommandBarControls( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext ) throw( css::uno::RuntimeException );
++ 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 );
+ 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; };
@@ -873,12 +881,17 @@
+ if( m_pCommandBar ) return m_pCommandBar->GetToolBarName();
+ else return rtl::OUString();
+ }
++ rtl::OUString GetControlNameByIndex( const sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
+
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
++ // XEnumerationAccess
++ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
++ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
++ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+
+ // Methods
-+ virtual css::uno::Reference< oo::vba::XCommandBarControl > SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
++ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< oo::vba::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
@@ -887,8 +900,8 @@
+
+#endif//SC_VBA_COMMANDBARCONTROLS_HXX
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbarcontrols.cxx 2008-01-28 15:00:16.000000000 +0800
-@@ -0,0 +1,162 @@
++++ sc/source/ui/vba/vbacommandbarcontrols.cxx 2008-02-28 15:00:35.000000000 +0800
+@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -929,7 +942,38 @@
+using namespace com::sun::star;
+using namespace org::openoffice;
+
-+ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext )
++typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE;
++class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
++{
++ //uno::Reference< uno::XComponentContext > m_xContext;
++ ScVbaCommandBarControls* m_pCommandBarControls;
++ sal_Int32 m_nCurrentPosition;
++public:
++ CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {}
++ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
++ {
++ if( m_nCurrentPosition < m_pCommandBarControls->getCount() )
++ return sal_True;
++ return sal_False;
++ }
++ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
++ {
++ if( hasMoreElements() )
++ {
++ rtl::OUString sName = m_pCommandBarControls->GetControlNameByIndex( m_nCurrentPosition );
++ m_nCurrentPosition = m_nCurrentPosition + 1;
++ if( sName.getLength() > 0 )
++ return m_pCommandBarControls->createCollectionObject( uno::makeAny( sName ) );
++ else
++ return nextElement();
++ }
++ else
++ throw container::NoSuchElementException();
++ return uno::Any();
++ }
++};
++
++ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess )
+{
+ m_bIsMenu = sal_False;
+ m_bHasElements = sal_False;
@@ -955,6 +999,41 @@
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() );
+ }
+}
++rtl::OUString
++ScVbaCommandBarControls::GetControlNameByIndex( const sal_Int32 nIndex ) throw ( uno::RuntimeException )
++{
++ sal_Int32 nCount = 0;
++ if( m_bHasElements )
++ {
++ sal_Int32 nBarSettingsCount = m_xBarSettings->getCount();
++ for( sal_Int32 i = 0; i < nBarSettingsCount; i++ )
++ {
++ beans::PropertyValues aMenuValues;
++ m_xBarSettings->getByIndex( i ) >>= aMenuValues;
++ for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ )
++ {
++ if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) )
++ {
++ nCount++;
++ if( nIndex == nCount )
++ {
++ rtl::OUString sCommandURL;
++ aMenuValues[j].Value >>= sCommandURL;
++ sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") );
++ if( ( nLastIndex != -1 ) && ( ( nLastIndex +1 ) < sCommandURL.getLength() ) )
++ {
++ sCommandURL = sCommandURL.copy( nLastIndex + 1 );
++ return sCommandURL;
++ }
++ }
++ }
++ }
++ }
++ }
++ else
++ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Out of bound" ), uno::Reference< uno::XInterface >() );
++ return rtl::OUString();
++}
+
+// Attributes
+sal_Int32 SAL_CALL
@@ -979,23 +1058,42 @@
+ }
+ return nCount;
+}
++// XEnumerationAccess
++uno::Type SAL_CALL
++ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException )
++{
++ return vba::XCommandBarControls::static_type( 0 );
++}
++uno::Reference< container::XEnumeration >
++ScVbaCommandBarControls::createEnumeration() throw ( uno::RuntimeException )
++{
++ return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) );
++}
++uno::Any
++ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource )
++{
++ // only surport the aSource as a name string, because this class is a API wrapper
++ rtl::OUString sName;
++ if( aSource >>= sName )
++ return uno::makeAny( uno::Reference< vba::XCommandBarControl > ( new ScVbaCommandBarControl( this, mxContext, sName ) ) );
++ return uno::Any();
++}
+
+// Methods
-+uno::Reference< vba::XCommandBarControl > SAL_CALL
-+ScVbaCommandBarControls::Item( const uno::Any& aIndex ) throw (uno::RuntimeException)
++uno::Any SAL_CALL
++ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException)
+{
-+ rtl::OUString sName;
-+ if( aIndex >>= sName )
++ if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
+ {
-+ return new ScVbaCommandBarControl( this, mxContext, sName );
-+ }
++ return createCollectionObject( aIndex );
++ }
+ sal_Int32 nIndex;
+ if( aIndex >>= nIndex )
+ {
-+ // do nothing at this time
++ return createCollectionObject( uno::makeAny( GetControlNameByIndex( nIndex ) ) );
+ }
+
-+ return uno::Reference< vba::XCommandBarControl > ();
++ return uno::Any();
+}
+uno::Reference< vba::XCommandBarControl > SAL_CALL
+ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const uno::Any& Parameter, const uno::Any& Before, const uno::Any& Temporary ) throw (script::BasicErrorException, uno::RuntimeException)
@@ -1052,7 +1150,7 @@
+}
+
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbar.hxx 2008-01-29 18:02:29.000000000 +0800
++++ sc/source/ui/vba/vbacommandbar.hxx 2008-02-22 17:48:24.000000000 +0800
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
@@ -1152,7 +1250,7 @@
+
+ // Methods
+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< oo::vba::XCommandBarControls > SAL_CALL Controls( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
++ virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
@@ -1160,8 +1258,8 @@
+};
+#endif//SC_VBA_COMMANDBAR_HXX
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbar.cxx 2008-01-30 10:42:36.000000000 +0800
-@@ -0,0 +1,317 @@
++++ sc/source/ui/vba/vbacommandbar.cxx 2008-02-27 12:59:19.000000000 +0800
+@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -1457,10 +1555,22 @@
+ }
+ }
+}
-+uno::Reference< vba::XCommandBarControls > SAL_CALL
-+ScVbaCommandBar::Controls( ) throw (script::BasicErrorException, uno::RuntimeException)
++uno::Any SAL_CALL
++ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
+{
-+ return uno::Reference< vba::XCommandBarControls >( new ScVbaCommandBarControls( this, mxContext ) );
++ sal_Int32 nIndex;
++ uno::Reference< vba::XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
++ if( aIndex.hasValue() )
++ {
++ if( aIndex >>= nIndex )
++ {
++ uno::Reference< vba::XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
++ return uno::makeAny( xCommandBarControl );
++ }
++ else
++ throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() );
++ }
++ return uno::makeAny( xCommandBarControls );
+}
+rtl::OUString&
+ScVbaCommandBar::getServiceImplName()
@@ -1480,8 +1590,8 @@
+ return aServiceNames;
+}
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbars.hxx 2008-01-30 10:45:13.000000000 +0800
-@@ -0,0 +1,72 @@
++++ sc/source/ui/vba/vbacommandbars.hxx 2008-02-22 17:57:39.000000000 +0800
+@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -1519,14 +1629,16 @@
+#ifndef SC_VBA_COMMANDBARS_HXX
+#define SC_VBA_COMMANDBARS_HXX
+
++#include <org/openoffice/vba/XCommandBar.hpp>
+#include <org/openoffice/vba/XCommandBars.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+#include "vbahelperinterface.hxx"
++#include "vbacollectionimpl.hxx"
+
-+typedef InheritedHelperInterfaceImpl1< oo::vba::XCommandBars > CommandBars_BASE;
++typedef CollTestImplHelper< oo::vba::XCommandBars > CommandBars_BASE;
+
+class ScVbaCommandBars : public CommandBars_BASE
+{
@@ -1535,7 +1647,7 @@
+ rtl::OUString m_sModuleName;
+ void retrieveObjects() throw( css::uno::RuntimeException );
+public:
-+ ScVbaCommandBars( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext );
++ ScVbaCommandBars( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess );
+
+ sal_Bool checkToolBarExist( rtl::OUString sToolBarName );
+ rtl::OUString GetModuleName(){ return m_sModuleName; };
@@ -1546,8 +1658,13 @@
+ };
+ // XCommandBars
+ virtual css::uno::Reference< oo::vba::XCommandBar > SAL_CALL Add( const css::uno::Any& Name, const css::uno::Any& Position, const css::uno::Any& MenuBar, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
++ // XEnumerationAccess
++ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
++ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
++ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
++
+ virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ virtual css::uno::Reference< oo::vba::XCommandBar > SAL_CALL Item( const css::uno::Any& aIndex ) throw( css::uno::RuntimeException);
++ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
@@ -1555,8 +1672,8 @@
+
+#endif//SC_VBA_COMMANDBARS_HXX
--- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbacommandbars.cxx 2008-01-29 18:00:48.000000000 +0800
-@@ -0,0 +1,171 @@
++++ sc/source/ui/vba/vbacommandbars.cxx 2008-02-28 15:27:39.000000000 +0800
+@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -1601,11 +1718,64 @@
+using namespace com::sun::star;
+using namespace org::openoffice;
+
++typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE;
++
+static rtl::OUString sSpreadsheetDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
+static rtl::OUString sTextDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) );
+static rtl::OUString sWindowStateConfUrl( rtl::OUString::createFromAscii( "com.sun.star.ui.WindowStateConfiguration" ) );
+
-+ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext ) : CommandBars_BASE( xParent, xContext )
++class CommandBarEnumeration : public CommandBarEnumeration_BASE
++{
++ uno::Reference< uno::XComponentContext > m_xContext;
++ uno::Reference< vba::XCommandBars > m_xCommandBars;
++ uno::Sequence< rtl::OUString > m_sNames;
++ sal_Int32 m_nCurrentPosition;
++public:
++ CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< vba::XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 )
++ {
++ }
++ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
++ {
++ if( m_nCurrentPosition < m_sNames.getLength() )
++ return sal_True;
++ return sal_False;
++ }
++ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
++ {
++ if( hasMoreElements() )
++ {
++ rtl::OUString sName( m_sNames[ m_nCurrentPosition ] );
++ m_nCurrentPosition = m_nCurrentPosition + 1;
++ if( sName.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
++ {
++ sal_Int32 nLastIndex = sName.lastIndexOf( rtl::OUString::createFromAscii( "/" ) );
++ if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sName.getLength() ) )
++ {
++ sName = sName.copy( nLastIndex + 1);
++ if( sName.getLength() > 0 )
++ {
++ uno::Reference< vba::XHelperInterface > xHelperInterface( m_xCommandBars, uno::UNO_QUERY_THROW );
++ uno::Reference< vba::XCommandBar > xCommandBar( new ScVbaCommandBar( xHelperInterface, m_xContext, sName, sal_True, sal_False ) );
++ if( xCommandBar.is() )
++ return uno::makeAny( xCommandBar );
++ else
++ return nextElement();
++ }
++ else
++ return nextElement();
++ }
++ }
++ else
++ return nextElement();
++ }
++ else
++ throw container::NoSuchElementException();
++ return uno::Any();
++ }
++};
++
++
++ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess ) : CommandBars_BASE( xParent, xContext, xIndexAccess )
+{
+ retrieveObjects();
+}
@@ -1629,6 +1799,42 @@
+ m_xNameAccess.set( xNameAccess->getByName( m_sModuleName ), uno::UNO_QUERY_THROW );
+}
+
++// XEnumerationAccess
++uno::Type SAL_CALL
++ScVbaCommandBars::getElementType() throw ( uno::RuntimeException )
++{
++ return vba::XCommandBars::static_type( 0 );
++}
++uno::Reference< container::XEnumeration >
++ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException )
++{
++ return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames() ) );
++}
++
++uno::Any
++ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
++{
++ // aSource should be a name at this time, because of the class is API wrapper.
++ rtl::OUString sToolBarName;
++ if( aSource >>= sToolBarName )
++ {
++ sToolBarName = sToolBarName.toAsciiLowerCase();
++ if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) )
++ {
++ return uno::makeAny( uno::Reference< vba::XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) ) );
++ }
++ else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
++ {
++ return uno::makeAny( uno::Reference< vba::XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) ) );
++ }
++ else if( checkToolBarExist( sToolBarName ) )
++ {
++ return uno::makeAny( uno::Reference< vba::XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) ) );
++ }
++ }
++ return uno::Any();
++}
++
+// XCommandBars
+uno::Reference< vba::XCommandBar > SAL_CALL
+ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
@@ -1664,27 +1870,14 @@
+}
+
+// ScVbaCollectionBaseImpl
-+uno::Reference< vba::XCommandBar > SAL_CALL
-+ScVbaCommandBars::Item( const uno::Any& aSource ) throw( uno::RuntimeException )
++uno::Any SAL_CALL
++ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
+{
-+ rtl::OUString sToolBarName;
-+ if( aSource >>= sToolBarName )
++ if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
+ {
-+ sToolBarName = sToolBarName.toAsciiLowerCase();
-+ if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) )
-+ {
-+ return uno::Reference< vba::XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) );
-+ }
-+ else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
-+ {
-+ return uno::Reference< vba::XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) );
-+ }
-+ else if( checkToolBarExist( sToolBarName ) )
-+ {
-+ return uno::Reference< vba::XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) );
-+ }
++ return createCollectionObject( aIndex );
+ }
-+ return uno::Reference< vba::XCommandBar >();
++ return uno::Any();
+}
+
+sal_Bool
@@ -1728,8 +1921,8 @@
+ return aServiceNames;
+}
+
---- sc/source/ui/vba/vbaapplication.hxx.orig 2008-01-21 17:48:09.000000000 +0800
-+++ sc/source/ui/vba/vbaapplication.hxx 2008-01-24 14:33:26.000000000 +0800
+--- sc/source/ui/vba/vbaapplication.hxx.orig 2008-02-22 10:42:57.000000000 +0800
++++ sc/source/ui/vba/vbaapplication.hxx 2008-02-22 10:43:03.000000000 +0800
@@ -81,6 +81,7 @@ public:
virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException );
@@ -1738,17 +1931,17 @@
virtual css::uno::Reference< oo::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Workbooks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
---- sc/source/ui/vba/vbaapplication.cxx.orig 2008-01-21 17:48:18.000000000 +0800
-+++ sc/source/ui/vba/vbaapplication.cxx 2008-01-25 18:14:07.000000000 +0800
-@@ -63,6 +63,7 @@
- #include "vbanames.hxx"
+--- sc/source/ui/vba/vbaapplication.cxx.orig 2008-02-22 10:42:57.000000000 +0800
++++ sc/source/ui/vba/vbaapplication.cxx 2008-02-22 14:36:56.000000000 +0800
+@@ -64,6 +64,7 @@
#include "vbashape.hxx"
+ #include "vbatextboxshape.hxx"
#include "vbaassistant.hxx"
+#include "vbacommandbars.hxx"
#include "sc.hrc"
#include <osl/file.hxx>
-@@ -131,12 +132,21 @@ ScVbaApplication::getThisWorkbook() thro
+@@ -132,12 +133,21 @@ ScVbaApplication::getThisWorkbook() thro
}
uno::Reference< vba::XAssistant > SAL_CALL
@@ -1761,13 +1954,13 @@
uno::Any SAL_CALL
+ScVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
+{
-+ uno::Reference< vba::XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext ) );
++ uno::Reference< vba::XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
+ if( aIndex.hasValue() )
-+ return uno::makeAny( xCommandBars->Item( aIndex ) );
++ return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) );
+ return uno::makeAny( xCommandBars );
+}
+
+uno::Any SAL_CALL
ScVbaApplication::getSelection() throw (uno::RuntimeException)
{
- uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument()->getCurrentSelection(), uno::UNO_QUERY_THROW );
+ OSL_TRACE("** ScVbaApplication::getSelection() ** ");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]