diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:24:29 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:24:29 +0200 |
commit | 92667c8edbaee9a252b1d5d221eb62849f76697c (patch) | |
tree | 8f1d329f2259b7d5bff054bc14d0965637df6961 /vbahelper | |
parent | fixing rebase errors (diff) | |
parent | remove unused define (diff) | |
download | core-92667c8edbaee9a252b1d5d221eb62849f76697c.tar.gz core-92667c8edbaee9a252b1d5d221eb62849f76697c.zip |
Merge branch 'master' into feature/gnumake4
Conflicts:
connectivity/source/cpool/Zregistration.cxx
connectivity/source/drivers/evoab/LCatalog.cxx
connectivity/source/drivers/evoab/LColumnAlias.cxx
connectivity/source/drivers/evoab/LColumnAlias.hxx
connectivity/source/drivers/evoab/LColumns.cxx
connectivity/source/drivers/evoab/LColumns.hxx
connectivity/source/drivers/evoab/LConfigAccess.cxx
connectivity/source/drivers/evoab/LConfigAccess.hxx
connectivity/source/drivers/evoab/LConnection.cxx
connectivity/source/drivers/evoab/LConnection.hxx
connectivity/source/drivers/evoab/LDatabaseMetaData.cxx
connectivity/source/drivers/evoab/LDatabaseMetaData.hxx
connectivity/source/drivers/evoab/LDriver.cxx
connectivity/source/drivers/evoab/LDriver.hxx
connectivity/source/drivers/evoab/LFolderList.cxx
connectivity/source/drivers/evoab/LFolderList.hxx
connectivity/source/drivers/evoab/LNoException.cxx
connectivity/source/drivers/evoab/LPreparedStatement.cxx
connectivity/source/drivers/evoab/LPreparedStatement.hxx
connectivity/source/drivers/evoab/LResultSet.cxx
connectivity/source/drivers/evoab/LResultSet.hxx
connectivity/source/drivers/evoab/LServices.cxx
connectivity/source/drivers/evoab/LStatement.cxx
connectivity/source/drivers/evoab/LStatement.hxx
connectivity/source/drivers/evoab/LTable.cxx
connectivity/source/drivers/evoab/LTable.hxx
connectivity/source/drivers/evoab/LTables.cxx
connectivity/source/drivers/evoab/LTables.hxx
connectivity/source/drivers/evoab/evoab.xml
connectivity/source/drivers/evoab/makefile.mk
editeng/Library_editeng.mk
framework/Library_fwe.mk
framework/test/test.cxx
idl/prj/d.lst
idl/util/idlpch.cxx
linguistic/Makefile
linguistic/Module_linguistic.mk
linguistic/inc/linguistic/lngdllapi.h
linguistic/inc/linguistic/lngprophelp.hxx
linguistic/inc/linguistic/misc.hxx
linguistic/prj/build.lst
linguistic/prj/d.lst
linguistic/qa/unoapi/Test.java
linguistic/source/grammarchecker.cxx
linguistic/source/grammarchecker.hxx
linguistic/source/hyphdta.cxx
linguistic/source/lngprophelp.cxx
linguistic/source/makefile.mk
linguistic/source/spelldta.cxx
sfx2/Library_qstart.mk
sfx2/Library_sfx.mk
sfx2/inc/sfx2/qswin32.h
sfx2/prj/build.lst
sfx2/qa/cppunit/makefile.mk
xmlscript/inc/xmlscript/xcrdllapi.h
xmlscript/prj/d.lst
xmlscript/util/makefile.mk
Diffstat (limited to 'vbahelper')
104 files changed, 1588 insertions, 691 deletions
diff --git a/vbahelper/Library_msforms.mk b/vbahelper/Library_msforms.mk index 58a90a7ccd42..e1b00c72643e 100755 --- a/vbahelper/Library_msforms.mk +++ b/vbahelper/Library_msforms.mk @@ -56,7 +56,6 @@ $(eval $(call gb_Library_add_linked_libs,msforms,\ svl \ svt \ svx \ - stl \ tk \ tl \ vbahelper \ diff --git a/vbahelper/Library_vbahelper.mk b/vbahelper/Library_vbahelper.mk index 380b0d0bc55c..45691f8066a7 100755 --- a/vbahelper/Library_vbahelper.mk +++ b/vbahelper/Library_vbahelper.mk @@ -56,7 +56,6 @@ $(eval $(call gb_Library_add_linked_libs,vbahelper,\ sal \ sb \ sfx \ - stl \ svl \ svt \ svxcore \ diff --git a/vbahelper/inc/vbahelper/helperdecl.hxx b/vbahelper/inc/vbahelper/helperdecl.hxx index 0b51c6242226..930041d3fe1e 100644 --- a/vbahelper/inc/vbahelper/helperdecl.hxx +++ b/vbahelper/inc/vbahelper/helperdecl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,3 +54,5 @@ struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<Impl } // namespace service_decl } // namespace comphelper #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx index 9fcfde744bbc..85a109b5f0ac 100644 --- a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx +++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: vbahelper.hxx,v $ - * $Revision: 1.5.32.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -53,7 +51,7 @@ namespace ooo return xVBAFactory; } - VBAHELPER_DLLPUBLIC inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException) + VBAHELPER_DLLPRIVATE inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException) { OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" ); ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); @@ -70,10 +68,14 @@ namespace ooo bRes = ( pFilt->GetMimeType().CompareToAscii( pMimeType ) == 0 ); return bRes; } - VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); } - VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); } + VBAHELPER_DLLPRIVATE inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); } + //VBAHELPER_DLLPRIVATE inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); } + // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one + VBAHELPER_DLLPRIVATE inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); } } // openoffice } // org #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx index 10cf0ba6ab70..7d21d3ed453b 100644 --- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx +++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,7 +62,7 @@ public: virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException); - virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException); virtual void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::uno::RuntimeException); virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); virtual void SAL_CALL Undo() throw (css::uno::RuntimeException); @@ -72,3 +73,5 @@ public: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx index da0fd29267ae..a0447bde4ef0 100644 --- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx +++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -243,12 +244,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase; protected: css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess; css::uno::Reference< css::container::XNameAccess > m_xNameAccess; + sal_Bool mbIgnoreCase; virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException) { if ( !m_xNameAccess.is() ) throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() ); + if( mbIgnoreCase ) + { + css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames(); + for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ ) + { + rtl::OUString aName = sElementNames[i]; + if( aName.equalsIgnoreAsciiCase( sIndex ) ) + { + return createCollectionObject( m_xNameAccess->getByName( aName ) ); + } + } + } return createCollectionObject( m_xNameAccess->getByName( sIndex ) ); } @@ -275,7 +289,7 @@ protected: } public: - ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); } + ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); } //XCollection virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException) { @@ -291,8 +305,8 @@ public: if ( ( Index1 >>= nIndex ) != sal_True ) { rtl::OUString message; - message = rtl::OUString::createFromAscii( - "Couldn't convert index to Int32"); + message = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Couldn't convert index to Int32")); throw css::lang::IndexOutOfBoundsException( message, css::uno::Reference< css::uno::XInterface >() ); } @@ -340,8 +354,10 @@ class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1; public: - CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {} + CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {} }; #endif //SC_VBA_COLLECTION_IMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbadialogbase.hxx b/vbahelper/inc/vbahelper/vbadialogbase.hxx index 79c3fa551073..acf4b7e1ddb7 100644 --- a/vbahelper/inc/vbahelper/vbadialogbase.hxx +++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,8 +45,10 @@ public: virtual ~VbaDialogBase() {} // Methods - virtual void SAL_CALL Show() throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL Show() throw (css::uno::RuntimeException); virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0; }; #endif /* VBA_DIALOG_BASE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbadialogsbase.hxx b/vbahelper/inc/vbahelper/vbadialogsbase.hxx index 408a156ac3bc..a20903094092 100644 --- a/vbahelper/inc/vbahelper/vbadialogsbase.hxx +++ b/vbahelper/inc/vbahelper/vbadialogsbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,3 +50,5 @@ public: }; #endif /* VBA_DIALOGS_BASE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbadllapi.h b/vbahelper/inc/vbahelper/vbadllapi.h index 1768802c5176..f3e6c5e581bf 100644..100755 --- a/vbahelper/inc/vbahelper/vbadllapi.h +++ b/vbahelper/inc/vbahelper/vbadllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,3 +40,4 @@ #endif /* INCLUDED_SVLDLLAPI_H */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx index d1c7320fbfb1..d2c1a1ad7e29 100644 --- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx +++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,7 +60,7 @@ public: virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges, const css::uno::Any &aFileName, const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Protect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException); virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException); virtual void SAL_CALL Save() throw (css::uno::RuntimeException); virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); @@ -70,3 +71,5 @@ public: }; #endif /* VBA_DOCUMENTBASE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx index 8e4554b74b3d..1587091bfd4c 100644 --- a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx +++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,3 +65,5 @@ protected: }; #endif /* SC_VBA_WORKBOOKS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx index dc554d6a043f..86647c565f18 100755..100644 --- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx +++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,8 +30,8 @@ #define VBAHELPER_VBAEVENTSHELPERBASE_HXX #include <deque> -#include <hash_map> #include <map> +#include <boost/unordered_map.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> #include <com/sun/star/util/XChangesListener.hpp> @@ -134,7 +135,7 @@ protected: const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException) = 0; /** Derived classes may do additional postprocessing. Called even if the - event handler does not exist, or if an error occured during execution. */ + event handler does not exist, or if an error occurred during execution. */ virtual void implPostProcessEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, @@ -176,7 +177,7 @@ protected: private: typedef ::std::map< sal_Int32, EventHandlerInfo > EventHandlerInfoMap; - typedef ::std::hash_map< ::rtl::OUString, ModulePathMap, ::rtl::OUStringHash > EventHandlerPathMap; + typedef boost::unordered_map< ::rtl::OUString, ModulePathMap, ::rtl::OUStringHash > EventHandlerPathMap; EventHandlerInfoMap maEventInfos; EventHandlerPathMap maEventPaths; @@ -188,3 +189,5 @@ private: // ============================================================================ #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx index d1272c9dcf48..8e2ad0fd5dda 100644 --- a/vbahelper/inc/vbahelper/vbafontbase.hxx +++ b/vbahelper/inc/vbahelper/vbafontbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,3 +102,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx index 61aaa1d65657..1f7d7a280f56 100644 --- a/vbahelper/inc/vbahelper/vbaglobalbase.hxx +++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,3 +49,5 @@ public: virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx index bf20541eff1e..00dfe585c9d7 100644 --- a/vbahelper/inc/vbahelper/vbahelper.hxx +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,6 +36,10 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> +#include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/awt/XUnitConversion.hpp> #include <basic/basmgr.hxx> #include <basic/sberrors.hxx> @@ -82,7 +87,7 @@ namespace ooo VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl ); - VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps ); + VBAHELPER_DLLPUBLIC void 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, sal_uInt16 nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); @@ -126,8 +131,10 @@ namespace ooo VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& ); VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite ); VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException ); + VBAHELPER_DLLPUBLIC css::uno::Any getDefaultPropByIntrospection( const css::uno::Any& aObj ) throw ( css::uno::RuntimeException ); VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName ); VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue ); + VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue ); class VBAHELPER_DLLPUBLIC Millimeter { @@ -267,19 +274,32 @@ public: static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ); - static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ); + static void exception( const css::uno::Exception& ex ) throw( css::script::BasicErrorException ); }; + +class VBAHELPER_DLLPUBLIC VBADispatchListener : public cppu::WeakImplHelper1< css::frame::XDispatchResultListener > +{ +private: + css::uno::Any m_Result; + sal_Bool m_State; + +public: + VBADispatchListener(); + ~VBADispatchListener(); + + css::uno::Any getResult() { return m_Result; } + sal_Bool getState() { return m_State; } + + // XDispatchResultListener + virtual void SAL_CALL dispatchFinished( const css::frame::DispatchResultEvent& aEvent ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw ( css::uno::RuntimeException ); +}; + } // vba } // ooo namespace ov = ooo::vba; -#ifdef DEBUG -# define SC_VBA_FIXME(a) OSL_TRACE( a ) -# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ )) -#else -# define SC_VBA_FIXME(a) -# define SC_VBA_STUB() #endif -#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx index dcd04af3d55f..33bcd40edad5 100644 --- a/vbahelper/inc/vbahelper/vbahelperinterface.hxx +++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -191,3 +192,5 @@ VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename ) // ============================================================================ #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx index 09ad2f91d654..a4294f425705 100644 --- a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx +++ b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ public: virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbapropvalue.hxx b/vbahelper/inc/vbahelper/vbapropvalue.hxx index 1efef8f8c05e..70e4c3aff2a9 100644 --- a/vbahelper/inc/vbahelper/vbapropvalue.hxx +++ b/vbahelper/inc/vbahelper/vbapropvalue.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,7 +52,9 @@ public: virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); - rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } }; #endif //SC_VBA_PROPVALULE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx index 87c640db203a..93f670f1d5fe 100644 --- a/vbahelper/inc/vbahelper/vbashape.hxx +++ b/vbahelper/inc/vbahelper/vbashape.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,7 +110,10 @@ public: // Replace?? virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException); // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException ); }; #endif//SC_VBA_SHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbashaperange.hxx b/vbahelper/inc/vbahelper/vbashaperange.hxx index a4cc35958ef2..7a580dac5e77 100644 --- a/vbahelper/inc/vbahelper/vbashaperange.hxx +++ b/vbahelper/inc/vbahelper/vbashaperange.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,6 +57,8 @@ public: virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ; virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); @@ -76,6 +79,7 @@ public: virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException); //XEnumerationAccess virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); @@ -84,3 +88,5 @@ public: }; #endif//SC_VBA_SHAPERANGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbashapes.hxx b/vbahelper/inc/vbahelper/vbashapes.hxx index 18e123a9c7f6..86e1ba3c6f37 100644 --- a/vbahelper/inc/vbahelper/vbashapes.hxx +++ b/vbahelper/inc/vbahelper/vbashapes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,5 @@ public: }; #endif//SC_VBA_SHAPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbatextframe.hxx b/vbahelper/inc/vbahelper/vbatextframe.hxx index 91bc4525b973..584e2559315c 100644 --- a/vbahelper/inc/vbahelper/vbatextframe.hxx +++ b/vbahelper/inc/vbahelper/vbatextframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ public: }; #endif//SC_VBA_TEXTFRAME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/inc/vbahelper/vbawindowbase.hxx b/vbahelper/inc/vbahelper/vbawindowbase.hxx index e9f1d40e4bd4..40119b4ea7a3 100644 --- a/vbahelper/inc/vbahelper/vbawindowbase.hxx +++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ private: }; #endif //VBA_WINDOWBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/prj/build.lst b/vbahelper/prj/build.lst index be2e516de360..8c411d422e29 100644 --- a/vbahelper/prj/build.lst +++ b/vbahelper/prj/build.lst @@ -1,3 +1,3 @@ -vba vbahelper : oovbaapi offuh basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal unotools LIBXSLT:libxslt 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\prj nmake - all vba_prj NULL diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst index e69de29bb2d1..470676b2e9b0 100644 --- a/vbahelper/prj/d.lst +++ b/vbahelper/prj/d.lst @@ -0,0 +1 @@ +..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc\vbahelper\vbaeventshelperbase.hxx diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk new file mode 100755 index 000000000000..30ce22139ce4 --- /dev/null +++ b/vbahelper/source/msforms/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# 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=..$/.. +PRJNAME=vbahelper +TARGET=msforms + +ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +CDEFS+=-DVBA_OOBUILD_HACK + +SLOFILES=\ + $(SLO)$/vbacontrol.obj \ + $(SLO)$/vbacontrols.obj \ + $(SLO)$/vbabutton.obj \ + $(SLO)$/vbacombobox.obj \ + $(SLO)$/vbalabel.obj \ + $(SLO)$/vbatextbox.obj \ + $(SLO)$/vbaradiobutton.obj \ + $(SLO)$/vbalistbox.obj \ + $(SLO)$/vbatogglebutton.obj \ + $(SLO)$/vbacheckbox.obj \ + $(SLO)$/vbaframe.obj \ + $(SLO)$/vbascrollbar.obj \ + $(SLO)$/vbaprogressbar.obj \ + $(SLO)$/vbamultipage.obj \ + $(SLO)$/vbalistcontrolhelper.obj \ + $(SLO)$/vbaspinbutton.obj \ + $(SLO)$/vbasystemaxcontrol.obj \ + $(SLO)$/vbaimage.obj \ + $(SLO)$/vbapages.obj \ + $(SLO)$/vbauserform.obj \ + $(SLO)$/service.obj \ + +# #FIXME vbapropvalue needs to move to vbahelper + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +ALLTAR : \ + $(MISC)$/$(TARGET).don \ + +$(SLOFILES) : $(MISC)$/$(TARGET).don + +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ + echo $@ + diff --git a/vbahelper/source/msforms/service.cxx b/vbahelper/source/msforms/service.cxx index 152517be3958..eca207f49ad9 100644 --- a/vbahelper/source/msforms/service.cxx +++ b/vbahelper/source/msforms/service.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ extern "C" return pRet; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx index 775a05cbb5b5..f0763330c8e2 100644 --- a/vbahelper/source/msforms/vbabutton.cxx +++ b/vbahelper/source/msforms/vbabutton.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -120,3 +121,5 @@ ScVbaButton::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx index 93a55e1bf73a..e999acf26ed4 100644 --- a/vbahelper/source/msforms/vbabutton.hxx +++ b/vbahelper/source/msforms/vbabutton.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,5 @@ public: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_BUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx index 329586cf6b27..290cdd1a7e33 100644 --- a/vbahelper/source/msforms/vbacheckbox.cxx +++ b/vbahelper/source/msforms/vbacheckbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,6 +72,8 @@ void SAL_CALL ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) { sal_Int16 nValue = 0; + sal_Int16 nOldValue = 0; + m_xProps->getPropertyValue( STATE ) >>= nOldValue; sal_Bool bValue = false; if( _value >>= nValue ) { @@ -83,6 +86,8 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept nValue = 1; } m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); + if ( nValue != nOldValue ) + fireClickEvent(); } uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont() throw (uno::RuntimeException) @@ -109,3 +114,4 @@ ScVbaCheckbox::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx index 59e4d7e75e49..e6cc4fe47453 100644 --- a/vbahelper/source/msforms/vbacheckbox.hxx +++ b/vbahelper/source/msforms/vbacheckbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,10 +46,12 @@ public: virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } //XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_CHECKBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx index 9a75fa5cbaa1..6f5049c548e7 100644 --- a/vbahelper/source/msforms/vbacombobox.cxx +++ b/vbahelper/source/msforms/vbacombobox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,6 +27,10 @@ ************************************************************************/ #include "vbacombobox.hxx" +#include <vector> +#include <filter/msfilter/msvbahelper.hxx> +#include <basic/sbstar.hxx> +#include <basic/sbmod.hxx> #include "vbanewfont.hxx" #include <ooo/vba/msforms/fmStyle.hpp> #include <ooo/vba/msforms/fmDropButtonStyle.hpp> @@ -78,12 +83,18 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti sal_Int16 nIndex = 0; if( _value >>= nIndex ) { + sal_Int32 nOldIndex = -1; + getListIndex() >>= nOldIndex; uno::Sequence< rtl::OUString > sItems; m_xProps->getPropertyValue( ITEMS ) >>= sItems; if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) ) { rtl::OUString sText = sItems[ nIndex ]; m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) ); + + // fire the _Change event + if( nOldIndex != nIndex ) + fireClickEvent(); } } } @@ -118,8 +129,29 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException) void SAL_CALL ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) { + rtl::OUString sOldValue, sNewValue; + // booleans are converted to uppercase strings + sOldValue = extractStringFromAny( getValue(), ::rtl::OUString(), true ); // booleans are converted to uppercase strings - m_xProps->setPropertyValue( sSourceName, uno::Any( extractStringFromAny( _value, ::rtl::OUString(), true ) ) ); + sNewValue = extractStringFromAny( _value, ::rtl::OUString(), true ); + + m_xProps->setPropertyValue( sSourceName, uno::Any( sNewValue ) ); + + if ( sNewValue != sOldValue ) + { + // If the new value is in current list, we should fire click event, otherwise fire the change event. + sal_Int32 nListIndex = -1; + getListIndex() >>= nListIndex; + sal_Bool bIsInList = ( nListIndex >= 0 ); + if ( bIsInList ) + { + fireClickEvent(); + } + else + { + fireChangeEvent(); + } + } } // see Value @@ -258,3 +290,5 @@ ScVbaComboBox::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx index c73b617a743b..e2b1716e4685 100644 --- a/vbahelper/source/msforms/vbacombobox.hxx +++ b/vbahelper/source/msforms/vbacombobox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,10 +83,12 @@ public: virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); // XDefaultProperty - ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } //XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif // + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 780191885049..143db79e9c01 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,7 @@ #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/XActionListener.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XControlShape.hpp> @@ -39,6 +41,9 @@ #include <com/sun/star/form/binding/XListEntrySink.hpp> #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/script/XScriptListener.hpp> +#include <com/sun/star/document/XCodeNameQuery.hpp> +#include <com/sun/star/form/XChangeListener.hpp> #include <ooo/vba/XControlProvider.hpp> #ifdef VBA_OOBUILD_HACK #include <svtools/bindablecontrolhelper.hxx> @@ -90,7 +95,7 @@ ScVbaControl::getWindowPeer() throw (uno::RuntimeException) } catch( uno::Exception ) { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ), + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The Control does not exsit")), uno::Reference< uno::XInterface >() ); } return xWinPeer; @@ -127,7 +132,7 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE //ScVbaControl -ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel ) +ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), bIsDialog(false), m_xControl( xControl ), m_xModel( xModel ) { //add listener m_xEventListener.set( new ScVbaControlListener( this ) ); @@ -139,9 +144,18 @@ ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, c uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ; if ( xControlShape.is() ) // form control + { m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + rtl::OUString sDefaultControl; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sDefaultControl; + uno::Reference< lang::XMultiComponentFactory > xMFac( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + m_xEmptyFormControl.set( xMFac->createInstanceWithContext( sDefaultControl, mxContext ), uno::UNO_QUERY_THROW ); + } else if ( xUserFormControl.is() ) // userform control + { m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW ); + bIsDialog = true; + } } ScVbaControl::~ScVbaControl() @@ -397,6 +411,86 @@ void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag ) m_aControlTag = aTag; } +::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int32 nForeColor = -1; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor; + return OORGBToXLRGB( nForeColor ); +} + +void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) ); +} + +void ScVbaControl::fireEvent( script::ScriptEvent& evt ) +{ + uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), mxContext ), uno::UNO_QUERY_THROW ); + + uno::Reference< beans::XPropertySet > xProps( xScriptListener, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), uno::makeAny( m_xModel ) ); + + // handling for sheet control + uno::Reference< msforms::XControl > xThisControl( this ); + try + { + evt.Arguments.realloc( 1 ); + lang::EventObject aEvt; + + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ) ; + + if ( xControlShape.is() ) + { + evt.Source = xControlShape; + aEvt.Source = m_xEmptyFormControl; + // Set up proper scriptcode + uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VBACodeNameProvider")) ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf ); + evt.Arguments[ 0 ] = uno::makeAny( aEvt ); + xScriptListener->firing( evt ); + } + else + { + if ( xControl.is() ) // normal control ( from dialog/userform ) + { + // #FIXME We should probably store a reference to the + // parent dialog/userform here ( other wise the name of + // dialog could be changed and we won't be aware of it. + // ( OTOH this is probably an unlikely scenario ) + evt.Source = xThisControl; + aEvt.Source = xControl; + evt.ScriptCode = m_sLibraryAndCodeName; + evt.Arguments[ 0 ] = uno::makeAny( aEvt ); + xScriptListener->firing( evt ); + } + } + } + catch( uno::Exception& e ) + { + } +} +void ScVbaControl::fireChangeEvent() +{ + script::ScriptEvent evt; + evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") ); + evt.ListenerType = form::XChangeListener::static_type(0); + evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("changed") ); + fireEvent( evt ); +} + +void ScVbaControl::fireClickEvent() +{ + script::ScriptEvent evt; + evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") ); + evt.ListenerType = awt::XActionListener::static_type(0); + evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("actionPerformed") ); + fireEvent( evt ); +} + sal_Int32 SAL_CALL ScVbaControl::getTabIndex() throw (uno::RuntimeException) { return 1; @@ -420,7 +514,6 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess uno::Reference< drawing::XShape > xShape( xControlShape, uno::UNO_QUERY_THROW ); ::std::auto_ptr< ConcreteXShapeGeometryAttributes > xGeoHelper( new ConcreteXShapeGeometryAttributes( xContext, xShape ) ); - switch( nClassId ) { case form::FormComponentType::COMBOBOX: @@ -431,6 +524,8 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R return new ScVbaLabel( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() ); case form::FormComponentType::TEXTFIELD: return new ScVbaTextBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() ); + case form::FormComponentType::CHECKBOX: + return new ScVbaCheckbox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() ); case form::FormComponentType::RADIOBUTTON: return new ScVbaRadioButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() ); case form::FormComponentType::LISTBOX: @@ -440,7 +535,7 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R case form::FormComponentType::IMAGECONTROL: return new ScVbaImage( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() ); } - throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported control.")), uno::Reference< uno::XInterface >() ); } /*static*/ uno::Reference< msforms::XControl > ScVbaControlFactory::createUserformControl( @@ -491,10 +586,18 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R xVBAControl.set( new ScVbaSpinButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) ); else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) ) xVBAControl.set( new VbaSystemAXControl( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) ); - + // #FIXME implement a page control + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) ) + xVBAControl.set( new ScVbaControl( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) ) + xVBAControl.set( new ScVbaFrame( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), xDialog ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) + xVBAControl.set( new ScVbaSpinButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) ) + xVBAControl.set( new VbaSystemAXControl( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) ); if( xVBAControl.is() ) return xVBAControl; - throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported control.")), uno::Reference< uno::XInterface >() ); } rtl::OUString& @@ -516,8 +619,6 @@ ScVbaControl::getServiceNames() return aServiceNames; } - - typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE; class ControlProviderImpl : public ControlProvider_BASE { @@ -548,3 +649,4 @@ extern sdecl::ServiceDecl const serviceDecl( } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx index e421f919b6a4..9076a3e38071 100644 --- a/vbahelper/source/msforms/vbacontrol.hxx +++ b/vbahelper/source/msforms/vbacontrol.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,6 +35,7 @@ #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/script/ScriptEvent.hpp> #include <ooo/vba/msforms/XControl.hpp> #include <vbahelper/vbahelper.hxx> @@ -48,17 +50,23 @@ class ScVbaControl : public ControlImpl_BASE { private: com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener; + com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl; protected: // awt control has nothing similar to Tag property of Mso controls, // whether it is necessary is another question ::rtl::OUString m_aControlTag; + bool bIsDialog; + rtl::OUString m_sLibraryAndCodeName; std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper; css::uno::Reference< css::beans::XPropertySet > m_xProps; css::uno::Reference< css::uno::XInterface > m_xControl; css::uno::Reference< css::frame::XModel > m_xModel; virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException); + void fireChangeEvent(); + void fireClickEvent(); + void fireEvent( css::script::ScriptEvent& evt ); public: ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper ); @@ -66,6 +74,10 @@ public: // This class will own the helper, so make sure it is allocated from // the heap void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper ); + // sets the name of the associated library ( used for UserForm controls ) + void setLibraryAndCodeName( const rtl::OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; } + rtl::OUString getLibraryAndCodeName() const { return m_sLibraryAndCodeName; } + // XControl virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException); @@ -97,6 +109,8 @@ public: virtual void SAL_CALL setTabIndex( sal_Int32 nTabIndex ) throw (css::uno::RuntimeException); //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape virtual void removeResouce() throw( css::uno::RuntimeException ); + virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException); //XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); @@ -124,3 +138,5 @@ private: }; #endif//SC_VBA_CONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx index 7411f7ad9463..309ff71e929f 100644 --- a/vbahelper/source/msforms/vbacontrols.cxx +++ b/vbahelper/source/msforms/vbacontrols.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,8 +39,8 @@ #include "vbacontrols.hxx" #include "vbacontrol.hxx" #include <cppuhelper/implbase2.hxx> -#include <ooo/vba/XControlProvider.hpp> -#include <hash_map> +#include <ooo/vba//XControlProvider.hpp> +#include <boost/unordered_map.hpp> using namespace com::sun::star; using namespace ooo::vba; @@ -47,7 +48,7 @@ using namespace ooo::vba; typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl; -typedef std::hash_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash, +typedef boost::unordered_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ControlIndexMap; typedef std::vector< uno::Reference< awt::XControl > > ControlVec; @@ -75,7 +76,19 @@ private: mIndices[ msNames[ nIndex ] ] = nIndex; } } - + void getNestedControls( ControlVec& vControls, uno::Reference< awt::XControlContainer >& xContainer ) + { + uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls(); + const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray(); + const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength(); + for ( ; pCtrl < pCtrlsEnd; ++pCtrl ) + { + uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY ); + vControls.push_back( *pCtrl ); + if ( xC.is() ) + getNestedControls( vControls, xC ); + } + } public: ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog ) { @@ -498,3 +511,4 @@ ScVbaControls::getElementType() throw (uno::RuntimeException) } VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaControls, "ooo.vba.msforms.Controls" ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx index 4b4838a45a8e..50aaae92f8f5 100644 --- a/vbahelper/source/msforms/vbacontrols.hxx +++ b/vbahelper/source/msforms/vbacontrols.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,3 +70,4 @@ private: #endif //SC_VBA_OLEOBJECTS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx index 4a1fe6a58b49..7c5f102603e5 100644 --- a/vbahelper/source/msforms/vbaframe.cxx +++ b/vbahelper/source/msforms/vbaframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,6 +69,17 @@ sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException) return msforms::fmSpecialEffect::fmSpecialEffectEtched; } +::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException) +{ + return 0; +} + +void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException) +{ + return; +} + + void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException) { } @@ -104,3 +116,4 @@ uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::Run // XHelperInterface VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx index d76f31230bba..bb5b198335e2 100644 --- a/vbahelper/source/msforms/vbaframe.hxx +++ b/vbahelper/source/msforms/vbaframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,6 +49,9 @@ public: // XFrame attributes virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getSpecialEffect() throw (css::uno::RuntimeException); virtual void SAL_CALL setSpecialEffect( sal_Int32 nSpecialEffect ) throw (css::uno::RuntimeException); virtual sal_Int32 SAL_CALL getBorderStyle() throw (css::uno::RuntimeException); @@ -63,3 +67,5 @@ private: css::uno::Reference< css::awt::XControl > mxDialog; }; #endif //SC_VBA_LABEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaimage.cxx b/vbahelper/source/msforms/vbaimage.cxx index 508f97824f51..08a3007d5714 100644 --- a/vbahelper/source/msforms/vbaimage.cxx +++ b/vbahelper/source/msforms/vbaimage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ ScVbaImage::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaimage.hxx b/vbahelper/source/msforms/vbaimage.hxx index 52012fc1fee3..e360fe4f67b1 100644 --- a/vbahelper/source/msforms/vbaimage.hxx +++ b/vbahelper/source/msforms/vbaimage.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,3 +44,5 @@ public: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_IMAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx index d5aa1176e3d3..4795a25be78c 100644 --- a/vbahelper/source/msforms/vbalabel.cxx +++ b/vbahelper/source/msforms/vbalabel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,13 +66,25 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run setCaption( sCaption ); } +rtl::OUString SAL_CALL +ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException) +{ + //FIXME: seems not support? + return rtl::OUString(); +} + +void SAL_CALL +ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException) +{ + //FIXME: seems not support? +} + uno::Reference< msforms::XNewFont > SAL_CALL ScVbaLabel::getFont() throw (uno::RuntimeException) { return new VbaNewFont( this, mxContext, m_xProps ); } -rtl::OUString& -ScVbaLabel::getServiceImplName() +rtl::OUString& ScVbaLabel::getServiceImplName() { static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") ); return sImplName; @@ -88,3 +101,5 @@ ScVbaLabel::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx index 2dcee186d58b..1166f045e6ac 100644 --- a/vbahelper/source/msforms/vbalabel.hxx +++ b/vbahelper/source/msforms/vbalabel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,11 +45,15 @@ public: virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException); //XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } }; #endif //SC_VBA_LABEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx index 8829c8ae7256..f008fef9d5e2 100644 --- a/vbahelper/source/msforms/vbalistbox.cxx +++ b/vbahelper/source/msforms/vbalistbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -72,8 +73,8 @@ ScVbaListBox::getValue() throw (uno::RuntimeException) m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; m_xProps->getPropertyValue( ITEMS ) >>= sItems; if( getMultiSelect() ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Attribute use invalid." )), uno::Reference< uno::XInterface >() ); uno::Any aRet; if ( sSelection.getLength() ) aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] ); @@ -85,8 +86,8 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) { if( getMultiSelect() ) { - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Attribute use invalid." )), uno::Reference< uno::XInterface >() ); } rtl::OUString sValue = getAnyAsString( _value ); uno::Sequence< rtl::OUString > sList; @@ -104,13 +105,17 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) } } if( nValue == -1 ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Attribute use invalid." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Attribute use invalid." )), uno::Reference< uno::XInterface >() ); uno::Sequence< sal_Int16 > nSelectedIndices(1); + uno::Sequence< sal_Int16 > nOldSelectedIndices; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices; nSelectedIndices[ 0 ] = nValue; m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); - m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); + if ( nSelectedIndices != nOldSelectedIndices ) + fireClickEvent(); + //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); } ::rtl::OUString SAL_CALL @@ -127,20 +132,22 @@ ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeExcepti setValue( uno::makeAny( _text ) ); // seems the same } -sal_Bool SAL_CALL +sal_Int32 SAL_CALL ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException) { sal_Bool bMultiSelect = sal_False; m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect; - return bMultiSelect; + return bMultiSelect ? 1 : 0 ; } void SAL_CALL -ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException) +ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException) { - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) ); + sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0; + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( bMultiSelect ) ); } + css::uno::Any SAL_CALL ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException) { @@ -151,8 +158,8 @@ ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException) // the indices are but sal_Int16 sal_Int16 nIndex = static_cast< sal_Int16 >( index ); if( nIndex < 0 || nIndex >= nLength ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Error Number." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Error Number." )), uno::Reference< uno::XInterface >() ); m_nIndex = nIndex; return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) ); } @@ -185,8 +192,8 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) { sal_Bool bValue = sal_False; if( !(value >>= bValue) ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Invalid type\n. need boolean." )), uno::Reference< uno::XInterface >() ); uno::Sequence< sal_Int16 > nList; m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList; sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() ); @@ -205,6 +212,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) } nList.realloc( nLength - 1 ); //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); + fireClickEvent(); m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); return; } @@ -223,6 +231,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) nList[0] = nIndex; } //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); + fireClickEvent(); m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); } } @@ -290,3 +299,5 @@ ScVbaListBox::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx index 7dbda1837cb0..28e9590fc06f 100644 --- a/vbahelper/source/msforms/vbalistbox.hxx +++ b/vbahelper/source/msforms/vbalistbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,8 +59,8 @@ public: virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException); // Methods @@ -72,7 +73,7 @@ public: virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } //XHelperInterface virtual rtl::OUString& getServiceImplName(); @@ -86,3 +87,5 @@ public: }; #endif // + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx index 76763b42039e..696b52bfb42d 100644 --- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx +++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx @@ -1,11 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include <vbalistcontrolhelper.hxx> #include <vector> +#include <vbahelper/vbapropvalue.hxx> using namespace com::sun::star; using namespace ooo::vba; const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); +class ListPropListener : public PropListener +{ +private: + uno::Reference< beans::XPropertySet > m_xProps; + uno::Any m_pvargIndex; + uno::Any m_pvarColumn; + +public: + ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ); + virtual void setValueEvent( const css::uno::Any& value ); + virtual css::uno::Any getValueEvent(); +}; + +ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn ) +{ +} + +void ListPropListener::setValueEvent( const uno::Any& value ) +{ + if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() ) + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Bad argument" )), uno::Reference< uno::XInterface >() ); + + m_xProps->setPropertyValue( ITEMS, value ); +} + +uno::Any ListPropListener::getValueEvent() +{ + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); + uno::Any aRet; + if ( m_pvargIndex.hasValue() ) + { + sal_Int16 nIndex = -1; + m_pvargIndex >>= nIndex; + if( nIndex < 0 || nIndex >= nLength ) + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Bad row Index" )), uno::Reference< uno::XInterface >() ); + aRet <<= sList[ nIndex ]; + } + else if ( m_pvarColumn.hasValue() ) // pvarColumn on its own would be bad + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Bad column Index" )), uno::Reference< uno::XInterface >() ); + else // List() ( e.g. no args ) + { + uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength ); + for ( sal_Int32 i = 0; i < nLength; ++i ) + { + sReturnArray[ i ].realloc( 10 ); + sReturnArray[ i ][ 0 ] = sList[ i ]; + } + aRet = uno::makeAny( sReturnArray ); + } + return aRet; +} + void SAL_CALL ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) { @@ -71,7 +130,7 @@ ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeExcept uno::Sequence< rtl::OUString > sList; m_xProps->getPropertyValue( ITEMS ) >>= sList; if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid index")), uno::Reference< uno::XInterface > () ); if( sList.hasElements() ) { if( sList.getLength() == 1 ) @@ -116,31 +175,7 @@ ListControlHelper::getListCount() throw (uno::RuntimeException) uno::Any SAL_CALL ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) { - uno::Sequence< rtl::OUString > sList; - m_xProps->getPropertyValue( ITEMS ) >>= sList; - sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); - uno::Any aRet; - if ( pvargIndex.hasValue() ) - { - sal_Int16 nIndex = -1; - pvargIndex >>= nIndex; - if( nIndex < 0 || nIndex >= nLength ) - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Bad row Index" ), uno::Reference< uno::XInterface >() ); - aRet <<= sList[ nIndex ]; - } - else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Bad column Index" ), uno::Reference< uno::XInterface >() ); - else // List() ( e.g. no args ) - { - uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength ); - for ( sal_Int32 i = 0; i < nLength; ++i ) - { - sReturnArray[ i ].realloc( 10 ); - sReturnArray[ i ][ 0 ] = sList[ i ]; - } - aRet = uno::makeAny( sReturnArray ); - } - return aRet; + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.hxx b/vbahelper/source/msforms/vbalistcontrolhelper.hxx index d56729da17e6..930204ebd5d5 100644 --- a/vbahelper/source/msforms/vbalistcontrolhelper.hxx +++ b/vbahelper/source/msforms/vbalistcontrolhelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef SC_VBA_LISTCONTROLHELPER #define SC_VBA_LISTCONTROLHELPER @@ -18,3 +19,5 @@ public: virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx index 78590f0fd85b..26555f0bfa2c 100644 --- a/vbahelper/source/msforms/vbamultipage.cxx +++ b/vbahelper/source/msforms/vbamultipage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,14 +29,12 @@ #include <ooo/vba/XCollection.hpp> #include "vbapages.hxx" #include <vector> +#include <com/sun/star/container/XNameContainer.hpp> using namespace com::sun::star; using namespace ooo::vba; -// uno servicename com.sun.star.awt.UnoControlProgressBarMode -const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); -const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ); -const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") ); +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ); typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base; class PagesImpl : public PagesImpl_Base @@ -77,9 +76,7 @@ ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< awt::XControl >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) { - mxDialogProps.set( xDialog->getModel(), uno::UNO_QUERY_THROW ); - // set dialog step to value of multipage pseudo model - setValue(getValue()); + mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW ); } // Attributes @@ -88,15 +85,19 @@ ScVbaMultiPage::getValue() throw (css::uno::RuntimeException) { sal_Int32 nValue = 0; m_xProps->getPropertyValue( SVALUE ) >>= nValue; - return nValue; + // VBA 0 based tab index + return nValue - 1; } void SAL_CALL ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) { - // track change in dialog ( dialog value is 1 based, 0 is a special value ) - m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) ); - mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) ); + // Openoffice 1 based tab index + sal_Int32 nVal = _value + 1; + sal_Int32 nOldVal = getValue(); + m_xProps->setPropertyValue( SVALUE, uno::makeAny( nVal ) ); + if ( nVal != nOldVal ) + fireChangeEvent(); } @@ -110,9 +111,9 @@ ScVbaMultiPage::getServiceImplName() uno::Any SAL_CALL ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException) { - sal_Int32 nValue = 0; - m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue; - uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) ); + // get the container model + uno::Reference< container::XNameContainer > xContainer( m_xProps, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( xContainer->getElementNames().getLength() ) ) ); if ( !index.hasValue() ) return uno::makeAny( xColl ); return xColl->Item( uno::makeAny( index ), uno::Any() ); @@ -129,3 +130,5 @@ ScVbaMultiPage::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbamultipage.hxx b/vbahelper/source/msforms/vbamultipage.hxx index 328a71b61592..26070a8a90d5 100644 --- a/vbahelper/source/msforms/vbamultipage.hxx +++ b/vbahelper/source/msforms/vbamultipage.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,6 @@ #include "vbacontrol.hxx" #include <vbahelper/vbahelper.hxx> -//#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase1.hxx> typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE; @@ -59,6 +59,8 @@ public: virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } }; #endif //SC_VBA_LABEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbapages.cxx b/vbahelper/source/msforms/vbapages.cxx index dd52a66a65cf..a32519c41f57 100644 --- a/vbahelper/source/msforms/vbapages.cxx +++ b/vbahelper/source/msforms/vbapages.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,3 +71,5 @@ ScVbaPages::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbapages.hxx b/vbahelper/source/msforms/vbapages.hxx index 4bc743b1ee96..63e989891b8e 100644 --- a/vbahelper/source/msforms/vbapages.hxx +++ b/vbahelper/source/msforms/vbapages.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ public: }; #endif//SC_VBA_SHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaprogressbar.cxx b/vbahelper/source/msforms/vbaprogressbar.cxx index 716cdcc61583..5e82443da203 100644 --- a/vbahelper/source/msforms/vbaprogressbar.cxx +++ b/vbahelper/source/msforms/vbaprogressbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ ScVbaProgressBar::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaprogressbar.hxx b/vbahelper/source/msforms/vbaprogressbar.hxx index 13980f522ef4..73c1ba776382 100644 --- a/vbahelper/source/msforms/vbaprogressbar.hxx +++ b/vbahelper/source/msforms/vbaprogressbar.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,6 +47,8 @@ public: virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } }; #endif //SC_VBA_LABEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx index 12ee1ad8ae41..8f349f499597 100644 --- a/vbahelper/source/msforms/vbaradiobutton.cxx +++ b/vbahelper/source/msforms/vbaradiobutton.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,6 +72,9 @@ void SAL_CALL ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) { sal_Int16 nValue = 0; + sal_Int16 nOldValue = 0; + m_xProps->getPropertyValue( STATE ) >>= nOldValue; + sal_Bool bValue = sal_False; if( _value >>= nValue ) { @@ -83,6 +87,15 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio nValue = 1; } m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); + if ( nValue != nOldValue ) + { + fireChangeEvent(); + // In Excel, only when the radio button is checked, the click event is fired. + if ( nValue != 0 ) + { + fireClickEvent(); + } + } } uno::Reference< msforms::XNewFont > SAL_CALL ScVbaRadioButton::getFont() throw (uno::RuntimeException) @@ -108,3 +121,5 @@ ScVbaRadioButton::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx index 3da00eb0765e..b499cbfa8c77 100644 --- a/vbahelper/source/msforms/vbaradiobutton.hxx +++ b/vbahelper/source/msforms/vbaradiobutton.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,7 +48,9 @@ public: virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } }; #endif //SC_VBA_RADIOBUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbascrollbar.cxx b/vbahelper/source/msforms/vbascrollbar.cxx index f208f5acdcf9..6b9eefaaf642 100644 --- a/vbahelper/source/msforms/vbascrollbar.cxx +++ b/vbahelper/source/msforms/vbascrollbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -129,3 +130,5 @@ ScVbaScrollBar::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbascrollbar.hxx b/vbahelper/source/msforms/vbascrollbar.hxx index 8b4e122c0422..bfb6430c4312 100644 --- a/vbahelper/source/msforms/vbascrollbar.hxx +++ b/vbahelper/source/msforms/vbascrollbar.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,3 +57,5 @@ public: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_LABEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaspinbutton.cxx b/vbahelper/source/msforms/vbaspinbutton.cxx index d536e0c41340..0e9472e71190 100644 --- a/vbahelper/source/msforms/vbaspinbutton.cxx +++ b/vbahelper/source/msforms/vbaspinbutton.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,5 @@ ScVbaSpinButton::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbaspinbutton.hxx b/vbahelper/source/msforms/vbaspinbutton.hxx index 1c600a0aa156..2726b44e5765 100644 --- a/vbahelper/source/msforms/vbaspinbutton.hxx +++ b/vbahelper/source/msforms/vbaspinbutton.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,3 +52,5 @@ public: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_SPINBUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.cxx b/vbahelper/source/msforms/vbasystemaxcontrol.cxx index ed2fc70164ac..1724ad31c154 100755..100644 --- a/vbahelper/source/msforms/vbasystemaxcontrol.cxx +++ b/vbahelper/source/msforms/vbasystemaxcontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,4 @@ VbaSystemAXControl::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.hxx b/vbahelper/source/msforms/vbasystemaxcontrol.hxx index bffe5b99c4f1..0ede40b1e979 100755..100644 --- a/vbahelper/source/msforms/vbasystemaxcontrol.hxx +++ b/vbahelper/source/msforms/vbasystemaxcontrol.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,3 +57,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx index b6aedcdceaf6..39861b9a75b6 100644 --- a/vbahelper/source/msforms/vbatextbox.cxx +++ b/vbahelper/source/msforms/vbatextbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,13 +69,20 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException) void SAL_CALL ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException) { + rtl::OUString sOldText = getText(); + if ( !mbDialog ) { - uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW ); - xTextRange->setString( _text ); -} + uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW ); + xTextRange->setString( _text ); + } else m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) ); + + if ( _text != sOldText ) + { + fireChangeEvent(); + } } sal_Int32 SAL_CALL @@ -91,7 +99,8 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException) void SAL_CALL ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException) { - uno::Any aValue( _maxlength ); + sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength); + uno::Any aValue( _maxlength16 ); m_xProps->setPropertyValue (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue); } @@ -161,3 +170,5 @@ ScVbaTextBox::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx index 586bceb607a0..bdbff16439ea 100644 --- a/vbahelper/source/msforms/vbatextbox.hxx +++ b/vbahelper/source/msforms/vbatextbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,9 +55,11 @@ public: virtual sal_Int32 SAL_CALL getTextLength() throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } //XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_TEXTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx index d1a3b40d6eb7..b989616a8574 100644 --- a/vbahelper/source/msforms/vbatogglebutton.cxx +++ b/vbahelper/source/msforms/vbatogglebutton.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,14 +70,30 @@ ScVbaToggleButton::getValue() throw (uno::RuntimeException) return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) ); } + void SAL_CALL ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) { sal_Int16 nState = 0; - _value >>= nState; + if (_value.getValueTypeClass() == uno::TypeClass_BOOLEAN) + { + sal_Bool bValue; + _value >>= bValue; + nState = static_cast< sal_Int16 >(bValue); + } + else if (_value.getValueTypeClass() == uno::TypeClass_BYTE) + { + sal_Int8 nValue; + _value >>= nValue; + nState = ( nValue == 1) ? 1 : 0; + } + else + { + _value >>= nState; OSL_TRACE( "nState - %d", nState ); - nState = ( nState == -1 ) ? 1 : 0; + nState = ( nState == -1 ) ? 1 : 0; OSL_TRACE( "nState - %d", nState ); + } m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) ); } @@ -149,3 +166,4 @@ ScVbaToggleButton::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx index d2bf4c6b7f17..6e8a0cb28e18 100644 --- a/vbahelper/source/msforms/vbatogglebutton.hxx +++ b/vbahelper/source/msforms/vbatogglebutton.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -60,6 +61,8 @@ public: virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); // XDefaultProperty - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); } }; #endif //SC_VBA_TOGGLEBUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index 3eb799205389..26912388ad05 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,10 @@ #include "vbauserform.hxx" #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> @@ -80,7 +83,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) 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 ); + xControlWindow->setPosSize(static_cast<sal_Int32>((aPosSize.Width - getWidth()) / 2.0), static_cast<sal_Int32>((aPosSize.Height - getHeight()) / 2.0), 0, 0, awt::PosSize::POS ); } catch( uno::Exception& ) { @@ -145,6 +148,24 @@ ScVbaUserForm::Hide( ) throw (uno::RuntimeException) m_xDialog->endExecute(); } +sal_Bool SAL_CALL ScVbaUserForm::getVisible() throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW ); + return xWindow2->isVisible(); +} + +void SAL_CALL ScVbaUserForm::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) +{ + if ( bVisible ) + { + Show(); + } + else + { + Hide(); + } +} + void SAL_CALL ScVbaUserForm::RePaint( ) throw (uno::RuntimeException) { @@ -210,6 +231,30 @@ ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& a } } +uno::Reference< awt::XControl > +ScVbaUserForm::nestedSearch( const rtl::OUString& aPropertyName, uno::Reference< awt::XControlContainer >& xContainer ) +{ + uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); + if ( !xControl.is() ) + { + uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls(); + const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray(); + const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength(); + + for ( ; pCtrl < pCtrlsEnd; ++pCtrl ) + { + uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY ); + if ( xC.is() ) + { + xControl.set( nestedSearch( aPropertyName, xC ) ); + if ( xControl.is() ) + break; + } + } + } + return xControl; +} + uno::Any SAL_CALL ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) { @@ -220,9 +265,16 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un { uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); + uno::Reference< awt::XControl > xControl = nestedSearch( aPropertyName, xContainer ); + xContainer->getControl( aPropertyName ); if ( xControl.is() ) - aResult <<= ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() ); + { + uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + if ( m_sLibName.getLength() ) + pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) ); + aResult = uno::makeAny( xVBAControl ); + } } return aResult; @@ -249,13 +301,18 @@ ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException) ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) { uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY ); + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() ); if ( xControl.is() ) { - uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW ); - sal_Bool bRes = xNameAccess->hasByName( aName ); - OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes ); - return bRes; + uno::Reference< beans::XPropertySet > xDlgProps( xControl->getModel(), uno::UNO_QUERY ); + if ( xDlgProps.is() ) + { + uno::Reference< container::XNameContainer > xAllChildren( xDlgProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllDialogChildren")) ), uno::UNO_QUERY_THROW ); + sal_Bool bRes = xAllChildren->hasByName( aName ); + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xAllChildren.is(), bRes ); + return bRes; + } } return sal_False; } @@ -270,3 +327,4 @@ extern sdecl::ServiceDecl const serviceDecl( "ooo.vba.msforms.UserForm" ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx index 1777a979b9f2..f66c3f85bb0e 100644 --- a/vbahelper/source/msforms/vbauserform.hxx +++ b/vbahelper/source/msforms/vbauserform.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ #include <cppuhelper/implbase1.hxx> #include <ooo/vba/msforms/XUserForm.hpp> #include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/frame/XModel.hpp> #include <vbahelper/vbahelperinterface.hxx> @@ -43,10 +45,14 @@ class ScVbaUserForm : public ScVbaUserForm_BASE private: css::uno::Reference< css::awt::XDialog > m_xDialog; bool mbDispose; + rtl::OUString m_sLibName; protected: public: ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException ); virtual ~ScVbaUserForm(); + static css::uno::Reference< css::awt::XControl > nestedSearch( const rtl::OUString& aPropertyName, css::uno::Reference< css::awt::XControlContainer >& xContainer ); + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); // XUserForm virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException); virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException); @@ -71,3 +77,5 @@ public: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk new file mode 100755 index 000000000000..31fefa8430b1 --- /dev/null +++ b/vbahelper/source/vbahelper/makefile.mk @@ -0,0 +1,77 @@ +#************************************************************************* +# +# 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=..$/../ +PRJNAME=vbahelper +TARGET=vbahelperbits + +ENABLE_EXCEPTIONS := TRUE +VISIBILITY_HIDDEN=TRUE +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +SLOFILES=\ + $(SLO)$/vbahelper.obj \ + $(SLO)$/vbapropvalue.obj \ + $(SLO)$/vbacommandbars.obj \ + $(SLO)$/vbacommandbar.obj \ + $(SLO)$/vbacommandbarcontrols.obj \ + $(SLO)$/vbacommandbarcontrol.obj \ + $(SLO)$/vbacommandbarhelper.obj \ + $(SLO)$/vbaapplicationbase.obj \ + $(SLO)$/vbawindowbase.obj \ + $(SLO)$/vbadocumentbase.obj \ + $(SLO)$/vbadocumentsbase.obj \ + $(SLO)$/vbaglobalbase.obj \ + $(SLO)$/vbafontbase.obj \ + $(SLO)$/vbadialogbase.obj \ + $(SLO)$/vbadialogsbase.obj \ + $(SLO)$/vbashape.obj \ + $(SLO)$/vbacolorformat.obj \ + $(SLO)$/vbashapes.obj \ + $(SLO)$/vbalineformat.obj \ + $(SLO)$/vbafillformat.obj \ + $(SLO)$/vbapictureformat.obj \ + $(SLO)$/vbashaperange.obj \ + $(SLO)$/vbatextframe.obj \ + $(SLO)$/vbapagesetupbase.obj \ + $(SLO)$/vbaeventshelperbase.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +ALLTAR : \ + $(MISC)$/$(TARGET).don \ + +$(SLOFILES) : $(MISC)$/$(TARGET).don + +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ + echo $@ + diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 5ae0a2c23890..21eec2670a09 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,6 +27,7 @@ ************************************************************************/ #include "vbahelper/vbaapplicationbase.hxx" +#include <sal/macros.h> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -41,7 +43,7 @@ #include <com/sun/star/document/XEmbeddedScripts.hpp> #include <com/sun/star/awt/XWindow2.hpp> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <filter/msfilter/msvbahelper.hxx> #include <tools/datetime.hxx> @@ -88,7 +90,7 @@ public: Time aTimeNow; Date aRefDate( 1,1,1900 ); long nDiffDays = (long)(aDateNow - aRefDate); - nDiffDays += 2; // Anpassung VisualBasic: 1.Jan.1900 == 2 + nDiffDays += 2; // Change VisualBasic: 1.Jan.1900 == 2 long nDiffSeconds = aTimeNow.GetHour() * 3600 + aTimeNow.GetMin() * 60 + aTimeNow.GetSec(); return (double)nDiffDays + ((double)nDiffSeconds)/(double)(24*3600); @@ -155,7 +157,7 @@ struct VbaTimerInfoHash }; // ====VbaTimerHashMap================================== -typedef ::std::hash_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash, ::std::equal_to< VbaTimerInfo > > VbaTimerHashMap; +typedef ::boost::unordered_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash, ::std::equal_to< VbaTimerInfo > > VbaTimerHashMap; // ====VbaApplicationBase_Impl================================== struct VbaApplicationBase_Impl @@ -290,8 +292,10 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException) return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION)); } -void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) +uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) { + ::rtl::OUString sSeparator(RTL_CONSTASCII_USTRINGPARAM("/")); + ::rtl::OUString sMacroSeparator(RTL_CONSTASCII_USTRINGPARAM("!")); ::rtl::OUString aMacroName = MacroName.trim(); if (0 == aMacroName.indexOf('!')) aMacroName = aMacroName.copy(1).trim(); @@ -314,21 +318,16 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u // 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 }; - int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] ); + int nArg = SAL_N_ELEMENTS( aArgsPtrArray ); uno::Sequence< uno::Any > aArgs( nArg ); const uno::Any** pArg = aArgsPtrArray; const uno::Any** pArgEnd = ( aArgsPtrArray + nArg ); - sal_Int32 nLastArgWithValue = 0; sal_Int32 nArgProcessed = 0; for ( ; pArg != pArgEnd; ++pArg, ++nArgProcessed ) - { aArgs[ nArgProcessed ] = **pArg; - if( (*pArg)->hasValue() ) - nLastArgWithValue = nArgProcessed; - } // resize array to position of last param with value aArgs.realloc( nArgProcessed + 1 ); @@ -336,6 +335,8 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u uno::Any aRet; uno::Any aDummyCaller; executeMacro( aMacroInfo.mpDocContext, aMacroInfo.msResolvedMacro, aArgs, aRet, aDummyCaller ); + + return aRet; } else { @@ -443,3 +444,4 @@ void VbaApplicationBase::Quit() throw (uno::RuntimeException) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacolorformat.cxx b/vbahelper/source/vbahelper/vbacolorformat.cxx index c5924e4b7efd..19cf96e71135 100644 --- a/vbahelper/source/vbahelper/vbacolorformat.cxx +++ b/vbahelper/source/vbahelper/vbacolorformat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,7 +57,7 @@ ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xP { uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW ); m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() ); - }catch ( uno::RuntimeException e ) + }catch ( uno::RuntimeException& ) { m_pFillFormat = NULL; } @@ -76,20 +77,20 @@ ScVbaColorFormat::getRGB() throw (uno::RuntimeException) switch( m_nColorFormatType ) { case ColorFormatType::LINEFORMAT_FORECOLOR: - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")) ) >>= nRGB; break; case ColorFormatType::LINEFORMAT_BACKCOLOR: //TODO BackColor not supported - // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) ); + // m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color")), uno::makeAny( nRGB ) ); break; case ColorFormatType::FILLFORMAT_FORECOLOR: - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")) ) >>= nRGB; break; case ColorFormatType::FILLFORMAT_BACKCOLOR: nRGB = m_nFillFormatBackColor; break; default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second parameter of ColorFormat is wrong.")), uno::Reference< uno::XInterface >() ); } nRGB = OORGBToXLRGB( nRGB ); return nRGB; @@ -102,13 +103,13 @@ ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException) switch( m_nColorFormatType ) { case ColorFormatType::LINEFORMAT_FORECOLOR: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")), uno::makeAny( nRGB ) ); break; case ColorFormatType::LINEFORMAT_BACKCOLOR: // TODO BackColor not supported break; case ColorFormatType::FILLFORMAT_FORECOLOR: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), uno::makeAny( nRGB ) ); if( m_pFillFormat ) { m_pFillFormat->setForeColorAndInternalStyle(nRGB); @@ -122,7 +123,7 @@ ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException) } break; default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second parameter of ColorFormat is wrong.")), uno::Reference< uno::XInterface >() ); } } @@ -185,3 +186,4 @@ ScVbaColorFormat::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacolorformat.hxx b/vbahelper/source/vbahelper/vbacolorformat.hxx index 01ca5a047e44..c0e023dc5ce7 100644 --- a/vbahelper/source/vbahelper/vbacolorformat.hxx +++ b/vbahelper/source/vbahelper/vbacolorformat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,3 +124,5 @@ public: }; #endif//SC_VBA_XCOLORFORMAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx index 11cbacb79894..e51aadbe6364 100644 --- a/vbahelper/source/vbahelper/vbacommandbar.cxx +++ b/vbahelper/source/vbahelper/vbacommandbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException ) { // This will get a "NULL length string" when Name is not set. uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ); + uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")) ); rtl::OUString sName; aName >>= sName; if( sName.getLength() < 1 ) @@ -55,9 +56,9 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException ) { if( m_sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ) { - if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.sheet.SpreadsheetDocument") ) + if( pCBarHelper->getModuleId().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sheet.SpreadsheetDocument")) ) sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar") ); - else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") ) + else if( pCBarHelper->getModuleId().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) ) sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Menu Bar") ); return sName; } @@ -77,7 +78,7 @@ void SAL_CALL ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException) { uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) ); + xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), uno::makeAny( _name ) ); pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings ); } @@ -121,7 +122,7 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) xLayoutManager->destroyElement( m_sResourceUrl ); } } - catch( uno::Exception e ) + catch( uno::Exception& ) { OSL_TRACE( "SetVisible get an exception\n" ); } @@ -277,3 +278,5 @@ uno::Sequence< rtl::OUString > VbaDummyCommandBar::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbar.hxx b/vbahelper/source/vbahelper/vbacommandbar.hxx index bcb5a11e9691..d9278729c144 100644 --- a/vbahelper/source/vbahelper/vbacommandbar.hxx +++ b/vbahelper/source/vbahelper/vbacommandbar.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,7 @@ private: public: ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary = sal_True ) throw( css::uno::RuntimeException ); - sal_Bool IsMenu() { return m_bIsMenu; } + sal_Bool IsMenu() const { return m_bIsMenu; } // Attributes virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); @@ -107,3 +108,5 @@ private: }; #endif//SC_VBA_COMMANDBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx index d57bc00644a5..54d8f032ce49 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,7 @@ ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException ) { // "Label" always empty rtl::OUString sCaption; - getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption; + getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sCaption; return sCaption; } @@ -61,7 +62,7 @@ void SAL_CALL ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException) { rtl::OUString sCaption = _caption.replace('&','~'); - setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( sCaption ) ); + setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), uno::makeAny( sCaption ) ); ApplyChange(); } @@ -69,7 +70,7 @@ ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException) { rtl::OUString sCommandURL; - getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ) >>= sCommandURL; + getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandURL")) ) >>= sCommandURL; return sCommandURL; } @@ -83,7 +84,7 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u { 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::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) ); + setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandURL")), uno::makeAny( aCommandURL ) ); ApplyChange(); } } @@ -175,7 +176,7 @@ ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicE { // only Popup Menu has controls uno::Reference< container::XIndexAccess > xSubMenu; - getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu; + getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )) ) >>= xSubMenu; if( !xSubMenu.is() ) throw uno::RuntimeException(); @@ -257,3 +258,5 @@ ScVbaCommandBarButton::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx index 5066ba75eea0..7033c4dd1179 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -113,3 +114,5 @@ public: }; #endif//SC_VBA_COMMANDBARCONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx index da218d007736..55befbe6f086 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,15 +71,15 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemDat { uno::Sequence< beans::PropertyValue > aProps(7); - aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL ); + aProps[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL )); aProps[0].Value <<= sCommandURL; - aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL ); + aProps[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )); aProps[1].Value <<= sHelpURL; - aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL ); + aProps[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )); aProps[2].Value <<= sLabel; - aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE ); + aProps[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE )); aProps[3].Value <<= nType; - aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ); + aProps[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )); aProps[4].Value = aSubMenu; aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ); aProps[5].Value <<= isVisible; @@ -92,19 +93,19 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateToolbarItem { uno::Sequence< beans::PropertyValue > aProps(7); - aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL ); + aProps[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL )); aProps[0].Value <<= sCommandURL; - aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL ); + aProps[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )); aProps[1].Value <<= sHelpURL; - aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL ); + aProps[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )); aProps[2].Value <<= sLabel; - aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE ); + aProps[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE )); aProps[3].Value <<= nType; - aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ); + aProps[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )); aProps[4].Value = aSubMenu; - aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ); + aProps[5].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_ISVISIBLE )); aProps[5].Value <<= isVisible; - aProps[6].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_STYLE ); + aProps[6].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE )); aProps[6].Value <<= nStyle; return aProps; @@ -131,7 +132,7 @@ ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource ) uno::Sequence< beans::PropertyValue > aProps; m_xIndexAccess->getByIndex( nPosition ) >>= aProps; uno::Reference< container::XIndexAccess > xSubMenu; - getPropertyValue( aProps, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu; + getPropertyValue( aProps, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )) ) >>= xSubMenu; ScVbaCommandBarControl* pNewCommandBarControl = NULL; if( xSubMenu.is() ) pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True ); @@ -170,8 +171,8 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un { // Parameter is not supported // the following name needs to be individually created; - rtl::OUString sLabel( rtl::OUString::createFromAscii("Custom") ); - rtl::OUString sCommandUrl = rtl::OUString::createFromAscii( CUSTOM_MENU_STR ) + sLabel; + rtl::OUString sLabel(RTL_CONSTASCII_USTRINGPARAM("Custom")); + rtl::OUString sCommandUrl(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CUSTOM_MENU_STR)) + sLabel); sal_Int32 nType = office::MsoControlType::msoControlButton; sal_Int32 nPosition = 0; sal_Bool bTemporary = sal_True; @@ -327,3 +328,5 @@ uno::Sequence<rtl::OUString> VbaDummyCommandBarControls::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx index 79a4a8c5a5fe..4774dd5c8c73 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ public: }; #endif//SC_VBA_COMMANDBARCONTROLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx index 385b220d201c..9cf3522257cb 100644 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ using namespace com::sun::star; using namespace ooo::vba; -#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr) +#define CREATEOUSTRING(asciistr) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(asciistr)) typedef std::map< rtl::OUString, rtl::OUString > MSO2OOCommandbarMap; @@ -80,7 +81,7 @@ public: rtl::OUString findBuildinToolbar( const rtl::OUString& sToolbarName ) { MSO2OOCommandbarMap::iterator it = maBuildinToolbarMap.begin(); - for(; it != maBuildinToolbarMap.end(); it++ ) + for(; it != maBuildinToolbarMap.end(); ++it ) { rtl::OUString sName = it->first; if( sName.equalsIgnoreAsciiCase( sToolbarName ) ) @@ -184,7 +185,7 @@ uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager() { uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW ); - uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW ); return xLayoutManager; } @@ -194,7 +195,7 @@ sal_Bool VbaCommandBarHelper::hasToolbar( const rtl::OUString& sResourceUrl, con { rtl::OUString sUIName; uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW ); - xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName; + xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ITEM_DESCRIPTOR_UINAME)) ) >>= sUIName; if( sName.equalsIgnoreAsciiCase( sUIName ) ) return sal_True; } @@ -215,7 +216,7 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference< for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) { sResourceUrl = allNames[i]; - if(sResourceUrl.indexOf( rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ) ) == 0 ) + if(sResourceUrl.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL )) ) == 0 ) { if( hasToolbar( sResourceUrl, sName ) ) return sResourceUrl; @@ -240,7 +241,7 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css { rtl::OUString sLabel; xIndexAccess->getByIndex( i ) >>= aProps; - getPropertyValue( aProps, rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_LABEL) ) >>= sLabel; + getPropertyValue( aProps, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ITEM_DESCRIPTOR_LABEL)) ) >>= sLabel; // handle the hotkey marker '~' (remove in toolbars (?), replace by '&' in menus) ::rtl::OUStringBuffer aBuffer; sal_Int32 index = sLabel.indexOf( sal_Unicode('~') ); @@ -267,11 +268,13 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css rtl::OUString VbaCommandBarHelper::generateCustomURL() { - rtl::OUString url = rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ); - url += rtl::OUString::createFromAscii( CUSTOM_TOOLBAR_STR ); + rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL )); + url += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CUSTOM_TOOLBAR_STR )); // use a random number to minimize possible clash with existing custom toolbars srand( unsigned( time( NULL ) )); url += rtl::OUString::valueOf( sal_Int64( rand() ), 16 ); return url; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx index 93c6e5f55457..8c4be0c5a577 100644 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,17 +74,17 @@ private: public: VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ); - css::uno::Reference< css::frame::XModel > getModel() { return mxModel; } + css::uno::Reference< css::frame::XModel > getModel() const { return mxModel; } - css::uno::Reference< css::ui::XUIConfigurationManager > getDocCfgManager() throw (css::uno::RuntimeException) + css::uno::Reference< css::ui::XUIConfigurationManager > getDocCfgManager() const throw (css::uno::RuntimeException) { return m_xDocCfgMgr; } - css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager() throw (css::uno::RuntimeException) + css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager() const throw (css::uno::RuntimeException) { return m_xAppCfgMgr; } - css::uno::Reference< css::container::XNameAccess > getPersistentWindowState() throw (css::uno::RuntimeException) + css::uno::Reference< css::container::XNameAccess > getPersistentWindowState() const throw (css::uno::RuntimeException) { return m_xWindowState; } @@ -94,10 +95,12 @@ public: css::uno::Reference< css::frame::XLayoutManager > getLayoutManager() throw (css::uno::RuntimeException); - const rtl::OUString getModuleId(){ return maModuleId; } + const rtl::OUString getModuleId() const { return maModuleId; } rtl::OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException); static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName, bool bMenu = false ) throw (css::uno::RuntimeException); static rtl::OUString generateCustomURL(); }; #endif //VBA_COMMANDBARHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx index 9d6cd9e2eea7..0e021078bfd9 100644 --- a/vbahelper/source/vbahelper/vbacommandbars.cxx +++ b/vbahelper/source/vbahelper/vbacommandbars.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,7 +68,7 @@ public: if( hasMoreElements() ) { rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] ); - if( sResourceUrl.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + if( sResourceUrl.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/")) ) != -1 ) { uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl ); uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, m_pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) ); @@ -122,7 +123,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Worksheet Menu Bar") ) ) { // spreadsheet menu bar - sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL ); + sResourceUrl = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL )); bMenu = sal_True; } else if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Cell") ) ) @@ -136,7 +137,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Menu Bar") ) ) { // text processor menu bar - sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL ); + sResourceUrl = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL )); bMenu = sal_True; } } @@ -202,7 +203,7 @@ ScVbaCommandBars::getCount() throw(css::uno::RuntimeException) uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) { - if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + if(allNames[i].indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/")) ) != -1 ) { nCount++; } @@ -225,10 +226,10 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th if( nIndex == 1 ) { uno::Any aSource; - if( m_pCBarHelper->getModuleId().equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ) - aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" ); - else if( m_pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") ) - aSource <<= rtl::OUString::createFromAscii( "Menu Bar" ); + if( m_pCBarHelper->getModuleId().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) + aSource <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar")); + else if( m_pCBarHelper->getModuleId().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) ) + aSource <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Menu Bar")); if( aSource.hasValue() ) return createCollectionObject( aSource ); } @@ -254,3 +255,4 @@ ScVbaCommandBars::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbacommandbars.hxx b/vbahelper/source/vbahelper/vbacommandbars.hxx index 92ed1438d269..3c32b7d4a9b5 100644 --- a/vbahelper/source/vbahelper/vbacommandbars.hxx +++ b/vbahelper/source/vbahelper/vbacommandbars.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ public: }; #endif//SC_VBA_COMMANDBARS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx index e093e32c7443..86de3e73a3d0 100644 --- a/vbahelper/source/vbahelper/vbadialogbase.cxx +++ b/vbahelper/source/vbahelper/vbadialogbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,11 +31,10 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -// fails silently -void -VbaDialogBase::Show() throw(uno::RuntimeException) +sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException ) { rtl::OUString aURL; + sal_Bool bSuccess = sal_False; if ( m_xModel.is() ) { aURL = mapIndexToName( mnIndex ); @@ -42,7 +42,27 @@ VbaDialogBase::Show() throw(uno::RuntimeException) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), uno::Reference< XInterface > () ); - dispatchRequests( m_xModel, aURL ); + + uno::Sequence< beans::PropertyValue > dispatchProps(0); + if ( aURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:PrinterSetup")) ) + { + dispatchProps.realloc(1); + dispatchProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADialogResultRequest" ) ); + dispatchProps[0].Value <<= (sal_Bool) sal_True; + } + + VBADispatchListener *pNotificationListener = new VBADispatchListener(); + uno::Reference< frame::XDispatchResultListener > rListener = pNotificationListener; + dispatchRequests( m_xModel, aURL, dispatchProps, rListener, sal_False ); + + bSuccess = pNotificationListener->getState(); + uno::Any aResult = pNotificationListener->getResult(); + if ( bSuccess ) + { + if ( aResult.getValueTypeClass() == uno::TypeClass_BOOLEAN ) + aResult >>= bSuccess; + } } + return bSuccess; } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbadialogsbase.cxx b/vbahelper/source/vbahelper/vbadialogsbase.cxx index 2e02c35ac674..d625184a8b1d 100644 --- a/vbahelper/source/vbahelper/vbadialogsbase.cxx +++ b/vbahelper/source/vbahelper/vbadialogsbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,4 @@ VbaDialogsBase::Item( const uno::Any& /* &aItem */) throw (uno::RuntimeException return uno::Any(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 291bc6ad2931..e8aa501a40df 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,6 +37,7 @@ #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 <ooo/vba/XApplicationBase.hpp> @@ -73,13 +75,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException) } else { - const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) ); - // process "UntitledX - $(PRODUCTNAME)" - uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); - xProps->getPropertyValue(sTitle ) >>= sName; - sal_Int32 pos = 0; - sName = sName.getToken(0,'-',pos); + uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW ); + sName = xTitle->getTitle(); sName = sName.trim(); } return sName; @@ -175,16 +172,31 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, // 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. - xCloseable->close(sal_True); + try{ + xCloseable->close(sal_True); + } + catch( util::CloseVetoException ) + { + //close is cancelled, nothing to do + } } + // 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 { - // 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. uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY ); if ( xDisposable.is() ) - xDisposable->dispose(); + { + // To be on the safe side, catch possible veto exception anyway. + try + { + xDisposable->dispose(); + } + catch( uno::Exception& ) + { + } + } } } } @@ -194,7 +206,7 @@ VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeExcepti { rtl::OUString rPassword; uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - SC_VBA_FIXME(("Workbook::Protect stub")); + OSL_TRACE("Workbook::Protect stub"); if( aPassword >>= rPassword ) xProt->protect( rPassword ); else @@ -302,3 +314,4 @@ VbaDocumentBase::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index b65a58542b92..d4d9ce700e66 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,6 +38,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/frame/XStorable.hpp> @@ -51,7 +53,8 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <sfx2/objsh.hxx> #include <tools/urlobj.hxx> -#include <hash_map> +#include <vbahelper/vbadocumentbase.hxx> +#include <boost/unordered_map.hpp> #include <osl/file.hxx> #include "vbahelper/vbahelper.hxx" @@ -60,10 +63,10 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -static const rtl::OUString sSpreadsheetDocument( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ); -static const rtl::OUString sTextDocument( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) ); +static const rtl::OUString sSpreadsheetDocument( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") ); +static const rtl::OUString sTextDocument( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument") ); -typedef std::hash_map< rtl::OUString, +typedef boost::unordered_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameIndexHash; @@ -91,7 +94,7 @@ public: m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW ); + (xSMgr->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), m_xContext), uno::UNO_QUERY_THROW ); uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); while( mxComponents->hasMoreElements() ) { @@ -148,8 +151,13 @@ public: { uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given m_documents.push_back( xModel ); - INetURLObject aURL( xModel->getURL() ); - namesToIndices[ aURL.GetLastName() ] = nIndex++; + rtl::OUString sName; + uno::Reference< ::ooo::vba::XDocumentBase > xVbaDocument = new VbaDocumentBase( uno::Reference< XHelperInterface >(), xContext, xModel ); + if ( xVbaDocument.is() ) + { + sName = xVbaDocument->getName(); + } + namesToIndices[ sName ] = nIndex++; } } @@ -255,7 +263,7 @@ uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException) uno::Reference< frame::XComponentLoader > xLoader( xSMgr->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), mxContext), uno::UNO_QUERY_THROW ); rtl::OUString sURL; if( meDocType == WORD_DOCUMENT ) @@ -315,11 +323,11 @@ uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const u uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext), + (xSMgr->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) , mxContext), uno::UNO_QUERY_THROW ); uno::Reference< frame::XComponentLoader > xLoader( xSMgr->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), mxContext), uno::UNO_QUERY_THROW ); @@ -350,3 +358,4 @@ uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const u return uno::makeAny( xComponent ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 5e2cf949c473..57e535a1dc1a 100755..100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -348,3 +349,5 @@ VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( co } // ============================================================================ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbafillformat.cxx b/vbahelper/source/vbahelper/vbafillformat.cxx index dc474dd158bc..463860c07aa3 100644 --- a/vbahelper/source/vbahelper/vbafillformat.cxx +++ b/vbahelper/source/vbahelper/vbafillformat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,7 +50,7 @@ ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::Runti m_nFillStyle = nFillStyle; if( m_nFillStyle == drawing::FillStyle_GRADIENT ) { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny( drawing::FillStyle_GRADIENT ) ); awt::Gradient aGradient; // AXIAL // RADIAL @@ -66,11 +67,11 @@ ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::Runti aGradient.StartIntensity = 100; aGradient.EndIntensity = 100; aGradient.StepCount = 1; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillGradient")), uno::makeAny( aGradient ) ); } else if( m_nFillStyle == drawing::FillStyle_SOLID ) { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny(drawing::FillStyle_SOLID) ); } } @@ -86,7 +87,7 @@ sal_Bool SAL_CALL ScVbaFillFormat::getVisible() throw (uno::RuntimeException) { drawing::FillStyle nFillStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")) ) >>= nFillStyle; if( nFillStyle == drawing::FillStyle_NONE ) return sal_False; return sal_True; @@ -96,10 +97,10 @@ void SAL_CALL ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) { drawing::FillStyle aFillStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")) ) >>= aFillStyle; if( !_visible ) { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny( drawing::FillStyle_NONE ) ); } else { @@ -115,7 +116,7 @@ ScVbaFillFormat::getTransparency() throw (uno::RuntimeException) { sal_Int16 nTransparence = 0; double dTransparence = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillTransparence")) ) >>= nTransparence; dTransparence = static_cast<double>( nTransparence ); dTransparence /= 100; return dTransparence; @@ -125,7 +126,7 @@ void SAL_CALL ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) { sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillTransparence")), uno::makeAny( nTransparence ) ); } @@ -197,3 +198,4 @@ ScVbaFillFormat::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbafillformat.hxx b/vbahelper/source/vbahelper/vbafillformat.hxx index 31f4dccb5a38..6cdaf0e0cd17 100644 --- a/vbahelper/source/vbahelper/vbafillformat.hxx +++ b/vbahelper/source/vbahelper/vbafillformat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,3 +70,5 @@ public: }; #endif//SC_VBA_XFILLFORMAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx index 065414343bd1..3f681c6eec68 100644 --- a/vbahelper/source/vbahelper/vbafontbase.cxx +++ b/vbahelper/source/vbahelper/vbafontbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -337,3 +338,4 @@ VbaFontBase::getUnderline() throw ( uno::RuntimeException ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx index e0df37583df5..7e6d365823c8 100644 --- a/vbahelper/source/vbahelper/vbaglobalbase.cxx +++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,6 +26,7 @@ * ************************************************************************/ #include "vbahelper/vbaglobalbase.hxx" +#include <sal/macros.h> #include <cppuhelper/component_context.hxx> #include <comphelper/processfactory.hxx> @@ -59,7 +61,7 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s }; // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and // some strange behavior - mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL ); + mxContext = ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), NULL ); } VbaGlobalsBase::~VbaGlobalsBase() @@ -136,7 +138,7 @@ VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException) // common ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ), }; - static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) ); + static uno::Sequence< rtl::OUString > serviceNames( names, SAL_N_ELEMENTS( names ) ); return serviceNames; } @@ -154,3 +156,4 @@ VbaGlobalsBase::hasServiceName( const rtl::OUString& serviceName ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 2a13124a741e..a52ef14402b5 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,6 +33,7 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> @@ -80,9 +82,6 @@ #include <vbahelper/vbahelper.hxx> #include <sfx2/app.hxx> -// #FIXME needs service -//#include "vbashape.hxx" -//#include "unonames.hxx" using namespace ::com::sun::star; using namespace ::ooo::vba; @@ -120,158 +119,6 @@ nViewNo && !pView->GetObjectShell()->IsInPlaceActive() ) } return false; } -#if 0 -namespace excel // all in this namespace probably can be moved to sc -{ - - -const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning")); -class PasteCellsWarningReseter -{ -private: - bool bInitialWarningState; - static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException ) - { - static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW ); - static uno::Reference<lang::XMultiComponentFactory > xServiceManager( - xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW ); - return xProps; - } - - bool getReplaceCellsWarning() throw ( uno::RuntimeException ) - { - sal_Bool res = sal_False; - getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res; - return ( res == sal_True ); - } - - void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException ) - { - getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) ); - } -public: - PasteCellsWarningReseter() throw ( uno::RuntimeException ) - { - bInitialWarningState = getReplaceCellsWarning(); - if ( bInitialWarningState ) - setReplaceCellsWarning( false ); - } - ~PasteCellsWarningReseter() - { - if ( bInitialWarningState ) - { - // don't allow dtor to throw - try - { - setReplaceCellsWarning( true ); - } - catch ( uno::Exception& /*e*/ ){} - } - } -}; - -void -implnPaste() -{ - PasteCellsWarningReseter resetWarningBox; - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - { - pViewShell->PasteFromSystem(); - pViewShell->CellContentChanged(); - } -} - - -void -implnCopy() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - pViewShell->CopyToClip(NULL,false,false,true); -} - -void -implnCut() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - pViewShell->CutToClip( NULL, sal_True ); -} -void implnPasteSpecial(SfxViewShell* pViewShell, sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose) -{ - PasteCellsWarningReseter resetWarningBox; - sal_Bool bAsLink(sal_False), bOtherDoc(sal_False); - InsCellCmd eMoveMode = INS_NONE; - - if ( !pTabViewShell ) - // none active, try next best - pTabViewShell = getCurrentBestViewShell(); - if ( pTabViewShell ) - { - ScViewData* pView = pTabViewShell->GetViewData(); - Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL; - if ( pView && pWin ) - { - if ( bAsLink && bOtherDoc ) - pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK - else - { - ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); - ScDocument* pDoc = NULL; - if ( pOwnClip ) - pDoc = pOwnClip->GetDocument(); - pTabViewShell->PasteFromClip( nFlags, pDoc, - nFunction, bSkipEmpty, bTranspose, bAsLink, - eMoveMode, IDF_NONE, sal_True ); - pTabViewShell->CellContentChanged(); - } - } - } - -} - -ScDocShell* -getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) -{ - uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW ); - ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); - ScDocShell* pDocShell = NULL; - if ( pModel ) - pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); - return pDocShell; - -} - -ScTabViewShell* -getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) -{ - ScDocShell* pDocShell = getDocShell( xModel ); - if ( pDocShell ) - return pDocShell->GetBestViewShell(); - return NULL; -} - -ScTabViewShell* -getCurrentBestViewShell() -{ - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - return getBestViewShell( xModel ); -} - -SfxViewFrame* -getCurrentViewFrame() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - return pViewShell->GetViewFrame(); - return NULL; -} -}; - -#endif uno::Reference< beans::XIntrospectionAccess > getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) @@ -280,7 +127,7 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) if( !xIntrospection.is() ) { uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW ); + xIntrospection.set( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) ), uno::UNO_QUERY_THROW ); } return xIntrospection->inspect( aObject ); } @@ -314,7 +161,7 @@ void dispatchExecute(SfxViewShell* pViewShell, sal_uInt16 nSlot, SfxCallMode nCa } void -dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUString& aUrl, const uno::Sequence< beans::PropertyValue >& sProps ) +dispatchRequests (const uno::Reference< frame::XModel>& xModel, const rtl::OUString & aUrl, const uno::Sequence< beans::PropertyValue >& sProps, const uno::Reference< frame::XDispatchResultListener >& rListener, const sal_Bool bSilent ) { util::URL url; url.Complete = aUrl; @@ -346,6 +193,7 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr } uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0); + uno::Reference< frame::XNotifyingDispatch > xNotifyingDispatcher( xDispatcher, uno::UNO_QUERY ); uno::Sequence<beans::PropertyValue> dispatchProps(1); @@ -361,11 +209,20 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr *pDest = *pSrc; } - (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" )); - (*pDest).Value <<= (sal_Bool)sal_True; + if ( bSilent ) + { + (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" )); + (*pDest).Value <<= (sal_Bool)sal_True; + } - if (xDispatcher.is()) + if ( !rListener.is() && xDispatcher.is() ) + { xDispatcher->dispatch( url, dispatchProps ); + } + else if ( rListener.is() && xNotifyingDispatcher.is() ) + { + xNotifyingDispatcher->dispatchWithNotification( url, dispatchProps, rListener ); + } } void @@ -867,7 +724,7 @@ double PointsToPixels( const css::uno::Reference< css::awt::XDevice >& xDevice, double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical) { double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical ); - return HmmToPoints( fPixels/fConvertFactor ); + return HmmToPoints(static_cast<sal_Int32>(fPixels/fConvertFactor)); } sal_Int32 PointsToHmm( double fPoints ) @@ -970,6 +827,23 @@ void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue throw uno::RuntimeException(); } +uno::Any getDefaultPropByIntrospection( const uno::Any& aObj ) throw ( uno::RuntimeException ) +{ + uno::Any aValue; + uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) ); + uno::Reference< script::XDefaultProperty > xDefaultProperty( aObj, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet; + + if ( xUnoAccess.is() ) + xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY ); + + if ( xPropSet.is() ) + aValue = xPropSet->getPropertyValue( xDefaultProperty->getDefaultPropertyName() ); + else + throw uno::RuntimeException(); + return aValue; +} + uno::Any getPropertyValue( const uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName ) { uno::Any result; @@ -997,6 +871,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r return sal_False; } +void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue ) +{ + if( setPropertyValue( aProp, aName, aValue ) ) + return; + + // append the property + sal_Int32 nLength = aProp.getLength(); + aProp.realloc( nLength + 1 ); + aProp[ nLength ].Name = aName; + aProp[ nLength ].Value = aValue; +} + // ====UserFormGeomentryHelper==== //--------------------------------------------- UserFormGeometryHelper::UserFormGeometryHelper( @@ -1168,169 +1054,189 @@ void UserFormGeometryHelper::implSetSize( double fSize, bool bHeight, bool bOute // ============================================================================ - double ConcreteXShapeGeometryAttributes::getLeft() const - { - return m_pShapeHelper->getLeft(); - } - void ConcreteXShapeGeometryAttributes::setLeft( double nLeft ) - { - m_pShapeHelper->setLeft( nLeft ); - } - double ConcreteXShapeGeometryAttributes::getTop() const - { - return m_pShapeHelper->getTop(); - } - void ConcreteXShapeGeometryAttributes::setTop( double nTop ) - { - m_pShapeHelper->setTop( nTop ); - } +double ConcreteXShapeGeometryAttributes::getLeft() const +{ + return m_pShapeHelper->getLeft(); +} +void ConcreteXShapeGeometryAttributes::setLeft( double nLeft ) +{ + m_pShapeHelper->setLeft( nLeft ); +} +double ConcreteXShapeGeometryAttributes::getTop() const +{ + return m_pShapeHelper->getTop(); +} +void ConcreteXShapeGeometryAttributes::setTop( double nTop ) +{ + m_pShapeHelper->setTop( nTop ); +} - double ConcreteXShapeGeometryAttributes::getHeight() const - { - return m_pShapeHelper->getHeight(); - } - void ConcreteXShapeGeometryAttributes::setHeight( double nHeight ) - { - m_pShapeHelper->setHeight( nHeight ); - } - double ConcreteXShapeGeometryAttributes::getWidth() const - { - return m_pShapeHelper->getWidth(); - } - void ConcreteXShapeGeometryAttributes::setWidth( double nWidth) - { - m_pShapeHelper->setWidth( nWidth ); +double ConcreteXShapeGeometryAttributes::getHeight() const +{ + return m_pShapeHelper->getHeight(); +} +void ConcreteXShapeGeometryAttributes::setHeight( double nHeight ) +{ + m_pShapeHelper->setHeight( nHeight ); +} +double ConcreteXShapeGeometryAttributes::getWidth() const +{ + return m_pShapeHelper->getWidth(); +} +void ConcreteXShapeGeometryAttributes::setWidth( double nWidth) +{ + m_pShapeHelper->setWidth( nWidth ); +} + + +ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape ) +{ + if( !xShape.is() ) + throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No valid shape for helper")), css::uno::Reference< css::uno::XInterface >() ); +} + +double ShapeHelper::getHeight() const +{ + return Millimeter::getInPoints(xShape->getSize().Height); } - ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape ) + void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException ) +{ + try { - if( !xShape.is() ) - throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() ); + css::awt::Size aSize = xShape->getSize(); + aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight); + xShape->setSize(aSize); } - - double ShapeHelper::getHeight() const + catch ( css::uno::Exception& /*e*/) { - return Millimeter::getInPoints(xShape->getSize().Height); + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); } +} +double ShapeHelper::getWidth() const +{ + return Millimeter::getInPoints(xShape->getSize().Width); + } - - void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException ) +void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException ) +{ + try { - try - { - css::awt::Size aSize = xShape->getSize(); - aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight); - xShape->setSize(aSize); - } - catch ( css::uno::Exception& /*e*/) - { - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); - } + css::awt::Size aSize = xShape->getSize(); + aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth); + xShape->setSize(aSize); + } + catch (css::uno::Exception& /*e*/) + { + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); } +} - double ShapeHelper::getWidth() const - { - return Millimeter::getInPoints(xShape->getSize().Width); - } +double ShapeHelper::getLeft() const +{ + return Millimeter::getInPoints(xShape->getPosition().X); +} - void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException ) - { - try - { - css::awt::Size aSize = xShape->getSize(); - aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth); - xShape->setSize(aSize); - } - catch (css::uno::Exception& /*e*/) - { - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); - } - } +void ShapeHelper::setLeft(double _fLeft) +{ + css::awt::Point aPoint = xShape->getPosition(); + aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft); + xShape->setPosition(aPoint); +} - double ShapeHelper::getLeft() const - { - return Millimeter::getInPoints(xShape->getPosition().X); - } +double ShapeHelper::getTop() const +{ + return Millimeter::getInPoints(xShape->getPosition().Y); +} - void ShapeHelper::setLeft(double _fLeft) - { - css::awt::Point aPoint = xShape->getPosition(); - aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft); - xShape->setPosition(aPoint); - } +void ShapeHelper::setTop(double _fTop) +{ + css::awt::Point aPoint = xShape->getPosition(); + aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop); + xShape->setPosition(aPoint); +} - double ShapeHelper::getTop() const - { - return Millimeter::getInPoints(xShape->getPosition().Y); - } +void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ) +{ + // #TODO #FIXME ( do we want to support additionalArg here ) + throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() ); +} +void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ) +{ + exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument ); +} +void DebugHelper::exception( const css::uno::Exception& ex ) throw( css::script::BasicErrorException ) +{ + exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() ); +} - void ShapeHelper::setTop(double _fTop) - { - css::awt::Point aPoint = xShape->getPosition(); - aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop); - xShape->setPosition(aPoint); - } +Millimeter::Millimeter():m_nMillimeter(0) {} - void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException ) - { - // #TODO #FIXME ( do we want to support additionalArg here ) - throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() ); - } +Millimeter::Millimeter(double mm):m_nMillimeter(mm) {} - void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException ) - { - exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument ); - } - void DebugHelper::exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException ) - { - exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() ); - } +void Millimeter::set(double mm) { m_nMillimeter = mm; } +void Millimeter::setInPoints(double points) +{ + m_nMillimeter = points * factor / 100.0; +} - Millimeter::Millimeter():m_nMillimeter(0) {} +void Millimeter::setInHundredthsOfOneMillimeter(double hmm) +{ + m_nMillimeter = hmm / 100; +} - Millimeter::Millimeter(double mm):m_nMillimeter(mm) {} +double Millimeter::get() +{ + return m_nMillimeter; +} +double Millimeter::getInHundredthsOfOneMillimeter() +{ + return m_nMillimeter * 100; +} +double Millimeter::getInPoints() +{ + return m_nMillimeter / factor * 100.0; +} - void Millimeter::set(double mm) { m_nMillimeter = mm; } - void Millimeter::setInPoints(double points) - { - m_nMillimeter = points * factor / 100.0; - } +sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points) +{ + sal_Int32 mm = static_cast<sal_Int32>(points * factor); + return mm; +} - void Millimeter::setInHundredthsOfOneMillimeter(double hmm) - { - m_nMillimeter = hmm / 100; - } +double Millimeter::getInPoints(int _hmm) +{ + double points = double( static_cast<double>(_hmm) / factor); + return points; +} - double Millimeter::get() - { - return m_nMillimeter; - } - double Millimeter::getInHundredthsOfOneMillimeter() - { - return m_nMillimeter * 100; - } - double Millimeter::getInPoints() - { - return m_nMillimeter / factor * 100.0; - } +// Listener for XNotifyingDispatch +VBADispatchListener::VBADispatchListener() : m_State( sal_False ) +{ +} - sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points) - { - sal_Int32 mm = static_cast<sal_Int32>(points * factor); - return mm; - } +// Listener for XNotifyingDispatch +VBADispatchListener::~VBADispatchListener() +{ +} - double Millimeter::getInPoints(int _hmm) - { - double points = double( static_cast<double>(_hmm) / factor); - return points; - } +// Listener for XNotifyingDispatch +void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException ) +{ + m_Result = aEvent.Result; + m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False; +} + +// Listener for XNotifyingDispatch +void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException ) +{ +} uno::Reference< XHelperInterface > getVBADocument( const uno::Reference< frame::XModel >& xModel ) { @@ -1379,3 +1285,5 @@ SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) } // openoffice } //org + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx index e0ea1f3e077b..4a66960763dc 100644 --- a/vbahelper/source/vbahelper/vbalineformat.cxx +++ b/vbahelper/source/vbahelper/vbalineformat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,7 +45,7 @@ ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< ov::XHelperInterface >& } sal_Int32 -ScVbaLineFormat::calculateArrowheadSize() +ScVbaLineFormat::calculateArrowheadSize() const { return 0; } @@ -53,39 +54,39 @@ sal_Int32 ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ) { sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; - if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) || - sLineName.equals(rtl::OUString::createFromAscii("Double Arrow"))) + if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Small Arrow"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowEnd"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Double Arrow")))) { // msoArrowheadTriangle nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle; } - else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) || - sLineName.equals(rtl::OUString::createFromAscii("Square")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd"))) + else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square 45"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowDiamondEnd")))) { // msoArrowheadDiamond nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond; } - else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) || - sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) ) + else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Circle"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowOvalEnd"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dimension Lines"))) ) { // msoArrowheadOval nLineType = office::MsoArrowheadStyle::msoArrowheadOval; } - else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd"))) + else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow concave"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowStealthEnd")))) { // msoArrowheadStealth nLineType = office::MsoArrowheadStyle::msoArrowheadStealth; } - else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) || - sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) || - sLineName.equals(rtl::OUString::createFromAscii("Line Arrow"))) + else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rounded short Arrow"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rounded large Arrow"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Symmetric Arrow"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowOpenEnd"))) || + sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line Arrow")))) { // msoArrowheadOpen nLineType = office::MsoArrowheadStyle::msoArrowheadOpen; @@ -104,19 +105,19 @@ ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadSt switch( nArrowheadStyle ) { case office::MsoArrowheadStyle::msoArrowheadNone: - return rtl::OUString(rtl::OUString::createFromAscii( "" ) ); + return rtl::OUString(); case office::MsoArrowheadStyle::msoArrowheadStealth: - return rtl::OUString::createFromAscii( "Arrow concave" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow concave")); case office::MsoArrowheadStyle::msoArrowheadOpen: - return rtl::OUString::createFromAscii("Line Arrow" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line Arrow")); case office::MsoArrowheadStyle::msoArrowheadOval: - return rtl::OUString::createFromAscii("Circle" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Circle")); case office::MsoArrowheadStyle::msoArrowheadDiamond: - return rtl::OUString::createFromAscii( "Square 45" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square 45")); case office::MsoArrowheadStyle::msoArrowheadTriangle: - return rtl::OUString::createFromAscii( "Arrow" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow")); default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Arrow Style!")), uno::Reference< uno::XInterface >() ); } } @@ -126,10 +127,10 @@ ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException) { sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; rtl::OUString sLineName; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName; - if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 ) + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStartName")) ) >>= sLineName; + if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArray")) ) ) != -1 ) { - sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") ); + sal_Int32 nIndex = sLineName.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) ); rtl::OUString sName = sLineName.copy( 0, nIndex ); //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32(); nLineType = convertLineStartEndNameToArrowheadStyle( sName ); @@ -145,31 +146,31 @@ void SAL_CALL ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException) { rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStartName")), uno::makeAny( sArrayName ) ); } sal_Int32 SAL_CALL ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } void SAL_CALL ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } sal_Int32 SAL_CALL ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } void SAL_CALL ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } sal_Int32 SAL_CALL @@ -186,32 +187,32 @@ ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) thro sal_Int32 SAL_CALL ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } void SAL_CALL ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } sal_Int32 SAL_CALL ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } void SAL_CALL ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() ); } double SAL_CALL ScVbaLineFormat::getWeight() throw (uno::RuntimeException) { sal_Int32 nLineWidth=0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineWidth")) ) >>= nLineWidth; double dLineWidth = Millimeter::getInPoints( nLineWidth ); return dLineWidth; } @@ -220,7 +221,7 @@ void SAL_CALL ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException) { if( _weight < 0 ) - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parameter: Must be positive.")), uno::Reference< uno::XInterface >() ); if( _weight == 0 ) _weight = 0.5; m_nLineWeight = _weight; @@ -228,7 +229,7 @@ ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException) aMillimeter.setInPoints( _weight ); sal_Int32 nLineWidth = static_cast<sal_Int32>( aMillimeter.getInHundredthsOfOneMillimeter() ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineWidth")), uno::makeAny( nLineWidth ) ); setDashStyle( m_nLineDashStyle ); } @@ -236,7 +237,7 @@ sal_Bool SAL_CALL ScVbaLineFormat::getVisible() throw (uno::RuntimeException) { drawing::LineStyle aLineStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) ) >>= aLineStyle; if( aLineStyle == drawing::LineStyle_NONE ) { return sal_False; @@ -248,11 +249,11 @@ void SAL_CALL ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) { drawing::LineStyle aLineStyle; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) ) >>= aLineStyle; if( !_visible ) { aLineStyle = drawing::LineStyle_NONE; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( aLineStyle ) ); } else { @@ -267,7 +268,7 @@ double SAL_CALL ScVbaLineFormat::getTransparency() throw (uno::RuntimeException) { sal_Int16 nTransparency = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineTransparence")) ) >>= nTransparency; double fTransparency = static_cast<double>( nTransparency ); return fTransparency / 100; } @@ -276,7 +277,7 @@ void SAL_CALL ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) { sal_Int16 nTransparency = static_cast<sal_Int16>( _transparency * 100 ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineTransparence")), uno::makeAny( nTransparency ) ); } sal_Int16 SAL_CALL @@ -301,13 +302,13 @@ ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException) { drawing::LineStyle eLineStyle; //LineStyle integer in Xray - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) ) >>= eLineStyle; if( eLineStyle == drawing::LineStyle_SOLID ) m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; else { drawing::LineDash aLineDash; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineDash")) ) >>= aLineDash; if( aLineDash.Dots == 0 ) { //LineDash @@ -353,11 +354,11 @@ ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeExcepti m_nLineDashStyle = _dashstyle; if( _dashstyle == office::MsoLineDashStyle::msoLineSolid ) { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID )); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( drawing::LineStyle_SOLID )); } else { - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( drawing::LineStyle_DASH ) ); drawing::LineDash pLineDash; Millimeter aMillimeter( m_nLineWeight ); sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() ); @@ -413,9 +414,9 @@ ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeExcepti pLineDash.Distance = nPixel; break; default: - throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this MsoLineDashStyle is not supported.")), uno::Reference< uno::XInterface >() ); } - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineDash")), uno::makeAny( pLineDash ) ); } } @@ -453,3 +454,4 @@ ScVbaLineFormat::getServiceNames() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbalineformat.hxx b/vbahelper/source/vbahelper/vbalineformat.hxx index 8c95fc996e0c..4e74ae827227 100644 --- a/vbahelper/source/vbahelper/vbalineformat.hxx +++ b/vbahelper/source/vbahelper/vbalineformat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ protected: virtual css::uno::Sequence<rtl::OUString> getServiceNames(); sal_Int32 convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ); rtl::OUString convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (css::uno::RuntimeException); - sal_Int32 calculateArrowheadSize(); + sal_Int32 calculateArrowheadSize() const; public: ScVbaLineFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); @@ -80,3 +81,5 @@ public: }; #endif//SC_VBA_XLINEFORMAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbapagesetupbase.cxx b/vbahelper/source/vbahelper/vbapagesetupbase.cxx index 0d023e502b7c..976fc232cc5b 100644 --- a/vbahelper/source/vbahelper/vbapagesetupbase.cxx +++ b/vbahelper/source/vbahelper/vbapagesetupbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -320,3 +321,4 @@ void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (c } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx index 7ebbb62d1125..26d4424e427b 100644 --- a/vbahelper/source/vbahelper/vbapictureformat.cxx +++ b/vbahelper/source/vbahelper/vbapictureformat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,11 +43,11 @@ ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, dou { if( nRange < nMin ) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parameter out of range, value is too small.")) , uno::Reference< uno::XInterface >() ); } if( nRange > nMax ) { - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parameter out of range, value is too high.")) , uno::Reference< uno::XInterface >() ); } } @@ -55,7 +56,7 @@ double SAL_CALL ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException) { sal_Int16 nLuminance = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustLuminance")) ) >>= nLuminance; double fBrightness = static_cast< double >( nLuminance ); fBrightness = ( fBrightness +100 ) / 200; return fBrightness; @@ -67,14 +68,14 @@ ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeExcep checkParameterRangeInDouble( _brightness, 0.0, 1.0 ); double fLuminance = _brightness * 200 - 100; sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustLuminance")), uno::makeAny( nLuminance ) ); } double SAL_CALL ScVbaPictureFormat::getContrast() throw (uno::RuntimeException) { sal_Int16 nContrast = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustContrast")) ) >>= nContrast; double fContrast = static_cast< double >( nContrast ); fContrast = ( fContrast + 100 ) / 200; return fContrast; @@ -86,7 +87,7 @@ ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException checkParameterRangeInDouble( _contrast, 0.0, 1.0 ); double fContrast = _contrast * 200 - 100; sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustContrast")), uno::makeAny( nContrast ) ); } @@ -112,13 +113,14 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc { double nContrast = getContrast(); nContrast += increment; - if( increment < 0 ) + //VBA, minz@cn.ibm.com. + if( nContrast < 0 ) { - increment = 0.0; + nContrast = 0.0; } - if( increment > 1 ) + if( nContrast > 1 ) { - increment = 1.0; + nContrast = 1.0; } setContrast( nContrast ); } @@ -142,3 +144,5 @@ ScVbaPictureFormat::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbapictureformat.hxx b/vbahelper/source/vbahelper/vbapictureformat.hxx index e7b6ed9c1a30..56422cc7b623 100644 --- a/vbahelper/source/vbahelper/vbapictureformat.hxx +++ b/vbahelper/source/vbahelper/vbapictureformat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,3 +60,5 @@ public: }; #endif//SC_VBA_PICTUREFORMAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbapropvalue.cxx b/vbahelper/source/vbahelper/vbapropvalue.cxx index 26437a359e8d..87a4e40e882c 100644 --- a/vbahelper/source/vbahelper/vbapropvalue.cxx +++ b/vbahelper/source/vbahelper/vbapropvalue.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,3 +44,5 @@ ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::Runtime { m_pListener->setValueEvent( _value ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx index 485ebee3ea8d..ca368e447118 100644 --- a/vbahelper/source/vbahelper/vbashape.cxx +++ b/vbahelper/source/vbahelper/vbashape.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,11 +36,12 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/RelOrientation.hpp> #include <ooo/vba/word/WdRelativeHorizontalPosition.hpp> #include <ooo/vba/word/WdRelativeVerticalPosition.hpp> #include <comphelper/processfactory.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <svx/unopage.hxx> #include <svx/unoshape.hxx> @@ -53,7 +55,6 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -using namespace ::vos; ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType ), m_xModel( xModel ) { @@ -141,22 +142,22 @@ ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw sShapeType = xShapeDescriptor->getShapeType(); OSL_TRACE("ScVbaShape::getType: %s", rtl::OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() ); // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape" - if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) ) + if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GroupShape")) ) ) return office::MsoShapeType::msoGroup; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape")) ) ) return office::MsoShapeType::msoPicture; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) || - sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape")) ) || + sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameShape")) ) ) return office::MsoShapeType::msoOLEControlObject; // OOo don't support office::MsoShapeType::msoComment as a Shape. - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ) ) return office::MsoShapeType::msoChart; // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape" - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ConnectorShape")) ) ) { enum drawing::ConnectorType connectorType; uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); - xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType; + xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind"))) >>= connectorType; if( connectorType == drawing::ConnectorType_CURVE ) return office::MsoShapeType::msoFreeform; else if( connectorType == drawing::ConnectorType_LINE ) @@ -164,15 +165,15 @@ ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw else return office::MsoShapeType::msoAutoShape; } - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")) ) ) return office::MsoShapeType::msoLine; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) || - sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")) ) || + sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape")) ) ) return office::MsoShapeType::msoAutoShape; - else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ) ) + else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TextShape")) ) ) return office::MsoShapeType::msoTextBox; else - throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be supported: " ) + sShapeType, uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("the shape type do not be supported: ")) + sShapeType, uno::Reference< uno::XInterface >() ); } // Attributes @@ -219,25 +220,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException) double SAL_CALL ScVbaShape::getLeft() throw (uno::RuntimeException) { - return m_pShapeHelper->getLeft(); + double left = 0; + try + { + left = m_pShapeHelper->getLeft(); + } + catch( uno::Exception& ) + { + // fail to get position by using XShape::getPosition() + sal_Int32 nLeft = 0; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft; + left = Millimeter::getInPoints( nLeft ); + } + return left; } void SAL_CALL ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException) { - m_pShapeHelper->setLeft( _left ); + try + { + m_pShapeHelper->setLeft( _left ); + } + catch( uno::Exception& ) + { + sal_Int32 nLeft = 0; + nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")), uno::makeAny( nLeft ) ); + } } double SAL_CALL ScVbaShape::getTop() throw (uno::RuntimeException) { - return m_pShapeHelper->getTop(); + double top = 0; + try + { + top = m_pShapeHelper->getTop(); + } + catch( uno::Exception& ) + { + sal_Int32 nTop = 0; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop; + top = Millimeter::getInPoints( nTop ); + } + return top; } void SAL_CALL ScVbaShape::setTop( double _top ) throw (uno::RuntimeException) { - return m_pShapeHelper->setTop( _top ); + try + { + m_pShapeHelper->setTop( _top ); + } + catch( uno::Exception& ) + { + sal_Int32 nTop = 0; + nTop = Millimeter::getInHundredthsOfOneMillimeter( _top ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")), uno::makeAny( nTop ) ); + } } sal_Bool SAL_CALL @@ -257,7 +299,7 @@ sal_Int32 SAL_CALL ScVbaShape::getZOrderPosition() throw (uno::RuntimeException) { sal_Int32 nZOrderPosition = 0; - uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); + uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")) ); aZOrderPosition >>= nZOrderPosition; return nZOrderPosition + 1; } @@ -273,7 +315,7 @@ ScVbaShape::getRotation() throw (uno::RuntimeException) { double dRotation = 0; sal_Int32 nRotation = 0; - m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation; + m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RotateAngle")) ) >>= nRotation; dRotation = static_cast< double >( nRotation /100 ); return dRotation; } @@ -282,7 +324,7 @@ void SAL_CALL ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException) { sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RotateAngle")), uno::makeAny( nRotation ) ); } uno::Reference< msforms::XLineFormat > SAL_CALL @@ -325,7 +367,7 @@ ScVbaShape::TextFrame() throw (uno::RuntimeException) void SAL_CALL ScVbaShape::Delete() throw (uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xShapes->remove( m_xShape ); } @@ -333,33 +375,33 @@ void SAL_CALL ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException) { sal_Int32 nOrderPositon; - uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); + uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")) ); aOrderPostion >>= nOrderPositon; switch( ZOrderCmd ) { case office::MsoZOrderCmd::msoBringToFront: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( SAL_MAX_INT32 ) ); break; case office::MsoZOrderCmd::msoSendToBack: - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( (sal_Int32)0 ) ); break; case office::MsoZOrderCmd::msoBringForward: nOrderPositon += 1; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( nOrderPositon ) ); break; case office::MsoZOrderCmd::msoSendBackward: if( nOrderPositon > 0 ) { nOrderPositon -= 1; - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( nOrderPositon ) ); } break; // below two commands use with Writer for text and image object. case office::MsoZOrderCmd::msoBringInFrontOfText: case office::MsoZOrderCmd::msoSendBehindText: - throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This ZOrderCmd is not implemented, it is use with writer.")), uno::Reference< uno::XInterface >() ); default: - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Parameter.")), uno::Reference< uno::XInterface >() ); } } @@ -412,7 +454,7 @@ ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal } else { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScaleHeight.Scale wrong value is given.")) , uno::Reference< uno::XInterface >() ); } } @@ -441,7 +483,7 @@ ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_ } else { - throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScaleHeight.Scale wrong value is given.")) , uno::Reference< uno::XInterface >() ); } } @@ -474,6 +516,17 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException ) return uno::makeAny( xShapeRange ); } +void SAL_CALL ScVbaShape::Copy() throw (uno::RuntimeException) +{ + if ( m_xModel.is() ) + { + Select( uno::Any() ); + // Copy this Shape. + rtl::OUString sUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Copy") ); + dispatchRequests( m_xModel, sUrl ); + } +} + sal_Bool SAL_CALL ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException) { @@ -504,35 +557,34 @@ sal_Int32 SAL_CALL ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException) { sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; - text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; - m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType; + sal_Int16 nType = text::RelOrientation::PAGE_LEFT; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType; - switch( eType ) + switch( nType ) { - case text::TextContentAnchorType_AT_PARAGRAPH: + case text::RelOrientation::FRAME: { nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn; break; } - case text::TextContentAnchorType_AT_PAGE: + case text::RelOrientation::PAGE_FRAME: { nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage; break; } - case text::TextContentAnchorType_AT_CHARACTER: + case text::RelOrientation::CHAR: { nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter; break; } - case text::TextContentAnchorType_AT_FRAME: - case text::TextContentAnchorType_AS_CHARACTER: + case text::RelOrientation::PAGE_PRINT_AREA: { nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; break; } default: { - nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; + throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() ); } } return nRelativeHorizontalPosition; @@ -541,23 +593,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException) void SAL_CALL ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException) { - text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; + sal_Int16 nType = text::RelOrientation::PAGE_FRAME; switch( _relativehorizontalposition ) { case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter: { - eType = text::TextContentAnchorType_AT_CHARACTER; + nType = text::RelOrientation::CHAR; break; } case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn: + { + nType = text::RelOrientation::PAGE_FRAME; + break; + } case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin: { - eType = text::TextContentAnchorType_AT_PARAGRAPH; + nType = text::RelOrientation::PAGE_PRINT_AREA; break; } case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage: { - eType = text::TextContentAnchorType_AT_PAGE; + nType = text::RelOrientation::PAGE_FRAME; break; } default: @@ -565,42 +621,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); } } - m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) ); + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) ); } sal_Int32 SAL_CALL ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException) { sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; - text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; - m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType; + sal_Int16 nType = text::RelOrientation::PAGE_FRAME; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType; - switch( eType ) + switch( nType ) { - case text::TextContentAnchorType_AT_PARAGRAPH: + case text::RelOrientation::FRAME: { nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph; break; } - case text::TextContentAnchorType_AT_PAGE: + case text::RelOrientation::PAGE_FRAME: { nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage; break; } - case text::TextContentAnchorType_AT_CHARACTER: + case text::RelOrientation::TEXT_LINE: { nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine; break; } - case text::TextContentAnchorType_AT_FRAME: - case text::TextContentAnchorType_AS_CHARACTER: + case text::RelOrientation::PAGE_PRINT_AREA: { nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; break; } default: { - nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; + throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() ); } } return nRelativeVerticalPosition; @@ -609,23 +664,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException) void SAL_CALL ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException) { - text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; + sal_Int16 nType = text::RelOrientation::PAGE_FRAME; switch( _relativeverticalposition ) { case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine: { - eType = text::TextContentAnchorType_AT_CHARACTER; + nType = text::RelOrientation::TEXT_LINE; break; } case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph: + { + nType = text::RelOrientation::FRAME; + break; + } case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin: { - eType = text::TextContentAnchorType_AT_PARAGRAPH; + nType = text::RelOrientation::PAGE_PRINT_AREA; break; } case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage: { - eType = text::TextContentAnchorType_AT_PAGE; + nType = text::RelOrientation::PAGE_FRAME; break; } default: @@ -633,7 +692,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); } } - m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) ); + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) ); } uno::Any SAL_CALL @@ -671,3 +730,5 @@ ScVbaShape::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx index 3020cfa47eca..44f2845d36d4 100644 --- a/vbahelper/source/vbahelper/vbashaperange.cxx +++ b/vbahelper/source/vbahelper/vbashaperange.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,7 +83,7 @@ ScVbaShapeRange::getShapes() throw (uno::RuntimeException) if ( !m_xShapes.is() ) { uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW ); + m_xShapes.set( xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection")) ), uno::UNO_QUERY_THROW ); sal_Int32 nLen = m_xIndexAccess->getCount(); for ( sal_Int32 index = 0; index < nLen; ++index ) m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) ); @@ -125,6 +126,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException) } } +rtl::OUString SAL_CALL ScVbaShapeRange::getName() throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + return xShape->getName( ); + } + throw uno::RuntimeException(); +} + +void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->setName( _name ); + } +} + double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException) { sal_Int32 nLen = getCount(); @@ -337,6 +359,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept throw uno::RuntimeException(); } +void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException) +{ + sal_Int32 nLen = getCount(); + for ( sal_Int32 index = 1; index <= nLen; ++index ) + { + uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); + xShape->ZOrder( ZOrderCmd ); + } +} + uno::Type SAL_CALL ScVbaShapeRange::getElementType() throw (uno::RuntimeException) { @@ -377,3 +409,5 @@ ScVbaShapeRange::getServiceNames() } return aServiceNames; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index 37952ee3d3a3..761d8de625f3 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,7 +87,7 @@ void ScVbaShapes::initBaseCollection() m_xNameAccess.set( xShapes, uno::UNO_QUERY ); } -ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel ) +ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel ) { m_xShapes.set( xShapes, uno::UNO_QUERY_THROW ); m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW ); @@ -235,7 +236,7 @@ ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeExcept uno::Any ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) { - rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) ); + rtl::OUString sCreateShapeName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape")) ); sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); @@ -244,7 +245,7 @@ ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWi uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); m_xShapes->add( xShape ); - rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) ); + rtl::OUString sName(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rectangle")) )); setDefaultShapeProperties( xShape ); setShape_NameProperty( xShape, sName ); @@ -267,7 +268,7 @@ ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWi uno::Any ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) { - rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) ); + rtl::OUString sCreateShapeName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.EllipseShape") ); sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); @@ -289,7 +290,7 @@ ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidt setShape_AnchorTypeAndRangeProperty(xShape, _aRange); */ - rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" )); + rtl::OUString name(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Oval")))); setDefaultShapeProperties(xShape); setShape_NameProperty(xShape, name); @@ -320,12 +321,12 @@ ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_In sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX ); sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY ); - uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")) ), uno::UNO_QUERY_THROW ); m_xShapes->add( xShape ); awt::Point aMovePositionIfRange( 0, 0 ); - rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) ); + rtl::OUString name(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line")) )); setDefaultShapeProperties(xShape); setShape_NameProperty(xShape, name); @@ -372,7 +373,7 @@ ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _n uno::Any ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) { - rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ); + rtl::OUString sCreateShapeName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TextShape") ); sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft ); sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop ); sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth ); @@ -383,7 +384,7 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, setDefaultShapeProperties(xShape); - rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Text Box") ); + rtl::OUString sName(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text Box")) )); setShape_NameProperty( xShape, sName ); awt::Size size; @@ -392,23 +393,23 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, xShape->setSize(size); uno::Reference< beans::XPropertySet > xShapeProps( xShape, uno::UNO_QUERY_THROW ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "AnchorType" ), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_LEFT ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrient" ), uno::makeAny( text::HoriOrientation::NONE ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nXPos ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation")), uno::makeAny( text::RelOrientation::PAGE_LEFT ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")), uno::makeAny( text::HoriOrientation::NONE ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")), uno::makeAny( nXPos ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_FRAME ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrient" ), uno::makeAny( text::VertOrientation::NONE ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nYPos ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation")), uno::makeAny( text::RelOrientation::PAGE_FRAME ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrient")), uno::makeAny( text::VertOrientation::NONE ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")), uno::makeAny( nYPos ) ); // set to visible drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID; - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( aLineStyle ) ); // set to font sal_Int16 nLayerId = 1; - rtl::OUString sLayerName = rtl::OUString::createFromAscii("Heaven"); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerID" ), uno::makeAny( nLayerId ) ); - xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerName" ), uno::makeAny( sLayerName ) ); + rtl::OUString sLayerName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Heaven")); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayerID")), uno::makeAny( nLayerId ) ); + xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayerName")), uno::makeAny( sLayerName ) ); ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ); @@ -447,11 +448,11 @@ void ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) { uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) ); - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) ); + xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SOLID")) ) ); + xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), uno::makeAny( sal_Int32(0xFFFFFF) ) ); + xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextWordWrap")), uno::makeAny( text::WrapTextMode_THROUGHT ) ); //not find in OOo2.3 - //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) ); + //xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Opaque")), uno::makeAny( sal_True ) ); } void @@ -460,7 +461,7 @@ ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShap uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); try { - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) ); + xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), uno::makeAny( sName ) ); } catch( script::BasicErrorException e ) { @@ -476,13 +477,4 @@ ScVbaShapes::createName( rtl::OUString sName ) return sName; } -#if 0 -//TODO helperapi using a writer document -awt::Point -calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument ) -{ - awt::Point aPoint( 0, 0 ); - uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); - return awt::Point(); -} -#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx index de15992fe49e..1a98998c8dca 100644 --- a/vbahelper/source/vbahelper/vbatextframe.cxx +++ b/vbahelper/source/vbahelper/vbatextframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,8 +44,8 @@ VbaTextFrame::setAsMSObehavior() //set property TextWordWrap default as False. // TextFitToSize control the text content. it seems we should set the default as False. // com.sun.star.drawing.TextFitToSizeType.NONE - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) ); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextWordWrap")), uno::makeAny( sal_False ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextFitToSize")), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); } sal_Int32 VbaTextFrame::getMargin( rtl::OUString sMarginType ) @@ -69,7 +70,7 @@ VbaTextFrame::getAutoSize() throw (uno::RuntimeException) // TextFitToSize control the text content. // and in mso, there isnot option TextWordWrap which means auto wrap. the default is False. sal_Bool bAutosize = sal_False; - uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) ); + uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowHeight")) ); aTextAutoGrowHeight >>= bAutosize; return bAutosize; } @@ -78,13 +79,13 @@ void SAL_CALL VbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException) { setAsMSObehavior(); - m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) ); + m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowHeight")), uno::makeAny( _autosize ) ); } float SAL_CALL VbaTextFrame::getMarginBottom() throw (uno::RuntimeException) { - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) ); + sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLowerDistance")) ); float fMargin = (float)Millimeter::getInPoints( nMargin ); return fMargin; } @@ -92,13 +93,13 @@ VbaTextFrame::getMarginBottom() throw (uno::RuntimeException) void SAL_CALL VbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException) { - setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom ); + setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLowerDistance")), _marginbottom ); } float SAL_CALL VbaTextFrame::getMarginTop() throw (uno::RuntimeException) { - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) ); + sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextUpperDistance")) ); float fMargin = (float)Millimeter::getInPoints( nMargin ); return fMargin; } @@ -106,13 +107,13 @@ VbaTextFrame::getMarginTop() throw (uno::RuntimeException) void SAL_CALL VbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException) { - setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop ); + setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextUpperDistance")), _margintop ); } float SAL_CALL VbaTextFrame::getMarginLeft() throw (uno::RuntimeException) { - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) ); + sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLeftDistance")) ); float fMargin = (float)Millimeter::getInPoints( nMargin ); return fMargin; } @@ -120,13 +121,13 @@ VbaTextFrame::getMarginLeft() throw (uno::RuntimeException) void SAL_CALL VbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException) { - setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft ); + setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLeftDistance")), _marginleft ); } float SAL_CALL VbaTextFrame::getMarginRight() throw (uno::RuntimeException) { - sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) ); + sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextRightDistance")) ); float fMargin = (float)Millimeter::getInPoints( nMargin ); return fMargin; } @@ -134,7 +135,7 @@ VbaTextFrame::getMarginRight() throw (uno::RuntimeException) void SAL_CALL VbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException) { - setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright ); + setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextRightDistance")), _marginright ); } @@ -164,3 +165,4 @@ VbaTextFrame::getServiceNames() return aServiceNames; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx index 132caef8b5e1..f789595d20ed 100644 --- a/vbahelper/source/vbahelper/vbawindowbase.cxx +++ b/vbahelper/source/vbahelper/vbawindowbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -175,3 +176,5 @@ void VbaWindowBase::construct( const uno::Reference< frame::XController >& xCont m_xController = xController; m_xWindow = xWindow; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk new file mode 100755 index 000000000000..48f4f9346ef5 --- /dev/null +++ b/vbahelper/util/makefile.mk @@ -0,0 +1,100 @@ +#************************************************************************* +# +# 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=.. + +PRJNAME=vbahelper +TARGET=vbahelper + +# --- Settings --------------------------------------------------- + +.INCLUDE : settings.mk + +TARGET_HELPER=vbahelper + +LIB1TARGET= $(SLB)$/$(TARGET).lib +LIB1FILES=$(SLB)$/$(TARGET)bits.lib + +SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX) + + +# dynamic libraries +SHL1STDLIBS= \ + $(CPPULIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(BASICLIB) \ + $(TOOLSLIB) \ + $(SALLIB)\ + $(SFXLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(VCLLIB) \ + $(SVTOOLLIB) \ + $(MSFILTERLIB) \ + $(TKLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET_HELPER) +SHL1USE_EXPORTS=name +SHL1LIBS=$(LIB1TARGET) + +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEFLIB1NAME=$(TARGET) + +TARGET_MSFORMS=msforms +SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno +SHL2IMPLIB= i$(TARGET_MSFORMS) + +SHL2VERSIONMAP=$(SOLARENV)/src/component.map +SHL2DEF=$(MISC)$/$(SHL2TARGET).def +DEF2NAME=$(SHL2TARGET) +SHL2STDLIBS= \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(COMPHELPERLIB) \ + $(SVLIB) \ + $(TOOLSLIB) \ + $(SALLIB)\ + $(VBAHELPERLIB) \ + $(SFXLIB) \ + $(SVXLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(VCLLIB) \ + $(TKLIB) \ + $(BASICLIB) \ + $(SVXMSFILTERLIB) \ + +SHL2DEPN=$(SHL1TARGETN) +SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib + +# --- Targets ----------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/vbahelper/util/msforms.component b/vbahelper/util/msforms.component index 98ce4a8451d4..98ce4a8451d4 100644..100755 --- a/vbahelper/util/msforms.component +++ b/vbahelper/util/msforms.component |