ooo-build r11525 - in branches/sled-10-ooo-build-2-3: . patches/src680 patches/vba



Author: noelpwer
Date: Thu Feb  7 16:56:14 2008
New Revision: 11525
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11525&view=rev

Log:
2008-02-07  Noel Power  <noel power novell com>

        * patches/src680/apply: backport some needed pieces to partially 
        satisfy bug n#338012
        * patches/vba/vba-assistant-impl.diff:
        * patches/vba/n353260-datevalue.diff:
        * patches/vba/vba-displayworkbooktabs.diff:
        * patches/vba/vba-commandbar-bundle.diff:
        * patches/vba/n353254-dateserial.diff:



Added:
   branches/sled-10-ooo-build-2-3/patches/vba/n353254-dateserial.diff
   branches/sled-10-ooo-build-2-3/patches/vba/n353260-datevalue.diff
   branches/sled-10-ooo-build-2-3/patches/vba/vba-assistant-impl.diff
   branches/sled-10-ooo-build-2-3/patches/vba/vba-commandbar-bundle.diff
   branches/sled-10-ooo-build-2-3/patches/vba/vba-displayworkbooktabs.diff
Modified:
   branches/sled-10-ooo-build-2-3/ChangeLog
   branches/sled-10-ooo-build-2-3/patches/src680/apply

Modified: branches/sled-10-ooo-build-2-3/patches/src680/apply
==============================================================================
--- branches/sled-10-ooo-build-2-3/patches/src680/apply	(original)
+++ branches/sled-10-ooo-build-2-3/patches/src680/apply	Thu Feb  7 16:56:14 2008
@@ -1327,6 +1327,15 @@
 # Application.Caller 
 api-application-caller.diff, n#339941, noelpwer
 basic-caller-support.diff, n#339941, noelpwer
+
+# backported from npower11
+vba-assistant-impl.diff, n#353248, Jianhua 
+# backported from trunk
+vba-commandbar-bundle.diff, n#353242, Jianhua
+n353254-dateserial.diff, n#353254, Fong
+n353260-datevalue.diff, n#353260, Fong
+# backported implementation of Windows.DisplayWorktabs property
+vba-displayworkbooktabs.diff
 [ VBAUntested ]
 SectionOwner => noelpwer
 basic-source-classes-eventatt-cxx.diff, #no-upstream

Added: branches/sled-10-ooo-build-2-3/patches/vba/n353254-dateserial.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/vba/n353254-dateserial.diff	Thu Feb  7 16:56:14 2008
@@ -0,0 +1,55 @@
+--- basic/source/runtime/methods.cxx	2008-02-07 12:25:54.000000000 +0000
++++ basic/source/runtime/methods.cxx	2008-02-07 12:36:22.000000000 +0000
+@@ -1830,15 +1830,48 @@ BOOL implDateSerial( INT16 nYear, INT16 
+ {
+ 	if ( nYear < 100 )
+ 		nYear += 1900;
+-	if ((nYear < 100 || nYear > 9999)   ||
+-		(nMonth < 1 || nMonth > 12 )	||
+-		(nDay < 1 || nDay > 31 ))
++	Date aCurDate( nDay, nMonth, nYear );
++	if ((nYear < 100 || nYear > 9999) )  
+ 	{
+ 		StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ 		return FALSE;
+ 	}
++	if ( !SbiRuntime::isVBAEnabled() )
++	{
++		if ( (nMonth < 1 || nMonth > 12 )||
++		(nDay < 1 || nDay > 31 ) ) 
++		{
++			StarBASIC::Error( SbERR_BAD_ARGUMENT );
++			return FALSE;
++		}
++	}
++	else
++	{
++		// grab the year & month
++		aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear );
++	
++		// adjust year based on month value
++		// e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year )
++		//		2000, 13, xx = 2001, 1, xx ( or January of the following year )
++		if( ( nMonth < 1 ) || ( nMonth > 12 ) )
++		{
++			// inacurrate around leap year, don't use days to calculate,
++			// just modify the months directory
++			INT16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
++			if ( nMonth <=0 )
++				nYearAdj = ( ( nMonth -12 ) / 12 );
++			aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
++		}
++
++		// adjust day value,
++		// e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month
++		//		2000, 1, 32 = 2000, 2, 1 or the first day of the following month
++		if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) )
++			aCurDate += nDay - 1;
++		else
++			aCurDate.SetDay( nDay );
++	}	
+ 
+-	Date aCurDate( nDay, nMonth, nYear );
+ 	long nDiffDays = GetDayDiff( aCurDate );
+     rdRet = (double)nDiffDays;
+     return TRUE;

Added: branches/sled-10-ooo-build-2-3/patches/vba/n353260-datevalue.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/vba/n353260-datevalue.diff	Thu Feb  7 16:56:14 2008
@@ -0,0 +1,170 @@
+--- /dev/null	2007-05-04 18:54:36.000000000 +0800
++++ udkapi/com/sun/star/script/DateType.idl	2008-01-24 22:05:46.000000000 +0800
+@@ -0,0 +1,63 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: DateType.idl,v $
++ *
++ *  $Revision: 1.0 $
++ *
++ *  last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++
++#ifndef __com_sun_star_script_XDateType_idl__
++#define __com_sun_star_script_XDateType_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++//=============================================================================
++module com {  module sun {  module star { module script {
++
++//=============================================================================
++/** A date type for script 
++*/
++
++struct DateType
++{
++    /** the value of date. 
++    */
++	double Value; 
++};
++
++//=============================================================================
++
++}; }; }; };
++
++#endif
++
++
+--- udkapi/com/sun/star/script/makefile.mk.orig	2008-01-25 11:35:24.000000000 +0800
++++ udkapi/com/sun/star/script/makefile.mk	2008-01-24 21:38:10.000000000 +0800
+@@ -89,6 +89,7 @@ IDLFILES=\
+ 	XScriptEventsAttacher.idl\
+ 	XDefaultMethod.idl\
+ 	XDefaultProperty.idl\
++	DateType.idl\
+ 
+ # ------------------------------------------------------------------
+ 
+--- sc/source/ui/vba/vbarange.cxx.orig	2008-01-24 21:40:42.000000000 +0800
++++ sc/source/ui/vba/vbarange.cxx	2008-01-24 21:52:45.000000000 +0800
+@@ -167,6 +167,7 @@
+ // end test includes
+ 
+ #include <org/openoffice/excel/Range.hpp>
++#include <com/sun/star/script/DateType.hpp>
+ 
+ using namespace ::org::openoffice;
+ using namespace ::com::sun::star;
+@@ -447,6 +448,18 @@ public:
+ 		return false;
+ 	}
+ 
++	bool isDateType()
++	{
++		sal_Int16 nType = getNumberFormat();
++		if(( nType & util::NumberFormat::DATE )
++			|| ( nType & util::NumberFormat::TIME )
++			|| ( nType & util::NumberFormat::DATETIME ))
++		{
++			return true;
++		}
++		return false;
++	}
++	
+ 	rtl::OUString getNumberFormatString()
+ 	{
+ 		uno::Reference< uno::XInterface > xIf( mxRangeProps, uno::UNO_QUERY_THROW );
+@@ -720,6 +733,8 @@ void CellValueGetter::visitNode( sal_Int
+ 			NumFormatHelper cellFormat( xRange );
+ 			if ( cellFormat.isBooleanType() )
+ 				aValue = uno::makeAny( ( xCell->getValue() != 0.0 ) );
++			else if ( cellFormat.isDateType() )
++				aValue = uno::makeAny( script::DateType( xCell->getValue() ) );
+ 			else
+ 				aValue <<= xCell->getValue();
+ 		}
+--- basic/source/classes/sbunoobj.cxx.orig	2008-01-24 21:40:12.000000000 +0800
++++ basic/source/classes/sbunoobj.cxx	2008-01-24 22:19:29.000000000 +0800
+@@ -114,6 +114,7 @@ using namespace rtl;
+ #include <hash_map>
+ #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
+ #include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
++#include <com/sun/star/script/DateType.hpp>
+ 
+ TYPEINIT1(SbUnoMethod,SbxMethod)
+ TYPEINIT1(SbUnoProperty,SbxProperty)
+@@ -647,6 +648,7 @@ void unoToSbxValue( SbxVariable* pVar, c
+ 			if( eTypeClass == TypeClass_STRUCT )
+ 			{
+ 				ArrayWrapper aWrap;
++				DateType aUnoDate;
+ 				if ( (aValue >>= aWrap) )
+ 				{
+ 					SbxDimArray* pArray = NULL;
+@@ -666,6 +668,11 @@ void unoToSbxValue( SbxVariable* pVar, c
+ 						pVar->PutEmpty();
+ 					break;
+ 				}
++				else if( (aValue >>= aUnoDate) )
++				{
++					pVar->PutDate( aUnoDate.Value );
++					break;
++				}
+ 				else
+ 				{
+ 					SbiInstance* pInst = pINST;
+--- basic/source/runtime/methods.cxx.orig	2008-01-23 22:38:41.000000000 +0800
++++ basic/source/runtime/methods.cxx	2008-01-25 11:16:46.000000000 +0800
+@@ -2040,6 +2040,23 @@ RTLFUNC(DateValue)
+ 		String aStr( rPar.Get(1)->GetString() );
+ 		BOOL bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
+ 		short nType = pFormatter->GetType( nIndex );
++		
++		// DateValue("February 12, 1969") raises error if the system locale is not en_US
++		// by using SbiInstance::GetNumberFormatter.
++		// It seems that both locale number formatter and English number formatter 
++		// are supported in Visual Basic.
++		LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
++		if( !bSuccess && !(eLangType & LANGUAGE_ENGLISH))
++		{
++			// Create a new SvNumberFormatter by using LANGUAGE_ENGLISH to get the date value;
++			com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > 
++				xFactory = comphelper::getProcessServiceFactory();
++			SvNumberFormatter* pFormatterEn = new SvNumberFormatter( xFactory, LANGUAGE_ENGLISH );
++			bSuccess = pFormatterEn->IsNumberFormat( aStr, nIndex, fResult );
++			nType = pFormatterEn->GetType( nIndex );
++			delete pFormatterEn;
++		}
++
+ 		if(bSuccess && (nType==NUMBERFORMAT_DATE || nType==NUMBERFORMAT_DATETIME))
+ 		{
+ 			if ( nType == NUMBERFORMAT_DATETIME )

Added: branches/sled-10-ooo-build-2-3/patches/vba/vba-assistant-impl.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/vba/vba-assistant-impl.diff	Thu Feb  7 16:56:14 2008
@@ -0,0 +1,408 @@
+Index: sc/source/ui/vba/makefile.mk
+===================================================================
+RCS file: /cvs/sc/sc/source/ui/vba/makefile.mk,v
+retrieving revision 1.5
+retrieving revision 1.5.42.1
+diff -u -p -u -p -b -w -B -r1.5 -r1.5.42.1
+--- sc/source/ui/vba/makefile.mk	7 Dec 2007 10:42:39 -0000	1.5
++++ sc/source/ui/vba/makefile.mk	18 Jan 2008 16:51:37 -0000	1.5.42.1
+@@ -115,6 +115,7 @@ SLOFILES= \
+                 $(SLO)$/vbaformatconditions.obj \
+                 $(SLO)$/vbastyle.obj \
+                 $(SLO)$/vbastyles.obj \
++                $(SLO)$/vbaassistant.obj \
+ 		$(SLO)$/service.obj \
+  
+ 
+Index: sc/source/ui/vba/vbaapplication.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/ui/vba/vbaapplication.cxx,v
+retrieving revision 1.5
+retrieving revision 1.5.42.1
+diff -u -p -u -p -b -w -B -r1.5 -r1.5.42.1
+--- sc/source/ui/vba/vbaapplication.cxx	7 Dec 2007 10:43:04 -0000	1.5
++++ sc/source/ui/vba/vbaapplication.cxx	18 Jan 2008 16:51:37 -0000	1.5.42.1
+@@ -62,6 +62,7 @@
+ #include "gridwin.hxx"
+ #include "vbanames.hxx"
+ #include "vbashape.hxx"
++#include "vbaassistant.hxx"
+ #include "sc.hrc"
+ 
+ #include <osl/file.hxx>
+@@ -127,6 +128,12 @@ ScVbaApplication::getThisWorkbook() thro
+ 	return getActiveWorkbook();
+ }
+ 
++uno::Reference< vba::XAssistant > SAL_CALL
++ScVbaApplication::getAssistant() throw (css::uno::RuntimeException)
++{
++    return uno::Reference< vba::XAssistant >( new ScVbaAssistant( this, mxContext ) );
++}
++
+ uno::Any SAL_CALL
+ ScVbaApplication::getSelection() throw (uno::RuntimeException)
+ {
+Index: sc/source/ui/vba/vbaapplication.hxx
+===================================================================
+RCS file: /cvs/sc/sc/source/ui/vba/vbaapplication.hxx,v
+retrieving revision 1.3
+retrieving revision 1.3.42.1
+diff -u -p -u -p -b -w -B -r1.3 -r1.3.42.1
+--- sc/source/ui/vba/vbaapplication.hxx	7 Dec 2007 10:43:17 -0000	1.3
++++ sc/source/ui/vba/vbaapplication.hxx	18 Jan 2008 16:51:37 -0000	1.3.42.1
+@@ -80,6 +80,7 @@ public:
+ 	virtual ::sal_Bool SAL_CALL getDisplayFormulaBar() throw ( css::uno::RuntimeException );
+ 	virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException );
+ 
++    virtual css::uno::Reference< oo::vba::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException);
+ 	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);
+Index: sc/source/ui/vba/vbaassistant.cxx
+===================================================================
+RCS file: sc/source/ui/vba/vbaassistant.cxx
+diff -N sc/source/ui/vba/vbaassistant.cxx
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sc/source/ui/vba/vbaassistant.cxx	18 Jan 2008 19:27:41 -0000	1.1.2.1
+@@ -0,0 +1,140 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#include <sfx2/app.hxx>
++#include <svtools/helpopt.hxx>
++
++#include <org/openoffice/office/MsoAnimationType.hpp>
++
++#include"vbaassistant.hxx"
++
++
++using namespace com::sun::star;
++using namespace org::openoffice;
++
++using namespace org::openoffice::office::MsoAnimationType;
++
++ScVbaAssistant::ScVbaAssistant( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext ): ScVbaAssistantImpl_BASE( xParent, xContext )
++{
++    m_bIsVisible = sal_False;
++    m_nPointsLeft = 795;
++    m_nPointsTop = 248;
++    m_sName = rtl::OUString::createFromAscii( "Clippit" );
++    m_nAnimation = msoAnimationIdle;
++}
++
++ScVbaAssistant::~ScVbaAssistant()
++{
++}
++
++sal_Bool SAL_CALL ScVbaAssistant::getVisible() throw (uno::RuntimeException)
++{
++    return m_bIsVisible;
++}
++
++void SAL_CALL ScVbaAssistant::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
++{
++    m_bIsVisible = bVisible;
++}
++
++sal_Bool SAL_CALL ScVbaAssistant::getOn() throw (uno::RuntimeException)
++{
++    if( SvtHelpOptions().IsHelpAgentAutoStartMode() )
++        return sal_True;
++    else
++        return sal_False;
++}
++
++void SAL_CALL ScVbaAssistant::setOn( sal_Bool bOn ) throw (uno::RuntimeException)
++{
++    SvtHelpOptions().SetHelpAgentAutoStartMode( bOn );
++    setVisible( bOn );
++}
++
++
++::sal_Int32 SAL_CALL 
++ScVbaAssistant::getTop() throw (css::uno::RuntimeException)
++{
++    return m_nPointsTop;
++}
++void SAL_CALL 
++ScVbaAssistant::setTop( ::sal_Int32 _top ) throw (css::uno::RuntimeException)
++{
++    m_nPointsTop = _top;
++}
++::sal_Int32 SAL_CALL 
++ScVbaAssistant::getLeft() throw (css::uno::RuntimeException)
++{
++    return m_nPointsLeft;
++}
++void SAL_CALL 
++ScVbaAssistant::setLeft( ::sal_Int32 _left ) throw (css::uno::RuntimeException)
++{
++    m_nPointsLeft = _left;
++}
++::sal_Int32 SAL_CALL 
++ScVbaAssistant::getAnimation() throw (css::uno::RuntimeException)
++{
++    return m_nAnimation;
++}
++void SAL_CALL 
++ScVbaAssistant::setAnimation( ::sal_Int32 _animation ) throw (css::uno::RuntimeException)
++{
++    m_nAnimation = _animation;
++}
++
++::rtl::OUString SAL_CALL 
++ScVbaAssistant::Name(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
++{
++    return m_sName;
++}
++
++rtl::OUString& 
++ScVbaAssistant::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaAssistant") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaAssistant::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.Assistant" ) );
++	}
++	return aServiceNames;
++}
+Index: sc/source/ui/vba/vbaassistant.hxx
+===================================================================
+RCS file: sc/source/ui/vba/vbaassistant.hxx
+diff -N sc/source/ui/vba/vbaassistant.hxx
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sc/source/ui/vba/vbaassistant.hxx	18 Jan 2008 19:27:42 -0000	1.1.2.1
+@@ -0,0 +1,78 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef SC_VBA_ASSISTANT_HXX
++#define SC_VBA_ASSISTANT_HXX
++
++#include <cppuhelper/implbase1.hxx>
++#include <org/openoffice/vba/XAssistant.hpp>
++
++#include <sfx2/sfxhelp.hxx>
++
++#include "vbahelper.hxx"
++#include "vbahelperinterface.hxx"
++
++typedef ::cppu::WeakImplHelper1< oo::vba::XAssistant > Assistant;
++typedef InheritedHelperInterfaceImpl< Assistant > ScVbaAssistantImpl_BASE;
++
++class ScVbaAssistant : public ScVbaAssistantImpl_BASE
++{
++private:
++    sal_Bool        m_bIsVisible;
++    sal_Int32       m_nPointsLeft;
++    sal_Int32       m_nPointsTop;
++    rtl::OUString   m_sName;
++    sal_Int32       m_nAnimation;
++public:
++    ScVbaAssistant( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext );
++    virtual ~ScVbaAssistant();
++    // XAssistant 
++    virtual sal_Bool SAL_CALL getOn() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setOn( sal_Bool _on ) 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_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setTop( ::sal_Int32 _top ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setLeft( ::sal_Int32 _left ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getAnimation() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setAnimation( ::sal_Int32 _animation ) throw (css::uno::RuntimeException);
++
++    virtual ::rtl::OUString SAL_CALL Name(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#endif//SC_VBA_ASSISTANT_HXX
+Index: oovbaapi/org/openoffice/excel/XApplication.idl
+===================================================================
+RCS file: /cvs/api/oovbaapi/org/openoffice/excel/XApplication.idl,v
+retrieving revision 1.3
+retrieving revision 1.3.4.1
+diff -u -p -u -p -b -w -B -r1.3 -r1.3.4.1
+--- oovbaapi/org/openoffice/excel/XApplication.idl	7 Dec 2007 11:21:12 -0000	1.3
++++ oovbaapi/org/openoffice/excel/XApplication.idl	18 Jan 2008 16:51:20 -0000	1.3.4.1
+@@ -43,6 +43,10 @@
+ #include <org/openoffice/vba/XHelperInterface.idl>
+ #endif
+ 
++#ifndef __org_openoffice_vba_XAssistant_idl__
++#include <org/openoffice/vba/XAssistant.idl>
++#endif
++
+ module org {  module openoffice {  module excel { 
+ 
+ interface XRange;
+@@ -63,6 +67,7 @@ interface XApplication
+ 	[attribute, readonly] XRange ActiveCell;
+ 	[attribute, readonly] XWindow ActiveWindow;
+ 	[attribute, readonly] XWorksheet ActiveSheet;
++    [attribute, readonly] org::openoffice::vba::XAssistant Assistant;
+ 	[attribute] long Calculation;
+ 	//#TODO #FIXME this is more of a placeholder, will return
+ 	// the value of activeworkbook, in xl 'ThisWorkbook' should return the
+Index: oovbaapi/org/openoffice/vba/XAssistant.idl
+===================================================================
+RCS file: oovbaapi/org/openoffice/vba/XAssistant.idl
+diff -N oovbaapi/org/openoffice/vba/XAssistant.idl
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ oovbaapi/org/openoffice/vba/XAssistant.idl	18 Jan 2008 19:28:17 -0000	1.1.2.1
+@@ -0,0 +1,65 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_vba_XAssistant_idl__
++#define __org_openoffice_vba_XAssistant_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++//=============================================================================
++
++module org {  module openoffice {  module vba { 
++//=============================================================================
++
++interface XAssistant
++{
++	interface ::org::openoffice::vba::XHelperInterface;
++
++    [attribute] boolean On;
++    [attribute] boolean Visible;
++    [attribute] long Top;
++    [attribute] long Left;
++    [attribute] long Animation;
++    
++    string Name() raises ( com::sun::star::script::BasicErrorException );
++};
++
++}; }; };
++
++#endif
+Index: oovbaapi/org/openoffice/vba/makefile.mk
+===================================================================
+RCS file: /cvs/api/oovbaapi/org/openoffice/vba/makefile.mk,v
+retrieving revision 1.3
+retrieving revision 1.3.4.1
+diff -u -p -u -p -b -w -B -r1.3 -r1.3.4.1
+--- oovbaapi/org/openoffice/vba/makefile.mk	7 Dec 2007 12:18:21 -0000	1.3
++++ oovbaapi/org/openoffice/vba/makefile.mk	18 Jan 2008 16:51:21 -0000	1.3.4.1
+@@ -56,6 +56,7 @@ IDLFILES=\
+ 	XVBAToOOEventDescGen.idl\
+ 	XPropValue.idl\
+ 	XHelperInterface.idl\
++	XAssistant.idl\
+ 	Globals.idl\
+ 
+ # ------------------------------------------------------------------

Added: branches/sled-10-ooo-build-2-3/patches/vba/vba-commandbar-bundle.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/vba/vba-commandbar-bundle.diff	Thu Feb  7 16:56:14 2008
@@ -0,0 +1,1773 @@
+--- 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
+@@ -52,6 +52,10 @@ IDLFILES=\
+ 	XPropValue.idl\
+ 	XHelperInterface.idl\
+ 	XAssistant.idl\
++	XCommandBarControl.idl\
++	XCommandBarControls.idl\
++	XCommandBar.idl\
++	XCommandBars.idl\
+ 	Globals.idl\
+ 
+ # ------------------------------------------------------------------
+--- /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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_vba_XCommandBarControl_idl__
++#define __org_openoffice_vba_XCommandBarControl_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++//=============================================================================
++
++module org {  module openoffice {  module vba { 
++//=============================================================================
++interface XCommandBarControls;
++
++interface XCommandBarControl
++{
++	interface XHelperInterface;
++
++    [attribute] string Caption;
++    [attribute] string OnAction;
++    [attribute] boolean Visible;
++    
++    void Delete() raises ( com::sun::star::script::BasicErrorException );
++    XCommandBarControls Controls() 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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_vba_XCommandBarControls_idl__
++#define __org_openoffice_vba_XCommandBarControls_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++//=============================================================================
++
++module org {  module openoffice {  module vba { 
++//=============================================================================
++interface XCommandBarControl;
++
++interface XCommandBarControls
++{
++	interface XHelperInterface;
++
++    [attribute, readonly] long Count;
++    XCommandBarControl Item( [in] any Index );
++
++    XCommandBarControl Add( [in] any Type, [in] any Id, [in] any Parameter, [in] any Before, [in] any Temporary ) raises ( com::sun::star::script::BasicErrorException );
++};
++
++}; }; };
++
++#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
+@@ -0,0 +1,64 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_vba_XCommandBar_idl__
++#define __org_openoffice_vba_XCommandBar_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++//=============================================================================
++
++module org {  module openoffice {  module vba { 
++//=============================================================================
++interface XCommandBarControls;
++
++interface XCommandBar
++{
++	interface XHelperInterface;
++
++    [attribute] string Name;
++    [attribute] boolean Visible;
++    
++    void Delete() raises ( com::sun::star::script::BasicErrorException );
++    XCommandBarControls Controls() 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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_vba_XCommandBars_idl__
++#define __org_openoffice_vba_XCommandBars_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++
++//=============================================================================
++
++module org {  module openoffice {  module vba { 
++//=============================================================================
++interface XCommandBar;
++
++interface XCommandBars
++{
++    interface XHelperInterface;
++
++	[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
+@@ -47,6 +47,10 @@
+ #include <org/openoffice/vba/XAssistant.idl>
+ #endif
+ 
++#ifndef __org_openoffice_vba_XCommandBars_idl__
++#include <org/openoffice/vba/XCommandBars.idl>
++#endif
++
+ module org {  module openoffice {  module excel { 
+ 
+ interface XRange;
+@@ -91,6 +95,7 @@ interface XApplication
+ 	string LibraryPath() raises(com::sun::star::script::BasicErrorException);
+ 	string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
+ 	string PathSeparator() raises(com::sun::star::script::BasicErrorException);
++    any CommandBars( [in] any aIndex );
+ 	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= \
+                 $(SLO)$/vbastyle.obj \
+                 $(SLO)$/vbastyles.obj \
+                 $(SLO)$/vbaassistant.obj \
++                $(SLO)$/vbacommandbarcontrol.obj \
++                $(SLO)$/vbacommandbarcontrols.obj \
++                $(SLO)$/vbacommandbar.obj \
++                $(SLO)$/vbacommandbars.obj \
+ 		$(SLO)$/service.obj \
+  
+ 
+--- /dev/null	2007-05-04 18:54:36.000000000 +0800
++++ sc/source/ui/vba/vbacommandbarcontrol.hxx	2008-01-28 15:40:00.000000000 +0800
+@@ -0,0 +1,90 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbarcontrol.hxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:09 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef SC_VBA_COMMANDBARCONTROL_HXX
++#define SC_VBA_COMMANDBARCONTROL_HXX
++
++#include <org/openoffice/vba/XCommandBarControl.hpp>
++
++#include "vbahelperinterface.hxx"
++#include "vbacommandbarcontrols.hxx"
++
++typedef InheritedHelperInterfaceImpl1< oo::vba::XCommandBarControl > CommandBarControl_BASE;
++
++class ScVbaCommandBarControl : public CommandBarControl_BASE
++{
++private:
++    rtl::OUString       m_sName;
++    rtl::OUString       m_sBarName;
++    rtl::OUString       m_sCommand;
++    sal_Int32           m_nType;
++    sal_Int32           m_nPosition;
++    sal_Bool            m_bTemporary;
++    sal_Bool            m_bIsMenu;
++    ScVbaCommandBarControls*        m_pCommandBarControls;
++    css::uno::Reference< oo::vba::XHelperInterface >               m_xParentHardRef;
++    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;
++    css::beans::PropertyValues                                      m_aPropertyValues;
++    
++    void initObjects() throw (css::uno::RuntimeException);
++    void createNewMenuBarControl();
++    void createNewToolBarControl();
++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);
++    sal_Int32 GetPosition() { return m_nPosition; };
++    css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; };
++    css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; };
++    void SetPropertyValues( css::beans::PropertyValues aPropertyValues ) { m_aPropertyValues = aPropertyValues; };
++    
++    // Attributes
++    virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException);
++    virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
++    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);
++
++    // 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);
++
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbarcontrol.cxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:09 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#include "vbacommandbarcontrol.hxx"
++
++using namespace com::sun::star;
++using namespace org::openoffice;
++
++uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName )
++{
++    sal_Int32 nCount = aPropertyValues.getLength();
++    for( sal_Int32 i = 0; i < nCount; i++ )
++    {
++        if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) )
++        {
++            return aPropertyValues[i].Value;
++        }
++    }
++    return uno::Any();
++}
++
++beans::PropertyValues lcl_repalcePropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName, uno::Any aValue )
++{
++    sal_Int32 nCount = aPropertyValues.getLength();
++    for( sal_Int32 i = 0; i < nCount; i++ )
++    {
++        if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) )
++        {
++            aPropertyValues[i].Value = aValue;
++            return aPropertyValues;
++        }
++    }
++    return aPropertyValues;
++}
++
++ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName )
++{
++    // exsiting CommandBarBarControl
++    m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
++    initObjects();
++    if( m_xBarSettings->hasElements() )
++    {
++        ScVbaCommandBarControl* pParentCommandBarControl = m_pCommandBarControls->GetParentCommandBarControl();
++        if( pParentCommandBarControl )
++        {
++            beans::PropertyValues aPropertyValues;
++            pParentCommandBarControl->GetCurrentSettings()->getByIndex( pParentCommandBarControl->GetPosition() ) >>= aPropertyValues;
++            pParentCommandBarControl->SetPropertyValues( aPropertyValues );
++            m_xCurrentSettings.set( lcl_getPropertyValue( pParentCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY_THROW );
++        }
++        if( !m_xCurrentSettings.is() )
++        {
++            m_xCurrentSettings.set( m_xUICfgManager->getSettings( m_pCommandBarControls->GetParentToolBarName(), sal_True ), uno::UNO_QUERY_THROW );
++        }
++        for( sal_Int32 i = 0; i < m_xCurrentSettings->getCount(); i++ )
++        {
++            beans::PropertyValues aPropertyValuesTemp;
++            m_xCurrentSettings->getByIndex( i ) >>= aPropertyValuesTemp;
++            // Label always empty in OOo
++            rtl::OUString sLabel;
++            lcl_getPropertyValue( aPropertyValuesTemp, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
++            if( sLabel.equalsIgnoreAsciiCase( sName ) )
++            {
++                m_nPosition = i;
++                break;
++            }
++            // using CammandURL to find
++            rtl::OUString sCommandURL;
++            lcl_getPropertyValue( aPropertyValuesTemp, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL;
++            sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") );
++            if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sCommandURL.getLength() ) )
++            {
++                sCommandURL = sCommandURL.copy( nLastIndex + 1 );
++            }
++            if( sCommandURL.equalsIgnoreAsciiCase( sName ) )
++            {
++                m_nPosition = i;
++                break;
++            }
++        }
++        if( m_nPosition  == -1 )
++            throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
++    }
++    if( m_bIsMenu )
++    {
++        m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
++    }
++    else
++    {
++        m_sBarName = m_pCommandBarControls->GetParentToolBarName();
++    }
++    m_bTemporary = sal_True;
++}
++ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, rtl::OUString sCommand, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) :  CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary )
++{
++    m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
++    initObjects();
++    if( sName.getLength() > 0 )
++    {
++        m_sName = sName;
++    }
++    if( sCommand.getLength() > 0 )
++    {
++        m_sCommand = sCommand;
++    }
++    else
++    {
++        m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName;
++    }
++    if( m_bIsMenu )
++    {
++        m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
++        createNewMenuBarControl();
++    }
++    else
++    {
++        m_sBarName = m_pCommandBarControls->GetParentToolBarName();
++        createNewToolBarControl();
++    }
++}
++
++void
++ScVbaCommandBarControl::initObjects() throw (uno::RuntimeException)
++{
++    m_pCommandBarControls = dynamic_cast< ScVbaCommandBarControls* >( m_xParentHardRef.get() );
++    if( !m_pCommandBarControls )
++        throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBarControls"), uno::Reference< uno::XInterface >() );
++    m_xUICfgManager.set( m_pCommandBarControls->GetUICfgManager(), uno::UNO_QUERY_THROW );
++    m_xUICfgPers.set( m_pCommandBarControls->GetUICfgPers(), uno::UNO_QUERY_THROW );
++    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::Sequence< beans::PropertyValue > aPropertys(4);
++    aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
++    aPropertys[0].Value <<= m_sCommand; 
++    aPropertys[1].Name = rtl::OUString::createFromAscii("Label");
++    aPropertys[1].Value <<= m_sName; 
++    aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
++    aPropertys[2].Value <<= m_nType; 
++    aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
++
++    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
++        m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
++        m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW );
++    }
++    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;
++        pPc->SetPropertyValues( aPropertyValues );
++        
++        // has the property already been set?
++        if( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ).hasValue() )
++        {
++            lcl_repalcePropertyValue(  pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer"), uno::makeAny( xMenuMSF->createInstanceWithContext( mxContext ) ) );
++            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 ) );
++    }
++    if( m_xUICfgManager->hasSettings( m_sBarName ) )
++    {
++        m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++    }
++    else
++    {
++        m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++    }
++    if( !m_bTemporary )
++    {
++        m_xUICfgPers->store();
++    }
++}
++
++void
++ScVbaCommandBarControl::createNewToolBarControl()
++{
++    uno::Sequence< beans::PropertyValue > aPropertys(4);
++    aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
++    aPropertys[0].Value <<= m_sCommand; 
++    aPropertys[1].Name = rtl::OUString::createFromAscii("Label");
++    aPropertys[1].Value <<= m_sName; 
++    aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
++    aPropertys[2].Value <<= m_nType; 
++    aPropertys[3].Name = rtl::OUString::createFromAscii("IsVisible");
++    aPropertys[3].Value <<= sal_True; 
++
++    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;
++
++    m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW );
++    if( m_xUICfgManager->hasSettings( m_sBarName ) )
++    {
++        m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++    }
++    else
++    {
++        m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++    }
++    if( !m_bTemporary )
++    {
++        m_xUICfgPers->store();
++    }
++}
++
++::rtl::OUString SAL_CALL
++ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException )
++{
++    // "Label" always empty
++    rtl::OUString sCaption;
++    beans::PropertyValues aPropertyValues;
++    if( m_xCurrentSettings.is() )
++    {
++        m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
++        lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
++    }
++    else if( m_xBarSettings.is() )
++    {
++        m_xBarSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
++        lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
++    }
++    return sCaption;
++}
++void SAL_CALL 
++ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
++{
++    if( m_xCurrentSettings.is() )
++    {
++        beans::PropertyValues aPropertyValues;
++        m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
++        beans::PropertyValues aNewPropertyValues;
++        aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( _caption ) );
++        m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
++        if( m_xUICfgManager->hasSettings( m_sBarName ) )
++        {
++            m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++        }
++        else
++        {
++            m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++        }
++        // make it permanent
++        if( !m_bTemporary )
++        {
++            m_xUICfgPers->store();
++        }
++    }
++}
++::rtl::OUString SAL_CALL 
++ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException)
++{
++    if( m_xCurrentSettings.is() )
++    {
++        beans::PropertyValues aPropertyValues;
++        m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
++        rtl::OUString sCommandURL;
++        lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL;
++        return sCommandURL;
++    }
++    return ::rtl::OUString();
++}
++void SAL_CALL 
++ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
++{
++    if( m_xCurrentSettings.is() )
++    {
++        beans::PropertyValues aPropertyValues;
++        m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
++        beans::PropertyValues aNewPropertyValues;
++        aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( _onaction ) );
++        m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
++        if( m_xUICfgManager->hasSettings( m_sBarName ) )
++        {
++            m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++        }
++        else
++        {
++            m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++        }
++        // make it permanent
++        if( !m_bTemporary )
++        {
++            m_xUICfgPers->store();
++        }
++    }
++}
++::sal_Bool SAL_CALL 
++ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
++{
++    // not possible in UNO?
++    return sal_True;
++}
++void SAL_CALL 
++ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
++{
++    // "IsVisilbe"
++}
++void SAL_CALL 
++ScVbaCommandBarControl::Delete(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
++{
++    if( m_xCurrentSettings.is() )
++    {
++        m_xCurrentSettings->removeByIndex( m_nPosition );
++
++        if( m_xUICfgManager->hasSettings( m_sBarName ) )
++        {
++            m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++        }
++        else
++        {
++            m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++        }
++        // make it permanent
++        if( !m_bTemporary )
++        {
++            m_xUICfgPers->store();
++        }
++    }
++}
++uno::Reference< vba::XCommandBarControls > SAL_CALL 
++ScVbaCommandBarControl::Controls(  ) throw (script::BasicErrorException, uno::RuntimeException)
++{
++    return uno::Reference< vba::XCommandBarControls >( new ScVbaCommandBarControls( this, mxContext ) );
++}
++rtl::OUString& 
++ScVbaCommandBarControl::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") );
++	return sImplName;
++}
++uno::Sequence<rtl::OUString> 
++ScVbaCommandBarControl::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.CommandBarControl" ) );
++	}
++	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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbarcontrols.hxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:56 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef SC_VBA_COMMANDBARCONTROLS_HXX
++#define SC_VBA_COMMANDBARCONTROLS_HXX
++
++#include <org/openoffice/vba/XCommandBarControls.hpp>
++
++#include "vbahelperinterface.hxx"
++#include "vbacommandbar.hxx"
++
++class ScVbaCommandBarControl;
++
++typedef InheritedHelperInterfaceImpl1< oo::vba::XCommandBarControls > CommandBarControls_BASE;
++
++class ScVbaCommandBarControls : public CommandBarControls_BASE
++{
++private:
++    sal_Bool                    m_bIsMenu;
++    sal_Bool                    m_bHasElements;
++    ScVbaCommandBar*            m_pCommandBar; 
++    ScVbaCommandBarControl*     m_pCommandBarControl; 
++    css::uno::Reference< oo::vba::XHelperInterface >               m_xParentHardRef;
++    css::uno::Reference< css::ui::XUIConfigurationManager >         m_xUICfgManager;
++    css::uno::Reference< css::ui::XUIConfigurationPersistence >     m_xUICfgPers;
++    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 );
++    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; };
++    ScVbaCommandBar* GetParentCommandBar() { return m_pCommandBar; };
++    ScVbaCommandBarControl* GetParentCommandBarControl() { return m_pCommandBarControl; };
++    rtl::OUString GetParentToolBarName() 
++    { 
++        if( m_pCommandBar ) return m_pCommandBar->GetToolBarName();
++        else return rtl::OUString();
++    }
++
++    // Attributes
++    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
++
++    // Methods     
++    virtual css::uno::Reference< oo::vba::XCommandBarControl > SAL_CALL Item( const css::uno::Any& Index ) 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();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbarcontrols.cxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:56 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#include "vbacommandbarcontrols.hxx"
++#include "vbacommandbarcontrol.hxx"
++
++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 )
++{
++    m_bIsMenu = sal_False;
++    m_bHasElements = sal_False;
++    m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
++    m_pCommandBar = dynamic_cast< ScVbaCommandBar* >( m_xParentHardRef.get() );
++    m_pCommandBarControl = dynamic_cast< ScVbaCommandBarControl* >( m_xParentHardRef.get() );
++    if( m_pCommandBar )
++    {
++        m_xUICfgManager.set( m_pCommandBar->GetUICfgManager(), uno::UNO_QUERY_THROW );
++        m_xUICfgPers.set( m_pCommandBar->GetUICfgPers(), uno::UNO_QUERY_THROW );
++        m_xBarSettings.set( m_pCommandBar->GetBarSettings(), uno::UNO_QUERY_THROW );
++        m_bIsMenu = m_pCommandBar->IsMenu();
++        if( m_xBarSettings->hasElements() )
++        {
++            m_bHasElements = sal_True;
++        }
++    }
++    else if( m_pCommandBarControl )
++    {
++    }
++    else
++    {
++        throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() );
++    }
++}
++
++// Attributes
++sal_Int32 SAL_CALL 
++ScVbaCommandBarControls::getCount() 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++;
++                }
++            }
++        } 
++    }
++    return nCount;
++}
++
++// Methods
++uno::Reference< vba::XCommandBarControl > SAL_CALL 
++ScVbaCommandBarControls::Item( const uno::Any& aIndex ) throw (uno::RuntimeException)
++{
++    rtl::OUString sName;
++    if( aIndex >>= sName )
++    {
++        return new ScVbaCommandBarControl( this, mxContext, sName );
++    }
++    sal_Int32 nIndex;
++    if( aIndex >>= nIndex )
++    {
++        // do nothing at this time
++    }
++    
++    return uno::Reference< vba::XCommandBarControl > ();
++}
++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)
++{
++    // Parameter is not supported
++    // the following name needs to be individually created;
++    rtl::OUString sCaption( rtl::OUString::createFromAscii("custom Control") );
++    rtl::OUString sCommand( rtl::OUString::createFromAscii("macro:///Standard.Module1.Test()") );
++    sal_Int32 nType =0;
++    sal_Int32 nPosition = 0;
++    sal_Int32 nId;
++    sal_Bool bTemporary = sal_True;
++    
++    if( Type.hasValue() )
++        if( Type >>= nType )
++        {
++            // evalute the type of the new control
++        }
++    if( Id.hasValue() )
++        if( Id >>= nId )
++        {
++            // evalute the action of the new control
++        }
++    if( Before.hasValue() )
++        if( Before >>= nPosition )
++        {
++            // evalute the position of the new Control
++        }
++    if( Temporary.hasValue() )
++        if( Temporary >>= bTemporary )
++        {
++            // evalute the temporary of the new Control
++        }
++    return uno::Reference< vba::XCommandBarControl > ( new ScVbaCommandBarControl( this, mxContext, sCaption, sCommand, nPosition, bTemporary ) );
++}
++   
++// XHelperInterface
++rtl::OUString& 
++ScVbaCommandBarControls::getServiceImplName()
++{
++    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") );
++    return sImplName;
++}
++uno::Sequence<rtl::OUString> 
++ScVbaCommandBarControls::getServiceNames()
++{
++    static uno::Sequence< rtl::OUString > aServiceNames;
++    if ( aServiceNames.getLength() == 0 )
++    {
++        aServiceNames.realloc( 1 );
++        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.CommandBarControls" ) );
++    }
++    return aServiceNames;
++}
++
+--- /dev/null	2007-05-04 18:54:36.000000000 +0800
++++ sc/source/ui/vba/vbacommandbar.hxx	2008-01-29 18:02:29.000000000 +0800
+@@ -0,0 +1,105 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbar.hxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:09 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef SC_VBA_COMMANDBAR_HXX
++#define SC_VBA_COMMANDBAR_HXX
++
++#include <org/openoffice/vba/XCommandBar.hpp>
++#include <com/sun/star/ui/XUIConfigurationManager.hpp>
++#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
++#include <com/sun/star/container/XIndexContainer.hpp>
++#include <com/sun/star/beans/PropertyValues.hpp>
++
++#include "vbahelperinterface.hxx"
++#include "vbacommandbars.hxx"
++
++#include <map>
++typedef std::map< const rtl::OUString, rtl::OUString > CommandBarNameMap;
++typedef std::pair< const rtl::OUString, rtl::OUString > CommandBarNamePair;
++const CommandBarNamePair namePair[] = { 
++    CommandBarNamePair(  rtl::OUString::createFromAscii("standard"), rtl::OUString::createFromAscii("standardbar") ),
++    CommandBarNamePair(  rtl::OUString::createFromAscii("formatting"), rtl::OUString::createFromAscii("formatobjectbar") ),
++};
++static const CommandBarNameMap mCommandBarNameMap( namePair, ( namePair + sizeof(namePair) / sizeof(namePair[0]) ) );
++
++
++typedef InheritedHelperInterfaceImpl1<  oo::vba::XCommandBar > CommandBar_BASE;
++
++class ScVbaCommandBar : public CommandBar_BASE
++{
++private:
++    rtl::OUString       m_sToolBarName;
++    rtl::OUString       m_sMenuModuleName;
++    rtl::OUString       m_sUIName;
++    sal_Bool            m_bTemporary;
++    sal_Bool            m_bIsMenu;
++    sal_Bool            m_bCustom;
++    sal_Bool            m_bCreate;
++    ScVbaCommandBars*   m_pScVbaCommandBars;
++    css::beans::PropertyValues  m_aToolBar;
++    // hard reference for parent
++    css::uno::Reference< oo::vba::XHelperInterface >               m_xParentHardRef;
++    css::uno::Reference< css::ui::XUIConfigurationManager >         m_xUICfgManager;
++    css::uno::Reference< css::ui::XUIConfigurationPersistence >     m_xUICfgPers;
++    css::uno::Reference< css::container::XIndexContainer >          m_xBarSettings;
++    void initCommandBar() throw( css::uno::RuntimeException );
++protected:
++    void getToolBarSettings( rtl::OUString sToolBarName ) throw( css::uno::RuntimeException );
++    void getMenuSettings();
++    void addCustomBar();
++public:
++    ScVbaCommandBar( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw( css::uno::RuntimeException );
++    ScVbaCommandBar( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw( css::uno::RuntimeException );
++    
++    sal_Bool IsMenu() { return m_bIsMenu; };
++    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; };
++    rtl::OUString GetToolBarName() { return m_sToolBarName; };
++
++    // Attributes
++    virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setName( const ::rtl::OUString& _name ) 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);
++
++    // 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);
++
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbar.cxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:09 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
++#include <com/sun/star/frame/XFrame.hpp>
++#include <com/sun/star/frame/XDesktop.hpp>
++#include <com/sun/star/frame/XLayoutManager.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++
++#include "vbacommandbar.hxx"
++#include "vbacommandbarcontrols.hxx"
++#include "vbahelper.hxx"
++
++
++using namespace com::sun::star;
++using namespace org::openoffice;
++
++ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext )
++{
++    // it's a menu bar
++    // only supporting factory menus ( no custom menus )
++    m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
++    initCommandBar();
++    switch( nModuleType )
++    {
++        case 0:
++            m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" );
++            break;
++        case 1:
++            m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" );
++            break;
++        default:
++            m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" );
++    }
++    getMenuSettings();
++    m_bIsMenu = sal_True;
++    m_bCustom = sal_False;
++}
++ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< vba::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) :  CommandBar_BASE( xParent, xContext )
++{
++    // it's a tool bar
++    m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
++    initCommandBar();
++    m_bTemporary = bTemporary;
++    m_bCreate = bCreate;
++    // get OOo ToolBarName
++    CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() );
++    if( iter != mCommandBarNameMap.end() )
++    {
++        m_sToolBarName = iter->second;
++    }
++    else
++    {
++        m_sToolBarName = sToolBarName;
++    }
++    m_sUIName = m_sToolBarName;
++    m_bIsMenu = sal_False;
++    getToolBarSettings( m_sToolBarName );
++}
++void
++ScVbaCommandBar::initCommandBar() throw (uno::RuntimeException)
++{
++    m_pScVbaCommandBars = dynamic_cast< ScVbaCommandBars* >( m_xParentHardRef.get() );
++    if ( !m_pScVbaCommandBars )
++        throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBars"), uno::Reference< uno::XInterface >() );
++    m_bIsMenu = sal_False;
++    m_bCustom = sal_False;
++    m_bTemporary = sal_True;
++    m_sToolBarName = rtl::OUString::createFromAscii("");
++    m_sUIName = rtl::OUString::createFromAscii("");
++    m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" );
++}
++void
++ScVbaCommandBar::getToolBarSettings( rtl::OUString sToolBarName ) throw( uno::RuntimeException )
++{
++    rtl::OUString sFactoryToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/") + sToolBarName.toAsciiLowerCase();
++    rtl::OUString sCustomToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/custom_toolbar_") + sToolBarName;
++    uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
++    uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW );
++    m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_pScVbaCommandBars->GetModuleName() ), uno::UNO_QUERY_THROW );
++    m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW );
++    if( m_xUICfgManager->hasSettings( sFactoryToolBar ) )
++    {
++        // exsiting standard ToolBar
++        m_xBarSettings.set( m_xUICfgManager->getSettings( sFactoryToolBar, sal_True ), uno::UNO_QUERY_THROW );
++        m_sToolBarName = sFactoryToolBar;
++    }
++    else if( m_xUICfgManager->hasSettings( sCustomToolBar ) )
++    {
++        // exisiting custom ToolBar
++        m_xBarSettings.set( m_xUICfgManager->getSettings( sCustomToolBar, sal_True ), uno::UNO_QUERY_THROW );
++        m_sToolBarName = sCustomToolBar;
++        m_bCustom = sal_True;
++    }
++    else if( m_bCreate )
++    {
++        // new custom ToolBar
++        m_xBarSettings.set( m_xUICfgManager->createSettings(), uno::UNO_QUERY_THROW );
++        m_sToolBarName = sCustomToolBar;
++        m_bCustom = sal_True;
++        addCustomBar();
++    }
++    else
++        throw uno::RuntimeException( rtl::OUString::createFromAscii("ToolBar do not exist"), uno::Reference< uno::XInterface >() );
++    if( m_pScVbaCommandBars->GetWindows()->hasByName( m_sToolBarName ) )
++    {
++        uno::Any aToolBar = m_pScVbaCommandBars->GetWindows()->getByName( m_sToolBarName );
++        aToolBar >>= m_aToolBar; 
++    }
++}
++void
++ScVbaCommandBar::addCustomBar()
++{
++    uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
++    xPropertySet->setPropertyValue(rtl::OUString::createFromAscii("UIName"), uno::makeAny( m_sUIName ));
++
++    if( m_xUICfgManager->hasSettings(m_sToolBarName) )
++    {
++        m_xUICfgManager->replaceSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++    }
++    else
++    {
++        m_xUICfgManager->insertSettings( m_sToolBarName,  uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
++    }
++    if( !m_bTemporary )
++    {
++        m_xUICfgPers->store();
++    }
++}
++void 
++ScVbaCommandBar::getMenuSettings()
++{
++    try
++    {
++        rtl::OUString sMenuBar = rtl::OUString::createFromAscii( "private:resource/menubar/menubar" );
++        uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
++        uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW );
++        m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_sMenuModuleName ), uno::UNO_QUERY_THROW );
++        m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW );
++        m_xBarSettings.set( m_xUICfgManager->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
++    } 
++    catch ( uno::Exception e)
++    {
++        OSL_TRACE( "getMenuSetting got a error\n" );
++    }
++}
++::rtl::OUString SAL_CALL
++ScVbaCommandBar::getName() throw ( uno::RuntimeException )
++{
++    // This will get a "NULL length string" when Name is not set. 
++    uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
++    uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") );
++    rtl::OUString sName;
++    aName >>= sName;
++    if( sName.getLength() < 1 && !m_bIsMenu )
++    {
++        uno::Reference< container::XNameAccess > xNameAccess( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
++        if( xNameAccess->hasByName( m_sToolBarName ) )
++        {
++            beans::PropertyValues aToolBar; 
++            xNameAccess->getByName( m_sToolBarName ) >>= aToolBar;
++            sal_Int32 nCount = aToolBar.getLength();
++            beans::PropertyValue aPropertyValue;
++            for( sal_Int32 i = 0; i < nCount; i++ )
++            {
++                aPropertyValue = aToolBar[i];
++                if( aPropertyValue.Name.equals( rtl::OUString::createFromAscii("UIName") ) )
++                {
++                    aPropertyValue.Value >>= sName;
++                    return sName;
++                }
++            }
++        }
++    }
++    return sName;
++}
++void SAL_CALL 
++ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException)
++{
++    uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
++    xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) );
++    uno::Reference< container::XIndexAccess > xIndexAccess( m_xBarSettings, uno::UNO_QUERY_THROW );
++    
++    if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
++    {
++        m_xUICfgManager->replaceSettings( m_sToolBarName, xIndexAccess );
++    }
++    else
++    {
++        // toolbar not found
++    }
++    if( !m_bTemporary )
++    {
++        m_xUICfgPers->store();
++    }
++}
++::sal_Bool SAL_CALL 
++ScVbaCommandBar::getVisible() throw (uno::RuntimeException)
++{
++    sal_Bool bVisible = sal_False;
++    try
++    {
++        sal_Int32 i = 0;
++        while( !m_aToolBar[i].Name.equals( rtl::OUString::createFromAscii( "Visible" ) ) )
++        {
++            i++;
++        }
++        m_aToolBar[i].Value >>= bVisible;
++    }
++    catch ( uno::Exception e )
++    {
++    }
++    return bVisible;
++}
++void SAL_CALL 
++ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference< frame::XFrame > xFrame( getCurrentDocument()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); 
++        uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW );
++        uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW );
++        if( _visible )
++        {
++            xLayoutManager->createElement( m_sToolBarName );
++            xLayoutManager->showElement( m_sToolBarName );
++        }
++        else
++        {
++            xLayoutManager->hideElement( m_sToolBarName );
++            xLayoutManager->destroyElement( m_sToolBarName );
++        }
++    }
++    catch( uno::Exception e )
++    {
++        OSL_TRACE( "SetVisible get an exception\n" );
++    }
++}
++void SAL_CALL 
++ScVbaCommandBar::Delete(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
++{
++    if( m_bCustom )
++    {
++        if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
++        {
++            m_xUICfgManager->removeSettings(m_sToolBarName);
++            // make it permanent
++            if( !m_bTemporary )
++            {
++                m_xUICfgPers->store();
++            }
++        }
++        else
++        {
++            // toolbar not found
++            // TODO throw Error
++        }
++        uno::Reference< container::XNameContainer > xNameContainer( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
++        if( xNameContainer->hasByName( m_sToolBarName ) )
++        {
++            xNameContainer->removeByName( m_sToolBarName );
++        }
++    }
++}
++uno::Reference< vba::XCommandBarControls > SAL_CALL 
++ScVbaCommandBar::Controls(  ) throw (script::BasicErrorException, uno::RuntimeException)
++{
++    return uno::Reference< vba::XCommandBarControls >( new ScVbaCommandBarControls( this, mxContext ) );
++}
++rtl::OUString& 
++ScVbaCommandBar::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") );
++	return sImplName;
++}
++uno::Sequence<rtl::OUString> 
++ScVbaCommandBar::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.CommandBar" ) );
++	}
++	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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbars.hxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:56 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef SC_VBA_COMMANDBARS_HXX
++#define SC_VBA_COMMANDBARS_HXX
++
++#include <org/openoffice/vba/XCommandBars.hpp>
++#include <com/sun/star/container/XNameAccess.hpp>
++
++#include <cppuhelper/implbase1.hxx>
++
++#include "vbahelperinterface.hxx"
++
++typedef InheritedHelperInterfaceImpl1< oo::vba::XCommandBars > CommandBars_BASE;
++
++class ScVbaCommandBars : public CommandBars_BASE
++{
++private:
++    css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
++    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 );
++
++    sal_Bool checkToolBarExist( rtl::OUString sToolBarName );
++    rtl::OUString GetModuleName(){ return m_sModuleName; };
++    css::uno::Reference< css::container::XNameAccess > GetWindows() 
++    { 
++        retrieveObjects();
++        return m_xNameAccess; 
++    };
++    // 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);
++    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);
++    // XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#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 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: vbacommandbars.cxx,v $
++ *
++ *  $Revision: 1.2 $
++ *
++ *  last change: $Author: vg $ $Date: 2007/12/07 11:02:56 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#include <com/sun/star/lang/XServiceInfo.hpp>
++#include <com/sun/star/frame/XDesktop.hpp>
++#include <com/sun/star/container/XNameAccess.hpp>
++
++#include "vbacommandbars.hxx"
++#include "vbacommandbar.hxx"
++
++using namespace com::sun::star;
++using namespace org::openoffice;
++
++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 )
++{
++    retrieveObjects();
++}
++void
++ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException )
++{
++    uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW );
++    if( xServiceInfo->supportsService( sSpreadsheetDocumentUrl ) )
++    {
++        m_sModuleName = sSpreadsheetDocumentUrl;
++    }
++    else if( xServiceInfo->supportsService( sTextDocumentUrl ) )
++    {
++        m_sModuleName = sTextDocumentUrl;
++    }
++    else
++        throw uno::RuntimeException( rtl::OUString::createFromAscii( "Unsupported Document" ), uno::Reference< uno::XInterface >() );
++    
++    uno::Reference < lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
++    uno::Reference < container::XNameAccess > xNameAccess( xMSF->createInstance( sWindowStateConfUrl ), uno::UNO_QUERY_THROW );
++    m_xNameAccess.set( xNameAccess->getByName( m_sModuleName ), uno::UNO_QUERY_THROW );
++}
++
++// 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)
++{
++    // Position - MsoBar MenuBar - sal_Bool
++    // Currently only the Name is supported.
++    rtl::OUString sName;
++    if( !( Name >>= sName ) )
++    {
++        sName = rtl::OUString::createFromAscii("Custom1");
++    }
++    sal_Bool bTemporary;
++    if( !( Temporary >>= bTemporary ) )
++    {
++        bTemporary = sal_True;
++    }
++    return uno::Reference< vba::XCommandBar >( new ScVbaCommandBar( this, mxContext, sName.toAsciiLowerCase(), bTemporary, sal_True ) );
++}
++sal_Int32 SAL_CALL 
++ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
++{
++    // Filter out all toolbars from the window collection
++    sal_Int32 nCount = 0;
++    uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
++    for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
++    {
++        if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
++        {
++            nCount++;
++        }
++    }
++    return nCount;
++}
++
++// ScVbaCollectionBaseImpl
++uno::Reference< vba::XCommandBar > SAL_CALL
++ScVbaCommandBars::Item( const uno::Any& aSource ) throw( uno::RuntimeException )
++{
++    rtl::OUString sToolBarName;
++    if( aSource >>= sToolBarName )
++    {
++        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 uno::Reference< vba::XCommandBar >();
++}
++
++sal_Bool
++ScVbaCommandBars::checkToolBarExist( rtl::OUString sToolBarName )
++{
++    CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() );
++    if( iter != mCommandBarNameMap.end() )
++    {
++        return sal_True;
++    }    
++    uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
++    for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
++    {
++        if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
++        {
++            if( allNames[i].indexOf( sToolBarName ) != -1 )
++            {
++                return sal_True;
++            }
++        }
++    }
++    return sal_False;
++}
++    
++// XHelperInterface
++rtl::OUString& 
++ScVbaCommandBars::getServiceImplName()
++{
++    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBars") );
++    return sImplName;
++}
++uno::Sequence<rtl::OUString> 
++ScVbaCommandBars::getServiceNames()
++{
++    static uno::Sequence< rtl::OUString > aServiceNames;
++    if ( aServiceNames.getLength() == 0 )
++    {
++        aServiceNames.realloc( 1 );
++        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.CommandBars" ) );
++    }
++    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
+@@ -81,6 +81,7 @@ public:
+ 	virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException );
+ 
+     virtual css::uno::Reference< oo::vba::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException);
++    virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ 	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"
+ #include "vbashape.hxx"
+ #include "vbaassistant.hxx"
++#include "vbacommandbars.hxx"
+ #include "sc.hrc"
+ 
+ #include <osl/file.hxx>
+@@ -131,12 +132,21 @@ ScVbaApplication::getThisWorkbook() thro
+ }
+ 
+ uno::Reference< vba::XAssistant > SAL_CALL
+-ScVbaApplication::getAssistant() throw (css::uno::RuntimeException)
++ScVbaApplication::getAssistant() throw (uno::RuntimeException)
+ {
+     return uno::Reference< vba::XAssistant >( new ScVbaAssistant( this, mxContext ) );
+ }
+ 
+ uno::Any SAL_CALL
++ScVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
++{
++    uno::Reference< vba::XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext ) );
++    if( aIndex.hasValue() )
++        return uno::makeAny( xCommandBars->Item( aIndex ) );
++    return uno::makeAny( xCommandBars );
++}
++
++uno::Any SAL_CALL
+ ScVbaApplication::getSelection() throw (uno::RuntimeException)
+ {
+     uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument()->getCurrentSelection(), uno::UNO_QUERY_THROW );

Added: branches/sled-10-ooo-build-2-3/patches/vba/vba-displayworkbooktabs.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/vba/vba-displayworkbooktabs.diff	Thu Feb  7 16:56:14 2008
@@ -0,0 +1,157 @@
+diff -rup oovbaapi/org/openoffice/excel/XWindow.idl oovbaapi.patched/org/openoffice/excel/XWindow.idl
+--- oovbaapi/org/openoffice/excel/XWindow.idl	2008-02-07 15:44:37.000000000 +0000
++++ oovbaapi/org/openoffice/excel/XWindow.idl	2008-02-07 15:46:27.000000000 +0000
+@@ -54,12 +54,15 @@ interface XWindow
+ 	interface ::org::openoffice::vba::XHelperInterface;
+ 
+ 	[attribute] boolean DisplayGridlines; 
++	[attribute] boolean DisplayHeadings;
+ 	[attribute] boolean DisplayVerticalScrollBar; 
+ 	[attribute] boolean DisplayHorizontalScrollBar; 
++	[attribute] boolean DisplayWorkbookTabs;
+ 	[attribute] any Caption;
+ 	[attribute] any ScrollRow;
+ 	[attribute] any ScrollColumn;
+ 	[attribute] any WindowState;
++	[attribute] any Zoom;
+ 	any SelectedSheets( [in] any aIndex );
+ 	void SmallScroll( [in] any Down, [in] any Up, [in] any ToRight, [in] any ToLeft );
+ 	void LargeScroll( [in] any Down, [in] any Up, [in] any ToRight, [in] any ToLeft );
+diff -rup sc/source/ui/vba/vbawindow.cxx sc.patched/source/ui/vba/vbawindow.cxx
+--- sc/source/ui/vba/vbawindow.cxx	2008-02-07 15:44:37.000000000 +0000
++++ sc/source/ui/vba/vbawindow.cxx	2008-02-07 15:47:37.000000000 +0000
+@@ -39,6 +39,7 @@
+ #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+ #include <com/sun/star/sheet/XSpreadsheet.hpp>
+ #include <com/sun/star/container/XNamed.hpp>
++#include <com/sun/star/view/DocumentZoomType.hpp>
+ #include <org/openoffice/excel/XlWindowState.hpp>
+ #include <org/openoffice/excel/Constants.hpp>
+ 
+@@ -49,6 +50,7 @@
+ #include <hash_map>
+ #include <sfx2/viewfrm.hxx>
+ #include <sfx2/topfrm.hxx>
++#include "unonames.hxx"
+ 
+ using namespace ::com::sun::star;
+ using namespace ::org::openoffice;
+@@ -478,6 +480,24 @@ ScVbaWindow::setDisplayGridlines( ::sal_
+ }
+ 
+ ::sal_Bool SAL_CALL 
++ScVbaWindow::getDisplayHeadings() throw (uno::RuntimeException)
++{
++	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++	rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_COLROWHDR ) );
++	sal_Bool bHeading = sal_True;
++	xProps->getPropertyValue( sName ) >>= bHeading;
++	return bHeading;	
++}
++
++void SAL_CALL 
++ScVbaWindow::setDisplayHeadings( ::sal_Bool _bDisplayHeadings ) throw (uno::RuntimeException)
++{
++	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++	rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_COLROWHDR ) );
++	xProps->setPropertyValue( sName, uno::makeAny( _bDisplayHeadings ));
++}
++
++::sal_Bool SAL_CALL 
+ ScVbaWindow::getDisplayVerticalScrollBar() throw (css::uno::RuntimeException)
+ {
+ 	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
+@@ -496,6 +516,68 @@ ScVbaWindow::setDisplayVerticalScrollBar
+ }
+ 
+ ::sal_Bool SAL_CALL 
++ScVbaWindow::getDisplayWorkbookTabs() throw (uno::RuntimeException)
++{
++	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++	rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SHEETTABS ) );
++	sal_Bool bWorkbookTabs = sal_True;
++	xProps->getPropertyValue( sName ) >>= bWorkbookTabs;
++	return bWorkbookTabs;	
++}
++
++void SAL_CALL 
++ScVbaWindow::setDisplayWorkbookTabs( ::sal_Bool _bDisplayWorkbookTabs ) throw (uno::RuntimeException)
++{
++	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++	rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SHEETTABS ) );
++	xProps->setPropertyValue( sName, uno::makeAny( _bDisplayWorkbookTabs ));
++}
++
++uno::Any SAL_CALL 
++ScVbaWindow::getZoom() throw (uno::RuntimeException)
++{	
++	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++	rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMTYPE ) );
++	sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH;
++	xProps->getPropertyValue( sName ) >>= nZoomType;
++	if( nZoomType == view::DocumentZoomType::PAGE_WIDTH )
++	{
++		return uno::makeAny( sal_True );
++	}
++	else if( nZoomType == view::DocumentZoomType::BY_VALUE )
++	{
++		sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ZOOMVALUE));
++		sal_Int16 nZoom = 100;
++		xProps->getPropertyValue( sName ) >>= nZoom;
++		return uno::makeAny( nZoom );
++	}
++    return uno::Any();
++}
++
++void SAL_CALL 
++ScVbaWindow::setZoom( const uno::Any& _zoom ) throw (uno::RuntimeException)
++{
++	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++	rtl::OUString sZoomType( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMTYPE ) );
++	sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH;
++	if( _zoom.getValueTypeClass() == uno::TypeClass_BOOLEAN )
++	{		
++		//zoom type is PAGE_WIDTH_EXACT in helperapi, it seems that there is a issue for this zoom type in current OOo.
++		// so PAGE_WIDTH is used.   	
++		xProps->setPropertyValue(sZoomType, uno::makeAny( nZoomType ));
++	}					
++	else
++	{
++		nZoomType = view::DocumentZoomType::BY_VALUE;
++		rtl::OUString sZoomValue( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMVALUE ));
++		sal_Int16 nZoomValue = 100;
++		_zoom >>= nZoomValue;
++		xProps->setPropertyValue( sZoomType, uno::makeAny( nZoomType ));
++		xProps->setPropertyValue( sZoomValue, uno::makeAny( nZoomValue ));
++	}			
++}
++
++::sal_Bool SAL_CALL 
+ ScVbaWindow::getDisplayHorizontalScrollBar() throw (css::uno::RuntimeException)
+ {
+ 	uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
+diff -rup sc/source/ui/vba/vbawindow.hxx sc.patched/source/ui/vba/vbawindow.hxx
+--- sc/source/ui/vba/vbawindow.hxx	2008-02-07 15:44:37.000000000 +0000
++++ sc/source/ui/vba/vbawindow.hxx	2008-02-07 15:47:08.000000000 +0000
+@@ -58,8 +58,12 @@ public:
+ 	// XWindow
+ 	virtual ::sal_Bool SAL_CALL getDisplayGridlines() throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL setDisplayGridlines( ::sal_Bool _displaygridlines ) throw (css::uno::RuntimeException);
++	virtual ::sal_Bool SAL_CALL getDisplayHeadings() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setDisplayHeadings( ::sal_Bool _bDisplayHeadings ) throw (css::uno::RuntimeException);
+ 	virtual ::sal_Bool SAL_CALL getDisplayVerticalScrollBar() throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL setDisplayVerticalScrollBar( ::sal_Bool _displayverticalscrollbar ) throw (css::uno::RuntimeException);
++	virtual ::sal_Bool SAL_CALL getDisplayWorkbookTabs() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setDisplayWorkbookTabs( ::sal_Bool _bDisplayWorkbookTabs ) throw (css::uno::RuntimeException);
+ 	virtual ::sal_Bool SAL_CALL getDisplayHorizontalScrollBar() throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL setDisplayHorizontalScrollBar( ::sal_Bool _displayhorizontalscrollbar ) throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL setCaption( const css::uno::Any& _caption ) throw (css::uno::RuntimeException);
+@@ -70,6 +74,8 @@ public:
+     virtual void SAL_CALL setScrollColumn( const css::uno::Any& _scrollcolumn ) throw (css::uno::RuntimeException) ;
+     virtual css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
+     virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
++    virtual css::uno::Any SAL_CALL getZoom() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setZoom( const css::uno::Any& _zoom ) throw (css::uno::RuntimeException);
+ 
+ 	// Methods
+ 	virtual void SAL_CALL SmallScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException);



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