diff options
author | Noel Power <npower@openoffice.org> | 2009-09-18 15:35:47 +0000 |
---|---|---|
committer | Noel Power <npower@openoffice.org> | 2009-09-18 15:35:47 +0000 |
commit | d37c09f380fa6e24487231e5d70bfc8ecd8157d6 (patch) | |
tree | fcfef511849c572fad16b97a2e628134b05cc1c4 /vbahelper/inc | |
parent | 4cea79ccdfde2c25b376ca46fdcbe3e91e2405ec (diff) |
new and removed files
Diffstat (limited to 'vbahelper/inc')
20 files changed, 1962 insertions, 0 deletions
diff --git a/vbahelper/inc/vbahelper/helperdecl.hxx b/vbahelper/inc/vbahelper/helperdecl.hxx new file mode 100644 index 000000000000..a570a0e56eb3 --- /dev/null +++ b/vbahelper/inc/vbahelper/helperdecl.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: helperdecl.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_SERV_DECL +#define OOVBAAPI_SERV_DECL +#include <comphelper/servicedecl.hxx> +#include <ooo/vba/XHelperInterface.hpp> + +namespace comphelper { +namespace service_decl { +template <typename ImplT_, typename WithArgsT = with_args<false> > +struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > +{ + typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT; + /** Default ctor. Implementation class without args, expecting + component context as single argument. + */ + vba_service_class_() : baseT() {} + template <typename PostProcessFuncT> + /** Ctor to pass a post processing function/functor. + + @tpl PostProcessDefaultT let your compiler deduce this + @param postProcessFunc function/functor that gets the yet unacquired + ImplT_ pointer returning a + uno::Reference<uno::XInterface> + */ + explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} +}; + +} // namespace service_decl +} // namespace comphelper +#endif diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx new file mode 100644 index 000000000000..547e4b2da97e --- /dev/null +++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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: vbaapplicationbase.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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; + +class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE +{ +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 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 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 float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Quit( ) throw (::com::sun::star::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..1c10f5f2c760 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbacollectionimpl.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX +#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX + +#include <ooo/vba/XCollection.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/script/XDefaultMethod.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> + +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase1.hxx> + +#include "vbahelper/vbahelper.hxx" +#include "vbahelper/vbahelperinterface.hxx" + +#include <vector> + +typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE; + +class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE +{ +protected: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::container::XEnumeration > m_xEnumeration; +public: + + EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { } + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); } +}; + +// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces +// only requirement is the object needs to implement XName + + + +typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE; + +template< typename Ifc1 > +class 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 ) ); + } +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..80d76b029f7b --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialog.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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..96b74febb0d3 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadialogsbase.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialogs.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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..5ba0717490e6 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadllapi.h @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svldllapi.h,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_VBADLLAPI_H +#define INCLUDED_VBADLLAPI_H + +#include "sal/types.h" + +#if defined(VBAHELPER_DLLIMPLEMENTATION) +#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_SVLDLLAPI_H */ + diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx new file mode 100644 index 000000000000..064058aa80dd --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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); + + // 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..59791f9b479e --- /dev/null +++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx new file mode 100644 index 000000000000..19ca49215b54 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbafontbase.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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: vbafont.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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; +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, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) 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..76fa4600adf8 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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: vbaapplicationbase.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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: + + 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..67a68d82d318 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_HELPER_HXX +#define OOVBAAPI_VBA_HELPER_HXX + +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/beans/XIntrospectionAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/script/BasicErrorException.hpp> +#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XDevice.hpp> +#include <basic/sberrors.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/frame/XModel.hpp> +#include <sfx2/dispatch.hxx> +//#include <ooo/vba/msforms/XShape.hpp> +#include <vcl/pointr.hxx> +#define VBAHELPER_DLLIMPLEMENTATION +#include <vbahelper/vbadllapi.h> +#include <memory> +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 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); + VBAHELPER_DLLPUBLIC 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); + css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) 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 (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); + VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& ); + VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& ); + // provide a NULL object that can be passed as variant so that + // the object when passed to IsNull will return true. aNULL + // contains an empty object reference + VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL(); + VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection ); + VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* ); + + VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); + VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) + VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + 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: + static const double factor; + + 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" +class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes +{ + + css::uno::Reference< css::beans::XPropertySet > mxModel; +public: + UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; + +class VBAHELPER_DLLPUBLIC 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/vbahelper.hxx.orig b/vbahelper/inc/vbahelper/vbahelper.hxx.orig new file mode 100644 index 000000000000..047019c214d0 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbahelper.hxx.orig @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_HELPER_HXX +#define OOVBAAPI_VBA_HELPER_HXX + +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/beans/XIntrospectionAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/script/BasicErrorException.hpp> +#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XDevice.hpp> +#include <basic/sberrors.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/frame/XModel.hpp> +#include <sfx2/dispatch.hxx> +//#include <ooo/vba/msforms/XShape.hpp> +#include <vcl/pointr.hxx> +#define VBAHELPER_DLLIMPLEMENTATION +#include <vbahelper/vbadllapi.h> +#include <memory> +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 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); + VBAHELPER_DLLPUBLIC 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); + css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc() throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc() 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 (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); + VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); + VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& ); + VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& ); + // provide a NULL object that can be passed as variant so that + // the object when passed to IsNull will return true. aNULL + // contains an empty object reference + VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL(); + VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection ); + VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* ); + + VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); + VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) + VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); + 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 ); + +class VBAHELPER_DLLPUBLIC Millimeter +{ +//Factor to translate between points and hundredths of millimeters: +private: + static const double factor; + + 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" +class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes +{ + + css::uno::Reference< css::beans::XPropertySet > mxModel; +public: + UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; + +class VBAHELPER_DLLPUBLIC 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..709bc06f19dc --- /dev/null +++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelperinterface.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX +#define OOVBAAPI_VBA_HELPERINTERFACE_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/XHelperInterface.hpp> +#include <vbahelper/vbahelper.hxx> +#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< 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 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {} + +}; +#endif diff --git a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx new file mode 100644 index 000000000000..d2ad5582ee80 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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..c2d2ed2aa039 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbapropvalue.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbapropvalue.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_PROPVALULE_HXX +#define SC_VBA_PROPVALULE_HXX +#include <ooo/vba/XPropValue.hpp> +#include <cppuhelper/implbase1.hxx> + +#include <vbahelper/vbahelper.hxx> + +typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE; + +class 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..64fdaef8fcf7 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbashape.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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: vbashape.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_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..712a2f1ee2f4 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbashaperange.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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: vbashaperange.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_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..19cbec2b2dca --- /dev/null +++ b/vbahelper/inc/vbahelper/vbashapes.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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: vbashapes.hxx,v $ + * $Revision: 1.3.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_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..f096d6732f92 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbatextframe.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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: vbatextframe.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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..515897d92cfe --- /dev/null +++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef 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 |