diff options
Diffstat (limited to 'vbahelper')
108 files changed, 761 insertions, 432 deletions
diff --git a/vbahelper/Library_msforms.mk b/vbahelper/Library_msforms.mk new file mode 100755 index 000000000000..3e23c492f32b --- /dev/null +++ b/vbahelper/Library_msforms.mk @@ -0,0 +1,94 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# MODULE is the name of the module the makefile is located in + +# declare a library +# LIB is the name of the library as it is found in Repository.mk +$(eval $(call gb_Library_Library,msforms)) + +# for platforms supporting PCH: declare the location of the pch file +# this is the name of the cxx file (without extension) +#$(eval $(call gb_Library_add_precompiled_header,msforms,$(SRCDIR)/vbahelper/PCH_FILE)) + +# in case UNO services are exported: declare location of component file +$(eval $(call gb_Library_set_componentfile,msforms,vbahelper/util/msforms)) + +# add any additional include paths for this library here +$(eval $(call gb_Library_set_include,msforms,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/offuh \ +)) + +# add libraries to be linked to LIB; again these names need to be given as +# specified in Repository.mk +$(eval $(call gb_Library_add_linked_libs,msforms,\ + comphelper \ + cppu \ + cppuhelper \ + svl \ + svt \ + tl \ + sal \ + vbahelper \ + sfx \ + svx \ + vcl \ + tk \ + sb \ + stl \ + $(gb_STDLIBS) \ +)) + +# add all source files that shall be compiled with exceptions enabled +# the name is relative to $(SRCROOT) and must not contain an extension +$(eval $(call gb_Library_add_exception_objects,msforms,\ + vbahelper/source/msforms/service \ + vbahelper/source/msforms/vbabutton \ + vbahelper/source/msforms/vbacheckbox \ + vbahelper/source/msforms/vbacombobox \ + vbahelper/source/msforms/vbacontrol \ + vbahelper/source/msforms/vbacontrols \ + vbahelper/source/msforms/vbaframe \ + vbahelper/source/msforms/vbaimage \ + vbahelper/source/msforms/vbalabel \ + vbahelper/source/msforms/vbalistbox \ + vbahelper/source/msforms/vbalistcontrolhelper \ + vbahelper/source/msforms/vbamultipage \ + vbahelper/source/msforms/vbapages \ + vbahelper/source/msforms/vbaprogressbar \ + vbahelper/source/msforms/vbaradiobutton \ + vbahelper/source/msforms/vbascrollbar \ + vbahelper/source/msforms/vbaspinbutton \ + vbahelper/source/msforms/vbasystemaxcontrol \ + vbahelper/source/msforms/vbatextbox \ + vbahelper/source/msforms/vbatogglebutton \ + vbahelper/source/msforms/vbauserform \ +)) + +# vim: set noet sw=4 ts=4: + diff --git a/vbahelper/Library_vbahelper.mk b/vbahelper/Library_vbahelper.mk new file mode 100755 index 000000000000..722b66d709a1 --- /dev/null +++ b/vbahelper/Library_vbahelper.mk @@ -0,0 +1,100 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,vbahelper)) + +$(eval $(call gb_Library_add_package_headers,vbahelper,vbahelper_inc)) + +# for platforms supporting PCH: declare the location of the pch file +# this is the name of the cxx file (without extension) +#$(eval $(call gb_Library_add_precompiled_header,vbahelper,$(SRCDIR)/vbahelper/PCH_FILE)) + +# in case UNO services are exported: declare location of component file +#$(eval $(call gb_Library_set_componentfile,vbahelper,vbahelper/COMPONENT_FILE)) + +# add any additional include paths for this library here +$(eval $(call gb_Library_set_include,vbahelper,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_set_defs,vbahelper,\ + $$(DEFS) \ + -DVBAHELPER_DLLIMPLEMENTATION \ +)) + +# add libraries to be linked to vbahelper; again these names need to be given as +# specified in Repository.mk +$(eval $(call gb_Library_add_linked_libs,vbahelper,\ + cppu \ + cppuhelper \ + comphelper \ + sb \ + tl \ + sal \ + sfx \ + stl \ + svt \ + vcl \ + svl \ + msfilter \ + tk \ + $(gb_STDLIBS) \ +)) + +# add all source files that shall be compiled with exceptions enabled +# the name is relative to $(SRCROOT) and must not contain an extension +$(eval $(call gb_Library_add_exception_objects,vbahelper,\ + vbahelper/source/vbahelper/vbaapplicationbase \ + vbahelper/source/vbahelper/vbacolorformat \ + vbahelper/source/vbahelper/vbacommandbar \ + vbahelper/source/vbahelper/vbacommandbarcontrol \ + vbahelper/source/vbahelper/vbacommandbarcontrols \ + vbahelper/source/vbahelper/vbacommandbarhelper \ + vbahelper/source/vbahelper/vbacommandbars \ + vbahelper/source/vbahelper/vbadialogbase \ + vbahelper/source/vbahelper/vbadialogsbase \ + vbahelper/source/vbahelper/vbadocumentbase \ + vbahelper/source/vbahelper/vbadocumentsbase \ + vbahelper/source/vbahelper/vbaeventshelperbase \ + vbahelper/source/vbahelper/vbafillformat \ + vbahelper/source/vbahelper/vbafontbase \ + vbahelper/source/vbahelper/vbaglobalbase \ + vbahelper/source/vbahelper/vbahelper \ + vbahelper/source/vbahelper/vbalineformat \ + vbahelper/source/vbahelper/vbapagesetupbase \ + vbahelper/source/vbahelper/vbapictureformat \ + vbahelper/source/vbahelper/vbapropvalue \ + vbahelper/source/vbahelper/vbashape \ + vbahelper/source/vbahelper/vbashaperange \ + vbahelper/source/vbahelper/vbashapes \ + vbahelper/source/vbahelper/vbatextframe \ + vbahelper/source/vbahelper/vbawindowbase \ +)) + +# vim: set noet sw=4 ts=4: + diff --git a/vbahelper/Makefile b/vbahelper/Makefile new file mode 100755 index 000000000000..a79aff831024 --- /dev/null +++ b/vbahelper/Makefile @@ -0,0 +1,38 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +ifeq ($(strip $(SOLARENV)),) +$(error No environment set!) +endif + +gb_PARTIALBUILD := T +GBUILDDIR := $(SOLARENV)/gbuild +include $(GBUILDDIR)/gbuild.mk + +$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk))) + +# vim: set noet sw=4 ts=4: diff --git a/vbahelper/Module_vbahelper.mk b/vbahelper/Module_vbahelper.mk new file mode 100755 index 000000000000..8fe6c15b6abf --- /dev/null +++ b/vbahelper/Module_vbahelper.mk @@ -0,0 +1,46 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Module_Module,vbahelper)) + +# the targets to be inserted are their file names without .mk extension +$(eval $(call gb_Module_add_targets,vbahelper,\ + Library_vbahelper \ + Library_msforms \ + Package_inc \ +)) + +# add any runtime tests (unit tests) here +# remove if no tests +#$(eval $(call gb_Module_add_check_targets,vbahelper,\ +#)) + +# add any subsequent checks (e.g. complex tests) here +#$(eval $(call gb_Module_add_subsequentcheck_targets,vbahelper,\ +#)) + +# vim: set noet sw=4 ts=4: diff --git a/vbahelper/Package_inc.mk b/vbahelper/Package_inc.mk new file mode 100755 index 000000000000..6d8033aa5b02 --- /dev/null +++ b/vbahelper/Package_inc.mk @@ -0,0 +1,51 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,vbahelper_inc,$(SRCDIR)/vbahelper/inc)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/helperdecl.hxx,vbahelper/helperdecl.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaaccesshelper.hxx,vbahelper/vbaaccesshelper.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaapplicationbase.hxx,vbahelper/vbaapplicationbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbacollectionimpl.hxx,vbahelper/vbacollectionimpl.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbadialogbase.hxx,vbahelper/vbadialogbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbadialogsbase.hxx,vbahelper/vbadialogsbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbadllapi.h,vbahelper/vbadllapi.h)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbadocumentbase.hxx,vbahelper/vbadocumentbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbadocumentsbase.hxx,vbahelper/vbadocumentsbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaeventshelperbase.hxx,vbahelper/vbaeventshelperbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbafontbase.hxx,vbahelper/vbafontbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaglobalbase.hxx,vbahelper/vbaglobalbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbahelper.hxx,vbahelper/vbahelper.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbahelperinterface.hxx,vbahelper/vbahelperinterface.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbapagesetupbase.hxx,vbahelper/vbapagesetupbase.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbapropvalue.hxx,vbahelper/vbapropvalue.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbashape.hxx,vbahelper/vbashape.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbashaperange.hxx,vbahelper/vbashaperange.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbashapes.hxx,vbahelper/vbashapes.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbatextframe.hxx,vbahelper/vbatextframe.hxx)) +$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbawindowbase.hxx,vbahelper/vbawindowbase.hxx)) + +# vim: set noet sw=4 ts=4: diff --git a/vbahelper/inc/vbahelper/helperdecl.hxx b/vbahelper/inc/vbahelper/helperdecl.hxx index 930041d3fe1e..930041d3fe1e 100644..100755 --- a/vbahelper/inc/vbahelper/helperdecl.hxx +++ b/vbahelper/inc/vbahelper/helperdecl.hxx diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx index 2aeb9759dfb5..cf166cf0a888 100644..100755 --- a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx +++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx @@ -33,7 +33,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/docfile.hxx> -#define VBAHELPER_DLLIMPLEMENTATION +//#define VBAHELPER_DLLIMPLEMENTATION #include <vbahelper/vbadllapi.h> #include <memory> namespace css = ::com::sun::star; diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx index 0a402c244ee5..0a402c244ee5 100644..100755 --- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx +++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx index 69020d373e3f..3867825ef586 100644..100755 --- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx +++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx @@ -151,7 +151,7 @@ public: typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE; template< typename Ifc1 > -class VBAHELPER_DLLPUBLIC XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE +class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE { public: typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec; @@ -349,7 +349,7 @@ public: }; template <typename Ifc> // where Ifc must implement XCollectionTest -class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > +class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > { typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1; diff --git a/vbahelper/inc/vbahelper/vbadialogbase.hxx b/vbahelper/inc/vbahelper/vbadialogbase.hxx index acf4b7e1ddb7..acf4b7e1ddb7 100644..100755 --- a/vbahelper/inc/vbahelper/vbadialogbase.hxx +++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx diff --git a/vbahelper/inc/vbahelper/vbadialogsbase.hxx b/vbahelper/inc/vbahelper/vbadialogsbase.hxx index a20903094092..a20903094092 100644..100755 --- a/vbahelper/inc/vbahelper/vbadialogsbase.hxx +++ b/vbahelper/inc/vbahelper/vbadialogsbase.hxx diff --git a/vbahelper/inc/vbahelper/vbadllapi.h b/vbahelper/inc/vbahelper/vbadllapi.h index f3e6c5e581bf..f3e6c5e581bf 100644..100755 --- a/vbahelper/inc/vbahelper/vbadllapi.h +++ b/vbahelper/inc/vbahelper/vbadllapi.h diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx index f08790ab26d2..f08790ab26d2 100644..100755 --- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx +++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx index d67d96108055..1587091bfd4c 100644..100755 --- a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx +++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx @@ -58,10 +58,10 @@ public: // 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); +protected: + css::uno::Any createDocument() throw (css::uno::RuntimeException); + void closeDocuments() throw (css::uno::RuntimeException); + css::uno::Any openDocument( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); }; #endif /* SC_VBA_WORKBOOKS_HXX */ diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx index 9fe65267acfc..a2a036b86236 100644..100755 --- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx +++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx @@ -59,6 +59,17 @@ public: // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException); + // little helpers --------------------------------------------------------- + + /** Throws, if the passed sequence does not contain a value at the specified index. */ + static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) + { if( (nIndex < 0) || (nIndex >= rArgs.getLength()) ) throw css::lang::IllegalArgumentException(); } + + /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */ + template< typename Type > + static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) + { checkArgument( rArgs, nIndex ); if( !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); } + protected: // ------------------------------------------------------------------------ @@ -74,7 +85,7 @@ protected: /** Registers a supported event handler. - @param nEventId Event identifier from com.sun.star.script.vba.EventIdentifier. + @param nEventId Event identifier from com.sun.star.script.vba.VBAEventId. @param pcMacroName Name of the associated VBA event handler macro. @param eType Document event or global event. @param nCancelIndex 0-based index of Cancel parameter, or -1. @@ -86,15 +97,6 @@ protected: sal_Int32 nCancelIndex = -1, const css::uno::Any& rUserData = css::uno::Any() ); - /** Throws, if the passed sequence does not contain a value at the specified index. */ - static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) - { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); } - - /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */ - template< typename Type > - static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) - { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); } - // ------------------------------------------------------------------------ struct EventQueueEntry @@ -106,10 +108,6 @@ protected: }; typedef ::std::deque< EventQueueEntry > EventQueue; - /** Derived classes return whether event processing is enabled. Throws if - the instance is in an invalid state. */ - virtual bool implEventsEnabled() throw (css::uno::RuntimeException) = 0; - /** Derived classes do additional prpeparations and return whether the event handler has to be called. */ virtual bool implPrepareEvent( diff --git a/vbahelper/inc/vbahelper/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx index 8e2ad0fd5dda..8e2ad0fd5dda 100644..100755 --- a/vbahelper/inc/vbahelper/vbafontbase.hxx +++ b/vbahelper/inc/vbahelper/vbafontbase.hxx diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx index 1f7d7a280f56..1f7d7a280f56 100644..100755 --- a/vbahelper/inc/vbahelper/vbaglobalbase.hxx +++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx index 2843ce30ade0..31c427529f42 100644..100755 --- a/vbahelper/inc/vbahelper/vbahelper.hxx +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -83,7 +83,7 @@ namespace ooo VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl ); VBAHELPER_DLLPUBLIC void dispatchRequests (const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString & aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps, const css::uno::Reference< css::frame::XDispatchResultListener >& rListener = css::uno::Reference< css::frame::XDispatchResultListener >(), const sal_Bool bSilent = sal_True ); - VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, sal_uInt16 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& ); @@ -193,6 +193,7 @@ public: virtual void setHeight( double nHeight ); virtual double getWidth(); virtual void setWidth( double nWidth); + virtual ~ConcreteXShapeGeometryAttributes(); }; #define VBA_LEFT "PositionX" @@ -201,11 +202,8 @@ public: #define VBA_WIDTH "Width" class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes { - css::uno::Reference< css::awt::XUnitConversion > mxControlUnits; - css::uno::Reference< css::beans::XPropertySet > mxModel; - - sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit ); - sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit ); + css::uno::Reference< css::awt::XWindow > mxWindow; + sal_Bool mbDialog; public: UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx index 68217a63add9..33bcd40edad5 100644..100755 --- a/vbahelper/inc/vbahelper/vbahelperinterface.hxx +++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx @@ -64,7 +64,7 @@ const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) ); template< typename Ifc1 > -class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl : public Ifc1 +class InheritedHelperInterfaceImpl : public Ifc1 { protected: css::uno::WeakReference< ov::XHelperInterface > mxParent; @@ -110,7 +110,7 @@ public: }; template< typename Ifc1 > -class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > +class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > { typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base; public: @@ -120,7 +120,7 @@ public: }; template< typename Ifc1, typename Ifc2 > -class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl2 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > > +class InheritedHelperInterfaceImpl2 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > > { typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > > Base; public: @@ -130,7 +130,7 @@ public: }; template< typename Ifc1, typename Ifc2, typename Ifc3 > -class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl3 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > > +class InheritedHelperInterfaceImpl3 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > > { typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > > Base; public: diff --git a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx index a4294f425705..a4294f425705 100644..100755 --- a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx +++ b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx diff --git a/vbahelper/inc/vbahelper/vbapropvalue.hxx b/vbahelper/inc/vbahelper/vbapropvalue.hxx index 70e4c3aff2a9..70e4c3aff2a9 100644..100755 --- a/vbahelper/inc/vbahelper/vbapropvalue.hxx +++ b/vbahelper/inc/vbahelper/vbapropvalue.hxx diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx index 93f670f1d5fe..93f670f1d5fe 100644..100755 --- a/vbahelper/inc/vbahelper/vbashape.hxx +++ b/vbahelper/inc/vbahelper/vbashape.hxx diff --git a/vbahelper/inc/vbahelper/vbashaperange.hxx b/vbahelper/inc/vbahelper/vbashaperange.hxx index 7a580dac5e77..7a580dac5e77 100644..100755 --- a/vbahelper/inc/vbahelper/vbashaperange.hxx +++ b/vbahelper/inc/vbahelper/vbashaperange.hxx diff --git a/vbahelper/inc/vbahelper/vbashapes.hxx b/vbahelper/inc/vbahelper/vbashapes.hxx index 86e1ba3c6f37..86e1ba3c6f37 100644..100755 --- a/vbahelper/inc/vbahelper/vbashapes.hxx +++ b/vbahelper/inc/vbahelper/vbashapes.hxx diff --git a/vbahelper/inc/vbahelper/vbatextframe.hxx b/vbahelper/inc/vbahelper/vbatextframe.hxx index 584e2559315c..584e2559315c 100644..100755 --- a/vbahelper/inc/vbahelper/vbatextframe.hxx +++ b/vbahelper/inc/vbahelper/vbatextframe.hxx diff --git a/vbahelper/inc/vbahelper/vbawindowbase.hxx b/vbahelper/inc/vbahelper/vbawindowbase.hxx index f7e68273343f..f7e68273343f 100644..100755 --- a/vbahelper/inc/vbahelper/vbawindowbase.hxx +++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx diff --git a/vbahelper/prj/build.lst b/vbahelper/prj/build.lst index ded9ee23b3fc..8c411d422e29 100644..100755 --- a/vbahelper/prj/build.lst +++ b/vbahelper/prj/build.lst @@ -1,6 +1,3 @@ -vba vbahelper : oovbaapi oox basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL +vba vbahelper : offuh oox basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal LIBXSLT:libxslt NULL vba vbahelper usr1 - all vba_mkout NULL -#vba vbahelper\inc nmake - all vba_inc NULL -vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL -vba vbahelper\source\msforms nmake - all vba_msforms NULL -vba vbahelper\util nmake - all vba_util vba_vbahelper vba_msforms NULL +vba vbahelper\prj nmake - all vba_prj NULL diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst index 92b01be83912..c317c4de1e0e 100644..100755 --- a/vbahelper/prj/d.lst +++ b/vbahelper/prj/d.lst @@ -1,30 +1 @@ -..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT% -..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT% -..\%__SRC%\lib\ivbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib -..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.* -..\%__SRC%\bin\vbahelper*.* %_DEST%\bin%_EXT%\vbahelper*.* -..\%__SRC%\bin\msforms*.* %_DEST%\bin%_EXT%\msforms*.* - -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 -..\inc\vbahelper\vbafontbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbafontbase.hxx -..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h -..\inc\vbahelper\vbawindowbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbawindowbase.hxx -..\inc\vbahelper\vbadocumentbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentbase.hxx -..\inc\vbahelper\vbadocumentsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentsbase.hxx -..\inc\vbahelper\vbapropvalue.hxx %_DEST%\inc%_EXT%\vbahelper\vbapropvalue.hxx -..\inc\vbahelper\vbaglobalbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaglobalbase.hxx -..\inc\vbahelper\vbadialogbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogbase.hxx -..\inc\vbahelper\vbadialogsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogsbase.hxx -..\inc\vbahelper\vbashape.hxx %_DEST%\inc%_EXT%\vbahelper\vbashape.hxx -..\inc\vbahelper\vbashapes.hxx %_DEST%\inc%_EXT%\vbahelper\vbashapes.hxx -..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx -..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx -..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx -..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx ..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx diff --git a/vbahelper/prj/makefile.mk b/vbahelper/prj/makefile.mk new file mode 100755 index 000000000000..e312a7ccab65 --- /dev/null +++ b/vbahelper/prj/makefile.mk @@ -0,0 +1,40 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. +TARGET=prj + +.INCLUDE : settings.mk + +.IF "$(VERBOSE)"!="" +VERBOSEFLAG := +.ELSE +VERBOSEFLAG := -s +.ENDIF + +all: + cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk index 30ce22139ce4..30ce22139ce4 100644..100755 --- a/vbahelper/source/msforms/makefile.mk +++ b/vbahelper/source/msforms/makefile.mk diff --git a/vbahelper/source/msforms/service.cxx b/vbahelper/source/msforms/service.cxx index e86a5807449d..eca207f49ad9 100644..100755 --- a/vbahelper/source/msforms/service.cxx +++ b/vbahelper/source/msforms/service.cxx @@ -58,16 +58,6 @@ extern "C" *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) - { - OSL_TRACE("In component_writeInfo"); - - // Component registration - return component_writeInfoHelper( pServiceManager, pRegistryKey, - controlprovider::serviceDecl, userform::serviceDecl ); - } - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx index d7e5249b3b3b..d7e5249b3b3b 100644..100755 --- a/vbahelper/source/msforms/vbabutton.cxx +++ b/vbahelper/source/msforms/vbabutton.cxx diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx index e30605edb897..e30605edb897 100644..100755 --- a/vbahelper/source/msforms/vbabutton.hxx +++ b/vbahelper/source/msforms/vbabutton.hxx diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx index cc026bd70c48..cc026bd70c48 100644..100755 --- a/vbahelper/source/msforms/vbacheckbox.cxx +++ b/vbahelper/source/msforms/vbacheckbox.cxx diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx index 10af39e64ea3..10af39e64ea3 100644..100755 --- a/vbahelper/source/msforms/vbacheckbox.hxx +++ b/vbahelper/source/msforms/vbacheckbox.hxx diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx index 10910f4ef01b..10910f4ef01b 100644..100755 --- a/vbahelper/source/msforms/vbacombobox.cxx +++ b/vbahelper/source/msforms/vbacombobox.cxx diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx index fa4ee10d89d4..fa4ee10d89d4 100644..100755 --- a/vbahelper/source/msforms/vbacombobox.hxx +++ b/vbahelper/source/msforms/vbacombobox.hxx diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 6b14bed48e87..2d100caa2e54 100644..100755 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -241,7 +241,6 @@ void SAL_CALL ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) { mpGeometryHelper->setLeft( _left ); - } double SAL_CALL diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx index 2d52d30c2726..1e239b8a4c82 100644..100755 --- a/vbahelper/source/msforms/vbacontrol.hxx +++ b/vbahelper/source/msforms/vbacontrol.hxx @@ -43,6 +43,7 @@ #include <memory> //typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE; +//template SAL_DLLPUBLIC_IMPORT InheritedHelperInterfaceImpl1< ov::msforms::XControl >; typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE; class ScVbaControl : public ControlImpl_BASE diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx index 52340642fb64..52340642fb64 100644..100755 --- a/vbahelper/source/msforms/vbacontrols.cxx +++ b/vbahelper/source/msforms/vbacontrols.cxx diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx index c525cb49297c..c525cb49297c 100644..100755 --- a/vbahelper/source/msforms/vbacontrols.hxx +++ b/vbahelper/source/msforms/vbacontrols.hxx diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx index 09d3b3c7fbd5..09d3b3c7fbd5 100644..100755 --- a/vbahelper/source/msforms/vbaframe.cxx +++ b/vbahelper/source/msforms/vbaframe.cxx diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx index 9b2c77252f67..9b2c77252f67 100644..100755 --- a/vbahelper/source/msforms/vbaframe.hxx +++ b/vbahelper/source/msforms/vbaframe.hxx diff --git a/vbahelper/source/msforms/vbaimage.cxx b/vbahelper/source/msforms/vbaimage.cxx index 08a3007d5714..08a3007d5714 100644..100755 --- a/vbahelper/source/msforms/vbaimage.cxx +++ b/vbahelper/source/msforms/vbaimage.cxx diff --git a/vbahelper/source/msforms/vbaimage.hxx b/vbahelper/source/msforms/vbaimage.hxx index e360fe4f67b1..e360fe4f67b1 100644..100755 --- a/vbahelper/source/msforms/vbaimage.hxx +++ b/vbahelper/source/msforms/vbaimage.hxx diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx index 29c8dfa83466..29c8dfa83466 100644..100755 --- a/vbahelper/source/msforms/vbalabel.cxx +++ b/vbahelper/source/msforms/vbalabel.cxx diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx index 6ee3998b52b0..6ee3998b52b0 100644..100755 --- a/vbahelper/source/msforms/vbalabel.hxx +++ b/vbahelper/source/msforms/vbalabel.hxx diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx index a29c1312eecc..a29c1312eecc 100644..100755 --- a/vbahelper/source/msforms/vbalistbox.cxx +++ b/vbahelper/source/msforms/vbalistbox.cxx diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx index 972e5808a62d..972e5808a62d 100644..100755 --- a/vbahelper/source/msforms/vbalistbox.hxx +++ b/vbahelper/source/msforms/vbalistbox.hxx diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx index 696b52bfb42d..696b52bfb42d 100644..100755 --- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx +++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.hxx b/vbahelper/source/msforms/vbalistcontrolhelper.hxx index 930204ebd5d5..930204ebd5d5 100644..100755 --- a/vbahelper/source/msforms/vbalistcontrolhelper.hxx +++ b/vbahelper/source/msforms/vbalistcontrolhelper.hxx diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx index ac613ccdfaca..ac613ccdfaca 100644..100755 --- a/vbahelper/source/msforms/vbamultipage.cxx +++ b/vbahelper/source/msforms/vbamultipage.cxx diff --git a/vbahelper/source/msforms/vbamultipage.hxx b/vbahelper/source/msforms/vbamultipage.hxx index b3a16294d8f4..b3a16294d8f4 100644..100755 --- a/vbahelper/source/msforms/vbamultipage.hxx +++ b/vbahelper/source/msforms/vbamultipage.hxx diff --git a/vbahelper/source/msforms/vbapages.cxx b/vbahelper/source/msforms/vbapages.cxx index a32519c41f57..a32519c41f57 100644..100755 --- a/vbahelper/source/msforms/vbapages.cxx +++ b/vbahelper/source/msforms/vbapages.cxx diff --git a/vbahelper/source/msforms/vbapages.hxx b/vbahelper/source/msforms/vbapages.hxx index 63e989891b8e..63e989891b8e 100644..100755 --- a/vbahelper/source/msforms/vbapages.hxx +++ b/vbahelper/source/msforms/vbapages.hxx diff --git a/vbahelper/source/msforms/vbaprogressbar.cxx b/vbahelper/source/msforms/vbaprogressbar.cxx index 5e82443da203..5e82443da203 100644..100755 --- a/vbahelper/source/msforms/vbaprogressbar.cxx +++ b/vbahelper/source/msforms/vbaprogressbar.cxx diff --git a/vbahelper/source/msforms/vbaprogressbar.hxx b/vbahelper/source/msforms/vbaprogressbar.hxx index 73c1ba776382..73c1ba776382 100644..100755 --- a/vbahelper/source/msforms/vbaprogressbar.hxx +++ b/vbahelper/source/msforms/vbaprogressbar.hxx diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx index 8c89b08ff1ef..8c89b08ff1ef 100644..100755 --- a/vbahelper/source/msforms/vbaradiobutton.cxx +++ b/vbahelper/source/msforms/vbaradiobutton.cxx diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx index 6bb0981553f4..6bb0981553f4 100644..100755 --- a/vbahelper/source/msforms/vbaradiobutton.hxx +++ b/vbahelper/source/msforms/vbaradiobutton.hxx diff --git a/vbahelper/source/msforms/vbascrollbar.cxx b/vbahelper/source/msforms/vbascrollbar.cxx index 6b9eefaaf642..6b9eefaaf642 100644..100755 --- a/vbahelper/source/msforms/vbascrollbar.cxx +++ b/vbahelper/source/msforms/vbascrollbar.cxx diff --git a/vbahelper/source/msforms/vbascrollbar.hxx b/vbahelper/source/msforms/vbascrollbar.hxx index bfb6430c4312..bfb6430c4312 100644..100755 --- a/vbahelper/source/msforms/vbascrollbar.hxx +++ b/vbahelper/source/msforms/vbascrollbar.hxx diff --git a/vbahelper/source/msforms/vbaspinbutton.cxx b/vbahelper/source/msforms/vbaspinbutton.cxx index 0e9472e71190..0e9472e71190 100644..100755 --- a/vbahelper/source/msforms/vbaspinbutton.cxx +++ b/vbahelper/source/msforms/vbaspinbutton.cxx diff --git a/vbahelper/source/msforms/vbaspinbutton.hxx b/vbahelper/source/msforms/vbaspinbutton.hxx index 2726b44e5765..2726b44e5765 100644..100755 --- a/vbahelper/source/msforms/vbaspinbutton.hxx +++ b/vbahelper/source/msforms/vbaspinbutton.hxx diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.cxx b/vbahelper/source/msforms/vbasystemaxcontrol.cxx index 1724ad31c154..1724ad31c154 100644..100755 --- a/vbahelper/source/msforms/vbasystemaxcontrol.cxx +++ b/vbahelper/source/msforms/vbasystemaxcontrol.cxx diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.hxx b/vbahelper/source/msforms/vbasystemaxcontrol.hxx index 0ede40b1e979..0ede40b1e979 100644..100755 --- a/vbahelper/source/msforms/vbasystemaxcontrol.hxx +++ b/vbahelper/source/msforms/vbasystemaxcontrol.hxx diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx index f73bdca68b54..f73bdca68b54 100644..100755 --- a/vbahelper/source/msforms/vbatextbox.cxx +++ b/vbahelper/source/msforms/vbatextbox.cxx diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx index 161926c98c92..161926c98c92 100644..100755 --- a/vbahelper/source/msforms/vbatextbox.hxx +++ b/vbahelper/source/msforms/vbatextbox.hxx diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx index a6f20a28f39f..a6f20a28f39f 100644..100755 --- a/vbahelper/source/msforms/vbatogglebutton.cxx +++ b/vbahelper/source/msforms/vbatogglebutton.cxx diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx index 7ae6daab84d7..7ae6daab84d7 100644..100755 --- a/vbahelper/source/msforms/vbatogglebutton.hxx +++ b/vbahelper/source/msforms/vbatogglebutton.hxx diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index afbe84830dcc..7152523e2696 100644..100755 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -30,8 +30,10 @@ #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/beans/PropertyConcept.hpp> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <basic/sbx.hxx> #include <basic/sbstar.hxx> #include <basic/sbmeth.hxx> @@ -69,9 +71,28 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) { OSL_TRACE("ScVbaUserForm::Show( )"); short aRet = 0; - mbDispose = true; + mbDispose = true; + if ( m_xDialog.is() ) + { + // try to center dialog on model window + if( m_xModel.is() ) try + { + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); + uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + awt::Rectangle aPosSize = xWindow->getPosSize(); // already in pixel + + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XWindow > xControlWindow( xControl->getPeer(), uno::UNO_QUERY_THROW ); + xControlWindow->setPosSize( (aPosSize.Width - getWidth()) / 2.0, (aPosSize.Height - getHeight()) / 2.0, 0, 0, awt::PosSize::POS ); + } + catch( uno::Exception& ) + { + } + aRet = m_xDialog->execute(); + } OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); if ( mbDispose ) { @@ -228,13 +249,16 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControl > xControl = nestedSearch( aPropertyName, xContainer ); xContainer->getControl( aPropertyName ); - ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); - if ( m_sLibName.getLength() ) - pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) ); - aResult = uno::makeAny( xVBAControl ); + if ( xControl.is() ) + { + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + if ( m_sLibName.getLength() ) + pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) ); + aResult = uno::makeAny( xVBAControl ); + } } return aResult; diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx index 700f1017bffd..700f1017bffd 100644..100755 --- a/vbahelper/source/msforms/vbauserform.hxx +++ b/vbahelper/source/msforms/vbauserform.hxx diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk index 31fefa8430b1..31fefa8430b1 100644..100755 --- a/vbahelper/source/vbahelper/makefile.mk +++ b/vbahelper/source/vbahelper/makefile.mk diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 9c72951fd748..16cb309cae7c 100644..100755 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -52,6 +52,7 @@ #include <basic/sbuno.hxx> #include <basic/sbmeth.hxx> #include <basic/sbmod.hxx> +#include <basic/vbahelper.hxx> #include "vbacommandbars.hxx" @@ -202,12 +203,8 @@ void SAL_CALL VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException) { uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - if( bUpdate != xModel->hasControllersLocked() ) - return; - if (bUpdate) - xModel->unlockControllers(); - else - xModel->lockControllers(); + // #163808# use helper from module "basic" to lock all documents of this application + ::basic::vba::lockControllersOfAllDocuments( xModel, !bUpdate ); } sal_Bool SAL_CALL @@ -266,10 +263,8 @@ void SAL_CALL VbaApplicationBase::setInteractive( ::sal_Bool bInteractive ) throw (uno::RuntimeException) { uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); - - xWindow->setEnable( bInteractive ); + // #163808# use helper from module "basic" to enable/disable all container windows of all documents of this application + ::basic::vba::enableContainerWindowsOfAllDocuments( xModel, bInteractive ); } sal_Bool SAL_CALL VbaApplicationBase::getVisible() throw (uno::RuntimeException) @@ -301,54 +296,24 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con { ::rtl::OUString sSeparator(RTL_CONSTASCII_USTRINGPARAM("/")); ::rtl::OUString sMacroSeparator(RTL_CONSTASCII_USTRINGPARAM("!")); - ::rtl::OUString sMacro_only_Name; - sal_Int32 Position_MacroSeparator = MacroName.indexOf(sMacroSeparator); - - uno::Reference< frame::XModel > aMacroDocumentModel; - if (-1 != Position_MacroSeparator) - { - uno::Reference< container::XEnumerationAccess > xComponentEnumAccess; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager(); - try - { - uno::Reference< frame::XDesktop > xDesktop (xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )),mxContext ), uno::UNO_QUERY_THROW ); - xComponentEnumAccess = xDesktop->getComponents(); - } - catch(uno::Exception&) - { - } - - //rem look for the name of the document in the cmpoonents collection - uno::Reference < container::XEnumeration > xEnum = xComponentEnumAccess->createEnumeration(); + ::rtl::OUString aMacroName = MacroName.trim(); + if (0 == aMacroName.indexOf('!')) + aMacroName = aMacroName.copy(1).trim(); - // iterate through the collection by name - while (xEnum->hasMoreElements()) - { - // get the next element as a UNO Any - uno::Any aComponentHelper = xEnum->nextElement(); - uno::Reference <frame::XModel> xDocModel( aComponentHelper, uno::UNO_QUERY_THROW ); - - // get the name of the sheet from its XNamed interface - ::rtl::OUString aName = xDocModel->getURL(); - - - if (aName.match(MacroName.copy(0,Position_MacroSeparator-1),aName.lastIndexOf(sSeparator)+1)) - { - aMacroDocumentModel = xDocModel; - sMacro_only_Name = MacroName.copy(Position_MacroSeparator+1); - } - } - } - else + uno::Reference< frame::XModel > xModel; + SbMethod* pMeth = StarBASIC::GetActiveMethod(); + if ( pMeth ) { - aMacroDocumentModel = getCurrentDocument(); - sMacro_only_Name = MacroName.copy(0); + SbModule* pMod = dynamic_cast< SbModule* >( pMeth->GetParent() ); + if ( pMod ) + xModel = StarBASIC::GetModelFromBasic( pMod ); } + if ( !xModel.is() ) + xModel = getCurrentDocument(); - // search the global tempalte - VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name, sal_True ); - if( aMacroInfo.IsResolved() ) + MacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( xModel ), aMacroName ); + if( aMacroInfo.mbFound ) { // handle the arguments const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 }; @@ -369,7 +334,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con uno::Any aRet; uno::Any aDummyCaller; - executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller ); + executeMacro( aMacroInfo.mpDocContext, aMacroInfo.msResolvedMacro, aArgs, aRet, aDummyCaller ); return aRet; } diff --git a/vbahelper/source/vbahelper/vbacolorformat.cxx b/vbahelper/source/vbahelper/vbacolorformat.cxx index 19cf96e71135..19cf96e71135 100644..100755 --- a/vbahelper/source/vbahelper/vbacolorformat.cxx +++ b/vbahelper/source/vbahelper/vbacolorformat.cxx diff --git a/vbahelper/source/vbahelper/vbacolorformat.hxx b/vbahelper/source/vbahelper/vbacolorformat.hxx index c0e023dc5ce7..c0e023dc5ce7 100644..100755 --- a/vbahelper/source/vbahelper/vbacolorformat.hxx +++ b/vbahelper/source/vbahelper/vbacolorformat.hxx diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx index ea58e8e86e31..ea58e8e86e31 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbar.cxx +++ b/vbahelper/source/vbahelper/vbacommandbar.cxx diff --git a/vbahelper/source/vbahelper/vbacommandbar.hxx b/vbahelper/source/vbahelper/vbacommandbar.hxx index d9278729c144..d9278729c144 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbar.hxx +++ b/vbahelper/source/vbahelper/vbacommandbar.hxx diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx index a18f81ff2e3a..6df2a94bc3bf 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx @@ -79,10 +79,10 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u { // get the current model uno::Reference< frame::XModel > xModel( pCBarHelper->getModel() ); - VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true ); - if ( aResolvedMacro.IsResolved() ) + MacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true ); + if ( aResolvedMacro.mbFound ) { - rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() ); + rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.msResolvedMacro ); OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() ); setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandURL")), uno::makeAny( aCommandURL ) ); ApplyChange(); @@ -92,11 +92,13 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u ::sal_Bool SAL_CALL ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException) { - sal_Bool bVisible = sal_True; + /*sal_Bool bVisible = sal_True; uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) ); if( aValue.hasValue() ) aValue >>= bVisible; - return bVisible; + return bVisible;*/ + return getEnabled(); + } void SAL_CALL ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) @@ -107,12 +109,16 @@ ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeExc setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")), uno::makeAny( _visible ) ); ApplyChange(); } + setEnabled( _visible); } ::sal_Bool SAL_CALL ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) { sal_Bool bEnabled = sal_True; + rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___"); + rtl::OUString aCommandURL ; + if( m_xParentMenu.is() ) { // currently only the menu in the MenuBat support Enable/Disable @@ -122,7 +128,14 @@ ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) else { // emulated with Visible - bEnabled = getVisible(); + //bEnabled = getVisible(); + uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ); + if (aValue >>= aCommandURL){ + if (0 == aCommandURL.indexOf(aCommandURLappendix)){ + bEnabled = sal_False; + } + } + } return bEnabled; } @@ -130,6 +143,9 @@ ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) void SAL_CALL ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException) { + rtl::OUString aCommandURL ; + rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___"); + rtl::OUStringBuffer aCommandURLSringBuffer; if( m_xParentMenu.is() ) { // currently only the menu in the MenuBat support Enable/Disable @@ -137,8 +153,20 @@ ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeExcep } else { + uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ); + if (aValue >>= aCommandURL){ + if (0 == aCommandURL.indexOf(aCommandURLappendix)){ + aCommandURL = aCommandURL.copy(3); + } + if (false == _enabled){ + aCommandURLSringBuffer = aCommandURLappendix; + } + aCommandURLSringBuffer.append(aCommandURL); + setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURLSringBuffer.makeStringAndClear()) ); + ApplyChange(); + } // emulated with Visible - setVisible( _enabled ); + //setVisible( _enabled ); } } diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx index 1b9a58e660e8..1b9a58e660e8 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx index cfeb31007067..cfeb31007067 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx index 674e7132895a..674e7132895a 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx index 9cf3522257cb..9cf3522257cb 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx index 36202ad53039..36202ad53039 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx index 0e021078bfd9..0e021078bfd9 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbars.cxx +++ b/vbahelper/source/vbahelper/vbacommandbars.cxx diff --git a/vbahelper/source/vbahelper/vbacommandbars.hxx b/vbahelper/source/vbahelper/vbacommandbars.hxx index 3c32b7d4a9b5..3c32b7d4a9b5 100644..100755 --- a/vbahelper/source/vbahelper/vbacommandbars.hxx +++ b/vbahelper/source/vbahelper/vbacommandbars.hxx diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx index 86de3e73a3d0..86de3e73a3d0 100644..100755 --- a/vbahelper/source/vbahelper/vbadialogbase.cxx +++ b/vbahelper/source/vbahelper/vbadialogbase.cxx diff --git a/vbahelper/source/vbahelper/vbadialogsbase.cxx b/vbahelper/source/vbahelper/vbadialogsbase.cxx index d625184a8b1d..d625184a8b1d 100644..100755 --- a/vbahelper/source/vbahelper/vbadialogsbase.cxx +++ b/vbahelper/source/vbahelper/vbadialogsbase.cxx diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 5230945e6e74..ea6b6e19ba6c 100644..100755 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -29,15 +29,19 @@ #include "vbahelper/vbadocumentbase.hxx" #include "vbahelper/helperdecl.hxx" +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XProtectable.hpp> #include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn #include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/exc_hlp.hxx> #include <comphelper/unwrapargs.hxx> #include <tools/urlobj.hxx> #include <osl/file.hxx> @@ -72,25 +76,29 @@ VbaDocumentBase::getName() throw (uno::RuntimeException) { uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW ); sName = xTitle->getTitle(); + sName = sName.trim(); } return sName; } ::rtl::OUString VbaDocumentBase::getPath() throw (uno::RuntimeException) { - INetURLObject aURL( getModel()->getURL() ); - rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 ); - rtl::OUString sPath; - ::osl::File::getSystemPathFromFileURL( sURL, sPath ); + INetURLObject aURL( getModel()->getURL() ); + rtl::OUString sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ); + rtl::OUString sPath; + if( sURL.getLength() > 0 ) + { + sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 ); + ::osl::File::getSystemPathFromFileURL( sURL, sPath ); + } return sPath; } ::rtl::OUString VbaDocumentBase::getFullName() throw (uno::RuntimeException) { - rtl::OUString sPath; - ::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); + rtl::OUString sPath = getName(); + //::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); return sPath; } @@ -124,38 +132,69 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, else xModifiable->setModified( false ); - uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY ); - - if( xCloseable.is() ) + // first try to close the document using UI dispatch functionality + sal_Bool bUIClose = sal_False; + try { - // use close(boolean DeliverOwnership) + uno::Reference< frame::XController > xController( getModel()->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xController->getFrame(), uno::UNO_QUERY_THROW ); - // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may - // assume ownership if they object the closure by throwing a CloseVetoException - // Here we give up ownership. To be on the safe side, catch possible veto exception anyway. - try{ - xCloseable->close(sal_True); - } - catch( util::CloseVetoException ) - { - //close is cancelled, nothing to do - } + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); + uno::Reference< util::XURLTransformer > xURLTransformer( + xServiceManager->createInstanceWithContext( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), + mxContext ), + uno::UNO_QUERY_THROW ); + + util::URL aURL; + aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc" ) ); + xURLTransformer->parseStrict( aURL ); + + uno::Reference< css::frame::XDispatch > xDispatch( + xDispatchProvider->queryDispatch( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), 0 ), + uno::UNO_SET_THROW ); + xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); + bUIClose = sal_True; } - // If close is not supported by this model - try to dispose it. - // But if the model disagree with a reset request for the modify state - // we shouldn't do so. Otherwhise some strange things can happen. - else + catch( uno::Exception& ) { - uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY ); - if ( xDisposable.is() ) + } + + if ( !bUIClose ) + { + // if it is not possible to use UI dispatch, try to close the model directly + uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY ); + if( xCloseable.is() ) { - // To be on the safe side, catch possible veto exception anyway. - try + // use close(boolean DeliverOwnership) + + // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may + // assume ownership if they object the closure by throwing a CloseVetoException + // Here we give up ownership. To be on the safe side, catch possible veto exception anyway. + try{ + xCloseable->close(sal_True); + } + catch( util::CloseVetoException ) { - xDisposable->dispose(); + //close is cancelled, nothing to do } - catch( uno::Exception& ) + } + // If close is not supported by this model - try to dispose it. + // But if the model disagree with a reset request for the modify state + // we shouldn't do so. Otherwhise some strange things can happen. + else + { + uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY ); + if ( xDisposable.is() ) { + // To be on the safe side, catch possible veto exception anyway. + try + { + xDisposable->dispose(); + } + catch( uno::Exception& ) + { + } } } } @@ -195,7 +234,22 @@ void VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) { uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - xModifiable->setModified( !bSave ); + try + { + xModifiable->setModified( !bSave ); + } + catch ( lang::DisposedException& ) + { + // impossibility to set the modified state on disposed document should not trigger an error + } + catch ( beans::PropertyVetoException& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't change modified state of model!" ) ), + uno::Reference< uno::XInterface >(), + aCaught ); + } } sal_Bool @@ -227,7 +281,7 @@ VbaDocumentBase::getVBProject() throw (uno::RuntimeException) { uno::Sequence< uno::Any > aArgs( 2 ); aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this ); - aArgs[ 1 ] <<= mxModel; + aArgs[ 1 ] <<= getModel(); uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); uno::Reference< uno::XInterface > xVBProjects = xServiceManager->createInstanceWithArgumentsAndContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBProject" ) ), aArgs, mxContext ); diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 462d93fcfd67..d4d9ce700e66 100644..100755 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -25,7 +25,10 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <vbahelper/vbadocumentsbase.hxx> + +#include "vbahelper/vbadocumentsbase.hxx" + +#include <comphelper/mediadescriptor.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase3.hxx> @@ -50,11 +53,13 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <sfx2/objsh.hxx> #include <tools/urlobj.hxx> -#include <vbahelper/vbahelper.hxx> #include <vbahelper/vbadocumentbase.hxx> #include <boost/unordered_map.hpp> #include <osl/file.hxx> +#include "vbahelper/vbahelper.hxx" +#include "vbahelper/vbaapplicationbase.hxx" + using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -220,10 +225,40 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP { } -uno::Any SAL_CALL -VbaDocumentsBase::Add() throw (uno::RuntimeException) +namespace { + +void lclSetupComponent( const uno::Reference< lang::XComponent >& rxComponent, sal_Bool bScreenUpdating, sal_Bool bInteractive ) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( + if( !bScreenUpdating ) try + { + uno::Reference< frame::XModel >( rxComponent, uno::UNO_QUERY_THROW )->lockControllers(); + } + catch( uno::Exception& ) + { + } + + if( !bInteractive ) try + { + uno::Reference< frame::XModel > xModel( rxComponent, uno::UNO_QUERY_THROW ); + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); + uno::Reference< awt::XWindow >( xFrame->getContainerWindow(), uno::UNO_SET_THROW )->setEnable( sal_False ); + } + catch( uno::Exception& ) + { + } +} + +} // namespace + +uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException) +{ + // #163808# determine state of Application.ScreenUpdating and Application.Interactive symbols (before new document is opened) + uno::Reference< XApplicationBase > xApplication( Application(), uno::UNO_QUERY ); + sal_Bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating(); + sal_Bool bInteractive = !xApplication.is() || xApplication->getInteractive(); + + uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XComponentLoader > xLoader( @@ -237,15 +272,25 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException) sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ); else throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + + // prepare the media descriptor + ::comphelper::MediaDescriptor aMediaDesc; + aMediaDesc[ ::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE() ] <<= document::MacroExecMode::USE_CONFIG; + aMediaDesc.setComponentDataEntry( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ApplyFormDesignMode" ) ), uno::Any( false ) ); + + // craete the new document uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( sURL , rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, - uno::Sequence< beans::PropertyValue >(0) ); + aMediaDesc.getAsConstPropertyValueList() ); + + // #163808# lock document controllers and container window if specified by application + lclSetupComponent( xComponent, bScreenUpdating, bInteractive ); + return uno::makeAny( xComponent ); } -void -VbaDocumentsBase::Close() throw (uno::RuntimeException) +void VbaDocumentsBase::closeDocuments() throw (uno::RuntimeException) { // #FIXME this *MUST* be wrong documents::close surely closes ALL documents // in the collection, use of getCurrentDocument here is totally wrong @@ -259,9 +304,13 @@ VbaDocumentsBase::Close() throw (uno::RuntimeException) } // #TODO# #FIXME# can any of the unused params below be used? -uno::Any -VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) { + // #163808# determine state of Application.ScreenUpdating and Application.Interactive symbols (before new document is opened) + uno::Reference< XApplicationBase > xApplication( Application(), uno::UNO_QUERY ); + sal_Bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating(); + sal_Bool bInteractive = !xApplication.is() || xApplication->getInteractive(); + // we need to detect if this is a URL, if not then assume its a file path rtl::OUString aURL; INetURLObject aObj; @@ -285,19 +334,16 @@ VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly uno::Sequence< beans::PropertyValue > sProps( rProps ); sProps.realloc( sProps.getLength() + 1 ); sProps[ sProps.getLength() - 1 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode") ); - sProps[ sProps.getLength() - 1 ].Value <<= uno::makeAny( document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN ); - - sal_Int32 nIndex = sProps.getLength() - 1; + sProps[ sProps.getLength() - 1 ].Value <<= document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN; if ( ReadOnly.hasValue() ) { sal_Bool bIsReadOnly = sal_False; ReadOnly >>= bIsReadOnly; if ( bIsReadOnly ) { - static const rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); sProps.realloc( sProps.getLength() + 1 ); - sProps[ nIndex ].Name = sReadOnly; - sProps[ nIndex++ ].Value = uno::makeAny( (sal_Bool)sal_True ); + sProps[ sProps.getLength() - 1 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); + sProps[ sProps.getLength() - 1 ].Value <<= true; } } @@ -305,6 +351,10 @@ VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ), frame::FrameSearchFlag::CREATE, sProps); + + // #163808# lock document controllers and container window if specified by application + lclSetupComponent( xComponent, bScreenUpdating, bInteractive ); + return uno::makeAny( xComponent ); } diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index d70a8046512a..836e6325c01b 100644..100755 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -75,10 +75,6 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un EventQueue aEventQueue; aEventQueue.push_back( EventQueueEntry( nEventId, rArgs ) ); - /* bEnabled will track if event processing is enabled. Every event handler - may disable handling of other events. */ - bool bEnabled = true; - /* bCancel will contain the current Cancel value. It is possible that multiple events will try to modify the Cancel value. Every event handler receives the Cancel value of the previous event handler. */ @@ -88,10 +84,10 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un executed successfully. */ bool bSuccess = false; - /* Loop as long as there are more events to be processed, and as event - handling is still enabled. Derived classes may add new events to be - processed in the virtual implPrepareEvent() function. */ - while( bEnabled && !aEventQueue.empty() ) + /* Loop as long as there are more events to be processed. Derived classes + may add new events to be processed in the virtual implPrepareEvent() + function. */ + while( !aEventQueue.empty() ) { /* Check that all class members are available, and that we are not disposed (this may have happened at any time during execution of @@ -104,14 +100,14 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs; aEventQueue.pop_front(); - // let derived classes decide whether event processing is still enabled - bEnabled = implEventsEnabled(); - // let derived classes prepare the event, they may add new events for next iteration - if( bEnabled && implPrepareEvent( aEventQueue, rInfo, aEventArgs ) ) + /* Let derived classes prepare the event, they may add new events for + next iteration. If false is returned, the event handler must not be + called. */ + bool bEventSuccess = false; + if( implPrepareEvent( aEventQueue, rInfo, aEventArgs ) ) { // search the event handler macro in the document ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs ); - bool bEventSuccess = false; if( aMacroPath.getLength() > 0 ) { // build the argument list @@ -140,11 +136,11 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un bCancel = nNewCancel != 0; } } - // post processing (also, if event handler does not exist, or on error - implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel ); // global success, if at least one event handler succeeded bSuccess |= bEventSuccess; } + // post processing (also, if event handler does not exist, or disabled, or on error + implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel ); } // if event handlers want to cancel the event, do so regardless of any errors @@ -201,7 +197,8 @@ const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandle append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear(); break; } - return resolveVBAMacro( mpShell, aMacroName ).ResolvedMacro(); + MacroResolvedInfo aMacroInfo = resolveVBAMacro( mpShell, aMacroName, false ); + return aMacroInfo.mbFound ? ::rtl::OUString( aMacroInfo.msResolvedMacro ) : ::rtl::OUString(); } void VbaEventsHelperBase::stopListening() diff --git a/vbahelper/source/vbahelper/vbafillformat.cxx b/vbahelper/source/vbahelper/vbafillformat.cxx index 463860c07aa3..463860c07aa3 100644..100755 --- a/vbahelper/source/vbahelper/vbafillformat.cxx +++ b/vbahelper/source/vbahelper/vbafillformat.cxx diff --git a/vbahelper/source/vbahelper/vbafillformat.hxx b/vbahelper/source/vbahelper/vbafillformat.hxx index 6cdaf0e0cd17..6cdaf0e0cd17 100644..100755 --- a/vbahelper/source/vbahelper/vbafillformat.hxx +++ b/vbahelper/source/vbahelper/vbafillformat.hxx diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx index 3f681c6eec68..3f681c6eec68 100644..100755 --- a/vbahelper/source/vbahelper/vbafontbase.cxx +++ b/vbahelper/source/vbahelper/vbafontbase.cxx diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx index 7e6d365823c8..7e6d365823c8 100644..100755 --- a/vbahelper/source/vbahelper/vbaglobalbase.cxx +++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index cc692b0ce685..2ef6ae939b1f 100644..100755 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -41,6 +41,9 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XIntrospection.hpp> #include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/awt/PosSize.hpp> #include <ooo/vba/msforms/XShape.hpp> @@ -142,7 +145,7 @@ aNULL() return aNULLL; } -void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall) +void dispatchExecute(SfxViewShell* pViewShell, sal_uInt16 nSlot, SfxCallMode nCall) { SfxViewFrame* pViewFrame = NULL; if ( pViewShell ) @@ -461,7 +464,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno:: } } else - pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs ); + pDispatcher->Execute( (sal_uInt16)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs ); } } @@ -733,6 +736,9 @@ ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::u { m_pShapeHelper.reset( new ShapeHelper( xShape ) ); } +ConcreteXShapeGeometryAttributes::~ConcreteXShapeGeometryAttributes() +{ +} sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel ) { @@ -875,277 +881,122 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con // ====UserFormGeomentryHelper==== //--------------------------------------------- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) +: mbDialog( uno::Reference< awt::XDialog >( xControl, uno::UNO_QUERY ).is() ) { if ( !xControl.is() ) - throw uno::RuntimeException(); - - mxControlUnits.set( xControl->getPeer(), uno::UNO_QUERY_THROW ); - mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW ); -} - -//--------------------------------------------- -sal_Int32 UserFormGeometryHelper::ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit ) -{ - sal_Int32 nResult = 0; - if ( bIsPoint ) - { - // conversion for a point - awt::Point aPixelPoint( 0, 0 ); - ( bIsX ? aPixelPoint.X : aPixelPoint.Y ) = nValue; - awt::Point aTargetPoint( 0, 0 ); - aTargetPoint = mxControlUnits->convertPointToLogic( aPixelPoint, nTargetUnit ); - - nResult = bIsX ? aTargetPoint.X : aTargetPoint.Y; - } - else - { - // conversion for a size - awt::Size aPixelSize( 0, 0 ); - ( bIsX ? aPixelSize.Width : aPixelSize.Height ) = nValue; - awt::Size aTargetSize( 0, 0 ); - aTargetSize = mxControlUnits->convertSizeToLogic( aPixelSize, nTargetUnit ); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No control is provided!" ) ), + uno::Reference< uno::XInterface >() ); - nResult = bIsX ? aTargetSize.Width : aTargetSize.Height; - } - - return nResult; + mxWindow.set( xControl->getPeer(), uno::UNO_QUERY_THROW ); } //--------------------------------------------- -sal_Int32 UserFormGeometryHelper::ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit ) -{ - sal_Int32 nResult = 0; - if ( bIsPoint ) - { - // conversion for a point - awt::Point aSourcePoint( 0, 0 ); - ( bIsX ? aSourcePoint.X : aSourcePoint.Y ) = nValue; - - awt::Point aPixelPoint( 0, 0 ); - aPixelPoint = mxControlUnits->convertPointToPixel( aSourcePoint, nSourceUnit ); - - nResult = bIsX ? aPixelPoint.X : aPixelPoint.Y; - } - else - { - // conversion for a size - awt::Size aSourceSize( 0, 0 ); - ( bIsX ? aSourceSize.Width : aSourceSize.Height ) = nValue; - - awt::Size aPixelSize( 0, 0 ); - aPixelSize = mxControlUnits->convertSizeToPixel( aSourceSize, nSourceUnit ); - - nResult = bIsX ? aPixelSize.Width : aPixelSize.Height; - } - - return nResult; -} -//--------------------------------------------- double UserFormGeometryHelper::getLeft() { - double nResult = 0; - - try - { - sal_Int32 nLeft = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft; - nResult = ConvertLogicToPixel( nLeft, - sal_True, // Point - sal_True, // X - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position X!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); - } - - return nResult; + return mxWindow->getPosSize().X; } //--------------------------------------------- void UserFormGeometryHelper::setLeft( double nLeft ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), - uno::makeAny( ConvertPixelToLogic( nLeft, - sal_True, // Point - sal_True, // X - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); - } + mxWindow->setPosSize( nLeft, mxWindow->getPosSize().Y, 0, 0, awt::PosSize::POS ); } //--------------------------------------------- double UserFormGeometryHelper::getTop() { - double nResult = 0; - - try - { - sal_Int32 nTop = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop; - nResult = ConvertLogicToPixel( nTop, - sal_True, // Point - sal_False, // Y - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position Y!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); - } - - return nResult; + return mxWindow->getPosSize().Y; } //--------------------------------------------- void UserFormGeometryHelper::setTop( double nTop ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), - uno::makeAny( ConvertPixelToLogic( nTop, - sal_True, // Point - sal_False, // Y - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); - } + mxWindow->setPosSize( mxWindow->getPosSize().X, nTop, 0, 0, awt::PosSize::POS ); } //--------------------------------------------- double UserFormGeometryHelper::getWidth() { - double nResult = 0; - - try - { - sal_Int32 nWidth = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_WIDTH ) ) ) >>= nWidth; - nResult = ConvertLogicToPixel( nWidth, - sal_False, // Size - sal_True, // X - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) + if ( mbDialog ) { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get width!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // get the size with decoration + Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); + return aResult.getWidth(); + } } - return nResult; + return mxWindow->getPosSize().Width; } //--------------------------------------------- -void UserFormGeometryHelper::setWidth( double nWidth) +void UserFormGeometryHelper::setWidth( double nWidth ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_WIDTH ) ), - uno::makeAny( ConvertPixelToLogic( nWidth, - sal_False, // Size - sal_True, // X - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) + sal_Int64 nNewWidth = nWidth; + + if ( mbDialog ) { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set width!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // set the size with decoration + Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); + if ( !aRDecor.IsEmpty() ) + { + sal_Int64 nDecor = aRDecor.getWidth(); + sal_Int64 nUnDecor = mxWindow->getPosSize().Width; + if ( nWidth < nDecor - nUnDecor ) + nUnDecor = nDecor - nWidth; // avoid negative size + nNewWidth = nWidth + nUnDecor - nDecor; + } + } } + + mxWindow->setPosSize( 0, 0, nNewWidth, 0, awt::PosSize::WIDTH ); } //--------------------------------------------- double UserFormGeometryHelper::getHeight() { - double nResult = 0; - - try + if ( mbDialog ) { - sal_Int32 nHeight = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_HEIGHT ) ) ) >>= nHeight; - nResult = ConvertLogicToPixel( nHeight, - sal_False, // Size - sal_False, // Y - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get height!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // get the size with decoration + Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); + return aResult.getHeight(); + } } - return nResult; + return mxWindow->getPosSize().Height; } //--------------------------------------------- void UserFormGeometryHelper::setHeight( double nHeight ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_HEIGHT ) ), - uno::makeAny( ConvertPixelToLogic( nHeight, - sal_False, // Size - sal_False, // Y - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) + sal_Int64 nNewHeight = nHeight; + if ( mbDialog ) { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set height!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // set the size with decoration + Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); + if ( !aRDecor.IsEmpty() ) + { + sal_Int64 nDecor = aRDecor.getHeight(); + sal_Int64 nUnDecor = mxWindow->getPosSize().Height; + if ( nHeight < nDecor - nUnDecor ) + nUnDecor = nDecor - nHeight; // avoid negative size + nNewHeight = nHeight + nUnDecor - nDecor; + } + } } + + mxWindow->setPosSize( 0, 0, 0, nNewHeight, awt::PosSize::HEIGHT ); } // ============ diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx index 4a66960763dc..4a66960763dc 100644..100755 --- a/vbahelper/source/vbahelper/vbalineformat.cxx +++ b/vbahelper/source/vbahelper/vbalineformat.cxx diff --git a/vbahelper/source/vbahelper/vbalineformat.hxx b/vbahelper/source/vbahelper/vbalineformat.hxx index 4e74ae827227..4e74ae827227 100644..100755 --- a/vbahelper/source/vbahelper/vbalineformat.hxx +++ b/vbahelper/source/vbahelper/vbalineformat.hxx diff --git a/vbahelper/source/vbahelper/vbapagesetupbase.cxx b/vbahelper/source/vbahelper/vbapagesetupbase.cxx index 976fc232cc5b..976fc232cc5b 100644..100755 --- a/vbahelper/source/vbahelper/vbapagesetupbase.cxx +++ b/vbahelper/source/vbahelper/vbapagesetupbase.cxx diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx index 26d4424e427b..26d4424e427b 100644..100755 --- a/vbahelper/source/vbahelper/vbapictureformat.cxx +++ b/vbahelper/source/vbahelper/vbapictureformat.cxx diff --git a/vbahelper/source/vbahelper/vbapictureformat.hxx b/vbahelper/source/vbahelper/vbapictureformat.hxx index 56422cc7b623..56422cc7b623 100644..100755 --- a/vbahelper/source/vbahelper/vbapictureformat.hxx +++ b/vbahelper/source/vbahelper/vbapictureformat.hxx diff --git a/vbahelper/source/vbahelper/vbapropvalue.cxx b/vbahelper/source/vbahelper/vbapropvalue.cxx index 87a4e40e882c..87a4e40e882c 100644..100755 --- a/vbahelper/source/vbahelper/vbapropvalue.cxx +++ b/vbahelper/source/vbahelper/vbapropvalue.cxx diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx index ca368e447118..ca368e447118 100644..100755 --- a/vbahelper/source/vbahelper/vbashape.cxx +++ b/vbahelper/source/vbahelper/vbashape.cxx diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx index 44f2845d36d4..44f2845d36d4 100644..100755 --- a/vbahelper/source/vbahelper/vbashaperange.cxx +++ b/vbahelper/source/vbahelper/vbashaperange.cxx diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index 761d8de625f3..761d8de625f3 100644..100755 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx index 1a98998c8dca..1a98998c8dca 100644..100755 --- a/vbahelper/source/vbahelper/vbatextframe.cxx +++ b/vbahelper/source/vbahelper/vbatextframe.cxx diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx index 853dd47bf61e..aa2d911caba7 100644..100755 --- a/vbahelper/source/vbahelper/vbawindowbase.cxx +++ b/vbahelper/source/vbahelper/vbawindowbase.cxx @@ -81,7 +81,7 @@ css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel ) return aRect; } -void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, USHORT nFlag ) +void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, sal_uInt16 nFlag ) { uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW ); diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk index a09ffa594483..a09ffa594483 100644..100755 --- a/vbahelper/util/makefile.mk +++ b/vbahelper/util/makefile.mk diff --git a/vbahelper/util/msforms.component b/vbahelper/util/msforms.component new file mode 100755 index 000000000000..98ce4a8451d4 --- /dev/null +++ b/vbahelper/util/msforms.component @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="ControlProviderImpl"> + <service name="ooo.vba.ControlProvider"/> + </implementation> + <implementation name="ScVbaUserForm"> + <service name="ooo.vba.msforms.UserForm"/> + </implementation> +</component> |