ooo-build r14857 - trunk/patches/vba



Author: noelpwer
Date: Mon Dec 15 18:16:13 2008
New Revision: 14857
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14857&view=rev

Log:
latest version


Modified:
   trunk/patches/vba/vba-word-support.diff

Modified: trunk/patches/vba/vba-word-support.diff
==============================================================================
--- trunk/patches/vba/vba-word-support.diff	(original)
+++ trunk/patches/vba/vba-word-support.diff	Mon Dec 15 18:16:13 2008
@@ -21,6 +21,28 @@
  };
  
  #ifndef __SB_SBSTARBASICREF_HXX
+diff --git basic/prj/d.lst basic/prj/d.lst
+index d920102..fc5f94c 100644
+--- basic/prj/d.lst
++++ basic/prj/d.lst
+@@ -7,6 +7,8 @@ mkdir: %COMMON_DEST%\res%_EXT%
+ ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+ ..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+ ..\%__SRC%\slb\sb.lib %_DEST%\lib%_EXT%\xsb.lib
++..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
++
+ ..\%__SRC%\srs\classes.srs %_DEST%\res%_EXT%\basic.srs
+ ..\%COMMON_OUTDIR%\srs\classes_srs.hid %COMMON_DEST%\res%_EXT%\basic_srs.hid
+ ..\%__SRC%\bin\sb?????.dll %_DEST%\bin%_EXT%\sb?????.dll
+@@ -57,4 +59,8 @@ mkdir: %_DEST%\inc%_EXT%\basic
+ ..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx
+ 
+ ..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx
++..\inc\basic\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\basic\vbacollectionimpl.hxx
++..\inc\basic\vbahelper.hxx %_DEST%\inc%_EXT%\basic\vbahelper.hxx
++..\inc\basic\helperdecl.hxx %_DEST%\inc%_EXT%\basic\helperdecl.hxx
++..\inc\basic\vbahelperinterface.hxx %_DEST%\inc%_EXT%\basic\vbahelperinterface.hxx
+ ..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx
 diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
 index 349c2cc..b149e96 100644
 --- basic/source/classes/sb.cxx
@@ -198,12 +220,12 @@
  					rtl::OUString sCodeName;	
  					sCodeName = xNameQuery->getCodeNameForObject( xIf );
  					Reference< XPropertySet > xProps( xIf, UNO_QUERY );
-diff --git oovbaapi/inc/oovbaapi/helperdecl.hxx oovbaapi/inc/oovbaapi/helperdecl.hxx
+diff --git oovbaapi/ooo/vba/ControlProvider.idl oovbaapi/ooo/vba/ControlProvider.idl
 new file mode 100644
-index 0000000..7a0b495
+index 0000000..4db6ce8
 --- /dev/null
-+++ oovbaapi/inc/oovbaapi/helperdecl.hxx
-@@ -0,0 +1,58 @@
++++ oovbaapi/ooo/vba/ControlProvider.idl
+@@ -0,0 +1,54 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -212,8 +234,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: helperdecl.hxx,v $
-+ * $Revision: 1.3 $
++ * $RCSfile: XGlobals.idl,v $
++ * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -233,41 +255,37 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef OOVBAAPI_SERV_DECL
-+#define OOVBAAPI_SERV_DECL
-+#include <comphelper/servicedecl.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
++#ifndef __ooo_vba_ControlProvider_idl__
++#define __ooo_vba_ControlProvider_idl__
 +
-+namespace comphelper {
-+namespace service_decl {
-+template <typename ImplT_, typename WithArgsT = with_args<false> >
-+struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT >
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __com_sun_star_frame_XModel_idl__
++#include <com/sun/star/frame/XModel.idl>
++#endif
++
++
++module ooo {  module vba { 
++
++interface XControlProvider;
++
++service ControlProvider 
 +{
-+    typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT;
-+    /** Default ctor.  Implementation class without args, expecting
-+        component context as single argument.
-+    */
-+    vba_service_class_() : baseT() {}
-+    template <typename PostProcessFuncT>
-+    /** Ctor to pass a post processing function/functor.
-+        
-+        @tpl PostProcessDefaultT let your compiler deduce this
-+        @param postProcessFunc function/functor that gets the yet unacquired
-+                               ImplT_ pointer returning a
-+                               uno::Reference<uno::XInterface>
-+    */
-+    explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
++    interface ::ooo::vba::XControlProvider;
 +};
 +
-+} // namespace service_decl
-+} // namespace comphelper
++}; };
++
 +#endif
-diff --git oovbaapi/inc/oovbaapi/oovbadllapi.h oovbaapi/inc/oovbaapi/oovbadllapi.h
++
+diff --git oovbaapi/ooo/vba/XControlProvider.idl oovbaapi/ooo/vba/XControlProvider.idl
 new file mode 100644
-index 0000000..f7d31ec
+index 0000000..cd0c68d
 --- /dev/null
-+++ oovbaapi/inc/oovbaapi/oovbadllapi.h
-@@ -0,0 +1,44 @@
++++ oovbaapi/ooo/vba/XControlProvider.idl
+@@ -0,0 +1,64 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -276,7 +294,7 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: svtdllapi.h,v $
++ * $RCSfile: XGlobals.idl,v $
 + * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
@@ -297,27 +315,60 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
++#ifndef __ooo_vba_XControlProvider_idl__
++#define __ooo_vba_XControlProvider_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
 +
-+#ifndef INCLUDED_OOVBADLLAPI_H
-+#define INCLUDED_OOVBADLLAPI_H
++#ifndef __com_sun_star_frame_XModel_idl__
++#include <com/sun/star/frame/XModel.idl>
++#endif
 +
-+#include "sal/types.h"
++#ifndef __com_sun_star_awt_XControl_idl__
++#include <com/sun/star/awt/XControl.idl>
++#endif
 +
-+#if defined(OOVBA_DLLIMPLEMENTATION)
-+#define OOVBA_DLLPUBLIC  SAL_DLLPUBLIC_EXPORT
-+#else
-+#define OOVBA_DLLPUBLIC  SAL_DLLPUBLIC_IMPORT
++#ifndef __com_sun_star_drawing_XControlShape_idl__
++#include <com/sun/star/drawing/XControlShape.idl>
++#endif
++#ifndef __ooo_vba_msforms_XControl_idl__
++#include <ooo/vba/msforms/XControl.idl>
 +#endif
-+#define OOVBA_DLLPRIVATE SAL_DLLPRIVATE
 +
-+#endif /* INCLUDED_OOVBADLLAPI_H */
++module ooo {  module vba { 
++
++interface XControlProvider 
++{
++   ::ooo::vba::msforms::XControl createControl( [in] ::com::sun::star::drawing::XControlShape xControl, [in] ::com::sun::star::frame::XModel xDocOwner );
++   ::ooo::vba::msforms::XControl createUserformControl( [in] ::com::sun::star::awt::XControl xControl, [in] ::com::sun::star::awt::XControl xDialog, [in] ::com::sun::star::frame::XModel xDocOwner );
++
++};
++
++}; };
++
++#endif
 +
-diff --git oovbaapi/inc/oovbaapi/vbacollectionimpl.hxx oovbaapi/inc/oovbaapi/vbacollectionimpl.hxx
+diff --git oovbaapi/ooo/vba/makefile.mk oovbaapi/ooo/vba/makefile.mk
+index 11188d5..1a500d8 100644
+--- oovbaapi/ooo/vba/makefile.mk
++++ oovbaapi/ooo/vba/makefile.mk
+@@ -55,6 +55,8 @@ IDLFILES=\
+ 	XCommandBarPopup.idl\
+ 	XCommandBarButton.idl\
+ 	Globals.idl\
++	XControlProvider.idl\
++	ControlProvider.idl\
+ 
+ # ------------------------------------------------------------------
+ 
+diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
 new file mode 100644
-index 0000000..9fdf717
+index 0000000..292399b
 --- /dev/null
-+++ oovbaapi/inc/oovbaapi/vbacollectionimpl.hxx
-@@ -0,0 +1,257 @@
++++ oovbaapi/ooo/vba/word/XApplication.idl
+@@ -0,0 +1,57 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -326,8 +377,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbacollectionimpl.hxx,v $
-+ * $Revision: 1.5 $
++ * $RCSfile: XApplication.idl,v $
++ * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -347,584 +398,476 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
-+#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
-+
-+#include <ooo/vba/XCollection.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
++#ifndef __ooo_vba_word_XApplication_idl__
++#define __ooo_vba_word_XApplication_idl__
 +
-+#include <cppuhelper/implbase3.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase1.hxx>
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
 +
-+#include "oovbaapi/vbahelper.hxx"
-+#include "oovbaapi/vbahelperinterface.hxx"
++#ifndef __ooo_vba_XHelperInterface_idl__
++#include <ooo/vba/XHelperInterface.idl>
++#endif
 +
-+#include <vector>
 +
-+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
++module ooo {  module vba {  module word { 
 +
-+class EnumerationHelperImpl : public EnumerationHelper_BASE
++interface XApplication
 +{
-+protected:
-+	css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+	css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
-+public:
 +
-+	EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ),  m_xEnumeration( xEnumeration ) { }
-+	virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
++	interface ::ooo::vba::XHelperInterface;
++
++	[attribute, readonly] string Name;
++	void DoEvents();
 +};
 +
-+// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces 
-+// only requirement is the object needs to implement XName
++}; }; };
 +
++#endif
 +
 +
-+typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
+diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
+new file mode 100644
+index 0000000..3c144a6
+--- /dev/null
++++ oovbaapi/ooo/vba/word/XGlobals.idl
+@@ -0,0 +1,54 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: XGlobals.idl,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef __ooo_vba_word_XGlobals_idl__
++#define __ooo_vba_word_XGlobals_idl__
 +
-+template< typename Ifc1 >
-+class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
-+{
-+public:
-+typedef std::vector< css::uno::Reference< Ifc1 > >  XNamedVec;
-+private:
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++#ifndef __ooo_vba_word_XApplication_idl__
++#include <ooo/vba/word/XApplication.idl>
++#endif
 +
-+	class XNamedEnumerationHelper : public EnumerationHelper_BASE
-+	{
-+		XNamedVec mXNamedVec;
-+		typename XNamedVec::iterator mIt;
-+	public:
-+	        XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {}
-+	
-+	        virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (css::uno::RuntimeException)
-+	        {
-+			return ( mIt != mXNamedVec.end() );
-+	        }
-+	
-+	        virtual css::uno::Any SAL_CALL nextElement(  ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
-+	        {
-+	                if ( hasMoreElements() )
-+				return css::uno::makeAny( *mIt++ );
-+	                throw css::container::NoSuchElementException();
-+	        }
-+	};
++module ooo {  module vba {  module word { 
 +
-+protected:
-+	XNamedVec mXNamedVec;
-+	typename XNamedVec::iterator cachePos;
-+public:
-+	XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {}
-+	// XElementAccess
-+	virtual css::uno::Type SAL_CALL getElementType(  ) throw (css::uno::RuntimeException) { return  Ifc1::static_type(0); }
-+	virtual ::sal_Bool SAL_CALL hasElements(  ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); }
-+	// XNameAcess 
-+	virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
-+	{
-+		if ( !hasByName(aName) )
-+			throw css::container::NoSuchElementException();
-+		return css::uno::makeAny( *cachePos );
-+	}
-+	virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (css::uno::RuntimeException)
-+	{
-+		css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() );
-+		rtl::OUString* pString = sNames.getArray();
-+		typename XNamedVec::iterator it = mXNamedVec.begin();
-+		typename XNamedVec::iterator it_end = mXNamedVec.end();
++interface XGlobals: com::sun::star::uno::XInterface
++{
++        // FIXME, need better way to expose globals
++	sequence< any > getGlobals();
 +
-+		for ( ; it != it_end; ++it, ++pString )
-+		{
-+			css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW );	
-+			*pString = xName->getName();
-+		}
-+		return sNames;
-+	}
-+	virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
-+	{
-+		cachePos = mXNamedVec.begin();
-+		typename XNamedVec::iterator it_end = mXNamedVec.end();
-+		for ( ; cachePos != it_end; ++cachePos )
-+		{
-+			css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW );	
-+			if ( aName.equals( xName->getName() ) )
-+				break;
-+		}
-+		return ( cachePos != it_end );
-+	}
++	[attribute, readonly] ooo::vba::word::XApplication Application;
++};
 +
-+	// XElementAccess
-+	virtual ::sal_Int32 SAL_CALL getCount(  ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); }	
-+	virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException )
-+	{
-+		if ( Index < 0 || Index >= getCount() )
-+			throw css::lang::IndexOutOfBoundsException();
-+	
-+		return css::uno::makeAny( mXNamedVec[ Index ] );
++}; }; };
 +
-+	}
-+	// XEnumerationAccess
-+	virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration(  ) throw (css::uno::RuntimeException)
-+	{
-+		return new XNamedEnumerationHelper( mXNamedVec );
-+	}
-+};
++#endif
 +
-+// including a HelperInterface implementation
-+template< typename Ifc1 >
-+class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
-+{
-+typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
-+protected:
-+	css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
-+	css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
 +
-+	virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
-+	{
-+		if ( !m_xNameAccess.is() )
-+			throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
-+	
-+		return createCollectionObject( m_xNameAccess->getByName( sIndex ) );	
-+	}		
-+
-+	virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException)
-+	{
-+		if ( !m_xIndexAccess.is() )
-+			throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
-+		if ( nIndex <= 0 )
-+		{
-+			throw  css::lang::IndexOutOfBoundsException( 
-+				::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
-+				"index is 0 or negative" ) ), 
-+				css::uno::Reference< css::uno::XInterface >() );
-+		}
-+		// need to adjust for vba index ( for which first element is 1 )
-+		return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );		
-+	}
-+public:
-+	ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent,   const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
-+	//XCollection
-+	virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
-+	{
-+		return m_xIndexAccess->getCount();
-+	}
-+
-+	virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException)
-+	{
-+		if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING )
-+		{
-+			sal_Int32 nIndex = 0;
-+	
-+			if ( ( Index1 >>= nIndex ) != sal_True )
-+			{
-+				rtl::OUString message;
-+				message = rtl::OUString::createFromAscii(
-+					"Couldn't convert index to Int32");
-+				throw  css::lang::IndexOutOfBoundsException( message,
-+					css::uno::Reference< css::uno::XInterface >() );
-+			}
-+			return 	getItemByIntIndex( nIndex );
-+		}
-+		rtl::OUString aStringSheet;
-+
-+		Index1 >>= aStringSheet;
-+		return getItemByStringIndex( aStringSheet );	
-+	}
-+	// XDefaultMethod
-+	::rtl::OUString SAL_CALL getDefaultMethodName(  ) throw (css::uno::RuntimeException)
-+	{
-+		const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
-+		return sName;
-+	}
-+	// XEnumerationAccess
-+	virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;	
-+
-+	// XElementAccess
-+	virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
-+	// XElementAccess
-+	virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
-+	{
-+		return ( m_xIndexAccess->getCount() > 0 );
-+	}
-+	virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
-+	
-+};
-+
-+typedef ::cppu::WeakImplHelper1<ov::XCollection> XCollection_InterfacesBASE;
-+
-+typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1;
-+// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this )
-+class ScVbaCollectionBaseImpl : public CollImplBase1
-+{
-+public:
-+	ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){}
-+
-+};
-+
-+template <typename Ifc> // where Ifc must implement XCollectionTest
-+class CollTestImplHelper :  public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
-+{
-+typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc >  > ImplBase1;
-+
-+public:
-+	CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,  const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
-+};
-+
-+
-+#endif //SC_VBA_COLLECTION_IMPL_HXX
-diff --git oovbaapi/inc/oovbaapi/vbahelper.hxx oovbaapi/inc/oovbaapi/vbahelper.hxx
+diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
 new file mode 100644
-index 0000000..f533b09
+index 0000000..27f6b68
 --- /dev/null
-+++ oovbaapi/inc/oovbaapi/vbahelper.hxx
-@@ -0,0 +1,338 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbahelper.hxx,v $
-+ * $Revision: 1.5.32.1 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef OOVBAAPI_VBA_HELPER_HXX
-+#define OOVBAAPI_VBA_HELPER_HXX
++++ oovbaapi/ooo/vba/word/makefile.mk
+@@ -0,0 +1,50 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.4 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++PRJ=..$/..$/..
 +
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/beans/XIntrospectionAccess.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/script/BasicErrorException.hpp>
-+#include <com/sun/star/script/XTypeConverter.hpp>
-+#include <com/sun/star/lang/IllegalArgumentException.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XDevice.hpp>
-+#include <basic/sberrors.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <sfx2/dispatch.hxx>
-+#include <ooo/vba/msforms/XShape.hpp>
-+#ifndef OOVBA_DLLIMPLEMENTATION
-+#define OOVBA_DLLIMPLEMENTATION
-+#endif
-+#include <oovbaapi/oovbadllapi.h>
++PRJNAME=oovapi
 +
-+namespace css = ::com::sun::star;
++TARGET=word
++PACKAGE=ooo$/vba$/Word
 +
-+namespace ooo 
-+{
-+	namespace vba 
-+	{
-+		template < class T > 
-+		css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException)
-+		{
-+			if ( args.getLength() < ( nPos + 1) )
-+				throw css::lang::IllegalArgumentException();
-+			css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY );
-+			if ( !bCanBeNull && !aSomething.is() )
-+				throw css::lang::IllegalArgumentException();
-+			return aSomething;
-+		}
-+		OOVBA_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
-+		OOVBA_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
++# --- Settings -----------------------------------------------------
++.INCLUDE :  $(PRJ)$/util$/makefile.pmk
 +
-+		OOVBA_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
-+		OOVBA_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
-+		OOVBA_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
-+		OOVBA_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
-+		OOVBA_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
-+		OOVBA_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& );
-+		OOVBA_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& );
-+		// provide a NULL object that can be passed as variant so that 
-+		// the object when passed to IsNull will return true. aNULL 
-+		// contains an empty object reference
-+		OOVBA_DLLPUBLIC const css::uno::Any& aNULL();
-+		OOVBA_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection  );
-+		OOVBA_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges,  SfxViewShell* );
-+
-+		OOVBA_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
-+		OOVBA_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
-+	OOVBA_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
-+	OOVBA_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-+	OOVBA_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
++# ------------------------------------------------------------------------
 +
-+class OOVBA_DLLPUBLIC Millimeter
-+{
-+//Factor to translate between points and hundredths of millimeters:
-+private:
-+	static const double factor;
-+    
-+	double m_nMillimeter;
 +
-+public:
-+	Millimeter():m_nMillimeter(0) {}
-+    
-+	Millimeter(double mm):m_nMillimeter(mm) {}
-+    
-+	void set(double mm) { m_nMillimeter = mm; }
-+	void setInPoints(double points) 
-+	{ 
-+		m_nMillimeter = points * 0.352777778; 
-+		// 25.4mm / 72 
-+	}
-+      
-+	void setInHundredthsOfOneMillimeter(double hmm)
-+	{
-+		m_nMillimeter = hmm / 100;
-+	}
-+    
-+	double get()
-+	{
-+		return m_nMillimeter;
-+	}
-+	double getInHundredthsOfOneMillimeter()
-+	{
-+		return m_nMillimeter * 100;
-+	}
-+	double getInPoints()
-+	{
-+		return m_nMillimeter * 2.834645669; // 72 / 25.4mm
-+	}    
++IDLFILES= XGlobals.idl\
++	XApplication.idl \
 +
-+	static sal_Int32 getInHundredthsOfOneMillimeter(double points)
-+	{
-+		sal_Int32 mm = static_cast<sal_Int32>(points * factor);
-+		return mm;
-+	}
-+    
-+	static double getInPoints(int _hmm)
-+	{
-+		double points = double( static_cast<double>(_hmm) / factor);
-+		return points;
-+	}
-+};
++# ------------------------------------------------------------------
 +
-+class OOVBA_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below
-+{
-+public:
-+    virtual ~AbstractGeometryAttributes() {}
-+    virtual double getLeft() = 0;
-+    virtual void setLeft( double ) = 0;
-+    virtual double getTop() = 0;
-+    virtual void setTop( double ) = 0;
-+    virtual double getHeight() = 0;
-+    virtual void setHeight( double ) = 0;
-+    virtual double getWidth() = 0;
-+    virtual void setWidth( double ) = 0;
-+};
++.INCLUDE :  target.mk
++
+diff --git oovbaapi/prj/build.lst oovbaapi/prj/build.lst
+index 04060dd..937c864 100644
+--- oovbaapi/prj/build.lst
++++ oovbaapi/prj/build.lst
+@@ -4,5 +4,6 @@ ovba	oovbaapi\genconstidl         nmake	-	all	ovba_genconstidl NULL
+ ovba	oovbaapi\ooo\vba\constants          nmake	-	all	ovba_constants  ovba_genconstidl NULL
+ ovba	oovbaapi\ooo\vba                    nmake	-	all	ovba_vba NULL
+ ovba	oovbaapi\ooo\vba\excel              nmake	-	all	ovba_excel NULL
++ovba	oovbaapi\ooo\vba\word               nmake	-	all	ovba_word NULL
+ ovba	oovbaapi\ooo\vba\msforms            nmake	-	all	ovba_msforms NULL
+-ovba   oovbaapi\util                             nmake   -   all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL
++ovba   oovbaapi\util                             nmake   -   all ovba_util ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL
+diff --git oovbaapi/util/makefile.mk oovbaapi/util/makefile.mk
+index bb6c97f..741f474 100644
+--- oovbaapi/util/makefile.mk
++++ oovbaapi/util/makefile.mk
+@@ -44,6 +44,7 @@ TARGET=oovbaapi_db
+ UNOIDLDBFILES= \
+ 	$(UCR)$/vba.db \
+ 	$(UCR)$/excel.db \
++	$(UCR)$/word.db \
+ 	$(UCR)$/msforms.db \
+ 	$(UCR)$/constants.db
+ 
+diff --git sc/inc/docuno.hxx sc/inc/docuno.hxx
+index f036a23..58ebb35 100644
+--- sc/inc/docuno.hxx
++++ sc/inc/docuno.hxx
+@@ -74,8 +74,6 @@ class ScTableSheetObj;
+ class SvxFmDrawPage;
+ class SvxDrawPage;
+ 
+-#include <com/sun/star/document/XCodeNameQuery.hpp>
+-
+ class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
+ 					public com::sun::star::sheet::XSpreadsheetDocument,
+ 					public com::sun::star::document::XActionLockable,
+@@ -89,7 +87,6 @@ class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
+ 					public com::sun::star::view::XRenderable,
+ 					public com::sun::star::document::XLinkTargetSupplier,
+ 					public com::sun::star::beans::XPropertySet,
+-					public com::sun::star::document::XCodeNameQuery,
+                     public com::sun::star::document::XDocumentEventCompatibleHelper,
+ 					public SvxFmMSFactory,	// derived from XMultiServiceFactory
+                     public com::sun::star::lang::XServiceInfo
+@@ -300,8 +297,6 @@ public:
+ 								throw(::com::sun::star::uno::RuntimeException);
+ 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ 								throw(::com::sun::star::uno::RuntimeException);
+- 	virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
+-								throw(::com::sun::star::uno::RuntimeException);
+                             // XVbaEventHelper
+     virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
+ };
+diff --git sc/inc/servuno.hxx sc/inc/servuno.hxx
+index 3beb852..13950f1 100644
+--- sc/inc/servuno.hxx
++++ sc/inc/servuno.hxx
+@@ -94,7 +94,8 @@ class ScDocShell;
+ #define SC_SERVICE_FORMULAPARS  38
+ #define SC_SERVICE_OPCODEMAPPER 39
+ #define SC_SERVICE_VBAOBJECTPROVIDER   40
+-#define SC_SERVICE_COUNT        41
++#define SC_SERVICE_VBACODENAMEPROVIDER   41
++#define SC_SERVICE_COUNT        42
+ #define SC_SERVICE_INVALID		USHRT_MAX
+ 
+ 
+diff --git sc/prj/build.lst sc/prj/build.lst
+index 9fa0b02..7ca5f1e 100644
+--- sc/prj/build.lst
++++ sc/prj/build.lst
+@@ -1,4 +1,4 @@
+-sc	sc	:	SCSOLVER:scsolver oovbaapi svx stoc uui BOOST:boost NULL
++sc	sc	:	SCSOLVER:scsolver vbahelper oovbaapi svx stoc uui BOOST:boost NULL
+ sc	sc										usr1	-	all	sc_mkout NULL
+ sc	sc\inc									nmake	-	all	sc_inc NULL
+ sc	sc\prj									get		-	all	sc_prj NULL
+diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
+index 033cb76..f091a47 100644
+--- sc/source/filter/excel/excimp8.cxx
++++ sc/source/filter/excel/excimp8.cxx
+@@ -103,7 +103,7 @@
+ #include <com/sun/star/document/XDocumentProperties.hpp>
+ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+ #include <com/sun/star/script/ModuleInfo.hpp>
+-
++#include <basic/basmgr.hxx>
+ 
+ using namespace com::sun::star;
+ 
+@@ -280,6 +280,15 @@ void ImportExcel8::ReadBasic( void )
+         bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
+         if( bLoadCode || bLoadStrg )
+         {
++            // Create and insert Excel vba Globals
++            uno::Reference < uno::XComponentContext > xCtx;
++            uno::Reference < beans::XPropertySet > xProps(
++            ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++            xCtx.set( xProps->getPropertyValue( rtl::OUString(
++                RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
++                uno::UNO_QUERY_THROW );
++            uno::Any aGlobs = uno::makeAny( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) );
++            pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
+             SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
+ 			bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
+             aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
+diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
+index bd1a653..87556ed 100644
+--- sc/source/ui/docshell/docsh.cxx
++++ sc/source/ui/docshell/docsh.cxx
+@@ -131,7 +131,8 @@
+ #include "cellsuno.hxx"
+ #include <com/sun/star/document/XVbaEventsHelper.hpp>
+ #include <com/sun/star/document/VbaEventId.hpp>
+-
++#include <basic/sbstar.hxx>
++#include <basic/basmgr.hxx>
+ using namespace com::sun::star;
+ using namespace com::sun::star::document::VbaEventId;
+ 
+@@ -286,6 +287,7 @@ void ScDocShell::BeforeXMLLoading()
+     if ( xEvt.is() )
+        xEvt->setIgnoreEvents( sal_True );
+     
++// if VBA enabled then we need to  
+     // prevent unnecessary broadcasts and updates
+     DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
+ 	pModificator = new ScDocShellModificator( *this );
+@@ -369,7 +371,19 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
+     }
+     else
+ 		aDocument.SetInsertingFromOtherDoc( FALSE );
+-
++	// add vba globals ( if they are availabl )
++	SfxObjectShell* pShell = aDocument.GetDocumentShell();
++	if ( pShell )
++	{
++		uno::Reference < uno::XComponentContext > xCtx;
++		uno::Reference < beans::XPropertySet > xProps(
++			::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++		xCtx.set( xProps->getPropertyValue( rtl::OUString(
++			RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
++				uno::UNO_QUERY_THROW );
++		uno::Any aGlobs = uno::makeAny( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) );
++		pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
++	}
+         // suppress VBA events when loading the xml
+         uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
+         if ( xEvt.is() )
+diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
+index a340ff2..fd91983 100644
+--- sc/source/ui/unoobj/docuno.cxx
++++ sc/source/ui/unoobj/docuno.cxx
+@@ -107,7 +107,6 @@ using namespace com::sun::star::document::VbaEventId;
+ //	alles ohne Which-ID, Map nur fuer PropertySetInfo
+ 
+ //!	umbenennen, sind nicht mehr nur Options
+-#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+ const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
+ {
+ 	static SfxItemPropertyMap aDocOptPropertyMap_Impl[] =
+@@ -314,7 +313,6 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
+ 	SC_QUERYINTERFACE( view::XRenderable )
+ 	SC_QUERYINTERFACE( document::XLinkTargetSupplier )
+ 	SC_QUERYINTERFACE( beans::XPropertySet )
+-	SC_QUERYINTERFACE( document::XCodeNameQuery )
+ 	SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
+ 	SC_QUERYINTERFACE( lang::XMultiServiceFactory )
+ 	SC_QUERYINTERFACE( lang::XServiceInfo )
+@@ -1720,49 +1718,7 @@ uno::Sequence<rtl::OUString> SAL_CALL ScModelObj::getAvailableServiceNames()
+ 
+ 	return concatServiceNames( aMyServices, aDrawServices );
+ }
+-// XCodeNameQuery
+-rtl::OUString SAL_CALL 
+-ScModelObj::getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
+-{
+-    rtl::OUString sCodeName;
+-    if ( pDocShell )
+-    {
+-        OSL_TRACE( "*** In ScModelObj::getCodeNameForObject");
+-        // need to find the page ( and index )  for this control
+-        uno::Reference< drawing::XDrawPagesSupplier > xSupplier( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
+-        uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
+-        sal_Int32 nLen = xIndex->getCount();
+-        bool bMatched = false;
+-        uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
+-        for ( sal_Int32 index = 0; index < nLen; ++index )
+-        {
+-            try
+-            {
+-                uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
+-                uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
+-                // get the www-standard container
+-                uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
+-                sal_Int32 nCntrls = xFormControls->getCount();
+-                for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
+-                {
+-                    uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );	
+-                    bMatched = ( xControl == xIf );
+-                    if ( bMatched )
+-                    {
+-                        String sName;
+-                        pDocShell->GetDocument()->GetCodeName( index, sName );
+-                        sCodeName = sName;
+-                    }
+-                }
+-            }
+-            catch( uno::Exception& ) {}
+-            if ( bMatched )
+-                break;
+-        }
+-    }
+-    // Probably should throw here ( if !bMatched )
+-     return sCodeName;
+-}
++
+ // XVbaEventHelper
+ // For Vba Event
+ sal_Bool SAL_CALL
+diff --git sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
+index 83db312..05ec9d2 100644
+--- sc/source/ui/unoobj/servuno.cxx
++++ sc/source/ui/unoobj/servuno.cxx
+@@ -63,6 +63,11 @@
+ #include <svx/xmlgrhlp.hxx>
+ 
+ #include <comphelper/processfactory.hxx>
++#include <com/sun/star/document/XCodeNameQuery.hpp>
++#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
++#include <com/sun/star/form/XFormsSupplier.hpp>
++#include <com/sun/star/script/ScriptEventDescriptor.hpp>
 +
-+class OOVBA_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
+ 
+ using namespace ::com::sun::star;
+ 
+@@ -160,6 +165,56 @@ public:
+ 
+ };
+ 
++class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
 +{
++ScDocShell* mpDocShell;
 +public:
-+    css::uno::Reference< ooo::vba::msforms::XShape > m_xShape; 
-+    ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
-+    virtual double getLeft()
-+    {
-+        return m_xShape->getLeft();
-+    }
-+    virtual void setLeft( double nLeft )
-+    {
-+        m_xShape->setLeft( nLeft );
-+    }
-+    virtual double getTop()
-+    {
-+        return m_xShape->getTop();
-+    }
-+    virtual void setTop( double nTop )
-+    {
-+        m_xShape->setTop( nTop );
-+    }
-+
-+    virtual double getHeight()
-+    {
-+        return m_xShape->getHeight();
-+    }
-+    virtual void setHeight( double nHeight )
++    ScVbaCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
++    // XCodeNameQuery
++    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
 +    {
-+        m_xShape->setHeight( nHeight );
-+    }
-+    virtual double getWidth()
-+    {
-+        return m_xShape->getWidth();
-+    }
-+    virtual void setWidth( double nWidth)
-+    {
-+        m_xShape->setHeight( nWidth );
++        rtl::OUString sCodeName;
++        if ( mpDocShell )
++        {
++            OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
++            // need to find the page ( and index )  for this control
++            uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
++            uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
++            sal_Int32 nLen = xIndex->getCount();
++            bool bMatched = false;
++            uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
++            for ( sal_Int32 index = 0; index < nLen; ++index )
++            {
++                try
++                {
++                    uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
++                    uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
++                    // get the www-standard container
++                    uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
++                    sal_Int32 nCntrls = xFormControls->getCount();
++                    for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
++                    {
++                        uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );	
++                        bMatched = ( xControl == xIf );
++                        if ( bMatched )
++                        {
++                            String sName;
++                            mpDocShell->GetDocument()->GetCodeName( index, sName );
++                            sCodeName = sName;
++                        }
++                    }
++                }
++                catch( uno::Exception& ) {}
++                if ( bMatched )
++                    break;
++            }
++        }
++        // Probably should throw here ( if !bMatched )
++         return sCodeName;
 +    }
 +
-+   
-+};
-+#define VBA_LEFT "PositionX"
-+#define VBA_TOP "PositionY"
-+class OOVBA_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
-+{
-+
-+    css::uno::Reference< css::beans::XPropertySet > mxModel;
-+public:
-+    UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
-+    virtual double getLeft();
-+    virtual void setLeft( double nLeft );
-+    virtual double getTop();
-+    virtual void setTop( double nTop );
-+    virtual double getHeight();
-+    virtual void setHeight( double nHeight );
-+    virtual double getWidth();
-+    virtual void setWidth( double nWidth);
-+};
-+
-+class OOVBA_DLLPUBLIC ShapeHelper
-+{
-+protected:
-+	css::uno::Reference< css::drawing::XShape > xShape;
-+public:
-+	ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
-+	{ 
-+		if( !xShape.is() ) 
-+			throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
-+	}
-+    
-+	double getHeight()
-+	{
-+        	return  Millimeter::getInPoints(xShape->getSize().Height);
-+    	}
-+
-+
-+    	void setHeight(double _fheight) throw ( css::script::BasicErrorException )
-+	{
-+		try
-+		{
-+			css::awt::Size aSize = xShape->getSize();
-+			aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
-+			xShape->setSize(aSize);
-+		}
-+		catch ( css::uno::Exception& /*e*/)
-+		{
-+			throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
-+    		}
-+	}
-+    
-+    
-+	double getWidth()
-+	{ 
-+		return Millimeter::getInPoints(xShape->getSize().Width);
-+    	}
-+
-+	void setWidth(double _fWidth) throw ( css::script::BasicErrorException )
-+	{
-+		try
-+		{
-+			css::awt::Size aSize = xShape->getSize();
-+			aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
-+			xShape->setSize(aSize);
-+		}
-+		catch (css::uno::Exception& /*e*/)
-+		{
-+			throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
-+		}
-+	}
-+    
-+    
-+	double getLeft()
-+	{
-+		return Millimeter::getInPoints(xShape->getPosition().X);
-+	}
-+
-+    
-+	void setLeft(double _fLeft)
-+	{
-+		css::awt::Point aPoint = xShape->getPosition();
-+		aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
-+		xShape->setPosition(aPoint);
-+	}
-+    
-+
-+	double getTop()
-+	{
-+        	return Millimeter::getInPoints(xShape->getPosition().Y);
-+	}
-+
-+    
-+	void setTop(double _fTop)
-+	{
-+		css::awt::Point aPoint = xShape->getPosition();
-+		aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
-+		xShape->setPosition(aPoint);
-+	}
-+    
-+};
-+
-+class OOVBA_DLLPUBLIC ContainerUtilities
-+{
-+
-+public: 
-+	static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >&  _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator);
-+	static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix );
-+
-+	static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
-+};
-+
-+// really just a a place holder to ease the porting pain
-+class OOVBA_DLLPUBLIC DebugHelper
-+{
-+public:
-+	static void exception( const rtl::OUString&  DetailedMessage, const css::uno::Exception& ex,  int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
-+	{
-+		// #TODO #FIXME ( do we want to support additionalArg here )
-+		throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
-+	}
-+
-+	static void exception( int err,  const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
-+	{
-+		exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
-+	}
-+
-+	static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
-+	{
-+		exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
-+	}
 +};
-+	} // openoffice
-+} // org
-+
-+namespace ov = ooo::vba;
-+
-+#ifdef DEBUG
-+#  define SC_VBA_FIXME(a) OSL_TRACE( a )
-+#  define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ ))
-+#else
-+#  define SC_VBA_FIXME(a)
-+#  define SC_VBA_STUB()
-+#endif
 +
-+#endif
-diff --git oovbaapi/inc/oovbaapi/vbahelperinterface.hxx oovbaapi/inc/oovbaapi/vbahelperinterface.hxx
+ //------------------------------------------------------------------------
+ 
+ static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
+@@ -210,6 +265,7 @@ static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
+         SC_SERVICENAME_FORMULAPARS,                 // SC_SERVICE_FORMULAPARS
+         SC_SERVICENAME_OPCODEMAPPER,                 // SC_SERVICE_OPCODEMAPPER
+ "ooo.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
++"ooo.vba.VBACodeNameProvider",// SC_SERVICE_VBACODENAMEPROVIDER
+ 	};
+ 
+ //
+@@ -263,6 +319,7 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] =
+         "",                                         // SC_SERVICE_FORMULAPARS
+         "",                                         // SC_SERVICE_OPCODEMAPPER
+         "",                                         // SC_SERVICE_VBAOBJECTPROVIDER
++        "",                                         // SC_SERVICE_VBACODENAMEPROVIDER
+ 	};
+ 
+ 
+@@ -458,6 +515,9 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
+         case SC_SERVICE_VBAOBJECTPROVIDER:
+             xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
+             break;
++        case SC_SERVICE_VBACODENAMEPROVIDER:
++            xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
++            break;
+ 	}
+ 	return xRet;
+ }
+diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
 new file mode 100644
-index 0000000..dc1a89f
+index 0000000..1be67f7
 --- /dev/null
-+++ oovbaapi/inc/oovbaapi/vbahelperinterface.hxx
-@@ -0,0 +1,117 @@
++++ sc/source/ui/vba/excelvbahelper.cxx
+@@ -0,0 +1,208 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -933,8 +876,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbahelperinterface.hxx,v $
-+ * $Revision: 1.3 $
++ * $RCSfile: vbahelper.cxx,v $
++ * $Revision: 1.5.32.1 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -954,100 +897,191 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX
-+#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
++#include <docuno.hxx>
++#include "excelvbahelper.hxx"
++#include "tabvwsh.hxx"
++#include "transobj.hxx"
++#include "scmod.hxx"
++#include <comphelper/processfactory.hxx>
 +
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <oovbaapi/vbahelper.hxx>
++using namespace ::com::sun::star;
++using namespace ::ooo::vba;
 +
-+// use this class when you have an a object like
-+// interface  XAnInterface which contains XHelperInterface in its inheritance hierarchy
-+// interface XAnInterface
-+// { 
-+//     interface XHelperInterface;
-+//     [attribute, string] name;
-+// }
-+// or
-+// interface XAnInterface : XHelperInterface;
-+// { 
-+//     [attribute, string] name;
-+// }
-+//
-+// then this class can provide a default implementation of XHelperInterface,
-+// you can use it like this
-+// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE;
-+// class AnInterfaceImpl : public AnInterfaceImpl_BASE
-+// {
-+// public:
-+//     AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {}
-+//     // implement XAnInterface methods only, no need to implement the XHelperInterface 
-+//     // methods
-+//     virtual void setName( const OUString& );  
-+//     virtual OUString getName();  
-+// }
-+//
-+const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) );
++namespace ooo
++{
++namespace vba
++{
 +
-+template< typename Ifc1 >
-+class InheritedHelperInterfaceImpl : public Ifc1
++bool isInPrintPreview( SfxViewFrame* pView )
 +{
-+protected: 
-+	css::uno::WeakReference< ov::XHelperInterface > mxParent;
-+	css::uno::Reference< css::uno::XComponentContext > mxContext;
-+public:
-+	InheritedHelperInterfaceImpl() {}
-+	InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
-+	virtual rtl::OUString& getServiceImplName() = 0;
-+	virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
++	sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
++	if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
++nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
++	{
++		SfxViewFactory &rViewFactory =
++			pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
++		if (  pView->GetCurViewId() == rViewFactory.GetOrdinal() )
++			return true;
++	}
++	return false;
++}
 +
-+	// XHelperInterface Methods
-+	virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
++const ::rtl::OUString REPLACE_CELLS_WARNING(  RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
++
++class PasteCellsWarningReseter
++{
++private:
++	bool bInitialWarningState;
++	static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
 +	{
-+		return 0x53756E4F;
++		static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++		static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
++		static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
++				xContext->getServiceManager(), uno::UNO_QUERY_THROW );
++		static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
++		return xProps;
 +	}
-+	virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; }
-+	
-+	virtual css::uno::Any SAL_CALL Application(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { 
-+	// #FIXME - we need some reasonable way to pass back the application
-+	return  css::uno::Any(); }
 +
++	bool getReplaceCellsWarning() throw ( uno::RuntimeException )
++	{
++		sal_Bool res = sal_False;
++		getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
++		return ( res == sal_True );
++	}
 +
-+	// XServiceInfo Methods
-+	virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
-+	virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException) 
-+	{ 
-+		css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames();
-+		const rtl::OUString* pStart = sServices.getConstArray();
-+		const rtl::OUString* pEnd = pStart + sServices.getLength();
-+		for ( ; pStart != pEnd ; ++pStart )
-+			if ( (*pStart).equals( ServiceName ) )
-+				return sal_True;
-+		return sal_False;	
++	void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
++	{
++		getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
 +	}
-+	virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (css::uno::RuntimeException) 
-+	{ 
-+		css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
-+		return aNames;
++public:
++	PasteCellsWarningReseter() throw ( uno::RuntimeException )
++	{
++		bInitialWarningState = getReplaceCellsWarning();
++		if ( bInitialWarningState )
++			setReplaceCellsWarning( false );
 +	}
-+ };
++	~PasteCellsWarningReseter()
++	{
++		if ( bInitialWarningState )
++		{
++			// don't allow dtor to throw
++			try
++			{
++				setReplaceCellsWarning( true );
++			}
++			catch ( uno::Exception& /*e*/ ){}
++		}
++	}
++};
 +
-+template< typename Ifc1 >
-+class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
++void
++implnPaste()
++{
++	PasteCellsWarningReseter resetWarningBox;
++	ScTabViewShell* pViewShell = getCurrentBestViewShell();
++	if ( pViewShell )
++	{
++		pViewShell->PasteFromSystem();
++		pViewShell->CellContentChanged();
++	}
++}
 +
++
++void
++implnCopy()
 +{
-+typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
-+public:
-+	InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}	
++	ScTabViewShell* pViewShell = getCurrentBestViewShell();
++	if ( pViewShell )
++		pViewShell->CopyToClip(NULL,false,false,true);
++}
 +
-+};
-+#endif
-diff --git oovbaapi/inc/vbapropvalue.hxx oovbaapi/inc/vbapropvalue.hxx
++void 
++implnCut()
++{
++	ScTabViewShell* pViewShell =  getCurrentBestViewShell();
++	if ( pViewShell )
++		pViewShell->CutToClip( NULL, TRUE );
++}
++
++void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
++{
++	PasteCellsWarningReseter resetWarningBox;
++	sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
++	InsCellCmd eMoveMode = INS_NONE;
++
++	ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
++	if ( !pTabViewShell ) 
++		// none active, try next best
++		pTabViewShell = getCurrentBestViewShell();
++	if ( pTabViewShell )
++	{
++		ScViewData* pView = pTabViewShell->GetViewData();	
++		Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
++		if ( pView && pWin )
++		{
++			if ( bAsLink && bOtherDoc )
++				pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
++			else 
++			{
++				ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
++				ScDocument* pDoc = NULL; 
++				if ( pOwnClip )
++					pDoc = pOwnClip->GetDocument();	
++				pTabViewShell->PasteFromClip( nFlags, pDoc,
++					nFunction, bSkipEmpty, bTranspose, bAsLink,
++					eMoveMode, IDF_NONE, TRUE );
++				pTabViewShell->CellContentChanged();
++			}
++		}
++	}
++
++}
++
++ScDocShell* 
++getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) 
++{
++	uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
++	ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
++	ScDocShell* pDocShell = NULL;
++	if ( pModel )
++		pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
++	return pDocShell;
++
++}
++
++ScTabViewShell* 
++getBestViewShell(  css::uno::Reference< css::frame::XModel>& xModel )
++{
++	ScDocShell* pDocShell = getDocShell( xModel );
++	if ( pDocShell )
++		return pDocShell->GetBestViewShell();
++	return NULL;
++}
++
++ScTabViewShell* 
++getCurrentBestViewShell()
++{ 
++	uno::Reference< frame::XModel > xModel = getCurrentDocument();
++	return getBestViewShell( xModel );
++}
++
++SfxViewFrame* 
++getCurrentViewFrame()
++{
++	ScTabViewShell* pViewShell = getCurrentBestViewShell();	
++	if ( pViewShell )
++		return pViewShell->GetViewFrame();
++	return NULL;
++}
++
++} // openoffice
++} //org
+diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
 new file mode 100644
-index 0000000..2580c43
+index 0000000..e35b1db
 --- /dev/null
-+++ oovbaapi/inc/vbapropvalue.hxx
-@@ -0,0 +1,60 @@
++++ sc/source/ui/vba/excelvbahelper.hxx
+@@ -0,0 +1,52 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1056,8 +1090,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbapropvalue.hxx,v $
-+ * $Revision: 1.3 $
++ * $RCSfile: vbahelper.hxx,v $
++ * $Revision: 1.5.32.1 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -1077,5609 +1111,26 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef SC_VBA_PROPVALULE_HXX
-+#define SC_VBA_PROPVALULE_HXX
-+#include <ooo/vba/XPropValue.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include <oovbaapi/vbahelper.hxx>
++#ifndef SC_EXCEL_VBA_HELPER_HXX
++#define SC_EXCEL_VBA_HELPER_HXX
 +
-+typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
++#include<vbahelper/vbahelper.hxx>
++#include <docsh.hxx>
 +
-+class PropListener 
++namespace ooo 
 +{
-+public:
-+    virtual void setValueEvent( const css::uno::Any& value ) = 0;
-+    virtual css::uno::Any getValueEvent() = 0; 
-+};
-+
-+
-+class ScVbaPropValue : public PropValueImpl_BASE 
-+{
-+    PropListener* m_pListener;
-+public:
-+    ScVbaPropValue( PropListener* pListener );
-+
-+    // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+
-+    rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+
-+};
-+#endif //SC_VBA_PROPVALULE_HXX
-diff --git oovbaapi/ooo/allapi/makefile.mk oovbaapi/ooo/allapi/makefile.mk
-new file mode 100644
-index 0000000..3246221
---- /dev/null
-+++ oovbaapi/ooo/allapi/makefile.mk
-@@ -0,0 +1,54 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.4 $
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org 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 version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..
-+PRJPCH=
-+
-+PRJNAME=oovbaapi
-+TARGET=allapi_db
-+
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+
-+# ------------------------------------------------------------------
-+UNOIDLDBFILES= \
-+	$(UCR)$/vba.db \
-+	$(UCR)$/excel.db \
-+	$(UCR)$/word.db \
-+	$(UCR)$/msforms.db \
-+	$(UCR)$/constants.db
-+
-+# --- Targets ------------------------------------------------------
-+REGMERGEFLAGS=-i
-+
-+.INCLUDE :  target.mk
-diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
-new file mode 100644
-index 0000000..292399b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XApplication.idl
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XApplication.idl,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XApplication_idl__
-+#define __ooo_vba_word_XApplication_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+module ooo {  module vba {  module word { 
-+
-+interface XApplication
-+{
-+
-+	interface ::ooo::vba::XHelperInterface;
-+
-+	[attribute, readonly] string Name;
-+	void DoEvents();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
-new file mode 100644
-index 0000000..3c144a6
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XGlobals.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XGlobals.idl,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XGlobals_idl__
-+#define __ooo_vba_word_XGlobals_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __ooo_vba_word_XApplication_idl__
-+#include <ooo/vba/word/XApplication.idl>
-+#endif
-+
-+module ooo {  module vba {  module word { 
-+
-+interface XGlobals: com::sun::star::uno::XInterface
-+{
-+        // FIXME, need better way to expose globals
-+	sequence< any > getGlobals();
-+
-+	[attribute, readonly] ooo::vba::word::XApplication Application;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
-new file mode 100644
-index 0000000..27f6b68
---- /dev/null
-+++ oovbaapi/ooo/vba/word/makefile.mk
-@@ -0,0 +1,50 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.4 $
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org 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 version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+PRJ=..$/..$/..
-+
-+PRJNAME=oovapi
-+
-+TARGET=word
-+PACKAGE=ooo$/vba$/Word
-+
-+# --- Settings -----------------------------------------------------
-+.INCLUDE :  $(PRJ)$/util$/makefile.pmk
-+
-+# ------------------------------------------------------------------------
-+
-+
-+IDLFILES= XGlobals.idl\
-+	XApplication.idl \
-+
-+# ------------------------------------------------------------------
-+
-+.INCLUDE :  target.mk
-+
-diff --git oovbaapi/prj/build.lst oovbaapi/prj/build.lst
-index 04060dd..516ee98 100644
---- oovbaapi/prj/build.lst
-+++ oovbaapi/prj/build.lst
-@@ -4,5 +4,8 @@ ovba	oovbaapi\genconstidl         nmake	-	all	ovba_genconstidl NULL
- ovba	oovbaapi\ooo\vba\constants          nmake	-	all	ovba_constants  ovba_genconstidl NULL
- ovba	oovbaapi\ooo\vba                    nmake	-	all	ovba_vba NULL
- ovba	oovbaapi\ooo\vba\excel              nmake	-	all	ovba_excel NULL
-+ovba	oovbaapi\ooo\vba\word               nmake	-	all	ovba_word NULL
- ovba	oovbaapi\ooo\vba\msforms            nmake	-	all	ovba_msforms NULL
--ovba   oovbaapi\util                             nmake   -   all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL
-+ovba   oovbaapi\ooo\allapi                             nmake   -   all ovba_allapi ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL
-+ovba   oovbaapi\source\vbahelper                             nmake   -   all ovba_vbahelper ovba_allapi ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL
-+ovba   oovbaapi\util                             nmake   -   all ovba_util ovba_vbahelper ovba_allapi ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL
-diff --git oovbaapi/prj/d.lst oovbaapi/prj/d.lst
-index 1acd2ac..7bbc811 100644
---- oovbaapi/prj/d.lst
-+++ oovbaapi/prj/d.lst
-@@ -1 +1,9 @@
- ..\%__SRC%\ucr\oovbaapi.db %_DEST%\bin%_EXT%\oovbaapi.rdb
-+..\inc\oovbaapi\helperdecl.hxx %_DEST%\inc%_EXT%\oovbaapi\helperdecl.hxx
-+..\inc\oovbaapi\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\oovbaapi\vbacollectionimpl.hxx
-+..\inc\oovbaapi\vbahelper.hxx %_DEST%\inc%_EXT%\oovbaapi\vbahelper.hxx
-+..\inc\oovbaapi\vbahelperinterface.hxx %_DEST%\inc%_EXT%\oovbaapi\vbahelperinterface.hxx
-+..\inc\oovbaapi\oovbadllapi.h %_DEST%\inc%_EXT%\oovbaapi\oovbadllapi.h
-+..\%__SRC%\lib\vba*.* %_DEST%\lib%_EXT%\vba*.*
-+..\%__SRC%\slb\lib*.* %_DEST%\lib%_EXT%\lib*.*
-+..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
-diff --git oovbaapi/source/msforms/.makefile.mk.swp oovbaapi/source/msforms/.makefile.mk.swp
-new file mode 100644
-index 0000000..186da1e
-Binary files /dev/null and oovbaapi/source/msforms/.makefile.mk.swp differ
-diff --git oovbaapi/source/msforms/.vbacontrol.cxx.swp oovbaapi/source/msforms/.vbacontrol.cxx.swp
-new file mode 100644
-index 0000000..aa2bb12
-Binary files /dev/null and oovbaapi/source/msforms/.vbacontrol.cxx.swp differ
-diff --git oovbaapi/source/msforms/makefile.mk oovbaapi/source/msforms/makefile.mk
-new file mode 100644
-index 0000000..e33f42f
---- /dev/null
-+++ oovbaapi/source/msforms/makefile.mk
-@@ -0,0 +1,75 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.45 $
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org 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 version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..
-+PRJNAME=oovbaapi
-+TARGET=msforms
-+
-+ENABLE_EXCEPTIONS := TRUE
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE :  settings.mk
-+
-+SLOFILES=\
-+    $(SLO)$/vbacontrol.obj \
-+    $(SLO)$/vbabutton.obj \
-+    $(SLO)$/vbacombobox.obj \
-+    $(SLO)$/vbalabel.obj \
-+    $(SLO)$/vbatextbox.obj \
-+    $(SLO)$/vbaradiobutton.obj \
-+    $(SLO)$/vbalistbox.obj \
-+    $(SLO)$/vbatogglebutton.obj \
-+    $(SLO)$/vbacheckbox.obj \
-+    $(SLO)$/vbaframe.obj \
-+    $(SLO)$/vbascrollbar.obj \
-+    $(SLO)$/vbaprogressbar.obj \
-+    $(SLO)$/vbamultipage.obj \
-+    $(SLO)$/vbalistcontrolhelper.obj \
-+    $(SLO)$/vbaspinbutton.obj \
-+    $(SLO)$/vbaimage.obj \
-+    $(SLO)$/vbapages.obj \
-+
-+# #FIXME vbapropvalue needs to move to vbahelper
-+
-+# --- Targets -------------------------------------------------------
-+
-+.INCLUDE :  target.mk
-+
-+ALLTAR : \
-+        $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(UCR)$/oovbaapi.db
-+        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(UCR)$/oovbaapi.db -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+        echo $@
-+
-diff --git oovbaapi/source/msforms/vbabutton.cxx oovbaapi/source/msforms/vbabutton.cxx
-new file mode 100644
-index 0000000..0e4d749
---- /dev/null
-+++ oovbaapi/source/msforms/vbabutton.cxx
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbabutton.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbabutton.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+rtl::OUString SAL_CALL 
-+ScVbaButton::getCaption() throw (css::uno::RuntimeException)
-+{
-+    rtl::OUString Label;
-+    m_xProps->getPropertyValue( LABEL ) >>= Label;
-+    return Label;
-+}
-+
-+void SAL_CALL 
-+ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-+}
-+
-+rtl::OUString& 
-+ScVbaButton::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaButton::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbabutton.hxx oovbaapi/source/msforms/vbabutton.hxx
-new file mode 100644
-index 0000000..7447a73
---- /dev/null
-+++ oovbaapi/source/msforms/vbabutton.hxx
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbabutton.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_BUTTON_HXX
-+#define SC_VBA_BUTTON_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
-+
-+class ScVbaButton : public ButtonImpl_BASE
-+{
-+public:
-+    ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
-+   // Attributes
-+    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_BUTTON_HXX
-diff --git oovbaapi/source/msforms/vbacheckbox.cxx oovbaapi/source/msforms/vbacheckbox.cxx
-new file mode 100644
-index 0000000..958e375
---- /dev/null
-+++ oovbaapi/source/msforms/vbacheckbox.cxx
-@@ -0,0 +1,110 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbacheckbox.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
-+ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+rtl::OUString SAL_CALL 
-+ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException)
-+{
-+    rtl::OUString Label;
-+    m_xProps->getPropertyValue( LABEL ) >>= Label;
-+    return Label;
-+}
-+
-+void SAL_CALL 
-+ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaCheckbox::getValue() throw (css::uno::RuntimeException)
-+{
-+    sal_Int16 nValue = -1;
-+    m_xProps->getPropertyValue( STATE ) >>= nValue;
-+    if( nValue != 0 )
-+        nValue = -1;
-+//    return uno::makeAny( nValue ); 
-+// I must be missing something MSO says value should be -1 if selected, 0 if not
-+// selected
-+    return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); 
-+}
-+
-+void SAL_CALL 
-+ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
-+{
-+    sal_Int16 nValue = 0;
-+    sal_Bool bValue = false;
-+    if( _value >>= nValue )
-+    {
-+        if( nValue == -1)
-+            nValue = 1;
-+    }
-+    else if ( _value >>= bValue )
-+    {
-+        if ( bValue )
-+            nValue = 1;
-+    }
-+    m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+}
-+rtl::OUString& 
-+ScVbaCheckbox::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaCheckbox::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbacheckbox.hxx oovbaapi/source/msforms/vbacheckbox.hxx
-new file mode 100644
-index 0000000..74eaf7b
---- /dev/null
-+++ oovbaapi/source/msforms/vbacheckbox.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ *  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_CHECKBOX_HXX
-+#define SC_VBA_CHECKBOX_HXX
-+#include <cppuhelper/implbase2.hxx>
-+#include <ooo/vba/msforms/XRadioButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-+
-+class ScVbaCheckbox : public CheckBoxImpl_BASE
-+{
-+public:
-+    ScVbaCheckbox(  const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
-+   // 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 css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    // XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_CHECKBOX_HXX
-diff --git oovbaapi/source/msforms/vbacombobox.cxx oovbaapi/source/msforms/vbacombobox.cxx
-new file mode 100644
-index 0000000..8f1e0fb
---- /dev/null
-+++ oovbaapi/source/msforms/vbacombobox.cxx
-@@ -0,0 +1,175 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbacombobox.cxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacombobox.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+//SelectedItems list of integer indexes
-+//StringItemList list of items
-+
-+const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
-+const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
-+const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-+const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") );
-+
-+ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
-+{
-+    	mpListHelper.reset( new ListControlHelper( m_xProps ) );
-+	// grab the default value property name
-+	m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
-+}
-+
-+// Attributes
-+
-+
-+// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in
-+// the drop down
-+uno::Any SAL_CALL 
-+ScVbaComboBox::getValue() throw (uno::RuntimeException)
-+{
-+	return m_xProps->getPropertyValue( sSourceName );
-+}
-+
-+void SAL_CALL 
-+ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
-+{
-+    uno::Sequence< sal_Int16 > sSelection(1);
-+    _value >>= sSelection[ 0 ];
-+    m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
-+{
-+	uno::Sequence< rtl::OUString > sItems;
-+	m_xProps->getPropertyValue( ITEMS ) >>= sItems;
-+	// should really return the item that has focus regardless of
-+	// it been selected
-+	if ( sItems.getLength() > 0 )
-+	{
-+		rtl::OUString sText = getText();
-+		sal_Int32 nLen = sItems.getLength();
-+		for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index )
-+		{
-+			if ( sItems[ index ].equals( sText ) )
-+			{
-+				OSL_TRACE("getListIndex returning %d", index );
-+				return uno::makeAny( index );
-+			}
-+				
-+		} 
-+ 	} 
-+	OSL_TRACE("getListIndex returning %d", -1 );
-+	return uno::makeAny( sal_Int32( -1 ) );
-+}
-+
-+// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one
-+// of the values in the list then the selection is also set
-+void SAL_CALL 
-+ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
-+{
-+	m_xProps->setPropertyValue( sSourceName, _value );
-+}
-+
-+// see Value
-+
-+::rtl::OUString SAL_CALL 
-+ScVbaComboBox::getText() throw (uno::RuntimeException)
-+{
-+	rtl::OUString result;
-+	getValue() >>= result;
-+	return result;
-+}
-+
-+void SAL_CALL 
-+ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
-+{
-+	setValue( uno::makeAny( _text ) ); // seems the same
-+}
-+
-+// Methods
-+void SAL_CALL 
-+ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
-+{
-+	mpListHelper->AddItem( pvargItem, pvargIndex );
-+}
-+
-+void SAL_CALL 
-+ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
-+	{
-+	mpListHelper->removeItem( index );
-+}
-+
-+void SAL_CALL 
-+ScVbaComboBox::Clear(  ) throw (uno::RuntimeException)
-+		{
-+	mpListHelper->Clear();
-+		}
-+
-+void SAL_CALL
-+ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
-+{
-+	ScVbaControl::setRowSource( _rowsource );
-+	mpListHelper->setRowSource( _rowsource );
-+		}
-+
-+sal_Int32 SAL_CALL
-+ScVbaComboBox::getListCount() throw (uno::RuntimeException)
-+		{
-+	return mpListHelper->getListCount();
-+		}
-+		
-+uno::Any SAL_CALL 
-+ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
-+		{
-+	return mpListHelper->List( pvargIndex, pvarColumn );
-+		}
-+
-+rtl::OUString& 
-+ScVbaComboBox::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") );
-+	return sImplName;
-+	}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaComboBox::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) );
-+}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbacombobox.hxx oovbaapi/source/msforms/vbacombobox.hxx
-new file mode 100644
-index 0000000..219e05c
---- /dev/null
-+++ oovbaapi/source/msforms/vbacombobox.hxx
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbacombobox.hxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_COMBOBOX_HXX
-+#define SC_VBA_COMBOBOX_HXX
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <ooo/vba/msforms/XComboBox.hpp>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include "vbalistcontrolhelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
-+class ScVbaComboBox : public ComboBoxImpl_BASE
-+{		
-+	std::auto_ptr< ListControlHelper > mpListHelper;
-+	rtl::OUString sSourceName; 
-+	rtl::OUString msDftPropName;
-+	bool mbDialogType;
-+
-+public:
-+	ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false );
-+
-+	// Attributes
-+	virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
-+	virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+	virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+	virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
-+
-+	// Methods
-+	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
-+	virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
-+	// XControl
-+    virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
-+
-+	// XDefaultProperty
-+        ::rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+	//XHelperInterface
-+	virtual rtl::OUString& getServiceImplName();
-+	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //
-diff --git oovbaapi/source/msforms/vbacontrol.cxx oovbaapi/source/msforms/vbacontrol.cxx
-new file mode 100644
-index 0000000..a84703c
---- /dev/null
-+++ oovbaapi/source/msforms/vbacontrol.cxx
-@@ -0,0 +1,467 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbacontrol.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/form/FormComponentType.hpp>
-+#include <com/sun/star/awt/XControlModel.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/view/XControlAccess.hpp>
-+#include <com/sun/star/container/XChild.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#ifdef VBA_OOBUILD_HACK
-+#include <svtools/bindablecontrolhelper.hxx>
-+#endif
-+#include"vbacontrol.hxx"
-+#include"vbacombobox.hxx"
-+#include "vbabutton.hxx"
-+#include "vbalabel.hxx"
-+#include "vbatextbox.hxx"
-+#include "vbaradiobutton.hxx"
-+#include "vbalistbox.hxx"
-+#include "vbatogglebutton.hxx"
-+#include "vbacheckbox.hxx"
-+#include "vbaframe.hxx"
-+#include "vbascrollbar.hxx"
-+#include "vbaprogressbar.hxx"
-+#include "vbamultipage.hxx"
-+#include "vbaspinbutton.hxx"
-+#include "vbaimage.hxx"
-+
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+uno::Reference< css::awt::XWindowPeer > 
-+ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
-+{
-+    uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
-+
-+    uno::Reference< awt::XControlModel > xControlModel;
-+    uno::Reference< css::awt::XWindowPeer >  xWinPeer;
-+    if ( !xControlShape.is() ) 
-+    { 
-+        // would seem to be a Userform control
-+        uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW );
-+        xWinPeer =  xControl->getPeer();
-+	return xWinPeer;
-+    }
-+    // form control
-+    xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+
-+    uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+    try
-+    {
-+        uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY );
-+        xWinPeer =  xControl->getPeer();
-+    }
-+    catch( uno::Exception )
-+    {
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ),
-+                uno::Reference< uno::XInterface >() );
-+    }
-+    return xWinPeer;
-+}
-+
-+//ScVbaControlListener
-+class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener >
-+{
-+private:
-+    ScVbaControl *pControl;
-+public:
-+    ScVbaControlListener( ScVbaControl *pTmpControl );
-+    virtual ~ScVbaControlListener();
-+    virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException );
-+};
-+
-+ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl )
-+{
-+}
-+
-+ScVbaControlListener::~ScVbaControlListener()
-+{
-+}
-+
-+void SAL_CALL
-+ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException )
-+{
-+    if( pControl )
-+    {
-+        pControl->removeResouce();
-+        pControl = NULL;
-+    }
-+}
-+
-+//ScVbaControl
-+
-+ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl,  const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ),  m_xControl( xControl ), m_xModel( xModel )
-+{
-+    //add listener
-+    m_xEventListener.set( new ScVbaControlListener( this ) );
-+    setGeometryHelper( pGeomHelper );
-+    uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
-+    xComponent->addEventListener( m_xEventListener );
-+   
-+    //init m_xProps
-+    uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
-+    uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ;
-+    if ( xControlShape.is() ) // form control
-+        m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+    else if ( xUserFormControl.is() ) // userform control
-+        m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
-+}
-+
-+ScVbaControl::~ScVbaControl()
-+{
-+    if( m_xControl.is() )
-+    {
-+        uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
-+        xComponent->removeEventListener( m_xEventListener );
-+    }
-+}
-+
-+void 
-+ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper )
-+{
-+    mpGeometryHelper.reset( pHelper );
-+}
-+
-+void ScVbaControl::removeResouce() throw( uno::RuntimeException )
-+{
-+    uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
-+    xComponent->removeEventListener( m_xEventListener );
-+    m_xControl= NULL;
-+    m_xProps = NULL;
-+}
-+
-+//In design model has different behavior
-+sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException)
-+{
-+    uno::Any aValue = m_xProps->getPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) );
-+    sal_Bool bRet = false;
-+    aValue >>= bRet;
-+    return bRet;
-+}
-+
-+void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException)
-+{
-+    uno::Any aValue( bVisible );
-+    m_xProps->setPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue);
-+
-+}
-+
-+sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
-+{
-+    uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
-+    return xWindow2->isVisible();
-+}
-+
-+void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-+{
-+    uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
-+    xWindow2->setVisible( bVisible );
-+}
-+double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
-+{
-+    return mpGeometryHelper->getHeight();
-+}
-+void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException)
-+{
-+    mpGeometryHelper->setHeight( _height );
-+}
-+
-+double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException)
-+{
-+    return mpGeometryHelper->getWidth();
-+}
-+void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException)
-+{
-+    mpGeometryHelper->setWidth( _width );
-+}
-+
-+double SAL_CALL
-+ScVbaControl::getLeft() throw (uno::RuntimeException)
-+{
-+    return mpGeometryHelper->getLeft();
-+}
-+
-+void SAL_CALL
-+ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
-+{
-+    mpGeometryHelper->setLeft( _left );
-+
-+}
-+
-+double SAL_CALL
-+ScVbaControl::getTop() throw (uno::RuntimeException)
-+{
-+    return mpGeometryHelper->getTop();
-+}
-+
-+void SAL_CALL
-+ScVbaControl::setTop( double _top ) throw (uno::RuntimeException)
-+{
-+    mpGeometryHelper->setTop( _top );
-+}
-+
-+uno::Reference< uno::XInterface > SAL_CALL
-+ScVbaControl::getObject() throw (uno::RuntimeException)
-+{
-+	uno::Reference< msforms::XControl > xRet( this );
-+	return xRet;
-+}
-+
-+void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) 
-+{
-+    uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW );
-+    xWin->setFocus();
-+}
-+
-+rtl::OUString SAL_CALL 
-+ScVbaControl::getControlSource() throw (uno::RuntimeException)
-+{
-+// #FIXME I *hate* having these upstream differences
-+// but this is necessary until I manage to upstream other
-+// dependant parts
-+#ifdef VBA_OOBUILD_HACK
-+	rtl::OUString sControlSource;
-+	uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY );
-+	if ( xBindable.is() )
-+	{
-+		try
-+		{
-+			uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
-+			uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY );
-+			uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW );
-+			table::CellAddress aAddress;
-+			xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress;
-+			xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) );
-+                	xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource;
-+}
-+		catch( uno::Exception& )
-+		{
-+		}	
-+	}
-+	return sControlSource;
-+#else
-+	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
-+#endif
-+}
-+
-+void SAL_CALL 
-+ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException)
-+{
-+#ifdef VBA_OOBUILD_HACK
-+    rtl::OUString sEmpty;
-+    svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty );
-+#else
-+	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported
-+#endif
-+}
-+
-+rtl::OUString SAL_CALL 
-+ScVbaControl::getRowSource() throw (uno::RuntimeException)
-+    {
-+#ifdef VBA_OOBUILD_HACK
-+	rtl::OUString sRowSource;
-+	uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY );
-+	if ( xListSink.is() )
-+    {
-+		try
-+		{
-+			uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
-+			uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY );
-+
-+			uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW );
-+			table::CellRangeAddress aAddress;
-+			xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress;
-+			xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) );
-+			xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource;
-+    }
-+		catch( uno::Exception& )
-+		{
-+}
-+	}
-+	return sRowSource;
-+#else
-+	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
-+#endif
-+}
-+
-+void SAL_CALL 
-+ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
-+{
-+#ifdef VBA_OOBUILD_HACK
-+    rtl::OUString sEmpty;
-+    svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource );
-+#else
-+	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported
-+#endif
-+}
-+
-+rtl::OUString SAL_CALL 
-+ScVbaControl::getName() throw (uno::RuntimeException)
-+{
-+	rtl::OUString sName;
-+	m_xProps->getPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
-+	return sName;
-+
-+}
-+
-+void SAL_CALL
-+ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
-+{
-+	m_xProps->setPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
-+    }
-+//ScVbaControlFactory
-+
-+ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
-+{
-+}
-+
-+ScVbaControl* ScVbaControlFactory::createControl()  throw (uno::RuntimeException)
-+{
-+    return createControl( m_xModel );
-+}
-+ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent )  throw (uno::RuntimeException)
-+{
-+    uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
-+    if ( xControlShape.is() ) // form controls
-+        return createControl( xControlShape, xParent );
-+    uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY );
-+    if ( !xControl.is() )
-+        throw uno::RuntimeException(); // really we should be more informative
-+    return createControl( xControl, xParent );
-+    
-+}
-+
-+ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape,  const uno::Reference< uno::XInterface >& /*xParent*/ )  throw (uno::RuntimeException)
-+{
-+    uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+    sal_Int32 nClassId = -1;
-+    const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
-+    xProps->getPropertyValue( sClassId ) >>= nClassId;
-+    uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
-+    switch( nClassId )
-+    {
-+        case form::FormComponentType::COMBOBOX:
-+            return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::COMMANDBUTTON:
-+            return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::FIXEDTEXT:
-+            return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::TEXTFIELD:
-+            return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::RADIOBUTTON:
-+            return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::LISTBOX:
-+            return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::SPINBUTTON:
-+            return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        case form::FormComponentType::IMAGECONTROL:
-+            return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+        default:
-+            throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Donot support this Control Type." ), uno::Reference< uno::XInterface >() );
-+    }
-+}
-+
-+ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl,  const uno::Reference< uno::XInterface >& xParent  )  throw (uno::RuntimeException)
-+{
-+    uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
-+    uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW );
-+    ScVbaControl* pControl = NULL;
-+    uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
-+    if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
-+	pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );	
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
-+	pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );	
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
-+        pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
-+    {
-+        sal_Bool bToggle = sal_False;
-+        xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
-+        if ( bToggle )
-+            pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+        else
-+            pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    }
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
-+        pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
-+	pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
-+	pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
-+	pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
-+	pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
-+	pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
-+	pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-+	pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
-+    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
-+	pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+    else
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
-+    return pControl;
-+}
-+
-+rtl::OUString& 
-+ScVbaControl::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaControl::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) );
-+    }
-+	return aServiceNames;
-+}
-+
-+
-diff --git oovbaapi/source/msforms/vbacontrol.hxx oovbaapi/source/msforms/vbacontrol.hxx
-new file mode 100644
-index 0000000..788ea55
---- /dev/null
-+++ oovbaapi/source/msforms/vbacontrol.hxx
-@@ -0,0 +1,112 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbacontrol.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_CONTROL_HXX
-+#define SC_VBA_CONTROL_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XWindowPeer.hpp>
-+#include <ooo/vba/msforms/XControl.hpp>
-+
-+#include <oovbaapi/vbahelper.hxx>
-+#include <oovbaapi/vbahelperinterface.hxx>
-+#include <memory>
-+
-+//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
-+typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
-+
-+class ScVbaControl : public ControlImpl_BASE
-+{
-+private:
-+    com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
-+protected:
-+    std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
-+    css::uno::Reference< css::beans::XPropertySet > m_xProps;
-+    css::uno::Reference< css::uno::XInterface > m_xControl;
-+    css::uno::Reference< css::frame::XModel > m_xModel;
-+
-+    virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
-+public:
-+    ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, 
-+                    const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
-+    virtual ~ScVbaControl();
-+    // This class will own the helper, so make sure it is allocated from 
-+    // the heap
-+    void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
-+    // XControl
-+    virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setEnabled( sal_Bool _enabled ) 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 double SAL_CALL getHeight() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
-+    virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
-+    virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
-+    virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL SetFocus(  ) throw (css::uno::RuntimeException);
-+
-+    virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
-+    virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException);
-+    virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
-+    virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
-+    //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
-+    virtual void removeResouce() throw( css::uno::RuntimeException );
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+
-+class ScVbaControlFactory
-+{
-+public:
-+    ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext, 
-+                    const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
-+    ScVbaControl* createControl()  throw ( css::uno::RuntimeException );
-+    ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent )  throw ( css::uno::RuntimeException );
-+private:
-+    ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >&  )  throw ( css::uno::RuntimeException );
-+    ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& )  throw ( css::uno::RuntimeException );
-+    css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+    css::uno::Reference< css::uno::XInterface > m_xControl;
-+    css::uno::Reference< css::frame::XModel > m_xModel;
-+};
-+
-+#endif//SC_VBA_CONTROL_HXX
-diff --git oovbaapi/source/msforms/vbaframe.cxx oovbaapi/source/msforms/vbaframe.cxx
-new file mode 100644
-index 0000000..b2827d0
---- /dev/null
-+++ oovbaapi/source/msforms/vbaframe.cxx
-@@ -0,0 +1,93 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbaframe.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+rtl::OUString SAL_CALL 
-+ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
-+{
-+    rtl::OUString Label;
-+    m_xProps->getPropertyValue( LABEL ) >>= Label;
-+    return Label;
-+}
-+
-+void SAL_CALL 
-+ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaFrame::getValue() throw (css::uno::RuntimeException)
-+{
-+    return uno::makeAny( getCaption() );
-+}
-+
-+void SAL_CALL 
-+ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    rtl::OUString sCaption;
-+    _value >>= sCaption;
-+    setCaption( sCaption ); 
-+}
-+
-+rtl::OUString& 
-+ScVbaFrame::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaFrame::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbaframe.hxx oovbaapi/source/msforms/vbaframe.hxx
-new file mode 100644
-index 0000000..5c35347
---- /dev/null
-+++ oovbaapi/source/msforms/vbaframe.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ *  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_FRAME_HXX
-+#define SC_VBA_FRAME_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XLabel.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
-+
-+class ScVbaFrame : public FrameImpl_BASE
-+{
-+public:
-+    ScVbaFrame(  const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_LABEL_HXX
-diff --git oovbaapi/source/msforms/vbaimage.cxx oovbaapi/source/msforms/vbaimage.cxx
-new file mode 100644
-index 0000000..847a08a
---- /dev/null
-+++ oovbaapi/source/msforms/vbaimage.cxx
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ * $Revision$
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaimage.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+rtl::OUString& 
-+ScVbaImage::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaImage::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbaimage.hxx oovbaapi/source/msforms/vbaimage.hxx
-new file mode 100644
-index 0000000..4f5c946
---- /dev/null
-+++ oovbaapi/source/msforms/vbaimage.hxx
-@@ -0,0 +1,48 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ * $Revision$
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_IMAGE_HXX
-+#define SC_VBA_IMAGE_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XImage.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE;
-+
-+class ScVbaImage : public ImageImpl_BASE
-+{
-+public:
-+    ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_IMAGE_HXX
-diff --git oovbaapi/source/msforms/vbalabel.cxx oovbaapi/source/msforms/vbalabel.cxx
-new file mode 100644
-index 0000000..a5fa3c1
---- /dev/null
-+++ oovbaapi/source/msforms/vbalabel.cxx
-@@ -0,0 +1,88 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbalabel.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalabel.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ScVbaLabel::ScVbaLabel(  const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+rtl::OUString SAL_CALL 
-+ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
-+{
-+    rtl::OUString Label;
-+    m_xProps->getPropertyValue( LABEL ) >>= Label;
-+    return Label;
-+}
-+
-+void SAL_CALL 
-+ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-+}
-+uno::Any SAL_CALL 
-+ScVbaLabel::getValue() throw (css::uno::RuntimeException)
-+{
-+    return uno::makeAny( getCaption() );
-+}
-+
-+void SAL_CALL 
-+ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    rtl::OUString sCaption;
-+    _value >>= sCaption;
-+    setCaption( sCaption ); 
-+}
-+
-+
-+rtl::OUString& 
-+ScVbaLabel::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaLabel::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbalabel.hxx oovbaapi/source/msforms/vbalabel.hxx
-new file mode 100644
-index 0000000..736d0b8
---- /dev/null
-+++ oovbaapi/source/msforms/vbalabel.hxx
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbalabel.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_LABEL_HXX
-+#define SC_VBA_LABEL_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XLabel.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty  > LabelImpl_BASE;
-+
-+class ScVbaLabel : public LabelImpl_BASE
-+{
-+public:
-+    ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+    // XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_LABEL_HXX
-diff --git oovbaapi/source/msforms/vbalistbox.cxx oovbaapi/source/msforms/vbalistbox.cxx
-new file mode 100644
-index 0000000..a0fd7ce
---- /dev/null
-+++ oovbaapi/source/msforms/vbalistbox.cxx
-@@ -0,0 +1,287 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbalistbox.cxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
-+
-+#include "vbalistbox.hxx"
-+#include "vbapropvalue.hxx"
-+#include <vector>
-+#include <comphelper/anytostring.hxx>
-+#include <com/sun/star/script/ArrayWrapper.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
-+const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
-+const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-+
-+
-+ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+    mpListHelper.reset( new ListControlHelper( m_xProps ) );
-+}
-+
-+// Attributes
-+void SAL_CALL 
-+ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
-+{
-+    sal_Int32 nIndex = 0;
-+    _value >>= nIndex;
-+    Selected( nIndex );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaListBox::getListIndex() throw (uno::RuntimeException)
-+{
-+    uno::Sequence< sal_Int16 > sSelection;
-+    m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
-+    if ( sSelection.getLength() == 0 )
-+        return uno::Any( sal_Int32( -1 ) );
-+    return uno::Any( sSelection[ 0 ] );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaListBox::getValue() throw (uno::RuntimeException)
-+{
-+    uno::Sequence< sal_Int16 > sSelection;
-+    uno::Sequence< rtl::OUString > sItems;
-+    m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
-+    m_xProps->getPropertyValue( ITEMS ) >>= sItems;
-+    if( getMultiSelect() )
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-+    uno::Any aRet;
-+    if ( sSelection.getLength() )
-+        aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] ); 
-+    return aRet;
-+}
-+
-+void SAL_CALL 
-+ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
-+{
-+    if( getMultiSelect() )
-+    {	
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-+    }
-+    rtl::OUString sValue = getAnyAsString( _value );
-+    uno::Sequence< rtl::OUString > sList;
-+    m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+    uno::Sequence< sal_Int16 > nList;
-+    sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() );
-+    sal_Int16 nValue = -1;
-+    sal_Int16 i = 0;
-+    for( i = 0; i < nLength; i++ )
-+    {
-+        if( sList[i].equals( sValue ) )
-+        {
-+            nValue = i; 
-+            break;
-+        }
-+    }
-+    if( nValue == -1 )
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-+
-+    uno::Sequence< sal_Int16 > nSelectedIndices(1);
-+    nSelectedIndices[ 0 ] = nValue;
-+    m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); 
-+    m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); 
-+}
-+
-+::rtl::OUString SAL_CALL 
-+ScVbaListBox::getText() throw (uno::RuntimeException)
-+{
-+	rtl::OUString result;
-+	getValue() >>= result;
-+	return result;
-+}
-+
-+void SAL_CALL 
-+ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
-+{
-+	setValue( uno::makeAny( _text ) ); // seems the same
-+}
-+
-+sal_Bool SAL_CALL 
-+ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
-+{
-+    sal_Bool bMultiSelect = sal_False;
-+    m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
-+    return bMultiSelect;
-+}
-+
-+void SAL_CALL 
-+ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
-+}
-+
-+css::uno::Any SAL_CALL 
-+ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
-+{
-+    uno::Sequence< rtl::OUString > sList;
-+    m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+    sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
-+    sal_Int16 nIndex( index );
-+    if( nIndex < 0 || nIndex >= nLength )
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Error Number." ), uno::Reference< uno::XInterface >() );
-+    m_nIndex = static_cast< sal_Int16 >( index );
-+    return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
-+}
-+
-+// Methods
-+void SAL_CALL 
-+ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
-+{
-+	mpListHelper->AddItem( pvargItem, pvargIndex );
-+		}
-+
-+void SAL_CALL 
-+ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
-+		{
-+	mpListHelper->removeItem( index );
-+		}
-+
-+void SAL_CALL 
-+ScVbaListBox::Clear(  ) throw (uno::RuntimeException)
-+{
-+	mpListHelper->Clear();
-+}
-+
-+// this is called when something like the following vba code is used
-+// to set the selected state of particular entries in the Listbox
-+// ListBox1.Selected( 3 ) = false
-+//PropListener
-+void 
-+ScVbaListBox::setValueEvent( const uno::Any& value )
-+{
-+    sal_Bool bValue = sal_False;
-+    if( !(value >>= bValue) )
-+        throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
-+    uno::Sequence< sal_Int16 > nList;
-+    m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList;
-+    sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
-+    sal_Int16 nIndex = m_nIndex;
-+    for( sal_Int16 i = 0; i < nLength; i++ )
-+    {
-+        if( nList[i] == nIndex )
-+        {
-+            if( bValue )
-+                return;
-+            else
-+            {
-+                for( ; i < nLength - 1; i++ )
-+                {
-+                    nList[i] = nList[i + 1];
-+                }
-+                nList.realloc( nLength - 1 );
-+                //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+		m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
-+                return;
-+            }
-+        }
-+    }
-+    if( bValue )
-+    {
-+        if( getMultiSelect() )
-+        {
-+            nList.realloc( nLength + 1 );
-+            nList[nLength] = nIndex;
-+        }
-+        else
-+        {
-+            nList.realloc( 1 );
-+            nList[0] = nIndex;
-+        }
-+        m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+    }
-+}
-+
-+// this is called when something like the following vba code is used
-+// to determine the selected state of particular entries in the Listbox
-+// msgbox ListBox1.Selected( 3 )
-+
-+css::uno::Any 
-+ScVbaListBox::getValueEvent()
-+{
-+    uno::Sequence< sal_Int16 > nList;
-+    m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
-+    sal_Int32 nLength = nList.getLength();
-+    sal_Int32 nIndex = m_nIndex;
-+    
-+    for( sal_Int32 i = 0; i < nLength; i++ )
-+    {
-+        if( nList[i] == nIndex )
-+            return uno::makeAny( sal_True );
-+    }
-+
-+    return uno::makeAny( sal_False );
-+}
-+
-+void SAL_CALL
-+ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
-+{
-+	ScVbaControl::setRowSource( _rowsource );
-+	mpListHelper->setRowSource( _rowsource );
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaListBox::getListCount() throw (uno::RuntimeException)
-+{
-+	return mpListHelper->getListCount();
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
-+{
-+	return mpListHelper->List( pvargIndex, pvarColumn );
-+}
-+
-+rtl::OUString& 
-+ScVbaListBox::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaListBox::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbalistbox.hxx oovbaapi/source/msforms/vbalistbox.hxx
-new file mode 100644
-index 0000000..aa74e90
---- /dev/null
-+++ oovbaapi/source/msforms/vbalistbox.hxx
-@@ -0,0 +1,90 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbalistbox.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_LISTBOX_HXX
-+#define SC_VBA_LISTBOX_HXX
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <ooo/vba/msforms/XListBox.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include "vbapropvalue.hxx"
-+#include "vbalistcontrolhelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
-+class ScVbaListBox : public ListBoxImpl_BASE
-+    ,public PropListener
-+{		
-+	std::auto_ptr< ListControlHelper > mpListHelper;
-+	rtl::OUString sSourceName; 
-+	rtl::OUString msDftPropName;
-+
-+    sal_Int16 m_nIndex;
-+	
-+public:
-+	ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
-+
-+	// Attributes
-+	virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+	virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
-+	virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+	virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
-+    virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
-+    virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
-+
-+	// Methods
-+	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
-+	virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
-+	// XControl
-+    virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
-+
-+	// XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+    
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();    
-+
-+    //PropListener
-+    virtual void setValueEvent( const css::uno::Any& value );
-+    virtual css::uno::Any getValueEvent();
-+
-+
-+};
-+
-+#endif //
-diff --git oovbaapi/source/msforms/vbalistcontrolhelper.cxx oovbaapi/source/msforms/vbalistcontrolhelper.cxx
-new file mode 100644
-index 0000000..8582821
---- /dev/null
-+++ oovbaapi/source/msforms/vbalistcontrolhelper.cxx
-@@ -0,0 +1,146 @@
-+#include <vbalistcontrolhelper.hxx>
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-+
-+void SAL_CALL 
-+ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
-+{
-+	if ( pvargItem.hasValue()  )
-+	{
-+		uno::Sequence< rtl::OUString > sList;
-+		m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+
-+		sal_Int32 nIndex = sList.getLength();
-+
-+		if ( pvargIndex.hasValue() )
-+			pvargIndex >>= nIndex;
-+
-+		rtl::OUString sString = getAnyAsString( pvargItem );
-+
-+		// if no index specified or item is to be appended to end of 
-+		// list just realloc the array and set the last item
-+		if ( nIndex  == sList.getLength() )
-+		{
-+			sal_Int32 nOldSize = sList.getLength();
-+			sList.realloc( nOldSize + 1 );
-+			sList[ nOldSize ] = sString; 
-+		}
-+		else
-+		{
-+			// just copy those elements above the one to be inserted
-+			std::vector< rtl::OUString > sVec;
-+			// reserve just the amount we need to copy
-+			sVec.reserve( sList.getLength() - nIndex );
-+
-+			// point at first element to copy
-+			rtl::OUString* pString = sList.getArray() + nIndex;
-+			const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
-+			// insert the new element
-+			sVec.push_back( sString );
-+			// copy elements	
-+			for ( ; pString != pEndString; ++pString )
-+				sVec.push_back( *pString );
-+		
-+			sList.realloc(  sList.getLength() + 1 );
-+
-+			// point at first element to be overwritten
-+			pString = sList.getArray() + nIndex;
-+			pEndString = sList.getArray() + sList.getLength();
-+			std::vector< rtl::OUString >::iterator it = sVec.begin();
-+			for ( ; pString != pEndString; ++pString, ++it)
-+				*pString = *it;	
-+			//
-+		}
-+
-+		m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-+		
-+	}
-+}
-+
-+void SAL_CALL 
-+ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+    sal_Int32 nIndex = 0;
-+    // for int index
-+	if ( index >>= nIndex  )
-+	{
-+		uno::Sequence< rtl::OUString > sList;
-+		m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+        if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
-+            throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
-+        if( sList.hasElements() )
-+        {
-+            if( sList.getLength() == 1 )
-+            {
-+                Clear();
-+                return;
-+            }
-+            for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
-+            {
-+                sList[i] = sList[i+1];
-+            }
-+			sList.realloc(  sList.getLength() - 1 );
-+		}
-+
-+		m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-+	}
-+}
-+
-+void SAL_CALL 
-+ListControlHelper::Clear(  ) throw (uno::RuntimeException)
-+{
-+	// urk, setValue doesn't seem to work !!
-+	//setValue( uno::makeAny( sal_Int16() ) );
-+	m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
-+}
-+
-+void SAL_CALL
-+ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
-+{
-+	if ( _rowsource.getLength() == 0 )
-+		Clear();
-+}
-+
-+sal_Int32 SAL_CALL
-+ListControlHelper::getListCount() throw (uno::RuntimeException)
-+{
-+    uno::Sequence< rtl::OUString > sList;
-+    m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+    return sList.getLength();
-+}
-+
-+uno::Any SAL_CALL 
-+ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
-+{
-+    uno::Sequence< rtl::OUString > sList;
-+    m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+    sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
-+    uno::Any aRet;
-+    if ( pvargIndex.hasValue() )
-+    {
-+        sal_Int16 nIndex = -1;
-+        pvargIndex >>= nIndex;
-+        if( nIndex < 0 || nIndex >= nLength )
-+            throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Bad row Index" ), uno::Reference< uno::XInterface >() );       
-+        aRet <<= sList[ nIndex ];
-+    }
-+    else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
-+            throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+                    "Bad column Index" ), uno::Reference< uno::XInterface >() );       
-+    else // List() ( e.g. no args )
-+    {
-+        uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
-+        for ( sal_Int32 i = 0; i < nLength; ++i )
-+        {
-+            sReturnArray[ i ].realloc( 10 );
-+            sReturnArray[ i ][ 0 ] = sList[ i ];
-+        }        
-+        aRet = uno::makeAny( sReturnArray );
-+    }
-+    return aRet;
-+}
-diff --git oovbaapi/source/msforms/vbalistcontrolhelper.hxx oovbaapi/source/msforms/vbalistcontrolhelper.hxx
-new file mode 100644
-index 0000000..5627d97
---- /dev/null
-+++ oovbaapi/source/msforms/vbalistcontrolhelper.hxx
-@@ -0,0 +1,20 @@
-+#ifndef SC_VBA_LISTCONTROLHELPER
-+#define SC_VBA_LISTCONTROLHELPER
-+
-+#include <oovbaapi/vbahelper.hxx>
-+
-+class ListControlHelper
-+{
-+	css::uno::Reference< css::beans::XPropertySet > m_xProps;
-+
-+public:
-+	ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){}
-+
-+	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);   
-+    	virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
-+	virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
-+	virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
-+};
-+#endif
-diff --git oovbaapi/source/msforms/vbamultipage.cxx oovbaapi/source/msforms/vbamultipage.cxx
-new file mode 100644
-index 0000000..118e005
---- /dev/null
-+++ oovbaapi/source/msforms/vbamultipage.cxx
-@@ -0,0 +1,132 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbamultipage.hxx"
-+#include <ooo/vba/XCollection.hpp>
-+#include "vbapages.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+// uno servicename com.sun.star.awt.UnoControlProgressBarMode
-+const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
-+const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") );
-+const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") );
-+
-+typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base;
-+class PagesImpl : public PagesImpl_Base
-+{
-+	sal_Int32 mnPages;
-+public:
-+	PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {}
-+	virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; }
-+	virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException)
-+	{
-+		if ( Index < 0 || Index > mnPages )
-+			throw lang::IndexOutOfBoundsException();
-+		return uno::makeAny( uno::Reference< uno::XInterface >() );
-+	}
-+	// XElementAccess
-+	virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
-+	{
-+		// no Pages object yet #FIXME
-+		//return msforms::XPage::static_type(0);
-+		return uno::XInterface::static_type(0);
-+	}
-+	virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+	{
-+		return ( mnPages > 0 );
-+	}
-+};
-+uno::Reference< container::XIndexAccess > 
-+ScVbaMultiPage::getPages( sal_Int32 nPages )
-+{
-+	return new PagesImpl( nPages );
-+}
-+
-+ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+    mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
-+    // set dialog step to value of multipage pseudo model
-+    setValue(getValue());
-+}
-+
-+// Attributes
-+sal_Int32 SAL_CALL 
-+ScVbaMultiPage::getValue() throw (css::uno::RuntimeException)
-+{
-+    sal_Int32 nValue = 0;
-+    m_xProps->getPropertyValue( SVALUE ) >>= nValue;
-+    return nValue;
-+}
-+
-+void SAL_CALL 
-+ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    // track change in dialog ( dialog value is 1 based, 0 is a special value )
-+    m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
-+    mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
-+}
-+
-+
-+rtl::OUString& 
-+ScVbaMultiPage::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") );
-+	return sImplName;
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+	sal_Int32 nValue = 0;
-+	m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue;
-+	uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) );
-+	if ( !index.hasValue() )
-+		return uno::makeAny( xColl );
-+	return xColl->Item( uno::makeAny( index ), uno::Any() );
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaMultiPage::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbamultipage.hxx oovbaapi/source/msforms/vbamultipage.hxx
-new file mode 100644
-index 0000000..a01f2a1
---- /dev/null
-+++ oovbaapi/source/msforms/vbamultipage.hxx
-@@ -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 SC_VBA_MULTIPAGE_HXX
-+#define SC_VBA_MULTIPAGE_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XMultiPage.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+//#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE;
-+
-+class ScVbaMultiPage : public MultiPageImpl_BASE
-+{
-+    css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages );
-+    css::uno::Reference< css::beans::XPropertySet > mxDialogProps;
-+public:
-+    ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog );
-+   // Attributes
-+    virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const sal_Int32 _value ) throw (css::uno::RuntimeException);
-+    virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+    // XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_LABEL_HXX
-diff --git oovbaapi/source/msforms/vbapages.cxx oovbaapi/source/msforms/vbapages.cxx
-new file mode 100644
-index 0000000..db28086
---- /dev/null
-+++ oovbaapi/source/msforms/vbapages.cxx
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbapages.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages )
-+{
-+}
-+
-+uno::Type SAL_CALL 
-+ScVbaPages::getElementType() throw (uno::RuntimeException)
-+{
-+	// return msforms::XPage::static_type(0); 
-+	return uno::XInterface::static_type(0); 
-+}
-+
-+uno::Any 
-+ScVbaPages::createCollectionObject( const css::uno::Any& aSource )
-+{
-+	return aSource;
-+}
-+
-+rtl::OUString& 
-+ScVbaPages::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") );
-+	return sImplName;
-+}
-+
-+uno::Reference< container::XEnumeration > SAL_CALL 
-+ScVbaPages::createEnumeration() throw (uno::RuntimeException)
-+{
-+	return uno::Reference< container::XEnumeration >();
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaPages::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbapages.hxx oovbaapi/source/msforms/vbapages.hxx
-new file mode 100644
-index 0000000..bf71e86
---- /dev/null
-+++ oovbaapi/source/msforms/vbapages.hxx
-@@ -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 SC_VBA_PAGES_HXX
-+#define SC_VBA_PAGES_HXX
-+
-+#include <ooo/vba/office/MsoShapeType.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/msforms/XPages.hpp>
-+#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include <oovbaapi/vbacollectionimpl.hxx>
-+typedef CollTestImplHelper< 
-+ov::msforms::XPages > ScVbaPages_BASE;
-+
-+class ScVbaPages : public ScVbaPages_BASE
-+{
-+protected:
-+	virtual rtl::OUString& getServiceImplName();
-+	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+public:
-+    ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException );
-+    virtual ~ScVbaPages() {}
-+        // XEnumerationAccess
-+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
-+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-+     // ScVbaPages_BASE
-+     virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+
-+};
-+#endif//SC_VBA_SHAPE_HXX
-diff --git oovbaapi/source/msforms/vbaprogressbar.cxx oovbaapi/source/msforms/vbaprogressbar.cxx
-new file mode 100644
-index 0000000..77f3eca
---- /dev/null
-+++ oovbaapi/source/msforms/vbaprogressbar.cxx
-@@ -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
-+ *
-+ ************************************************************************/
-+#include "vbaprogressbar.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+// uno servicename com.sun.star.awt.UnoControlProgressBarMode
-+const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
-+
-+ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+uno::Any SAL_CALL 
-+ScVbaProgressBar::getValue() throw (css::uno::RuntimeException)
-+{
-+    return m_xProps->getPropertyValue( SVALUE );
-+}
-+
-+void SAL_CALL 
-+ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SVALUE,  _value );
-+}
-+
-+rtl::OUString& 
-+ScVbaProgressBar::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaProgressBar::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbaprogressbar.hxx oovbaapi/source/msforms/vbaprogressbar.hxx
-new file mode 100644
-index 0000000..d1adcf4
---- /dev/null
-+++ oovbaapi/source/msforms/vbaprogressbar.hxx
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ *  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_PROGRESSBAR_HXX
-+#define SC_VBA_PROGRESSBAR_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XProgressBar.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty  > ProgressBarImpl_BASE;
-+
-+class ScVbaProgressBar : public ProgressBarImpl_BASE
-+{
-+public:
-+    ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+    // XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_LABEL_HXX
-diff --git oovbaapi/source/msforms/vbaradiobutton.cxx oovbaapi/source/msforms/vbaradiobutton.cxx
-new file mode 100644
-index 0000000..5aa9d20
---- /dev/null
-+++ oovbaapi/source/msforms/vbaradiobutton.cxx
-@@ -0,0 +1,107 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaradiobutton.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaradiobutton.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
-+ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+rtl::OUString SAL_CALL 
-+ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException)
-+{
-+    rtl::OUString Label;
-+    m_xProps->getPropertyValue( LABEL ) >>= Label;
-+    return Label;
-+}
-+
-+void SAL_CALL 
-+ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaRadioButton::getValue() throw (css::uno::RuntimeException)
-+{
-+    sal_Int16 nValue = -1;
-+    m_xProps->getPropertyValue( STATE ) >>= nValue;
-+    if( nValue != 0 )
-+        nValue = -1;
-+//    return uno::makeAny( nValue ); 
-+// I must be missing something MSO says value should be -1 if selected, 0 if not
-+// selected
-+    return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); 
-+
-+}
-+
-+void SAL_CALL 
-+ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
-+{
-+    sal_Int16 nValue = 0;
-+    sal_Bool bValue = sal_False;
-+    if( _value >>= nValue )
-+    {
-+        if( nValue == -1)
-+        nValue = 1;
-+    }
-+    else if ( _value >>= bValue )
-+    {
-+        if ( bValue )
-+            nValue = 1;
-+    }
-+    m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+}
-+
-+rtl::OUString& 
-+ScVbaRadioButton::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaRadioButton::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbaradiobutton.hxx oovbaapi/source/msforms/vbaradiobutton.hxx
-new file mode 100644
-index 0000000..2924d83
---- /dev/null
-+++ oovbaapi/source/msforms/vbaradiobutton.hxx
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaradiobutton.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_RADIOBUTTON_HXX
-+#define SC_VBA_RADIOBUTTON_HXX
-+#include <ooo/vba/msforms/XRadioButton.hpp>
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE;
-+
-+class ScVbaRadioButton : public RadioButtonImpl_BASE
-+{
-+public:
-+    ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
-+   // 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 css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+    // XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+
-+};
-+#endif //SC_VBA_RADIOBUTTON_HXX
-diff --git oovbaapi/source/msforms/vbascrollbar.cxx oovbaapi/source/msforms/vbascrollbar.cxx
-new file mode 100644
-index 0000000..e754903
---- /dev/null
-+++ oovbaapi/source/msforms/vbascrollbar.cxx
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbascrollbar.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") );
-+const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") );
-+const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
-+const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") );
-+const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") );
-+const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") );
-+
-+ScVbaScrollBar::ScVbaScrollBar(  const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+uno::Any SAL_CALL 
-+ScVbaScrollBar::getValue() throw (css::uno::RuntimeException)
-+{
-+    return  m_xProps->getPropertyValue( SCROLLVALUE );
-+}
-+
-+void SAL_CALL 
-+ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SCROLLVALUE, _value );
-+}
-+
-+::sal_Int32 SAL_CALL 
-+ScVbaScrollBar::getMax() throw (uno::RuntimeException)
-+{
-+    sal_Int32 nMax = 0;
-+    m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax;
-+    return nMax;
-+}
-+
-+void SAL_CALL 
-+ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); 
-+}
-+
-+::sal_Int32 SAL_CALL 
-+ScVbaScrollBar::getMin() throw (uno::RuntimeException)
-+{
-+    sal_Int32 nVal = 0;
-+    m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal;
-+    return nVal;
-+}
-+
-+void SAL_CALL 
-+ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); 
-+}
-+
-+void SAL_CALL 
-+ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) );
-+}
-+
-+::sal_Int32 SAL_CALL 
-+ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException)
-+{
-+    sal_Int32 nVal = 0;
-+    m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal;
-+    return nVal;
-+}
-+
-+::sal_Int32 SAL_CALL 
-+ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException)
-+{
-+    sal_Int32 nSmallChange = 0;
-+    m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange;
-+    return nSmallChange;
-+}
-+
-+void SAL_CALL 
-+ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) );
-+}
-+
-+rtl::OUString& 
-+ScVbaScrollBar::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaScrollBar::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbascrollbar.hxx oovbaapi/source/msforms/vbascrollbar.hxx
-new file mode 100644
-index 0000000..33fbcfb
---- /dev/null
-+++ oovbaapi/source/msforms/vbascrollbar.hxx
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ *  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_SCROLLBAR_HXX
-+#define SC_VBA_SCROLLBAR_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XScrollBar.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE;
-+
-+class ScVbaScrollBar : public ScrollBarImpl_BASE
-+{
-+public:
-+    ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
-+    virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
-+    virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException);
-+    virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException);
-+
-+
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_LABEL_HXX
-diff --git oovbaapi/source/msforms/vbaspinbutton.cxx oovbaapi/source/msforms/vbaspinbutton.cxx
-new file mode 100644
-index 0000000..05b6777
---- /dev/null
-+++ oovbaapi/source/msforms/vbaspinbutton.cxx
-@@ -0,0 +1,109 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbaspinbutton.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
-+const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") );
-+const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") );
-+const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") );
-+
-+ScVbaSpinButton::ScVbaSpinButton(  const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+}
-+
-+// Attributes
-+uno::Any SAL_CALL 
-+ScVbaSpinButton::getValue() throw (css::uno::RuntimeException)
-+{
-+    return  m_xProps->getPropertyValue( SPINVALUE );
-+}
-+
-+void SAL_CALL 
-+ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SPINVALUE, _value );
-+}
-+
-+::sal_Int32 SAL_CALL 
-+ScVbaSpinButton::getMax() throw (uno::RuntimeException)
-+{
-+    sal_Int32 nMax = 0;
-+    m_xProps->getPropertyValue( SPINMAX ) >>= nMax;
-+    return nMax;
-+}
-+
-+void SAL_CALL 
-+ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); 
-+}
-+
-+::sal_Int32 SAL_CALL 
-+ScVbaSpinButton::getMin() throw (uno::RuntimeException)
-+{
-+    sal_Int32 nVal = 0;
-+    m_xProps->getPropertyValue( SPINMIN ) >>= nVal;
-+    return nVal;
-+}
-+
-+void SAL_CALL 
-+ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); 
-+}
-+
-+rtl::OUString& 
-+ScVbaSpinButton::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaSpinButton::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbaspinbutton.hxx oovbaapi/source/msforms/vbaspinbutton.hxx
-new file mode 100644
-index 0000000..fb876e5
---- /dev/null
-+++ oovbaapi/source/msforms/vbaspinbutton.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ *  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_SPINBUTTON_HXX
-+#define SC_VBA_SPINBUTTON_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XSpinButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE;
-+
-+class ScVbaSpinButton : public SpinButtonImpl_BASE
-+{
-+public:
-+    ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
-+    virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
-+
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_SPINBUTTON_HXX
-diff --git oovbaapi/source/msforms/vbatextbox.cxx oovbaapi/source/msforms/vbatextbox.cxx
-new file mode 100644
-index 0000000..d246970
---- /dev/null
-+++ oovbaapi/source/msforms/vbatextbox.cxx
-@@ -0,0 +1,137 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbatextbox.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+#include "vbatextbox.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+
-+ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
-+{
-+}
-+
-+// Attributes
-+uno::Any SAL_CALL 
-+ScVbaTextBox::getValue() throw (css::uno::RuntimeException)
-+{
-+	return uno::makeAny( getText() );
-+}
-+
-+void SAL_CALL 
-+ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
-+{
-+	rtl::OUString sVal = getAnyAsString( _value );
-+	setText( sVal );
-+}
-+
-+//getString() will cause some imfo lose.
-+rtl::OUString SAL_CALL 
-+ScVbaTextBox::getText() throw (css::uno::RuntimeException)
-+{
-+    uno::Any aValue;
-+    aValue = m_xProps->getPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
-+    rtl::OUString sString;
-+    aValue >>= sString;
-+    return sString;
-+}
-+
-+void SAL_CALL 
-+ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
-+{
-+    if ( !mbDialog )
-+    {
-+    uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
-+    xTextRange->setString( _text );
-+}
-+    else
-+        m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) ); 
-+}
-+
-+sal_Int32 SAL_CALL 
-+ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
-+{
-+    uno::Any aValue;
-+    aValue = m_xProps->getPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) );
-+    sal_Int32 nMaxLength = 0;
-+    aValue >>= nMaxLength;
-+    return nMaxLength;
-+}
-+
-+void SAL_CALL 
-+ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
-+{
-+    uno::Any aValue( _maxlength );
-+    m_xProps->setPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
-+}
-+
-+sal_Bool SAL_CALL 
-+ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException)
-+{
-+    uno::Any aValue;
-+    aValue = m_xProps->getPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) );
-+    sal_Bool bRet = false;
-+    aValue >>= bRet;
-+    return bRet;
-+}
-+
-+void SAL_CALL 
-+ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException)
-+{
-+    uno::Any aValue( _multiline );
-+    m_xProps->setPropertyValue
-+            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
-+}
-+
-+rtl::OUString& 
-+ScVbaTextBox::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaTextBox::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) );
-+	}
-+	return aServiceNames;
-+}
-diff --git oovbaapi/source/msforms/vbatextbox.hxx oovbaapi/source/msforms/vbatextbox.hxx
-new file mode 100644
-index 0000000..90cecd0
---- /dev/null
-+++ oovbaapi/source/msforms/vbatextbox.hxx
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbatextbox.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_TEXTBOX_HXX
-+#define SC_VBA_TEXTBOX_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XTextBox.hpp>
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
-+
-+class ScVbaTextBox : public TextBoxImpl_BASE
-+{
-+    bool mbDialog;
-+public:
-+    ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false );
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+    virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException);
-+    virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException);
-+    virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_TEXTBOX_HXX
-diff --git oovbaapi/source/msforms/vbatogglebutton.cxx oovbaapi/source/msforms/vbatogglebutton.cxx
-new file mode 100644
-index 0000000..f938ad1
---- /dev/null
-+++ oovbaapi/source/msforms/vbatogglebutton.cxx
-@@ -0,0 +1,108 @@
-+/*************************************************************************
-+ *
-+ *  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 "vbatogglebutton.hxx"
-+#include <vector>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") );
-+const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
-+ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
-+{
-+    OSL_TRACE("ScVbaToggleButton(ctor)");
-+    m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) );
-+}
-+
-+ScVbaToggleButton::~ScVbaToggleButton()
-+{
-+    OSL_TRACE("~ScVbaToggleButton(dtor)");
-+}
-+
-+// Attributes
-+rtl::OUString SAL_CALL 
-+ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException)
-+{
-+    rtl::OUString Label;
-+    m_xProps->getPropertyValue( LABEL ) >>= Label;
-+    return Label;
-+}
-+
-+void SAL_CALL 
-+ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-+}
-+
-+uno::Any SAL_CALL 
-+ScVbaToggleButton::getValue() throw (uno::RuntimeException)
-+{
-+	sal_Int16 nState = 0;
-+    	m_xProps->getPropertyValue( STATE ) >>= nState;
-+ 	return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
-+}
-+
-+void SAL_CALL 
-+ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
-+{
-+	sal_Int16 nState = 0;
-+	_value >>= nState;
-+        OSL_TRACE( "nState - %d", nState );
-+	nState = ( nState == -1 ) ?  1 : 0;
-+        OSL_TRACE( "nState - %d", nState );
-+	m_xProps->setPropertyValue( STATE, uno::makeAny(  nState ) );
-+}
-+
-+rtl::OUString& 
-+ScVbaToggleButton::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") );
-+	return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString > 
-+ScVbaToggleButton::getServiceNames()
-+{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
-+	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) );
-+	}
-+	return aServiceNames;
-+}
-+
-diff --git oovbaapi/source/msforms/vbatogglebutton.hxx oovbaapi/source/msforms/vbatogglebutton.hxx
-new file mode 100644
-index 0000000..dd9761a
---- /dev/null
-+++ oovbaapi/source/msforms/vbatogglebutton.hxx
-@@ -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 SC_VBA_TOGGLEBUTTON_HXX
-+#define SC_VBA_TOGGLEBUTTON_HXX
-+#include <cppuhelper/implbase2.hxx>
-+#include <ooo/vba/msforms/XToggleButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty  > ToggleButtonImpl_BASE;
-+
-+class ScVbaToggleButton : public ToggleButtonImpl_BASE
-+{
-+	rtl::OUString msDftPropName;
-+public:
-+    ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
-+    ~ScVbaToggleButton();
-+   // Attributes
-+    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-+
-+    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
-+    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
-+    //XHelperInterface
-+    virtual rtl::OUString& getServiceImplName();
-+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+    // XDefaultProperty
-+    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_TOGGLEBUTTON_HXX
-diff --git oovbaapi/source/vbahelper/makefile.mk oovbaapi/source/vbahelper/makefile.mk
-new file mode 100644
-index 0000000..8493a79
---- /dev/null
-+++ oovbaapi/source/vbahelper/makefile.mk
-@@ -0,0 +1,58 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.45 $
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org 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 version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..
-+PRJNAME=oovbaapi
-+TARGET=vbahelper
-+
-+ENABLE_EXCEPTIONS := TRUE
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE :  settings.mk
-+
-+SLOFILES=\
-+    $(SLO)$/vbahelper.obj \
-+    $(SLO)$/vbapropvalue.obj \
-+
-+# --- Targets -------------------------------------------------------
-+
-+.INCLUDE :  target.mk
-+
-+ALLTAR : \
-+        $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(UCR)$/oovbaapi.db
-+        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(UCR)$/oovbaapi.db -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+        echo $@
-+
-diff --git oovbaapi/source/vbahelper/vbahelper.cxx oovbaapi/source/vbahelper/vbahelper.cxx
-new file mode 100644
-index 0000000..41a7288
---- /dev/null
-+++ oovbaapi/source/vbahelper/vbahelper.cxx
-@@ -0,0 +1,837 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbahelper.cxx,v $
-+ * $Revision: 1.5.32.1 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <cppuhelper/bootstrap.hxx>
-+#include <com/sun/star/util/XURLTransformer.hpp>
-+#include <com/sun/star/frame/XDispatchProvider.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/XIntrospection.hpp>
-+
-+#include <comphelper/processfactory.hxx>
-+
-+#include <sfx2/objsh.hxx>
-+#include <sfx2/viewfrm.hxx>
-+#include <sfx2/dispatch.hxx>
-+#include <sfx2/app.hxx>
-+#include <svtools/stritem.hxx>
-+#include <svtools/eitem.hxx>
-+#include <svtools/intitem.hxx>
-+#include <svtools/itemset.hxx>
-+//#include <svtools/itempool.hxx>
-+#include <sfx2/docfac.hxx>
-+#include <sfx2/viewfac.hxx>
-+
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <rtl/math.hxx>
-+#include <sfx2/viewsh.hxx>
-+#include <math.h>
-+
-+
-+#ifndef OOVBA_DLLIMPLEMENTATION
-+#define OOVBA_DLLIMPLEMENTATION
-+#endif 
-+
-+#include <oovbaapi/vbahelper.hxx>
-+#include <sfx2/app.hxx>
-+// #FIXME needs service
-+//#include "vbashape.hxx"
-+//#include "unonames.hxx"
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define NAME_HEIGHT "Height"
-+#define NAME_WIDTH "Width"
-+
-+#define POINTTO100THMILLIMETERFACTOR 35.27778
-+
-+void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
-+
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
-+
-+
-+namespace ooo
-+{
-+namespace vba
-+{
-+// helper method to determine if the view ( calc ) is in print-preview mode
-+bool isInPrintPreview( SfxViewFrame* pView )
-+{
-+	sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
-+	if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
-+nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
-+	{
-+		SfxViewFactory &rViewFactory =
-+			pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
-+		if (  pView->GetCurViewId() == rViewFactory.GetOrdinal() )
-+			return true;
-+	}
-+	return false;
-+}
-+#if 0
-+namespace excel // all in this namespace probably can be moved to sc
-+{
-+
-+
-+const ::rtl::OUString REPLACE_CELLS_WARNING(  RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
-+class PasteCellsWarningReseter
-+{
-+private:
-+	bool bInitialWarningState;
-+	static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
-+	{
-+		static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+		static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+		static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-+				xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+		static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
-+		return xProps;
-+	}
-+
-+	bool getReplaceCellsWarning() throw ( uno::RuntimeException )
-+	{
-+		sal_Bool res = sal_False;
-+		getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
-+		return ( res == sal_True );
-+	}
-+
-+	void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
-+	{
-+		getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
-+	}
-+public:
-+	PasteCellsWarningReseter() throw ( uno::RuntimeException )
-+	{
-+		bInitialWarningState = getReplaceCellsWarning();
-+		if ( bInitialWarningState )
-+			setReplaceCellsWarning( false );
-+	}
-+	~PasteCellsWarningReseter()
-+	{
-+		if ( bInitialWarningState )
-+		{
-+			// don't allow dtor to throw
-+			try
-+			{
-+				setReplaceCellsWarning( true );
-+			}
-+			catch ( uno::Exception& /*e*/ ){}
-+		}
-+	}
-+};
-+
-+void
-+implnPaste()
-+{
-+	PasteCellsWarningReseter resetWarningBox;
-+	ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+	if ( pViewShell )
-+	{
-+		pViewShell->PasteFromSystem();
-+		pViewShell->CellContentChanged();
-+	}
-+}
-+
-+
-+void
-+implnCopy()
-+{
-+	ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+	if ( pViewShell )
-+		pViewShell->CopyToClip(NULL,false,false,true);
-+}
-+
-+void 
-+implnCut()
-+{
-+	ScTabViewShell* pViewShell =  getCurrentBestViewShell();
-+	if ( pViewShell )
-+		pViewShell->CutToClip( NULL, TRUE );
-+}
-+void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
-+{
-+	PasteCellsWarningReseter resetWarningBox;
-+	sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
-+	InsCellCmd eMoveMode = INS_NONE;
-+
-+	if ( !pTabViewShell ) 
-+		// none active, try next best
-+		pTabViewShell = getCurrentBestViewShell();
-+	if ( pTabViewShell )
-+	{
-+		ScViewData* pView = pTabViewShell->GetViewData();	
-+		Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
-+		if ( pView && pWin )
-+		{
-+			if ( bAsLink && bOtherDoc )
-+				pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
-+			else 
-+			{
-+				ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
-+				ScDocument* pDoc = NULL; 
-+				if ( pOwnClip )
-+					pDoc = pOwnClip->GetDocument();	
-+				pTabViewShell->PasteFromClip( nFlags, pDoc,
-+					nFunction, bSkipEmpty, bTranspose, bAsLink,
-+					eMoveMode, IDF_NONE, TRUE );
-+				pTabViewShell->CellContentChanged();
-+			}
-+		}
-+	}
-+
-+}
-+
-+ScDocShell* 
-+getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) 
-+{
-+	uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
-+	ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
-+	ScDocShell* pDocShell = NULL;
-+	if ( pModel )
-+		pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
-+	return pDocShell;
-+
-+}
-+
-+ScTabViewShell* 
-+getBestViewShell(  css::uno::Reference< css::frame::XModel>& xModel )
-+{
-+	ScDocShell* pDocShell = getDocShell( xModel );
-+	if ( pDocShell )
-+		return pDocShell->GetBestViewShell();
-+	return NULL;
-+}
-+
-+ScTabViewShell* 
-+getCurrentBestViewShell()
-+{ 
-+	uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+	return getBestViewShell( xModel );
-+}
-+
-+SfxViewFrame* 
-+getCurrentViewFrame()
-+{
-+	ScTabViewShell* pViewShell = getCurrentBestViewShell();	
-+	if ( pViewShell )
-+		return pViewShell->GetViewFrame();
-+	return NULL;
-+}
-+};
-+
-+#endif
-+const double Millimeter::factor =  35.27778;
-+
-+uno::Reference< beans::XIntrospectionAccess >
-+getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
-+{
-+	static uno::Reference< beans::XIntrospection > xIntrospection;
-+	if( !xIntrospection.is() )
-+	{
-+		uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+		xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
-+	}
-+	return xIntrospection->inspect( aObject );
-+}
-+
-+uno::Reference< script::XTypeConverter >
-+getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
-+{
-+	static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
-+	return xTypeConv;
-+}
-+const uno::Any&
-+aNULL()
-+{
-+ 	static  uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
-+	return aNULLL;
-+}
-+
-+void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
-+{
-+	SfxViewFrame* pViewFrame = NULL;
-+	if ( pViewShell )
-+		pViewFrame = pViewShell->GetViewFrame();
-+	if ( pViewFrame )
-+	{
-+		SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-+		if( pDispatcher )
-+		{
-+			pDispatcher->Execute( nSlot , nCall );
-+		}
-+	}	
-+}
-+	
-+void
-+dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
-+{
-+
-+	util::URL  url ;
-+	url.Complete = aUrl;
-+	rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
-+	uno::Reference<frame::XController> xController = xModel->getCurrentController();
-+	uno::Reference<frame::XFrame> xFrame = xController->getFrame();
-+	uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
-+	try
-+	{
-+		uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+		uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW  );
-+		if ( !xContext.is() )
-+		{
-+			return ;
-+		}
-+
-+		uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-+				xContext->getServiceManager() );
-+		if ( !xServiceManager.is() )
-+		{
-+			return ;
-+		}
-+		uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext(     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
-+			,xContext), uno::UNO_QUERY_THROW );
-+		if (!xParser.is())
-+			return;
-+		xParser->parseStrict (url);
-+	}
-+	catch ( uno::Exception & /*e*/ )
-+	{
-+		return ;
-+	}
-+
-+	uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
-+
-+	uno::Sequence<beans::PropertyValue> dispatchProps(1);
-+
-+	sal_Int32 nProps = sProps.getLength();
-+	beans::PropertyValue* pDest = dispatchProps.getArray();
-+	if ( nProps )
-+	{
-+		dispatchProps.realloc( nProps + 1 );
-+		// need to reaccquire pDest after realloc
-+		pDest = dispatchProps.getArray();
-+		beans::PropertyValue* pSrc = sProps.getArray();
-+		for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
-+			*pDest = *pSrc;
-+	}
-+
-+	(*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-+	(*pDest).Value <<= (sal_Bool)sal_True;
-+
-+	if (xDispatcher.is())
-+		xDispatcher->dispatch( url, dispatchProps );
-+}
-+
-+void
-+dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) 
-+{
-+	uno::Sequence<beans::PropertyValue> dispatchProps;
-+	dispatchRequests( xModel, aUrl, dispatchProps );
-+}
-+
-+
-+
-+ uno::Reference< frame::XModel > 
-+getCurrentDocument() throw (uno::RuntimeException)
-+{
-+	uno::Reference< frame::XModel > xModel;
-+	SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
-+	SbxObject* basicChosen =  pBasic ;
-+	if ( basicChosen == NULL)
-+	{
-+		OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
-+		return xModel;
-+	}    
-+    SbxObject* p = pBasic;
-+    SbxObject* pParent = p->GetParent();
-+    SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
-+
-+    if( pParentParent )
-+    {
-+        basicChosen = pParentParent;
-+    }
-+    else if( pParent )
-+    {
-+        basicChosen = pParent;
-+    }
-+
-+
-+    uno::Any aModel; 
-+    SbxVariable *pCompVar = basicChosen->Find(  UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
-+
-+	if ( pCompVar )
-+	{
-+		aModel = sbxToUnoValue( pCompVar );
-+		if ( sal_False == ( aModel >>= xModel ) ||
-+			!xModel.is() )
-+		{
-+			// trying last gasp try the current component
-+			uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+			// test if vba service is present
-+			uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+			uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
-+			uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
-+			xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
-+			if ( !xModel.is() )
-+			{
-+				throw uno::RuntimeException( 
-+					rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
-+			}
-+			return xModel;
-+		}
-+		else
-+		{
-+			OSL_TRACE("Have model ThisComponent points to url %s",
-+			::rtl::OUStringToOString( xModel->getURL(),
-+				RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-+		}
-+	}
-+	else
-+	{
-+		OSL_TRACE("Failed to get ThisComponent");
-+		throw uno::RuntimeException( 
-+			rtl::OUString( 
-+				RTL_CONSTASCII_USTRINGPARAM(
-+					"Can't determine the currently selected document") ),
-+			uno::Reference< uno::XInterface >() );
-+	}
-+	return xModel;
-+}
-+
-+sal_Int32 
-+OORGBToXLRGB( sal_Int32 nCol )
-+{
-+	sal_Int32 nRed = nCol;
-+	nRed &= 0x00FF0000;
-+	nRed >>= 16;
-+	sal_Int32 nGreen = nCol;
-+	nGreen &= 0x0000FF00;
-+	nGreen >>= 8;
-+	sal_Int32 nBlue = nCol;
-+	nBlue &= 0x000000FF;
-+	sal_Int32 nRGB =  ( (nBlue << 16) | (nGreen << 8) | nRed );
-+	return nRGB;
-+}
-+sal_Int32 
-+XLRGBToOORGB( sal_Int32 nCol )
-+{
-+	sal_Int32 nBlue = nCol;
-+	nBlue &= 0x00FF0000;
-+	nBlue >>= 16;
-+	sal_Int32 nGreen = nCol;
-+	nGreen &= 0x0000FF00;
-+	nGreen >>= 8;
-+	sal_Int32 nRed = nCol;
-+	nRed &= 0x000000FF;
-+	sal_Int32 nRGB =  ( (nRed << 16) | (nGreen << 8) | nBlue );
-+	return nRGB;
-+}
-+uno::Any 
-+OORGBToXLRGB( const uno::Any& aCol )
-+{
-+	sal_Int32 nCol;
-+	aCol >>= nCol;
-+	nCol = OORGBToXLRGB( nCol );
-+	return uno::makeAny( nCol );
-+}
-+uno::Any 
-+XLRGBToOORGB(  const uno::Any& aCol )
-+{
-+	sal_Int32 nCol;
-+	aCol >>= nCol;
-+	nCol = XLRGBToOORGB( nCol );
-+	return uno::makeAny( nCol );
-+}
-+
-+void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection  )
-+{
-+	sal_Int32 nTo = 0;
-+	sal_Int32 nFrom = 0;
-+	sal_Int16 nCopies = 1;
-+	sal_Bool bPreview = sal_False;
-+	sal_Bool bCollate = sal_False;
-+	sal_Bool bSelection = bUseSelection;
-+	From >>= nFrom;
-+	To >>= nTo;
-+	Copies >>= nCopies;
-+	Preview >>= bPreview;
-+	if ( nCopies > 1 ) // Collate only useful when more that 1 copy
-+		Collate >>= bCollate;
-+
-+	rtl::OUString sRange(  RTL_CONSTASCII_USTRINGPARAM( "-" ) );
-+	rtl::OUString sFileName;
-+	
-+	if (( nFrom || nTo ) )
-+	{
-+		if ( nFrom )
-+			sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
-+		if ( nTo )
-+			sRange += ::rtl::OUString::valueOf( nTo );
-+	}
-+
-+	if (  PrToFileName.getValue() )
-+	{
-+		PrToFileName >>= sFileName;
-+	}
-+	SfxViewFrame* pViewFrame = NULL;
-+	if ( pViewShell )
-+		pViewFrame = pViewShell->GetViewFrame();
-+	if ( pViewFrame )
-+	{
-+		SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-+				
-+		SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
-+		aArgs.Put( sfxCollate, sfxCollate.Which() );
-+		SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
-+		aArgs.Put( sfxCopies, sfxCopies.Which() );
-+		if ( sFileName.getLength() )
-+		{
-+			SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
-+			aArgs.Put( sfxFileName, sfxFileName.Which() );
-+		
-+		}
-+		if (  sRange.getLength() )
-+		{
-+			SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
-+			aArgs.Put( sfxRange, sfxRange.Which() );
-+		}
-+		SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
-+		aArgs.Put( sfxSelection, sfxSelection.Which() );
-+		SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-+		aArgs.Put( sfxAsync, sfxAsync.Which() );
-+		SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-+
-+		if ( pDispatcher )
-+		{
-+			if ( bPreview )
-+			{
-+				if ( !pViewFrame->GetFrame()->IsInPlace() ) 	
-+				{
-+					// #TODO is this necessary ( calc specific )
-+//					SC_MOD()->InputEnterHandler();
-+					pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
-+					while ( isInPrintPreview( pViewFrame ) )
-+						Application::Yield();
-+				}
-+			}
-+			else
-+				pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-+		}
-+			
-+	}
-+	
-+	// #FIXME #TODO
-+	// 1 ActivePrinter ( how/can we switch a printer via API? )
-+	// 2 PrintToFile ( ms behaviour if this option is specified but no 
-+	//   filename supplied 'PrToFileName' then the user will be prompted )
-+	// 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
-+	//    values ) in oOO these options are mutually exclusive
-+	// 4 There is a pop up to do with transparent objects in the print source
-+	//   should be able to disable that via configuration for the duration
-+	//   of this method
-+}
-+
-+ void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell )
-+{
-+	dispatchExecute( pViewShell, SID_VIEWSHELL1 );
-+}
-+
-+rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
-+{
-+	uno::Type aType = pvargItem.getValueType();
-+	uno::TypeClass eTypeClass = aType.getTypeClass();
-+	rtl::OUString sString;
-+	switch ( eTypeClass )
-+	{
-+		case uno::TypeClass_BOOLEAN:
-+		{
-+			sal_Bool bBool = sal_False;
-+			pvargItem >>= bBool;
-+			sString = rtl::OUString::valueOf( bBool );
-+			break;
-+		}
-+		case uno::TypeClass_STRING:
-+			pvargItem >>= sString;
-+			break;
-+		case uno::TypeClass_FLOAT:
-+			{
-+				float aFloat = 0;
-+				pvargItem >>= aFloat;
-+				sString = rtl::OUString::valueOf( aFloat );
-+				break;
-+			}
-+		case uno::TypeClass_DOUBLE:
-+			{
-+				double aDouble = 0;
-+				pvargItem >>= aDouble;
-+				sString = rtl::OUString::valueOf( aDouble );
-+				break;
-+			}
-+		case uno::TypeClass_SHORT:
-+		case uno::TypeClass_LONG:
-+		case uno::TypeClass_BYTE:
-+			{
-+				sal_Int32 aNum = 0;
-+				pvargItem >>= aNum;
-+				sString = rtl::OUString::valueOf( aNum );
-+				break;
-+			}
-+
-+		case uno::TypeClass_HYPER:
-+			{
-+				sal_Int64 aHyper = 0;
-+				pvargItem >>= aHyper;
-+				sString = rtl::OUString::valueOf( aHyper );
-+				break;
-+			}
-+		default:
-+       			throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
-+	}
-+	return sString;
-+}
-+
-+
-+rtl::OUString 
-+ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >&  _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
-+{
-+	return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
-+}
-+
-+rtl::OUString 
-+ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
-+{
-+	sal_Int32 a = _nStartSuffix;
-+	rtl::OUString scompname = _sElementName;
-+	bool bElementexists = true;
-+	sal_Int32 nLen = _slist.getLength();
-+	if ( nLen == 0 )
-+		return _sElementName;
-+
-+	while (bElementexists == true) 
-+	{
-+		for (sal_Int32 i = 0; i < nLen; i++)
-+		{
-+			if (FieldInList(_slist, scompname) == -1)
-+			{
-+				return scompname;
-+			}
-+		}
-+		scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
-+	}
-+	return rtl::OUString();
-+}
-+
-+sal_Int32 
-+ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
-+{
-+	sal_Int32 FieldLen = SearchList.getLength();
-+	sal_Int32 retvalue = -1;
-+	for (sal_Int32 i = 0; i < FieldLen; i++) 
-+	{
-+		// I wonder why comparing lexicographically is done
-+		// when its a match is whats interesting?
-+		//if (SearchList[i].compareTo(SearchString) == 0) 
-+		if ( SearchList[i].equals( SearchString ) ) 
-+		{
-+			retvalue = i;
-+			break;
-+		}
-+	}
-+	return retvalue;
-+
-+}
-+bool NeedEsc(sal_Unicode cCode)
-+{
-+	String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
-+	return (STRING_NOTFOUND != sEsc.Search(cCode));
-+}
-+
-+rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
-+{
-+	rtl::OUStringBuffer sResult;
-+	const sal_Unicode *start = rIn.getStr();
-+	const sal_Unicode *end = start + rIn.getLength();
-+
-+	int seenright = 0;
-+	if ( bForLike )
-+		sResult.append(static_cast<sal_Unicode>('^'));
-+
-+	while (start < end) 
-+	{
-+		switch (*start)
-+		{
-+			case '?':
-+				sResult.append(static_cast<sal_Unicode>('.'));
-+				start++;
-+				break;
-+			case '*':
-+				sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
-+				start++;
-+				break;
-+			case '#':
-+				sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
-+				start++;
-+				break;
-+			case '~':
-+				sResult.append(static_cast<sal_Unicode>('\\'));
-+				sResult.append(*(++start));
-+				start++;
-+				break;
-+				// dump the ~ and escape the next characture
-+			case ']':
-+				sResult.append(static_cast<sal_Unicode>('\\'));
-+				sResult.append(*start++);
-+				break;
-+			case '[':
-+				sResult.append(*start++);
-+				seenright = 0;
-+				while (start < end && !seenright)
-+				{
-+					switch (*start)
-+					{
-+						case '[':
-+						case '?':
-+						case '*':
-+						sResult.append(static_cast<sal_Unicode>('\\'));
-+						sResult.append(*start);
-+							break;
-+						case ']':
-+						sResult.append(*start);
-+							seenright = 1;
-+							break;
-+						case '!':
-+							sResult.append(static_cast<sal_Unicode>('^'));
-+							break;
-+						default:
-+						if (NeedEsc(*start))
-+							sResult.append(static_cast<sal_Unicode>('\\'));
-+						sResult.append(*start);
-+							break;
-+					}
-+					start++;
-+				}
-+				break;
-+			default:
-+				if (NeedEsc(*start))
-+					sResult.append(static_cast<sal_Unicode>('\\'));
-+				sResult.append(*start++);
-+		}
-+	}
-+
-+	if ( bForLike )
-+		sResult.append(static_cast<sal_Unicode>('$'));
-+
-+	return sResult.makeStringAndClear( );
-+}
-+
-+double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
-+{
-+	double fConvertFactor = 1.0;
-+	if( bVertical )
-+	{
-+		fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
-+	}
-+	else
-+	{
-+		fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;	
-+	}
-+	return fConvertFactor;
-+}
-+
-+double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
-+{
-+	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-+	return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
-+}
-+double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
-+{
-+	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-+	return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
-+}
-+
-+ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
-+{
-+// #FIXME needs to be an instantiable service
-+//	m_xShape = new ScVbaShape( xContext, xShape );
-+}
-+
-+#define VBA_LEFT "PositionX"
-+#define VBA_TOP "PositionY"
-+UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-+{
-+    mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
-+}
-+    double UserFormGeometryHelper::getLeft()
-+    {
-+	sal_Int32 nLeft = 0;
-+	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;	
-+	return Millimeter::getInPoints( nLeft );
-+    }
-+    void UserFormGeometryHelper::setLeft( double nLeft )
-+    {
-+        mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
-+    }
-+    double UserFormGeometryHelper::getTop()
-+    {
-+	sal_Int32 nTop = 0;
-+	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;	
-+	return Millimeter::getInPoints( nTop );
-+    }
-+    void UserFormGeometryHelper::setTop( double nTop )
-+    {
-+	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
-+    }
-+    double UserFormGeometryHelper::getHeight()
-+    {
-+	sal_Int32 nHeight = 0;
-+	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight;	
-+	return Millimeter::getInPoints( nHeight );
-+    }
-+    void UserFormGeometryHelper::setHeight( double nHeight )
-+    {
-+	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
-+    }
-+    double UserFormGeometryHelper::getWidth()
-+    {
-+	sal_Int32 nWidth = 0;
-+	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	NAME_WIDTH ) ) ) >>= nWidth;	
-+	return Millimeter::getInPoints( nWidth );
-+    }
-+    void UserFormGeometryHelper::setWidth( double nWidth)
-+    {
-+	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	NAME_WIDTH ) ), uno::makeAny(  Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
-+    }
-+} // openoffice
-+} //org
-diff --git oovbaapi/source/vbahelper/vbapropvalue.cxx oovbaapi/source/vbahelper/vbapropvalue.cxx
-new file mode 100644
-index 0000000..febf7b9
---- /dev/null
-+++ oovbaapi/source/vbahelper/vbapropvalue.cxx
-@@ -0,0 +1,48 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbapropvalue.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbapropvalue.hxx"
-+
-+using namespace com::sun::star;
-+ 
-+ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener )
-+{
-+}
-+
-+css::uno::Any SAL_CALL 
-+ScVbaPropValue::getValue() throw (css::uno::RuntimeException)
-+{
-+    return m_pListener->getValueEvent();
-+}
-+
-+void SAL_CALL 
-+ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException)
-+{
-+    m_pListener->setValueEvent( _value );
-+}
-diff --git oovbaapi/util/makefile.mk oovbaapi/util/makefile.mk
-index 4b98130..6dad290 100644
---- oovbaapi/util/makefile.mk
-+++ oovbaapi/util/makefile.mk
-@@ -40,13 +40,28 @@ TARGET=oovbaapi_db
- 
- .INCLUDE :  makefile.pmk
- 
--# ------------------------------------------------------------------
--UNOIDLDBFILES= \
--	$(UCR)$/vba.db \
--	$(UCR)$/excel.db \
--	$(UCR)$/msforms.db \
--	$(UCR)$/constants.db
--
--# --- Targets ------------------------------------------------------
--
-+TARGET_HELPER=vbahelper
-+SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
-+SHL1IMPLIB= i$(TARGET_HELPER)
-+
-+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-+DEF1NAME=$(SHL1TARGET)
-+
-+LIB1FILES=$(SLB)$/$(TARGET_HELPER).lib
-+
-+# dynamic libraries
-+SHL1STDLIBS=       \
-+		$(CPPULIB) \
-+		$(COMPHELPERLIB) \
-+		$(CPPUHELPERLIB) \
-+		$(TOOLSLIB) \
-+		$(SALLIB)\
-+		$(BASICLIB)	\
-+		$(SFXLIB)	\
-+		$(SVTOOLLIB)    \
-+		$(SVLLIB) \
-+        $(VCLLIB) \
-+
-+SHL1LIBS=$(LIB1FILES)
-+
- .INCLUDE :  target.mk
-diff --git sc/inc/docuno.hxx sc/inc/docuno.hxx
-index f036a23..58ebb35 100644
---- sc/inc/docuno.hxx
-+++ sc/inc/docuno.hxx
-@@ -74,8 +74,6 @@ class ScTableSheetObj;
- class SvxFmDrawPage;
- class SvxDrawPage;
- 
--#include <com/sun/star/document/XCodeNameQuery.hpp>
--
- class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
- 					public com::sun::star::sheet::XSpreadsheetDocument,
- 					public com::sun::star::document::XActionLockable,
-@@ -89,7 +87,6 @@ class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
- 					public com::sun::star::view::XRenderable,
- 					public com::sun::star::document::XLinkTargetSupplier,
- 					public com::sun::star::beans::XPropertySet,
--					public com::sun::star::document::XCodeNameQuery,
-                     public com::sun::star::document::XDocumentEventCompatibleHelper,
- 					public SvxFmMSFactory,	// derived from XMultiServiceFactory
-                     public com::sun::star::lang::XServiceInfo
-@@ -300,8 +297,6 @@ public:
- 								throw(::com::sun::star::uno::RuntimeException);
- 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
- 								throw(::com::sun::star::uno::RuntimeException);
-- 	virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
--								throw(::com::sun::star::uno::RuntimeException);
-                             // XVbaEventHelper
-     virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
- };
-diff --git sc/inc/servuno.hxx sc/inc/servuno.hxx
-index 3beb852..13950f1 100644
---- sc/inc/servuno.hxx
-+++ sc/inc/servuno.hxx
-@@ -94,7 +94,8 @@ class ScDocShell;
- #define SC_SERVICE_FORMULAPARS  38
- #define SC_SERVICE_OPCODEMAPPER 39
- #define SC_SERVICE_VBAOBJECTPROVIDER   40
--#define SC_SERVICE_COUNT        41
-+#define SC_SERVICE_VBACODENAMEPROVIDER   41
-+#define SC_SERVICE_COUNT        42
- #define SC_SERVICE_INVALID		USHRT_MAX
- 
- 
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 033cb76..f091a47 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -103,7 +103,7 @@
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
--
-+#include <basic/basmgr.hxx>
- 
- using namespace com::sun::star;
- 
-@@ -280,6 +280,15 @@ void ImportExcel8::ReadBasic( void )
-         bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
-         if( bLoadCode || bLoadStrg )
-         {
-+            // Create and insert Excel vba Globals
-+            uno::Reference < uno::XComponentContext > xCtx;
-+            uno::Reference < beans::XPropertySet > xProps(
-+            ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+            xCtx.set( xProps->getPropertyValue( rtl::OUString(
-+                RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-+                uno::UNO_QUERY_THROW );
-+            uno::Any aGlobs = uno::makeAny( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) );
-+            pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-             SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- 			bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
-             aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index bd1a653..87556ed 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -131,7 +131,8 @@
- #include "cellsuno.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
- #include <com/sun/star/document/VbaEventId.hpp>
--
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
- using namespace com::sun::star;
- using namespace com::sun::star::document::VbaEventId;
- 
-@@ -286,6 +287,7 @@ void ScDocShell::BeforeXMLLoading()
-     if ( xEvt.is() )
-        xEvt->setIgnoreEvents( sal_True );
-     
-+// if VBA enabled then we need to  
-     // prevent unnecessary broadcasts and updates
-     DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
- 	pModificator = new ScDocShellModificator( *this );
-@@ -369,7 +371,19 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
-     }
-     else
- 		aDocument.SetInsertingFromOtherDoc( FALSE );
--
-+	// add vba globals ( if they are availabl )
-+	SfxObjectShell* pShell = aDocument.GetDocumentShell();
-+	if ( pShell )
-+	{
-+		uno::Reference < uno::XComponentContext > xCtx;
-+		uno::Reference < beans::XPropertySet > xProps(
-+			::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+		xCtx.set( xProps->getPropertyValue( rtl::OUString(
-+			RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-+				uno::UNO_QUERY_THROW );
-+		uno::Any aGlobs = uno::makeAny( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) );
-+		pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+	}
-         // suppress VBA events when loading the xml
-         uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
-         if ( xEvt.is() )
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index a340ff2..fd91983 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -107,7 +107,6 @@ using namespace com::sun::star::document::VbaEventId;
- //	alles ohne Which-ID, Map nur fuer PropertySetInfo
- 
- //!	umbenennen, sind nicht mehr nur Options
--#include <com/sun/star/script/ScriptEventDescriptor.hpp>
- const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
- {
- 	static SfxItemPropertyMap aDocOptPropertyMap_Impl[] =
-@@ -314,7 +313,6 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
- 	SC_QUERYINTERFACE( view::XRenderable )
- 	SC_QUERYINTERFACE( document::XLinkTargetSupplier )
- 	SC_QUERYINTERFACE( beans::XPropertySet )
--	SC_QUERYINTERFACE( document::XCodeNameQuery )
- 	SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
- 	SC_QUERYINTERFACE( lang::XMultiServiceFactory )
- 	SC_QUERYINTERFACE( lang::XServiceInfo )
-@@ -1720,49 +1718,7 @@ uno::Sequence<rtl::OUString> SAL_CALL ScModelObj::getAvailableServiceNames()
- 
- 	return concatServiceNames( aMyServices, aDrawServices );
- }
--// XCodeNameQuery
--rtl::OUString SAL_CALL 
--ScModelObj::getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
--{
--    rtl::OUString sCodeName;
--    if ( pDocShell )
--    {
--        OSL_TRACE( "*** In ScModelObj::getCodeNameForObject");
--        // need to find the page ( and index )  for this control
--        uno::Reference< drawing::XDrawPagesSupplier > xSupplier( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
--        uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
--        sal_Int32 nLen = xIndex->getCount();
--        bool bMatched = false;
--        uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
--        for ( sal_Int32 index = 0; index < nLen; ++index )
--        {
--            try
--            {
--                uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
--                uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
--                // get the www-standard container
--                uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
--                sal_Int32 nCntrls = xFormControls->getCount();
--                for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
--                {
--                    uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );	
--                    bMatched = ( xControl == xIf );
--                    if ( bMatched )
--                    {
--                        String sName;
--                        pDocShell->GetDocument()->GetCodeName( index, sName );
--                        sCodeName = sName;
--                    }
--                }
--            }
--            catch( uno::Exception& ) {}
--            if ( bMatched )
--                break;
--        }
--    }
--    // Probably should throw here ( if !bMatched )
--     return sCodeName;
--}
-+
- // XVbaEventHelper
- // For Vba Event
- sal_Bool SAL_CALL
-diff --git sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
-index 83db312..05ec9d2 100644
---- sc/source/ui/unoobj/servuno.cxx
-+++ sc/source/ui/unoobj/servuno.cxx
-@@ -63,6 +63,11 @@
- #include <svx/xmlgrhlp.hxx>
- 
- #include <comphelper/processfactory.hxx>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+
- 
- using namespace ::com::sun::star;
- 
-@@ -160,6 +165,56 @@ public:
- 
- };
- 
-+class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
-+{
-+ScDocShell* mpDocShell;
-+public:
-+    ScVbaCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+    // XCodeNameQuery
-+    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+    {
-+        rtl::OUString sCodeName;
-+        if ( mpDocShell )
-+        {
-+            OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-+            // need to find the page ( and index )  for this control
-+            uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+            uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-+            sal_Int32 nLen = xIndex->getCount();
-+            bool bMatched = false;
-+            uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+            for ( sal_Int32 index = 0; index < nLen; ++index )
-+            {
-+                try
-+                {
-+                    uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-+                    uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+                    // get the www-standard container
-+                    uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+                    sal_Int32 nCntrls = xFormControls->getCount();
-+                    for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+                    {
-+                        uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );	
-+                        bMatched = ( xControl == xIf );
-+                        if ( bMatched )
-+                        {
-+                            String sName;
-+                            mpDocShell->GetDocument()->GetCodeName( index, sName );
-+                            sCodeName = sName;
-+                        }
-+                    }
-+                }
-+                catch( uno::Exception& ) {}
-+                if ( bMatched )
-+                    break;
-+            }
-+        }
-+        // Probably should throw here ( if !bMatched )
-+         return sCodeName;
-+    }
-+
-+};
-+
- //------------------------------------------------------------------------
- 
- static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
-@@ -210,6 +265,7 @@ static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
-         SC_SERVICENAME_FORMULAPARS,                 // SC_SERVICE_FORMULAPARS
-         SC_SERVICENAME_OPCODEMAPPER,                 // SC_SERVICE_OPCODEMAPPER
- "ooo.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
-+"ooo.vba.VBACodeNameProvider",// SC_SERVICE_VBACODENAMEPROVIDER
- 	};
- 
- //
-@@ -263,6 +319,7 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] =
-         "",                                         // SC_SERVICE_FORMULAPARS
-         "",                                         // SC_SERVICE_OPCODEMAPPER
-         "",                                         // SC_SERVICE_VBAOBJECTPROVIDER
-+        "",                                         // SC_SERVICE_VBACODENAMEPROVIDER
- 	};
- 
- 
-@@ -458,6 +515,9 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
-         case SC_SERVICE_VBAOBJECTPROVIDER:
-             xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
-             break;
-+        case SC_SERVICE_VBACODENAMEPROVIDER:
-+            xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
-+            break;
- 	}
- 	return xRet;
- }
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-new file mode 100644
-index 0000000..1be67f7
---- /dev/null
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -0,0 +1,208 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbahelper.cxx,v $
-+ * $Revision: 1.5.32.1 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <docuno.hxx>
-+#include "excelvbahelper.hxx"
-+#include "tabvwsh.hxx"
-+#include "transobj.hxx"
-+#include "scmod.hxx"
-+#include <comphelper/processfactory.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+namespace ooo
-+{
-+namespace vba
-+{
-+
-+bool isInPrintPreview( SfxViewFrame* pView )
-+{
-+	sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
-+	if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
-+nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
-+	{
-+		SfxViewFactory &rViewFactory =
-+			pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
-+		if (  pView->GetCurViewId() == rViewFactory.GetOrdinal() )
-+			return true;
-+	}
-+	return false;
-+}
-+
-+const ::rtl::OUString REPLACE_CELLS_WARNING(  RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
-+
-+class PasteCellsWarningReseter
-+{
-+private:
-+	bool bInitialWarningState;
-+	static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
-+	{
-+		static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+		static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+		static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-+				xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+		static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
-+		return xProps;
-+	}
-+
-+	bool getReplaceCellsWarning() throw ( uno::RuntimeException )
-+	{
-+		sal_Bool res = sal_False;
-+		getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
-+		return ( res == sal_True );
-+	}
-+
-+	void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
-+	{
-+		getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
-+	}
-+public:
-+	PasteCellsWarningReseter() throw ( uno::RuntimeException )
-+	{
-+		bInitialWarningState = getReplaceCellsWarning();
-+		if ( bInitialWarningState )
-+			setReplaceCellsWarning( false );
-+	}
-+	~PasteCellsWarningReseter()
-+	{
-+		if ( bInitialWarningState )
-+		{
-+			// don't allow dtor to throw
-+			try
-+			{
-+				setReplaceCellsWarning( true );
-+			}
-+			catch ( uno::Exception& /*e*/ ){}
-+		}
-+	}
-+};
-+
-+void
-+implnPaste()
-+{
-+	PasteCellsWarningReseter resetWarningBox;
-+	ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+	if ( pViewShell )
-+	{
-+		pViewShell->PasteFromSystem();
-+		pViewShell->CellContentChanged();
-+	}
-+}
-+
-+
-+void
-+implnCopy()
-+{
-+	ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+	if ( pViewShell )
-+		pViewShell->CopyToClip(NULL,false,false,true);
-+}
-+
-+void 
-+implnCut()
-+{
-+	ScTabViewShell* pViewShell =  getCurrentBestViewShell();
-+	if ( pViewShell )
-+		pViewShell->CutToClip( NULL, TRUE );
-+}
-+
-+void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
-+{
-+	PasteCellsWarningReseter resetWarningBox;
-+	sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
-+	InsCellCmd eMoveMode = INS_NONE;
-+
-+	ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
-+	if ( !pTabViewShell ) 
-+		// none active, try next best
-+		pTabViewShell = getCurrentBestViewShell();
-+	if ( pTabViewShell )
-+	{
-+		ScViewData* pView = pTabViewShell->GetViewData();	
-+		Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
-+		if ( pView && pWin )
-+		{
-+			if ( bAsLink && bOtherDoc )
-+				pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
-+			else 
-+			{
-+				ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
-+				ScDocument* pDoc = NULL; 
-+				if ( pOwnClip )
-+					pDoc = pOwnClip->GetDocument();	
-+				pTabViewShell->PasteFromClip( nFlags, pDoc,
-+					nFunction, bSkipEmpty, bTranspose, bAsLink,
-+					eMoveMode, IDF_NONE, TRUE );
-+				pTabViewShell->CellContentChanged();
-+			}
-+		}
-+	}
-+
-+}
-+
-+ScDocShell* 
-+getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) 
-+{
-+	uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
-+	ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
-+	ScDocShell* pDocShell = NULL;
-+	if ( pModel )
-+		pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
-+	return pDocShell;
-+
-+}
-+
-+ScTabViewShell* 
-+getBestViewShell(  css::uno::Reference< css::frame::XModel>& xModel )
-+{
-+	ScDocShell* pDocShell = getDocShell( xModel );
-+	if ( pDocShell )
-+		return pDocShell->GetBestViewShell();
-+	return NULL;
-+}
-+
-+ScTabViewShell* 
-+getCurrentBestViewShell()
-+{ 
-+	uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+	return getBestViewShell( xModel );
-+}
-+
-+SfxViewFrame* 
-+getCurrentViewFrame()
-+{
-+	ScTabViewShell* pViewShell = getCurrentBestViewShell();	
-+	if ( pViewShell )
-+		return pViewShell->GetViewFrame();
-+	return NULL;
-+}
-+
-+} // openoffice
-+} //org
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-new file mode 100644
-index 0000000..51d7db0
---- /dev/null
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbahelper.hxx,v $
-+ * $Revision: 1.5.32.1 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_EXCEL_VBA_HELPER_HXX
-+#define SC_EXCEL_VBA_HELPER_HXX
-+
-+#include<oovbaapi/vbahelper.hxx>
-+#include <docsh.hxx>
-+
-+namespace ooo 
-+{
-+	namespace vba 
-+	{
-+		void implnCopy();
-+		void implnPaste();
-+		void implnCut();
-+		void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
-+		css::uno::Reference< css::frame::XModel >
-+			getCurrentDocument() throw (css::uno::RuntimeException);
-+		ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
-+		ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
-+		ScTabViewShell* getCurrentBestViewShell();
-+		SfxViewFrame* getCurrentViewFrame();
++	namespace vba 
++	{
++		void implnCopy();
++		void implnPaste();
++		void implnCut();
++		void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
++		css::uno::Reference< css::frame::XModel >
++			getCurrentDocument() throw (css::uno::RuntimeException);
++		ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
++		ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
++		ScTabViewShell* getCurrentBestViewShell();
++		SfxViewFrame* getCurrentViewFrame();
 +};
 +};
 +#endif
@@ -6697,7 +1148,7 @@
  		$(SLO)$/vbawsfunction.obj\
  		$(SLO)$/vbawindow.obj\
 diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index 754885e..197655a 100644
+index 754885e..4749b24 100644
 --- sc/source/ui/vba/vbaapplication.hxx
 +++ sc/source/ui/vba/vbaapplication.hxx
 @@ -35,7 +35,7 @@
@@ -6705,12 +1156,12 @@
  #include <com/sun/star/uno/XComponentContext.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XApplication > ScVbaApplication_BASE;
  
 diff --git sc/source/ui/vba/vbaassistant.hxx sc/source/ui/vba/vbaassistant.hxx
-index d3c5ff4..74bef57 100644
+index d3c5ff4..060538d 100644
 --- sc/source/ui/vba/vbaassistant.hxx
 +++ sc/source/ui/vba/vbaassistant.hxx
 @@ -40,8 +40,8 @@
@@ -6720,12 +1171,12 @@
 -#include "vbahelper.hxx"
 -#include "vbahelperinterface.hxx"
 +#include "excelvbahelper.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef ::cppu::WeakImplHelper1< ov::XAssistant > Assistant;
  typedef InheritedHelperInterfaceImpl< Assistant > ScVbaAssistantImpl_BASE;
 diff --git sc/source/ui/vba/vbaaxes.hxx sc/source/ui/vba/vbaaxes.hxx
-index 1117d27..961d3eb 100644
+index 1117d27..3ef05ec 100644
 --- sc/source/ui/vba/vbaaxes.hxx
 +++ sc/source/ui/vba/vbaaxes.hxx
 @@ -32,7 +32,7 @@
@@ -6733,12 +1184,12 @@
  #include <ooo/vba/excel/XAxis.hpp>
  #include <ooo/vba/excel/XChart.hpp>
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::excel::XAxes > ScVbaAxes_BASE;
  class ScVbaAxes : public ScVbaAxes_BASE
 diff --git sc/source/ui/vba/vbaaxis.hxx sc/source/ui/vba/vbaaxis.hxx
-index 71ec1c1..5791f50 100644
+index 71ec1c1..f51bac5 100644
 --- sc/source/ui/vba/vbaaxis.hxx
 +++ sc/source/ui/vba/vbaaxis.hxx
 @@ -32,8 +32,8 @@
@@ -6747,13 +1198,13 @@
  #include <ooo/vba/excel/XChart.hpp>
 -#include "vbahelperinterface.hxx"
 -
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
 +#include <memory>
  typedef InheritedHelperInterfaceImpl1< ov::excel::XAxis >  ScVbaAxis_BASE;
  class ScVbaChart;
  class ScVbaAxis : public ScVbaAxis_BASE
 diff --git sc/source/ui/vba/vbaborders.hxx sc/source/ui/vba/vbaborders.hxx
-index 9ad8c50..d152540 100644
+index 9ad8c50..642e32b 100644
 --- sc/source/ui/vba/vbaborders.hxx
 +++ sc/source/ui/vba/vbaborders.hxx
 @@ -38,7 +38,7 @@
@@ -6761,12 +1212,12 @@
  
   
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::excel::XBorders > ScVbaBorders_BASE;
  class ScVbaPalette;
 diff --git sc/source/ui/vba/vbabutton.hxx sc/source/ui/vba/vbabutton.hxx
-index 2a98ad6..7447a73 100644
+index 2a98ad6..818f245 100644
 --- sc/source/ui/vba/vbabutton.hxx
 +++ sc/source/ui/vba/vbabutton.hxx
 @@ -33,7 +33,7 @@
@@ -6774,12 +1225,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
  
 diff --git sc/source/ui/vba/vbacharacters.hxx sc/source/ui/vba/vbacharacters.hxx
-index 1ea523f..af46d1e 100644
+index 1ea523f..f69b6d2 100644
 --- sc/source/ui/vba/vbacharacters.hxx
 +++ sc/source/ui/vba/vbacharacters.hxx
 @@ -36,7 +36,7 @@
@@ -6787,12 +1238,12 @@
  #include <com/sun/star/text/XSimpleText.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbapalette.hxx"
  typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaCharacters_BASE;
  
 diff --git sc/source/ui/vba/vbachart.hxx sc/source/ui/vba/vbachart.hxx
-index cd20e06..ec53e08 100644
+index cd20e06..b7fab46 100644
 --- sc/source/ui/vba/vbachart.hxx
 +++ sc/source/ui/vba/vbachart.hxx
 @@ -41,7 +41,7 @@
@@ -6800,12 +1251,12 @@
  #include <ooo/vba/excel/XDataLabels.hpp>
  #include <ooo/vba/excel/XSeries.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1<ov::excel::XChart > ChartImpl_BASE;
  
 diff --git sc/source/ui/vba/vbachartobject.hxx sc/source/ui/vba/vbachartobject.hxx
-index e36f157..4044b26 100644
+index e36f157..45b5c17 100644
 --- sc/source/ui/vba/vbachartobject.hxx
 +++ sc/source/ui/vba/vbachartobject.hxx
 @@ -36,7 +36,7 @@
@@ -6813,12 +1264,12 @@
  #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
  #include <ooo/vba/excel/XChartObject.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include <memory>
  
  typedef InheritedHelperInterfaceImpl1<ov::excel::XChartObject > ChartObjectImpl_BASE;
 diff --git sc/source/ui/vba/vbachartobjects.hxx sc/source/ui/vba/vbachartobjects.hxx
-index 3b18f51..3dbc271 100644
+index 3b18f51..bc87157 100644
 --- sc/source/ui/vba/vbachartobjects.hxx
 +++ sc/source/ui/vba/vbachartobjects.hxx
 @@ -36,8 +36,8 @@
@@ -6827,13 +1278,13 @@
  #include <com/sun/star/container/XEnumerationAccess.hpp>
 -#include"vbacollectionimpl.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
 +#include "excelvbahelper.hxx"
  #include <hash_map>
  
  typedef CollTestImplHelper< ov::excel::XChartObjects > ChartObjects_BASE;
 diff --git sc/source/ui/vba/vbacharts.hxx sc/source/ui/vba/vbacharts.hxx
-index d9d0f8e..99b2b7d 100644
+index d9d0f8e..cedfeaa 100644
 --- sc/source/ui/vba/vbacharts.hxx
 +++ sc/source/ui/vba/vbacharts.hxx
 @@ -31,8 +31,8 @@
@@ -6842,13 +1293,13 @@
  #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 -#include"vbacollectionimpl.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
 +#include "excelvbahelper.hxx"
  #include <hash_map>
  
  typedef CollTestImplHelper< ov::excel::XCharts > Charts_BASE;
 diff --git sc/source/ui/vba/vbacheckbox.hxx sc/source/ui/vba/vbacheckbox.hxx
-index 58805c6..74eaf7b 100644
+index 58805c6..c3ddfb5 100644
 --- sc/source/ui/vba/vbacheckbox.hxx
 +++ sc/source/ui/vba/vbacheckbox.hxx
 @@ -38,7 +38,7 @@
@@ -6856,7 +1307,7 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
  
@@ -7268,7 +1719,7 @@
 -
 -#endif //SC_VBA_COLLECTION_IMPL_HXX
 diff --git sc/source/ui/vba/vbacolorformat.hxx sc/source/ui/vba/vbacolorformat.hxx
-index a5104d8..be251e0 100644
+index a5104d8..a45d5d8 100644
 --- sc/source/ui/vba/vbacolorformat.hxx
 +++ sc/source/ui/vba/vbacolorformat.hxx
 @@ -33,7 +33,7 @@
@@ -7276,12 +1727,12 @@
  #include <ooo/vba/msforms/XColorFormat.hpp>
  #include <ooo/vba/msforms/XFillFormat.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbafillformat.hxx"
  
  typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE;
 diff --git sc/source/ui/vba/vbacombobox.hxx sc/source/ui/vba/vbacombobox.hxx
-index 45996e2..219e05c 100644
+index 45996e2..d14a19f 100644
 --- sc/source/ui/vba/vbacombobox.hxx
 +++ sc/source/ui/vba/vbacombobox.hxx
 @@ -40,7 +40,7 @@
@@ -7289,7 +1740,7 @@
  #include "vbacontrol.hxx"
  #include "vbalistcontrolhelper.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
  class ScVbaComboBox : public ComboBoxImpl_BASE
@@ -7307,7 +1758,7 @@
  
  using namespace com::sun::star;
 diff --git sc/source/ui/vba/vbacommandbar.hxx sc/source/ui/vba/vbacommandbar.hxx
-index bbeda7c..920dc18 100644
+index bbeda7c..0b830b2 100644
 --- sc/source/ui/vba/vbacommandbar.hxx
 +++ sc/source/ui/vba/vbacommandbar.hxx
 @@ -41,7 +41,7 @@
@@ -7315,12 +1766,12 @@
  #include <com/sun/star/beans/PropertyValues.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbacommandbars.hxx"
  
  #include <map>
 diff --git sc/source/ui/vba/vbacommandbarcontrol.hxx sc/source/ui/vba/vbacommandbarcontrol.hxx
-index cc237bd..5379529 100644
+index 1c406a5..4d7d133 100644
 --- sc/source/ui/vba/vbacommandbarcontrol.hxx
 +++ sc/source/ui/vba/vbacommandbarcontrol.hxx
 @@ -40,7 +40,7 @@
@@ -7328,12 +1779,12 @@
  #include <ooo/vba/office/MsoControlType.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbacommandbarcontrols.hxx"
  
  typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE;
 diff --git sc/source/ui/vba/vbacommandbarcontrols.hxx sc/source/ui/vba/vbacommandbarcontrols.hxx
-index 8e7d1e1..4ebfe88 100644
+index 8e7d1e1..ff00609 100644
 --- sc/source/ui/vba/vbacommandbarcontrols.hxx
 +++ sc/source/ui/vba/vbacommandbarcontrols.hxx
 @@ -37,9 +37,9 @@
@@ -7341,10 +1792,10 @@
  #include <ooo/vba/XCommandBarControls.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbacommandbar.hxx"
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  class ScVbaCommandBarControl;
  
@@ -7361,7 +1812,7 @@
  using namespace com::sun::star;
  using namespace ooo::vba;
 diff --git sc/source/ui/vba/vbacommandbars.hxx sc/source/ui/vba/vbacommandbars.hxx
-index a05e22b..4f54c92 100644
+index a05e22b..7442002 100644
 --- sc/source/ui/vba/vbacommandbars.hxx
 +++ sc/source/ui/vba/vbacommandbars.hxx
 @@ -41,8 +41,8 @@
@@ -7370,13 +1821,13 @@
  
 -#include "vbahelperinterface.hxx"
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE;
  
 diff --git sc/source/ui/vba/vbacomment.hxx sc/source/ui/vba/vbacomment.hxx
-index 8baae1c..bc4ecb9 100644
+index 8baae1c..4911586 100644
 --- sc/source/ui/vba/vbacomment.hxx
 +++ sc/source/ui/vba/vbacomment.hxx
 @@ -39,7 +39,7 @@
@@ -7384,12 +1835,12 @@
  #include <com/sun/star/uno/XComponentContext.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XComment > ScVbaComment_BASE;
  
 diff --git sc/source/ui/vba/vbacomments.hxx sc/source/ui/vba/vbacomments.hxx
-index 0f9d740..8dfe712 100644
+index 0f9d740..2010f16 100644
 --- sc/source/ui/vba/vbacomments.hxx
 +++ sc/source/ui/vba/vbacomments.hxx
 @@ -34,8 +34,8 @@
@@ -7399,12 +1850,12 @@
 -#include "vbahelper.hxx"
 -#include "vbacollectionimpl.hxx"
 +#include "excelvbahelper.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  #include "vbacomment.hxx"
  
  typedef CollTestImplHelper< ov::excel::XComments > ScVbaComments_BASE;
 diff --git sc/source/ui/vba/vbacondition.hxx sc/source/ui/vba/vbacondition.hxx
-index 9f01951..3b95e2e 100644
+index 9f01951..421431b 100644
 --- sc/source/ui/vba/vbacondition.hxx
 +++ sc/source/ui/vba/vbacondition.hxx
 @@ -31,7 +31,7 @@
@@ -7412,12 +1863,12 @@
  #include <com/sun/star/sheet/XSheetCondition.hpp> 
  #include <com/sun/star/sheet/XCellRangeAddressable.hpp> 
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include <com/sun/star/sheet/ConditionOperator.hpp>
  
  template< typename Ifc1 >
 diff --git sc/source/ui/vba/vbacontrol.hxx sc/source/ui/vba/vbacontrol.hxx
-index 21c5de2..788ea55 100644
+index 21c5de2..e7593e8 100644
 --- sc/source/ui/vba/vbacontrol.hxx
 +++ sc/source/ui/vba/vbacontrol.hxx
 @@ -39,8 +39,9 @@
@@ -7426,14 +1877,14 @@
  
 -#include "vbahelper.hxx"
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelper.hxx>
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelper.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
 +#include <memory>
  
  //typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
  typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
 diff --git sc/source/ui/vba/vbacontrols.hxx sc/source/ui/vba/vbacontrols.hxx
-index 31ab049..4904033 100644
+index 31ab049..461c360 100644
 --- sc/source/ui/vba/vbacontrols.hxx
 +++ sc/source/ui/vba/vbacontrols.hxx
 @@ -34,8 +34,8 @@
@@ -7442,8 +1893,8 @@
  
 -#include "vbacollectionimpl.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
  
@@ -7461,7 +1912,7 @@
  #include "vbaglobals.hxx"
  
 diff --git sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
-index 94d8114..bb4ede8 100644
+index 94d8114..162e19c 100644
 --- sc/source/ui/vba/vbadialog.hxx
 +++ sc/source/ui/vba/vbadialog.hxx
 @@ -37,7 +37,7 @@
@@ -7469,7 +1920,7 @@
  #include <ooo/vba/excel/XDialog.hpp>
   
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbadialog.hxx"
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XDialog > ScVbaDialog_BASE;
@@ -7487,7 +1938,7 @@
  #include "vbaglobals.hxx"
  #include "vbadialog.hxx"
 diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
-index fe9a32c..b8d7007 100644
+index fe9a32c..a0b2b24 100644
 --- sc/source/ui/vba/vbadialogs.hxx
 +++ sc/source/ui/vba/vbadialogs.hxx
 @@ -35,7 +35,7 @@
@@ -7495,12 +1946,12 @@
  #include <ooo/vba/excel/XDialogs.hpp>
  #include <ooo/vba/XCollection.hpp>
 -#include "vbahelperinterface.hxx" 
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  class ScModelObj;
  
 diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index c83406f..0fcea13 100644
+index c83406f..52ba287 100644
 --- sc/source/ui/vba/vbaeventshelper.cxx
 +++ sc/source/ui/vba/vbaeventshelper.cxx
 @@ -33,7 +33,7 @@
@@ -7508,7 +1959,7 @@
   ************************************************************************/
  #include "vbaeventshelper.hxx"
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
++#include <vbahelper/helperdecl.hxx>
  #include <sfx2/objsh.hxx> 
  #include <basic/basmgr.hxx>
  #include <basic/sbmod.hxx>
@@ -7526,7 +1977,7 @@
  #define INVALID_TAB -1
  
 diff --git sc/source/ui/vba/vbafillformat.hxx sc/source/ui/vba/vbafillformat.hxx
-index 88fcfc0..2ab5661 100644
+index 88fcfc0..047af92 100644
 --- sc/source/ui/vba/vbafillformat.hxx
 +++ sc/source/ui/vba/vbafillformat.hxx
 @@ -33,7 +33,7 @@
@@ -7534,12 +1985,12 @@
  #include <com/sun/star/drawing/FillStyle.hpp>
  #include <ooo/vba/msforms/XFillFormat.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE;
  
 diff --git sc/source/ui/vba/vbafont.hxx sc/source/ui/vba/vbafont.hxx
-index f73d729..9875342 100644
+index f73d729..efca63c 100644
 --- sc/source/ui/vba/vbafont.hxx
 +++ sc/source/ui/vba/vbafont.hxx
 @@ -34,7 +34,7 @@
@@ -7547,7 +1998,7 @@
  #include <ooo/vba/excel/XFont.hpp>
  #include <com/sun/star/beans/XPropertySet.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbapalette.hxx"
  
  class ScTableSheetsObj;
@@ -7564,7 +2015,7 @@
  #include <com/sun/star/table/CellHoriJustify.hpp>
  #include <com/sun/star/table/CellOrientation.hpp>
 diff --git sc/source/ui/vba/vbaformat.hxx sc/source/ui/vba/vbaformat.hxx
-index a88687d..b3cb9c4 100644
+index a88687d..7c01ea4 100644
 --- sc/source/ui/vba/vbaformat.hxx
 +++ sc/source/ui/vba/vbaformat.hxx
 @@ -39,7 +39,7 @@
@@ -7572,7 +2023,7 @@
  #include <com/sun/star/lang/Locale.hpp>
  #include <com/sun/star/beans/XPropertyState.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  template< typename Ifc1 >
  class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
@@ -7589,7 +2040,7 @@
  using namespace ::com::sun::star;
  
 diff --git sc/source/ui/vba/vbaformatconditions.hxx sc/source/ui/vba/vbaformatconditions.hxx
-index efdfce5..7696380 100644
+index efdfce5..cac54da 100644
 --- sc/source/ui/vba/vbaformatconditions.hxx
 +++ sc/source/ui/vba/vbaformatconditions.hxx
 @@ -35,7 +35,7 @@
@@ -7597,12 +2048,12 @@
  #include <com/sun/star/table/CellAddress.hpp>
  #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::excel::XFormatConditions > ScVbaFormatConditions_BASE;
  class ScVbaFormatConditions: public ScVbaFormatConditions_BASE
 diff --git sc/source/ui/vba/vbaframe.hxx sc/source/ui/vba/vbaframe.hxx
-index 6020457..5c35347 100644
+index 6020457..071b5b0 100644
 --- sc/source/ui/vba/vbaframe.hxx
 +++ sc/source/ui/vba/vbaframe.hxx
 @@ -38,7 +38,7 @@
@@ -7610,12 +2061,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
  
 diff --git sc/source/ui/vba/vbaglobals.cxx sc/source/ui/vba/vbaglobals.cxx
-index bfc291f..d51057b 100644
+index bfc291f..7c829bf 100644
 --- sc/source/ui/vba/vbaglobals.cxx
 +++ sc/source/ui/vba/vbaglobals.cxx
 @@ -27,7 +27,7 @@
@@ -7623,7 +2074,7 @@
   *
   ************************************************************************/
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
++#include <vbahelper/helperdecl.hxx>
  #include "vbaglobals.hxx"
  
  #include <comphelper/unwrapargs.hxx>
@@ -8937,7 +3388,7 @@
 -};
 -#endif
 diff --git sc/source/ui/vba/vbahyperlink.cxx sc/source/ui/vba/vbahyperlink.cxx
-index 4b95eb7..9bf353f 100644
+index 4b95eb7..1b30151 100644
 --- sc/source/ui/vba/vbahyperlink.cxx
 +++ sc/source/ui/vba/vbahyperlink.cxx
 @@ -32,7 +32,7 @@
@@ -8945,12 +3396,12 @@
   *
   ************************************************************************/
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
++#include <vbahelper/helperdecl.hxx>
  #include "vbahyperlink.hxx"
  #include <com/sun/star/container/XIndexAccess.hpp>
  #include <com/sun/star/text/XTextFieldsSupplier.hpp> 
 diff --git sc/source/ui/vba/vbahyperlink.hxx sc/source/ui/vba/vbahyperlink.hxx
-index aad0a87..dc2617c 100644
+index aad0a87..ee33a33 100644
 --- sc/source/ui/vba/vbahyperlink.hxx
 +++ sc/source/ui/vba/vbahyperlink.hxx
 @@ -40,7 +40,7 @@
@@ -8958,12 +3409,12 @@
  #include <ooo/vba/excel/XRange.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XHyperlink > HyperlinkImpl_BASE;
  
 diff --git sc/source/ui/vba/vbaimage.hxx sc/source/ui/vba/vbaimage.hxx
-index 2a8ba10..4f5c946 100644
+index 2a8ba10..d64f1c3 100644
 --- sc/source/ui/vba/vbaimage.hxx
 +++ sc/source/ui/vba/vbaimage.hxx
 @@ -33,7 +33,7 @@
@@ -8971,12 +3422,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE;
  
 diff --git sc/source/ui/vba/vbainterior.hxx sc/source/ui/vba/vbainterior.hxx
-index ee8175f..d6f1a7a 100644
+index ee8175f..847af6b 100644
 --- sc/source/ui/vba/vbainterior.hxx
 +++ sc/source/ui/vba/vbainterior.hxx
 @@ -34,9 +34,10 @@
@@ -8987,12 +3438,12 @@
  
  #include <com/sun/star/script/XInvocation.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  class ScDocument;
  
 diff --git sc/source/ui/vba/vbalabel.hxx sc/source/ui/vba/vbalabel.hxx
-index d6846a4..736d0b8 100644
+index d6846a4..3afd652 100644
 --- sc/source/ui/vba/vbalabel.hxx
 +++ sc/source/ui/vba/vbalabel.hxx
 @@ -33,7 +33,7 @@
@@ -9000,12 +3451,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  #include <cppuhelper/implbase2.hxx>
  
  typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty  > LabelImpl_BASE;
 diff --git sc/source/ui/vba/vbalineformat.hxx sc/source/ui/vba/vbalineformat.hxx
-index edfa47a..fe309fb 100644
+index edfa47a..a6287e4 100644
 --- sc/source/ui/vba/vbalineformat.hxx
 +++ sc/source/ui/vba/vbalineformat.hxx
 @@ -33,7 +33,7 @@
@@ -9013,12 +3464,12 @@
  #include <com/sun/star/beans/XPropertySet.hpp>
  #include <ooo/vba/msforms/XLineFormat.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE;
  
 diff --git sc/source/ui/vba/vbalistbox.hxx sc/source/ui/vba/vbalistbox.hxx
-index 1848ba6..aa74e90 100644
+index 1848ba6..265f89d 100644
 --- sc/source/ui/vba/vbalistbox.hxx
 +++ sc/source/ui/vba/vbalistbox.hxx
 @@ -38,7 +38,7 @@
@@ -9026,7 +3477,7 @@
  #include "vbapropvalue.hxx"
  #include "vbalistcontrolhelper.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
  class ScVbaListBox : public ListBoxImpl_BASE
@@ -9041,7 +3492,7 @@
  using namespace com::sun::star;
  using namespace ooo::vba;
 diff --git sc/source/ui/vba/vbalistcontrolhelper.hxx sc/source/ui/vba/vbalistcontrolhelper.hxx
-index 5e4684c..5627d97 100644
+index 5e4684c..53f369f 100644
 --- sc/source/ui/vba/vbalistcontrolhelper.hxx
 +++ sc/source/ui/vba/vbalistcontrolhelper.hxx
 @@ -1,7 +1,7 @@
@@ -9049,12 +3500,12 @@
  #define SC_VBA_LISTCONTROLHELPER
  
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  class ListControlHelper
  {
 diff --git sc/source/ui/vba/vbamultipage.hxx sc/source/ui/vba/vbamultipage.hxx
-index 3c83d6c..a01f2a1 100644
+index 3c83d6c..05d0775 100644
 --- sc/source/ui/vba/vbamultipage.hxx
 +++ sc/source/ui/vba/vbamultipage.hxx
 @@ -39,7 +39,7 @@
@@ -9062,12 +3513,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  //#include <cppuhelper/implbase2.hxx>
  #include <cppuhelper/implbase1.hxx>
  
 diff --git sc/source/ui/vba/vbaname.cxx sc/source/ui/vba/vbaname.cxx
-index 3fdc003..555144a 100644
+index 3fdc003..3e7b713 100644
 --- sc/source/ui/vba/vbaname.cxx
 +++ sc/source/ui/vba/vbaname.cxx
 @@ -27,7 +27,7 @@
@@ -9075,12 +3526,12 @@
   *
   ************************************************************************/
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
++#include <vbahelper/helperdecl.hxx>
  
  #include <com/sun/star/table/XCellRange.hpp>
  #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
 diff --git sc/source/ui/vba/vbaname.hxx sc/source/ui/vba/vbaname.hxx
-index fcd1a7d..72d22ce 100644
+index fcd1a7d..6370d64 100644
 --- sc/source/ui/vba/vbaname.hxx
 +++ sc/source/ui/vba/vbaname.hxx
 @@ -34,7 +34,9 @@
@@ -9088,14 +3539,14 @@
  #include <com/sun/star/sheet/XNamedRanges.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
 +
 +class ScDocument; 
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE;
  
 diff --git sc/source/ui/vba/vbanames.cxx sc/source/ui/vba/vbanames.cxx
-index 1e40d55..4246537 100644
+index 1e40d55..c69d29b 100644
 --- sc/source/ui/vba/vbanames.cxx
 +++ sc/source/ui/vba/vbanames.cxx
 @@ -27,7 +27,7 @@
@@ -9103,12 +3554,12 @@
   *
   ************************************************************************/
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
++#include <vbahelper/helperdecl.hxx>
  
  #include <com/sun/star/table/XCellRange.hpp>
  #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
 diff --git sc/source/ui/vba/vbanames.hxx sc/source/ui/vba/vbanames.hxx
-index 5b53ab0..952c46e 100644
+index 5b53ab0..5f93b7b 100644
 --- sc/source/ui/vba/vbanames.hxx
 +++ sc/source/ui/vba/vbanames.hxx
 @@ -34,7 +34,10 @@
@@ -9116,7 +3567,7 @@
  #include <com/sun/star/container/XEnumerationAccess.hpp>
  #include <com/sun/star/sheet/XNamedRanges.hpp>
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
 +
 +class ScDocument;
 +class ScDocShell;
@@ -9124,7 +3575,7 @@
  typedef CollTestImplHelper< ov::excel::XNames > ScVbaNames_BASE;
  
 diff --git sc/source/ui/vba/vbaoleobject.hxx sc/source/ui/vba/vbaoleobject.hxx
-index 868de87..ca94d0a 100644
+index 868de87..297fcbf 100644
 --- sc/source/ui/vba/vbaoleobject.hxx
 +++ sc/source/ui/vba/vbaoleobject.hxx
 @@ -35,7 +35,7 @@
@@ -9132,12 +3583,12 @@
  #include <ooo/vba/excel/XOLEObject.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BASE;
  
 diff --git sc/source/ui/vba/vbaoleobjects.hxx sc/source/ui/vba/vbaoleobjects.hxx
-index a00d193..97a72d3 100644
+index a00d193..72bdbc6 100644
 --- sc/source/ui/vba/vbaoleobjects.hxx
 +++ sc/source/ui/vba/vbaoleobjects.hxx
 @@ -33,8 +33,8 @@
@@ -9146,13 +3597,13 @@
  
 -#include "vbacollectionimpl.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
 +#include "excelvbahelper.hxx"
  
  typedef CollTestImplHelper< ov::excel::XOLEObjects > OLEObjectsImpl_BASE;
  
 diff --git sc/source/ui/vba/vbaoutline.hxx sc/source/ui/vba/vbaoutline.hxx
-index b8f4ece..b1e2539 100644
+index b8f4ece..4f1776c 100644
 --- sc/source/ui/vba/vbaoutline.hxx
 +++ sc/source/ui/vba/vbaoutline.hxx
 @@ -34,7 +34,7 @@
@@ -9160,12 +3611,12 @@
  #include <ooo/vba/excel/XOutline.hpp>
  #include <com/sun/star/uno/XComponentContext.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XOutline > ScVbaOutline_BASE;
  
 diff --git sc/source/ui/vba/vbapagebreak.hxx sc/source/ui/vba/vbapagebreak.hxx
-index a07cfda..338edb3 100644
+index a07cfda..a353edb 100644
 --- sc/source/ui/vba/vbapagebreak.hxx
 +++ sc/source/ui/vba/vbapagebreak.hxx
 @@ -38,7 +38,7 @@
@@ -9173,12 +3624,12 @@
  #include <com/sun/star/sheet/TablePageBreakData.hpp>
  #include <com/sun/star/beans/XPropertySet.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  template< typename Ifc1 >
  class ScVbaPageBreak : public InheritedHelperInterfaceImpl1< Ifc1 >
 diff --git sc/source/ui/vba/vbapagebreaks.hxx sc/source/ui/vba/vbapagebreaks.hxx
-index 530d82a..059b462 100644
+index 530d82a..ac99ddf 100644
 --- sc/source/ui/vba/vbapagebreaks.hxx
 +++ sc/source/ui/vba/vbapagebreaks.hxx
 @@ -41,8 +41,8 @@
@@ -9187,8 +3638,8 @@
  #include <com/sun/star/table/XColumnRowRange.hpp>
 -#include "vbahelperinterface.hxx"
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::excel::XHPageBreaks > ScVbaHPageBreaks_BASE;
  
@@ -9205,7 +3656,7 @@
  ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages )
  {
 diff --git sc/source/ui/vba/vbapages.hxx sc/source/ui/vba/vbapages.hxx
-index 6c7b23e..bf71e86 100644
+index 6c7b23e..c1755f5 100644
 --- sc/source/ui/vba/vbapages.hxx
 +++ sc/source/ui/vba/vbapages.hxx
 @@ -42,7 +42,7 @@
@@ -9213,7 +3664,7 @@
  #include <cppuhelper/implbase1.hxx>
  
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  typedef CollTestImplHelper< 
  ov::msforms::XPages > ScVbaPages_BASE;
  
@@ -9230,7 +3681,7 @@
  #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
  #include <com/sun/star/text/XText.hpp>
 diff --git sc/source/ui/vba/vbapagesetup.hxx sc/source/ui/vba/vbapagesetup.hxx
-index e60fc07..9cdbe79 100644
+index e60fc07..0026197 100644
 --- sc/source/ui/vba/vbapagesetup.hxx
 +++ sc/source/ui/vba/vbapagesetup.hxx
 @@ -35,7 +35,7 @@
@@ -9238,7 +3689,7 @@
  #include <com/sun/star/sheet/XSpreadsheet.hpp>
  #include <com/sun/star/beans/XPropertySet.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE;
  
@@ -9269,7 +3720,7 @@
  typedef cppu::WeakImplHelper1< ov::excel::XPane > PaneImpl_Base;
  
 diff --git sc/source/ui/vba/vbapictureformat.hxx sc/source/ui/vba/vbapictureformat.hxx
-index 75d2360..047ff4b 100644
+index 75d2360..a549b88 100644
 --- sc/source/ui/vba/vbapictureformat.hxx
 +++ sc/source/ui/vba/vbapictureformat.hxx
 @@ -33,7 +33,7 @@
@@ -9277,12 +3728,12 @@
  #include <com/sun/star/beans/XPropertySet.hpp>
  #include <ooo/vba/msforms/XPictureFormat.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE;
  
 diff --git sc/source/ui/vba/vbapivotcache.hxx sc/source/ui/vba/vbapivotcache.hxx
-index 2b370d3..27c0d93 100644
+index 2b370d3..2550dec 100644
 --- sc/source/ui/vba/vbapivotcache.hxx
 +++ sc/source/ui/vba/vbapivotcache.hxx
 @@ -34,7 +34,7 @@
@@ -9290,12 +3741,12 @@
  
  #include <ooo/vba/excel/XPivotCache.hpp>
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1<ov::excel::XPivotCache > PivotCacheImpl_BASE;
  
 diff --git sc/source/ui/vba/vbapivottable.hxx sc/source/ui/vba/vbapivottable.hxx
-index f105081..34cc8e1 100644
+index f105081..649e9a2 100644
 --- sc/source/ui/vba/vbapivottable.hxx
 +++ sc/source/ui/vba/vbapivottable.hxx
 @@ -33,8 +33,8 @@
@@ -9305,12 +3756,12 @@
 -#include "vbahelper.hxx"
 -#include "vbahelperinterface.hxx"
 +#include "excelvbahelper.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XPivotTable >  PivotTableImpl_BASE;
  
 diff --git sc/source/ui/vba/vbapivottables.hxx sc/source/ui/vba/vbapivottables.hxx
-index 28f1485..ff4ceca 100644
+index 28f1485..9fc7083 100644
 --- sc/source/ui/vba/vbapivottables.hxx
 +++ sc/source/ui/vba/vbapivottables.hxx
 @@ -36,9 +36,9 @@
@@ -9321,13 +3772,13 @@
 -#include "vbahelperinterface.hxx"
 -#include "vbacollectionimpl.hxx"
 +#include "excelvbahelper.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  
  typedef CollTestImplHelper< ov::excel::XPivotTables > ScVbaPivotTables_BASE;
 diff --git sc/source/ui/vba/vbaprogressbar.hxx sc/source/ui/vba/vbaprogressbar.hxx
-index d040f08..d1adcf4 100644
+index d040f08..86cbae4 100644
 --- sc/source/ui/vba/vbaprogressbar.hxx
 +++ sc/source/ui/vba/vbaprogressbar.hxx
 @@ -38,7 +38,7 @@
@@ -9335,7 +3786,7 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  #include <cppuhelper/implbase2.hxx>
  
  typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty  > ProgressBarImpl_BASE;
@@ -9353,7 +3804,7 @@
  typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
  
 diff --git sc/source/ui/vba/vbaradiobutton.hxx sc/source/ui/vba/vbaradiobutton.hxx
-index 7203aed..2924d83 100644
+index 7203aed..9a09dff 100644
 --- sc/source/ui/vba/vbaradiobutton.hxx
 +++ sc/source/ui/vba/vbaradiobutton.hxx
 @@ -31,7 +31,7 @@
@@ -9361,12 +3812,12 @@
  #include <ooo/vba/msforms/XRadioButton.hpp>
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  #include <cppuhelper/implbase2.hxx>
  
  typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE;
 diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 6b510ff..402a6e4 100644
+index 6b510ff..e243410 100644
 --- sc/source/ui/vba/vbarange.cxx
 +++ sc/source/ui/vba/vbarange.cxx
 @@ -27,7 +27,7 @@
@@ -9374,7 +3825,7 @@
   *
   ************************************************************************/
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
++#include <vbahelper/helperdecl.hxx>
  
  #include <comphelper/unwrapargs.hxx>
  #include <comphelper/processfactory.hxx>
@@ -9383,7 +3834,7 @@
  #include "vbastyle.hxx"
  #include <vector>
 -#include <vbacollectionimpl.hxx>
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  // begin test includes
  #include <com/sun/star/sheet/FunctionArgument.hpp>
  // end test includes
@@ -9397,7 +3848,7 @@
  	}
  }
 diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
-index f9e4186..4607e54 100644
+index f9e4186..57fda33 100644
 --- sc/source/ui/vba/vbarange.hxx
 +++ sc/source/ui/vba/vbarange.hxx
 @@ -53,12 +53,15 @@
@@ -9405,7 +3856,7 @@
  #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
  
 -//#include "vbahelperinterface.hxx"
-+//#include <oovbaapi/vbahelperinterface.hxx>
++//#include <vbahelper/vbahelperinterface.hxx>
  #include "vbaformat.hxx"
 +#include "address.hxx"
 +#include "grammar.hxx"
@@ -9418,7 +3869,7 @@
  //typedef InheritedHelperInterfaceImpl1< ov::excel::XRange >  ScVbaRange_BASE;
  typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE;
 diff --git sc/source/ui/vba/vbascrollbar.hxx sc/source/ui/vba/vbascrollbar.hxx
-index 04c4853..33fbcfb 100644
+index 04c4853..459f610 100644
 --- sc/source/ui/vba/vbascrollbar.hxx
 +++ sc/source/ui/vba/vbascrollbar.hxx
 @@ -38,7 +38,7 @@
@@ -9426,12 +3877,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE;
  
 diff --git sc/source/ui/vba/vbaseriescollection.hxx sc/source/ui/vba/vbaseriescollection.hxx
-index 52c57e6..cc19c86 100644
+index 52c57e6..48450ac 100644
 --- sc/source/ui/vba/vbaseriescollection.hxx
 +++ sc/source/ui/vba/vbaseriescollection.hxx
 @@ -31,9 +31,9 @@
@@ -9441,14 +3892,14 @@
 -#include "vbahelperinterface.hxx"
 -#include "vbacollectionimpl.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
 +#include "excelvbahelper.hxx"
  
  
  typedef CollTestImplHelper< ov::excel::XSeriesCollection > SeriesCollection_BASE;
 diff --git sc/source/ui/vba/vbashape.hxx sc/source/ui/vba/vbashape.hxx
-index bb24e3c..dd91137 100644
+index bb24e3c..d896a3d 100644
 --- sc/source/ui/vba/vbashape.hxx
 +++ sc/source/ui/vba/vbashape.hxx
 @@ -39,7 +39,7 @@
@@ -9456,7 +3907,7 @@
  #include <cppuhelper/implbase2.hxx>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
  typedef  ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
  
@@ -9473,7 +3924,7 @@
  #include "vbashape.hxx"
  
 diff --git sc/source/ui/vba/vbashaperange.hxx sc/source/ui/vba/vbashaperange.hxx
-index 8490c5e..4c5bedd 100644
+index 8490c5e..540f33d 100644
 --- sc/source/ui/vba/vbashaperange.hxx
 +++ sc/source/ui/vba/vbashaperange.hxx
 @@ -33,7 +33,7 @@
@@ -9481,7 +3932,7 @@
  #include <ooo/vba/msforms/XShapeRange.hpp>
  
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
  
@@ -9498,7 +3949,7 @@
  #include "vbashape.hxx"
  #include "vbashaperange.hxx"
 diff --git sc/source/ui/vba/vbashapes.hxx sc/source/ui/vba/vbashapes.hxx
-index 9155b5e..4b1a2de 100644
+index 9155b5e..c29f56b 100644
 --- sc/source/ui/vba/vbashapes.hxx
 +++ sc/source/ui/vba/vbashapes.hxx
 @@ -35,9 +35,9 @@
@@ -9506,15 +3957,15 @@
  #include <ooo/vba/msforms/XShapes.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE;
  
 diff --git sc/source/ui/vba/vbaspinbutton.hxx sc/source/ui/vba/vbaspinbutton.hxx
-index 338d71f..fb876e5 100644
+index 338d71f..8f1d6e3 100644
 --- sc/source/ui/vba/vbaspinbutton.hxx
 +++ sc/source/ui/vba/vbaspinbutton.hxx
 @@ -38,7 +38,7 @@
@@ -9522,7 +3973,7 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE;
  
@@ -9539,7 +3990,7 @@
  using namespace ::ooo::vba;
  using namespace ::com::sun::star;
 diff --git sc/source/ui/vba/vbastyles.hxx sc/source/ui/vba/vbastyles.hxx
-index f92cc7d..db14147 100644
+index f92cc7d..d934ea7 100644
 --- sc/source/ui/vba/vbastyles.hxx
 +++ sc/source/ui/vba/vbastyles.hxx
 @@ -31,7 +31,7 @@
@@ -9547,12 +3998,12 @@
  #include <ooo/vba/excel/XStyles.hpp>
  #include <com/sun/star/container/XNameContainer.hpp>
 -#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
++#include <vbahelper/vbacollectionimpl.hxx>
  
  typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE;
  class ScVbaStyles: public ScVbaStyles_BASE
 diff --git sc/source/ui/vba/vbatextbox.hxx sc/source/ui/vba/vbatextbox.hxx
-index 5767251..90cecd0 100644
+index 5767251..3abe491 100644
 --- sc/source/ui/vba/vbatextbox.hxx
 +++ sc/source/ui/vba/vbatextbox.hxx
 @@ -32,7 +32,7 @@
@@ -9560,7 +4011,7 @@
  #include <ooo/vba/msforms/XTextBox.hpp>
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
  
@@ -9578,7 +4029,7 @@
  
  typedef cppu::ImplInheritanceHelper1< ScVbaShape, ov::msforms::XTextBoxShape > TextBoxShapeImpl_BASE;
 diff --git sc/source/ui/vba/vbatextframe.hxx sc/source/ui/vba/vbatextframe.hxx
-index 99ff59f..7a6de5a 100644
+index 99ff59f..4787ddc 100644
 --- sc/source/ui/vba/vbatextframe.hxx
 +++ sc/source/ui/vba/vbatextframe.hxx
 @@ -34,7 +34,7 @@
@@ -9586,12 +4037,12 @@
  #include <ooo/vba/excel/XTextFrame.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
  #include "vbapalette.hxx"
  
  typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE;
 diff --git sc/source/ui/vba/vbatitle.hxx sc/source/ui/vba/vbatitle.hxx
-index fb35d8e..f67b67c 100644
+index fb35d8e..1553199 100644
 --- sc/source/ui/vba/vbatitle.hxx
 +++ sc/source/ui/vba/vbatitle.hxx
 @@ -30,8 +30,8 @@
@@ -9600,13 +4051,13 @@
  
 -#include "vbahelperinterface.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
 +#include "excelvbahelper.hxx"
  #include "vbainterior.hxx"
  #include "vbafont.hxx"
  #include "vbapalette.hxx"
 diff --git sc/source/ui/vba/vbatogglebutton.hxx sc/source/ui/vba/vbatogglebutton.hxx
-index 326f0a9..dd9761a 100644
+index 326f0a9..dfa5c1c 100644
 --- sc/source/ui/vba/vbatogglebutton.hxx
 +++ sc/source/ui/vba/vbatogglebutton.hxx
 @@ -38,7 +38,7 @@
@@ -9614,12 +4065,12 @@
  
  #include "vbacontrol.hxx"
 -#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
++#include <vbahelper/vbahelper.hxx>
  
  typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty  > ToggleButtonImpl_BASE;
  
 diff --git sc/source/ui/vba/vbauserform.cxx sc/source/ui/vba/vbauserform.cxx
-index 8d27e5c..71015d1 100644
+index 8d27e5c..1ba9e3c 100644
 --- sc/source/ui/vba/vbauserform.cxx
 +++ sc/source/ui/vba/vbauserform.cxx
 @@ -32,7 +32,7 @@
@@ -9627,1063 +4078,6934 @@
   *
   ************************************************************************/
 -#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
- #include "vbauserform.hxx"
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XControlContainer.hpp>
-@@ -56,11 +56,10 @@ using namespace ::com::sun::star;
- //     the models in ControlModels can be accessed by name
- // also the XDialog is a XControl ( to access the model above
++#include <vbahelper/helperdecl.hxx>
+ #include "vbauserform.hxx"
+ #include <com/sun/star/awt/XControl.hpp>
+ #include <com/sun/star/awt/XControlContainer.hpp>
+@@ -56,11 +56,10 @@ using namespace ::com::sun::star;
+ //     the models in ControlModels can be accessed by name
+ // also the XDialog is a XControl ( to access the model above
+ 
+-ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) :  ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), m_pDocShell( 0 ), mbDispose( true )
++ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) :  ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ),  mbDispose( true )
+ {
+     m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
+     uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
+-    m_pDocShell = getDocShell( m_xModel );
+     m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
+     setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
+ }
+diff --git sc/source/ui/vba/vbauserform.hxx sc/source/ui/vba/vbauserform.hxx
+index 2c8a1b7..be93dc7 100644
+--- sc/source/ui/vba/vbauserform.hxx
++++ sc/source/ui/vba/vbauserform.hxx
+@@ -40,7 +40,7 @@
+ #include <com/sun/star/awt/XDialog.hpp>
+ #include <com/sun/star/frame/XModel.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <vbahelper/vbahelperinterface.hxx>
+ #include "vbacontrol.hxx"
+ 
+ //typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE;
+@@ -50,7 +50,6 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
+ {
+ private:
+     css::uno::Reference< css::awt::XDialog > m_xDialog;
+-    ScDocShell* m_pDocShell;
+     bool mbDispose;
+ protected:
+ public:
+diff --git sc/source/ui/vba/vbavalidation.hxx sc/source/ui/vba/vbavalidation.hxx
+index fff6b8a..445a249 100644
+--- sc/source/ui/vba/vbavalidation.hxx
++++ sc/source/ui/vba/vbavalidation.hxx
+@@ -33,7 +33,7 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <ooo/vba/excel/XValidation.hpp>
+ #include <com/sun/star/table/XCellRange.hpp>
+-#include "vbahelperinterface.hxx"
++#include <vbahelper/vbahelperinterface.hxx>
+ 
+ typedef InheritedHelperInterfaceImpl1<ov::excel::XValidation > ValidationImpl_BASE;
+ 
+diff --git sc/source/ui/vba/vbawindow.cxx sc/source/ui/vba/vbawindow.cxx
+index ea4fe9a..9012ff7 100644
+--- sc/source/ui/vba/vbawindow.cxx
++++ sc/source/ui/vba/vbawindow.cxx
+@@ -27,10 +27,11 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <vbahelper/helperdecl.hxx>
+ #include "vbawindow.hxx"
+ #include "vbaworksheets.hxx"
+ #include "vbaworksheet.hxx"
++#include "vbaglobals.hxx"
+ #include "vbapane.hxx"
+ #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+ #include <com/sun/star/sheet/XSpreadsheet.hpp>
+@@ -787,7 +788,9 @@ ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException)
+ 		default:
+ 			DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
+ 	}
+-	dispatchExecute( m_xModel, nSlot );
++	ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
++	if ( pViewShell )
++		dispatchExecute( pViewShell, nSlot );
+ }
+ 
+ sal_Bool SAL_CALL
+@@ -924,14 +927,14 @@ void SAL_CALL
+ ScVbaWindow::PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
+ {
+ 	// need test, print current active sheet	
+-	PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, m_xModel, sal_True );
++	PrintOutHelper( getBestViewShell( m_xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True );
+ }
+ 
+ void SAL_CALL 
+ ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
+ {
+ 	// need test, print preview current active sheet	
+-	PrintPreviewHelper( EnableChanges, m_xModel );	
++	PrintPreviewHelper( EnableChanges, getBestViewShell( m_xModel ) );	
+ }
+ 
+ rtl::OUString& 
+diff --git sc/source/ui/vba/vbawindow.hxx sc/source/ui/vba/vbawindow.hxx
+index ee4f5c8..2fdd31c 100644
+--- sc/source/ui/vba/vbawindow.hxx
++++ sc/source/ui/vba/vbawindow.hxx
+@@ -39,7 +39,7 @@
+ #include <ooo/vba/excel/XPane.hpp>
+ #include <com/sun/star/awt/XDevice.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <vbahelper/vbahelperinterface.hxx>
+ #include "vbaworkbook.hxx"
+ 
+ typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > WindowImpl_BASE;
+diff --git sc/source/ui/vba/vbawindows.cxx sc/source/ui/vba/vbawindows.cxx
+index 517f9fd..4d9284d 100644
+--- sc/source/ui/vba/vbawindows.cxx
++++ sc/source/ui/vba/vbawindows.cxx
+@@ -37,6 +37,7 @@
+ 
+ #include <tools/urlobj.hxx>
+ #include "vbawindow.hxx"
++#include "vbaglobals.hxx"
+ //#include "vbaworkbook.hxx"
+ 
+ using namespace ::com::sun::star;
+diff --git sc/source/ui/vba/vbawindows.hxx sc/source/ui/vba/vbawindows.hxx
+index 67bda22..385530a 100644
+--- sc/source/ui/vba/vbawindows.hxx
++++ sc/source/ui/vba/vbawindows.hxx
+@@ -35,8 +35,8 @@
+ 
+ #include <com/sun/star/uno/XComponentContext.hpp>
+  
+-#include "vbahelper.hxx"
+-#include "vbacollectionimpl.hxx"
++#include "excelvbahelper.hxx"
++#include <vbahelper/vbacollectionimpl.hxx>
+ 
+ 
+ typedef CollTestImplHelper< ov::excel::XWindows > ScVbaWindows_BASE;
+diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
+index e0521dd..f3ad203 100644
+--- sc/source/ui/vba/vbaworkbook.cxx
++++ sc/source/ui/vba/vbaworkbook.cxx
+@@ -27,7 +27,7 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <vbahelper/helperdecl.hxx>
+ #include <tools/urlobj.hxx>
+ #include <comphelper/unwrapargs.hxx>
+ 
+@@ -46,7 +46,7 @@
+ #include "vbaworkbook.hxx"
+ #include "vbawindows.hxx"
+ #include "vbastyles.hxx"
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ #include "vbapalette.hxx"
+ #include <osl/file.hxx>
+ #include <stdio.h>
+diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
+index b84d84e..6c8f7da 100644
+--- sc/source/ui/vba/vbaworkbook.hxx
++++ sc/source/ui/vba/vbaworkbook.hxx
+@@ -32,7 +32,7 @@
+ 
+ #include <com/sun/star/frame/XModel.hpp>
+ #include <ooo/vba/excel/XWorkbook.hpp>
+-#include "vbahelperinterface.hxx"
++#include <vbahelper/vbahelperinterface.hxx>
+ 
+ class ScModelObj;
+ 
+diff --git sc/source/ui/vba/vbaworkbooks.cxx sc/source/ui/vba/vbaworkbooks.cxx
+index 6bb17b5..69e5693 100644
+--- sc/source/ui/vba/vbaworkbooks.cxx
++++ sc/source/ui/vba/vbaworkbooks.cxx
+@@ -56,7 +56,7 @@
+ #include "vbaglobals.hxx"
+ #include "vbaworkbook.hxx"
+ #include "vbaworkbooks.hxx"
+-#include "vbahelper.hxx"
++#include <vbahelper/vbahelper.hxx>
+ 
+ #include <hash_map>
+ #include <osl/file.hxx>
+diff --git sc/source/ui/vba/vbaworkbooks.hxx sc/source/ui/vba/vbaworkbooks.hxx
+index 7c5b421..a42d8a5 100644
+--- sc/source/ui/vba/vbaworkbooks.hxx
++++ sc/source/ui/vba/vbaworkbooks.hxx
+@@ -31,11 +31,11 @@
+ #define SC_VBA_WORKBOOKS_HXX
+ 
+ 
+-#include "vbacollectionimpl.hxx"
++#include <vbahelper/vbacollectionimpl.hxx>
+ #include <ooo/vba/XGlobals.hpp>
+ #include <ooo/vba/excel/XWorkbooks.hpp>
+ #include <com/sun/star/container/XEnumerationAccess.hpp>
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ 
+ 
+ class ScModelObj;
+diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
+index d687610..60b8f4b 100644
+--- sc/source/ui/vba/vbaworksheet.cxx
++++ sc/source/ui/vba/vbaworksheet.cxx
+@@ -27,7 +27,7 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <vbahelper/helperdecl.hxx>
+ #include <cppuhelper/queryinterface.hxx>
  
--ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) :  ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), m_pDocShell( 0 ), mbDispose( true )
-+ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) :  ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ),  mbDispose( true )
- {
-     m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
-     uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
--    m_pDocShell = getDocShell( m_xModel );
-     m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
-     setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
+ #include <com/sun/star/beans/XPropertySet.hpp>
+@@ -947,7 +947,7 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A
+ 		bSelection = sal_True;
+ 
+     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );  
+-	PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, bSelection );
++	PrintOutHelper( getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
  }
-diff --git sc/source/ui/vba/vbauserform.hxx sc/source/ui/vba/vbauserform.hxx
-index 2c8a1b7..4f8ce3e 100644
---- sc/source/ui/vba/vbauserform.hxx
-+++ sc/source/ui/vba/vbauserform.hxx
-@@ -40,7 +40,7 @@
- #include <com/sun/star/awt/XDialog.hpp>
- #include <com/sun/star/frame/XModel.hpp>
+ 
+ 
+diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
+index e70b282..d6637bb 100644
+--- sc/source/ui/vba/vbaworksheet.hxx
++++ sc/source/ui/vba/vbaworksheet.hxx
+@@ -47,7 +47,8 @@
+ #include <ooo/vba/excel/XChartObjects.hpp>
+ #include <com/sun/star/container/XNamed.hpp>
  
 -#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
- #include "vbacontrol.hxx"
++#include <vbahelper/vbahelperinterface.hxx>
++#include "address.hxx"
  
- //typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE;
-@@ -50,7 +50,6 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
- {
- private:
-     css::uno::Reference< css::awt::XDialog > m_xDialog;
--    ScDocShell* m_pDocShell;
-     bool mbDispose;
- protected:
- public:
-diff --git sc/source/ui/vba/vbavalidation.hxx sc/source/ui/vba/vbavalidation.hxx
-index fff6b8a..cd639eb 100644
---- sc/source/ui/vba/vbavalidation.hxx
-+++ sc/source/ui/vba/vbavalidation.hxx
-@@ -33,7 +33,7 @@
+ typedef InheritedHelperInterfaceImpl1< ov::excel::XWorksheet >  WorksheetImpl_BASE;
+ 
+diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
+index cfc156f..246d21c 100644
+--- sc/source/ui/vba/vbaworksheets.cxx
++++ sc/source/ui/vba/vbaworksheets.cxx
+@@ -295,7 +295,7 @@ ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno::
+ 		if ( isSelectedSheets() )
+ 			bSelection = sal_True;
+ 
+-	PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, mxModel, bSelection );
++	PrintOutHelper( getBestViewShell( mxModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
+ }
+ 
+ uno::Any SAL_CALL 
+diff --git sc/source/ui/vba/vbaworksheets.hxx sc/source/ui/vba/vbaworksheets.hxx
+index a57a86a..164196d 100644
+--- sc/source/ui/vba/vbaworksheets.hxx
++++ sc/source/ui/vba/vbaworksheets.hxx
+@@ -38,7 +38,7 @@
  #include <com/sun/star/uno/XComponentContext.hpp>
- #include <ooo/vba/excel/XValidation.hpp>
- #include <com/sun/star/table/XCellRange.hpp>
--#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
+ #include <ooo/vba/XGlobals.hpp>
+  
+-#include "vbacollectionimpl.hxx"
++#include <vbahelper/vbacollectionimpl.hxx>
  
- typedef InheritedHelperInterfaceImpl1<ov::excel::XValidation > ValidationImpl_BASE;
+ class ScModelObj;
  
-diff --git sc/source/ui/vba/vbawindow.cxx sc/source/ui/vba/vbawindow.cxx
-index ea4fe9a..67b14f7 100644
---- sc/source/ui/vba/vbawindow.cxx
-+++ sc/source/ui/vba/vbawindow.cxx
-@@ -27,10 +27,11 @@
-  * for a copy of the LGPLv3 License.
+diff --git sc/util/makefile.mk sc/util/makefile.mk
+index c88b4ab..13250b9 100644
+--- sc/util/makefile.mk
++++ sc/util/makefile.mk
+@@ -276,6 +276,7 @@ SHL9STDLIBS= \
+ 		$(TOOLSLIB) \
+ 		$(SALLIB)\
+ 		$(BASICLIB)	\
++		$(VBAHELPERLIB) \
+ 		$(SFXLIB)	\
+ 		$(SVXLIB)	\
+ 		$(SVTOOLLIB)    \
+diff --git scp2/source/ooo/file_library_ooo.scp scp2/source/ooo/file_library_ooo.scp
+index 447e0e7..bf707af 100644
+--- scp2/source/ooo/file_library_ooo.scp
++++ scp2/source/ooo/file_library_ooo.scp
+@@ -406,7 +406,42 @@ File gid_File_Lib_Vbaobj
+   #endif
+ End
+ 
++File gid_File_Lib_Vbaswobj
++    TXT_FILE_BODY;
++    Styles = (PACKED,UNO_COMPONENT);
++    RegistryID = gid_Starregistry_Services_Rdb;
++    Dir = gid_Dir_Program;
++  #ifdef UNX
++    Name = STRING(CONCAT4(libvbaswobj,DLLPOSTFIX,.uno,UNXSUFFIX));
++  #else
++    Name = STRING(CONCAT4(vbaswobj,DLLPOSTFIX,.uno,.dll));
++  #endif
++End
++
++File gid_File_Lib_Vbamsforms
++    TXT_FILE_BODY;
++    Styles = (PACKED,UNO_COMPONENT);
++    RegistryID = gid_Starregistry_Services_Rdb;
++    Dir = gid_Dir_Program;
++  #ifdef UNX
++    Name = STRING(CONCAT4(libmsforms,DLLPOSTFIX,.uno,UNXSUFFIX));
++  #else
++    Name = STRING(CONCAT4(msforms,DLLPOSTFIX,.uno,.dll));
++  #endif
++End
++
+ #endif // VBA_EXTENSION
++File gid_File_Lib_Vbahelper
++    TXT_FILE_BODY;
++    Styles = (PACKED);
++    RegistryID = gid_Starregistry_Services_Rdb;
++    Dir = gid_Dir_Program;
++  #ifdef UNX
++    Name = STRING(CONCAT3(libvbahelper,DLLPOSTFIX,UNXSUFFIX));
++  #else
++    Name = STRING(CONCAT3(vbahelper,DLLPOSTFIX,.dll));
++  #endif
++End
+ #endif // ENABLE_VBA
+ 
+ 
+diff --git solenv/inc/libs.mk solenv/inc/libs.mk
+index f686801..da2b8fc 100644
+--- solenv/inc/libs.mk
++++ solenv/inc/libs.mk
+@@ -192,6 +192,7 @@ SAXLIB=-lsax$(DLLPOSTFIX)
+ MAILLIB=-lmail
+ DOCMGRLIB=-ldmg$(DLLPOSTFIX)
+ BASICLIB=-lsb$(DLLPOSTFIX)
++VBAHELPERLIB=-lvbahelper$(DLLPOSTFIX)
+ DBTOOLSLIB=-ldbtools$(DLLPOSTFIX)
+ HM2LIBSH=-lhmwrpdll
+ HM2LIBST=-lhmwrap
+@@ -434,6 +435,7 @@ SAXLIB=isax.lib
+ MAILLIB=mail.lib
+ DOCMGRLIB=docmgr.lib
+ BASICLIB=basic.lib
++VBAHELPERLIB=vbahelper.lib
+ TKTLIB=tkt.lib
+ SJLIB=sj.lib
+ SVXLIB=isvx.lib
+diff --git sw/inc/unocoll.hxx sw/inc/unocoll.hxx
+index 7b4632d..06fe329 100644
+--- sw/inc/unocoll.hxx
++++ sw/inc/unocoll.hxx
+@@ -194,8 +194,10 @@ class SwUnoCollection
+ #define SW_SERVICE_CHART2_DATA_PROVIDER                 106
+ #define SW_SERVICE_TYPE_FIELDMARK                       107
+ #define SW_SERVICE_TYPE_FORMFIELDMARK                   108
++#define SW_SERVICE_VBAOBJECTPROVIDER                    109
++#define SW_SERVICE_VBACODENAMEPROVIDER                  110
+ 
+-#define SW_SERVICE_LAST                 SW_SERVICE_TYPE_FORMFIELDMARK
++#define SW_SERVICE_LAST                 SW_SERVICE_VBACODENAMEPROVIDER
+ 
+ #define SW_SERVICE_INVALID			USHRT_MAX
+ 
+diff --git sw/prj/build.lst sw/prj/build.lst
+index 1a799f7..428fc91 100644
+--- sw/prj/build.lst
++++ sw/prj/build.lst
+@@ -1,4 +1,4 @@
+-sw	sw	:	connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui NULL
++sw	sw	:	connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui vbahelper NULL
+ sw	sw										usr1	-	all	sw_mkout NULL
+ sw	sw\inc									nmake		-	all	sw_inc NULL
+ sw	sw\uiconfig\layout									nmake	-	all	sw_layout NULL
+@@ -33,6 +33,7 @@ sw      sw\source\ui\smartmenu                                          nmake
+ sw      sw\source\ui\table                                              nmake   -       all     sw_table sw_inc NULL
+ sw	sw\source\ui\uiview						nmake	-	all	sw_uivw sw_sdi sw_inc NULL
+ sw	sw\source\ui\uno						nmake	-	all	sw_uiuno sw_sdi sw_inc NULL
++sw	sw\source\ui\vba						nmake	-	all	sw_vba sw_inc NULL
+ sw	sw\source\ui\utlui						nmake	-	all	sw_utlui sw_inc NULL
+ sw	sw\source\ui\web						nmake	-	all	sw_web sw_uinc sw_sdi sw_inc NULL
+ sw	sw\source\ui\wrtsh						nmake	-	all	sw_wrtsh sw_inc NULL
+diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
+index 8ff51f9..c0e5e95 100644
+--- sw/source/core/unocore/unocoll.cxx
++++ sw/source/core/unocore/unocoll.cxx
+@@ -73,7 +73,12 @@
+ #include <unochart.hxx>
+ 
+ #include "docsh.hxx"
+-
++#include <com/sun/star/document/XCodeNameQuery.hpp>
++#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
++#include <com/sun/star/form/XFormsSupplier.hpp>
++#include <com/sun/star/script/ModuleInfo.hpp>
++#include <com/sun/star/script/ModuleType.hpp>
++#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+ using ::rtl::OUString;
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::document;
+@@ -82,6 +87,104 @@ using namespace ::com::sun::star::text;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::lang;
+ 
++class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
++{
++    SwDocShell* mpDocShell;
++    rtl::OUString msThisDocumentCodeName;
++public:
++    SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
++        // XCodeNameQuery
++    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
++    {
++        // Initialise the code name
++        if ( msThisDocumentCodeName.getLength() == 0 )
++        {
++            try
++            {
++                uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
++                uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
++                uno::Reference< container::XNameAccess > xStandard( xLibContainer->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ), uno::UNO_QUERY_THROW );
++                uno::Sequence< rtl::OUString > sModuleNames = xStandard->getElementNames();
++                for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
++                {
++                    script::ModuleInfo mInfo;
++                    if ( xStandard->getByName( sModuleNames[ i ] ) >>= mInfo )
++                    {
++                        if ( mInfo.ModuleType == script::ModuleType::Document )
++                        {
++                            msThisDocumentCodeName = sModuleNames[ i ];
++                            break;
++                        }
++                    } 
++                }
++		
++            }
++            catch( uno::Exception& )
++            {
++            }
++        }
++        rtl::OUString sCodeName;
++        if ( mpDocShell )
++        {
++            OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
++            // need to find the page ( and index )  for this control
++            uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
++            uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
++            sal_Int32 nLen = xIndex->getCount();
++            bool bMatched = false;
++            uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
++                try
++                {
++                    uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
++                    uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
++                    // get the www-standard container
++                    uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
++                    sal_Int32 nCntrls = xFormControls->getCount();
++                    for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
++                    {
++                        uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );	
++                        bMatched = ( xControl == xIf );
++                        if ( bMatched )
++                        {
++                            sCodeName = msThisDocumentCodeName;
++                            break;
++                        }
++                    }
++                }
++                catch( uno::Exception& ) {}
++        }
++        // Probably should throw here ( if !bMatched )
++        return sCodeName;
++    }
++};
++
++class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
++{
++    SwDocShell* mpDocShell;
++public:
++    SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
++    {
++    }
++
++    virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
++    {
++        return sal_False;
++    }
++    ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
++    {
++        return uno::Any();
++    }
++    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException)
++    {
++        uno::Sequence< rtl::OUString > aNames;
++        return aNames;
++    }
++    // XElemenAccess
++    virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
++    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
++
++};
++
+ /******************************************************************************
   *
-  ************************************************************************/
--#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
- #include "vbawindow.hxx"
- #include "vbaworksheets.hxx"
- #include "vbaworksheet.hxx"
-+#include "vbaglobals.hxx"
- #include "vbapane.hxx"
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
-@@ -787,7 +788,9 @@ ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException)
- 		default:
- 			DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- 	}
--	dispatchExecute( m_xModel, nSlot );
-+	ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
-+	if ( pViewShell )
-+		dispatchExecute( pViewShell, nSlot );
- }
- 
- sal_Bool SAL_CALL
-@@ -924,14 +927,14 @@ void SAL_CALL
- ScVbaWindow::PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- 	// need test, print current active sheet	
--	PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, m_xModel, sal_True );
-+	PrintOutHelper( getBestViewShell( m_xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True );
- }
+  ******************************************************************************/
+@@ -203,6 +306,8 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
+     { "com.sun.star.text.Fieldmark",                          SW_SERVICE_TYPE_FIELDMARK },
+     { "com.sun.star.text.FormFieldmark",                      SW_SERVICE_TYPE_FORMFIELDMARK },
+     { "com.sun.star.chart2.data.DataProvider",                SW_SERVICE_CHART2_DATA_PROVIDER },
++    { "ooo.vba.VBAObjectModuleObjectProvider",                SW_SERVICE_VBAOBJECTPROVIDER },
++    { "ooo.vba.VBACodeNameProvider",                          SW_SERVICE_VBACODENAMEPROVIDER },
  
- void SAL_CALL 
- ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- 	// need test, print preview current active sheet	
--	PrintPreviewHelper( EnableChanges, m_xModel );	
-+	PrintPreviewHelper( EnableChanges, getBestViewShell( m_xModel ) );	
- }
+     // case-correct versions of the service names (see #i67811)
+     { CSS_TEXT_TEXTFIELD_DATE_TIME,                   SW_SERVICE_FIELDTYPE_DATETIME },
+@@ -383,6 +488,18 @@ uno::Reference< uno::XInterface >   SwXServiceProvider::MakeInstance(sal_uInt16
+             xRet =  (cppu::OWeakObject*)pFieldmark;
+         }
+         break;
++		case  SW_SERVICE_VBAOBJECTPROVIDER :
++		{
++			SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
++			xRet =  (cppu::OWeakObject*)pObjProv;
++		}
++		break;
++		case  SW_SERVICE_VBACODENAMEPROVIDER :
++		{
++			SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
++			xRet =  (cppu::OWeakObject*)pObjProv;
++		}
++		break;
+         case  SW_SERVICE_TYPE_FOOTNOTE :
+             xRet =  (cppu::OWeakObject*)new SwXFootnote(sal_False);
+         break;
+diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
+index c292f2b..5055206 100644
+--- sw/source/filter/ww8/ww8par.cxx
++++ sw/source/filter/ww8/ww8par.cxx
+@@ -140,6 +140,8 @@
+ #include <svtools/itemiter.hxx>  //SfxItemIter
  
- rtl::OUString& 
-diff --git sc/source/ui/vba/vbawindow.hxx sc/source/ui/vba/vbawindow.hxx
-index ee4f5c8..aabdb06 100644
---- sc/source/ui/vba/vbawindow.hxx
-+++ sc/source/ui/vba/vbawindow.hxx
-@@ -39,7 +39,7 @@
- #include <ooo/vba/excel/XPane.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
+ #include <stdio.h>
++#include <comphelper/processfactory.hxx>
++#include <basic/basmgr.hxx>
  
--#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
- #include "vbaworkbook.hxx"
+ #ifdef DEBUG
+ #include <iostream>
+@@ -4003,7 +4005,38 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
+     }
+     else //ordinary case
+     {
++        if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
++        {
++            const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
++            maTracer.EnterEnvironment(sw::log::eMacros);
++            // Create and insert Excel vba Globals
++            uno::Reference < uno::XComponentContext > xCtx;
++            uno::Reference < beans::XPropertySet > xProps(
++            ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++            xCtx.set( xProps->getPropertyValue( rtl::OUString(
++                RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
++                uno::UNO_QUERY_THROW );
++            uno::Any aGlobs = uno::makeAny( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.word.theGlobals") ) );
++            mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
++            
++            SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
++                            pVBAFlags->IsLoadWordBasicCode(),
++                            pVBAFlags->IsLoadWordBasicStorage() );
++            String s1(CREATE_CONST_ASC("Macros"));
++            String s2(CREATE_CONST_ASC("VBA"));
++            int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
++            if( 2 & nRet )
++            {
++                maTracer.Log(sw::log::eContainsVisualBasic);
++                rDoc.SetContainsMSVBasic(true);
++            }
++
++            StoreMacroCmds();
++
++            maTracer.LeaveEnvironment(sw::log::eMacros);
++        }
+         ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
++
+     }
  
- typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > WindowImpl_BASE;
-diff --git sc/source/ui/vba/vbawindows.cxx sc/source/ui/vba/vbawindows.cxx
-index 517f9fd..4d9284d 100644
---- sc/source/ui/vba/vbawindows.cxx
-+++ sc/source/ui/vba/vbawindows.cxx
-@@ -37,6 +37,7 @@
+     ::SetProgressState(nProgress, mpDocShell);    // Update
+@@ -4077,26 +4110,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
+             eMode |= nsRedlineMode_t::REDLINE_ON;
+         if( pWDop->fRMView )
+             eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
+-        if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
+-        {
+-            const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
+-            maTracer.EnterEnvironment(sw::log::eMacros);
+-            SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
+-                            pVBAFlags->IsLoadWordBasicCode(),
+-                            pVBAFlags->IsLoadWordBasicStorage() );
+-            String s1(CREATE_CONST_ASC("Macros"));
+-            String s2(CREATE_CONST_ASC("VBA"));
+-            int nRet = aVBasic.Import( s1, s2 );
+-            if( 2 & nRet )
+-            {
+-                maTracer.Log(sw::log::eContainsVisualBasic);
+-                rDoc.SetContainsMSVBasic(true);
+-            }
+-
+-            StoreMacroCmds();
+-
+-            maTracer.LeaveEnvironment(sw::log::eMacros);
+-        }
+     }
  
- #include <tools/urlobj.hxx>
- #include "vbawindow.hxx"
+     maInsertedTables.DelAndMakeTblFrms();
+diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
+new file mode 100644
+index 0000000..96b7c8b
+--- /dev/null
++++ sw/source/ui/vba/makefile.mk
+@@ -0,0 +1,69 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.6 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..$/..$/..
++
++PRJNAME=sw
++TARGET=vbaswobj
++ENABLE_EXCEPTIONS=TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++DLLPRE =
++
++.IF "$(ENABLE_VBA)"!="YES"
++dummy:
++        @echo "not building vba..."
++.ENDIF
++ 
++INCPRE=$(INCCOM)$/$(TARGET)
++CDEFS+=-DVBA_OOBUILD_HACK
++# ------------------------------------------------------------------
++
++SLOFILES= \
++		$(SLO)$/vbaglobals.obj \
++		$(SLO)$/vbaapplication.obj \
++				$(SLO)$/service.obj \
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE :	target.mk
++
++ALLTAR : \
++        $(MISC)$/$(TARGET).don \
++
++$(SLOFILES) : $(MISC)$/$(TARGET).don
++
++$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
++        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
++        echo $@
++
+diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
+new file mode 100644
+index 0000000..c3dc180
+--- /dev/null
++++ sw/source/ui/vba/service.cxx
+@@ -0,0 +1,96 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: service.cxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "cppuhelper/implementationentry.hxx"
++#include "com/sun/star/lang/XMultiServiceFactory.hpp"
++#include "com/sun/star/registry/XRegistryKey.hpp"
++#include "comphelper/servicedecl.hxx"
++
++// =============================================================================
++// component exports
++// =============================================================================
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++
++namespace sdecl = comphelper::service_decl;
++
++namespace globals
++{
++extern sdecl::ServiceDecl const serviceDecl;
++}
++
++extern "C"
++{
++    void SAL_CALL component_getImplementationEnvironment( 
++        const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
++    {
++		OSL_TRACE("In component_getImplementationEnv");
++        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++    }
++
++    sal_Bool SAL_CALL component_writeInfo( 
++        lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
++    {
++		OSL_TRACE("In component_writeInfo");
++
++	// Component registration
++        if ( component_writeInfoHelper( pServiceManager, pRegistryKey, 
++		globals::serviceDecl ) )
++		{
++			// Singleton registration
++			try
++			{
++				registry::XRegistryKey * pKey =
++					reinterpret_cast< registry::XRegistryKey * >(pRegistryKey);
++
++				Reference< registry::XRegistryKey >xKey = pKey->createKey(
++					rtl::OUString::createFromAscii( ("ooo.vba.sw.Globals/UNO/SINGLETONS/ooo.vba.word.theGlobals") ) );
++				xKey->setStringValue( ::rtl::OUString::createFromAscii( 
++					("ooo.vba.word.Globals") ) );
++				return sal_True;
++			}
++			catch( uno::Exception& /*e*/ )
++			{
++				//recomp & friends will detect false returned and fail
++			}
++		}
++		return sal_False;
++    }
++
++    void * SAL_CALL component_getFactory( 
++        const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
++        registry::XRegistryKey * pRegistryKey )
++    {
++		OSL_TRACE("In component_getFactory for %s", pImplName );
++	void* pRet =  component_getFactoryHelper(
++        	pImplName, pServiceManager, pRegistryKey, globals::serviceDecl );
++	OSL_TRACE("Ret is 0x%x", pRet);
++	return pRet;
++    }
++}
+diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
+new file mode 100644
+index 0000000..3fd0635
+--- /dev/null
++++ sw/source/ui/vba/vbaapplication.cxx
+@@ -0,0 +1,100 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbaapplication.cxx,v $
++ * $Revision: 1.7 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include <stdio.h>
++
++
++#include "vbaapplication.hxx"
++#include <osl/file.hxx>
++
++using namespace ::ooo;
++using namespace ::com::sun::star;
++
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::uno::UNO_QUERY_THROW;
++using ::com::sun::star::uno::UNO_QUERY;
++using ::rtl::OUString;
++
++// Enable our own join detection for Intersection and Union
++// should be more efficient than using ScRangeList::Join ( because
++// we already are testing the same things )
++
++#define OWN_JOIN 1
++
++// #TODO is this defined somewhere else?
++#if ( defined UNX ) || ( defined OS2 ) //unix
++#define FILE_PATH_SEPERATOR "/"
++#else // windows
++#define FILE_PATH_SEPERATOR "\\"
++#endif 
++
++#define EXCELVERSION "11.0"
++
++uno::Any sbxToUnoValue( SbxVariable* pVar );
++
++SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( uno::Reference< vba::XHelperInterface >(), xContext )
++{
++    OSL_TRACE("SwVbaApplication::SwVbaApplication");
++}
++
++SwVbaApplication::~SwVbaApplication()
++{
++}
++	
++
++void SAL_CALL
++SwVbaApplication::DoEvents() throw ( uno::RuntimeException )
++{
++}
++
++rtl::OUString& 
++SwVbaApplication::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
++	return sImplName;
++}
++
++rtl::OUString SAL_CALL
++SwVbaApplication::getName() throw (uno::RuntimeException)
++{
++        static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
++        return appName;
++}
++
++uno::Sequence< rtl::OUString > 
++SwVbaApplication::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Application" ) );
++	}
++	return aServiceNames;
++}
+diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
+new file mode 100644
+index 0000000..f553aff
+--- /dev/null
++++ sw/source/ui/vba/vbaapplication.hxx
+@@ -0,0 +1,58 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbaapplication.hxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SW_VBA_APPLICATION_HXX
++#define SW_VBA_APPLICATION_HXX
++
++
++#include <ooo/vba/word/XApplication.hpp>
++
++#include <vbahelper/vbahelperinterface.hxx>
++
++typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
++
++class SwVbaApplication : public SwVbaApplication_BASE
++{
++private:
++public:
++	SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
++	virtual ~SwVbaApplication();
++
++	// XHelperInterface ( parent is itself )
++	virtual css::uno::Reference< ooo::vba::XHelperInterface > SAL_CALL getParent(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
++
++	// XApplication
++	
++	virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL DoEvents() throw (css::uno::RuntimeException);
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif /* SW_VBA_APPLICATION_HXX */
+diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
+new file mode 100644
+index 0000000..df7d6d9
+--- /dev/null
++++ sw/source/ui/vba/vbaglobals.cxx
+@@ -0,0 +1,109 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbaglobals.cxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include <vbahelper/helperdecl.hxx>
 +#include "vbaglobals.hxx"
- //#include "vbaworkbook.hxx"
- 
- using namespace ::com::sun::star;
-diff --git sc/source/ui/vba/vbawindows.hxx sc/source/ui/vba/vbawindows.hxx
-index 67bda22..461275c 100644
---- sc/source/ui/vba/vbawindows.hxx
-+++ sc/source/ui/vba/vbawindows.hxx
-@@ -35,8 +35,8 @@
- 
- #include <com/sun/star/uno/XComponentContext.hpp>
-  
--#include "vbahelper.hxx"
--#include "vbacollectionimpl.hxx"
-+#include "excelvbahelper.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
- 
- 
- typedef CollTestImplHelper< ov::excel::XWindows > ScVbaWindows_BASE;
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index e0521dd..10f78ee 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -27,7 +27,7 @@
-  * for a copy of the LGPLv3 License.
-  *
-  ************************************************************************/
--#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
- #include <tools/urlobj.hxx>
- #include <comphelper/unwrapargs.hxx>
- 
-@@ -46,7 +46,7 @@
- #include "vbaworkbook.hxx"
- #include "vbawindows.hxx"
- #include "vbastyles.hxx"
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- #include "vbapalette.hxx"
- #include <osl/file.hxx>
- #include <stdio.h>
-diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
-index b84d84e..125f423 100644
---- sc/source/ui/vba/vbaworkbook.hxx
-+++ sc/source/ui/vba/vbaworkbook.hxx
-@@ -32,7 +32,7 @@
- 
- #include <com/sun/star/frame/XModel.hpp>
- #include <ooo/vba/excel/XWorkbook.hpp>
--#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
- 
- class ScModelObj;
- 
-diff --git sc/source/ui/vba/vbaworkbooks.cxx sc/source/ui/vba/vbaworkbooks.cxx
-index 6bb17b5..113d3a0 100644
---- sc/source/ui/vba/vbaworkbooks.cxx
-+++ sc/source/ui/vba/vbaworkbooks.cxx
-@@ -56,7 +56,7 @@
- #include "vbaglobals.hxx"
- #include "vbaworkbook.hxx"
- #include "vbaworkbooks.hxx"
--#include "vbahelper.hxx"
-+#include <oovbaapi/vbahelper.hxx>
- 
- #include <hash_map>
- #include <osl/file.hxx>
-diff --git sc/source/ui/vba/vbaworkbooks.hxx sc/source/ui/vba/vbaworkbooks.hxx
-index 7c5b421..48dc58e 100644
---- sc/source/ui/vba/vbaworkbooks.hxx
-+++ sc/source/ui/vba/vbaworkbooks.hxx
-@@ -31,11 +31,11 @@
- #define SC_VBA_WORKBOOKS_HXX
- 
- 
--#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
- #include <ooo/vba/XGlobals.hpp>
- #include <ooo/vba/excel/XWorkbooks.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- 
- 
- class ScModelObj;
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index d687610..83d7290 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -27,7 +27,7 @@
-  * for a copy of the LGPLv3 License.
-  *
-  ************************************************************************/
--#include "helperdecl.hxx"
-+#include <oovbaapi/helperdecl.hxx>
- #include <cppuhelper/queryinterface.hxx>
- 
- #include <com/sun/star/beans/XPropertySet.hpp>
-@@ -947,7 +947,7 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A
- 		bSelection = sal_True;
- 
-     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );  
--	PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, bSelection );
-+	PrintOutHelper( getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
- }
- 
- 
-diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
-index e70b282..22dbe93 100644
---- sc/source/ui/vba/vbaworksheet.hxx
-+++ sc/source/ui/vba/vbaworksheet.hxx
-@@ -47,7 +47,8 @@
- #include <ooo/vba/excel/XChartObjects.hpp>
- #include <com/sun/star/container/XNamed.hpp>
- 
--#include "vbahelperinterface.hxx"
-+#include <oovbaapi/vbahelperinterface.hxx>
-+#include "address.hxx"
- 
- typedef InheritedHelperInterfaceImpl1< ov::excel::XWorksheet >  WorksheetImpl_BASE;
- 
-diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
-index cfc156f..246d21c 100644
---- sc/source/ui/vba/vbaworksheets.cxx
-+++ sc/source/ui/vba/vbaworksheets.cxx
-@@ -295,7 +295,7 @@ ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno::
- 		if ( isSelectedSheets() )
- 			bSelection = sal_True;
- 
--	PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, mxModel, bSelection );
-+	PrintOutHelper( getBestViewShell( mxModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
- }
- 
- uno::Any SAL_CALL 
-diff --git sc/source/ui/vba/vbaworksheets.hxx sc/source/ui/vba/vbaworksheets.hxx
-index a57a86a..29fb787 100644
---- sc/source/ui/vba/vbaworksheets.hxx
-+++ sc/source/ui/vba/vbaworksheets.hxx
-@@ -38,7 +38,7 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <ooo/vba/XGlobals.hpp>
-  
--#include "vbacollectionimpl.hxx"
-+#include <oovbaapi/vbacollectionimpl.hxx>
- 
- class ScModelObj;
- 
-diff --git sc/util/makefile.mk sc/util/makefile.mk
-index c88b4ab..13250b9 100644
---- sc/util/makefile.mk
-+++ sc/util/makefile.mk
-@@ -276,6 +276,7 @@ SHL9STDLIBS= \
- 		$(TOOLSLIB) \
- 		$(SALLIB)\
- 		$(BASICLIB)	\
-+		$(VBAHELPERLIB) \
- 		$(SFXLIB)	\
- 		$(SVXLIB)	\
- 		$(SVTOOLLIB)    \
-diff --git scp2/source/ooo/file_library_ooo.scp scp2/source/ooo/file_library_ooo.scp
-index 447e0e7..78e3dfc 100644
---- scp2/source/ooo/file_library_ooo.scp
-+++ scp2/source/ooo/file_library_ooo.scp
-@@ -406,7 +406,30 @@ File gid_File_Lib_Vbaobj
-   #endif
- End
++
++#include <comphelper/unwrapargs.hxx>
++
++#include <com/sun/star/lang/XMultiComponentFactory.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++
++#include <cppuhelper/bootstrap.hxx>
++#include "vbaapplication.hxx"
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++using namespace ::ooo::vba;
++
++
++
++// =============================================================================
++// SwVbaGlobals
++// =============================================================================
++
++SwVbaGlobals::SwVbaGlobals(  css::uno::Reference< css::uno::XComponentContext >const& rxContext )
++        :m_xContext( rxContext )
++{
++	OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
++	mxApplication = uno::Reference< word::XApplication > ( new SwVbaApplication( m_xContext) );
++}
++
++SwVbaGlobals::~SwVbaGlobals()
++{
++	OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
++}
++
++// Will throw if singleton can't be accessed 
++uno::Reference< word::XGlobals >
++SwVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException )
++{
++	uno::Reference< XGlobals > xGlobals( 
++		xContext->getValueByName( ::rtl::OUString::createFromAscii( 
++			"/singletons/ooo.vba.word.theGlobals") ), uno::UNO_QUERY);
++
++	if ( !xGlobals.is() )
++	{
++		throw uno::RuntimeException(
++                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ),
++                    uno::Reference< XInterface >() );
++	}
++	return xGlobals;
++}
++
++// =============================================================================
++// XGlobals
++// =============================================================================
++uno::Reference<word::XApplication >
++SwVbaGlobals::getApplication() throw (uno::RuntimeException)
++{
++	OSL_TRACE("In SwVbaGlobals::getApplication");	
++    return mxApplication;
++}
++
++::uno::Sequence< ::uno::Any > SAL_CALL
++SwVbaGlobals::getGlobals(  ) throw (::uno::RuntimeException)
++{
++	sal_uInt32 nMax = 0;
++	uno::Sequence< uno::Any > maGlobals(4);
++	maGlobals[ nMax++ ] <<= SwVbaGlobals::getGlobalsImpl(m_xContext);
++	maGlobals[ nMax++ ] <<= mxApplication;
++	maGlobals.realloc( nMax );
++	return maGlobals;
++}
++
++namespace globals
++{
++namespace sdecl = comphelper::service_decl;
++sdecl::class_<SwVbaGlobals, sdecl::with_args<false> > serviceImpl;
++extern sdecl::ServiceDecl const serviceDecl(
++    serviceImpl,
++    "SwVbaGlobals",
++    "ooo.vba.word.Globals" );
++}
++
+diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
+new file mode 100644
+index 0000000..b8a2033
+--- /dev/null
++++ sw/source/ui/vba/vbaglobals.hxx
+@@ -0,0 +1,69 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbaglobals.hxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SW_VBA_GLOBALS_HXX
++#define SW_VBA_GLOBALS_HXX
++
++#include <com/sun/star/lang/XServiceInfo.hpp>
++#include <com/sun/star/lang/XInitialization.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <ooo/vba/word/XGlobals.hpp>
++#include <ooo/vba/word/XApplication.hpp>
++
++#include <cppuhelper/implbase1.hxx>
++#include <vbahelper/vbahelper.hxx>
++
++    // =============================================================================
++    // class SwVbaGlobals
++    // =============================================================================
++
++    typedef ::cppu::WeakImplHelper1<    
++        ooo::vba::word::XGlobals > SwVbaGlobals_BASE;
++
++
++    class SwVbaGlobals : public SwVbaGlobals_BASE
++    {
++    private:
++            css::uno::Reference< css::uno::XComponentContext > m_xContext;
++            css::uno::Reference< ooo::vba::word::XApplication > mxApplication;
++    public:
++	
++        SwVbaGlobals(
++            css::uno::Reference< css::uno::XComponentContext >const& rxContext );
++        virtual ~SwVbaGlobals();
++
++		static 	css::uno::Reference< ooo::vba::word::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException);
++
++        // XGlobals
++        virtual css::uno::Reference<
++                        ooo::vba::word::XApplication > SAL_CALL getApplication()
++                        throw (css::uno::RuntimeException);
++	virtual css::uno::Sequence< css::uno::Any > SAL_CALL getGlobals(  ) throw (css::uno::RuntimeException);
++    };
++#endif /* SW_VBA_GLOBALS_HXX */ 
+diff --git sw/util/makefile.mk sw/util/makefile.mk
+index ef9b141..f3a33ba 100644
+--- sw/util/makefile.mk
++++ sw/util/makefile.mk
+@@ -296,6 +296,34 @@ LIB3OBJFILES = \
+         $(SLO)$/mmpreparemergepage.obj \
+         $(SLO)$/selectdbtabledialog.obj
  
-+File gid_File_Lib_Vbaswobj
-+    TXT_FILE_BODY;
-+    Styles = (PACKED,UNO_COMPONENT);
-+    RegistryID = gid_Starregistry_Services_Rdb;
-+    Dir = gid_Dir_Program;
-+  #ifdef UNX
-+    Name = STRING(CONCAT4(libvbaswobj,DLLPOSTFIX,.uno,UNXSUFFIX));
-+  #else
-+    Name = STRING(CONCAT4(vbaswobj,DLLPOSTFIX,.uno,.dll));
-+  #endif
-+End
- #endif // VBA_EXTENSION
++#target vba
++TARGET_VBA=vbaswobj
++SHL4TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno
++SHL4IMPLIB=     i$(TARGET_VBA)
++
++SHL4VERSIONMAP=$(TARGET_VBA).map
++SHL4DEF=$(MISC)$/$(SHL4TARGET).def
++DEF4NAME=$(SHL4TARGET)
++SHL4STDLIBS= \
++                $(CPPUHELPERLIB) \
++                $(VCLLIB) \
++                $(CPPULIB) \
++                $(COMPHELPERLIB) \
++                $(SVLIB) \
++                $(TOOLSLIB) \
++                $(SALLIB)\
++                $(BASICLIB)     \
++                $(SFXLIB)       \
++                $(SVXLIB)       \
++                $(SVTOOLLIB)    \
++                $(SVLLIB) \
++        $(VCLLIB) \
++        $(TKLIB) \
++
++SHL4DEPN=$(SHL1TARGETN)
++SHL4LIBS=$(SLB)$/$(TARGET_VBA).lib
++
++
+ .IF "$(GUI)$(COM)" == "WNTMSC"
+ .IF "$(ENABLE_PCH)" != "" && ( "$(PRJNAME)"!="sw" || "$(BUILD_SPECIAL)"!="TRUE" )
+ #target sw
+diff --git sw/util/vbaswobj.map sw/util/vbaswobj.map
+new file mode 100644
+index 0000000..832e82c
+--- /dev/null
++++ sw/util/vbaswobj.map
+@@ -0,0 +1,9 @@
++OOO_1.1 {
++	global:
++		component_getImplementationEnvironment;
++		component_getFactory;
++		component_writeInfo;
++
++	local:
++		*;
++};
+diff --git vbahelper/inc/vbahelper/helperdecl.hxx vbahelper/inc/vbahelper/helperdecl.hxx
+new file mode 100644
+index 0000000..7a0b495
+--- /dev/null
++++ vbahelper/inc/vbahelper/helperdecl.hxx
+@@ -0,0 +1,58 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: helperdecl.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef OOVBAAPI_SERV_DECL
++#define OOVBAAPI_SERV_DECL
++#include <comphelper/servicedecl.hxx>
++#include <ooo/vba/XHelperInterface.hpp>
++
++namespace comphelper {
++namespace service_decl {
++template <typename ImplT_, typename WithArgsT = with_args<false> >
++struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT >
++{
++    typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT;
++    /** Default ctor.  Implementation class without args, expecting
++        component context as single argument.
++    */
++    vba_service_class_() : baseT() {}
++    template <typename PostProcessFuncT>
++    /** Ctor to pass a post processing function/functor.
++        
++        @tpl PostProcessDefaultT let your compiler deduce this
++        @param postProcessFunc function/functor that gets the yet unacquired
++                               ImplT_ pointer returning a
++                               uno::Reference<uno::XInterface>
++    */
++    explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
++};
++
++} // namespace service_decl
++} // namespace comphelper
++#endif
+diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+new file mode 100644
+index 0000000..fec7b92
+--- /dev/null
++++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+@@ -0,0 +1,257 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbacollectionimpl.hxx,v $
++ * $Revision: 1.5 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
++#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
++
++#include <ooo/vba/XCollection.hpp>
++#include <com/sun/star/container/XEnumerationAccess.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/script/XDefaultMethod.hpp>
++#include <com/sun/star/container/XIndexAccess.hpp>
++#include <com/sun/star/container/XNameAccess.hpp>
++#include <com/sun/star/container/XNamed.hpp>
++
++#include <cppuhelper/implbase3.hxx>
++#include <cppuhelper/implbase2.hxx>
++#include <cppuhelper/implbase1.hxx>
++
++#include "vbahelper/vbahelper.hxx"
++#include "vbahelper/vbahelperinterface.hxx"
++
++#include <vector>
++
++typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
++
++class EnumerationHelperImpl : public EnumerationHelper_BASE
++{
++protected:
++	css::uno::Reference< css::uno::XComponentContext > m_xContext;
++	css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
++public:
++
++	EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ),  m_xEnumeration( xEnumeration ) { }
++	virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
++};
++
++// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces 
++// only requirement is the object needs to implement XName
++
++
++
++typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
++
++template< typename Ifc1 >
++class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
++{
++public:
++typedef std::vector< css::uno::Reference< Ifc1 > >  XNamedVec;
++private:
++
++	class XNamedEnumerationHelper : public EnumerationHelper_BASE
++	{
++		XNamedVec mXNamedVec;
++		typename XNamedVec::iterator mIt;
++	public:
++	        XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {}
++	
++	        virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (css::uno::RuntimeException)
++	        {
++			return ( mIt != mXNamedVec.end() );
++	        }
++	
++	        virtual css::uno::Any SAL_CALL nextElement(  ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
++	        {
++	                if ( hasMoreElements() )
++				return css::uno::makeAny( *mIt++ );
++	                throw css::container::NoSuchElementException();
++	        }
++	};
++
++protected:
++	XNamedVec mXNamedVec;
++	typename XNamedVec::iterator cachePos;
++public:
++	XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {}
++	// XElementAccess
++	virtual css::uno::Type SAL_CALL getElementType(  ) throw (css::uno::RuntimeException) { return  Ifc1::static_type(0); }
++	virtual ::sal_Bool SAL_CALL hasElements(  ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); }
++	// XNameAcess 
++	virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
++	{
++		if ( !hasByName(aName) )
++			throw css::container::NoSuchElementException();
++		return css::uno::makeAny( *cachePos );
++	}
++	virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (css::uno::RuntimeException)
++	{
++		css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() );
++		rtl::OUString* pString = sNames.getArray();
++		typename XNamedVec::iterator it = mXNamedVec.begin();
++		typename XNamedVec::iterator it_end = mXNamedVec.end();
++
++		for ( ; it != it_end; ++it, ++pString )
++		{
++			css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW );	
++			*pString = xName->getName();
++		}
++		return sNames;
++	}
++	virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
++	{
++		cachePos = mXNamedVec.begin();
++		typename XNamedVec::iterator it_end = mXNamedVec.end();
++		for ( ; cachePos != it_end; ++cachePos )
++		{
++			css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW );	
++			if ( aName.equals( xName->getName() ) )
++				break;
++		}
++		return ( cachePos != it_end );
++	}
++
++	// XElementAccess
++	virtual ::sal_Int32 SAL_CALL getCount(  ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); }	
++	virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException )
++	{
++		if ( Index < 0 || Index >= getCount() )
++			throw css::lang::IndexOutOfBoundsException();
++	
++		return css::uno::makeAny( mXNamedVec[ Index ] );
++
++	}
++	// XEnumerationAccess
++	virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration(  ) throw (css::uno::RuntimeException)
++	{
++		return new XNamedEnumerationHelper( mXNamedVec );
++	}
++};
++
++// including a HelperInterface implementation
++template< typename Ifc1 >
++class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
++{
++typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
++protected:
++	css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
++	css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
++
++	virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
++	{
++		if ( !m_xNameAccess.is() )
++			throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
++	
++		return createCollectionObject( m_xNameAccess->getByName( sIndex ) );	
++	}		
++
++	virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException)
++	{
++		if ( !m_xIndexAccess.is() )
++			throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
++		if ( nIndex <= 0 )
++		{
++			throw  css::lang::IndexOutOfBoundsException( 
++				::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
++				"index is 0 or negative" ) ), 
++				css::uno::Reference< css::uno::XInterface >() );
++		}
++		// need to adjust for vba index ( for which first element is 1 )
++		return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );		
++	}
++public:
++	ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent,   const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
++	//XCollection
++	virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
++	{
++		return m_xIndexAccess->getCount();
++	}
++
++	virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException)
++	{
++		if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING )
++		{
++			sal_Int32 nIndex = 0;
++	
++			if ( ( Index1 >>= nIndex ) != sal_True )
++			{
++				rtl::OUString message;
++				message = rtl::OUString::createFromAscii(
++					"Couldn't convert index to Int32");
++				throw  css::lang::IndexOutOfBoundsException( message,
++					css::uno::Reference< css::uno::XInterface >() );
++			}
++			return 	getItemByIntIndex( nIndex );
++		}
++		rtl::OUString aStringSheet;
++
++		Index1 >>= aStringSheet;
++		return getItemByStringIndex( aStringSheet );	
++	}
++	// XDefaultMethod
++	::rtl::OUString SAL_CALL getDefaultMethodName(  ) throw (css::uno::RuntimeException)
++	{
++		const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
++		return sName;
++	}
++	// XEnumerationAccess
++	virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;	
++
++	// XElementAccess
++	virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
++	// XElementAccess
++	virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
++	{
++		return ( m_xIndexAccess->getCount() > 0 );
++	}
++	virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
++	
++};
++
++typedef ::cppu::WeakImplHelper1<ov::XCollection> XCollection_InterfacesBASE;
++
++typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1;
++// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this )
++class ScVbaCollectionBaseImpl : public CollImplBase1
++{
++public:
++	ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){}
++
++};
++
++template <typename Ifc> // where Ifc must implement XCollectionTest
++class CollTestImplHelper :  public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
++{
++typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc >  > ImplBase1;
++
++public:
++	CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,  const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
++};
++
++
++#endif //SC_VBA_COLLECTION_IMPL_HXX
+diff --git vbahelper/inc/vbahelper/vbadllapi.h vbahelper/inc/vbahelper/vbadllapi.h
+new file mode 100644
+index 0000000..8d815fc
+--- /dev/null
++++ vbahelper/inc/vbahelper/vbadllapi.h
+@@ -0,0 +1,44 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: svldllapi.h,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef INCLUDED_VBADLLAPI_H
++#define INCLUDED_VBADLLAPI_H
++
++#include "sal/types.h"
++
++#if defined(VBAHELPER_DLLIMPLEMENTATION)
++#define VBAHELPER_DLLPUBLIC  SAL_DLLPUBLIC_EXPORT
++#else
++#define VBAHELPER_DLLPUBLIC  SAL_DLLPUBLIC_IMPORT
++#endif
++#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE
++
++#endif /* INCLUDED_SVLDLLAPI_H */
++
+diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
+new file mode 100644
+index 0000000..76b842a
+--- /dev/null
++++ vbahelper/inc/vbahelper/vbahelper.hxx
+@@ -0,0 +1,335 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbahelper.hxx,v $
++ * $Revision: 1.5.32.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef OOVBAAPI_VBA_HELPER_HXX
++#define OOVBAAPI_VBA_HELPER_HXX
++
++#include <com/sun/star/drawing/XShape.hpp>
++#include <com/sun/star/beans/XIntrospectionAccess.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/script/BasicErrorException.hpp>
++#include <com/sun/star/script/XTypeConverter.hpp>
++#include <com/sun/star/lang/IllegalArgumentException.hpp>
++#include <com/sun/star/awt/XControl.hpp>
++#include <com/sun/star/awt/XDevice.hpp>
++#include <basic/sberrors.hxx>
++#include <cppuhelper/implbase1.hxx>
++#include <com/sun/star/frame/XModel.hpp>
++#include <sfx2/dispatch.hxx>
++#include <ooo/vba/msforms/XShape.hpp>
++#define VBAHELPER_DLLIMPLEMENTATION
++#include <vbahelper/vbadllapi.h>
++namespace css = ::com::sun::star;
++
++namespace ooo 
++{
++	namespace vba 
++	{
++		template < class T > 
++		css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException)
++		{
++			if ( args.getLength() < ( nPos + 1) )
++				throw css::lang::IllegalArgumentException();
++			css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY );
++			if ( !bCanBeNull && !aSomething.is() )
++				throw css::lang::IllegalArgumentException();
++			return aSomething;
++		}
++		VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
++		VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
++
++		VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
++		VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
++		VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
++		VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
++		VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
++		VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& );
++		VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& );
++		// provide a NULL object that can be passed as variant so that 
++		// the object when passed to IsNull will return true. aNULL 
++		// contains an empty object reference
++		VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL();
++		VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection  );
++		VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges,  SfxViewShell* );
++
++		VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
++		VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
++	VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
++	VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
++	VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
++
++class VBAHELPER_DLLPUBLIC Millimeter
++{
++//Factor to translate between points and hundredths of millimeters:
++private:
++	static const double factor;
++    
++	double m_nMillimeter;
++
++public:
++	Millimeter():m_nMillimeter(0) {}
++    
++	Millimeter(double mm):m_nMillimeter(mm) {}
++    
++	void set(double mm) { m_nMillimeter = mm; }
++	void setInPoints(double points) 
++	{ 
++		m_nMillimeter = points * 0.352777778; 
++		// 25.4mm / 72 
++	}
++      
++	void setInHundredthsOfOneMillimeter(double hmm)
++	{
++		m_nMillimeter = hmm / 100;
++	}
++    
++	double get()
++	{
++		return m_nMillimeter;
++	}
++	double getInHundredthsOfOneMillimeter()
++	{
++		return m_nMillimeter * 100;
++	}
++	double getInPoints()
++	{
++		return m_nMillimeter * 2.834645669; // 72 / 25.4mm
++	}    
++
++	static sal_Int32 getInHundredthsOfOneMillimeter(double points)
++	{
++		sal_Int32 mm = static_cast<sal_Int32>(points * factor);
++		return mm;
++	}
++    
++	static double getInPoints(int _hmm)
++	{
++		double points = double( static_cast<double>(_hmm) / factor);
++		return points;
++	}
++};
++
++class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below
++{
++public:
++    virtual ~AbstractGeometryAttributes() {}
++    virtual double getLeft() = 0;
++    virtual void setLeft( double ) = 0;
++    virtual double getTop() = 0;
++    virtual void setTop( double ) = 0;
++    virtual double getHeight() = 0;
++    virtual void setHeight( double ) = 0;
++    virtual double getWidth() = 0;
++    virtual void setWidth( double ) = 0;
++};
++
++class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
++{
++public:
++    css::uno::Reference< ooo::vba::msforms::XShape > m_xShape; 
++    ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
++    virtual double getLeft()
++    {
++        return m_xShape->getLeft();
++    }
++    virtual void setLeft( double nLeft )
++    {
++        m_xShape->setLeft( nLeft );
++    }
++    virtual double getTop()
++    {
++        return m_xShape->getTop();
++    }
++    virtual void setTop( double nTop )
++    {
++        m_xShape->setTop( nTop );
++    }
++
++    virtual double getHeight()
++    {
++        return m_xShape->getHeight();
++    }
++    virtual void setHeight( double nHeight )
++    {
++        m_xShape->setHeight( nHeight );
++    }
++    virtual double getWidth()
++    {
++        return m_xShape->getWidth();
++    }
++    virtual void setWidth( double nWidth)
++    {
++        m_xShape->setHeight( nWidth );
++    }
++
++   
++};
++#define VBA_LEFT "PositionX"
++#define VBA_TOP "PositionY"
++class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
++{
++
++    css::uno::Reference< css::beans::XPropertySet > mxModel;
++public:
++    UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
++    virtual double getLeft();
++    virtual void setLeft( double nLeft );
++    virtual double getTop();
++    virtual void setTop( double nTop );
++    virtual double getHeight();
++    virtual void setHeight( double nHeight );
++    virtual double getWidth();
++    virtual void setWidth( double nWidth);
++};
++
++class VBAHELPER_DLLPUBLIC ShapeHelper
++{
++protected:
++	css::uno::Reference< css::drawing::XShape > xShape;
++public:
++	ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
++	{ 
++		if( !xShape.is() ) 
++			throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
++	}
++    
++	double getHeight()
++	{
++        	return  Millimeter::getInPoints(xShape->getSize().Height);
++    	}
++
++
++    	void setHeight(double _fheight) throw ( css::script::BasicErrorException )
++	{
++		try
++		{
++			css::awt::Size aSize = xShape->getSize();
++			aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
++			xShape->setSize(aSize);
++		}
++		catch ( css::uno::Exception& /*e*/)
++		{
++			throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
++    		}
++	}
++    
++    
++	double getWidth()
++	{ 
++		return Millimeter::getInPoints(xShape->getSize().Width);
++    	}
++
++	void setWidth(double _fWidth) throw ( css::script::BasicErrorException )
++	{
++		try
++		{
++			css::awt::Size aSize = xShape->getSize();
++			aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
++			xShape->setSize(aSize);
++		}
++		catch (css::uno::Exception& /*e*/)
++		{
++			throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
++		}
++	}
++    
++    
++	double getLeft()
++	{
++		return Millimeter::getInPoints(xShape->getPosition().X);
++	}
++
++    
++	void setLeft(double _fLeft)
++	{
++		css::awt::Point aPoint = xShape->getPosition();
++		aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
++		xShape->setPosition(aPoint);
++	}
++    
++
++	double getTop()
++	{
++        	return Millimeter::getInPoints(xShape->getPosition().Y);
++	}
++
++    
++	void setTop(double _fTop)
++	{
++		css::awt::Point aPoint = xShape->getPosition();
++		aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
++		xShape->setPosition(aPoint);
++	}
++    
++};
++
++class VBAHELPER_DLLPUBLIC ContainerUtilities
++{
++
++public: 
++	static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >&  _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator);
++	static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix );
++
++	static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
++};
++
++// really just a a place holder to ease the porting pain
++class VBAHELPER_DLLPUBLIC DebugHelper
++{
++public:
++	static void exception( const rtl::OUString&  DetailedMessage, const css::uno::Exception& ex,  int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
++	{
++		// #TODO #FIXME ( do we want to support additionalArg here )
++		throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
++	}
++
++	static void exception( int err,  const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
++	{
++		exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
++	}
++
++	static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
++	{
++		exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
++	}
++};
++	} // openoffice
++} // org
++
++namespace ov = ooo::vba;
++
++#ifdef DEBUG
++#  define SC_VBA_FIXME(a) OSL_TRACE( a )
++#  define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ ))
++#else
++#  define SC_VBA_FIXME(a)
++#  define SC_VBA_STUB()
++#endif
++
++#endif
+diff --git vbahelper/inc/vbahelper/vbahelperinterface.hxx vbahelper/inc/vbahelper/vbahelperinterface.hxx
+new file mode 100644
+index 0000000..2c67ba4
+--- /dev/null
++++ vbahelper/inc/vbahelper/vbahelperinterface.hxx
+@@ -0,0 +1,117 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbahelperinterface.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX
++#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
++
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/XHelperInterface.hpp>
++#include <vbahelper/vbahelper.hxx>
++
++// use this class when you have an a object like
++// interface  XAnInterface which contains XHelperInterface in its inheritance hierarchy
++// interface XAnInterface
++// { 
++//     interface XHelperInterface;
++//     [attribute, string] name;
++// }
++// or
++// interface XAnInterface : XHelperInterface;
++// { 
++//     [attribute, string] name;
++// }
++//
++// then this class can provide a default implementation of XHelperInterface,
++// you can use it like this
++// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE;
++// class AnInterfaceImpl : public AnInterfaceImpl_BASE
++// {
++// public:
++//     AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {}
++//     // implement XAnInterface methods only, no need to implement the XHelperInterface 
++//     // methods
++//     virtual void setName( const OUString& );  
++//     virtual OUString getName();  
++// }
++//
++const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) );
++
++template< typename Ifc1 >
++class InheritedHelperInterfaceImpl : public Ifc1
++{
++protected: 
++	css::uno::WeakReference< ov::XHelperInterface > mxParent;
++	css::uno::Reference< css::uno::XComponentContext > mxContext;
++public:
++	InheritedHelperInterfaceImpl() {}
++	InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
++	virtual rtl::OUString& getServiceImplName() = 0;
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
++
++	// XHelperInterface Methods
++	virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
++	{
++		return 0x53756E4F;
++	}
++	virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; }
++	
++	virtual css::uno::Any SAL_CALL Application(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { 
++	// #FIXME - we need some reasonable way to pass back the application
++	return  css::uno::Any(); }
++
++
++	// XServiceInfo Methods
++	virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
++	virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException) 
++	{ 
++		css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames();
++		const rtl::OUString* pStart = sServices.getConstArray();
++		const rtl::OUString* pEnd = pStart + sServices.getLength();
++		for ( ; pStart != pEnd ; ++pStart )
++			if ( (*pStart).equals( ServiceName ) )
++				return sal_True;
++		return sal_False;	
++	}
++	virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (css::uno::RuntimeException) 
++	{ 
++		css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
++		return aNames;
++	}
++ };
++
++template< typename Ifc1 >
++class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
++
++{
++typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
++public:
++	InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}	
++
++};
++#endif
+diff --git vbahelper/inc/vbahelper/vbapropvalue.hxx vbahelper/inc/vbahelper/vbapropvalue.hxx
+new file mode 100644
+index 0000000..c782f5b
+--- /dev/null
++++ vbahelper/inc/vbahelper/vbapropvalue.hxx
+@@ -0,0 +1,60 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbapropvalue.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_PROPVALULE_HXX
++#define SC_VBA_PROPVALULE_HXX
++#include <ooo/vba/XPropValue.hpp>
++#include <cppuhelper/implbase1.hxx>
++
++#include <vbahelper/vbahelper.hxx>
++
++typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
++
++class PropListener 
++{
++public:
++    virtual void setValueEvent( const css::uno::Any& value ) = 0;
++    virtual css::uno::Any getValueEvent() = 0; 
++};
++
++
++class ScVbaPropValue : public PropValueImpl_BASE 
++{
++    PropListener* m_pListener;
++public:
++    ScVbaPropValue( PropListener* pListener );
++
++    // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++
++    rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++
++};
++#endif //SC_VBA_PROPVALULE_HXX
+diff --git vbahelper/prj/.build.lst.swp vbahelper/prj/.build.lst.swp
+new file mode 100644
+index 0000000..87a3475
+Binary files /dev/null and vbahelper/prj/.build.lst.swp differ
+diff --git vbahelper/prj/build.lst vbahelper/prj/build.lst
+new file mode 100644
+index 0000000..a38a6dc
+--- /dev/null
++++ vbahelper/prj/build.lst
+@@ -0,0 +1,6 @@
++vba	vbahelper	:	oovbaapi basic sfx2 svx cppuhelper vcl comphelper svtools tools sal NULL
++vba	vbahelper									usr1	-	all	  vba_mkout NULL
++#vba	vbahelper\inc								nmake	-	all	vba_inc NULL
++vba	vbahelper\source\vbahelper                        nmake	-	all	vba_vbahelper NULL
++vba	vbahelper\source\msforms                        nmake	-	all	vba_msforms NULL
++vba	vbahelper\util								nmake	-	all	vba_util vba_vbahelper vba_msforms NULL
+diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst
+new file mode 100644
+index 0000000..bc31ac5
+--- /dev/null
++++ vbahelper/prj/d.lst
+@@ -0,0 +1,9 @@
++..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
++..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
++
++mkdir: %_DEST%\inc%_EXT%\basic
++..\inc\vbahelper\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\vbahelper\vbacollectionimpl.hxx
++..\inc\vbahelper\vbahelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelper.hxx
++..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx
++..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx
++..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h
+diff --git vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/makefile.mk
+new file mode 100644
+index 0000000..8c231ec
+--- /dev/null
++++ vbahelper/source/msforms/makefile.mk
+@@ -0,0 +1,76 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.45 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..$/..
++PRJNAME=vbahelper
++TARGET=msforms
++
++ENABLE_EXCEPTIONS := TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++
++SLOFILES=\
++    $(SLO)$/vbacontrol.obj \
++    $(SLO)$/vbabutton.obj \
++    $(SLO)$/vbacombobox.obj \
++    $(SLO)$/vbalabel.obj \
++    $(SLO)$/vbatextbox.obj \
++    $(SLO)$/vbaradiobutton.obj \
++    $(SLO)$/vbalistbox.obj \
++    $(SLO)$/vbatogglebutton.obj \
++    $(SLO)$/vbacheckbox.obj \
++    $(SLO)$/vbaframe.obj \
++    $(SLO)$/vbascrollbar.obj \
++    $(SLO)$/vbaprogressbar.obj \
++    $(SLO)$/vbamultipage.obj \
++    $(SLO)$/vbalistcontrolhelper.obj \
++    $(SLO)$/vbaspinbutton.obj \
++    $(SLO)$/vbaimage.obj \
++    $(SLO)$/vbapages.obj \
++    $(SLO)$/service.obj \
++
++# #FIXME vbapropvalue needs to move to vbahelper
++
++# --- Targets -------------------------------------------------------
++
++.INCLUDE :  target.mk
++
++ALLTAR : \
++        $(MISC)$/$(TARGET).don \
++
++$(SLOFILES) : $(MISC)$/$(TARGET).don
++
++$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
++        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
++        echo $@
++
+diff --git vbahelper/source/msforms/service.cxx vbahelper/source/msforms/service.cxx
+new file mode 100644
+index 0000000..8d20031
+--- /dev/null
++++ vbahelper/source/msforms/service.cxx
+@@ -0,0 +1,78 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: service.cxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "cppuhelper/implementationentry.hxx"
++#include "com/sun/star/lang/XMultiServiceFactory.hpp"
++#include "com/sun/star/registry/XRegistryKey.hpp"
++#include "comphelper/servicedecl.hxx"
++
++// =============================================================================
++// component exports
++// =============================================================================
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++
++namespace sdecl = comphelper::service_decl;
++
++// reference service helper(s)
++namespace  controlprovider
++{
++extern sdecl::ServiceDecl const serviceDecl;
++}
++
++extern "C"
++{
++    void SAL_CALL component_getImplementationEnvironment( 
++        const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
++    {
++		OSL_TRACE("In component_getImplementationEnv");
++        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++    }
++
++    sal_Bool SAL_CALL component_writeInfo( 
++        lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
++    {
++		OSL_TRACE("In component_writeInfo");
++
++	// Component registration
++         return component_writeInfoHelper( pServiceManager, pRegistryKey, 
++		controlprovider::serviceDecl );
++    }
++
++    void * SAL_CALL component_getFactory( 
++        const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
++        registry::XRegistryKey * pRegistryKey )
++    {
++		OSL_TRACE("In component_getFactory for %s", pImplName );
++	void* pRet =  component_getFactoryHelper(
++        	pImplName, pServiceManager, pRegistryKey, controlprovider::serviceDecl  );
++	OSL_TRACE("Ret is 0x%x", pRet);
++	return pRet;
++    }
++}
+diff --git vbahelper/source/msforms/vbabutton.cxx vbahelper/source/msforms/vbabutton.cxx
+new file mode 100644
+index 0000000..0e4d749
+--- /dev/null
++++ vbahelper/source/msforms/vbabutton.cxx
+@@ -0,0 +1,74 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbabutton.cxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbabutton.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++rtl::OUString SAL_CALL 
++ScVbaButton::getCaption() throw (css::uno::RuntimeException)
++{
++    rtl::OUString Label;
++    m_xProps->getPropertyValue( LABEL ) >>= Label;
++    return Label;
++}
++
++void SAL_CALL 
++ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
++}
++
++rtl::OUString& 
++ScVbaButton::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaButton::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbabutton.hxx vbahelper/source/msforms/vbabutton.hxx
+new file mode 100644
+index 0000000..818f245
+--- /dev/null
++++ vbahelper/source/msforms/vbabutton.hxx
+@@ -0,0 +1,51 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbabutton.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_BUTTON_HXX
++#define SC_VBA_BUTTON_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XButton.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
++
++class ScVbaButton : public ButtonImpl_BASE
++{
++public:
++    ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
++   // Attributes
++    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_BUTTON_HXX
+diff --git vbahelper/source/msforms/vbacheckbox.cxx vbahelper/source/msforms/vbacheckbox.cxx
+new file mode 100644
+index 0000000..3a6c5d9
+--- /dev/null
++++ vbahelper/source/msforms/vbacheckbox.cxx
+@@ -0,0 +1,112 @@
++/*************************************************************************
++ *
++ *  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 "vbacheckbox.hxx"
++#include <vbahelper/helperdecl.hxx>
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
++ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++rtl::OUString SAL_CALL 
++ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException)
++{
++    rtl::OUString Label;
++    m_xProps->getPropertyValue( LABEL ) >>= Label;
++    return Label;
++}
++
++void SAL_CALL 
++ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
++}
++
++uno::Any SAL_CALL 
++ScVbaCheckbox::getValue() throw (css::uno::RuntimeException)
++{
++    sal_Int16 nValue = -1;
++    m_xProps->getPropertyValue( STATE ) >>= nValue;
++    if( nValue != 0 )
++        nValue = -1;
++//    return uno::makeAny( nValue ); 
++// I must be missing something MSO says value should be -1 if selected, 0 if not
++// selected
++    return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); 
++}
++
++void SAL_CALL 
++ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
++{
++    sal_Int16 nValue = 0;
++    sal_Bool bValue = false;
++    if( _value >>= nValue )
++    {
++        if( nValue == -1)
++            nValue = 1;
++    }
++    else if ( _value >>= bValue )
++    {
++        if ( bValue )
++            nValue = 1;
++    }
++    m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
++}
++rtl::OUString& 
++ScVbaCheckbox::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaCheckbox::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) );
++	}
++	return aServiceNames;
++}
++
+diff --git vbahelper/source/msforms/vbacheckbox.hxx vbahelper/source/msforms/vbacheckbox.hxx
+new file mode 100644
+index 0000000..f3374db
+--- /dev/null
++++ vbahelper/source/msforms/vbacheckbox.hxx
+@@ -0,0 +1,61 @@
++/*************************************************************************
++ *
++ *  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_CHECKBOX_HXX
++#define SC_VBA_CHECKBOX_HXX
++#include <cppuhelper/implbase2.hxx>
++#include <ooo/vba/msforms/XRadioButton.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
++
++class ScVbaCheckbox : public CheckBoxImpl_BASE
++{
++public:
++    ScVbaCheckbox(  const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
++   // 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 css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    // XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#endif //SC_VBA_CHECKBOX_HXX
+diff --git vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacombobox.cxx
+new file mode 100644
+index 0000000..8f1e0fb
+--- /dev/null
++++ vbahelper/source/msforms/vbacombobox.cxx
+@@ -0,0 +1,175 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbacombobox.cxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbacombobox.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++//SelectedItems list of integer indexes
++//StringItemList list of items
++
++const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
++const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
++const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
++const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") );
++
++ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
++{
++    	mpListHelper.reset( new ListControlHelper( m_xProps ) );
++	// grab the default value property name
++	m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
++}
++
++// Attributes
++
++
++// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in
++// the drop down
++uno::Any SAL_CALL 
++ScVbaComboBox::getValue() throw (uno::RuntimeException)
++{
++	return m_xProps->getPropertyValue( sSourceName );
++}
++
++void SAL_CALL 
++ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
++{
++    uno::Sequence< sal_Int16 > sSelection(1);
++    _value >>= sSelection[ 0 ];
++    m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) );
++}
++
++uno::Any SAL_CALL 
++ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
++{
++	uno::Sequence< rtl::OUString > sItems;
++	m_xProps->getPropertyValue( ITEMS ) >>= sItems;
++	// should really return the item that has focus regardless of
++	// it been selected
++	if ( sItems.getLength() > 0 )
++	{
++		rtl::OUString sText = getText();
++		sal_Int32 nLen = sItems.getLength();
++		for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index )
++		{
++			if ( sItems[ index ].equals( sText ) )
++			{
++				OSL_TRACE("getListIndex returning %d", index );
++				return uno::makeAny( index );
++			}
++				
++		} 
++ 	} 
++	OSL_TRACE("getListIndex returning %d", -1 );
++	return uno::makeAny( sal_Int32( -1 ) );
++}
++
++// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one
++// of the values in the list then the selection is also set
++void SAL_CALL 
++ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
++{
++	m_xProps->setPropertyValue( sSourceName, _value );
++}
++
++// see Value
++
++::rtl::OUString SAL_CALL 
++ScVbaComboBox::getText() throw (uno::RuntimeException)
++{
++	rtl::OUString result;
++	getValue() >>= result;
++	return result;
++}
++
++void SAL_CALL 
++ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
++{
++	setValue( uno::makeAny( _text ) ); // seems the same
++}
++
++// Methods
++void SAL_CALL 
++ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
++{
++	mpListHelper->AddItem( pvargItem, pvargIndex );
++}
++
++void SAL_CALL 
++ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
++	{
++	mpListHelper->removeItem( index );
++}
++
++void SAL_CALL 
++ScVbaComboBox::Clear(  ) throw (uno::RuntimeException)
++		{
++	mpListHelper->Clear();
++		}
++
++void SAL_CALL
++ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
++{
++	ScVbaControl::setRowSource( _rowsource );
++	mpListHelper->setRowSource( _rowsource );
++		}
++
++sal_Int32 SAL_CALL
++ScVbaComboBox::getListCount() throw (uno::RuntimeException)
++		{
++	return mpListHelper->getListCount();
++		}
++		
++uno::Any SAL_CALL 
++ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
++		{
++	return mpListHelper->List( pvargIndex, pvarColumn );
++		}
++
++rtl::OUString& 
++ScVbaComboBox::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") );
++	return sImplName;
++	}
++
++uno::Sequence< rtl::OUString > 
++ScVbaComboBox::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) );
++}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbacombobox.hxx vbahelper/source/msforms/vbacombobox.hxx
+new file mode 100644
+index 0000000..d14a19f
+--- /dev/null
++++ vbahelper/source/msforms/vbacombobox.hxx
+@@ -0,0 +1,80 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbacombobox.hxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_COMBOBOX_HXX
++#define SC_VBA_COMBOBOX_HXX
++#include <cppuhelper/implbase2.hxx>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/script/XDefaultProperty.hpp>
++#include <ooo/vba/msforms/XComboBox.hpp>
++#include <comphelper/proparrhlp.hxx>
++#include <comphelper/propertycontainer.hxx>
++#include <com/sun/star/beans/PropertyAttribute.hpp>
++
++#include "vbacontrol.hxx"
++#include "vbalistcontrolhelper.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
++class ScVbaComboBox : public ComboBoxImpl_BASE
++{		
++	std::auto_ptr< ListControlHelper > mpListHelper;
++	rtl::OUString sSourceName; 
++	rtl::OUString msDftPropName;
++	bool mbDialogType;
++
++public:
++	ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false );
++
++	// Attributes
++	virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
++	virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++	virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
++
++	// Methods
++	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
++	virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
++	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
++	// XControl
++    virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
++
++	// XDefaultProperty
++        ::rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++	//XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#endif //
+diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
+new file mode 100644
+index 0000000..e005ab5
+--- /dev/null
++++ vbahelper/source/msforms/vbacontrol.cxx
+@@ -0,0 +1,520 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbacontrol.cxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include <com/sun/star/form/FormComponentType.hpp>
++#include <com/sun/star/awt/XControlModel.hpp>
++#include <com/sun/star/awt/XControl.hpp>
++#include <com/sun/star/awt/XWindow2.hpp>
++#include <com/sun/star/lang/XEventListener.hpp>
++#include <com/sun/star/drawing/XShape.hpp>
++#include <com/sun/star/drawing/XControlShape.hpp>
++#include <com/sun/star/awt/XControl.hpp>
++#include <com/sun/star/frame/XModel.hpp>
++#include <com/sun/star/view/XControlAccess.hpp>
++#include <com/sun/star/container/XChild.hpp>
++#include <com/sun/star/form/binding/XBindableValue.hpp>
++#include <com/sun/star/form/binding/XListEntrySink.hpp>
++#include <com/sun/star/table/CellAddress.hpp>
++#include <com/sun/star/table/CellRangeAddress.hpp>
++#include <ooo/vba/XControlProvider.hpp>
++#ifdef VBA_OOBUILD_HACK
++#include <svtools/bindablecontrolhelper.hxx>
++#endif
++#include"vbacontrol.hxx"
++#include"vbacombobox.hxx"
++#include "vbabutton.hxx"
++#include "vbalabel.hxx"
++#include "vbatextbox.hxx"
++#include "vbaradiobutton.hxx"
++#include "vbalistbox.hxx"
++#include "vbatogglebutton.hxx"
++#include "vbacheckbox.hxx"
++#include "vbaframe.hxx"
++#include "vbascrollbar.hxx"
++#include "vbaprogressbar.hxx"
++#include "vbamultipage.hxx"
++#include "vbaspinbutton.hxx"
++#include "vbaimage.hxx"
++#include <vbahelper/helperdecl.hxx>
++
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++uno::Reference< css::awt::XWindowPeer > 
++ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
++{
++    uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
++
++    uno::Reference< awt::XControlModel > xControlModel;
++    uno::Reference< css::awt::XWindowPeer >  xWinPeer;
++    if ( !xControlShape.is() ) 
++    { 
++        // would seem to be a Userform control
++        uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW );
++        xWinPeer =  xControl->getPeer();
++	return xWinPeer;
++    }
++    // form control
++    xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
++
++    uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
++    try
++    {
++        uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY );
++        xWinPeer =  xControl->getPeer();
++    }
++    catch( uno::Exception )
++    {
++        throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ),
++                uno::Reference< uno::XInterface >() );
++    }
++    return xWinPeer;
++}
++
++//ScVbaControlListener
++class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener >
++{
++private:
++    ScVbaControl *pControl;
++public:
++    ScVbaControlListener( ScVbaControl *pTmpControl );
++    virtual ~ScVbaControlListener();
++    virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException );
++};
++
++ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl )
++{
++}
++
++ScVbaControlListener::~ScVbaControlListener()
++{
++}
++
++void SAL_CALL
++ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException )
++{
++    if( pControl )
++    {
++        pControl->removeResouce();
++        pControl = NULL;
++    }
++}
++
++//ScVbaControl
++
++ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl,  const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ),  m_xControl( xControl ), m_xModel( xModel )
++{
++    //add listener
++    m_xEventListener.set( new ScVbaControlListener( this ) );
++    setGeometryHelper( pGeomHelper );
++    uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
++    xComponent->addEventListener( m_xEventListener );
++   
++    //init m_xProps
++    uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
++    uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ;
++    if ( xControlShape.is() ) // form control
++        m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
++    else if ( xUserFormControl.is() ) // userform control
++        m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
++}
++
++ScVbaControl::~ScVbaControl()
++{
++    if( m_xControl.is() )
++    {
++        uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
++        xComponent->removeEventListener( m_xEventListener );
++    }
++}
++
++void 
++ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper )
++{
++    mpGeometryHelper.reset( pHelper );
++}
++
++void ScVbaControl::removeResouce() throw( uno::RuntimeException )
++{
++    uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
++    xComponent->removeEventListener( m_xEventListener );
++    m_xControl= NULL;
++    m_xProps = NULL;
++}
++
++//In design model has different behavior
++sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException)
++{
++    uno::Any aValue = m_xProps->getPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) );
++    sal_Bool bRet = false;
++    aValue >>= bRet;
++    return bRet;
++}
++
++void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException)
++{
++    uno::Any aValue( bVisible );
++    m_xProps->setPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue);
++
++}
++
++sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
++{
++    uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
++    return xWindow2->isVisible();
++}
++
++void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
++{
++    uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
++    xWindow2->setVisible( bVisible );
++}
++double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
++{
++    return mpGeometryHelper->getHeight();
++}
++void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException)
++{
++    mpGeometryHelper->setHeight( _height );
++}
++
++double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException)
++{
++    return mpGeometryHelper->getWidth();
++}
++void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException)
++{
++    mpGeometryHelper->setWidth( _width );
++}
++
++double SAL_CALL
++ScVbaControl::getLeft() throw (uno::RuntimeException)
++{
++    return mpGeometryHelper->getLeft();
++}
++
++void SAL_CALL
++ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
++{
++    mpGeometryHelper->setLeft( _left );
++
++}
++
++double SAL_CALL
++ScVbaControl::getTop() throw (uno::RuntimeException)
++{
++    return mpGeometryHelper->getTop();
++}
++
++void SAL_CALL
++ScVbaControl::setTop( double _top ) throw (uno::RuntimeException)
++{
++    mpGeometryHelper->setTop( _top );
++}
++
++uno::Reference< uno::XInterface > SAL_CALL
++ScVbaControl::getObject() throw (uno::RuntimeException)
++{
++	uno::Reference< msforms::XControl > xRet( this );
++	return xRet;
++}
++
++void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) 
++{
++    uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW );
++    xWin->setFocus();
++}
++
++rtl::OUString SAL_CALL 
++ScVbaControl::getControlSource() throw (uno::RuntimeException)
++{
++// #FIXME I *hate* having these upstream differences
++// but this is necessary until I manage to upstream other
++// dependant parts
++#ifdef VBA_OOBUILD_HACK
++	rtl::OUString sControlSource;
++	uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY );
++	if ( xBindable.is() )
++	{
++		try
++		{
++			uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
++			uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY );
++			uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW );
++			table::CellAddress aAddress;
++			xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress;
++			xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) );
++                	xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource;
++}
++		catch( uno::Exception& )
++		{
++		}	
++	}
++	return sControlSource;
++#else
++	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
++#endif
++}
++
++void SAL_CALL 
++ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException)
++{
++#ifdef VBA_OOBUILD_HACK
++    rtl::OUString sEmpty;
++    svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty );
++#else
++	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported
++#endif
++}
++
++rtl::OUString SAL_CALL 
++ScVbaControl::getRowSource() throw (uno::RuntimeException)
++    {
++#ifdef VBA_OOBUILD_HACK
++	rtl::OUString sRowSource;
++	uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY );
++	if ( xListSink.is() )
++    {
++		try
++		{
++			uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
++			uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY );
++
++			uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW );
++			table::CellRangeAddress aAddress;
++			xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress;
++			xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) );
++			xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource;
++    }
++		catch( uno::Exception& )
++		{
++}
++	}
++	return sRowSource;
++#else
++	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
++#endif
++}
++
++void SAL_CALL 
++ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
++{
++#ifdef VBA_OOBUILD_HACK
++    rtl::OUString sEmpty;
++    svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource );
++#else
++	throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported
++#endif
++}
++
++rtl::OUString SAL_CALL 
++ScVbaControl::getName() throw (uno::RuntimeException)
++{
++	rtl::OUString sName;
++	m_xProps->getPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
++	return sName;
++
++}
++
++void SAL_CALL
++ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
++{
++	m_xProps->setPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
++    }
++//ScVbaControlFactory
++
++ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
++{
++}
++
++ScVbaControl* ScVbaControlFactory::createControl()  throw (uno::RuntimeException)
++{
++    return createControl( m_xModel );
++}
++ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent )  throw (uno::RuntimeException)
++{
++    uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
++    if ( xControlShape.is() ) // form controls
++        return createControl( xControlShape, xParent );
++    uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY );
++    if ( !xControl.is() )
++        throw uno::RuntimeException(); // really we should be more informative
++    return createControl( xControl, xParent );
++    
++}
++
++ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape,  const uno::Reference< uno::XInterface >& /*xParent*/ )  throw (uno::RuntimeException)
++{
++    uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
++    sal_Int32 nClassId = -1;
++    const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
++    xProps->getPropertyValue( sClassId ) >>= nClassId;
++    uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
++    switch( nClassId )
++    {
++        case form::FormComponentType::COMBOBOX:
++            return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::COMMANDBUTTON:
++            return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::FIXEDTEXT:
++            return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::TEXTFIELD:
++            return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::RADIOBUTTON:
++            return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::LISTBOX:
++            return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::SPINBUTTON:
++            return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        case form::FormComponentType::IMAGECONTROL:
++            return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
++        default:
++            throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Donot support this Control Type." ), uno::Reference< uno::XInterface >() );
++    }
++}
++
++ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl,  const uno::Reference< uno::XInterface >& xParent  )  throw (uno::RuntimeException)
++{
++    uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
++    uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW );
++    ScVbaControl* pControl = NULL;
++    uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
++    if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
++	pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );	
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
++	pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );	
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
++        pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
++    {
++        sal_Bool bToggle = sal_False;
++        xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
++        if ( bToggle )
++            pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++        else
++            pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    }
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
++        pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
++	pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
++	pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
++	pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
++	pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
++	pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
++	pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
++	pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
++    else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
++	pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
++    else
++        throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
++    return pControl;
++}
++
++rtl::OUString& 
++ScVbaControl::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaControl::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) );
++    }
++	return aServiceNames;
++}
++
++
++
++typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE;
++class ControlProviderImpl : public ControlProvider_BASE
++{
++    uno::Reference< uno::XComponentContext > m_xCtx;
++public:
++    ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {}
++    virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
++    virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
++};
++
++uno::Reference< msforms::XControl > SAL_CALL 
++ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
++{
++	uno::Reference< msforms::XControl > xControlToReturn;
++	if ( xControlShape.is() ) 
++	{
++		ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
++		xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
++	}
++	return xControlToReturn;
++		
++}
++uno::Reference< msforms::XControl > SAL_CALL 
++ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
++{
++	uno::Reference< msforms::XControl > xControlToReturn;
++	if ( xControl.is() && xDialog.is() ) 
++	{ 
++			
++		ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
++		xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
++		ScVbaControl* pControl  = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
++		pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) );
++	}
++	return xControlToReturn;
++}
++
++namespace controlprovider
++{
++namespace sdecl = comphelper::service_decl;
++sdecl::class_<ControlProviderImpl, sdecl::with_args<false> > serviceImpl;
++extern sdecl::ServiceDecl const serviceDecl(
++    serviceImpl,
++    "ControlProviderImpl",
++    "ooo.vba.ControlProvider" );
++}
++
++
+diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx
+new file mode 100644
+index 0000000..e7593e8
+--- /dev/null
++++ vbahelper/source/msforms/vbacontrol.hxx
+@@ -0,0 +1,112 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbacontrol.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_CONTROL_HXX
++#define SC_VBA_CONTROL_HXX
++
++#include <cppuhelper/implbase1.hxx>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/script/XDefaultProperty.hpp>
++#include <com/sun/star/drawing/XControlShape.hpp>
++#include <com/sun/star/awt/XControl.hpp>
++#include <com/sun/star/awt/XWindowPeer.hpp>
++#include <ooo/vba/msforms/XControl.hpp>
++
++#include <vbahelper/vbahelper.hxx>
++#include <vbahelper/vbahelperinterface.hxx>
++#include <memory>
++
++//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
++typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
++
++class ScVbaControl : public ControlImpl_BASE
++{
++private:
++    com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
++protected:
++    std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
++    css::uno::Reference< css::beans::XPropertySet > m_xProps;
++    css::uno::Reference< css::uno::XInterface > m_xControl;
++    css::uno::Reference< css::frame::XModel > m_xModel;
++
++    virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
++public:
++    ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, 
++                    const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
++    virtual ~ScVbaControl();
++    // This class will own the helper, so make sure it is allocated from 
++    // the heap
++    void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
++    // XControl
++    virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setEnabled( sal_Bool _enabled ) 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 double SAL_CALL getHeight() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
++    virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
++    virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
++    virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
++    virtual void SAL_CALL SetFocus(  ) throw (css::uno::RuntimeException);
++
++    virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
++    virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException);
++    virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
++    virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
++    //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
++    virtual void removeResouce() throw( css::uno::RuntimeException );
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++
++class ScVbaControlFactory
++{
++public:
++    ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext, 
++                    const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
++    ScVbaControl* createControl()  throw ( css::uno::RuntimeException );
++    ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent )  throw ( css::uno::RuntimeException );
++private:
++    ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >&  )  throw ( css::uno::RuntimeException );
++    ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& )  throw ( css::uno::RuntimeException );
++    css::uno::Reference< css::uno::XComponentContext > m_xContext;
++    css::uno::Reference< css::uno::XInterface > m_xControl;
++    css::uno::Reference< css::frame::XModel > m_xModel;
++};
++
++#endif//SC_VBA_CONTROL_HXX
+diff --git vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.cxx
+new file mode 100644
+index 0000000..b2827d0
+--- /dev/null
++++ vbahelper/source/msforms/vbaframe.cxx
+@@ -0,0 +1,93 @@
++/*************************************************************************
++ *
++ *  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 "vbaframe.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++rtl::OUString SAL_CALL 
++ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
++{
++    rtl::OUString Label;
++    m_xProps->getPropertyValue( LABEL ) >>= Label;
++    return Label;
++}
++
++void SAL_CALL 
++ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
++}
++
++uno::Any SAL_CALL 
++ScVbaFrame::getValue() throw (css::uno::RuntimeException)
++{
++    return uno::makeAny( getCaption() );
++}
++
++void SAL_CALL 
++ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    rtl::OUString sCaption;
++    _value >>= sCaption;
++    setCaption( sCaption ); 
++}
++
++rtl::OUString& 
++ScVbaFrame::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaFrame::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbaframe.hxx
+new file mode 100644
+index 0000000..071b5b0
+--- /dev/null
++++ vbahelper/source/msforms/vbaframe.hxx
+@@ -0,0 +1,58 @@
++/*************************************************************************
++ *
++ *  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_FRAME_HXX
++#define SC_VBA_FRAME_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XLabel.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
++
++class ScVbaFrame : public FrameImpl_BASE
++{
++public:
++    ScVbaFrame(  const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_LABEL_HXX
+diff --git vbahelper/source/msforms/vbaimage.cxx vbahelper/source/msforms/vbaimage.cxx
+new file mode 100644
+index 0000000..847a08a
+--- /dev/null
++++ vbahelper/source/msforms/vbaimage.cxx
+@@ -0,0 +1,59 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbaimage.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++rtl::OUString& 
++ScVbaImage::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaImage::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbaimage.hxx vbahelper/source/msforms/vbaimage.hxx
+new file mode 100644
+index 0000000..d64f1c3
+--- /dev/null
++++ vbahelper/source/msforms/vbaimage.hxx
+@@ -0,0 +1,48 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_IMAGE_HXX
++#define SC_VBA_IMAGE_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XImage.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE;
++
++class ScVbaImage : public ImageImpl_BASE
++{
++public:
++    ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_IMAGE_HXX
+diff --git vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.cxx
+new file mode 100644
+index 0000000..a5fa3c1
+--- /dev/null
++++ vbahelper/source/msforms/vbalabel.cxx
+@@ -0,0 +1,88 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbalabel.cxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbalabel.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++ScVbaLabel::ScVbaLabel(  const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++rtl::OUString SAL_CALL 
++ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
++{
++    rtl::OUString Label;
++    m_xProps->getPropertyValue( LABEL ) >>= Label;
++    return Label;
++}
++
++void SAL_CALL 
++ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
++}
++uno::Any SAL_CALL 
++ScVbaLabel::getValue() throw (css::uno::RuntimeException)
++{
++    return uno::makeAny( getCaption() );
++}
++
++void SAL_CALL 
++ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    rtl::OUString sCaption;
++    _value >>= sCaption;
++    setCaption( sCaption ); 
++}
++
++
++rtl::OUString& 
++ScVbaLabel::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaLabel::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalabel.hxx
+new file mode 100644
+index 0000000..3afd652
+--- /dev/null
++++ vbahelper/source/msforms/vbalabel.hxx
+@@ -0,0 +1,56 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbalabel.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_LABEL_HXX
++#define SC_VBA_LABEL_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XLabel.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++#include <cppuhelper/implbase2.hxx>
++
++typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty  > LabelImpl_BASE;
++
++class ScVbaLabel : public LabelImpl_BASE
++{
++public:
++    ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++    // XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++};
++#endif //SC_VBA_LABEL_HXX
+diff --git vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.cxx
+new file mode 100644
+index 0000000..f425069
+--- /dev/null
++++ vbahelper/source/msforms/vbalistbox.cxx
+@@ -0,0 +1,286 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbalistbox.cxx,v $
++ * $Revision: 1.4 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
++
++#include "vbalistbox.hxx"
++#include <vector>
++#include <comphelper/anytostring.hxx>
++#include <com/sun/star/script/ArrayWrapper.hpp>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
++const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
++const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
++
++
++ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++    mpListHelper.reset( new ListControlHelper( m_xProps ) );
++}
++
++// Attributes
++void SAL_CALL 
++ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
++{
++    sal_Int32 nIndex = 0;
++    _value >>= nIndex;
++    Selected( nIndex );
++}
++
++uno::Any SAL_CALL 
++ScVbaListBox::getListIndex() throw (uno::RuntimeException)
++{
++    uno::Sequence< sal_Int16 > sSelection;
++    m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
++    if ( sSelection.getLength() == 0 )
++        return uno::Any( sal_Int32( -1 ) );
++    return uno::Any( sSelection[ 0 ] );
++}
++
++uno::Any SAL_CALL 
++ScVbaListBox::getValue() throw (uno::RuntimeException)
++{
++    uno::Sequence< sal_Int16 > sSelection;
++    uno::Sequence< rtl::OUString > sItems;
++    m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
++    m_xProps->getPropertyValue( ITEMS ) >>= sItems;
++    if( getMultiSelect() )
++        throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
++    uno::Any aRet;
++    if ( sSelection.getLength() )
++        aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] ); 
++    return aRet;
++}
++
++void SAL_CALL 
++ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
++{
++    if( getMultiSelect() )
++    {	
++        throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
++    }
++    rtl::OUString sValue = getAnyAsString( _value );
++    uno::Sequence< rtl::OUString > sList;
++    m_xProps->getPropertyValue( ITEMS ) >>= sList;
++    uno::Sequence< sal_Int16 > nList;
++    sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() );
++    sal_Int16 nValue = -1;
++    sal_Int16 i = 0;
++    for( i = 0; i < nLength; i++ )
++    {
++        if( sList[i].equals( sValue ) )
++        {
++            nValue = i; 
++            break;
++        }
++    }
++    if( nValue == -1 )
++        throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
++
++    uno::Sequence< sal_Int16 > nSelectedIndices(1);
++    nSelectedIndices[ 0 ] = nValue;
++    m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); 
++    m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); 
++}
++
++::rtl::OUString SAL_CALL 
++ScVbaListBox::getText() throw (uno::RuntimeException)
++{
++	rtl::OUString result;
++	getValue() >>= result;
++	return result;
++}
++
++void SAL_CALL 
++ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
++{
++	setValue( uno::makeAny( _text ) ); // seems the same
++}
++
++sal_Bool SAL_CALL 
++ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
++{
++    sal_Bool bMultiSelect = sal_False;
++    m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
++    return bMultiSelect;
++}
++
++void SAL_CALL 
++ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
++}
++
++css::uno::Any SAL_CALL 
++ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
++{
++    uno::Sequence< rtl::OUString > sList;
++    m_xProps->getPropertyValue( ITEMS ) >>= sList;
++    sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
++    sal_Int16 nIndex( index );
++    if( nIndex < 0 || nIndex >= nLength )
++        throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Error Number." ), uno::Reference< uno::XInterface >() );
++    m_nIndex = static_cast< sal_Int16 >( index );
++    return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
++}
++
++// Methods
++void SAL_CALL 
++ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
++{
++	mpListHelper->AddItem( pvargItem, pvargIndex );
++		}
++
++void SAL_CALL 
++ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
++		{
++	mpListHelper->removeItem( index );
++		}
++
++void SAL_CALL 
++ScVbaListBox::Clear(  ) throw (uno::RuntimeException)
++{
++	mpListHelper->Clear();
++}
++
++// this is called when something like the following vba code is used
++// to set the selected state of particular entries in the Listbox
++// ListBox1.Selected( 3 ) = false
++//PropListener
++void 
++ScVbaListBox::setValueEvent( const uno::Any& value )
++{
++    sal_Bool bValue = sal_False;
++    if( !(value >>= bValue) )
++        throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
++    uno::Sequence< sal_Int16 > nList;
++    m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList;
++    sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
++    sal_Int16 nIndex = m_nIndex;
++    for( sal_Int16 i = 0; i < nLength; i++ )
++    {
++        if( nList[i] == nIndex )
++        {
++            if( bValue )
++                return;
++            else
++            {
++                for( ; i < nLength - 1; i++ )
++                {
++                    nList[i] = nList[i + 1];
++                }
++                nList.realloc( nLength - 1 );
++                //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
++		m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
++                return;
++            }
++        }
++    }
++    if( bValue )
++    {
++        if( getMultiSelect() )
++        {
++            nList.realloc( nLength + 1 );
++            nList[nLength] = nIndex;
++        }
++        else
++        {
++            nList.realloc( 1 );
++            nList[0] = nIndex;
++        }
++        m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
++    }
++}
++
++// this is called when something like the following vba code is used
++// to determine the selected state of particular entries in the Listbox
++// msgbox ListBox1.Selected( 3 )
++
++css::uno::Any 
++ScVbaListBox::getValueEvent()
++{
++    uno::Sequence< sal_Int16 > nList;
++    m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
++    sal_Int32 nLength = nList.getLength();
++    sal_Int32 nIndex = m_nIndex;
++    
++    for( sal_Int32 i = 0; i < nLength; i++ )
++    {
++        if( nList[i] == nIndex )
++            return uno::makeAny( sal_True );
++    }
++
++    return uno::makeAny( sal_False );
++}
++
++void SAL_CALL
++ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
++{
++	ScVbaControl::setRowSource( _rowsource );
++	mpListHelper->setRowSource( _rowsource );
++}
++
++sal_Int32 SAL_CALL
++ScVbaListBox::getListCount() throw (uno::RuntimeException)
++{
++	return mpListHelper->getListCount();
++}
++
++uno::Any SAL_CALL 
++ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
++{
++	return mpListHelper->List( pvargIndex, pvarColumn );
++}
++
++rtl::OUString& 
++ScVbaListBox::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaListBox::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbalistbox.hxx vbahelper/source/msforms/vbalistbox.hxx
+new file mode 100644
+index 0000000..93e80a3
+--- /dev/null
++++ vbahelper/source/msforms/vbalistbox.hxx
+@@ -0,0 +1,90 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbalistbox.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_LISTBOX_HXX
++#define SC_VBA_LISTBOX_HXX
++#include <cppuhelper/implbase2.hxx>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/script/XDefaultProperty.hpp>
++#include <ooo/vba/msforms/XListBox.hpp>
++#include <com/sun/star/beans/PropertyAttribute.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbapropvalue.hxx>
++#include "vbalistcontrolhelper.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
++class ScVbaListBox : public ListBoxImpl_BASE
++    ,public PropListener
++{		
++	std::auto_ptr< ListControlHelper > mpListHelper;
++	rtl::OUString sSourceName; 
++	rtl::OUString msDftPropName;
++
++    sal_Int16 m_nIndex;
++	
++public:
++	ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
++
++	// Attributes
++	virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++	virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
++    virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
++    virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
++
++	// Methods
++	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
++    virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
++	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
++	// XControl
++    virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
++
++	// XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++    
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();    
++
++    //PropListener
++    virtual void setValueEvent( const css::uno::Any& value );
++    virtual css::uno::Any getValueEvent();
++
++
++};
++
++#endif //
+diff --git vbahelper/source/msforms/vbalistcontrolhelper.cxx vbahelper/source/msforms/vbalistcontrolhelper.cxx
+new file mode 100644
+index 0000000..8582821
+--- /dev/null
++++ vbahelper/source/msforms/vbalistcontrolhelper.cxx
+@@ -0,0 +1,146 @@
++#include <vbalistcontrolhelper.hxx>
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
++
++void SAL_CALL 
++ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
++{
++	if ( pvargItem.hasValue()  )
++	{
++		uno::Sequence< rtl::OUString > sList;
++		m_xProps->getPropertyValue( ITEMS ) >>= sList;
++
++		sal_Int32 nIndex = sList.getLength();
++
++		if ( pvargIndex.hasValue() )
++			pvargIndex >>= nIndex;
++
++		rtl::OUString sString = getAnyAsString( pvargItem );
++
++		// if no index specified or item is to be appended to end of 
++		// list just realloc the array and set the last item
++		if ( nIndex  == sList.getLength() )
++		{
++			sal_Int32 nOldSize = sList.getLength();
++			sList.realloc( nOldSize + 1 );
++			sList[ nOldSize ] = sString; 
++		}
++		else
++		{
++			// just copy those elements above the one to be inserted
++			std::vector< rtl::OUString > sVec;
++			// reserve just the amount we need to copy
++			sVec.reserve( sList.getLength() - nIndex );
++
++			// point at first element to copy
++			rtl::OUString* pString = sList.getArray() + nIndex;
++			const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
++			// insert the new element
++			sVec.push_back( sString );
++			// copy elements	
++			for ( ; pString != pEndString; ++pString )
++				sVec.push_back( *pString );
++		
++			sList.realloc(  sList.getLength() + 1 );
++
++			// point at first element to be overwritten
++			pString = sList.getArray() + nIndex;
++			pEndString = sList.getArray() + sList.getLength();
++			std::vector< rtl::OUString >::iterator it = sVec.begin();
++			for ( ; pString != pEndString; ++pString, ++it)
++				*pString = *it;	
++			//
++		}
++
++		m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
++		
++	}
++}
++
++void SAL_CALL 
++ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
++{
++    sal_Int32 nIndex = 0;
++    // for int index
++	if ( index >>= nIndex  )
++	{
++		uno::Sequence< rtl::OUString > sList;
++		m_xProps->getPropertyValue( ITEMS ) >>= sList;
++        if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
++            throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
++        if( sList.hasElements() )
++        {
++            if( sList.getLength() == 1 )
++            {
++                Clear();
++                return;
++            }
++            for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
++            {
++                sList[i] = sList[i+1];
++            }
++			sList.realloc(  sList.getLength() - 1 );
++		}
++
++		m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
++	}
++}
++
++void SAL_CALL 
++ListControlHelper::Clear(  ) throw (uno::RuntimeException)
++{
++	// urk, setValue doesn't seem to work !!
++	//setValue( uno::makeAny( sal_Int16() ) );
++	m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
++}
++
++void SAL_CALL
++ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
++{
++	if ( _rowsource.getLength() == 0 )
++		Clear();
++}
++
++sal_Int32 SAL_CALL
++ListControlHelper::getListCount() throw (uno::RuntimeException)
++{
++    uno::Sequence< rtl::OUString > sList;
++    m_xProps->getPropertyValue( ITEMS ) >>= sList;
++    return sList.getLength();
++}
++
++uno::Any SAL_CALL 
++ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
++{
++    uno::Sequence< rtl::OUString > sList;
++    m_xProps->getPropertyValue( ITEMS ) >>= sList;
++    sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
++    uno::Any aRet;
++    if ( pvargIndex.hasValue() )
++    {
++        sal_Int16 nIndex = -1;
++        pvargIndex >>= nIndex;
++        if( nIndex < 0 || nIndex >= nLength )
++            throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Bad row Index" ), uno::Reference< uno::XInterface >() );       
++        aRet <<= sList[ nIndex ];
++    }
++    else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
++            throw uno::RuntimeException( rtl::OUString::createFromAscii(
++                    "Bad column Index" ), uno::Reference< uno::XInterface >() );       
++    else // List() ( e.g. no args )
++    {
++        uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
++        for ( sal_Int32 i = 0; i < nLength; ++i )
++        {
++            sReturnArray[ i ].realloc( 10 );
++            sReturnArray[ i ][ 0 ] = sList[ i ];
++        }        
++        aRet = uno::makeAny( sReturnArray );
++    }
++    return aRet;
++}
+diff --git vbahelper/source/msforms/vbalistcontrolhelper.hxx vbahelper/source/msforms/vbalistcontrolhelper.hxx
+new file mode 100644
+index 0000000..53f369f
+--- /dev/null
++++ vbahelper/source/msforms/vbalistcontrolhelper.hxx
+@@ -0,0 +1,20 @@
++#ifndef SC_VBA_LISTCONTROLHELPER
++#define SC_VBA_LISTCONTROLHELPER
++
++#include <vbahelper/vbahelper.hxx>
++
++class ListControlHelper
++{
++	css::uno::Reference< css::beans::XPropertySet > m_xProps;
++
++public:
++	ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){}
++
++	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
++	virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);   
++    	virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
++	virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
++	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
++};
++#endif
+diff --git vbahelper/source/msforms/vbamultipage.cxx vbahelper/source/msforms/vbamultipage.cxx
+new file mode 100644
+index 0000000..118e005
+--- /dev/null
++++ vbahelper/source/msforms/vbamultipage.cxx
+@@ -0,0 +1,132 @@
++/*************************************************************************
++ *
++ *  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 "vbamultipage.hxx"
++#include <ooo/vba/XCollection.hpp>
++#include "vbapages.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++// uno servicename com.sun.star.awt.UnoControlProgressBarMode
++const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
++const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") );
++const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") );
++
++typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base;
++class PagesImpl : public PagesImpl_Base
++{
++	sal_Int32 mnPages;
++public:
++	PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {}
++	virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; }
++	virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException)
++	{
++		if ( Index < 0 || Index > mnPages )
++			throw lang::IndexOutOfBoundsException();
++		return uno::makeAny( uno::Reference< uno::XInterface >() );
++	}
++	// XElementAccess
++	virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
++	{
++		// no Pages object yet #FIXME
++		//return msforms::XPage::static_type(0);
++		return uno::XInterface::static_type(0);
++	}
++	virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
++	{
++		return ( mnPages > 0 );
++	}
++};
++uno::Reference< container::XIndexAccess > 
++ScVbaMultiPage::getPages( sal_Int32 nPages )
++{
++	return new PagesImpl( nPages );
++}
++
++ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++    mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
++    // set dialog step to value of multipage pseudo model
++    setValue(getValue());
++}
++
++// Attributes
++sal_Int32 SAL_CALL 
++ScVbaMultiPage::getValue() throw (css::uno::RuntimeException)
++{
++    sal_Int32 nValue = 0;
++    m_xProps->getPropertyValue( SVALUE ) >>= nValue;
++    return nValue;
++}
++
++void SAL_CALL 
++ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    // track change in dialog ( dialog value is 1 based, 0 is a special value )
++    m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
++    mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
++}
++
++
++rtl::OUString& 
++ScVbaMultiPage::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") );
++	return sImplName;
++}
++
++uno::Any SAL_CALL 
++ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException)
++{
++	sal_Int32 nValue = 0;
++	m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue;
++	uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) );
++	if ( !index.hasValue() )
++		return uno::makeAny( xColl );
++	return xColl->Item( uno::makeAny( index ), uno::Any() );
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaMultiPage::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbamultipage.hxx vbahelper/source/msforms/vbamultipage.hxx
+new file mode 100644
+index 0000000..05d0775
+--- /dev/null
++++ vbahelper/source/msforms/vbamultipage.hxx
+@@ -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 SC_VBA_MULTIPAGE_HXX
++#define SC_VBA_MULTIPAGE_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XMultiPage.hpp>
++#include <com/sun/star/container/XIndexAccess.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++//#include <cppuhelper/implbase2.hxx>
++#include <cppuhelper/implbase1.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE;
++
++class ScVbaMultiPage : public MultiPageImpl_BASE
++{
++    css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages );
++    css::uno::Reference< css::beans::XPropertySet > mxDialogProps;
++public:
++    ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog );
++   // Attributes
++    virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const sal_Int32 _value ) throw (css::uno::RuntimeException);
++    virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException);
++
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++    // XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++};
++#endif //SC_VBA_LABEL_HXX
+diff --git vbahelper/source/msforms/vbapages.cxx vbahelper/source/msforms/vbapages.cxx
+new file mode 100644
+index 0000000..db28086
+--- /dev/null
++++ vbahelper/source/msforms/vbapages.cxx
+@@ -0,0 +1,80 @@
++/*************************************************************************
++ *
++ *  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 "vbapages.hxx"
++
++using namespace ::ooo::vba;
++using namespace ::com::sun::star;
++
++ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages )
++{
++}
++
++uno::Type SAL_CALL 
++ScVbaPages::getElementType() throw (uno::RuntimeException)
++{
++	// return msforms::XPage::static_type(0); 
++	return uno::XInterface::static_type(0); 
++}
++
++uno::Any 
++ScVbaPages::createCollectionObject( const css::uno::Any& aSource )
++{
++	return aSource;
++}
++
++rtl::OUString& 
++ScVbaPages::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") );
++	return sImplName;
++}
++
++uno::Reference< container::XEnumeration > SAL_CALL 
++ScVbaPages::createEnumeration() throw (uno::RuntimeException)
++{
++	return uno::Reference< container::XEnumeration >();
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaPages::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbapages.hxx vbahelper/source/msforms/vbapages.hxx
+new file mode 100644
+index 0000000..c1755f5
+--- /dev/null
++++ vbahelper/source/msforms/vbapages.hxx
+@@ -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 SC_VBA_PAGES_HXX
++#define SC_VBA_PAGES_HXX
++
++#include <ooo/vba/office/MsoShapeType.hpp>
++#include <com/sun/star/lang/XEventListener.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <ooo/vba/msforms/XPages.hpp>
++#include <cppuhelper/implbase2.hxx>
++#include <cppuhelper/implbase1.hxx>
++
++#include <vbahelper/vbacollectionimpl.hxx>
++typedef CollTestImplHelper< 
++ov::msforms::XPages > ScVbaPages_BASE;
++
++class ScVbaPages : public ScVbaPages_BASE
++{
++protected:
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++public:
++    ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException );
++    virtual ~ScVbaPages() {}
++        // XEnumerationAccess
++    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
++    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
++     // ScVbaPages_BASE
++     virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
++
++};
++#endif//SC_VBA_SHAPE_HXX
+diff --git vbahelper/source/msforms/vbaprogressbar.cxx vbahelper/source/msforms/vbaprogressbar.cxx
+new file mode 100644
+index 0000000..77f3eca
+--- /dev/null
++++ vbahelper/source/msforms/vbaprogressbar.cxx
+@@ -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
++ *
++ ************************************************************************/
++#include "vbaprogressbar.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++// uno servicename com.sun.star.awt.UnoControlProgressBarMode
++const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
++
++ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++uno::Any SAL_CALL 
++ScVbaProgressBar::getValue() throw (css::uno::RuntimeException)
++{
++    return m_xProps->getPropertyValue( SVALUE );
++}
++
++void SAL_CALL 
++ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SVALUE,  _value );
++}
++
++rtl::OUString& 
++ScVbaProgressBar::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaProgressBar::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbaprogressbar.hxx vbahelper/source/msforms/vbaprogressbar.hxx
+new file mode 100644
+index 0000000..86cbae4
+--- /dev/null
++++ vbahelper/source/msforms/vbaprogressbar.hxx
+@@ -0,0 +1,59 @@
++/*************************************************************************
++ *
++ *  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_PROGRESSBAR_HXX
++#define SC_VBA_PROGRESSBAR_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XProgressBar.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++#include <cppuhelper/implbase2.hxx>
++
++typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty  > ProgressBarImpl_BASE;
++
++class ScVbaProgressBar : public ProgressBarImpl_BASE
++{
++public:
++    ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++    // XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++};
++#endif //SC_VBA_LABEL_HXX
+diff --git vbahelper/source/msforms/vbaradiobutton.cxx vbahelper/source/msforms/vbaradiobutton.cxx
+new file mode 100644
+index 0000000..5aa9d20
+--- /dev/null
++++ vbahelper/source/msforms/vbaradiobutton.cxx
+@@ -0,0 +1,107 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbaradiobutton.cxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbaradiobutton.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
++ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++rtl::OUString SAL_CALL 
++ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException)
++{
++    rtl::OUString Label;
++    m_xProps->getPropertyValue( LABEL ) >>= Label;
++    return Label;
++}
++
++void SAL_CALL 
++ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
++}
++
++uno::Any SAL_CALL 
++ScVbaRadioButton::getValue() throw (css::uno::RuntimeException)
++{
++    sal_Int16 nValue = -1;
++    m_xProps->getPropertyValue( STATE ) >>= nValue;
++    if( nValue != 0 )
++        nValue = -1;
++//    return uno::makeAny( nValue ); 
++// I must be missing something MSO says value should be -1 if selected, 0 if not
++// selected
++    return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); 
++
++}
++
++void SAL_CALL 
++ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
++{
++    sal_Int16 nValue = 0;
++    sal_Bool bValue = sal_False;
++    if( _value >>= nValue )
++    {
++        if( nValue == -1)
++        nValue = 1;
++    }
++    else if ( _value >>= bValue )
++    {
++        if ( bValue )
++            nValue = 1;
++    }
++    m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
++}
++
++rtl::OUString& 
++ScVbaRadioButton::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaRadioButton::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbaradiobutton.hxx vbahelper/source/msforms/vbaradiobutton.hxx
+new file mode 100644
+index 0000000..9a09dff
+--- /dev/null
++++ vbahelper/source/msforms/vbaradiobutton.hxx
+@@ -0,0 +1,55 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbaradiobutton.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_RADIOBUTTON_HXX
++#define SC_VBA_RADIOBUTTON_HXX
++#include <ooo/vba/msforms/XRadioButton.hpp>
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++#include <cppuhelper/implbase2.hxx>
++
++typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE;
++
++class ScVbaRadioButton : public RadioButtonImpl_BASE
++{
++public:
++    ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
++   // 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 css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++    // XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++
++};
++#endif //SC_VBA_RADIOBUTTON_HXX
+diff --git vbahelper/source/msforms/vbascrollbar.cxx vbahelper/source/msforms/vbascrollbar.cxx
+new file mode 100644
+index 0000000..e754903
+--- /dev/null
++++ vbahelper/source/msforms/vbascrollbar.cxx
+@@ -0,0 +1,139 @@
++/*************************************************************************
++ *
++ *  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 "vbascrollbar.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") );
++const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") );
++const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
++const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") );
++const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") );
++const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") );
++
++ScVbaScrollBar::ScVbaScrollBar(  const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++uno::Any SAL_CALL 
++ScVbaScrollBar::getValue() throw (css::uno::RuntimeException)
++{
++    return  m_xProps->getPropertyValue( SCROLLVALUE );
++}
++
++void SAL_CALL 
++ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SCROLLVALUE, _value );
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaScrollBar::getMax() throw (uno::RuntimeException)
++{
++    sal_Int32 nMax = 0;
++    m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax;
++    return nMax;
++}
++
++void SAL_CALL 
++ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); 
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaScrollBar::getMin() throw (uno::RuntimeException)
++{
++    sal_Int32 nVal = 0;
++    m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal;
++    return nVal;
++}
++
++void SAL_CALL 
++ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); 
++}
++
++void SAL_CALL 
++ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) );
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException)
++{
++    sal_Int32 nVal = 0;
++    m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal;
++    return nVal;
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException)
++{
++    sal_Int32 nSmallChange = 0;
++    m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange;
++    return nSmallChange;
++}
++
++void SAL_CALL 
++ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) );
++}
++
++rtl::OUString& 
++ScVbaScrollBar::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaScrollBar::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbascrollbar.hxx vbahelper/source/msforms/vbascrollbar.hxx
+new file mode 100644
+index 0000000..459f610
+--- /dev/null
++++ vbahelper/source/msforms/vbascrollbar.hxx
+@@ -0,0 +1,66 @@
++/*************************************************************************
++ *
++ *  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_SCROLLBAR_HXX
++#define SC_VBA_SCROLLBAR_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XScrollBar.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE;
++
++class ScVbaScrollBar : public ScrollBarImpl_BASE
++{
++public:
++    ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException);
++
++
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_LABEL_HXX
+diff --git vbahelper/source/msforms/vbaspinbutton.cxx vbahelper/source/msforms/vbaspinbutton.cxx
+new file mode 100644
+index 0000000..05b6777
+--- /dev/null
++++ vbahelper/source/msforms/vbaspinbutton.cxx
+@@ -0,0 +1,109 @@
++/*************************************************************************
++ *
++ *  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 "vbaspinbutton.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
++const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") );
++const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") );
++const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") );
++
++ScVbaSpinButton::ScVbaSpinButton(  const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++}
++
++// Attributes
++uno::Any SAL_CALL 
++ScVbaSpinButton::getValue() throw (css::uno::RuntimeException)
++{
++    return  m_xProps->getPropertyValue( SPINVALUE );
++}
++
++void SAL_CALL 
++ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SPINVALUE, _value );
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaSpinButton::getMax() throw (uno::RuntimeException)
++{
++    sal_Int32 nMax = 0;
++    m_xProps->getPropertyValue( SPINMAX ) >>= nMax;
++    return nMax;
++}
++
++void SAL_CALL 
++ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); 
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaSpinButton::getMin() throw (uno::RuntimeException)
++{
++    sal_Int32 nVal = 0;
++    m_xProps->getPropertyValue( SPINMIN ) >>= nVal;
++    return nVal;
++}
++
++void SAL_CALL 
++ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); 
++}
++
++rtl::OUString& 
++ScVbaSpinButton::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaSpinButton::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbaspinbutton.hxx vbahelper/source/msforms/vbaspinbutton.hxx
+new file mode 100644
+index 0000000..8f1d6e3
+--- /dev/null
++++ vbahelper/source/msforms/vbaspinbutton.hxx
+@@ -0,0 +1,61 @@
++/*************************************************************************
++ *
++ *  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_SPINBUTTON_HXX
++#define SC_VBA_SPINBUTTON_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XSpinButton.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE;
++
++class ScVbaSpinButton : public SpinButtonImpl_BASE
++{
++public:
++    ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper  );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
++
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_SPINBUTTON_HXX
+diff --git vbahelper/source/msforms/vbatextbox.cxx vbahelper/source/msforms/vbatextbox.cxx
+new file mode 100644
+index 0000000..d246970
+--- /dev/null
++++ vbahelper/source/msforms/vbatextbox.cxx
+@@ -0,0 +1,137 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbatextbox.cxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include <com/sun/star/text/XTextRange.hpp>
++
++#include "vbatextbox.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++
++ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
++{
++}
++
++// Attributes
++uno::Any SAL_CALL 
++ScVbaTextBox::getValue() throw (css::uno::RuntimeException)
++{
++	return uno::makeAny( getText() );
++}
++
++void SAL_CALL 
++ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
++{
++	rtl::OUString sVal = getAnyAsString( _value );
++	setText( sVal );
++}
++
++//getString() will cause some imfo lose.
++rtl::OUString SAL_CALL 
++ScVbaTextBox::getText() throw (css::uno::RuntimeException)
++{
++    uno::Any aValue;
++    aValue = m_xProps->getPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
++    rtl::OUString sString;
++    aValue >>= sString;
++    return sString;
++}
++
++void SAL_CALL 
++ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
++{
++    if ( !mbDialog )
++    {
++    uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
++    xTextRange->setString( _text );
++}
++    else
++        m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) ); 
++}
++
++sal_Int32 SAL_CALL 
++ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
++{
++    uno::Any aValue;
++    aValue = m_xProps->getPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) );
++    sal_Int32 nMaxLength = 0;
++    aValue >>= nMaxLength;
++    return nMaxLength;
++}
++
++void SAL_CALL 
++ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
++{
++    uno::Any aValue( _maxlength );
++    m_xProps->setPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
++}
++
++sal_Bool SAL_CALL 
++ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException)
++{
++    uno::Any aValue;
++    aValue = m_xProps->getPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) );
++    sal_Bool bRet = false;
++    aValue >>= bRet;
++    return bRet;
++}
++
++void SAL_CALL 
++ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException)
++{
++    uno::Any aValue( _multiline );
++    m_xProps->setPropertyValue
++            (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
++}
++
++rtl::OUString& 
++ScVbaTextBox::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaTextBox::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) );
++	}
++	return aServiceNames;
++}
+diff --git vbahelper/source/msforms/vbatextbox.hxx vbahelper/source/msforms/vbatextbox.hxx
+new file mode 100644
+index 0000000..3abe491
+--- /dev/null
++++ vbahelper/source/msforms/vbatextbox.hxx
+@@ -0,0 +1,57 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbatextbox.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_TEXTBOX_HXX
++#define SC_VBA_TEXTBOX_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/msforms/XTextBox.hpp>
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
++
++class ScVbaTextBox : public TextBoxImpl_BASE
++{
++    bool mbDialog;
++public:
++    ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException);
++    virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException);
++    virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_TEXTBOX_HXX
+diff --git vbahelper/source/msforms/vbatogglebutton.cxx vbahelper/source/msforms/vbatogglebutton.cxx
+new file mode 100644
+index 0000000..f938ad1
+--- /dev/null
++++ vbahelper/source/msforms/vbatogglebutton.cxx
+@@ -0,0 +1,108 @@
++/*************************************************************************
++ *
++ *  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 "vbatogglebutton.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace ooo::vba;
++
++
++const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
++const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") );
++const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
++ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
++{
++    OSL_TRACE("ScVbaToggleButton(ctor)");
++    m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) );
++}
++
++ScVbaToggleButton::~ScVbaToggleButton()
++{
++    OSL_TRACE("~ScVbaToggleButton(dtor)");
++}
++
++// Attributes
++rtl::OUString SAL_CALL 
++ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException)
++{
++    rtl::OUString Label;
++    m_xProps->getPropertyValue( LABEL ) >>= Label;
++    return Label;
++}
++
++void SAL_CALL 
++ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
++}
++
++uno::Any SAL_CALL 
++ScVbaToggleButton::getValue() throw (uno::RuntimeException)
++{
++	sal_Int16 nState = 0;
++    	m_xProps->getPropertyValue( STATE ) >>= nState;
++ 	return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
++}
++
++void SAL_CALL 
++ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
++{
++	sal_Int16 nState = 0;
++	_value >>= nState;
++        OSL_TRACE( "nState - %d", nState );
++	nState = ( nState == -1 ) ?  1 : 0;
++        OSL_TRACE( "nState - %d", nState );
++	m_xProps->setPropertyValue( STATE, uno::makeAny(  nState ) );
++}
++
++rtl::OUString& 
++ScVbaToggleButton::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaToggleButton::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) );
++	}
++	return aServiceNames;
++}
++
+diff --git vbahelper/source/msforms/vbatogglebutton.hxx vbahelper/source/msforms/vbatogglebutton.hxx
+new file mode 100644
+index 0000000..dfa5c1c
+--- /dev/null
++++ vbahelper/source/msforms/vbatogglebutton.hxx
+@@ -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 SC_VBA_TOGGLEBUTTON_HXX
++#define SC_VBA_TOGGLEBUTTON_HXX
++#include <cppuhelper/implbase2.hxx>
++#include <ooo/vba/msforms/XToggleButton.hpp>
++
++#include "vbacontrol.hxx"
++#include <vbahelper/vbahelper.hxx>
++
++typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty  > ToggleButtonImpl_BASE;
++
++class ScVbaToggleButton : public ToggleButtonImpl_BASE
++{
++	rtl::OUString msDftPropName;
++public:
++    ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
++    ~ScVbaToggleButton();
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++
++    virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++    // XDefaultProperty
++    rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
++};
++#endif //SC_VBA_TOGGLEBUTTON_HXX
+diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
+new file mode 100644
+index 0000000..8d939b9
+--- /dev/null
++++ vbahelper/source/vbahelper/makefile.mk
+@@ -0,0 +1,58 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.45 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..$/../
++PRJNAME=vbahelper
++TARGET=vbahelper
++
++ENABLE_EXCEPTIONS := TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++
++SLOFILES=\
++    $(SLO)$/vbahelper.obj \
++    $(SLO)$/vbapropvalue.obj \
++
++# --- Targets -------------------------------------------------------
++
++.INCLUDE :  target.mk
++
++ALLTAR : \
++        $(MISC)$/$(TARGET).don \
++
++$(SLOFILES) : $(MISC)$/$(TARGET).don
++
++$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
++        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
++        echo $@
++
+diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
+new file mode 100644
+index 0000000..f3634bb
+--- /dev/null
++++ vbahelper/source/vbahelper/vbahelper.cxx
+@@ -0,0 +1,837 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: vbahelper.cxx,v $
++ * $Revision: 1.5.32.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include <cppuhelper/bootstrap.hxx>
++#include <com/sun/star/util/XURLTransformer.hpp>
++#include <com/sun/star/frame/XDispatchProvider.hpp>
++#include <com/sun/star/frame/XModel.hpp>
++#include <com/sun/star/frame/XFrame.hpp>
++#include <com/sun/star/frame/XDesktop.hpp>
++#include <com/sun/star/frame/XController.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/lang/XMultiComponentFactory.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/beans/XIntrospection.hpp>
++
++#include <comphelper/processfactory.hxx>
 +
-+File gid_File_Lib_Vbahelper
-+    TXT_FILE_BODY;
-+    Styles = (PACKED);
-+    RegistryID = gid_Starregistry_Services_Rdb;
-+    Dir = gid_Dir_Program;
-+  #ifdef UNX
-+    Name = STRING(CONCAT3(libvbahelper,DLLPOSTFIX,UNXSUFFIX));
-+  #else
-+    Name = STRING(CONCAT3(vbahelper,DLLPOSTFIX,.dll));
-+  #endif
-+End
- #endif // ENABLE_VBA
- 
- 
-diff --git solenv/inc/libs.mk solenv/inc/libs.mk
-index f686801..da2b8fc 100644
---- solenv/inc/libs.mk
-+++ solenv/inc/libs.mk
-@@ -192,6 +192,7 @@ SAXLIB=-lsax$(DLLPOSTFIX)
- MAILLIB=-lmail
- DOCMGRLIB=-ldmg$(DLLPOSTFIX)
- BASICLIB=-lsb$(DLLPOSTFIX)
-+VBAHELPERLIB=-lvbahelper$(DLLPOSTFIX)
- DBTOOLSLIB=-ldbtools$(DLLPOSTFIX)
- HM2LIBSH=-lhmwrpdll
- HM2LIBST=-lhmwrap
-@@ -434,6 +435,7 @@ SAXLIB=isax.lib
- MAILLIB=mail.lib
- DOCMGRLIB=docmgr.lib
- BASICLIB=basic.lib
-+VBAHELPERLIB=vbahelper.lib
- TKTLIB=tkt.lib
- SJLIB=sj.lib
- SVXLIB=isvx.lib
-diff --git sw/inc/unocoll.hxx sw/inc/unocoll.hxx
-index 7b4632d..06fe329 100644
---- sw/inc/unocoll.hxx
-+++ sw/inc/unocoll.hxx
-@@ -194,8 +194,10 @@ class SwUnoCollection
- #define SW_SERVICE_CHART2_DATA_PROVIDER                 106
- #define SW_SERVICE_TYPE_FIELDMARK                       107
- #define SW_SERVICE_TYPE_FORMFIELDMARK                   108
-+#define SW_SERVICE_VBAOBJECTPROVIDER                    109
-+#define SW_SERVICE_VBACODENAMEPROVIDER                  110
- 
--#define SW_SERVICE_LAST                 SW_SERVICE_TYPE_FORMFIELDMARK
-+#define SW_SERVICE_LAST                 SW_SERVICE_VBACODENAMEPROVIDER
- 
- #define SW_SERVICE_INVALID			USHRT_MAX
- 
-diff --git sw/prj/build.lst sw/prj/build.lst
-index 1a799f7..aa47144 100644
---- sw/prj/build.lst
-+++ sw/prj/build.lst
-@@ -33,6 +33,7 @@ sw      sw\source\ui\smartmenu                                          nmake
- sw      sw\source\ui\table                                              nmake   -       all     sw_table sw_inc NULL
- sw	sw\source\ui\uiview						nmake	-	all	sw_uivw sw_sdi sw_inc NULL
- sw	sw\source\ui\uno						nmake	-	all	sw_uiuno sw_sdi sw_inc NULL
-+sw	sw\source\ui\vba						nmake	-	all	sw_vba sw_inc NULL
- sw	sw\source\ui\utlui						nmake	-	all	sw_utlui sw_inc NULL
- sw	sw\source\ui\web						nmake	-	all	sw_web sw_uinc sw_sdi sw_inc NULL
- sw	sw\source\ui\wrtsh						nmake	-	all	sw_wrtsh sw_inc NULL
-diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
-index 8ff51f9..c0e5e95 100644
---- sw/source/core/unocore/unocoll.cxx
-+++ sw/source/core/unocore/unocoll.cxx
-@@ -73,7 +73,12 @@
- #include <unochart.hxx>
- 
- #include "docsh.hxx"
--
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
- using ::rtl::OUString;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::document;
-@@ -82,6 +87,104 @@ using namespace ::com::sun::star::text;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
- 
-+class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
++#include <sfx2/objsh.hxx>
++#include <sfx2/viewfrm.hxx>
++#include <sfx2/dispatch.hxx>
++#include <sfx2/app.hxx>
++#include <svtools/stritem.hxx>
++#include <svtools/eitem.hxx>
++#include <svtools/intitem.hxx>
++#include <svtools/itemset.hxx>
++//#include <svtools/itempool.hxx>
++#include <sfx2/docfac.hxx>
++#include <sfx2/viewfac.hxx>
++
++#include <basic/sbx.hxx>
++#include <basic/sbstar.hxx>
++#include <rtl/math.hxx>
++#include <sfx2/viewsh.hxx>
++#include <math.h>
++
++
++#ifndef OOVBA_DLLIMPLEMENTATION
++#define OOVBA_DLLIMPLEMENTATION
++#endif 
++
++#include <vbahelper/vbahelper.hxx>
++#include <sfx2/app.hxx>
++// #FIXME needs service
++//#include "vbashape.hxx"
++//#include "unonames.hxx"
++
++using namespace ::com::sun::star;
++using namespace ::ooo::vba;
++
++#define NAME_HEIGHT "Height"
++#define NAME_WIDTH "Width"
++
++#define POINTTO100THMILLIMETERFACTOR 35.27778
++
++void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
++
++uno::Any sbxToUnoValue( SbxVariable* pVar );
++
++
++namespace ooo
 +{
-+    SwDocShell* mpDocShell;
-+    rtl::OUString msThisDocumentCodeName;
++namespace vba
++{
++// helper method to determine if the view ( calc ) is in print-preview mode
++bool isInPrintPreview( SfxViewFrame* pView )
++{
++	sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
++	if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
++nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
++	{
++		SfxViewFactory &rViewFactory =
++			pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
++		if (  pView->GetCurViewId() == rViewFactory.GetOrdinal() )
++			return true;
++	}
++	return false;
++}
++#if 0
++namespace excel // all in this namespace probably can be moved to sc
++{
++
++
++const ::rtl::OUString REPLACE_CELLS_WARNING(  RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
++class PasteCellsWarningReseter
++{
++private:
++	bool bInitialWarningState;
++	static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
++	{
++		static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++		static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
++		static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
++				xContext->getServiceManager(), uno::UNO_QUERY_THROW );
++		static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
++		return xProps;
++	}
++
++	bool getReplaceCellsWarning() throw ( uno::RuntimeException )
++	{
++		sal_Bool res = sal_False;
++		getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
++		return ( res == sal_True );
++	}
++
++	void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
++	{
++		getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
++	}
 +public:
-+    SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+        // XCodeNameQuery
-+    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+    {
-+        // Initialise the code name
-+        if ( msThisDocumentCodeName.getLength() == 0 )
-+        {
-+            try
-+            {
-+                uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+                uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+                uno::Reference< container::XNameAccess > xStandard( xLibContainer->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ), uno::UNO_QUERY_THROW );
-+                uno::Sequence< rtl::OUString > sModuleNames = xStandard->getElementNames();
-+                for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
-+                {
-+                    script::ModuleInfo mInfo;
-+                    if ( xStandard->getByName( sModuleNames[ i ] ) >>= mInfo )
-+                    {
-+                        if ( mInfo.ModuleType == script::ModuleType::Document )
-+                        {
-+                            msThisDocumentCodeName = sModuleNames[ i ];
-+                            break;
-+                        }
-+                    } 
-+                }
-+		
-+            }
-+            catch( uno::Exception& )
-+            {
-+            }
-+        }
-+        rtl::OUString sCodeName;
-+        if ( mpDocShell )
-+        {
-+            OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-+            // need to find the page ( and index )  for this control
-+            uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+            uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+            sal_Int32 nLen = xIndex->getCount();
-+            bool bMatched = false;
-+            uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+                try
-+                {
-+                    uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
-+                    uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+                    // get the www-standard container
-+                    uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+                    sal_Int32 nCntrls = xFormControls->getCount();
-+                    for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+                    {
-+                        uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );	
-+                        bMatched = ( xControl == xIf );
-+                        if ( bMatched )
-+                        {
-+                            sCodeName = msThisDocumentCodeName;
-+                            break;
-+                        }
-+                    }
-+                }
-+                catch( uno::Exception& ) {}
-+        }
-+        // Probably should throw here ( if !bMatched )
-+        return sCodeName;
-+    }
++	PasteCellsWarningReseter() throw ( uno::RuntimeException )
++	{
++		bInitialWarningState = getReplaceCellsWarning();
++		if ( bInitialWarningState )
++			setReplaceCellsWarning( false );
++	}
++	~PasteCellsWarningReseter()
++	{
++		if ( bInitialWarningState )
++		{
++			// don't allow dtor to throw
++			try
++			{
++				setReplaceCellsWarning( true );
++			}
++			catch ( uno::Exception& /*e*/ ){}
++		}
++	}
 +};
 +
-+class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
++void
++implnPaste()
 +{
-+    SwDocShell* mpDocShell;
-+public:
-+    SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+    {
-+    }
++	PasteCellsWarningReseter resetWarningBox;
++	ScTabViewShell* pViewShell = getCurrentBestViewShell();
++	if ( pViewShell )
++	{
++		pViewShell->PasteFromSystem();
++		pViewShell->CellContentChanged();
++	}
++}
 +
-+    virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+    {
-+        return sal_False;
-+    }
-+    ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+    {
-+        return uno::Any();
-+    }
-+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException)
-+    {
-+        uno::Sequence< rtl::OUString > aNames;
-+        return aNames;
-+    }
-+    // XElemenAccess
-+    virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
-+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
 +
-+};
++void
++implnCopy()
++{
++	ScTabViewShell* pViewShell = getCurrentBestViewShell();
++	if ( pViewShell )
++		pViewShell->CopyToClip(NULL,false,false,true);
++}
 +
- /******************************************************************************
-  *
-  ******************************************************************************/
-@@ -203,6 +306,8 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
-     { "com.sun.star.text.Fieldmark",                          SW_SERVICE_TYPE_FIELDMARK },
-     { "com.sun.star.text.FormFieldmark",                      SW_SERVICE_TYPE_FORMFIELDMARK },
-     { "com.sun.star.chart2.data.DataProvider",                SW_SERVICE_CHART2_DATA_PROVIDER },
-+    { "ooo.vba.VBAObjectModuleObjectProvider",                SW_SERVICE_VBAOBJECTPROVIDER },
-+    { "ooo.vba.VBACodeNameProvider",                          SW_SERVICE_VBACODENAMEPROVIDER },
- 
-     // case-correct versions of the service names (see #i67811)
-     { CSS_TEXT_TEXTFIELD_DATE_TIME,                   SW_SERVICE_FIELDTYPE_DATETIME },
-@@ -383,6 +488,18 @@ uno::Reference< uno::XInterface >   SwXServiceProvider::MakeInstance(sal_uInt16
-             xRet =  (cppu::OWeakObject*)pFieldmark;
-         }
-         break;
-+		case  SW_SERVICE_VBAOBJECTPROVIDER :
-+		{
-+			SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
-+			xRet =  (cppu::OWeakObject*)pObjProv;
-+		}
-+		break;
-+		case  SW_SERVICE_VBACODENAMEPROVIDER :
++void 
++implnCut()
++{
++	ScTabViewShell* pViewShell =  getCurrentBestViewShell();
++	if ( pViewShell )
++		pViewShell->CutToClip( NULL, TRUE );
++}
++void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
++{
++	PasteCellsWarningReseter resetWarningBox;
++	sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
++	InsCellCmd eMoveMode = INS_NONE;
++
++	if ( !pTabViewShell ) 
++		// none active, try next best
++		pTabViewShell = getCurrentBestViewShell();
++	if ( pTabViewShell )
++	{
++		ScViewData* pView = pTabViewShell->GetViewData();	
++		Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
++		if ( pView && pWin )
 +		{
-+			SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
-+			xRet =  (cppu::OWeakObject*)pObjProv;
++			if ( bAsLink && bOtherDoc )
++				pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
++			else 
++			{
++				ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
++				ScDocument* pDoc = NULL; 
++				if ( pOwnClip )
++					pDoc = pOwnClip->GetDocument();	
++				pTabViewShell->PasteFromClip( nFlags, pDoc,
++					nFunction, bSkipEmpty, bTranspose, bAsLink,
++					eMoveMode, IDF_NONE, TRUE );
++				pTabViewShell->CellContentChanged();
++			}
 +		}
-+		break;
-         case  SW_SERVICE_TYPE_FOOTNOTE :
-             xRet =  (cppu::OWeakObject*)new SwXFootnote(sal_False);
-         break;
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index c292f2b..5055206 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -140,6 +140,8 @@
- #include <svtools/itemiter.hxx>  //SfxItemIter
- 
- #include <stdio.h>
-+#include <comphelper/processfactory.hxx>
-+#include <basic/basmgr.hxx>
- 
- #ifdef DEBUG
- #include <iostream>
-@@ -4003,7 +4005,38 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
-     }
-     else //ordinary case
-     {
-+        if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
-+        {
-+            const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+            maTracer.EnterEnvironment(sw::log::eMacros);
-+            // Create and insert Excel vba Globals
-+            uno::Reference < uno::XComponentContext > xCtx;
-+            uno::Reference < beans::XPropertySet > xProps(
-+            ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+            xCtx.set( xProps->getPropertyValue( rtl::OUString(
-+                RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-+                uno::UNO_QUERY_THROW );
-+            uno::Any aGlobs = uno::makeAny( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.word.theGlobals") ) );
-+            mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+            
-+            SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-+                            pVBAFlags->IsLoadWordBasicCode(),
-+                            pVBAFlags->IsLoadWordBasicStorage() );
-+            String s1(CREATE_CONST_ASC("Macros"));
-+            String s2(CREATE_CONST_ASC("VBA"));
-+            int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+            if( 2 & nRet )
-+            {
-+                maTracer.Log(sw::log::eContainsVisualBasic);
-+                rDoc.SetContainsMSVBasic(true);
-+            }
++	}
 +
-+            StoreMacroCmds();
++}
 +
-+            maTracer.LeaveEnvironment(sw::log::eMacros);
-+        }
-         ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
++ScDocShell* 
++getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) 
++{
++	uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
++	ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
++	ScDocShell* pDocShell = NULL;
++	if ( pModel )
++		pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
++	return pDocShell;
 +
-     }
- 
-     ::SetProgressState(nProgress, mpDocShell);    // Update
-@@ -4077,26 +4110,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
-             eMode |= nsRedlineMode_t::REDLINE_ON;
-         if( pWDop->fRMView )
-             eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
--        if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
--        {
--            const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
--            maTracer.EnterEnvironment(sw::log::eMacros);
--            SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
--                            pVBAFlags->IsLoadWordBasicCode(),
--                            pVBAFlags->IsLoadWordBasicStorage() );
--            String s1(CREATE_CONST_ASC("Macros"));
--            String s2(CREATE_CONST_ASC("VBA"));
--            int nRet = aVBasic.Import( s1, s2 );
--            if( 2 & nRet )
--            {
--                maTracer.Log(sw::log::eContainsVisualBasic);
--                rDoc.SetContainsMSVBasic(true);
--            }
--
--            StoreMacroCmds();
--
--            maTracer.LeaveEnvironment(sw::log::eMacros);
--        }
-     }
- 
-     maInsertedTables.DelAndMakeTblFrms();
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-new file mode 100644
-index 0000000..96b7c8b
---- /dev/null
-+++ sw/source/ui/vba/makefile.mk
-@@ -0,0 +1,69 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+# 
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.6 $
-+#
-+# This file is part of OpenOffice.org.
-+#
-+# OpenOffice.org is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU Lesser General Public License version 3
-+# only, as published by the Free Software Foundation.
-+#
-+# OpenOffice.org 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 version 3 for more details
-+# (a copy is included in the LICENSE file that accompanied this code).
-+#
-+# You should have received a copy of the GNU Lesser General Public License
-+# version 3 along with OpenOffice.org.  If not, see
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
++}
++
++ScTabViewShell* 
++getBestViewShell(  css::uno::Reference< css::frame::XModel>& xModel )
++{
++	ScDocShell* pDocShell = getDocShell( xModel );
++	if ( pDocShell )
++		return pDocShell->GetBestViewShell();
++	return NULL;
++}
++
++ScTabViewShell* 
++getCurrentBestViewShell()
++{ 
++	uno::Reference< frame::XModel > xModel = getCurrentDocument();
++	return getBestViewShell( xModel );
++}
++
++SfxViewFrame* 
++getCurrentViewFrame()
++{
++	ScTabViewShell* pViewShell = getCurrentBestViewShell();	
++	if ( pViewShell )
++		return pViewShell->GetViewFrame();
++	return NULL;
++}
++};
++
++#endif
++const double Millimeter::factor =  35.27778;
 +
-+PRJ=..$/..$/..
++uno::Reference< beans::XIntrospectionAccess >
++getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
++{
++	static uno::Reference< beans::XIntrospection > xIntrospection;
++	if( !xIntrospection.is() )
++	{
++		uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++		xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
++	}
++	return xIntrospection->inspect( aObject );
++}
 +
-+PRJNAME=sw
-+TARGET=vbaswobj
-+ENABLE_EXCEPTIONS=TRUE
++uno::Reference< script::XTypeConverter >
++getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
++{
++	static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
++	return xTypeConv;
++}
++const uno::Any&
++aNULL()
++{
++ 	static  uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
++	return aNULLL;
++}
 +
-+# --- Settings -----------------------------------------------------
++void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
++{
++	SfxViewFrame* pViewFrame = NULL;
++	if ( pViewShell )
++		pViewFrame = pViewShell->GetViewFrame();
++	if ( pViewFrame )
++	{
++		SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
++		if( pDispatcher )
++		{
++			pDispatcher->Execute( nSlot , nCall );
++		}
++	}	
++}
++	
++void
++dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
++{
 +
-+.INCLUDE :  settings.mk
-+DLLPRE =
++	util::URL  url ;
++	url.Complete = aUrl;
++	rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
++	uno::Reference<frame::XController> xController = xModel->getCurrentController();
++	uno::Reference<frame::XFrame> xFrame = xController->getFrame();
++	uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
++	try
++	{
++		uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++		uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW  );
++		if ( !xContext.is() )
++		{
++			return ;
++		}
 +
-+.IF "$(ENABLE_VBA)"!="YES"
-+dummy:
-+        @echo "not building vba..."
-+.ENDIF
-+ 
-+INCPRE=$(INCCOM)$/$(TARGET)
-+CDEFS+=-DVBA_OOBUILD_HACK
-+# ------------------------------------------------------------------
++		uno::Reference<lang::XMultiComponentFactory > xServiceManager(
++				xContext->getServiceManager() );
++		if ( !xServiceManager.is() )
++		{
++			return ;
++		}
++		uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext(     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
++			,xContext), uno::UNO_QUERY_THROW );
++		if (!xParser.is())
++			return;
++		xParser->parseStrict (url);
++	}
++	catch ( uno::Exception & /*e*/ )
++	{
++		return ;
++	}
 +
-+SLOFILES= \
-+		$(SLO)$/vbaglobals.obj \
-+		$(SLO)$/vbaapplication.obj \
-+				$(SLO)$/service.obj \
++	uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
 +
-+# --- Targets ------------------------------------------------------
++	uno::Sequence<beans::PropertyValue> dispatchProps(1);
 +
-+.INCLUDE :	target.mk
++	sal_Int32 nProps = sProps.getLength();
++	beans::PropertyValue* pDest = dispatchProps.getArray();
++	if ( nProps )
++	{
++		dispatchProps.realloc( nProps + 1 );
++		// need to reaccquire pDest after realloc
++		pDest = dispatchProps.getArray();
++		beans::PropertyValue* pSrc = sProps.getArray();
++		for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
++			*pDest = *pSrc;
++	}
 +
-+ALLTAR : \
-+        $(MISC)$/$(TARGET).don \
++	(*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
++	(*pDest).Value <<= (sal_Bool)sal_True;
 +
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
++	if (xDispatcher.is())
++		xDispatcher->dispatch( url, dispatchProps );
++}
 +
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+        echo $@
++void
++dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) 
++{
++	uno::Sequence<beans::PropertyValue> dispatchProps;
++	dispatchRequests( xModel, aUrl, dispatchProps );
++}
 +
-diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
-new file mode 100644
-index 0000000..c3dc180
---- /dev/null
-+++ sw/source/ui/vba/service.cxx
-@@ -0,0 +1,96 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: service.cxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "cppuhelper/implementationentry.hxx"
-+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/registry/XRegistryKey.hpp"
-+#include "comphelper/servicedecl.hxx"
 +
-+// =============================================================================
-+// component exports
-+// =============================================================================
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
 +
-+namespace sdecl = comphelper::service_decl;
++ uno::Reference< frame::XModel > 
++getCurrentDocument() throw (uno::RuntimeException)
++{
++	uno::Reference< frame::XModel > xModel;
++	SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
++	SbxObject* basicChosen =  pBasic ;
++	if ( basicChosen == NULL)
++	{
++		OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
++		return xModel;
++	}    
++    SbxObject* p = pBasic;
++    SbxObject* pParent = p->GetParent();
++    SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
 +
-+namespace globals
++    if( pParentParent )
++    {
++        basicChosen = pParentParent;
++    }
++    else if( pParent )
++    {
++        basicChosen = pParent;
++    }
++
++
++    uno::Any aModel; 
++    SbxVariable *pCompVar = basicChosen->Find(  UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
++
++	if ( pCompVar )
++	{
++		aModel = sbxToUnoValue( pCompVar );
++		if ( sal_False == ( aModel >>= xModel ) ||
++			!xModel.is() )
++		{
++			// trying last gasp try the current component
++			uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++			// test if vba service is present
++			uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
++			uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
++			uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
++			xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
++			if ( !xModel.is() )
++			{
++				throw uno::RuntimeException( 
++					rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
++			}
++			return xModel;
++		}
++		else
++		{
++			OSL_TRACE("Have model ThisComponent points to url %s",
++			::rtl::OUStringToOString( xModel->getURL(),
++				RTL_TEXTENCODING_ASCII_US ).pData->buffer );
++		}
++	}
++	else
++	{
++		OSL_TRACE("Failed to get ThisComponent");
++		throw uno::RuntimeException( 
++			rtl::OUString( 
++				RTL_CONSTASCII_USTRINGPARAM(
++					"Can't determine the currently selected document") ),
++			uno::Reference< uno::XInterface >() );
++	}
++	return xModel;
++}
++
++sal_Int32 
++OORGBToXLRGB( sal_Int32 nCol )
++{
++	sal_Int32 nRed = nCol;
++	nRed &= 0x00FF0000;
++	nRed >>= 16;
++	sal_Int32 nGreen = nCol;
++	nGreen &= 0x0000FF00;
++	nGreen >>= 8;
++	sal_Int32 nBlue = nCol;
++	nBlue &= 0x000000FF;
++	sal_Int32 nRGB =  ( (nBlue << 16) | (nGreen << 8) | nRed );
++	return nRGB;
++}
++sal_Int32 
++XLRGBToOORGB( sal_Int32 nCol )
++{
++	sal_Int32 nBlue = nCol;
++	nBlue &= 0x00FF0000;
++	nBlue >>= 16;
++	sal_Int32 nGreen = nCol;
++	nGreen &= 0x0000FF00;
++	nGreen >>= 8;
++	sal_Int32 nRed = nCol;
++	nRed &= 0x000000FF;
++	sal_Int32 nRGB =  ( (nRed << 16) | (nGreen << 8) | nBlue );
++	return nRGB;
++}
++uno::Any 
++OORGBToXLRGB( const uno::Any& aCol )
 +{
-+extern sdecl::ServiceDecl const serviceDecl;
++	sal_Int32 nCol;
++	aCol >>= nCol;
++	nCol = OORGBToXLRGB( nCol );
++	return uno::makeAny( nCol );
++}
++uno::Any 
++XLRGBToOORGB(  const uno::Any& aCol )
++{
++	sal_Int32 nCol;
++	aCol >>= nCol;
++	nCol = XLRGBToOORGB( nCol );
++	return uno::makeAny( nCol );
 +}
 +
-+extern "C"
++void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection  )
 +{
-+    void SAL_CALL component_getImplementationEnvironment( 
-+        const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
-+    {
-+		OSL_TRACE("In component_getImplementationEnv");
-+        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+    }
++	sal_Int32 nTo = 0;
++	sal_Int32 nFrom = 0;
++	sal_Int16 nCopies = 1;
++	sal_Bool bPreview = sal_False;
++	sal_Bool bCollate = sal_False;
++	sal_Bool bSelection = bUseSelection;
++	From >>= nFrom;
++	To >>= nTo;
++	Copies >>= nCopies;
++	Preview >>= bPreview;
++	if ( nCopies > 1 ) // Collate only useful when more that 1 copy
++		Collate >>= bCollate;
 +
-+    sal_Bool SAL_CALL component_writeInfo( 
-+        lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
-+    {
-+		OSL_TRACE("In component_writeInfo");
++	rtl::OUString sRange(  RTL_CONSTASCII_USTRINGPARAM( "-" ) );
++	rtl::OUString sFileName;
++	
++	if (( nFrom || nTo ) )
++	{
++		if ( nFrom )
++			sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
++		if ( nTo )
++			sRange += ::rtl::OUString::valueOf( nTo );
++	}
 +
-+	// Component registration
-+        if ( component_writeInfoHelper( pServiceManager, pRegistryKey, 
-+		globals::serviceDecl ) )
++	if (  PrToFileName.getValue() )
++	{
++		PrToFileName >>= sFileName;
++	}
++	SfxViewFrame* pViewFrame = NULL;
++	if ( pViewShell )
++		pViewFrame = pViewShell->GetViewFrame();
++	if ( pViewFrame )
++	{
++		SfxAllItemSet aArgs( SFX_APP()->GetPool() );
++				
++		SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
++		aArgs.Put( sfxCollate, sfxCollate.Which() );
++		SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
++		aArgs.Put( sfxCopies, sfxCopies.Which() );
++		if ( sFileName.getLength() )
 +		{
-+			// Singleton registration
-+			try
-+			{
-+				registry::XRegistryKey * pKey =
-+					reinterpret_cast< registry::XRegistryKey * >(pRegistryKey);
++			SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
++			aArgs.Put( sfxFileName, sfxFileName.Which() );
++		
++		}
++		if (  sRange.getLength() )
++		{
++			SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
++			aArgs.Put( sfxRange, sfxRange.Which() );
++		}
++		SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
++		aArgs.Put( sfxSelection, sfxSelection.Which() );
++		SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
++		aArgs.Put( sfxAsync, sfxAsync.Which() );
++		SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
 +
-+				Reference< registry::XRegistryKey >xKey = pKey->createKey(
-+					rtl::OUString::createFromAscii( ("ooo.vba.sw.Globals/UNO/SINGLETONS/ooo.vba.word.theGlobals") ) );
-+				xKey->setStringValue( ::rtl::OUString::createFromAscii( 
-+					("ooo.vba.word.Globals") ) );
-+				return sal_True;
-+			}
-+			catch( uno::Exception& /*e*/ )
++		if ( pDispatcher )
++		{
++			if ( bPreview )
 +			{
-+				//recomp & friends will detect false returned and fail
++				if ( !pViewFrame->GetFrame()->IsInPlace() ) 	
++				{
++					// #TODO is this necessary ( calc specific )
++//					SC_MOD()->InputEnterHandler();
++					pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
++					while ( isInPrintPreview( pViewFrame ) )
++						Application::Yield();
++				}
 +			}
++			else
++				pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
 +		}
-+		return sal_False;
-+    }
-+
-+    void * SAL_CALL component_getFactory( 
-+        const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
-+        registry::XRegistryKey * pRegistryKey )
-+    {
-+		OSL_TRACE("In component_getFactory for %s", pImplName );
-+	void* pRet =  component_getFactoryHelper(
-+        	pImplName, pServiceManager, pRegistryKey, globals::serviceDecl );
-+	OSL_TRACE("Ret is 0x%x", pRet);
-+	return pRet;
-+    }
++			
++	}
++	
++	// #FIXME #TODO
++	// 1 ActivePrinter ( how/can we switch a printer via API? )
++	// 2 PrintToFile ( ms behaviour if this option is specified but no 
++	//   filename supplied 'PrToFileName' then the user will be prompted )
++	// 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
++	//    values ) in oOO these options are mutually exclusive
++	// 4 There is a pop up to do with transparent objects in the print source
++	//   should be able to disable that via configuration for the duration
++	//   of this method
 +}
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-new file mode 100644
-index 0000000..3fd0635
---- /dev/null
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -0,0 +1,100 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaapplication.cxx,v $
-+ * $Revision: 1.7 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <stdio.h>
-+
-+
-+#include "vbaapplication.hxx"
-+#include <osl/file.hxx>
-+
-+using namespace ::ooo;
-+using namespace ::com::sun::star;
-+
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::uno::UNO_QUERY;
-+using ::rtl::OUString;
-+
-+// Enable our own join detection for Intersection and Union
-+// should be more efficient than using ScRangeList::Join ( because
-+// we already are testing the same things )
-+
-+#define OWN_JOIN 1
-+
-+// #TODO is this defined somewhere else?
-+#if ( defined UNX ) || ( defined OS2 ) //unix
-+#define FILE_PATH_SEPERATOR "/"
-+#else // windows
-+#define FILE_PATH_SEPERATOR "\\"
-+#endif 
-+
-+#define EXCELVERSION "11.0"
 +
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
++ void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell )
++{
++	dispatchExecute( pViewShell, SID_VIEWSHELL1 );
++}
 +
-+SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( uno::Reference< vba::XHelperInterface >(), xContext )
++rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
 +{
-+    OSL_TRACE("SwVbaApplication::SwVbaApplication");
++	uno::Type aType = pvargItem.getValueType();
++	uno::TypeClass eTypeClass = aType.getTypeClass();
++	rtl::OUString sString;
++	switch ( eTypeClass )
++	{
++		case uno::TypeClass_BOOLEAN:
++		{
++			sal_Bool bBool = sal_False;
++			pvargItem >>= bBool;
++			sString = rtl::OUString::valueOf( bBool );
++			break;
++		}
++		case uno::TypeClass_STRING:
++			pvargItem >>= sString;
++			break;
++		case uno::TypeClass_FLOAT:
++			{
++				float aFloat = 0;
++				pvargItem >>= aFloat;
++				sString = rtl::OUString::valueOf( aFloat );
++				break;
++			}
++		case uno::TypeClass_DOUBLE:
++			{
++				double aDouble = 0;
++				pvargItem >>= aDouble;
++				sString = rtl::OUString::valueOf( aDouble );
++				break;
++			}
++		case uno::TypeClass_SHORT:
++		case uno::TypeClass_LONG:
++		case uno::TypeClass_BYTE:
++			{
++				sal_Int32 aNum = 0;
++				pvargItem >>= aNum;
++				sString = rtl::OUString::valueOf( aNum );
++				break;
++			}
++
++		case uno::TypeClass_HYPER:
++			{
++				sal_Int64 aHyper = 0;
++				pvargItem >>= aHyper;
++				sString = rtl::OUString::valueOf( aHyper );
++				break;
++			}
++		default:
++       			throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
++	}
++	return sString;
 +}
 +
-+SwVbaApplication::~SwVbaApplication()
-+{
-+}
-+	
 +
-+void SAL_CALL
-+SwVbaApplication::DoEvents() throw ( uno::RuntimeException )
++rtl::OUString 
++ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >&  _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
 +{
++	return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
 +}
 +
-+rtl::OUString& 
-+SwVbaApplication::getServiceImplName()
++rtl::OUString 
++ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
 +{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
-+	return sImplName;
-+}
++	sal_Int32 a = _nStartSuffix;
++	rtl::OUString scompname = _sElementName;
++	bool bElementexists = true;
++	sal_Int32 nLen = _slist.getLength();
++	if ( nLen == 0 )
++		return _sElementName;
 +
-+rtl::OUString SAL_CALL
-+SwVbaApplication::getName() throw (uno::RuntimeException)
-+{
-+        static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
-+        return appName;
++	while (bElementexists == true) 
++	{
++		for (sal_Int32 i = 0; i < nLen; i++)
++		{
++			if (FieldInList(_slist, scompname) == -1)
++			{
++				return scompname;
++			}
++		}
++		scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
++	}
++	return rtl::OUString();
 +}
 +
-+uno::Sequence< rtl::OUString > 
-+SwVbaApplication::getServiceNames()
++sal_Int32 
++ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
 +{
-+	static uno::Sequence< rtl::OUString > aServiceNames;
-+	if ( aServiceNames.getLength() == 0 )
++	sal_Int32 FieldLen = SearchList.getLength();
++	sal_Int32 retvalue = -1;
++	for (sal_Int32 i = 0; i < FieldLen; i++) 
 +	{
-+		aServiceNames.realloc( 1 );
-+		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Application" ) );
++		// I wonder why comparing lexicographically is done
++		// when its a match is whats interesting?
++		//if (SearchList[i].compareTo(SearchString) == 0) 
++		if ( SearchList[i].equals( SearchString ) ) 
++		{
++			retvalue = i;
++			break;
++		}
 +	}
-+	return aServiceNames;
-+}
-diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
-new file mode 100644
-index 0000000..7c262a3
---- /dev/null
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaapplication.hxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_APPLICATION_HXX
-+#define SW_VBA_APPLICATION_HXX
-+
-+
-+#include <ooo/vba/word/XApplication.hpp>
-+
-+#include <oovbaapi/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
++	return retvalue;
 +
-+class SwVbaApplication : public SwVbaApplication_BASE
++}
++bool NeedEsc(sal_Unicode cCode)
 +{
-+private:
-+public:
-+	SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
-+	virtual ~SwVbaApplication();
-+
-+	// XHelperInterface ( parent is itself )
-+	virtual css::uno::Reference< ooo::vba::XHelperInterface > SAL_CALL getParent(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
-+
-+	// XApplication
-+	
-+	virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+	virtual void SAL_CALL DoEvents() throw (css::uno::RuntimeException);
-+	// XHelperInterface
-+	virtual rtl::OUString& getServiceImplName();
-+	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_APPLICATION_HXX */
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
-new file mode 100644
-index 0000000..ae1c775
---- /dev/null
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -0,0 +1,109 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaglobals.cxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org 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 version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <oovbaapi/helperdecl.hxx>
-+#include "vbaglobals.hxx"
-+
-+#include <comphelper/unwrapargs.hxx>
-+
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+
-+#include <cppuhelper/bootstrap.hxx>
-+#include "vbaapplication.hxx"
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::ooo::vba;
++	String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
++	return (STRING_NOTFOUND != sEsc.Search(cCode));
++}
 +
++rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
++{
++	rtl::OUStringBuffer sResult;
++	const sal_Unicode *start = rIn.getStr();
++	const sal_Unicode *end = start + rIn.getLength();
 +
++	int seenright = 0;
++	if ( bForLike )
++		sResult.append(static_cast<sal_Unicode>('^'));
 +
-+// =============================================================================
-+// SwVbaGlobals
-+// =============================================================================
++	while (start < end) 
++	{
++		switch (*start)
++		{
++			case '?':
++				sResult.append(static_cast<sal_Unicode>('.'));
++				start++;
++				break;
++			case '*':
++				sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
++				start++;
++				break;
++			case '#':
++				sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
++				start++;
++				break;
++			case '~':
++				sResult.append(static_cast<sal_Unicode>('\\'));
++				sResult.append(*(++start));
++				start++;
++				break;
++				// dump the ~ and escape the next characture
++			case ']':
++				sResult.append(static_cast<sal_Unicode>('\\'));
++				sResult.append(*start++);
++				break;
++			case '[':
++				sResult.append(*start++);
++				seenright = 0;
++				while (start < end && !seenright)
++				{
++					switch (*start)
++					{
++						case '[':
++						case '?':
++						case '*':
++						sResult.append(static_cast<sal_Unicode>('\\'));
++						sResult.append(*start);
++							break;
++						case ']':
++						sResult.append(*start);
++							seenright = 1;
++							break;
++						case '!':
++							sResult.append(static_cast<sal_Unicode>('^'));
++							break;
++						default:
++						if (NeedEsc(*start))
++							sResult.append(static_cast<sal_Unicode>('\\'));
++						sResult.append(*start);
++							break;
++					}
++					start++;
++				}
++				break;
++			default:
++				if (NeedEsc(*start))
++					sResult.append(static_cast<sal_Unicode>('\\'));
++				sResult.append(*start++);
++		}
++	}
 +
-+SwVbaGlobals::SwVbaGlobals(  css::uno::Reference< css::uno::XComponentContext >const& rxContext )
-+        :m_xContext( rxContext )
-+{
-+	OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
-+	mxApplication = uno::Reference< word::XApplication > ( new SwVbaApplication( m_xContext) );
-+}
++	if ( bForLike )
++		sResult.append(static_cast<sal_Unicode>('$'));
 +
-+SwVbaGlobals::~SwVbaGlobals()
-+{
-+	OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
++	return sResult.makeStringAndClear( );
 +}
 +
-+// Will throw if singleton can't be accessed 
-+uno::Reference< word::XGlobals >
-+SwVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException )
++double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
 +{
-+	uno::Reference< XGlobals > xGlobals( 
-+		xContext->getValueByName( ::rtl::OUString::createFromAscii( 
-+			"/singletons/ooo.vba.word.theGlobals") ), uno::UNO_QUERY);
-+
-+	if ( !xGlobals.is() )
++	double fConvertFactor = 1.0;
++	if( bVertical )
 +	{
-+		throw uno::RuntimeException(
-+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ),
-+                    uno::Reference< XInterface >() );
++		fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
 +	}
-+	return xGlobals;
++	else
++	{
++		fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;	
++	}
++	return fConvertFactor;
 +}
 +
-+// =============================================================================
-+// XGlobals
-+// =============================================================================
-+uno::Reference<word::XApplication >
-+SwVbaGlobals::getApplication() throw (uno::RuntimeException)
++double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
 +{
-+	OSL_TRACE("In SwVbaGlobals::getApplication");	
-+    return mxApplication;
++	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
++	return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
 +}
-+
-+::uno::Sequence< ::uno::Any > SAL_CALL
-+SwVbaGlobals::getGlobals(  ) throw (::uno::RuntimeException)
++double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
 +{
-+	sal_uInt32 nMax = 0;
-+	uno::Sequence< uno::Any > maGlobals(4);
-+	maGlobals[ nMax++ ] <<= SwVbaGlobals::getGlobalsImpl(m_xContext);
-+	maGlobals[ nMax++ ] <<= mxApplication;
-+	maGlobals.realloc( nMax );
-+	return maGlobals;
++	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
++	return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
 +}
 +
-+namespace globals
++ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
 +{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<SwVbaGlobals, sdecl::with_args<false> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+    serviceImpl,
-+    "SwVbaGlobals",
-+    "ooo.vba.word.Globals" );
++// #FIXME needs to be an instantiable service
++//	m_xShape = new ScVbaShape( xContext, xShape );
 +}
 +
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
++#define VBA_LEFT "PositionX"
++#define VBA_TOP "PositionY"
++UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
++{
++    mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
++}
++    double UserFormGeometryHelper::getLeft()
++    {
++	sal_Int32 nLeft = 0;
++	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;	
++	return Millimeter::getInPoints( nLeft );
++    }
++    void UserFormGeometryHelper::setLeft( double nLeft )
++    {
++        mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
++    }
++    double UserFormGeometryHelper::getTop()
++    {
++	sal_Int32 nTop = 0;
++	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;	
++	return Millimeter::getInPoints( nTop );
++    }
++    void UserFormGeometryHelper::setTop( double nTop )
++    {
++	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
++    }
++    double UserFormGeometryHelper::getHeight()
++    {
++	sal_Int32 nHeight = 0;
++	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight;	
++	return Millimeter::getInPoints( nHeight );
++    }
++    void UserFormGeometryHelper::setHeight( double nHeight )
++    {
++	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
++    }
++    double UserFormGeometryHelper::getWidth()
++    {
++	sal_Int32 nWidth = 0;
++	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	NAME_WIDTH ) ) ) >>= nWidth;	
++	return Millimeter::getInPoints( nWidth );
++    }
++    void UserFormGeometryHelper::setWidth( double nWidth)
++    {
++	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	NAME_WIDTH ) ), uno::makeAny(  Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
++    }
++} // openoffice
++} //org
+diff --git vbahelper/source/vbahelper/vbapropvalue.cxx vbahelper/source/vbahelper/vbapropvalue.cxx
 new file mode 100644
-index 0000000..7ac3fe9
+index 0000000..356c960
 --- /dev/null
-+++ sw/source/ui/vba/vbaglobals.hxx
-@@ -0,0 +1,69 @@
++++ vbahelper/source/vbahelper/vbapropvalue.cxx
+@@ -0,0 +1,48 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -10692,8 +11014,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbaglobals.hxx,v $
-+ * $Revision: 1.4 $
++ * $RCSfile: vbapropvalue.cxx,v $
++ * $Revision: 1.3 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -10713,98 +11035,126 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef SW_VBA_GLOBALS_HXX
-+#define SW_VBA_GLOBALS_HXX
++#include "vbahelper/vbapropvalue.hxx"
 +
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/XInitialization.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <ooo/vba/word/XGlobals.hpp>
-+#include <ooo/vba/word/XApplication.hpp>
++using namespace com::sun::star;
++ 
++ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener )
++{
++}
 +
-+#include <cppuhelper/implbase1.hxx>
-+#include <oovbaapi/vbahelper.hxx>
++css::uno::Any SAL_CALL 
++ScVbaPropValue::getValue() throw (css::uno::RuntimeException)
++{
++    return m_pListener->getValueEvent();
++}
 +
-+    // =============================================================================
-+    // class SwVbaGlobals
-+    // =============================================================================
++void SAL_CALL 
++ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException)
++{
++    m_pListener->setValueEvent( _value );
++}
+diff --git vbahelper/util/.makefile.mk.swp vbahelper/util/.makefile.mk.swp
+new file mode 100644
+index 0000000..bf20844
+Binary files /dev/null and vbahelper/util/.makefile.mk.swp differ
+diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk
+new file mode 100644
+index 0000000..b5553aa
+--- /dev/null
++++ vbahelper/util/makefile.mk
+@@ -0,0 +1,94 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.24 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
 +
-+    typedef ::cppu::WeakImplHelper1<    
-+        ooo::vba::word::XGlobals > SwVbaGlobals_BASE;
++PRJ=..
 +
++PRJNAME=vbahelper
++TARGET=vbahelper
 +
-+    class SwVbaGlobals : public SwVbaGlobals_BASE
-+    {
-+    private:
-+            css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+            css::uno::Reference< ooo::vba::word::XApplication > mxApplication;
-+    public:
-+	
-+        SwVbaGlobals(
-+            css::uno::Reference< css::uno::XComponentContext >const& rxContext );
-+        virtual ~SwVbaGlobals();
++# --- Settings ---------------------------------------------------
 +
-+		static 	css::uno::Reference< ooo::vba::word::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException);
++.INCLUDE :  settings.mk
 +
-+        // XGlobals
-+        virtual css::uno::Reference<
-+                        ooo::vba::word::XApplication > SAL_CALL getApplication()
-+                        throw (css::uno::RuntimeException);
-+	virtual css::uno::Sequence< css::uno::Any > SAL_CALL getGlobals(  ) throw (css::uno::RuntimeException);
-+    };
-+#endif /* SW_VBA_GLOBALS_HXX */ 
-diff --git sw/util/makefile.mk sw/util/makefile.mk
-index ef9b141..9becb8c 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -296,6 +296,35 @@ LIB3OBJFILES = \
-         $(SLO)$/mmpreparemergepage.obj \
-         $(SLO)$/selectdbtabledialog.obj
- 
-+#target vba
-+TARGET_VBA=vbaswobj
-+SHL4TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno
-+SHL4IMPLIB=     i$(TARGET_VBA)
 +
-+SHL4VERSIONMAP=$(TARGET_VBA).map
-+SHL4DEF=$(MISC)$/$(SHL4TARGET).def
-+DEF4NAME=$(SHL4TARGET)
-+SHL4STDLIBS= \
++TARGET_HELPER=vbahelper
++SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
++SHL1IMPLIB= i$(TARGET_HELPER)
++
++SHL1DEF=$(MISC)$/$(SHL1TARGET).def
++DEF1NAME=$(SHL1TARGET)
++
++LIB1FILES=$(SLB)$/$(TARGET_HELPER).lib
++
++# dynamic libraries
++SHL1STDLIBS=       \
++		$(CPPULIB) \
++		$(COMPHELPERLIB) \
++		$(CPPUHELPERLIB) \
++		$(BASICLIB) \
++		$(TOOLSLIB) \
++		$(SALLIB)\
++		$(SFXLIB)	\
++		$(SVTOOLLIB)    \
++		$(SVLLIB) \
++        $(VCLLIB) \
++
++#SHL4DEPN=$(SHL1TARGETN)
++SHL1LIBS=$(LIB1FILES)
++
++TARGET_MSFORMS=msforms
++SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno
++SHL2IMPLIB=     i$(TARGET_MSFORMS)
++
++#SHL4VERSIONMAP=$(TARGET_MSFORMS).map
++SHL2DEF=$(MISC)$/$(SHL2TARGET).def
++DEF2NAME=$(SHL2TARGET)
++SHL2STDLIBS= \
 +                $(CPPUHELPERLIB) \
-+                $(VCLLIB) \
 +                $(CPPULIB) \
 +                $(COMPHELPERLIB) \
 +                $(SVLIB) \
 +                $(TOOLSLIB) \
 +                $(SALLIB)\
-+                $(BASICLIB)     \
++		$(VBAHELPERLIB) \
 +                $(SFXLIB)       \
 +                $(SVXLIB)       \
 +                $(SVTOOLLIB)    \
 +                $(SVLLIB) \
-+                $(ISCLIB) \
 +        $(VCLLIB) \
 +        $(TKLIB) \
 +
-+SHL4DEPN=$(SHL1TARGETN)
-+SHL4LIBS=$(SLB)$/$(TARGET_VBA).lib
-+
++SHL2DEPN=$(SHL1TARGETN)
++SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
 +
- .IF "$(GUI)$(COM)" == "WNTMSC"
- .IF "$(ENABLE_PCH)" != "" && ( "$(PRJNAME)"!="sw" || "$(BUILD_SPECIAL)"!="TRUE" )
- #target sw
-diff --git sw/util/vbaswobj.map sw/util/vbaswobj.map
-new file mode 100644
-index 0000000..832e82c
---- /dev/null
-+++ sw/util/vbaswobj.map
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+	global:
-+		component_getImplementationEnvironment;
-+		component_getFactory;
-+		component_writeInfo;
++# --- Targets -----------------------------------------------------------
 +
-+	local:
-+		*;
-+};
++.INCLUDE :  target.mk



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