ooo-build r14827 - in trunk: . patches/vba



Author: noelpwer
Date: Thu Dec 11 17:41:18 2008
New Revision: 14827
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14827&view=rev

Log:
2008-12-11  Noel Power  <noel power novell com>

        * patches/vba/vba-word-support.diff: create new helper library and
        associated ripple so vba for word/excel can share. Also start
        of controls uno library


Modified:
   trunk/ChangeLog
   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	Thu Dec 11 17:41:18 2008
@@ -22,7 +22,7 @@
  
  #ifndef __SB_SBSTARBASICREF_HXX
 diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index e47234f..c5d36cd 100644
+index 349c2cc..b149e96 100644
 --- basic/source/classes/sb.cxx
 +++ basic/source/classes/sb.cxx
 @@ -70,7 +70,50 @@ SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
@@ -76,7 +76,7 @@
  
  //========================================================================
  // Array zur Umrechnung SFX <-> VB-Fehlercodes anlegen
-@@ -608,6 +651,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic  )
+@@ -609,6 +652,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic  )
  	pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
  	// Suche ueber StarBASIC ist immer global
  	SetFlag( SBX_GBLSEARCH );
@@ -198,12 +198,12 @@
  					rtl::OUString sCodeName;	
  					sCodeName = xNameQuery->getCodeNameForObject( xIf );
  					Reference< XPropertySet > xProps( xIf, UNO_QUERY );
-diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
+diff --git oovbaapi/inc/oovbaapi/helperdecl.hxx oovbaapi/inc/oovbaapi/helperdecl.hxx
 new file mode 100644
-index 0000000..292399b
+index 0000000..7a0b495
 --- /dev/null
-+++ oovbaapi/ooo/vba/word/XApplication.idl
-@@ -0,0 +1,57 @@
++++ oovbaapi/inc/oovbaapi/helperdecl.hxx
+@@ -0,0 +1,58 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -212,8 +212,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: XApplication.idl,v $
-+ * $Revision: 1.4 $
++ * $RCSfile: helperdecl.hxx,v $
++ * $Revision: 1.3 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -233,40 +233,91 @@
 + * 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 { 
++#ifndef OOVBAAPI_SERV_DECL
++#define OOVBAAPI_SERV_DECL
++#include <comphelper/servicedecl.hxx>
++#include <ooo/vba/XHelperInterface.hpp>
 +
-+interface XApplication
++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 ) {}
++};
 +
-+	interface ::ooo::vba::XHelperInterface;
++} // namespace service_decl
++} // namespace comphelper
++#endif
+diff --git oovbaapi/inc/oovbaapi/oovbadllapi.h oovbaapi/inc/oovbaapi/oovbadllapi.h
+new file mode 100644
+index 0000000..f7d31ec
+--- /dev/null
++++ oovbaapi/inc/oovbaapi/oovbadllapi.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: svtdllapi.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.
++ *
++ ************************************************************************/
 +
-+	[attribute, readonly] string Name;
-+	void DoEvents();
-+};
++#ifndef INCLUDED_OOVBADLLAPI_H
++#define INCLUDED_OOVBADLLAPI_H
 +
-+}; }; };
++#include "sal/types.h"
 +
++#if defined(OOVBA_DLLIMPLEMENTATION)
++#define OOVBA_DLLPUBLIC  SAL_DLLPUBLIC_EXPORT
++#else
++#define OOVBA_DLLPUBLIC  SAL_DLLPUBLIC_IMPORT
 +#endif
++#define OOVBA_DLLPRIVATE SAL_DLLPRIVATE
 +
++#endif /* INCLUDED_OOVBADLLAPI_H */
 +
-diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
+diff --git oovbaapi/inc/oovbaapi/vbacollectionimpl.hxx oovbaapi/inc/oovbaapi/vbacollectionimpl.hxx
 new file mode 100644
-index 0000000..3c144a6
+index 0000000..9fdf717
 --- /dev/null
-+++ oovbaapi/ooo/vba/word/XGlobals.idl
-@@ -0,0 +1,54 @@
++++ oovbaapi/inc/oovbaapi/vbacollectionimpl.hxx
+@@ -0,0 +1,257 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -275,8 +326,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: XGlobals.idl,v $
-+ * $Revision: 1.4 $
++ * $RCSfile: vbacollectionimpl.hxx,v $
++ * $Revision: 1.5 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -296,683 +347,240 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef __ooo_vba_word_XGlobals_idl__
-+#define __ooo_vba_word_XGlobals_idl__
++#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
++#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
 +
-+#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
++#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>
 +
-+module ooo {  module vba {  module word { 
++#include <cppuhelper/implbase3.hxx>
++#include <cppuhelper/implbase2.hxx>
++#include <cppuhelper/implbase1.hxx>
 +
-+interface XGlobals: com::sun::star::uno::XInterface
++#include "oovbaapi/vbahelper.hxx"
++#include "oovbaapi/vbahelperinterface.hxx"
++
++#include <vector>
++
++typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
++
++class EnumerationHelperImpl : public EnumerationHelper_BASE
 +{
-+        // FIXME, need better way to expose globals
-+	sequence< any > getGlobals();
++protected:
++	css::uno::Reference< css::uno::XComponentContext > m_xContext;
++	css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
++public:
 +
-+	[attribute, readonly] ooo::vba::word::XApplication Application;
++	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
 +
-+#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=..$/..$/..
++typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
 +
-+PRJNAME=oovapi
++template< typename Ifc1 >
++class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
++{
++public:
++typedef std::vector< css::uno::Reference< Ifc1 > >  XNamedVec;
++private:
 +
-+TARGET=word
-+PACKAGE=ooo$/vba$/Word
++	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();
++	        }
++	};
 +
-+# --- Settings -----------------------------------------------------
-+.INCLUDE :  $(PRJ)$/util$/makefile.pmk
++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 ] );
 +
-+IDLFILES= XGlobals.idl\
-+	XApplication.idl \
++	}
++	// 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;
 +
-+.INCLUDE :  target.mk
++	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 ) );	
++	}		
 +
-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 4b98130..a0f4982 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/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..3beaa29 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 )
++	virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException)
 +	{
-+		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 );
++		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();
 +	}
-         // 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>
++	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;
 +
- 
- using namespace ::com::sun::star;
- 
-@@ -160,6 +165,56 @@ public:
- 
- };
- 
-+class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
++		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
 +{
-+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;
-+    }
++	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){}
 +
 +};
 +
- //------------------------------------------------------------------------
- 
- 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 scp2/source/ooo/file_library_ooo.scp scp2/source/ooo/file_library_ooo.scp
-index 447e0e7..1e89e5b 100644
---- scp2/source/ooo/file_library_ooo.scp
-+++ scp2/source/ooo/file_library_ooo.scp
-@@ -406,6 +406,17 @@ 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
- #endif // VBA_EXTENSION
- #endif // ENABLE_VBA
- 
-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 >
++template <typename Ifc> // where Ifc must implement XCollectionTest
++class CollTestImplHelper :  public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
 +{
-+    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;
-+    }
-+};
++typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc >  > ImplBase1;
 +
-+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; }
-+
++	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 ) {}
 +};
 +
- /******************************************************************************
-  *
-  ******************************************************************************/
-@@ -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 :
-+		{
-+			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
- 
- #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);
 +
-     }
- 
-     ::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/helperdecl.hxx sw/source/ui/vba/helperdecl.hxx
++#endif //SC_VBA_COLLECTION_IMPL_HXX
+diff --git oovbaapi/inc/oovbaapi/vbahelper.hxx oovbaapi/inc/oovbaapi/vbahelper.hxx
 new file mode 100644
-index 0000000..4ed2834
+index 0000000..f533b09
 --- /dev/null
-+++ sw/source/ui/vba/helperdecl.hxx
-@@ -0,0 +1,143 @@
++++ oovbaapi/inc/oovbaapi/vbahelper.hxx
+@@ -0,0 +1,338 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -981,8 +589,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: helperdecl.hxx,v $
-+ * $Revision: 1.3 $
++ * $RCSfile: vbahelper.hxx,v $
++ * $Revision: 1.5.32.1 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -1002,201 +610,321 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef SW_VBA_HELPERDEC1_HXX
-+#define SW_VBA_HELPERDEC1_HXX
-+
++#ifndef OOVBAAPI_VBA_HELPER_HXX
++#define OOVBAAPI_VBA_HELPER_HXX
 +
-+#include <comphelper/servicedecl.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+
-+namespace comphelper {
-+namespace service_decl {
++#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>
 +
-+namespace detail {
 +namespace css = ::com::sun::star;
-+template <typename ImplT>
-+class OwnServiceImpl
-+    : public ImplT,
-+      private ::boost::noncopyable
++
++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);
++
++		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
 +{
-+    typedef ImplT BaseT;
++//Factor to translate between points and hundredths of millimeters:
++private:
++	static const double factor;
 +    
-+public:    
-+    OwnServiceImpl(
-+        ServiceDecl const& rServiceDecl,
-+        css::uno::Sequence<css::uno::Any> const& args,
-+        css::uno::Reference<css::uno::XComponentContext> const& xContext )
-+        :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
-+    OwnServiceImpl(
-+        ServiceDecl const& rServiceDecl,
-+        css::uno::Reference<css::uno::XComponentContext> const& xContext )
-+        : BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
++	double m_nMillimeter;
++
++public:
++	Millimeter():m_nMillimeter(0) {}
 +    
-+    // XServiceInfo
-+    virtual ::rtl::OUString SAL_CALL getImplementationName()
-+        throw (css::uno::RuntimeException) {
-+        return m_rServiceDecl.getImplementationName();
-+    }
-+    virtual sal_Bool SAL_CALL supportsService( ::rtl::OUString const& name )
-+        throw (css::uno::RuntimeException) {
-+        return m_rServiceDecl.supportsService(name);
-+    }
-+    virtual css::uno::Sequence< ::rtl::OUString>
-+    SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) {
-+        return m_rServiceDecl.getSupportedServiceNames();
-+    }
++	Millimeter(double mm):m_nMillimeter(mm) {}
 +    
-+private:
-+    ServiceDecl const& m_rServiceDecl;
-+};
++	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;
++	}
++};
 +
-+template <typename ImplT, typename WithArgsT>
-+struct OwnCreateFunc;
++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;
++};
 +
-+template <typename ImplT>
-+struct OwnCreateFunc<ImplT, with_args<false> > {
-+    explicit OwnCreateFunc(  )
-+         {}
-+    
-+    css::uno::Reference<css::uno::XInterface>
-+    operator()( ServiceDecl const& rServiceDecl,
-+                css::uno::Sequence<css::uno::Any> const&,
-+                css::uno::Reference<css::uno::XComponentContext>
-+                const& xContext ) const
++class OOVBA_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 css::uno::Reference< ooo::vba::XHelperInterface >(new OwnServiceImpl<ImplT>( rServiceDecl, xContext ));
++        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 );
 +    }
-+};
 +
-+template <typename ImplT>
-+struct OwnCreateFunc<ImplT, with_args<true> > {
-+    explicit OwnCreateFunc( )
-+         {}
-+    
-+    css::uno::Reference<css::uno::XInterface>
-+    operator()( ServiceDecl const& rServiceDecl,
-+                css::uno::Sequence<css::uno::Any> const& args,
-+                css::uno::Reference<css::uno::XComponentContext>
-+                const& xContext ) const
++    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)
 +    {
-+        css::uno::Reference< ooo::vba::XHelperInterface > xHelp(
-+            new OwnServiceImpl<ImplT>( rServiceDecl, args, xContext ) );
-+	css::uno::Reference< css::uno::XInterface > xIf( xHelp, css::uno::UNO_QUERY ) ;
-+	return xIf;
++        m_xShape->setHeight( nWidth );
 +    }
++
++   
 +};
++#define VBA_LEFT "PositionX"
++#define VBA_TOP "PositionY"
++class OOVBA_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
++{
 +
-+} // namespace detail
++    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);
++};
 +
-+/** Defines a service implementation class.
++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 >() );
++	}
 +    
-+    @tpl ImplT_ service implementation class
-+    @WithArgsT whether the implementation class ctor expects arguments
-+               (uno::Sequence<uno::Any>, uno::Reference<uno::XComponentContext>)
-+               or just (uno::Reference<uno::XComponentContext>)
-+*/
-+template <typename ImplT_, typename WithArgsT = with_args<false> >
-+struct vba_service_class_ {
-+    typedef ImplT_ ImplT;
-+    typedef detail::OwnServiceImpl<ImplT_ > ServiceImplT;
++	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() );
++    		}
++	}
 +    
-+    detail::CreateFuncF const m_createFunc;
 +    
-+    /** Default ctor.  Implementation class without args, expecting
-+        component context as single argument.
-+    */
-+    vba_service_class_() : m_createFunc(
-+        detail::OwnCreateFunc<ImplT, WithArgsT>() ) {}
++	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
++{
 +
-+} // namespace service_decl
-+} // namespace comphelper
++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 );
 +
-+#endif /* SW_VBA_HELPERDEC1_HXX */
-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 \
++	static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
++};
 +
-+# --- Targets ------------------------------------------------------
++// 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() );
++	}
 +
-+.INCLUDE :	target.mk
++	static void exception( int err,  const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
++	{
++		exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
++	}
 +
-+ALLTAR : \
-+        $(MISC)$/$(TARGET).don \
++	static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
++	{
++		exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
++	}
++};
++	} // openoffice
++} // org
 +
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
++namespace ov = ooo::vba;
 +
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+        echo $@
++#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
 +
-diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
++#endif
+diff --git oovbaapi/inc/oovbaapi/vbahelperinterface.hxx oovbaapi/inc/oovbaapi/vbahelperinterface.hxx
 new file mode 100644
-index 0000000..c3dc180
+index 0000000..dc1a89f
 --- /dev/null
-+++ sw/source/ui/vba/service.cxx
-@@ -0,0 +1,96 @@
++++ oovbaapi/inc/oovbaapi/vbahelperinterface.hxx
+@@ -0,0 +1,117 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1205,8 +933,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: service.cxx,v $
-+ * $Revision: 1.4 $
++ * $RCSfile: vbahelperinterface.hxx,v $
++ * $Revision: 1.3 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -1226,79 +954,100 @@
 + * 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;
++#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX
++#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
 +
-+namespace sdecl = comphelper::service_decl;
++#include <cppuhelper/implbase1.hxx>
++#include <ooo/vba/XHelperInterface.hpp>
++#include <oovbaapi/vbahelper.hxx>
 +
-+namespace globals
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
++// 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" ) );
 +
-+extern "C"
++template< typename Ifc1 >
++class InheritedHelperInterfaceImpl : public Ifc1
 +{
-+    void SAL_CALL component_getImplementationEnvironment( 
-+        const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
-+    {
-+		OSL_TRACE("In component_getImplementationEnv");
-+        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+    }
++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_Bool SAL_CALL component_writeInfo( 
-+        lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
-+    {
-+		OSL_TRACE("In component_writeInfo");
++	// 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(); }
 +
-+	// 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") ) );
++	// 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;
-+			}
-+			catch( uno::Exception& /*e*/ )
-+			{
-+				//recomp & friends will detect false returned and fail
-+			}
-+		}
-+		return sal_False;
-+    }
++		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;
++	}
++ };
 +
-+    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
++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 oovbaapi/inc/vbapropvalue.hxx oovbaapi/inc/vbapropvalue.hxx
 new file mode 100644
-index 0000000..3fd0635
+index 0000000..2580c43
 --- /dev/null
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -0,0 +1,100 @@
++++ oovbaapi/inc/vbapropvalue.hxx
+@@ -0,0 +1,60 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1307,8 +1056,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbaapplication.cxx,v $
-+ * $Revision: 1.7 $
++ * $RCSfile: vbapropvalue.hxx,v $
++ * $Revision: 1.3 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -1328,83 +1077,103 @@
 + * 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 )
++#ifndef SC_VBA_PROPVALULE_HXX
++#define SC_VBA_PROPVALULE_HXX
++#include <ooo/vba/XPropValue.hpp>
++#include <cppuhelper/implbase1.hxx>
 +
-+#define OWN_JOIN 1
++#include <oovbaapi/vbahelper.hxx>
 +
-+// #TODO is this defined somewhere else?
-+#if ( defined UNX ) || ( defined OS2 ) //unix
-+#define FILE_PATH_SEPERATOR "/"
-+#else // windows
-+#define FILE_PATH_SEPERATOR "\\"
-+#endif 
++typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
 +
-+#define EXCELVERSION "11.0"
++class PropListener 
++{
++public:
++    virtual void setValueEvent( const css::uno::Any& value ) = 0;
++    virtual css::uno::Any getValueEvent() = 0; 
++};
 +
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
 +
-+SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( uno::Reference< vba::XHelperInterface >(), xContext )
++class ScVbaPropValue : public PropValueImpl_BASE 
 +{
-+    OSL_TRACE("SwVbaApplication::SwVbaApplication");
-+}
++    PropListener* m_pListener;
++public:
++    ScVbaPropValue( PropListener* pListener );
 +
-+SwVbaApplication::~SwVbaApplication()
-+{
-+}
-+	
++    // 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);
 +
-+void SAL_CALL
-+SwVbaApplication::DoEvents() throw ( uno::RuntimeException )
-+{
-+}
++    rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
 +
-+rtl::OUString& 
-+SwVbaApplication::getServiceImplName()
-+{
-+	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
-+	return sImplName;
-+}
++};
++#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.
++#
++#*************************************************************************
 +
-+rtl::OUString SAL_CALL
-+SwVbaApplication::getName() throw (uno::RuntimeException)
-+{
-+        static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
-+        return appName;
-+}
++PRJ=..$/..
++PRJPCH=
 +
-+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
++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..0496ccf
+index 0000000..292399b
 --- /dev/null
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -0,0 +1,58 @@
++++ oovbaapi/ooo/vba/word/XApplication.idl
+@@ -0,0 +1,57 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1413,7 +1182,7 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbaapplication.hxx,v $
++ * $RCSfile: XApplication.idl,v $
 + * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
@@ -1434,41 +1203,40 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef SW_VBA_APPLICATION_HXX
-+#define SW_VBA_APPLICATION_HXX
++#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
 +
-+#include <ooo/vba/word/XApplication.hpp>
++#ifndef __ooo_vba_XHelperInterface_idl__
++#include <ooo/vba/XHelperInterface.idl>
++#endif
 +
-+#include "vbahelperinterface.hxx"
 +
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
++module ooo {  module vba {  module word { 
 +
-+class SwVbaApplication : public SwVbaApplication_BASE
++interface XApplication
 +{
-+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; }
++	interface ::ooo::vba::XHelperInterface;
 +
-+	// 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();
++	[attribute, readonly] string Name;
++	void DoEvents();
 +};
-+#endif /* SW_VBA_APPLICATION_HXX */
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
++
++}; }; };
++
++#endif
++
++
+diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
 new file mode 100644
-index 0000000..ccdafd3
+index 0000000..3c144a6
 --- /dev/null
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -0,0 +1,109 @@
++++ oovbaapi/ooo/vba/word/XGlobals.idl
+@@ -0,0 +1,54 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1477,7 +1245,7 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbaglobals.cxx,v $
++ * $RCSfile: XGlobals.idl,v $
 + * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
@@ -1498,167 +1266,9037 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#include "helperdecl.hxx"
-+#include "vbaglobals.hxx"
++#ifndef __ooo_vba_word_XGlobals_idl__
++#define __ooo_vba_word_XGlobals_idl__
 +
-+#include <comphelper/unwrapargs.hxx>
++#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
 +
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
++module ooo {  module vba {  module word { 
 +
-+#include <cppuhelper/bootstrap.hxx>
-+#include "vbaapplication.hxx"
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::ooo::vba;
++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
 +
-+// =============================================================================
-+// 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) );
-+}
+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 : $(SOLARBINDIR)$/oovbaapi.rdb
++        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -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 : $(SOLARBINDIR)$/oovbaapi.rdb
++        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -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 ------------------------------------------------------
+-REGMERGEFLAGS=-i
++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();
++};
++};
++#endif
+diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk
+index 4eaad61..4122073 100644
+--- sc/source/ui/vba/makefile.mk
++++ sc/source/ui/vba/makefile.mk
+@@ -63,7 +63,7 @@ SLOFILES= \
+ 		$(SLO)$/vbaworksheet.obj \
+ 		$(SLO)$/vbaoutline.obj \
+ 		$(SLO)$/vbafont.obj\
+-		$(SLO)$/vbahelper.obj\
++		$(SLO)$/excelvbahelper.obj\
+ 		$(SLO)$/vbainterior.obj\
+ 		$(SLO)$/vbawsfunction.obj\
+ 		$(SLO)$/vbawindow.obj\
+diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
+index 754885e..197655a 100644
+--- sc/source/ui/vba/vbaapplication.hxx
++++ sc/source/ui/vba/vbaapplication.hxx
+@@ -35,7 +35,7 @@
+ #include <ooo/vba/excel/XApplication.hpp>
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaassistant.hxx
++++ sc/source/ui/vba/vbaassistant.hxx
+@@ -40,8 +40,8 @@
+ 
+ #include <sfx2/sfxhelp.hxx>
+ 
+-#include "vbahelper.hxx"
+-#include "vbahelperinterface.hxx"
++#include "excelvbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaaxes.hxx
++++ sc/source/ui/vba/vbaaxes.hxx
+@@ -32,7 +32,7 @@
+ #include <ooo/vba/excel/XAxes.hpp>
+ #include <ooo/vba/excel/XAxis.hpp>
+ #include <ooo/vba/excel/XChart.hpp>
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaaxis.hxx
++++ sc/source/ui/vba/vbaaxis.hxx
+@@ -32,8 +32,8 @@
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <ooo/vba/excel/XAxis.hpp>
+ #include <ooo/vba/excel/XChart.hpp>
+-#include "vbahelperinterface.hxx"
+-
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaborders.hxx
++++ sc/source/ui/vba/vbaborders.hxx
+@@ -38,7 +38,7 @@
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ 
+  
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbabutton.hxx
++++ sc/source/ui/vba/vbabutton.hxx
+@@ -33,7 +33,7 @@
+ #include <ooo/vba/msforms/XButton.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacharacters.hxx
++++ sc/source/ui/vba/vbacharacters.hxx
+@@ -36,7 +36,7 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/text/XSimpleText.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbachart.hxx
++++ sc/source/ui/vba/vbachart.hxx
+@@ -41,7 +41,7 @@
+ #include <ooo/vba/excel/XChart.hpp>
+ #include <ooo/vba/excel/XDataLabels.hpp>
+ #include <ooo/vba/excel/XSeries.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbachartobject.hxx
++++ sc/source/ui/vba/vbachartobject.hxx
+@@ -36,7 +36,7 @@
+ #include <com/sun/star/container/XNamed.hpp>
+ #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
+ #include <ooo/vba/excel/XChartObject.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbachartobjects.hxx
++++ sc/source/ui/vba/vbachartobjects.hxx
+@@ -36,8 +36,8 @@
+ #include <com/sun/star/table/XTableCharts.hpp>
+ #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+ #include <com/sun/star/container/XEnumerationAccess.hpp>
+-#include"vbacollectionimpl.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacharts.hxx
++++ sc/source/ui/vba/vbacharts.hxx
+@@ -31,8 +31,8 @@
+ #define SC_VBA_CHARTS_HXX
+ #include <ooo/vba/excel/XCharts.hpp>
+ #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+-#include"vbacollectionimpl.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacheckbox.hxx
++++ sc/source/ui/vba/vbacheckbox.hxx
+@@ -38,7 +38,7 @@
+ #include <ooo/vba/msforms/XRadioButton.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ 
+ typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
+ 
+diff --git sc/source/ui/vba/vbacollectionimpl.cxx sc/source/ui/vba/vbacollectionimpl.cxx
+deleted file mode 100644
+index 5a9ae13..0000000
+--- sc/source/ui/vba/vbacollectionimpl.cxx
++++ /dev/null
+@@ -1,136 +0,0 @@
+-/*************************************************************************
+- *
+- * 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.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 <vbacollectionimpl.hxx>
+-#include "vbaglobals.hxx"
+-using namespace ::com::sun::star;
+-using namespace ::ooo::vba;
+-
+-
+-ScVbaCollectionBaseImpl::ScVbaCollectionBaseImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : m_xContext( xContext ), m_xIndexAccess( xIndexAccess )
+-{
+-	m_xNameAccess.set( xIndexAccess, uno::UNO_QUERY );
+-}
+-
+-uno::Any
+-ScVbaCollectionBaseImpl::getItemByStringIndex( const rtl::OUString& sIndex ) throw (::uno::RuntimeException)
+-{
+-	if ( !m_xNameAccess.is() )
+-		throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl string index access not supported by this object") ), uno::Reference< uno::XInterface >() );
+-
+-	return createCollectionObject( m_xNameAccess->getByName( sIndex ) );	
+-}
+-
+-uno::Any 
+-ScVbaCollectionBaseImpl::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException)
+-{
+-	if ( !m_xIndexAccess.is() )
+-		throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl numeric index access not supported by this object") ), uno::Reference< uno::XInterface >() );
+-	if ( nIndex <= 0 )
+-	{
+-		throw  lang::IndexOutOfBoundsException( 
+-			::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
+-			"index is 0 or negative" ) ), 
+-			uno::Reference< uno::XInterface >() );
+-	}
+-	// need to adjust for vba index ( for which first element is 1 )
+-	return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );	
+-}
+-
+-::sal_Int32 SAL_CALL 
+-ScVbaCollectionBaseImpl::getCount() throw (uno::RuntimeException)
+-{
+-	return m_xIndexAccess->getCount();
+-}
+-
+-uno::Any SAL_CALL 
+-ScVbaCollectionBaseImpl::getParent() throw (uno::RuntimeException)
+-{
+-	// #TODO #FIXME investigate whether this makes sense
+-	uno::Reference< excel::XApplication > xApplication =
+-		ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication();
+-	uno::Reference< excel::XWorkbook > xWorkbook;
+-	if ( xApplication.is() )
+-	{
+-		xWorkbook = xApplication->getActiveWorkbook();
+-	}
+-	return uno::Any( xWorkbook );
+-}
+-
+-::sal_Int32 SAL_CALL ScVbaCollectionBaseImpl::getCreator() throw (uno::RuntimeException)
+-{
+-	// #TODO #FIXE some sort of implementation
+-	//SC_VBA_STUB();
+-	return 0;
+-}
+-uno::Reference< excel::XApplication > SAL_CALL ScVbaCollectionBaseImpl::getApplication() throw (uno::RuntimeException)
+-{
+-	// #TODO #FIXME investigate whether this makes sense
+-	uno::Reference< excel::XApplication > xApplication =
+-		ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication();
+-	return  xApplication;
+-}
+-
+-uno::Any SAL_CALL ScVbaCollectionBaseImpl::Item( const uno::Any& aIndex ) throw (uno::RuntimeException)
+-{
+-	if ( aIndex.getValueTypeClass() != uno::TypeClass_STRING )
+-	{
+-		sal_Int32 nIndex = 0;
+-
+-		if ( ( aIndex >>= nIndex ) != sal_True )
+-		{
+-			rtl::OUString message;
+-			message = rtl::OUString::createFromAscii(
+-				"Couldn't convert index to Int32");
+-			throw  lang::IndexOutOfBoundsException( message,
+-				uno::Reference< uno::XInterface >() );
+-		}
+-		return 	getItemByIntIndex( nIndex );
+-	}
+-	rtl::OUString aStringSheet;
+-
+-	aIndex >>= aStringSheet;
+-	return getItemByStringIndex( aStringSheet );	
+-}
+-
+-::rtl::OUString SAL_CALL 
+-ScVbaCollectionBaseImpl::getDefaultMethodName(  ) throw (css::uno::RuntimeException)
+-{
+-	const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
+-	return sName;
+-}
+-
+-	// XElementAccess
+-
+-::sal_Bool SAL_CALL ScVbaCollectionBaseImpl::hasElements() throw (uno::RuntimeException)
+-{
+-	return ( m_xIndexAccess->getCount() > 0 );
+-}
+-
+-
+diff --git sc/source/ui/vba/vbacollectionimpl.hxx sc/source/ui/vba/vbacollectionimpl.hxx
+deleted file mode 100644
+index 80371a3..0000000
+--- sc/source/ui/vba/vbacollectionimpl.hxx
++++ /dev/null
+@@ -1,259 +0,0 @@
+-/*************************************************************************
+- *
+- * 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 SC_VBA_COLLECTION_IMPL_HXX
+-#define SC_VBA_COLLECTION_IMPL_HXX
+-
+-#include <ooo/vba/XCollection.hpp>
+-//#include <ooo/vba/XCollectionTest.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.hxx"
+-#include "vbahelperinterface.hxx"
+-#include "vbaglobals.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 sc/source/ui/vba/vbacolorformat.hxx sc/source/ui/vba/vbacolorformat.hxx
+index a5104d8..be251e0 100644
+--- sc/source/ui/vba/vbacolorformat.hxx
++++ sc/source/ui/vba/vbacolorformat.hxx
+@@ -33,7 +33,7 @@
+ #include <com/sun/star/drawing/XShape.hpp>
+ #include <ooo/vba/msforms/XColorFormat.hpp>
+ #include <ooo/vba/msforms/XFillFormat.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacombobox.hxx
++++ sc/source/ui/vba/vbacombobox.hxx
+@@ -40,7 +40,7 @@
+ 
+ #include "vbacontrol.hxx"
+ #include "vbalistcontrolhelper.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ 
+ typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
+ class ScVbaComboBox : public ComboBoxImpl_BASE
+diff --git sc/source/ui/vba/vbacommandbar.cxx sc/source/ui/vba/vbacommandbar.cxx
+index 24e5189..b5c283d 100644
+--- sc/source/ui/vba/vbacommandbar.cxx
++++ sc/source/ui/vba/vbacommandbar.cxx
+@@ -41,7 +41,7 @@
+ 
+ #include "vbacommandbar.hxx"
+ #include "vbacommandbarcontrols.hxx"
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ 
+ 
+ using namespace com::sun::star;
+diff --git sc/source/ui/vba/vbacommandbar.hxx sc/source/ui/vba/vbacommandbar.hxx
+index bbeda7c..920dc18 100644
+--- sc/source/ui/vba/vbacommandbar.hxx
++++ sc/source/ui/vba/vbacommandbar.hxx
+@@ -41,7 +41,7 @@
+ #include <com/sun/star/container/XIndexContainer.hpp>
+ #include <com/sun/star/beans/PropertyValues.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacommandbarcontrol.hxx
++++ sc/source/ui/vba/vbacommandbarcontrol.hxx
+@@ -40,7 +40,7 @@
+ #include <ooo/vba/XCommandBarButton.hpp>
+ #include <ooo/vba/office/MsoControlType.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacommandbarcontrols.hxx
++++ sc/source/ui/vba/vbacommandbarcontrols.hxx
+@@ -37,9 +37,9 @@
+ 
+ #include <ooo/vba/XCommandBarControls.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ #include "vbacommandbar.hxx"
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/vbacollectionimpl.hxx>
+ 
+ class ScVbaCommandBarControl;
+ 
+diff --git sc/source/ui/vba/vbacommandbars.cxx sc/source/ui/vba/vbacommandbars.cxx
+index a111609..7913000 100644
+--- sc/source/ui/vba/vbacommandbars.cxx
++++ sc/source/ui/vba/vbacommandbars.cxx
+@@ -38,6 +38,7 @@
+ 
+ #include "vbacommandbars.hxx"
+ #include "vbacommandbar.hxx"
++#include "vbaglobals.hxx"
+ 
+ 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
+--- sc/source/ui/vba/vbacommandbars.hxx
++++ sc/source/ui/vba/vbacommandbars.hxx
+@@ -41,8 +41,8 @@
+ 
+ #include <cppuhelper/implbase1.hxx>
+ 
+-#include "vbahelperinterface.hxx"
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacomment.hxx
++++ sc/source/ui/vba/vbacomment.hxx
+@@ -39,7 +39,7 @@
+ #include <com/sun/star/table/XCellRange.hpp>
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacomments.hxx
++++ sc/source/ui/vba/vbacomments.hxx
+@@ -34,8 +34,8 @@
+ 
+ #include <ooo/vba/excel/XComments.hpp>
+ 
+-#include "vbahelper.hxx"
+-#include "vbacollectionimpl.hxx"
++#include "excelvbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacondition.hxx
++++ sc/source/ui/vba/vbacondition.hxx
+@@ -31,7 +31,7 @@
+ #define SC_VBA_CONDITION_HXX
+ #include <com/sun/star/sheet/XSheetCondition.hpp> 
+ #include <com/sun/star/sheet/XCellRangeAddressable.hpp> 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbacontrol.hxx
++++ sc/source/ui/vba/vbacontrol.hxx
+@@ -39,8 +39,9 @@
+ #include <com/sun/star/awt/XWindowPeer.hpp>
+ #include <ooo/vba/msforms/XControl.hpp>
+ 
+-#include "vbahelper.hxx"
+-#include "vbahelperinterface.hxx"
++#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;
+diff --git sc/source/ui/vba/vbacontrols.hxx sc/source/ui/vba/vbacontrols.hxx
+index 31ab049..4904033 100644
+--- sc/source/ui/vba/vbacontrols.hxx
++++ sc/source/ui/vba/vbacontrols.hxx
+@@ -34,8 +34,8 @@
+ #include <ooo/vba/msforms/XControls.hpp>
+ #include <com/sun/star/awt/XControl.hpp>
+ 
+-#include "vbacollectionimpl.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbacollectionimpl.hxx>
++#include <oovbaapi/vbahelper.hxx>
+ 
+ typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
+ 
+diff --git sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx
+index 6037390..7383f5d 100644
+--- sc/source/ui/vba/vbadialog.cxx
++++ sc/source/ui/vba/vbadialog.cxx
+@@ -35,7 +35,7 @@
+ 
+ #include <tools/string.hxx>
+ 
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ #include "vbadialog.hxx"
+ #include "vbaglobals.hxx"
+ 
+diff --git sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
+index 94d8114..bb4ede8 100644
+--- sc/source/ui/vba/vbadialog.hxx
++++ sc/source/ui/vba/vbadialog.hxx
+@@ -37,7 +37,7 @@
+ #include <ooo/vba/excel/XApplication.hpp>
+ #include <ooo/vba/excel/XDialog.hpp>
+  
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ #include "vbadialog.hxx"
+ 
+ typedef InheritedHelperInterfaceImpl1< ov::excel::XDialog > ScVbaDialog_BASE;
+diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx
+index e25cf7c..c798be9 100644
+--- sc/source/ui/vba/vbadialogs.cxx
++++ sc/source/ui/vba/vbadialogs.cxx
+@@ -36,7 +36,7 @@
+ 
+ #include <tools/string.hxx>
+ 
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ #include "vbadialogs.hxx"
+ #include "vbaglobals.hxx"
+ #include "vbadialog.hxx"
+diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
+index fe9a32c..b8d7007 100644
+--- sc/source/ui/vba/vbadialogs.hxx
++++ sc/source/ui/vba/vbadialogs.hxx
+@@ -35,7 +35,7 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <ooo/vba/excel/XDialogs.hpp>
+ #include <ooo/vba/XCollection.hpp>
+-#include "vbahelperinterface.hxx" 
++#include <oovbaapi/vbahelperinterface.hxx>
+ 
+ class ScModelObj;
+ 
+diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
+index c83406f..0fcea13 100644
+--- sc/source/ui/vba/vbaeventshelper.cxx
++++ sc/source/ui/vba/vbaeventshelper.cxx
+@@ -33,7 +33,7 @@
+  *
+  ************************************************************************/
+ #include "vbaeventshelper.hxx"
+-#include "helperdecl.hxx"
++#include <oovbaapi/helperdecl.hxx>
+ #include <sfx2/objsh.hxx> 
+ #include <basic/basmgr.hxx>
+ #include <basic/sbmod.hxx>
+diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
+index df56886..fd0dc12 100644
+--- sc/source/ui/vba/vbaeventshelper.hxx
++++ sc/source/ui/vba/vbaeventshelper.hxx
+@@ -40,7 +40,7 @@
+ #include <cppuhelper/implbase1.hxx>
+ #include <com/sun/star/document/VbaEventId.hpp>
+ #include <com/sun/star/document/XVbaEventsHelper.hpp>
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ 
+ #define INVALID_TAB -1
+ 
+diff --git sc/source/ui/vba/vbafillformat.hxx sc/source/ui/vba/vbafillformat.hxx
+index 88fcfc0..2ab5661 100644
+--- sc/source/ui/vba/vbafillformat.hxx
++++ sc/source/ui/vba/vbafillformat.hxx
+@@ -33,7 +33,7 @@
+ #include <com/sun/star/drawing/XShape.hpp>
+ #include <com/sun/star/drawing/FillStyle.hpp>
+ #include <ooo/vba/msforms/XFillFormat.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbafont.hxx
++++ sc/source/ui/vba/vbafont.hxx
+@@ -34,7 +34,7 @@
+ 
+ #include <ooo/vba/excel/XFont.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ #include "vbapalette.hxx"
+ 
+ class ScTableSheetsObj;
+diff --git sc/source/ui/vba/vbaformat.cxx sc/source/ui/vba/vbaformat.cxx
+index 16cbf3a..9a13b94 100644
+--- sc/source/ui/vba/vbaformat.cxx
++++ sc/source/ui/vba/vbaformat.cxx
+@@ -33,6 +33,7 @@
+ #include <ooo/vba/excel/XlHAlign.hpp>
+ #include <ooo/vba/excel/XlOrientation.hpp>
+ #include <ooo/vba/excel/Constants.hpp>
++#include <ooo/vba/excel/XRange.hpp>
+ #include <com/sun/star/table/CellVertJustify.hpp>
+ #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
+--- sc/source/ui/vba/vbaformat.hxx
++++ sc/source/ui/vba/vbaformat.hxx
+@@ -39,7 +39,7 @@
+ #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+ #include <com/sun/star/lang/Locale.hpp>
+ #include <com/sun/star/beans/XPropertyState.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ 
+ template< typename Ifc1 >
+ class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
+diff --git sc/source/ui/vba/vbaformatconditions.cxx sc/source/ui/vba/vbaformatconditions.cxx
+index 26d8b67..827503e 100644
+--- sc/source/ui/vba/vbaformatconditions.cxx
++++ sc/source/ui/vba/vbaformatconditions.cxx
+@@ -36,6 +36,7 @@
+ #include "vbaformatcondition.hxx"
+ #include "vbaworkbook.hxx"
+ #include "vbastyles.hxx"
++#include "vbaglobals.hxx"
+ using namespace ::ooo::vba;
+ using namespace ::com::sun::star;
+ 
+diff --git sc/source/ui/vba/vbaformatconditions.hxx sc/source/ui/vba/vbaformatconditions.hxx
+index efdfce5..7696380 100644
+--- sc/source/ui/vba/vbaformatconditions.hxx
++++ sc/source/ui/vba/vbaformatconditions.hxx
+@@ -35,7 +35,7 @@
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/table/CellAddress.hpp>
+ #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaframe.hxx
++++ sc/source/ui/vba/vbaframe.hxx
+@@ -38,7 +38,7 @@
+ #include <ooo/vba/msforms/XLabel.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaglobals.cxx
++++ sc/source/ui/vba/vbaglobals.cxx
+@@ -27,7 +27,7 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <oovbaapi/helperdecl.hxx>
+ #include "vbaglobals.hxx"
+ 
+ #include <comphelper/unwrapargs.hxx>
+diff --git sc/source/ui/vba/vbaglobals.hxx sc/source/ui/vba/vbaglobals.hxx
+index 0e9e3a5..ee33026 100644
+--- sc/source/ui/vba/vbaglobals.hxx
++++ sc/source/ui/vba/vbaglobals.hxx
+@@ -36,7 +36,7 @@
+ #include <ooo/vba/XGlobals.hpp>
+ 
+ #include <cppuhelper/implbase1.hxx>
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ 
+     // =============================================================================
+     // class ScVbaGlobals
+diff --git sc/source/ui/vba/vbahelper.cxx sc/source/ui/vba/vbahelper.cxx
+deleted file mode 100644
+index 5e5f6e6..0000000
+--- sc/source/ui/vba/vbahelper.cxx
++++ /dev/null
+@@ -1,818 +0,0 @@
+-/*************************************************************************
+- *
+- * 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 <docuno.hxx>
+-
+-#include <basic/sbx.hxx>
+-#include <basic/sbstar.hxx>
+-#include <rtl/math.hxx>
+-
+-#include <math.h>
+-#include "vbahelper.hxx"
+-#include "tabvwsh.hxx"
+-#include "transobj.hxx"
+-#include "scmod.hxx"
+-#include "vbashape.hxx"
+-#include "unonames.hxx"
+-using namespace ::com::sun::star;
+-using namespace ::ooo::vba;
+-
+-#define POINTTO100THMILLIMETERFACTOR 35.27778
+-void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
+-
+-uno::Any sbxToUnoValue( SbxVariable* pVar );
+-
+-
+-namespace ooo
+-{
+-namespace vba
+-{
+-
+-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;
+-}
+-// 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;
+-}
+-const ::rtl::OUString REPLACE_CELLS_WARNING(  RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
+-const uno::Any&
+-aNULL()
+-{
+- 	static  uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
+-	return aNULLL;
+-}
+-
+-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
+-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 );
+-}
+-
+-
+-void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall)
+-{
+-	ScTabViewShell* pViewShell = getBestViewShell( xModel );
+-	SfxViewFrame* pViewFrame = NULL;
+-	if ( pViewShell )
+-		pViewFrame = pViewShell->GetViewFrame();
+-	if ( pViewFrame )
+-	{
+-		SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+-		if( pDispatcher )
+-		{
+-			pDispatcher->Execute( nSlot , nCall );
+-		}
+-	}	
+-}
+-		
+-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();
+-			}
+-		}
+-	}
+-
+-}
+-
+- 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;
+-}
+-
+-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;
+-}
+-
+-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( 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, css::uno::Reference< frame::XModel >& xModel, 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;
+-	}
+-	ScTabViewShell* pViewShell = getBestViewShell( xModel );
+-	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() ) 	
+-				{
+-					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*/, css::uno::Reference< css::frame::XModel >& xModel )
+-{
+-	dispatchExecute( xModel, 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 )
+-{
+-	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( 	SC_UNONAME_CELLHGT ) ) ) >>= nHeight;	
+-	return Millimeter::getInPoints( nHeight );
+-    }
+-    void UserFormGeometryHelper::setHeight( double nHeight )
+-    {
+-	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
+-    }
+-    double UserFormGeometryHelper::getWidth()
+-    {
+-	sal_Int32 nWidth = 0;
+-	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	SC_UNONAME_CELLWID ) ) ) >>= nWidth;	
+-	return Millimeter::getInPoints( nWidth );
+-    }
+-    void UserFormGeometryHelper::setWidth( double nWidth)
+-    {
+-	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	SC_UNONAME_CELLWID ) ), uno::makeAny(  Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
+-    }
+-} // openoffice
+-} //org
+diff --git sc/source/ui/vba/vbahelper.hxx sc/source/ui/vba/vbahelper.hxx
+deleted file mode 100644
+index 6ba5f16..0000000
+--- sc/source/ui/vba/vbahelper.hxx
++++ /dev/null
+@@ -1,344 +0,0 @@
+-/*************************************************************************
+- *
+- * 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_VBA_HELPER_HXX
+-#define SC_VBA_HELPER_HXX
+-
+-#include <com/sun/star/drawing/XShape.hpp>
+-#include <com/sun/star/beans/XIntrospectionAccess.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 <docsh.hxx>
+-#include <sfx2/dispatch.hxx>
+-#include <ooo/vba/msforms/XShape.hpp>
+-
+-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;
+-		}
+-		css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
+-		css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+-
+-		void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
+-		void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
+-		void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
+-		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();
+-		sal_Int32 OORGBToXLRGB( sal_Int32 );
+-		sal_Int32 XLRGBToOORGB( sal_Int32 );
+-		css::uno::Any OORGBToXLRGB( const css::uno::Any& );
+-		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
+-		const css::uno::Any& aNULL();
+-		void PrintOutHelper( 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, css::uno::Reference< css::frame::XModel >& xModel, sal_Bool bSelection  );
+-		void PrintPreviewHelper( const css::uno::Any& EnableChanges, css::uno::Reference< css::frame::XModel >& xModel );
+-
+-		rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
+-		rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
+-	double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
+-	double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+-	double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+-
+-class 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 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 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 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 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 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 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 sc/source/ui/vba/vbahelperinterface.hxx sc/source/ui/vba/vbahelperinterface.hxx
+deleted file mode 100644
+index 693706e..0000000
+--- sc/source/ui/vba/vbahelperinterface.hxx
++++ /dev/null
+@@ -1,116 +0,0 @@
+-/*************************************************************************
+- *
+- * 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 SC_VBA_HELPERINTERFACE_HXX
+-#define SC_VBA_HELPERINTERFACE_HXX
+-
+-#include <cppuhelper/implbase1.hxx>
+-#include <ooo/vba/XHelperInterface.hpp>
+-#include "vbahelper.hxx"
+-#include "vbaglobals.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) { return  css::uno::makeAny( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication() ); }
+-
+-
+-	// 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 sc/source/ui/vba/vbahyperlink.cxx sc/source/ui/vba/vbahyperlink.cxx
+index 4b95eb7..9bf353f 100644
+--- sc/source/ui/vba/vbahyperlink.cxx
++++ sc/source/ui/vba/vbahyperlink.cxx
+@@ -32,7 +32,7 @@
+  *    MA  02111-1307  USA
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbahyperlink.hxx
++++ sc/source/ui/vba/vbahyperlink.hxx
+@@ -40,7 +40,7 @@
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <ooo/vba/excel/XRange.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaimage.hxx
++++ sc/source/ui/vba/vbaimage.hxx
+@@ -33,7 +33,7 @@
+ #include <ooo/vba/msforms/XImage.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbainterior.hxx
++++ sc/source/ui/vba/vbainterior.hxx
+@@ -34,9 +34,10 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/container/XIndexAccess.hpp>
++#include <com/sun/star/container/XNameContainer.hpp>
+ 
+ #include <com/sun/star/script/XInvocation.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ 
+ class ScDocument;
+ 
+diff --git sc/source/ui/vba/vbalabel.hxx sc/source/ui/vba/vbalabel.hxx
+index d6846a4..736d0b8 100644
+--- sc/source/ui/vba/vbalabel.hxx
++++ sc/source/ui/vba/vbalabel.hxx
+@@ -33,7 +33,7 @@
+ #include <ooo/vba/msforms/XLabel.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbalineformat.hxx
++++ sc/source/ui/vba/vbalineformat.hxx
+@@ -33,7 +33,7 @@
+ #include <com/sun/star/drawing/XShape.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <ooo/vba/msforms/XLineFormat.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbalistbox.hxx
++++ sc/source/ui/vba/vbalistbox.hxx
+@@ -38,7 +38,7 @@
+ #include "vbacontrol.hxx"
+ #include "vbapropvalue.hxx"
+ #include "vbalistcontrolhelper.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ 
+ typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
+ class ScVbaListBox : public ListBoxImpl_BASE
+diff --git sc/source/ui/vba/vbalistcontrolhelper.cxx sc/source/ui/vba/vbalistcontrolhelper.cxx
+index 620734a..8582821 100644
+--- sc/source/ui/vba/vbalistcontrolhelper.cxx
++++ sc/source/ui/vba/vbalistcontrolhelper.cxx
+@@ -1,4 +1,5 @@
+ #include <vbalistcontrolhelper.hxx>
++#include <vector>
+ 
+ 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
+--- sc/source/ui/vba/vbalistcontrolhelper.hxx
++++ sc/source/ui/vba/vbalistcontrolhelper.hxx
+@@ -1,7 +1,7 @@
+ #ifndef SC_VBA_LISTCONTROLHELPER
+ #define SC_VBA_LISTCONTROLHELPER
+ 
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ 
+ class ListControlHelper
+ {
+diff --git sc/source/ui/vba/vbamultipage.hxx sc/source/ui/vba/vbamultipage.hxx
+index 3c83d6c..a01f2a1 100644
+--- sc/source/ui/vba/vbamultipage.hxx
++++ sc/source/ui/vba/vbamultipage.hxx
+@@ -39,7 +39,7 @@
+ #include <com/sun/star/container/XIndexAccess.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaname.cxx
++++ sc/source/ui/vba/vbaname.cxx
+@@ -27,7 +27,7 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaname.hxx
++++ sc/source/ui/vba/vbaname.hxx
+@@ -34,7 +34,9 @@
+ #include <com/sun/star/sheet/XNamedRange.hpp>
+ #include <com/sun/star/sheet/XNamedRanges.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbanames.cxx
++++ sc/source/ui/vba/vbanames.cxx
+@@ -27,7 +27,7 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbanames.hxx
++++ sc/source/ui/vba/vbanames.hxx
+@@ -34,7 +34,10 @@
+ #include <ooo/vba/XCollection.hpp>
+ #include <com/sun/star/container/XEnumerationAccess.hpp>
+ #include <com/sun/star/sheet/XNamedRanges.hpp>
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/vbacollectionimpl.hxx>
++
++class ScDocument;
++class ScDocShell;
+ 
+ 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
+--- sc/source/ui/vba/vbaoleobject.hxx
++++ sc/source/ui/vba/vbaoleobject.hxx
+@@ -35,7 +35,7 @@
+ #include <com/sun/star/awt/XWindowPeer.hpp>
+ #include <ooo/vba/excel/XOLEObject.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaoleobjects.hxx
++++ sc/source/ui/vba/vbaoleobjects.hxx
+@@ -33,8 +33,8 @@
+ #include <cppuhelper/implbase1.hxx>
+ #include <ooo/vba/excel/XOLEObjects.hpp>
+ 
+-#include "vbacollectionimpl.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaoutline.hxx
++++ sc/source/ui/vba/vbaoutline.hxx
+@@ -34,7 +34,7 @@
+ #include <cppuhelper/implbase1.hxx>
+ #include <ooo/vba/excel/XOutline.hpp>
+ #include <com/sun/star/uno/XComponentContext.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbapagebreak.hxx
++++ sc/source/ui/vba/vbapagebreak.hxx
+@@ -38,7 +38,7 @@
+ #include <com/sun/star/script/BasicErrorException.hpp>
+ #include <com/sun/star/sheet/TablePageBreakData.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbapagebreaks.hxx
++++ sc/source/ui/vba/vbapagebreaks.hxx
+@@ -41,8 +41,8 @@
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/container/XIndexAccess.hpp>
+ #include <com/sun/star/table/XColumnRowRange.hpp>
+-#include "vbahelperinterface.hxx"
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
++#include <oovbaapi/vbacollectionimpl.hxx>
+ 
+ typedef CollTestImplHelper< ov::excel::XHPageBreaks > ScVbaHPageBreaks_BASE;
+ 
+diff --git sc/source/ui/vba/vbapages.cxx sc/source/ui/vba/vbapages.cxx
+index 658bf06..db28086 100644
+--- sc/source/ui/vba/vbapages.cxx
++++ sc/source/ui/vba/vbapages.cxx
+@@ -36,7 +36,6 @@
+ 
+ using namespace ::ooo::vba;
+ using namespace ::com::sun::star;
+-using namespace ::vos;
+ 
+ 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
+--- sc/source/ui/vba/vbapages.hxx
++++ sc/source/ui/vba/vbapages.hxx
+@@ -42,7 +42,7 @@
+ #include <cppuhelper/implbase2.hxx>
+ #include <cppuhelper/implbase1.hxx>
+ 
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/vbacollectionimpl.hxx>
+ typedef CollTestImplHelper< 
+ ov::msforms::XPages > ScVbaPages_BASE;
+ 
+diff --git sc/source/ui/vba/vbapagesetup.cxx sc/source/ui/vba/vbapagesetup.cxx
+index 33d3128..c8974a6 100644
+--- sc/source/ui/vba/vbapagesetup.cxx
++++ sc/source/ui/vba/vbapagesetup.cxx
+@@ -31,6 +31,7 @@
+ #include "cellsuno.hxx"
+ #include "convuno.hxx"
+ #include "rangelst.hxx"
++#include "excelvbahelper.hxx"
+ #include <com/sun/star/sheet/XPrintAreas.hpp>
+ #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
+--- sc/source/ui/vba/vbapagesetup.hxx
++++ sc/source/ui/vba/vbapagesetup.hxx
+@@ -35,7 +35,7 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/sheet/XSpreadsheet.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ 
+ typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE;
+ 
+diff --git sc/source/ui/vba/vbapalette.hxx sc/source/ui/vba/vbapalette.hxx
+index 1fbb892..af41d2f 100644
+--- sc/source/ui/vba/vbapalette.hxx
++++ sc/source/ui/vba/vbapalette.hxx
+@@ -30,7 +30,7 @@
+ #ifndef SC_VBAPALETTE_HXX
+ #define SC_VBAPALETTE_HXX
+ 
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ #include <document.hxx>
+ #include <com/sun/star/container/XIndexAccess.hpp>
+ 
+diff --git sc/source/ui/vba/vbapane.hxx sc/source/ui/vba/vbapane.hxx
+index e7d8c9c..3e98c8b 100644
+--- sc/source/ui/vba/vbapane.hxx
++++ sc/source/ui/vba/vbapane.hxx
+@@ -34,7 +34,7 @@
+ #include<com/sun/star/sheet/XViewPane.hpp>
+ #include<ooo/vba/excel/XPane.hpp>
+ 
+-#include"vbahelper.hxx"
++#include"excelvbahelper.hxx"
+ 
+ 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
+--- sc/source/ui/vba/vbapictureformat.hxx
++++ sc/source/ui/vba/vbapictureformat.hxx
+@@ -33,7 +33,7 @@
+ #include <com/sun/star/drawing/XShape.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <ooo/vba/msforms/XPictureFormat.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbapivotcache.hxx
++++ sc/source/ui/vba/vbapivotcache.hxx
+@@ -34,7 +34,7 @@
+ #include <com/sun/star/sheet/XDataPilotTable.hpp>
+ 
+ #include <ooo/vba/excel/XPivotCache.hpp>
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbapivottable.hxx
++++ sc/source/ui/vba/vbapivottable.hxx
+@@ -33,8 +33,8 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/sheet/XDataPilotTable.hpp>
+ #include <ooo/vba/excel/XPivotTable.hpp>
+-#include "vbahelper.hxx"
+-#include "vbahelperinterface.hxx"
++#include "excelvbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbapivottables.hxx
++++ sc/source/ui/vba/vbapivottables.hxx
+@@ -36,9 +36,9 @@
+ #include <com/sun/star/container/XEnumerationAccess.hpp>
+ #include <com/sun/star/uno/XComponentContext.hpp>
+  
+-#include "vbahelper.hxx"
+-#include "vbahelperinterface.hxx"
+-#include "vbacollectionimpl.hxx"
++#include "excelvbahelper.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaprogressbar.hxx
++++ sc/source/ui/vba/vbaprogressbar.hxx
+@@ -38,7 +38,7 @@
+ #include <ooo/vba/msforms/XProgressBar.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ #include <cppuhelper/implbase2.hxx>
+ 
+ typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty  > ProgressBarImpl_BASE;
+diff --git sc/source/ui/vba/vbapropvalue.hxx sc/source/ui/vba/vbapropvalue.hxx
+index d7ca6ad..cd566e8 100644
+--- sc/source/ui/vba/vbapropvalue.hxx
++++ sc/source/ui/vba/vbapropvalue.hxx
+@@ -32,7 +32,7 @@
+ #include <ooo/vba/XPropValue.hpp>
+ #include <cppuhelper/implbase1.hxx>
+ 
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ 
+ 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
+--- sc/source/ui/vba/vbaradiobutton.hxx
++++ sc/source/ui/vba/vbaradiobutton.hxx
+@@ -31,7 +31,7 @@
+ #define SC_VBA_RADIOBUTTON_HXX
+ #include <ooo/vba/msforms/XRadioButton.hpp>
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbarange.cxx
++++ sc/source/ui/vba/vbarange.cxx
+@@ -27,7 +27,7 @@
+  * for a copy of the LGPLv3 License.
+  *
+  ************************************************************************/
+-#include "helperdecl.hxx"
++#include <oovbaapi/helperdecl.hxx>
+ 
+ #include <comphelper/unwrapargs.hxx>
+ #include <comphelper/processfactory.hxx>
+@@ -159,7 +159,7 @@
+ #include "vbaglobals.hxx"
+ #include "vbastyle.hxx"
+ #include <vector>
+-#include <vbacollectionimpl.hxx>
++#include <oovbaapi/vbacollectionimpl.hxx>
+ // begin test includes
+ #include <com/sun/star/sheet/FunctionArgument.hpp>
+ // end test includes
+@@ -4708,7 +4708,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
+ 		{
+ 			xPrintAreas->setPrintAreas( printAreas );
+ 			uno::Reference< frame::XModel > xModel = pShell->GetModel();
+-			PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, sal_True );
++			PrintOutHelper( getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True );
+ 		}
+ 	}
+ }
+diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
+index f9e4186..4607e54 100644
+--- sc/source/ui/vba/vbarange.hxx
++++ sc/source/ui/vba/vbarange.hxx
+@@ -53,12 +53,15 @@
+ #include <com/sun/star/sheet/XSpreadsheet.hpp>
+ #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
+ 
+-//#include "vbahelperinterface.hxx"
++//#include <oovbaapi/vbahelperinterface.hxx>
+ #include "vbaformat.hxx"
++#include "address.hxx"
++#include "grammar.hxx"
+ 
+ class ScTableSheetsObj;
+ class ScCellRangesBase;
+ class ScCellRangeObj;
++class ScDocShell;
+ 
+ //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
+--- sc/source/ui/vba/vbascrollbar.hxx
++++ sc/source/ui/vba/vbascrollbar.hxx
+@@ -38,7 +38,7 @@
+ #include <ooo/vba/msforms/XScrollBar.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaseriescollection.hxx
++++ sc/source/ui/vba/vbaseriescollection.hxx
+@@ -31,9 +31,9 @@
+ #define SC_VBA_SERIESCOLLECTION_HXX
+ 
+ #include <ooo/vba/excel/XSeriesCollection.hpp>
+-#include "vbahelperinterface.hxx"
+-#include "vbacollectionimpl.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbashape.hxx
++++ sc/source/ui/vba/vbashape.hxx
+@@ -39,7 +39,7 @@
+ #include <ooo/vba/msforms/XLineFormat.hpp>
+ #include <cppuhelper/implbase2.hxx>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ 
+ typedef  ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
+ 
+diff --git sc/source/ui/vba/vbashaperange.cxx sc/source/ui/vba/vbashaperange.cxx
+index 0f3bd8b..8aebaea 100644
+--- sc/source/ui/vba/vbashaperange.cxx
++++ sc/source/ui/vba/vbashaperange.cxx
+@@ -30,6 +30,7 @@
+ #include <com/sun/star/drawing/XShapeGrouper.hpp>
+ #include <com/sun/star/drawing/XDrawPage.hpp>
+ 
++#include "excelvbahelper.hxx"
+ #include "vbashaperange.hxx"
+ #include "vbashape.hxx"
+ 
+diff --git sc/source/ui/vba/vbashaperange.hxx sc/source/ui/vba/vbashaperange.hxx
+index 8490c5e..4c5bedd 100644
+--- sc/source/ui/vba/vbashaperange.hxx
++++ sc/source/ui/vba/vbashaperange.hxx
+@@ -33,7 +33,7 @@
+ #include <com/sun/star/drawing/XShapes.hpp>
+ #include <ooo/vba/msforms/XShapeRange.hpp>
+ 
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/vbacollectionimpl.hxx>
+ 
+ typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
+ 
+diff --git sc/source/ui/vba/vbashapes.cxx sc/source/ui/vba/vbashapes.cxx
+index e1dfbc3..80c1e8f 100644
+--- sc/source/ui/vba/vbashapes.cxx
++++ sc/source/ui/vba/vbashapes.cxx
+@@ -33,6 +33,7 @@
+ #include <ooo/vba/msforms/XShapeRange.hpp>
+ #include <ooo/vba/office/MsoAutoShapeType.hpp>
+ 
++#include "excelvbahelper.hxx"
+ #include "vbashapes.hxx"
+ #include "vbashape.hxx"
+ #include "vbashaperange.hxx"
+diff --git sc/source/ui/vba/vbashapes.hxx sc/source/ui/vba/vbashapes.hxx
+index 9155b5e..4b1a2de 100644
+--- sc/source/ui/vba/vbashapes.hxx
++++ sc/source/ui/vba/vbashapes.hxx
+@@ -35,9 +35,9 @@
+ #include <com/sun/star/container/XIndexAccess.hpp>
+ #include <ooo/vba/msforms/XShapes.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/vbahelperinterface.hxx>
+ 
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbaspinbutton.hxx
++++ sc/source/ui/vba/vbaspinbutton.hxx
+@@ -38,7 +38,7 @@
+ #include <ooo/vba/msforms/XSpinButton.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ 
+ typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE;
+ 
+diff --git sc/source/ui/vba/vbastyles.cxx sc/source/ui/vba/vbastyles.cxx
+index 253cd8c..2404c5e 100644
+--- sc/source/ui/vba/vbastyles.cxx
++++ sc/source/ui/vba/vbastyles.cxx
+@@ -29,6 +29,7 @@
+  ************************************************************************/
+ #include "vbastyles.hxx"
+ #include "vbastyle.hxx"
++#include <ooo/vba/excel/XRange.hpp>
+ 
+ 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
+--- sc/source/ui/vba/vbastyles.hxx
++++ sc/source/ui/vba/vbastyles.hxx
+@@ -31,7 +31,7 @@
+ #define SC_VBA_STYLES_HXX
+ #include <ooo/vba/excel/XStyles.hpp>
+ #include <com/sun/star/container/XNameContainer.hpp>
+-#include "vbacollectionimpl.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbatextbox.hxx
++++ sc/source/ui/vba/vbatextbox.hxx
+@@ -32,7 +32,7 @@
+ #include <cppuhelper/implbase1.hxx>
+ #include <ooo/vba/msforms/XTextBox.hpp>
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/vbahelper.hxx>
+ 
+ typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
+ 
+diff --git sc/source/ui/vba/vbatextboxshape.hxx sc/source/ui/vba/vbatextboxshape.hxx
+index 8a3b62b..c923329 100644
+--- sc/source/ui/vba/vbatextboxshape.hxx
++++ sc/source/ui/vba/vbatextboxshape.hxx
+@@ -38,7 +38,7 @@
+ #include <com/sun/star/text/XTextRange.hpp>
+ #include <ooo/vba/msforms/XTextBoxShape.hpp>
+ #include "vbashape.hxx"
+-#include "vbahelper.hxx"
++#include "excelvbahelper.hxx"
+ #include "vbacharacters.hxx"
+ 
+ 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
+--- sc/source/ui/vba/vbatextframe.hxx
++++ sc/source/ui/vba/vbatextframe.hxx
+@@ -34,7 +34,7 @@
+ #include <ooo/vba/excel/XCharacters.hpp>
+ #include <ooo/vba/excel/XTextFrame.hpp>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbatitle.hxx
++++ sc/source/ui/vba/vbatitle.hxx
+@@ -30,8 +30,8 @@
+ #ifndef SC_VBA_TITLE_HXX
+ #define SC_VBA_TITLE_HXX
+ 
+-#include "vbahelperinterface.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbatogglebutton.hxx
++++ sc/source/ui/vba/vbatogglebutton.hxx
+@@ -38,7 +38,7 @@
+ #include <ooo/vba/msforms/XToggleButton.hpp>
+ 
+ #include "vbacontrol.hxx"
+-#include "vbahelper.hxx"
++#include <oovbaapi/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
+--- sc/source/ui/vba/vbauserform.cxx
++++ sc/source/ui/vba/vbauserform.cxx
+@@ -32,7 +32,7 @@
+  *    MA  02111-1307  USA
+  *
+  ************************************************************************/
+-#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
+ 
+-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..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>
+ 
+-#include "vbahelperinterface.hxx"
++#include <oovbaapi/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..cd639eb 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 <oovbaapi/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..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.
+  *
+  ************************************************************************/
+-#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 );
+ }
+ 
+ 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..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 "vbahelperinterface.hxx"
++#include <oovbaapi/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..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
+ 
++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
++
++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 >
++{
++    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; }
++
++};
++
+ /******************************************************************************
+  *
+  ******************************************************************************/
+@@ -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 :
++		{
++			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
+ 
+ #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);
++            }
 +
-+SwVbaGlobals::~SwVbaGlobals()
-+{
-+	OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
-+}
++            StoreMacroCmds();
 +
-+// 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);
++            maTracer.LeaveEnvironment(sw::log::eMacros);
++        }
+         ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
 +
-+	if ( !xGlobals.is() )
-+	{
-+		throw uno::RuntimeException(
-+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ),
-+                    uno::Reference< XInterface >() );
-+	}
-+	return xGlobals;
-+}
+     }
+ 
+     ::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.
++#
++#*************************************************************************
 +
-+// =============================================================================
-+// XGlobals
-+// =============================================================================
-+uno::Reference<word::XApplication >
-+SwVbaGlobals::getApplication() throw (uno::RuntimeException)
-+{
-+	OSL_TRACE("In SwVbaGlobals::getApplication");	
-+    return mxApplication;
-+}
++PRJ=..$/..$/..
 +
-+::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;
-+}
++PRJNAME=sw
++TARGET=vbaswobj
++ENABLE_EXCEPTIONS=TRUE
 +
-+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" );
-+}
++# --- Settings -----------------------------------------------------
 +
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
-new file mode 100644
-index 0000000..e3ec3d8
---- /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 :  settings.mk
++DLLPRE =
 +
-+#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>
++.IF "$(ENABLE_VBA)"!="YES"
++dummy:
++        @echo "not building vba..."
++.ENDIF
++ 
++INCPRE=$(INCCOM)$/$(TARGET)
++CDEFS+=-DVBA_OOBUILD_HACK
++# ------------------------------------------------------------------
 +
-+#include <cppuhelper/implbase1.hxx>
-+#include "vbahelper.hxx"
++SLOFILES= \
++		$(SLO)$/vbaglobals.obj \
++		$(SLO)$/vbaapplication.obj \
++				$(SLO)$/service.obj \
 +
-+    // =============================================================================
-+    // class SwVbaGlobals
-+    // =============================================================================
++# --- Targets ------------------------------------------------------
 +
-+    typedef ::cppu::WeakImplHelper1<    
-+        ooo::vba::word::XGlobals > SwVbaGlobals_BASE;
++.INCLUDE :	target.mk
 +
++ALLTAR : \
++        $(MISC)$/$(TARGET).don \
 +
-+    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();
++$(SLOFILES) : $(MISC)$/$(TARGET).don
 +
-+		static 	css::uno::Reference< ooo::vba::word::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException);
++$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
++        +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
++        echo $@
 +
-+        // 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/source/ui/vba/vbahelper.cxx sw/source/ui/vba/vbahelper.cxx
+diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
 new file mode 100644
-index 0000000..8e448ce
+index 0000000..c3dc180
 --- /dev/null
-+++ sw/source/ui/vba/vbahelper.cxx
-@@ -0,0 +1,482 @@
++++ sw/source/ui/vba/service.cxx
+@@ -0,0 +1,96 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1667,8 +10305,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbahelper.cxx,v $
-+ * $Revision: 1.5 $
++ * $RCSfile: service.cxx,v $
++ * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -1688,465 +10326,185 @@
 + * 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 <docuno.hxx>
-+
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <rtl/math.hxx>
++#include "cppuhelper/implementationentry.hxx"
++#include "com/sun/star/lang/XMultiServiceFactory.hpp"
++#include "com/sun/star/registry/XRegistryKey.hpp"
++#include "comphelper/servicedecl.hxx"
 +
-+#include <math.h>
-+#include "vbahelper.hxx"
-+#include "tabvwsh.hxx"
-+#include "transobj.hxx"
-+#include "scmod.hxx"
-+#include "vbashape.hxx"
-+#include "unonames.hxx"
++// =============================================================================
++// component exports
++// =============================================================================
 +using namespace ::com::sun::star;
-+using namespace ::ooo;
-+
-+#define POINTTO100THMILLIMETERFACTOR 35.27778
-+void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
-+
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
-+
-+
-+namespace ooo
-+{
-+namespace vba
-+{
-+
-+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;
-+}
-+
-+ 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 );
-+}
-+
-+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;
-+}
++using namespace ::com::sun::star::uno;
 +
++namespace sdecl = comphelper::service_decl;
 +
-+rtl::OUString 
-+ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >&  _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
++namespace globals
 +{
-+	return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
++extern sdecl::ServiceDecl const serviceDecl;
 +}
 +
-+rtl::OUString 
-+ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
++extern "C"
 +{
-+	sal_Int32 a = _nStartSuffix;
-+	rtl::OUString scompname = _sElementName;
-+	bool bElementexists = true;
-+	sal_Int32 nLen = _slist.getLength();
-+	if ( nLen == 0 )
-+		return _sElementName;
++    void SAL_CALL component_getImplementationEnvironment( 
++        const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
++    {
++		OSL_TRACE("In component_getImplementationEnv");
++        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++    }
 +
-+	while (bElementexists == true) 
-+	{
-+		for (sal_Int32 i = 0; i < nLen; i++)
++    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 ) )
 +		{
-+			if (FieldInList(_slist, scompname) == -1)
++			// Singleton registration
++			try
 +			{
-+				return scompname;
++				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
 +			}
 +		}
-+		scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
-+	}
-+	return rtl::OUString();
++		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>
 +
-+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));
-+}
++#include "vbaapplication.hxx"
++#include <osl/file.hxx>
 +
-+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();
++using namespace ::ooo;
++using namespace ::com::sun::star;
 +
-+	int seenright = 0;
-+	if ( bForLike )
-+		sResult.append(static_cast<sal_Unicode>('^'));
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::uno::UNO_QUERY_THROW;
++using ::com::sun::star::uno::UNO_QUERY;
++using ::rtl::OUString;
 +
-+	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++);
-+		}
-+	}
++// 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 )
 +
-+	if ( bForLike )
-+		sResult.append(static_cast<sal_Unicode>('$'));
++#define OWN_JOIN 1
 +
-+	return sResult.makeStringAndClear( );
++// #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");
 +}
 +
-+double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
++SwVbaApplication::~SwVbaApplication()
 +{
-+	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)
++void SAL_CALL
++SwVbaApplication::DoEvents() throw ( uno::RuntimeException )
 +{
-+	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-+	return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
 +}
-+double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
++
++rtl::OUString& 
++SwVbaApplication::getServiceImplName()
 +{
-+	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-+	return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
++	return sImplName;
 +}
 +
-+ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
++rtl::OUString SAL_CALL
++SwVbaApplication::getName() throw (uno::RuntimeException)
 +{
-+	m_xShape = new ScVbaShape( xContext, xShape );
++        static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
++        return appName;
 +}
 +
-+#define VBA_LEFT "PositionX"
-+#define VBA_TOP "PositionY"
-+UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
++uno::Sequence< rtl::OUString > 
++SwVbaApplication::getServiceNames()
 +{
-+    mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
++	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;
 +}
-+    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( 	SC_UNONAME_CELLHGT ) ) ) >>= nHeight;	
-+	return Millimeter::getInPoints( nHeight );
-+    }
-+    void UserFormGeometryHelper::setHeight( double nHeight )
-+    {
-+	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
-+    }
-+    double UserFormGeometryHelper::getWidth()
-+    {
-+	sal_Int32 nWidth = 0;
-+	mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	SC_UNONAME_CELLWID ) ) ) >>= nWidth;	
-+	return Millimeter::getInPoints( nWidth );
-+    }
-+    void UserFormGeometryHelper::setWidth( double nWidth)
-+    {
-+	mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 	SC_UNONAME_CELLWID ) ), uno::makeAny(  Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
-+    }
-+} // vba 
-+} //ooo
-diff --git sw/source/ui/vba/vbahelper.hxx sw/source/ui/vba/vbahelper.hxx
+diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
 new file mode 100644
-index 0000000..51ffb2f
+index 0000000..7c262a3
 --- /dev/null
-+++ sw/source/ui/vba/vbahelper.hxx
-@@ -0,0 +1,331 @@
++++ sw/source/ui/vba/vbaapplication.hxx
+@@ -0,0 +1,58 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -2155,8 +10513,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbahelper.hxx,v $
-+ * $Revision: 1.5 $
++ * $RCSfile: vbaapplication.hxx,v $
++ * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -2176,314 +10534,156 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef SW_VBA_HELPER_HXX
-+#define SW_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>
++#ifndef SW_VBA_APPLICATION_HXX
++#define SW_VBA_APPLICATION_HXX
 +
-+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;
-+		}
-+		css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
-+		css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
++#include <ooo/vba/word/XApplication.hpp>
 +
-+		css::uno::Reference< css::frame::XModel >
-+			getCurrentDocument() throw (css::uno::RuntimeException);
-+		sal_Int32 OORGBToXLRGB( sal_Int32 );
-+		sal_Int32 XLRGBToOORGB( sal_Int32 );
-+		css::uno::Any OORGBToXLRGB( const css::uno::Any& );
-+		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
-+		const css::uno::Any& aNULL();
++#include <oovbaapi/vbahelperinterface.hxx>
 +
-+		rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
-+		rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
-+	double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
-+	double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-+	double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
++typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
 +
-+class Millimeter
++class SwVbaApplication : public SwVbaApplication_BASE
 +{
-+//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 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 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 );
-+    }
++	SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
++	virtual ~SwVbaApplication();
 +
-+   
-+};
-+#define VBA_LEFT "PositionX"
-+#define VBA_TOP "PositionY"
-+class UserFormGeometryHelper : public AbstractGeometryAttributes
-+{
++	// XHelperInterface ( parent is itself )
++	virtual css::uno::Reference< ooo::vba::XHelperInterface > SAL_CALL getParent(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
 +
-+    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);
++	// 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"
 +
-+class 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);
-+    	}
-+
++#include <comphelper/unwrapargs.hxx>
 +
-+    	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);
-+    	}
++#include <com/sun/star/lang/XMultiComponentFactory.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
 +
-+	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);
-+	}
++#include <cppuhelper/bootstrap.hxx>
++#include "vbaapplication.hxx"
++using namespace ::com::sun::star;
++using namespace ::com::sun::star::uno;
++using namespace ::ooo::vba;
 +
-+    
-+	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);
-+	}
-+    
-+};
++// =============================================================================
++// SwVbaGlobals
++// =============================================================================
 +
-+class ContainerUtilities
++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) );
++}
 +
-+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 );
-+};
++SwVbaGlobals::~SwVbaGlobals()
++{
++	OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
++}
 +
-+// really just a a place holder to ease the porting pain
-+class DebugHelper
++// Will throw if singleton can't be accessed 
++uno::Reference< word::XGlobals >
++SwVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException )
 +{
-+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() );
-+	}
++	uno::Reference< XGlobals > xGlobals( 
++		xContext->getValueByName( ::rtl::OUString::createFromAscii( 
++			"/singletons/ooo.vba.word.theGlobals") ), uno::UNO_QUERY);
 +
-+	static void exception( int err,  const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
++	if ( !xGlobals.is() )
 +	{
-+		exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
++		throw uno::RuntimeException(
++                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ),
++                    uno::Reference< XInterface >() );
 +	}
++	return xGlobals;
++}
 +
-+	static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
-+	{
-+		exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
-+	}
-+};
-+	} // vba 
-+} // ooo
++// =============================================================================
++// XGlobals
++// =============================================================================
++uno::Reference<word::XApplication >
++SwVbaGlobals::getApplication() throw (uno::RuntimeException)
++{
++	OSL_TRACE("In SwVbaGlobals::getApplication");	
++    return mxApplication;
++}
 +
-+namespace ov = ooo::vba;
++::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;
++}
 +
-+#ifdef DEBUG
-+#  define SW_VBA_FIXME(a) OSL_TRACE( a )
-+#  define SW_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ ))
-+#else
-+#  define SW_VBA_FIXME(a)
-+#  define SW_VBA_STUB()
-+#endif
++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" );
++}
 +
-+#endif
-diff --git sw/source/ui/vba/vbahelperinterface.hxx sw/source/ui/vba/vbahelperinterface.hxx
+diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
 new file mode 100644
-index 0000000..644c390
+index 0000000..7ac3fe9
 --- /dev/null
-+++ sw/source/ui/vba/vbahelperinterface.hxx
-@@ -0,0 +1,116 @@
++++ sw/source/ui/vba/vbaglobals.hxx
+@@ -0,0 +1,69 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -2492,8 +10692,8 @@
 + *
 + * OpenOffice.org - a multi-platform office productivity suite
 + *
-+ * $RCSfile: vbahelperinterface.hxx,v $
-+ * $Revision: 1.3 $
++ * $RCSfile: vbaglobals.hxx,v $
++ * $Revision: 1.4 $
 + *
 + * This file is part of OpenOffice.org.
 + *
@@ -2513,93 +10713,46 @@
 + * for a copy of the LGPLv3 License.
 + *
 + ************************************************************************/
-+#ifndef SW_VBA_HELPERINTERFACE_HXX
-+#define SW_VBA_HELPERINTERFACE_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include "vbahelper.hxx"
-+#include "vbaglobals.hxx"
++#ifndef SW_VBA_GLOBALS_HXX
++#define SW_VBA_GLOBALS_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" ) );
++#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>
 +
-+template< typename Ifc1 >
-+class InheritedHelperInterfaceImpl : public Ifc1
-+{
-+protected: 
-+	css::uno::WeakReference< ooo::vba::XHelperInterface > mxParent;
-+	css::uno::Reference< css::uno::XComponentContext > mxContext;
-+public:
-+	InheritedHelperInterfaceImpl() {}
-+	InheritedHelperInterfaceImpl( const css::uno::Reference< ooo::vba::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;
++#include <cppuhelper/implbase1.hxx>
++#include <oovbaapi/vbahelper.hxx>
 +
-+	// XHelperInterface Methods
-+	virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+	{
-+		return 0x53756E4F;
-+	}
-+	virtual css::uno::Reference< ooo::vba::XHelperInterface > SAL_CALL getParent(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; }
-+	// #FIXME	
-+	virtual css::uno::Any SAL_CALL Application(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return  css::uno::Any(); }
++    // =============================================================================
++    // class SwVbaGlobals
++    // =============================================================================
 +
++    typedef ::cppu::WeakImplHelper1<    
++        ooo::vba::word::XGlobals > SwVbaGlobals_BASE;
 +
-+	// 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 > >
++    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();
 +
-+{
-+typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
-+public:
-+	InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}	
++		static 	css::uno::Reference< ooo::vba::word::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException);
 +
-+};
-+#endif
++        // 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



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