Kaydet (Commit) 419d074d authored tarafından Olivier Hallot's avatar Olivier Hallot Kaydeden (comit) Luboš Luňák

More OUString cleanup in vbahelper

Change-Id: Ie7e350698900f1c1cacb6ebc3fa6716ef03ab782
Reviewed-on: https://gerrit.libreoffice.org/575Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 0cb1b968
...@@ -33,7 +33,7 @@ const char sAppService[] = "ooo.vba.Application"; ...@@ -33,7 +33,7 @@ const char sAppService[] = "ooo.vba.Application";
VbaGlobalsBase::VbaGlobalsBase( VbaGlobalsBase::VbaGlobalsBase(
const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< ov::XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName ) const uno::Reference< uno::XComponentContext >& xContext, const OUString& sDocCtxName )
: Globals_BASE( xParent, xContext ) : Globals_BASE( xParent, xContext )
, msDocCtxName( sDocCtxName ) , msDocCtxName( sDocCtxName )
, msApplication( RTL_CONSTASCII_USTRINGPARAM("Application") ) , msApplication( RTL_CONSTASCII_USTRINGPARAM("Application") )
...@@ -43,14 +43,14 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s ...@@ -43,14 +43,14 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s
uno::Reference< uno::XInterface > aSrvMgr; uno::Reference< uno::XInterface > aSrvMgr;
if ( xContext.is() && xContext->getServiceManager().is() ) if ( xContext.is() && xContext->getServiceManager().is() )
{ {
aSrvMgr = xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.OServiceManagerWrapper") ), xContext ); aSrvMgr = xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.comp.stoc.OServiceManagerWrapper" , xContext );
} }
::cppu::ContextEntry_Init aHandlerContextInfo[] = ::cppu::ContextEntry_Init aHandlerContextInfo[] =
{ {
::cppu::ContextEntry_Init( msApplication, uno::Any() ), ::cppu::ContextEntry_Init( msApplication, uno::Any() ),
::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ), ::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
::cppu::ContextEntry_Init( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.lang.theServiceManager" ) ), uno::makeAny( aSrvMgr ) ) ::cppu::ContextEntry_Init( "/singletons/com.sun.star.lang.theServiceManager" , uno::makeAny( aSrvMgr ) )
}; };
// don't pass a delegate, this seems to introduce yet another cyclic dependency ( and // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
// some strange behavior // some strange behavior
...@@ -117,7 +117,7 @@ VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs ) ...@@ -117,7 +117,7 @@ VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs )
} }
uno::Reference< uno::XInterface > SAL_CALL uno::Reference< uno::XInterface > SAL_CALL
VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException) VbaGlobalsBase::createInstance( const OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
{ {
uno::Reference< uno::XInterface > xReturn; uno::Reference< uno::XInterface > xReturn;
if ( aServiceSpecifier == sAppService ) if ( aServiceSpecifier == sAppService )
...@@ -132,7 +132,7 @@ VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw ...@@ -132,7 +132,7 @@ VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw
} }
uno::Reference< uno::XInterface > SAL_CALL uno::Reference< uno::XInterface > SAL_CALL
VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException) VbaGlobalsBase::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
{ {
uno::Reference< uno::XInterface > xReturn; uno::Reference< uno::XInterface > xReturn;
...@@ -147,21 +147,21 @@ VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpec ...@@ -147,21 +147,21 @@ VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpec
return xReturn; return xReturn;
} }
uno::Sequence< ::rtl::OUString > SAL_CALL uno::Sequence< OUString > SAL_CALL
VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException) VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException)
{ {
static const rtl::OUString names[] = { static const OUString names[] = {
// common // common
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ), "ooo.vba.msforms.UserForm" ,
}; };
static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) ); static uno::Sequence< OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) );
return serviceNames; return serviceNames;
} }
bool bool
VbaGlobalsBase::hasServiceName( const rtl::OUString& serviceName ) VbaGlobalsBase::hasServiceName( const OUString& serviceName )
{ {
uno::Sequence< rtl::OUString > sServiceNames( getAvailableServiceNames() ); uno::Sequence< OUString > sServiceNames( getAvailableServiceNames() );
sal_Int32 nLen = sServiceNames.getLength(); sal_Int32 nLen = sServiceNames.getLength();
for ( sal_Int32 index = 0; index < nLen; ++index ) for ( sal_Int32 index = 0; index < nLen; ++index )
{ {
......
...@@ -34,15 +34,15 @@ double SAL_CALL VbaPageSetupBase::getTopMargin() throw (css::uno::RuntimeExcepti ...@@ -34,15 +34,15 @@ double SAL_CALL VbaPageSetupBase::getTopMargin() throw (css::uno::RuntimeExcepti
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); uno::Any aValue = mxPageProps->getPropertyValue( "HeaderIsOn" );
aValue >>= headerOn; aValue >>= headerOn;
aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); aValue = mxPageProps->getPropertyValue( "TopMargin" );
aValue >>= topMargin; aValue >>= topMargin;
if( headerOn ) if( headerOn )
{ {
aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); aValue = mxPageProps->getPropertyValue( "HeaderHeight" );
aValue >>= headerHeight; aValue >>= headerHeight;
topMargin = topMargin + headerHeight; topMargin = topMargin + headerHeight;
} }
...@@ -62,18 +62,18 @@ void SAL_CALL VbaPageSetupBase::setTopMargin( double margin ) throw (css::uno::R ...@@ -62,18 +62,18 @@ void SAL_CALL VbaPageSetupBase::setTopMargin( double margin ) throw (css::uno::R
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); uno::Any aValue = mxPageProps->getPropertyValue( "HeaderIsOn" );
aValue >>= headerOn; aValue >>= headerOn;
if( headerOn ) if( headerOn )
{ {
aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); aValue = mxPageProps->getPropertyValue( "HeaderHeight" );
aValue >>= headerHeight; aValue >>= headerHeight;
topMargin -= headerHeight; topMargin -= headerHeight;
} }
aValue <<= topMargin; aValue <<= topMargin;
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); mxPageProps->setPropertyValue( "TopMargin" , aValue );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
...@@ -88,15 +88,15 @@ double SAL_CALL VbaPageSetupBase::getBottomMargin() throw (css::uno::RuntimeExce ...@@ -88,15 +88,15 @@ double SAL_CALL VbaPageSetupBase::getBottomMargin() throw (css::uno::RuntimeExce
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); uno::Any aValue = mxPageProps->getPropertyValue( "FooterIsOn" );
aValue >>= footerOn; aValue >>= footerOn;
aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); aValue = mxPageProps->getPropertyValue( "BottomMargin" );
aValue >>= bottomMargin; aValue >>= bottomMargin;
if( footerOn ) if( footerOn )
{ {
aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); aValue = mxPageProps->getPropertyValue( "FooterHeight" );
aValue >>= footerHeight; aValue >>= footerHeight;
bottomMargin += footerHeight; bottomMargin += footerHeight;
} }
...@@ -116,18 +116,18 @@ void SAL_CALL VbaPageSetupBase::setBottomMargin( double margin ) throw (css::uno ...@@ -116,18 +116,18 @@ void SAL_CALL VbaPageSetupBase::setBottomMargin( double margin ) throw (css::uno
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); uno::Any aValue = mxPageProps->getPropertyValue( "FooterIsOn" );
aValue >>= footerOn; aValue >>= footerOn;
if( footerOn ) if( footerOn )
{ {
aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); aValue = mxPageProps->getPropertyValue( "FooterHeight" );
aValue >>= footerHeight; aValue >>= footerHeight;
bottomMargin -= footerHeight; bottomMargin -= footerHeight;
} }
aValue <<= bottomMargin; aValue <<= bottomMargin;
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); mxPageProps->setPropertyValue( "BottomMargin" , aValue );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
...@@ -139,7 +139,7 @@ double SAL_CALL VbaPageSetupBase::getRightMargin() throw (css::uno::RuntimeExcep ...@@ -139,7 +139,7 @@ double SAL_CALL VbaPageSetupBase::getRightMargin() throw (css::uno::RuntimeExcep
sal_Int32 rightMargin = 0; sal_Int32 rightMargin = 0;
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))); uno::Any aValue = mxPageProps->getPropertyValue( "RightMargin" );
aValue >>= rightMargin; aValue >>= rightMargin;
} }
catch( uno::Exception& ) catch( uno::Exception& )
...@@ -156,7 +156,7 @@ void SAL_CALL VbaPageSetupBase::setRightMargin( double margin ) throw (css::uno: ...@@ -156,7 +156,7 @@ void SAL_CALL VbaPageSetupBase::setRightMargin( double margin ) throw (css::uno:
{ {
uno::Any aValue; uno::Any aValue;
aValue <<= rightMargin; aValue <<= rightMargin;
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin")), aValue ); mxPageProps->setPropertyValue( "RightMargin" , aValue );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
...@@ -169,7 +169,7 @@ double SAL_CALL VbaPageSetupBase::getLeftMargin() throw (css::uno::RuntimeExcept ...@@ -169,7 +169,7 @@ double SAL_CALL VbaPageSetupBase::getLeftMargin() throw (css::uno::RuntimeExcept
sal_Int32 leftMargin = 0; sal_Int32 leftMargin = 0;
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))); uno::Any aValue = mxPageProps->getPropertyValue( "LeftMargin" );
aValue >>= leftMargin; aValue >>= leftMargin;
} }
catch( uno::Exception& ) catch( uno::Exception& )
...@@ -186,7 +186,7 @@ void SAL_CALL VbaPageSetupBase::setLeftMargin( double margin ) throw (css::uno:: ...@@ -186,7 +186,7 @@ void SAL_CALL VbaPageSetupBase::setLeftMargin( double margin ) throw (css::uno::
{ {
uno::Any aValue; uno::Any aValue;
aValue <<= leftMargin; aValue <<= leftMargin;
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin")), aValue ); mxPageProps->setPropertyValue( "LeftMargin" , aValue );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
...@@ -198,7 +198,7 @@ double SAL_CALL VbaPageSetupBase::getHeaderMargin() throw (css::uno::RuntimeExce ...@@ -198,7 +198,7 @@ double SAL_CALL VbaPageSetupBase::getHeaderMargin() throw (css::uno::RuntimeExce
sal_Int32 headerMargin = 0; sal_Int32 headerMargin = 0;
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); uno::Any aValue = mxPageProps->getPropertyValue( "TopMargin" );
aValue >>= headerMargin; aValue >>= headerMargin;
} }
catch( uno::Exception& ) catch( uno::Exception& )
...@@ -215,7 +215,7 @@ void SAL_CALL VbaPageSetupBase::setHeaderMargin( double margin ) throw (css::uno ...@@ -215,7 +215,7 @@ void SAL_CALL VbaPageSetupBase::setHeaderMargin( double margin ) throw (css::uno
{ {
uno::Any aValue; uno::Any aValue;
aValue <<= headerMargin; aValue <<= headerMargin;
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); mxPageProps->setPropertyValue( "TopMargin" , aValue );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
...@@ -227,7 +227,7 @@ double SAL_CALL VbaPageSetupBase::getFooterMargin() throw (css::uno::RuntimeExce ...@@ -227,7 +227,7 @@ double SAL_CALL VbaPageSetupBase::getFooterMargin() throw (css::uno::RuntimeExce
sal_Int32 footerMargin = 0; sal_Int32 footerMargin = 0;
try try
{ {
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); uno::Any aValue = mxPageProps->getPropertyValue( "BottomMargin" );
aValue >>= footerMargin; aValue >>= footerMargin;
} }
catch( uno::Exception& ) catch( uno::Exception& )
...@@ -244,7 +244,7 @@ void SAL_CALL VbaPageSetupBase::setFooterMargin( double margin ) throw (css::uno ...@@ -244,7 +244,7 @@ void SAL_CALL VbaPageSetupBase::setFooterMargin( double margin ) throw (css::uno
{ {
uno::Any aValue; uno::Any aValue;
aValue <<= footerMargin; aValue <<= footerMargin;
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); mxPageProps->setPropertyValue( "BottomMargin" , aValue );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
...@@ -257,7 +257,7 @@ sal_Int32 SAL_CALL VbaPageSetupBase::getOrientation() throw (css::uno::RuntimeEx ...@@ -257,7 +257,7 @@ sal_Int32 SAL_CALL VbaPageSetupBase::getOrientation() throw (css::uno::RuntimeEx
try try
{ {
sal_Bool isLandscape = sal_False; sal_Bool isLandscape = sal_False;
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); uno::Any aValue = mxPageProps->getPropertyValue( "IsLandscape" );
aValue >>= isLandscape; aValue >>= isLandscape;
if( isLandscape ) if( isLandscape )
...@@ -276,13 +276,13 @@ void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (c ...@@ -276,13 +276,13 @@ void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (c
if( ( orientation != mnOrientPortrait ) && if( ( orientation != mnOrientPortrait ) &&
( orientation != mnOrientLandscape ) ) ( orientation != mnOrientLandscape ) )
{ {
DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); DebugHelper::exception(SbERR_BAD_PARAMETER, OUString() );
} }
try try
{ {
sal_Bool isLandscape = sal_False; sal_Bool isLandscape = sal_False;
uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); uno::Any aValue = mxPageProps->getPropertyValue( "IsLandscape" );
aValue >>= isLandscape; aValue >>= isLandscape;
sal_Bool switchOrientation = sal_False; sal_Bool switchOrientation = sal_False;
...@@ -295,11 +295,11 @@ void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (c ...@@ -295,11 +295,11 @@ void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (c
if( switchOrientation ) if( switchOrientation )
{ {
aValue <<= !isLandscape; aValue <<= !isLandscape;
uno::Any aHeight = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); uno::Any aHeight = mxPageProps->getPropertyValue( "Height" );
uno::Any aWidth = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); uno::Any aWidth = mxPageProps->getPropertyValue( "Width" );
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")), aValue ); mxPageProps->setPropertyValue( "IsLandscape" , aValue );
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")), aHeight ); mxPageProps->setPropertyValue( "Width" , aHeight );
mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")), aWidth ); mxPageProps->setPropertyValue( "Height" , aWidth );
} }
} }
catch( uno::Exception& ) catch( uno::Exception& )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment