From 2e677c39818f3a6479ac9103ac9c7e8ef985eeb0 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 26 Sep 2012 23:45:28 +0200 Subject: gbuild: split uwinapi out of gb_STDLIBS Change-Id: I53316e0b9369d806197bccb42cf22d3497af43e7 --- basic/CppunitTest_basic_enable.mk | 1 + basic/CppunitTest_basic_nested_struct.mk | 1 + basic/CppunitTest_basic_scanner.mk | 1 + basic/Library_sb.mk | 1 + 4 files changed, 4 insertions(+) (limited to 'basic') diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk index 76a9ecd02664..3bd2bc87337a 100644 --- a/basic/CppunitTest_basic_enable.mk +++ b/basic/CppunitTest_basic_enable.mk @@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_enable, \ vcl \ xmlscript \ test \ + $(gb_UWINAPI) \ $(gb_STDLIBS) \ )) diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk index 098840c5cd54..fcadba3b0c84 100644 --- a/basic/CppunitTest_basic_nested_struct.mk +++ b/basic/CppunitTest_basic_nested_struct.mk @@ -29,6 +29,7 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_nested_struct, \ vcl \ xmlscript \ test \ + $(gb_UWINAPI) \ $(gb_STDLIBS) \ )) diff --git a/basic/CppunitTest_basic_scanner.mk b/basic/CppunitTest_basic_scanner.mk index 1c248b6f95d7..af058148e32f 100644 --- a/basic/CppunitTest_basic_scanner.mk +++ b/basic/CppunitTest_basic_scanner.mk @@ -29,6 +29,7 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_scanner, \ utl \ vcl \ xmlscript \ + $(gb_UWINAPI) \ $(gb_STDLIBS) \ )) diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index fa0e8201e941..de50d0c70f9f 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,sb,\ utl \ vcl \ xmlscript \ + $(gb_UWINAPI) \ $(gb_STDLIBS) \ )) -- cgit From b85c34978356eb01311f197f00f4dd5f808e3664 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 27 Sep 2012 00:49:12 +0200 Subject: gbuild: replace direct gb_STDLIBS use with ... ... new gb_LinkTarget_add_standard_system_libs Change-Id: Ib2bc843098db3d8c6822b45a3d21724e67f57d69 --- basic/CppunitTest_basic_enable.mk | 3 ++- basic/CppunitTest_basic_nested_struct.mk | 3 ++- basic/CppunitTest_basic_scanner.mk | 3 ++- basic/Library_sb.mk | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'basic') diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk index 3bd2bc87337a..c09080ce2276 100644 --- a/basic/CppunitTest_basic_enable.mk +++ b/basic/CppunitTest_basic_enable.mk @@ -29,9 +29,10 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_enable, \ xmlscript \ test \ $(gb_UWINAPI) \ - $(gb_STDLIBS) \ )) +$(eval $(call gb_CppunitTest_add_standard_system_libs,basic_enable)) + ifeq ($(GUI),WNT) $(eval $(call gb_CppunitTest_use_libraries,basic_enable, \ oleaut32 \ diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk index fcadba3b0c84..e43404a27094 100644 --- a/basic/CppunitTest_basic_nested_struct.mk +++ b/basic/CppunitTest_basic_nested_struct.mk @@ -30,9 +30,10 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_nested_struct, \ xmlscript \ test \ $(gb_UWINAPI) \ - $(gb_STDLIBS) \ )) +$(eval $(call gb_CppunitTest_add_standard_system_libs,basic_nested_struct)) + ifeq ($(GUI),WNT) $(eval $(call gb_CppunitTest_use_libraries,basic_nested_struct, \ oleaut32 \ diff --git a/basic/CppunitTest_basic_scanner.mk b/basic/CppunitTest_basic_scanner.mk index af058148e32f..36806d0e276d 100644 --- a/basic/CppunitTest_basic_scanner.mk +++ b/basic/CppunitTest_basic_scanner.mk @@ -30,9 +30,10 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_scanner, \ vcl \ xmlscript \ $(gb_UWINAPI) \ - $(gb_STDLIBS) \ )) +$(eval $(call gb_CppunitTest_add_standard_system_libs,basic_scanner)) + ifeq ($(GUI),WNT) $(eval $(call gb_CppunitTest_use_libraries,basic_scanner, \ oleaut32 \ diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index de50d0c70f9f..c29a58c4b366 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -50,9 +50,10 @@ $(eval $(call gb_Library_use_libraries,sb,\ vcl \ xmlscript \ $(gb_UWINAPI) \ - $(gb_STDLIBS) \ )) +$(eval $(call gb_Library_add_standard_system_libs,sb)) + ifneq ($(DISABLE_SCRIPTING),TRUE) $(eval $(call gb_Library_add_exception_objects,sb,\ -- cgit From dc397aae70433c0086ef41f4dac5289fb07a9b19 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 28 Sep 2012 15:31:46 +0200 Subject: gbuild: gb_Library_PLAINLIBS_NONE cleanup for WNT: add a new gb_LinkTarget_use_system_win32_libs to abstract different linker options on MSVC and GCC. Change-Id: Ic9bf2545f59bf7871e6fc06b290c486ddfbec03d --- basic/CppunitTest_basic_enable.mk | 2 +- basic/CppunitTest_basic_nested_struct.mk | 2 +- basic/CppunitTest_basic_scanner.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'basic') diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk index c09080ce2276..6e871736c1bf 100644 --- a/basic/CppunitTest_basic_enable.mk +++ b/basic/CppunitTest_basic_enable.mk @@ -34,7 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_enable, \ $(eval $(call gb_CppunitTest_add_standard_system_libs,basic_enable)) ifeq ($(GUI),WNT) -$(eval $(call gb_CppunitTest_use_libraries,basic_enable, \ +$(eval $(call gb_CppunitTest_use_system_win32_libs,basic_enable, \ oleaut32 \ )) endif diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk index e43404a27094..a768ddf007c7 100644 --- a/basic/CppunitTest_basic_nested_struct.mk +++ b/basic/CppunitTest_basic_nested_struct.mk @@ -35,7 +35,7 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_nested_struct, \ $(eval $(call gb_CppunitTest_add_standard_system_libs,basic_nested_struct)) ifeq ($(GUI),WNT) -$(eval $(call gb_CppunitTest_use_libraries,basic_nested_struct, \ +$(eval $(call gb_CppunitTest_use_system_win32_libs,basic_nested_struct, \ oleaut32 \ )) endif diff --git a/basic/CppunitTest_basic_scanner.mk b/basic/CppunitTest_basic_scanner.mk index 36806d0e276d..88876b75db9a 100644 --- a/basic/CppunitTest_basic_scanner.mk +++ b/basic/CppunitTest_basic_scanner.mk @@ -35,7 +35,7 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_scanner, \ $(eval $(call gb_CppunitTest_add_standard_system_libs,basic_scanner)) ifeq ($(GUI),WNT) -$(eval $(call gb_CppunitTest_use_libraries,basic_scanner, \ +$(eval $(call gb_CppunitTest_use_system_win32_libs,basic_scanner, \ oleaut32 \ )) endif -- cgit From 5032dc0fc339ba6b200e80a5482cc86e00662a0b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 28 Sep 2012 16:29:24 +0200 Subject: gbuild: invert handling of standard system libraries: Always link in gb_STDLIBS, except when the library explicitly opts out with gb_LinkTarget_disable_standard_system_libs. Change-Id: I489a99114fbfa46d0421a27cf6c7b899dc268a4a --- basic/CppunitTest_basic_enable.mk | 2 -- basic/CppunitTest_basic_nested_struct.mk | 2 -- basic/CppunitTest_basic_scanner.mk | 2 -- basic/Library_sb.mk | 2 -- 4 files changed, 8 deletions(-) (limited to 'basic') diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk index 6e871736c1bf..5f6587dec684 100644 --- a/basic/CppunitTest_basic_enable.mk +++ b/basic/CppunitTest_basic_enable.mk @@ -31,8 +31,6 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_enable, \ $(gb_UWINAPI) \ )) -$(eval $(call gb_CppunitTest_add_standard_system_libs,basic_enable)) - ifeq ($(GUI),WNT) $(eval $(call gb_CppunitTest_use_system_win32_libs,basic_enable, \ oleaut32 \ diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk index a768ddf007c7..268f29a43b1c 100644 --- a/basic/CppunitTest_basic_nested_struct.mk +++ b/basic/CppunitTest_basic_nested_struct.mk @@ -32,8 +32,6 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_nested_struct, \ $(gb_UWINAPI) \ )) -$(eval $(call gb_CppunitTest_add_standard_system_libs,basic_nested_struct)) - ifeq ($(GUI),WNT) $(eval $(call gb_CppunitTest_use_system_win32_libs,basic_nested_struct, \ oleaut32 \ diff --git a/basic/CppunitTest_basic_scanner.mk b/basic/CppunitTest_basic_scanner.mk index 88876b75db9a..193c4a5835a5 100644 --- a/basic/CppunitTest_basic_scanner.mk +++ b/basic/CppunitTest_basic_scanner.mk @@ -32,8 +32,6 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_scanner, \ $(gb_UWINAPI) \ )) -$(eval $(call gb_CppunitTest_add_standard_system_libs,basic_scanner)) - ifeq ($(GUI),WNT) $(eval $(call gb_CppunitTest_use_system_win32_libs,basic_scanner, \ oleaut32 \ diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index c29a58c4b366..457a52bf6bdf 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -52,8 +52,6 @@ $(eval $(call gb_Library_use_libraries,sb,\ $(gb_UWINAPI) \ )) -$(eval $(call gb_Library_add_standard_system_libs,sb)) - ifneq ($(DISABLE_SCRIPTING),TRUE) $(eval $(call gb_Library_add_exception_objects,sb,\ -- cgit From 93a118d728736a9ffb6269b2816d4a1428472baa Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 28 Sep 2012 17:57:08 +0200 Subject: fix WNT build: missed one oleaut32 Change-Id: Ic079200f6a3f1a1e7ac38f971e4da40a8dd39dd0 --- basic/Library_sb.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'basic') diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index 457a52bf6bdf..73eb63163628 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -138,8 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,sb,\ )) ifeq ($(GUI),WNT) -$(eval $(call gb_Library_use_libraries,sb,\ - uwinapi \ +$(eval $(call gb_Library_use_system_win32_libs,sb,\ oleaut32 \ )) endif -- cgit From c2ca6fabd1afc3fc07001721c2069d3c8db7000a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 29 Sep 2012 17:20:22 +0200 Subject: Use comphelper::getComponentContext ...and some further clean up. Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9 --- basic/source/classes/eventatt.cxx | 33 ++++++-------- basic/source/classes/sbunoobj.cxx | 96 +++++++++++++-------------------------- basic/source/classes/sbxmod.cxx | 10 ++-- basic/source/uno/dlgcont.cxx | 28 +++--------- basic/source/uno/namecont.cxx | 55 +++++++--------------- 5 files changed, 70 insertions(+), 152 deletions(-) (limited to 'basic') diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 1c111e2d2eda..79e2c3b707ee 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -94,23 +94,18 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere } else { - Reference< XComponentContext > xContext; - Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - if ( xContext.is() ) - { - Reference< provider::XScriptProviderFactory > xFactory( - xContext->getValueByName( + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); + Reference< provider::XScriptProviderFactory > xFactory( + xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ), - UNO_QUERY ); - OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" ); - if ( xFactory.is() ) - { - Any aCtx; - aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")); - xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY ); - } + UNO_QUERY ); + OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" ); + if ( xFactory.is() ) + { + Any aCtx; + aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")); + xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY ); } } @@ -469,10 +464,8 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit if( !xISP.is() ) return; - Reference< XComponentContext > xContext; - Reference< XPropertySet > xProps( xMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); + Reference< XComponentContext > xContext( + comphelper::getComponentContext( xMSF ) ); // Import the DialogModel Reference< XInputStream > xInput( xISP->createInputStream() ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index c79263493714..6735dfe6299c 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -162,26 +162,6 @@ void SetSbUnoObjectDfltPropName( SbxObject* pObj ) } } -Reference< XComponentContext > getComponentContext_Impl( void ) -{ - static Reference< XComponentContext > xContext; - - // Do we have already CoreReflection; if not obtain it - if( !xContext.is() ) - { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference< XPropertySet > xProps( xFactory, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - if (xProps.is()) - { - xProps->getPropertyValue( - ::rtl::OUString( "DefaultContext" ) ) >>= xContext; - OSL_ASSERT( xContext.is() ); - } - } - return xContext; -} - // save CoreReflection statically Reference< XIdlReflection > getCoreReflection_Impl( void ) { @@ -190,7 +170,8 @@ Reference< XIdlReflection > getCoreReflection_Impl( void ) // Do we have already CoreReflection; if not obtain it if( !xCoreReflection.is() ) { - Reference< XComponentContext > xContext = getComponentContext_Impl(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); if( xContext.is() ) { xContext->getValueByName( @@ -233,7 +214,8 @@ Reference< XHierarchicalNameAccess > getTypeProvider_Impl( void ) // Do we have already CoreReflection; if not obtain it if( !xAccess.is() ) { - Reference< XComponentContext > xContext = getComponentContext_Impl(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); if( xContext.is() ) { xContext->getValueByName( @@ -260,7 +242,8 @@ Reference< XTypeConverter > getTypeConverter_Impl( void ) // Do we have already CoreReflection; if not obtain it if( !xTypeConverter.is() ) { - Reference< XComponentContext > xContext = getComponentContext_Impl(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); if( xContext.is() ) { xTypeConverter = Converter::create(xContext); @@ -287,7 +270,8 @@ SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType ) { bNeedsInit = false; - Reference< XComponentContext > xContext = getComponentContext_Impl(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); if( xContext.is() ) { Reference xSMgr = xContext->getServiceManager(); @@ -3694,33 +3678,24 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, } // "Call" ctor using createInstanceWithArgumentsAndContext - Reference < XComponentContext > xContext; - if( xFirstParamContext.is() ) - { - xContext = xFirstParamContext; - } - else - { - Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xContext.set( xProps->getPropertyValue( rtl::OUString( "DefaultContext" ) ), UNO_QUERY_THROW ); - } + Reference < XComponentContext > xContext( + xFirstParamContext.is() + ? xFirstParamContext + : comphelper::getProcessComponentContext() ); Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); Any aRetAny; - if( xServiceMgr.is() ) + ::rtl::OUString aServiceName = GetName(); + Reference < XInterface > xRet; + try { - ::rtl::OUString aServiceName = GetName(); - Reference < XInterface > xRet; - try - { - xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext ); - } - catch( const Exception& ) - { - implHandleAnyException( ::cppu::getCaughtException() ); - } - aRetAny <<= xRet; + xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext ); + } + catch( const Exception& ) + { + implHandleAnyException( ::cppu::getCaughtException() ); } + aRetAny <<= xRet; unoToSbxValue( pVar, aRetAny ); // Copy back out parameters? @@ -3835,8 +3810,7 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, if( !xContextToUse.is() ) { - Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xContextToUse.set( xProps->getPropertyValue( rtl::OUString( "DefaultContext" ) ), UNO_QUERY_THROW ); + xContextToUse = comphelper::getProcessComponentContext(); --nAllowedParamCount; } @@ -4205,22 +4179,12 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr SbxVariableRef refVar = rPar.Get(0); - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference< XPropertySet> xPSMPropertySet( xFactory, UNO_QUERY ); - if( xPSMPropertySet.is() ) - { - Any aContextAny = xPSMPropertySet->getPropertyValue( - ::rtl::OUString( "DefaultContext" ) ); + Any aContextAny( comphelper::getProcessComponentContext() ); - SbUnoObjectRef xUnoObj = new SbUnoObject - ( ::rtl::OUString( "DefaultContext" ), - aContextAny ); - refVar->PutObject( (SbUnoObject*)xUnoObj ); - } - else - { - refVar->PutObject( NULL ); - } + SbUnoObjectRef xUnoObj = new SbUnoObject + ( ::rtl::OUString( "DefaultContext" ), + aContextAny ); + refVar->PutObject( (SbUnoObject*)xUnoObj ); } //======================================================================== @@ -4544,7 +4508,8 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: { Reference< XInterface > xRet; - Reference< XComponentContext > xContext = getComponentContext_Impl(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj ); @@ -4665,7 +4630,8 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP // For now: Take first interface that allows to instantiate COM wrapper // TODO: Check if support for multiple interfaces is needed - Reference< XComponentContext > xContext = getComponentContext_Impl(); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); Reference< XSingleServiceFactory > xComImplementsFactory ( diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 3257a4ad5214..759b9b25f74b 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -139,7 +139,6 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV { if ( pMod->GetModuleType() == ModuleType::DOCUMENT ) { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); // Use proxy factory service to create aggregatable proxy. SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pMod->GetObject() ); Reference< XInterface > xIf; @@ -157,11 +156,10 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV { try { - Reference< XMultiComponentFactory > xMFac( xFactory, UNO_QUERY_THROW ); - Reference< XPropertySet> xPSMPropertySet( xMFac, UNO_QUERY_THROW ); - Reference< XComponentContext > xCtx; - xPSMPropertySet->getPropertyValue( - String( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xCtx; + Reference< XComponentContext > xCtx( + comphelper::getProcessComponentContext() ); + Reference< XMultiComponentFactory > xMFac( + xCtx->getServiceManager() ); Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( "com.sun.star.reflection.ProxyFactory" ), xCtx ), UNO_QUERY_THROW ); m_xAggProxy = xProxyFac->createProxy( xIf ); } diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 3f1101c4eac0..2cfe035a21b7 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -117,23 +116,12 @@ bool SAL_CALL SfxDialogLibraryContainer::isLibraryElementValid( Any aElement ) c bool writeOasis2OOoLibraryElement( Reference< XInputStream > xInput, Reference< XOutputStream > xOutput ) { - Reference< XMultiServiceFactory > xMSF( - comphelper::getProcessServiceFactory() ); - - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); - if (! xSMgr.is()) - { - return sal_False; - } - Reference< xml::sax::XParser > xParser( xSMgr->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -267,10 +255,8 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e Reference< io::XInputStream > xInput( xISP->createInputStream() ); Reference< XNameContainer > xDialogModel( mxMSF->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY ); - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); + Reference< XComponentContext > xContext( + comphelper::getComponentContext( mxMSF ) ); ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument ); std::vector< rtl::OUString > vEmbeddedImageURLs; GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs ); @@ -351,10 +337,8 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement if( !xInput.is() ) return aRetAny; - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); + Reference< XComponentContext > xContext( + comphelper::getComponentContext( mxMSF ) ); InputSource source; source.aInputStream = xInput; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index f8d946edd69c..77ced57a2eec 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -2725,29 +2725,20 @@ OUString SfxLibraryContainer::expand_url( const OUString& url ) { if( !mxMacroExpander.is() ) { - Reference< XPropertySet > xProps( mxMSF, UNO_QUERY_THROW ); - if( xProps.is() ) + Reference< XComponentContext > xContext( + comphelper::getComponentContext( mxMSF ) ); + Reference< util::XMacroExpander > xExpander; + xContext->getValueByName( + OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander; + if(! xExpander.is()) { - Reference< XComponentContext > xContext; - xProps->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext; - SAL_WARN_IF(!xContext.is(), "basic", "no DefaultContext"); - if( xContext.is() ) - { - Reference< util::XMacroExpander > xExpander; - xContext->getValueByName( - OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander; - if(! xExpander.is()) - { - throw uno::DeploymentException( - OUSTR("no macro expander singleton available!"), Reference< XInterface >() ); - } - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !mxMacroExpander.is() ) - { - mxMacroExpander = xExpander; - } - } + throw uno::DeploymentException( + OUSTR("no macro expander singleton available!"), Reference< XInterface >() ); + } + MutexGuard guard( Mutex::getGlobalMutex() ); + if( !mxMacroExpander.is() ) + { + mxMacroExpander = xExpander; } } @@ -3172,7 +3163,8 @@ void SAL_CALL SfxLibrary::removeChangesListener( const Reference< XChangesListen #define sDialogLibMediaType "application/vnd.sun.star.dialog-library" ScriptExtensionIterator::ScriptExtensionIterator( void ) - : m_eState( USER_EXTENSIONS ) + : m_xContext( comphelper::getProcessComponentContext() ) + , m_eState( USER_EXTENSIONS ) , m_bUserPackagesLoaded( false ) , m_bSharedPackagesLoaded( false ) , m_bBundledPackagesLoaded( false ) @@ -3180,22 +3172,7 @@ ScriptExtensionIterator::ScriptExtensionIterator( void ) , m_iSharedPackage( 0 ) , m_iBundledPackage( 0 ) , m_pScriptSubPackageIterator( NULL ) -{ - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference< XPropertySet > xProps( xFactory, UNO_QUERY_THROW ); - if (xProps.is()) - { - xProps->getPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= m_xContext; - SAL_WARN_IF(!m_xContext.is(), "basic", "no DefaultContext"); - } - if( !m_xContext.is() ) - { - throw RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptExtensionIterator::init(), no XComponentContext")), - Reference< XInterface >() ); - } -} +{} rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib ) { -- cgit From 36a2db3722b79ed3df075d7f3fa77fb761bcf5a4 Mon Sep 17 00:00:00 2001 From: Arnaud Versini Date: Sat, 29 Sep 2012 14:47:11 +0200 Subject: Replace usage of rtl_*Memory with equivalent from string.h Change-Id: I50ffc10f007f03c3252ef0196b59b881429cc159 Reviewed-on: https://gerrit.libreoffice.org/734 Reviewed-by: Norbert Thiebaud Tested-by: Norbert Thiebaud --- basic/source/basmgr/basmgr.cxx | 2 +- basic/source/runtime/iosys.cxx | 5 +++-- basic/source/uno/scriptcont.cxx | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'basic') diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 7f5c691da472..3bd3a52438b2 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -2009,7 +2009,7 @@ uno::Sequence< sal_Int8 > implGetDialogData( SbxObject* pDialog ) uno::Sequence< sal_Int8 > aData( nLen ); sal_Int8* pDestData = aData.getArray(); const sal_Int8* pSrcData = (const sal_Int8*)aMemStream.GetData(); - rtl_copyMemory( pDestData, pSrcData, nLen ); + memcpy( pDestData, pSrcData, nLen ); return aData; } diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 7f2753ad8b61..d03b8a67d58d 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include @@ -435,14 +436,14 @@ sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize ) { Sequence aData; nSize = xIS->readBytes( aData, nSize ); - rtl_copyMemory( pData, aData.getConstArray(), nSize ); + memcpy( pData, aData.getConstArray(), nSize ); return nSize; } else if( xS.is() && (xISFromS = xS->getInputStream()).is() ) { Sequence aData; nSize = xISFromS->readBytes( aData, nSize ); - rtl_copyMemory( pData, aData.getConstArray(), nSize ); + memcpy(pData, aData.getConstArray(), nSize ); return nSize; } else diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index cdd4b9ef6b56..393dc7771238 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -639,7 +639,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, sal_Int32 nSize = (sal_Int32)aMemStream.Tell(); Sequence< sal_Int8 > aBinSeq( nSize ); sal_Int8* pData = aBinSeq.getArray(); - ::rtl_copyMemory( pData, aMemStream.GetData(), nSize ); + memcpy( pData, aMemStream.GetData(), nSize ); Reference< XOutputStream > xOut = xCodeStream->getOutputStream(); if ( !xOut.is() ) @@ -775,7 +775,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, sal_Int32 nSize = (sal_Int32)aMemStream.Tell(); Sequence< sal_Int8 > aBinSeq( nSize ); sal_Int8* pData = aBinSeq.getArray(); - ::rtl_copyMemory( pData, aMemStream.GetData(), nSize ); + memcpy( pData, aMemStream.GetData(), nSize ); Reference< XOutputStream > xOut = xCodeStream->getOutputStream(); if ( xOut.is() ) -- cgit From af4df7ac089134df888ada3cd36b27a0b62babab Mon Sep 17 00:00:00 2001 From: Jack Leigh Date: Wed, 3 Oct 2012 16:35:47 +0100 Subject: fdo#48257 collect function prototypes from basic/ into single header file Change-Id: I1666e64b2b611054e1a713a76575e2f06781f80a --- basic/source/inc/date.hxx | 37 +++++++++++++++++++++++++++++++++++++ basic/source/runtime/methods.cxx | 8 +------- basic/source/runtime/methods1.cxx | 13 +------------ basic/source/sbx/sbxscan.cxx | 8 +------- 4 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 basic/source/inc/date.hxx (limited to 'basic') diff --git a/basic/source/inc/date.hxx b/basic/source/inc/date.hxx new file mode 100644 index 000000000000..cd38c896d1df --- /dev/null +++ b/basic/source/inc/date.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SBDATE_HXX +#define _SBDATE_HXX + +bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); + +sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ); + +sal_Int16 implGetDateYear( double aDate ); +sal_Int16 implGetDateMonth( double aDate ); +sal_Int16 implGetDateDay( double aDate ); + +sal_Int16 implGetHour( double dDate ); +sal_Int16 implGetMinute( double dDate ); +sal_Int16 implGetSecond( double dDate ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index a90cc0e72817..054de265eb46 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -63,6 +63,7 @@ using namespace com::sun::star; #include +#include "date.hxx" #include "stdobj.hxx" #include #include "rtlproto.hxx" @@ -103,9 +104,6 @@ SbxVariable* getDefaultProp( SbxVariable* pRef ); #ifndef DISABLE_SCRIPTING -// forward decl. -bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); - // from source/classes/sbxmod.cxx uno::Reference< frame::XModel > getDocumentModel( StarBASIC* ); @@ -1701,8 +1699,6 @@ sal_Int16 implGetDateMonth( double aDate ) return nRet; } -sal_Int16 implGetDateYear( double aDate ); - // Function to convert date to ISO 8601 date format RTLFUNC(CDateToIso) { @@ -1956,8 +1952,6 @@ RTLFUNC(Hour) } } -sal_Int16 implGetMinute( double dDate ); - RTLFUNC(Minute) { (void)pBasic; diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 3e1d94900f76..4692ca49d47d 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -32,6 +32,7 @@ #include #include +#include "date.hxx" #include "sbintern.hxx" #include "runtime.hxx" #include "stdobj.hxx" @@ -57,7 +58,6 @@ using namespace com::sun::star::i18n; void unoToSbxValue( SbxVariable* pVar, const Any& aValue ); Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL ); -sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ); static Reference< XCalendar3 > getLocaleCalendar( void ) { @@ -1906,17 +1906,6 @@ IntervalInfo* getIntervalInfo( const String& rStringCode ) return pInfo; } -// From methods.cxx -bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); -sal_Int16 implGetDateDay( double aDate ); -sal_Int16 implGetDateMonth( double aDate ); -sal_Int16 implGetDateYear( double aDate ); - -sal_Int16 implGetHour( double dDate ); -sal_Int16 implGetMinute( double dDate ); -sal_Int16 implGetSecond( double dDate ); - - inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int16& rnDay, double dDate ) { rnDay = implGetDateDay( dDate ); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index bc235236d785..7ea06b5e4fb5 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -39,6 +39,7 @@ #include #include "basrid.hxx" +#include "date.hxx" #include "runtime.hxx" #include @@ -689,13 +690,6 @@ VbaFormatInfo* getFormatInfo( const String& rFmt ) #define VBAFORMAT_LOWERCASE "<" #define VBAFORMAT_UPPERCASE ">" -// From methods1.cxx -sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ); -// from methods.cxx -sal_Int16 implGetMinute( double dDate ); -sal_Int16 implGetDateYear( double aDate ); -bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); - void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const { short nComma = 0; -- cgit From a20f9a410fdd3f776f870434bc39219d5fc64b40 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 3 Oct 2012 13:30:43 +0200 Subject: fdo#46808, Adapt xml::sax::XParser UNO service to new style The xml.sax.Parser service already existed, it just did not have a new-style service to create it. Change-Id: I6f145a7504ff9e149c802f723991954a2801cbc9 --- basic/source/uno/dlgcont.cxx | 20 +++++--------------- basic/source/uno/namecont.cxx | 18 +++--------------- basic/source/uno/scriptcont.cxx | 12 +++--------- 3 files changed, 11 insertions(+), 39 deletions(-) (limited to 'basic') diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 2cfe035a21b7..b9ad7f19ecce 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include @@ -32,6 +32,7 @@ #include "com/sun/star/document/XGraphicObjectResolver.hpp" #include "dlgcont.hxx" #include "sbmodule.hxx" +#include #include #include #include @@ -122,12 +123,7 @@ bool writeOasis2OOoLibraryElement( Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); - Reference< xml::sax::XParser > xParser( - xSMgr->createInstanceWithContext( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.xml.sax.Parser" ) ), - xContext ), - UNO_QUERY ); + Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); Reference< xml::sax::XExtendedDocumentHandler > xWriter( xSMgr->createInstanceWithContext( @@ -139,7 +135,7 @@ bool writeOasis2OOoLibraryElement( Reference< io::XActiveDataSource > xSource( xWriter, UNO_QUERY ); xSource->setOutputStream( xOutput ); - if ( !xParser.is() || !xWriter.is() ) + if ( !xWriter.is() ) { return sal_False; } @@ -297,13 +293,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement // return aRetAny; //} - Reference< XParser > xParser( mxMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY ); - if( !xParser.is() ) - { - OSL_FAIL( "### couldn't create sax parser component\n" ); - return aRetAny; - } + Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(mxMSF) ); Reference< XNameContainer > xDialogModel( mxMSF->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY ); diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 77ced57a2eec..dfce89aa5101 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -650,13 +650,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, maLibraryPath = SvtPathOptions().GetBasicPath(); } - Reference< XParser > xParser( mxMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY ); - if( !xParser.is() ) - { - SAL_WARN("basic", "couldn't create sax parser component"); - return; - } + Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF)); uno::Reference< io::XInputStream > xInput; @@ -1603,13 +1597,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib, ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage, const OUString& aIndexFileName ) { - Reference< XParser > xParser( mxMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY ); - if( !xParser.is() ) - { - SAL_WARN("basic", "couldn't create sax parser component"); - return false; - } + Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF)); sal_Bool bLink = sal_False; bool bStorage = false; diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 393dc7771238..bbc8509d23c2 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -20,7 +20,7 @@ #include "scriptcont.hxx" #include "sbmodule.hxx" #include -#include +#include #include #include #include @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -238,14 +239,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement { Any aRetAny; - Reference< XParser > xParser( mxMSF->createInstance( - OUString( "com.sun.star.xml.sax.Parser" ) ), UNO_QUERY ); - if( !xParser.is() ) - { - OSL_FAIL( "### couldn't create sax parser component\n" ); - return aRetAny; - } - + Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(mxMSF) ); // Read from storage? sal_Bool bStorage = xInStream.is(); -- cgit From 38968e2963302e650b718e5882ef85ff12f71e40 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 10 Oct 2012 14:56:29 +0300 Subject: WaE [loplugin]: statement alignment Change-Id: Ia09c74e02d261de5946e6d7e0530a7913e0bcb8d --- basic/source/comp/exprtree.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'basic') diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 710965dd56cb..1a4b465ded02 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -819,10 +819,22 @@ short SbiConstExpression::GetShortValue() else { double n = nVal; - if( n > 0 ) n += .5; else n -= .5; - if( n > SbxMAXINT ) n = SbxMAXINT, pParser->Error( SbERR_OUT_OF_RANGE ); + if( n > 0 ) + n += .5; else - if( n < SbxMININT ) n = SbxMININT, pParser->Error( SbERR_OUT_OF_RANGE ); + n -= .5; + + if( n > SbxMAXINT ) + { + n = SbxMAXINT; + pParser->Error( SbERR_OUT_OF_RANGE ); + } + else if( n < SbxMININT ) + { + n = SbxMININT; + pParser->Error( SbERR_OUT_OF_RANGE ); + } + return (short) n; } } -- cgit From f7a24eff2d40ca30c6f299ab6534393c5c146b95 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 12 Oct 2012 13:26:46 +0200 Subject: mark lcl_ functions static or rename them if they are not local at all http://lists.freedesktop.org/archives/libreoffice/2012-October/039639.html Change-Id: I231f0b367bf0b513c6c1ce4c4cfdb7c3dc8660d5 --- basic/source/classes/sbunoobj.cxx | 8 ++++---- basic/source/runtime/methods1.cxx | 6 +++--- basic/source/runtime/step0.cxx | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'basic') diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 6735dfe6299c..cd43e1b4c6bd 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -494,7 +494,7 @@ void clearNativeObjectWrapperVector( void ) GaNativeObjectWrapperVector::get().clear(); } -sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) +static sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) { NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get(); sal_uInt32 nIndex = rNativeObjectWrapperVector.size(); @@ -502,7 +502,7 @@ sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) return nIndex; } -SbxObject* lcl_getNativeObject( sal_uInt32 nIndex ) +static SbxObject* lcl_getNativeObject( sal_uInt32 nIndex ) { SbxObjectRef xRetObj; NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get(); @@ -4552,7 +4552,7 @@ typedef std::vector< StarBasicDisposeItem* > DisposeItemVector; static DisposeItemVector GaDisposeItemVector; -DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic ) +static DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic ) { DisposeItemVector::iterator it; for( it = GaDisposeItemVector.begin() ; it != GaDisposeItemVector.end() ; ++it ) @@ -4564,7 +4564,7 @@ DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic ) return GaDisposeItemVector.end(); } -StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic ) +static StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic ) { DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic ); StarBasicDisposeItem* pItem = (it != GaDisposeItemVector.end()) ? *it : NULL; diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 4692ca49d47d..7072c09cb3d7 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -915,7 +915,7 @@ RTLFUNC(FindPropertyObject) -sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, +static sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray ) { sal_uIntPtr nFPos = pStrm->Tell(); @@ -1001,7 +1001,7 @@ sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, return pStrm->GetErrorCode() ? sal_False : sal_True; } -sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, +static sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray ) { (void)bBinary; @@ -1111,7 +1111,7 @@ sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, // nCurDim = 1...n -sal_Bool lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, +static sal_Bool lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, sal_Bool bBinary, short nCurDim, short* pOtherDims, sal_Bool bWrite ) { DBG_ASSERT( nCurDim > 0,"Bad Dim"); diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 40d8f6982fcb..05a2759af4ef 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -43,8 +43,8 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: // for a patch forward declaring these methods below makes sense // but, #FIXME lets really just move the methods to the top -void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType ); -void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled ); +static void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType ); +static void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled ); SbxVariable* getDefaultProp( SbxVariable* pRef ); @@ -972,7 +972,7 @@ void SbiRuntime::StepREDIMP_ERASE() refVar->SetType( SbxEMPTY ); } -void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType ) +static void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType ) { sal_uInt16 nSavFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); @@ -981,7 +981,7 @@ void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType ) refVar->Clear(); } -void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled ) +static void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled ) { SbxDataType eType = refVar->GetType(); if( eType & SbxARRAY ) -- cgit