summaryrefslogtreecommitdiff
path: root/vbahelper/inc
diff options
context:
space:
mode:
Diffstat (limited to 'vbahelper/inc')
-rw-r--r--vbahelper/inc/vbahelper/helperdecl.hxx55
-rw-r--r--vbahelper/inc/vbahelper/vbaaccesshelper.hxx79
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx75
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx347
-rw-r--r--vbahelper/inc/vbahelper/vbadialogbase.hxx51
-rw-r--r--vbahelper/inc/vbahelper/vbadialogsbase.hxx51
-rw-r--r--vbahelper/inc/vbahelper/vbadllapi.h41
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx71
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentsbase.hxx66
-rwxr-xr-xvbahelper/inc/vbahelper/vbaeventshelperbase.hxx162
-rw-r--r--vbahelper/inc/vbahelper/vbafontbase.hxx103
-rw-r--r--vbahelper/inc/vbahelper/vbaglobalbase.hxx50
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx248
-rw-r--r--vbahelper/inc/vbahelper/vbahelperinterface.hxx193
-rw-r--r--vbahelper/inc/vbahelper/vbapagesetupbase.hxx67
-rw-r--r--vbahelper/inc/vbahelper/vbapropvalue.hxx57
-rw-r--r--vbahelper/inc/vbahelper/vbashape.hxx115
-rw-r--r--vbahelper/inc/vbahelper/vbashaperange.hxx86
-rw-r--r--vbahelper/inc/vbahelper/vbashapes.hxx81
-rw-r--r--vbahelper/inc/vbahelper/vbatextframe.hxx67
-rw-r--r--vbahelper/inc/vbahelper/vbawindowbase.hxx63
21 files changed, 2128 insertions, 0 deletions
diff --git a/vbahelper/inc/vbahelper/helperdecl.hxx b/vbahelper/inc/vbahelper/helperdecl.hxx
new file mode 100644
index 000000000000..0b51c6242226
--- /dev/null
+++ b/vbahelper/inc/vbahelper/helperdecl.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef OOVBAAPI_SERV_DECL
+#define OOVBAAPI_SERV_DECL
+#include <comphelper/servicedecl.hxx>
+#include <ooo/vba/XHelperInterface.hpp>
+
+namespace comphelper {
+namespace service_decl {
+template <typename ImplT_, typename WithArgsT = with_args<false> >
+struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT >
+{
+ typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT;
+ /** Default ctor. Implementation class without args, expecting
+ component context as single argument.
+ */
+ vba_service_class_() : baseT() {}
+ template <typename PostProcessFuncT>
+ /** Ctor to pass a post processing function/functor.
+
+ @tpl PostProcessDefaultT let your compiler deduce this
+ @param postProcessFunc function/functor that gets the yet unacquired
+ ImplT_ pointer returning a
+ uno::Reference<uno::XInterface>
+ */
+ explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
+};
+
+} // namespace service_decl
+} // namespace comphelper
+#endif
diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
new file mode 100644
index 000000000000..79bb44ce30a4
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: vbahelper.hxx,v $
+ * $Revision: 1.5.32.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef OOVBAAPI_VBA_ACCESS_HELPER_HXX
+#define OOVBAAPI_VBA_ACCESS_HELPER_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <basic/basmgr.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#define VBAHELPER_DLLIMPLEMENTATION
+#include <vbahelper/vbadllapi.h>
+#include <memory>
+namespace css = ::com::sun::star;
+namespace ooo
+{
+ namespace vba
+ {
+
+ VBAHELPER_DLLPRIVATE inline css::uno::Reference< css::lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell )
+ {
+ css::uno::Any aUnoVar;
+ if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
+ throw css::lang::IllegalArgumentException();
+ css::uno::Reference< css::lang::XMultiServiceFactory > xVBAFactory( aUnoVar, css::uno::UNO_QUERY_THROW );
+ return xVBAFactory;
+ }
+
+ VBAHELPER_DLLPUBLIC inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException)
+ {
+ OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ css::uno::Reference< css::uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
+ return xIf;
+ }
+
+
+ VBAHELPER_DLLPRIVATE inline bool isAlienDoc( SfxObjectShell& rDocShell, const char* pMimeType )
+ {
+ bool bRes( false );
+ const SfxFilter *pFilt = rDocShell.GetMedium()->GetFilter();
+ if ( pFilt && pFilt->IsAlienFormat() )
+ bRes = ( pFilt->GetMimeType().CompareToAscii( pMimeType ) == 0 );
+ return bRes;
+ }
+ VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
+ VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
+
+ } // openoffice
+} // org
+
+#endif
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
new file mode 100644
index 000000000000..6902bc7b5042
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_APPLICATION_BASE_HXX
+#define VBA_APPLICATION_BASE_HXX
+
+#include <ooo/vba/XHelperInterface.hpp>
+#include <ooo/vba/XApplicationBase.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <sfx2/objsh.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE;
+
+struct VbaApplicationBase_Impl;
+
+class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE
+{
+ VbaApplicationBase_Impl* m_pImpl;
+
+protected:
+ VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~VbaApplicationBase();
+
+ virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException) = 0;
+public:
+ // XHelperInterface ( parent is itself )
+ virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
+
+ virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getInteractive() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setInteractive( ::sal_Bool bInteractive ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( ::sal_Bool bVisible ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBProjects() throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Undo() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Quit() throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif
diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
new file mode 100644
index 000000000000..5bd58b44adaf
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -0,0 +1,347 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
+#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
+
+#include <ooo/vba/XCollection.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/script/XDefaultMethod.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include "vbahelper/vbahelper.hxx"
+#include "vbahelper/vbahelperinterface.hxx"
+
+#include <vector>
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
+
+// ============================================================================
+
+/** A wrapper that holds a com.sun.star.container.XIndexAccess and provides a
+ com.sun.star.container.XEnumeration.
+
+ Can be used to provide an enumeration from an index container that contains
+ completely constructed/initialized VBA implementation objects. CANNOT be
+ used to provide an enumeration from an index container with other objects
+ (e.g. UNO objects) where construction of the VBA objects is needed first.
+ */
+class VBAHELPER_DLLPUBLIC SimpleIndexAccessToEnumeration : public EnumerationHelper_BASE
+{
+public:
+ explicit SimpleIndexAccessToEnumeration(
+ const css::uno::Reference< css::container::XIndexAccess >& rxIndexAccess ) throw (css::uno::RuntimeException) :
+ mxIndexAccess( rxIndexAccess ), mnIndex( 0 ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException)
+ {
+ return mnIndex < mxIndexAccess->getCount();
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {
+ if( !hasMoreElements() )
+ throw css::container::NoSuchElementException();
+ return mxIndexAccess->getByIndex( mnIndex++ );
+ }
+
+private:
+ css::uno::Reference< css::container::XIndexAccess > mxIndexAccess;
+ sal_Int32 mnIndex;
+};
+
+// ============================================================================
+
+/** A wrapper that holds a com.sun.star.container.XEnumeration or a
+ com.sun.star.container.XIndexAccess and provides an enumeration of VBA objects.
+
+ The method nextElement() needs to be implemented by the derived class. This
+ class can be used to convert an enumeration or an index container
+ containing UNO objects to an enumeration providing the related VBA objects.
+ */
+class VBAHELPER_DLLPUBLIC SimpleEnumerationBase : public EnumerationHelper_BASE
+{
+public:
+ explicit SimpleEnumerationBase(
+ const css::uno::Reference< ov::XHelperInterface >& rxParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::container::XEnumeration >& rxEnumeration ) throw (css::uno::RuntimeException) :
+ mxParent( rxParent ), mxContext( rxContext ), mxEnumeration( rxEnumeration ) {}
+
+ explicit SimpleEnumerationBase(
+ const css::uno::Reference< ov::XHelperInterface >& rxParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::container::XIndexAccess >& rxIndexAccess ) throw (css::uno::RuntimeException) :
+ mxParent( rxParent ), mxContext( rxContext ), mxEnumeration( new SimpleIndexAccessToEnumeration( rxIndexAccess ) ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException)
+ {
+ return mxEnumeration->hasMoreElements();
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {
+ return createCollectionObject( mxEnumeration->nextElement() );
+ }
+
+ /** Derived classes implement creation of a VBA implementation object from
+ the passed container element. */
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource ) = 0;
+
+protected:
+ css::uno::Reference< ov::XHelperInterface > mxParent;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::container::XEnumeration > mxEnumeration;
+};
+
+// ============================================================================
+
+// deprecated, use SimpleEnumerationBase instead!
+class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
+{
+protected:
+ css::uno::WeakReference< ov::XHelperInterface > m_xParent;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
+public:
+
+ EnumerationHelperImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xParent( xParent ), 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 VBAHELPER_DLLPUBLIC 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 ) );
+ }
+
+ virtual void UpdateCollectionIndex( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess )
+ {
+ css::uno::Reference< css::container::XNameAccess > xNameAccess( xIndexAccess, css::uno::UNO_QUERY_THROW );
+ m_xIndexAccess = xIndexAccess;
+ m_xNameAccess = xNameAccess;
+ }
+
+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 VBAHELPER_DLLPUBLIC 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 VBAHELPER_DLLPUBLIC 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 a/vbahelper/inc/vbahelper/vbadialogbase.hxx b/vbahelper/inc/vbahelper/vbadialogbase.hxx
new file mode 100644
index 000000000000..79c3fa551073
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_DIALOG_BASE_HXX
+#define VBA_DIALOG_BASE_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/XDialogBase.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ov::XDialogBase > VbaDialogBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDialogBase : public VbaDialogBase_BASE
+{
+protected:
+ sal_Int32 mnIndex;
+ css::uno::Reference< css::frame::XModel > m_xModel;
+public:
+ VbaDialogBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nIndex ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ), m_xModel( xModel ) {}
+ virtual ~VbaDialogBase() {}
+
+ // Methods
+ virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0;
+};
+
+#endif /* VBA_DIALOG_BASE_HXX */
diff --git a/vbahelper/inc/vbahelper/vbadialogsbase.hxx b/vbahelper/inc/vbahelper/vbadialogsbase.hxx
new file mode 100644
index 000000000000..408a156ac3bc
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbadialogsbase.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_DIALOGS_BASE_HXX
+#define VBA_DIALOGS_BASE_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <ooo/vba/XDialogsBase.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ov::XDialogsBase > VbaDialogsBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDialogsBase : public VbaDialogsBase_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+public:
+ VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): VbaDialogsBase_BASE( xParent, xContext ), m_xModel( xModel ) {}
+ virtual ~VbaDialogsBase() {}
+
+ // XCollection
+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
+};
+
+#endif /* VBA_DIALOGS_BASE_HXX */
diff --git a/vbahelper/inc/vbahelper/vbadllapi.h b/vbahelper/inc/vbahelper/vbadllapi.h
new file mode 100644
index 000000000000..1768802c5176
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbadllapi.h
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_VBADLLAPI_H
+#define INCLUDED_VBADLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(VBAHELPER_DLLIMPLEMENTATION)
+#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SVLDLLAPI_H */
+
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
new file mode 100644
index 000000000000..2588b7da1720
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_DOCUMENTBASE_HXX
+#define VBA_DOCUMENTBASE_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <ooo/vba/XDocumentBase.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentBase > VbaDocumentBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+protected:
+ virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
+ VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
+public:
+ VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ css::uno::Reference< css::frame::XModel > xModel );
+ VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
+ virtual ~VbaDocumentBase() {}
+
+ // Attributes
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBProject() throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
+ const css::uno::Any &aFileName,
+ const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* VBA_DOCUMENTBASE_HXX */
diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx
new file mode 100644
index 000000000000..36bc0a4963ee
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_WORKBOOKS_HXX
+#define VBA_WORKBOOKS_HXX
+
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/XDocumentsBase.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+
+typedef CollTestImplHelper< ooo::vba::XDocumentsBase > VbaDocumentsBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaDocumentsBase : public VbaDocumentsBase_BASE
+{
+public:
+ enum DOCUMENT_TYPE
+ {
+ WORD_DOCUMENT = 1,
+ EXCEL_DOCUMENT
+ };
+
+private:
+ DOCUMENT_TYPE meDocType;
+
+public:
+ VbaDocumentsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (css::uno::RuntimeException);
+ virtual ~VbaDocumentsBase() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;
+
+ // VbaDocumentsBase_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
+
+ // XDocumentsBase
+ virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException);
+};
+
+#endif /* SC_VBA_WORKBOOKS_HXX */
diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
new file mode 100755
index 000000000000..89d355db71f9
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBAHELPER_VBAEVENTSHELPERBASE_HXX
+#define VBAHELPER_VBAEVENTSHELPERBASE_HXX
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <map>
+#include <deque>
+#include "vbahelper/vbahelper.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+} } }
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2< css::script::vba::XVBAEventProcessor, css::lang::XEventListener > VbaEventsHelperBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase : public VbaEventsHelperBase_BASE
+{
+public:
+ VbaEventsHelperBase(
+ const css::uno::Sequence< css::uno::Any >& rArgs,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~VbaEventsHelperBase();
+
+ // XVBAEventProcessor
+ virtual sal_Bool SAL_CALL hasVbaEventHandler( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ virtual void SAL_CALL processVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::script::provider::ScriptFrameworkErrorException, css::util::VetoException, css::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException);
+
+protected:
+ // ------------------------------------------------------------------------
+
+ enum EventHandlerType { EVENTHANDLER_GLOBAL, EVENTHANDLER_DOCUMENT };
+ struct EventHandlerInfo
+ {
+ sal_Int32 mnEventId;
+ ::rtl::OUString maMacroName;
+ EventHandlerType meType;
+ sal_Int32 mnCancelIndex;
+ css::uno::Any maUserData;
+ };
+
+ /** Registers a supported event handler.
+
+ @param nEventId Event identifier from com.sun.star.script.vba.EventIdentifier.
+ @param pcMacroName Name of the associated VBA event handler macro.
+ @param eType Document event or global event.
+ @param nCancelIndex 0-based index of Cancel parameter, or -1.
+ @param rUserData User data for free usage in derived implementations. */
+ void registerEventHandler(
+ sal_Int32 nEventId,
+ const sal_Char* pcMacroName,
+ EventHandlerType eType = EVENTHANDLER_DOCUMENT,
+ sal_Int32 nCancelIndex = -1,
+ const css::uno::Any& rUserData = css::uno::Any() );
+
+ /** Throws, if the passed sequence does not contain a value at the specified index. */
+ static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); }
+
+ /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */
+ template< typename Type >
+ static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); }
+
+ // ------------------------------------------------------------------------
+
+ struct EventQueueEntry
+ {
+ sal_Int32 mnEventId;
+ css::uno::Sequence< css::uno::Any > maArgs;
+ inline /*implicit*/ EventQueueEntry( sal_Int32 nEventId ) : mnEventId( nEventId ) {}
+ inline EventQueueEntry( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) : mnEventId( nEventId ), maArgs( rArgs ) {}
+ };
+ typedef ::std::deque< EventQueueEntry > EventQueue;
+
+ /** Derived classes return whether event processing is enabled. Throws if
+ the instance is in an invalid state. */
+ virtual bool implEventsEnabled() throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes do additional prpeparations and return whether the
+ event handler has to be called. */
+ virtual bool implPrepareEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes have to return the argument list for the specified VBA event handler. */
+ virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException) = 0;
+
+ /** Derived classes may do additional postprocessing. Called even if the
+ event handler does not exist, or if an error occured during execution. */
+ virtual void implPostProcessEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ bool bSuccess,
+ bool bCancel ) throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes have to return the name of the Basic document module. */
+ virtual ::rtl::OUString implGetDocumentModuleName(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException) = 0;
+
+private:
+ /** Returns the event handler info struct for the specified event, or throws. */
+ const EventHandlerInfo& getEventHandlerInfo( sal_Int32 nEventId ) const throw (css::lang::IllegalArgumentException);
+
+ /** Searches the event handler in the document and returns its full script path. */
+ ::rtl::OUString getEventHandlerPath(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException);
+
+ /** Removes this instance from all broadcasters. */
+ void stopListening();
+
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ SfxObjectShell* mpShell;
+
+private:
+ typedef ::std::map< sal_Int32, EventHandlerInfo > EventHandlerMap;
+
+ EventHandlerMap maEvents;
+ bool mbDisposed;
+};
+
+// ============================================================================
+
+#endif
diff --git a/vbahelper/inc/vbahelper/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx
new file mode 100644
index 000000000000..d1272c9dcf48
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbafontbase.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBAHELPER_FONTBASE_HXX
+#define VBAHELPER_FONTBASE_HXX
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <ooo/vba/XFontBase.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+// use local constants there is no need to expose these constants
+// externally. Looking at the Format->Character dialog it seem that
+// these may infact be even be calculated. Leave hardcoded for now
+// #FIXEME #TBD investigate the code for dialog mentioned above
+
+// The font baseline is not specified.
+const short NORMAL = 0;
+
+// specifies a superscripted.
+const short SUPERSCRIPT = 33;
+
+// specifies a subscripted.
+const short SUBSCRIPT = -33;
+
+// specifies a hight of superscripted font
+ const sal_Int8 SUPERSCRIPTHEIGHT = 58;
+
+// specifies a hight of subscripted font
+const sal_Int8 SUBSCRIPTHEIGHT = 58;
+
+// specifies a hight of normal font
+const short NORMALHEIGHT = 100;
+
+typedef InheritedHelperInterfaceImpl1< ov::XFontBase > VbaFontBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaFontBase : public VbaFontBase_BASE
+{
+protected:
+ css::uno::Reference< css::beans::XPropertySet > mxFont;
+ css::uno::Reference< css::container::XIndexAccess > mxPalette;
+ bool mbFormControl;
+
+public:
+ VbaFontBase(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::container::XIndexAccess >& xPalette,
+ const css::uno::Reference< css::beans::XPropertySet >& xPropertySet,
+ bool bFormControl = false ) throw ( css::uno::RuntimeException );
+ virtual ~VbaFontBase();// {}
+
+ // Attributes
+ virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const css::uno::Any& _size ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBold( const css::uno::Any& _bold ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException) = 0;
+ virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException) = 0;
+ virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getSubscript() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getSuperscript() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const css::uno::Any& _name ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ;
+ virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ;
+};
+
+#endif
+
diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
new file mode 100644
index 000000000000..61aaa1d65657
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_GLOBAL_BASE_HXX
+#define VBA_GLOBAL_BASE_HXX
+
+#include "vbahelperinterface.hxx"
+#include <ooo/vba/XGlobalsBase.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE;
+class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
+{
+protected:
+ rtl::OUString msDocCtxName;
+
+ bool hasServiceName( const rtl::OUString& serviceName );
+ void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
+
+public:
+ VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName );
+ virtual ~VbaGlobalsBase();
+ // XMultiServiceFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException);
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
+};
+#endif
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
new file mode 100644
index 000000000000..ccabb9114f2d
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef OOVBAAPI_VBA_HELPER_HXX
+#define OOVBAAPI_VBA_HELPER_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XIntrospectionAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/script/BasicErrorException.hpp>
+#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
+#include <basic/basmgr.hxx>
+#include <basic/sberrors.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <vcl/pointr.hxx>
+#include <memory>
+#include "vbaaccesshelper.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;
+ }
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell );
+ VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
+
+ css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+
+ VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl );
+ VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps );
+ VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
+ VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
+ VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
+ VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& );
+ VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& );
+ // provide a NULL object that can be passed as variant so that
+ // the object when passed to IsNull will return true. aNULL
+ // contains an empty object reference
+ VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL();
+ VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection );
+ VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* );
+
+ /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value.
+ Returns false, if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC bool extractBoolFromAny( bool& rbValue, const css::uno::Any& rAny );
+ /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value.
+ Throws, if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC bool extractBoolFromAny( const css::uno::Any& rAny ) throw (css::uno::RuntimeException);
+
+ VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
+ VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
+ VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC sal_Int32 PointsToHmm( double fPoints );
+ VBAHELPER_DLLPUBLIC double HmmToPoints( sal_Int32 nHmm );
+ VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
+ VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
+ VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
+ VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
+ VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
+
+class VBAHELPER_DLLPUBLIC Millimeter
+{
+//Factor to translate between points and hundredths of millimeters:
+private:
+ double m_nMillimeter;
+
+public:
+ Millimeter();
+
+ Millimeter(double mm);
+
+ void set(double mm);
+ void setInPoints(double points) ;
+ void setInHundredthsOfOneMillimeter(double hmm);
+ double get();
+ double getInHundredthsOfOneMillimeter();
+ double getInPoints();
+ static sal_Int32 getInHundredthsOfOneMillimeter(double points);
+ static double getInPoints(int _hmm);
+};
+
+class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below
+{
+public:
+ virtual ~AbstractGeometryAttributes() {}
+ virtual double getLeft() = 0;
+ virtual void setLeft( double ) = 0;
+ virtual double getTop() = 0;
+ virtual void setTop( double ) = 0;
+ virtual double getHeight() = 0;
+ virtual void setHeight( double ) = 0;
+ virtual double getWidth() = 0;
+ virtual void setWidth( double ) = 0;
+};
+
+namespace msforms {
+ class XShape;
+}
+
+class VBAHELPER_DLLPUBLIC ShapeHelper
+{
+protected:
+ css::uno::Reference< css::drawing::XShape > xShape;
+public:
+ ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
+
+ double getHeight();
+
+ void setHeight(double _fheight) throw ( css::script::BasicErrorException );
+
+ double getWidth();
+
+ void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
+
+ double getLeft();
+
+ void setLeft(double _fLeft);
+
+ double getTop();
+
+ void setTop(double _fTop);
+};
+
+class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
+{
+ std::auto_ptr< ShapeHelper > m_pShapeHelper;
+public:
+ ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
+ 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);
+};
+
+#define VBA_LEFT "PositionX"
+#define VBA_TOP "PositionY"
+#define VBA_HEIGHT "Height"
+#define VBA_WIDTH "Width"
+class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
+{
+ css::uno::Reference< css::awt::XUnitConversion > mxControlUnits;
+ css::uno::Reference< css::beans::XPropertySet > mxModel;
+
+ sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit );
+ sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit );
+
+public:
+ UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
+ virtual double getLeft();
+ virtual void setLeft( double nLeft );
+ virtual double getTop();
+ virtual void setTop( double nTop );
+ virtual double getHeight();
+ virtual void setHeight( double nHeight );
+ virtual double getWidth();
+ virtual void setWidth( double nWidth);
+};
+
+class VBAHELPER_DLLPUBLIC ContainerUtilities
+{
+
+public:
+ static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator);
+ static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix );
+
+ static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
+};
+
+// really just a a place holder to ease the porting pain
+class VBAHELPER_DLLPUBLIC DebugHelper
+{
+public:
+ static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException );
+
+ static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException );
+
+ static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
+};
+ } // 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 a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
new file mode 100644
index 000000000000..b095b5cd2823
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX
+#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <vbahelper/vbahelper.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+// 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 VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl : public Ifc1
+{
+protected:
+ css::uno::WeakReference< ov::XHelperInterface > mxParent;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+public:
+ InheritedHelperInterfaceImpl() {}
+ InheritedHelperInterfaceImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxContext( xContext ) {}
+ 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) {
+ // The application could certainly be passed around in the context - seems
+ // to make sense
+ css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW );
+ return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) );
+ }
+
+ // 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 VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
+public:
+ InheritedHelperInterfaceImpl1< Ifc1 >() {}
+ InheritedHelperInterfaceImpl1< Ifc1 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl1< Ifc1 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+
+template< typename Ifc1, typename Ifc2 >
+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl2 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > > Base;
+public:
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >() {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+
+template< typename Ifc1, typename Ifc2, typename Ifc3 >
+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl3 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > > Base;
+public:
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >() {}
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+
+// ============================================================================
+
+/** Helper macro to implement the method 'getServiceImplName()' of the
+ 'ooo.vba.XHelperInterface' interface. Will return the class name as service
+ implementation name.
+ */
+#define VBAHELPER_IMPL_GETSERVICEIMPLNAME( classname ) \
+::rtl::OUString& classname::getServiceImplName() \
+{ \
+ static ::rtl::OUString saImplName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( #classname ) ); \
+ return saImplName; \
+}
+
+// ----------------------------------------------------------------------------
+
+/** Helper macro to implement the method 'getServiceNames()' for a single
+ service name.
+ */
+#define VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename ) \
+css::uno::Sequence< ::rtl::OUString > classname::getServiceNames() \
+{ \
+ static css::uno::Sequence< ::rtl::OUString > saServiceNames; \
+ if( saServiceNames.getLength() == 0 ) \
+ { \
+ saServiceNames.realloc( 1 ); \
+ saServiceNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( servicename ) ); \
+ } \
+ return saServiceNames; \
+}
+
+// ----------------------------------------------------------------------------
+
+/** Helper macro to declare the methods 'getServiceImplName()' and
+ 'getServiceNames()' of the 'ooo.vba.XHelperInterface' interface in a class
+ declaration.
+ */
+#define VBAHELPER_DECL_XHELPERINTERFACE \
+ virtual ::rtl::OUString& getServiceImplName(); \
+ virtual css::uno::Sequence< ::rtl::OUString > getServiceNames();
+
+// ----------------------------------------------------------------------------
+
+/** Helper macro to implement the methods 'getServiceImplName()' and
+ 'getServiceNames()' of the 'ooo.vba.XHelperInterface' interface. Will
+ return the class name as service implementation name.
+ */
+#define VBAHELPER_IMPL_XHELPERINTERFACE( classname, servicename ) \
+VBAHELPER_IMPL_GETSERVICEIMPLNAME( classname ) \
+VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename )
+
+// ============================================================================
+
+#endif
diff --git a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx
new file mode 100644
index 000000000000..09ad2f91d654
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_PAGESETUPBASE_HXX
+#define VBA_PAGESETUPBASE_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/XPageSetupBase.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::XPageSetupBase > VbaPageSetupBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaPageSetupBase : public VbaPageSetupBase_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::beans::XPropertySet > mxPageProps;
+ sal_Int32 mnOrientLandscape;
+ sal_Int32 mnOrientPortrait;
+
+ VbaPageSetupBase( const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+public:
+ virtual ~VbaPageSetupBase(){}
+
+ // Attribute
+ virtual double SAL_CALL getTopMargin() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTopMargin( double margin ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getBottomMargin() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBottomMargin( double margin ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getRightMargin() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRightMargin( double margin ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getLeftMargin() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLeftMargin( double margin ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getHeaderMargin() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setFooterMargin( double margin ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException);
+};
+#endif
diff --git a/vbahelper/inc/vbahelper/vbapropvalue.hxx b/vbahelper/inc/vbahelper/vbapropvalue.hxx
new file mode 100644
index 000000000000..1efef8f8c05e
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbapropvalue.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SC_VBA_PROPVALULE_HXX
+#define SC_VBA_PROPVALULE_HXX
+#include <ooo/vba/XPropValue.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include <vbahelper/vbahelper.hxx>
+
+typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
+
+class VBAHELPER_DLLPUBLIC PropListener
+{
+public:
+ virtual void setValueEvent( const css::uno::Any& value ) = 0;
+ virtual css::uno::Any getValueEvent() = 0;
+};
+
+
+class VBAHELPER_DLLPUBLIC ScVbaPropValue : public PropValueImpl_BASE
+{
+ PropListener* m_pListener;
+public:
+ ScVbaPropValue( PropListener* pListener );
+
+ // Attributes
+ virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
+
+ rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+
+};
+#endif //SC_VBA_PROPVALULE_HXX
diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx
new file mode 100644
index 000000000000..87c640db203a
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbashape.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_SHAPE_HXX
+#define SC_VBA_SHAPE_HXX
+
+#include <ooo/vba/office/MsoShapeType.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <ooo/vba/msforms/XShape.hpp>
+#include <ooo/vba/msforms/XLineFormat.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
+
+typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
+
+class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE
+{
+private:
+protected:
+ std::auto_ptr< ov::ShapeHelper > m_pShapeHelper;
+ css::uno::Reference< css::drawing::XShape > m_xShape;
+ css::uno::Reference< css::drawing::XShapes > m_xShapes;
+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
+ sal_Int32 m_nType;
+ css::uno::Reference< css::frame::XModel > m_xModel;
+ css::uno::Any m_aRange;
+ virtual void addListeners();
+ virtual void removeShapeListener() throw( css::uno::RuntimeException );
+ virtual void removeShapesListener() throw( css::uno::RuntimeException );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+public:
+ ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException );
+ ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::lang::IllegalArgumentException );
+ virtual ~ScVbaShape();
+ css::uno::Any getRange() { return m_aRange; };
+ void setRange( css::uno::Any aRange ) { m_aRange = aRange; };
+
+ static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException);
+
+ // Attributes
+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
+ virtual 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 sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException);
+ // Replace??
+ virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
+};
+#endif//SC_VBA_SHAPE_HXX
diff --git a/vbahelper/inc/vbahelper/vbashaperange.hxx b/vbahelper/inc/vbahelper/vbashaperange.hxx
new file mode 100644
index 000000000000..a4cc35958ef2
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbashaperange.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_SHAPERANGE_HXX
+#define SC_VBA_SHAPERANGE_HXX
+
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <ooo/vba/msforms/XShapeRange.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/msforms/XLineFormat.hpp>
+#include <ooo/vba/msforms/XFillFormat.hpp>
+
+typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
+
+class VBAHELPER_DLLPUBLIC ScVbaShapeRange : public ScVbaShapeRange_BASE
+{
+private:
+ css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
+ css::uno::Reference< css::drawing::XShapes > m_xShapes;
+ sal_Int32 m_nShapeGroupCount;
+protected:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+ css::uno::Reference< css::drawing::XShapes > getShapes() throw (css::uno::RuntimeException) ;
+public:
+ ScVbaShapeRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape, const css::uno::Reference< css::frame::XModel >& xModel );
+
+ // Methods
+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ::ooo::vba::msforms::XShape > SAL_CALL Group() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ;
+ virtual void SAL_CALL IncrementTop( double Increment ) 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 css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
+ //XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+};
+
+#endif//SC_VBA_SHAPERANGE_HXX
diff --git a/vbahelper/inc/vbahelper/vbashapes.hxx b/vbahelper/inc/vbahelper/vbashapes.hxx
new file mode 100644
index 000000000000..18e123a9c7f6
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbashapes.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_SHAPES_HXX
+#define SC_VBA_SHAPES_HXX
+
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <ooo/vba/msforms/XShapes.hpp>
+
+#include <vbahelper/vbahelperinterface.hxx>
+
+#include <vbahelper/vbacollectionimpl.hxx>
+
+typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE;
+
+class VBAHELPER_DLLPUBLIC ScVbaShapes : public ScVbaShapes_BASE
+{
+private:
+ css::uno::Reference< css::drawing::XShapes > m_xShapes;
+ css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
+ sal_Int32 m_nNewShapeCount;
+ void initBaseCollection();
+protected:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+ virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
+ css::uno::Reference< css::drawing::XShape > createShape( rtl::OUString service ) throw (css::uno::RuntimeException);
+ css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException);
+ css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException);
+ css::uno::Any AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
+ rtl::OUString createName( rtl::OUString sName );
+ css::uno::Any AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
+ //TODO helperapi using a writer document
+ //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::XHelperInterface > xDocument );
+
+public:
+ ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const css::uno::Reference< css::frame::XModel >& xModel );
+ static void setDefaultShapeProperties( css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException);
+ static void setShape_NameProperty( css::uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName );
+ //XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL SelectAll() throw (css::uno::RuntimeException);
+ //helper::calc
+ virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) throw (css::uno::RuntimeException);
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException);
+};
+
+#endif//SC_VBA_SHAPES_HXX
diff --git a/vbahelper/inc/vbahelper/vbatextframe.hxx b/vbahelper/inc/vbahelper/vbatextframe.hxx
new file mode 100644
index 000000000000..91bc4525b973
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbatextframe.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_TEXTFRAME_HXX
+#define VBA_TEXTFRAME_HXX
+#include <ooo/vba/msforms/XTextFrame.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ov::msforms::XTextFrame > VbaTextFrame_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaTextFrame : public VbaTextFrame_BASE
+{
+protected:
+ css::uno::Reference< css::drawing::XShape > m_xShape;
+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
+protected:
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+ virtual void setAsMSObehavior();
+ sal_Int32 getMargin( rtl::OUString sMarginType );
+ void setMargin( rtl::OUString sMarginType, float fMargin );
+public:
+ VbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape);
+ virtual ~VbaTextFrame() {}
+ // Attributes
+ virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getMarginBottom() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMarginBottom( float _marginbottom ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getMarginTop() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMarginTop( float _margintop ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getMarginLeft() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMarginLeft( float _marginleft ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getMarginRight() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMarginRight( float _marginright ) throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual css::uno::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException);
+
+};
+
+#endif//SC_VBA_TEXTFRAME_HXX
diff --git a/vbahelper/inc/vbahelper/vbawindowbase.hxx b/vbahelper/inc/vbahelper/vbawindowbase.hxx
new file mode 100644
index 000000000000..f42c2a19854e
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 VBA_WINDOWBASE_HXX
+#define VBA_WINDOWBASE_HXX
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/XWindowBase.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef InheritedHelperInterfaceImpl1<ov::XWindowBase > WindowBaseImpl_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaWindowBase : public WindowBaseImpl_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+public:
+ VbaWindowBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
+ VbaWindowBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
+
+ // XWindowBase
+ virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ;
+ virtual void SAL_CALL setHeight( sal_Int32 _height ) throw (css::uno::RuntimeException) ;
+ virtual sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException) ;
+ virtual void SAL_CALL setLeft( sal_Int32 _left ) throw (css::uno::RuntimeException) ;
+ virtual sal_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ;
+ virtual void SAL_CALL setTop( sal_Int32 _top ) throw (css::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException) ;
+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ;
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif //VBA_WINDOWBASE_HXX