diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2010-05-11 11:26:34 +0200 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2010-05-11 11:26:34 +0200 |
commit | a8697ca9b4f3c5a1915304e6dbe638012d506ce7 (patch) | |
tree | 4fe26403842f1261cbea4b4122fe1bfc34957441 /vbahelper | |
parent | 16257d5d011e4b8a95f6942407fc2d6ca9af2607 (diff) | |
parent | 1aad112dd03e02bc531d509d1f1b6fba2cd7f314 (diff) |
CWS-TOOLING: integrate CWS npower14miscfixes
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/inc/vbahelper/vbaaccesshelper.hxx | 79 | ||||
-rw-r--r-- | vbahelper/inc/vbahelper/vbahelper.hxx | 12 | ||||
-rw-r--r-- | vbahelper/prj/d.lst | 1 | ||||
-rw-r--r-- | vbahelper/source/msforms/makefile.mk | 5 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbacontrol.cxx | 4 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbacontrol.hxx | 1 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/makefile.mk | 5 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbahelper.cxx | 16 | ||||
-rw-r--r-- | vbahelper/util/makefile.mk | 4 |
9 files changed, 101 insertions, 26 deletions
diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx new file mode 100644 index 000000000000..79bb44ce30a4 --- /dev/null +++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef OOVBAAPI_VBA_ACCESS_HELPER_HXX +#define OOVBAAPI_VBA_ACCESS_HELPER_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <basic/basmgr.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/docfile.hxx> +#define VBAHELPER_DLLIMPLEMENTATION +#include <vbahelper/vbadllapi.h> +#include <memory> +namespace css = ::com::sun::star; +namespace ooo +{ + namespace vba + { + + VBAHELPER_DLLPRIVATE inline css::uno::Reference< css::lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell ) + { + css::uno::Any aUnoVar; + if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) ) + throw css::lang::IllegalArgumentException(); + css::uno::Reference< css::lang::XMultiServiceFactory > xVBAFactory( aUnoVar, css::uno::UNO_QUERY_THROW ); + return xVBAFactory; + } + + VBAHELPER_DLLPUBLIC inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException) + { + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); + css::uno::Reference< css::uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs ); + return xIf; + } + + + VBAHELPER_DLLPRIVATE inline bool isAlienDoc( SfxObjectShell& rDocShell, const char* pMimeType ) + { + bool bRes( false ); + const SfxFilter *pFilt = rDocShell.GetMedium()->GetFilter(); + if ( pFilt && pFilt->IsAlienFormat() ) + bRes = ( pFilt->GetMimeType().CompareToAscii( pMimeType ) == 0 ); + return bRes; + } + VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); } + VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); } + + } // openoffice +} // org + +#endif diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx index 315ddb19b7ca..aa7ff9b292a7 100644 --- a/vbahelper/inc/vbahelper/vbahelper.hxx +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -35,17 +35,19 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XDevice.hpp> +#include <basic/basmgr.hxx> #include <basic/sberrors.hxx> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/frame/XModel.hpp> #include <sfx2/dispatch.hxx> -//#include <ooo/vba/msforms/XShape.hpp> +#include <sfx2/objsh.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/docfile.hxx> #include <vcl/pointr.hxx> -#define VBAHELPER_DLLIMPLEMENTATION -#include <vbahelper/vbadllapi.h> #include <memory> -namespace css = ::com::sun::star; +#include "vbaaccesshelper.hxx" +namespace css = ::com::sun::star; namespace ooo { namespace vba @@ -62,7 +64,7 @@ namespace ooo } 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); diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst index d7b61d1e5a61..d683e97c8b90 100644 --- a/vbahelper/prj/d.lst +++ b/vbahelper/prj/d.lst @@ -8,6 +8,7 @@ mkdir: %_DEST%\inc%_EXT%\basic ..\inc\vbahelper\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\vbahelper\vbacollectionimpl.hxx ..\inc\vbahelper\vbahelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelper.hxx +..\inc\vbahelper\vbaaccesshelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbaaccesshelper.hxx ..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx ..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx ..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk index 9c24c77f8009..7c61e4302b7f 100644 --- a/vbahelper/source/msforms/makefile.mk +++ b/vbahelper/source/msforms/makefile.mk @@ -34,6 +34,11 @@ VISIBILITY_HIDDEN=TRUE # --- Settings ----------------------------------------------------- +.IF "$(ENABLE_VBA)" == "NO" +dummy: + @echo "Nothing to build" +.ENDIF + .INCLUDE : settings.mk SLOFILES=\ diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 8cf00748c278..2ff12b145824 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -374,10 +374,6 @@ ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentC { } -ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException) -{ - return createControl( m_xModel ); -} ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) { uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx index b0db3c476186..1a8ed063548b 100644 --- a/vbahelper/source/msforms/vbacontrol.hxx +++ b/vbahelper/source/msforms/vbacontrol.hxx @@ -98,7 +98,6 @@ class ScVbaControlFactory public: ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel ); - ScVbaControl* createControl() throw ( css::uno::RuntimeException ); ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException ); private: ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk index 88f8f53bd5bf..3284ec5cec9d 100644 --- a/vbahelper/source/vbahelper/makefile.mk +++ b/vbahelper/source/vbahelper/makefile.mk @@ -33,6 +33,11 @@ ENABLE_EXCEPTIONS := TRUE VISIBILITY_HIDDEN=TRUE # --- Settings ----------------------------------------------------- +.IF "$(ENABLE_VBA)" == "NO" +dummy: + @echo "Nothing to build" +.ENDIF + .INCLUDE : settings.mk SLOFILES=\ diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index a99b3fd47e00..a7921da9a4f7 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -98,15 +98,6 @@ namespace ooo namespace vba { -uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell ) -{ - uno::Any aUnoVar; - if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) ) - throw lang::IllegalArgumentException(); - uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW ); - return xVBAFactory; -} - css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException) { OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); @@ -114,13 +105,6 @@ css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShe return getVBAServiceFactory( pShell )->createInstance( sVarName ); } -css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException ) -{ - OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); - ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); - uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs ); - return xIf; -} // helper method to determine if the view ( calc ) is in print-preview mode bool isInPrintPreview( SfxViewFrame* pView ) { diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk index 98adae420ed9..49bc8e7d39b0 100644 --- a/vbahelper/util/makefile.mk +++ b/vbahelper/util/makefile.mk @@ -34,6 +34,10 @@ TARGET=vbahelper .INCLUDE : settings.mk +.IF "$(ENABLE_VBA)" == "NO" +dummy: + @echo "Nothing to build" +.ENDIF TARGET_HELPER=vbahelper |