[ooo-build-commit] 2 commits - patches/dev300 patches/vba

Pei Feng Lin pflin at kemper.freedesktop.org
Wed Jul 15 00:22:03 PDT 2009


 patches/dev300/apply                           |    4 +
 patches/vba/vba-commandbarcontrol-enabled.diff |   74 +++++++++++++++++++++++++
 patches/vba/vba-dim-as-contants-fix.diff       |   71 +++++++++++++++++++++++
 3 files changed, 149 insertions(+)

New commits:
commit 2775421c23fd7796ce4181edbf92c9d73b79820a
Author: Fong Lin <pflin at novell.com>
Date:   Wed Jul 15 14:04:50 2009 +0800

    fix for dim a variable as vba constant, n#521820
    
    * patches/dev300/apply:
    * patches/vba/vba-dim-as-contants-fix.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 969bb89..ce1cd36 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1874,6 +1874,8 @@ vba-buildin-toolbar-fix.diff, n#520228, Fong
 vba-workbook-precisionasdisplayed.diff, n#520228, Fong
 # support CommandbarControl.Enabled ( Stub )
 vba-commandbarcontrol-enabled.diff, n#520228, Fong
+# fix for dim a variable as vba constant
+vba-dim-as-contants-fix.diff, n#521820, Fong
 [VBAUntested]
 SectionOwner => noelpwer
 # doesn't work
diff --git a/patches/vba/vba-dim-as-contants-fix.diff b/patches/vba/vba-dim-as-contants-fix.diff
new file mode 100644
index 0000000..38a4a1a
--- /dev/null
+++ b/patches/vba/vba-dim-as-contants-fix.diff
@@ -0,0 +1,71 @@
+diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
+index 89bd7c8..1873d26 100644
+--- basic/source/classes/sbunoobj.cxx
++++ basic/source/classes/sbunoobj.cxx
+@@ -3218,6 +3218,44 @@ SbxVariable* getVBAConstant( const String& rName )
+ 	return pConst;
+ }
+ 
++typedef std::vector< rtl::OUString > VBAConstantsVector;
++bool isVBAConstant( const String& rName )
++{
++    bool bConstant = false;
++	static VBAConstantsVector aContantsCache;
++	static bool isInited = false;
++	if ( !isInited )
++	{
++		Sequence< TypeClass > types(1);
++		types[ 0 ] = TypeClass_CONSTANTS;
++		Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE  );
++
++		if ( !xEnum.is() )
++			return NULL;
++
++		while ( xEnum->hasMoreElements() )
++		{
++			Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
++			if ( xConstants.is() )
++			{
++                aContantsCache.push_back( xConstants->getName() );
++			}
++		}
++		isInited = true;
++	}
++	::rtl::OUString sKey( defaultNameSpace );
++    sKey = sKey.concat( rtl::OUString( sal_Unicode('.') ) ).concat( rName );
++	VBAConstantsVector::const_iterator it = aContantsCache.begin();
++    for( ; it != aContantsCache.end(); it++ )
++	{
++        if( sKey.equalsIgnoreAsciiCase( *it ) )
++        {
++            bConstant = true;
++            break;
++        }
++	}
++	return bConstant;
++}
+ // Funktion, um einen globalen Bezeichner im
+ // UnoScope zu suchen und fuer Sbx zu wrappen
+ SbxVariable* findUnoClass( const String& rName )
+diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
+index b37ff96..ca7a28d 100644
+--- basic/source/comp/dim.cxx
++++ basic/source/comp/dim.cxx
+@@ -33,6 +33,8 @@
+ #include <basic/sbx.hxx>
+ #include "sbcomp.hxx"
+ 
++bool isVBAConstant( const String& rName );
++
+ // Deklaration einer Variablen
+ // Bei Fehlern wird bis zum Komma oder Newline geparst.
+ // Returnwert: eine neue Instanz, die eingefuegt und dann geloescht wird.
+@@ -147,7 +149,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
+ 							}
+ 						}
+ 					}
+-					else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
++					else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && isVBAConstant( aCompleteName ) ) )
+ 					{
+ 						eType = SbxLONG;
+ 						break;
commit 2073b3d293f5563bc2b747145f974e0024204392
Author: Fong Lin <pflin at novell.com>
Date:   Wed Jul 15 14:02:57 2009 +0800

    support CommandbarControl.Enabled, n#520228
    
    * patches/dev300/apply:
    * patches/vba/vba-commandbarcontrol-enabled.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 1589a4c..969bb89 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1872,6 +1872,8 @@ vba-workbook-auto-open-event.diff, n#520228, Fong
 vba-buildin-toolbar-fix.diff, n#520228, Fong
 # support WorkBook.PrecisionAsDisplayed
 vba-workbook-precisionasdisplayed.diff, n#520228, Fong
+# support CommandbarControl.Enabled ( Stub )
+vba-commandbarcontrol-enabled.diff, n#520228, Fong
 [VBAUntested]
 SectionOwner => noelpwer
 # doesn't work
diff --git a/patches/vba/vba-commandbarcontrol-enabled.diff b/patches/vba/vba-commandbarcontrol-enabled.diff
new file mode 100644
index 0000000..3f45fd2
--- /dev/null
+++ b/patches/vba/vba-commandbarcontrol-enabled.diff
@@ -0,0 +1,74 @@
+diff --git oovbaapi/ooo/vba/XCommandBarControl.idl oovbaapi/ooo/vba/XCommandBarControl.idl
+index 167bce8..b10750e 100644
+--- oovbaapi/ooo/vba/XCommandBarControl.idl
++++ oovbaapi/ooo/vba/XCommandBarControl.idl
+@@ -55,6 +55,7 @@ interface XCommandBarControl
+     [attribute] string OnAction;
+     [attribute] boolean Visible;
+     [attribute, readonly] long Type;
++    [attribute] boolean Enabled;
+     
+     void Delete() raises ( com::sun::star::script::BasicErrorException );
+     any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
+diff --git vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbar.cxx
+index 43abe41..fcb3c62 100644
+--- vbahelper/source/vbahelper/vbacommandbar.cxx
++++ vbahelper/source/vbahelper/vbacommandbar.cxx
+@@ -151,16 +151,14 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
+ ::sal_Bool SAL_CALL 
+ ScVbaCommandBar::getEnabled() throw (uno::RuntimeException)
+ {
+-    // #FIXME: seems tha main menu is alwayse enabled.
+-    // for the toolbar, need to investigate
+-    return sal_True;
++    // emulated by Visiable
++    return getVisible();
+ }
+ 
+ void SAL_CALL
+-ScVbaCommandBar::setEnabled( sal_Bool/* _enabled */ ) throw (uno::RuntimeException)
++ScVbaCommandBar::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
+ {
+-    // #FIXME: seems tha main menu is alwayse enabled.
+-    // for the toolbar, need to investigate
++    setVisible( _enabled );
+ }
+ 
+ void SAL_CALL 
+diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+index dd20256..111123c 100644
+--- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
++++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+@@ -118,6 +118,19 @@ ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeExc
+     }
+ }
+ 
++::sal_Bool SAL_CALL 
++ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException)
++{
++    // emulated by Visiable
++    return getVisible();
++}
++
++void SAL_CALL
++ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
++{
++    setVisible( _enabled );
++}
++
+ void SAL_CALL 
+ ScVbaCommandBarControl::Delete(  ) throw (script::BasicErrorException, uno::RuntimeException)
+ {
+diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.hxx vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
+index f40ad82..e125317 100644
+--- vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
++++ vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
+@@ -71,6 +71,8 @@ public:
+     virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
+     virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+     virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
++    virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
+     virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
+     {
+         return ov::office::MsoControlType::msoControlButton;


More information about the ooo-build-commit mailing list