summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-31 15:54:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-04-02 14:53:48 +0100
commitae9219769106648ac35d594fc07c83103a62ecbe (patch)
treedbc21e302fe1808fc798c15156ad3a96418f5f45 /vbahelper
parent437f93ec8d1cb0f1486c69b863cb509aea4dac65 (diff)
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/inc/vbahelper/vbaglobalbase.hxx1
-rw-r--r--vbahelper/source/vbahelper/vbaglobalbase.cxx24
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx16
3 files changed, 21 insertions, 20 deletions
diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
index 1f7d7a280f56..ea78fcec97f6 100644
--- a/vbahelper/inc/vbahelper/vbaglobalbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
@@ -36,6 +36,7 @@ class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
{
protected:
rtl::OUString msDocCtxName;
+ rtl::OUString msApplication;
bool hasServiceName( const rtl::OUString& serviceName );
void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx
index 7e6d365823c8..d81cfc155440 100644
--- a/vbahelper/source/vbahelper/vbaglobalbase.cxx
+++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx
@@ -35,15 +35,15 @@
using namespace com::sun::star;
using namespace ooo::vba;
-rtl::OUString sApplication( RTL_CONSTASCII_USTRINGPARAM("Application") );
-
// special key to return the Application
-rtl::OUString sAppService( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.Application") );
+const char sAppService[] = "ooo.vba.Application";
VbaGlobalsBase::VbaGlobalsBase(
const uno::Reference< ov::XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
-: Globals_BASE( xParent, xContext ), msDocCtxName( sDocCtxName )
+ : Globals_BASE( xParent, xContext )
+ , msDocCtxName( sDocCtxName )
+ , msApplication( RTL_CONSTASCII_USTRINGPARAM("Application") )
{
// overwrite context with custom one ( that contains the application )
// wrap the service manager as we don't want the disposing context to tear down the 'normal' ServiceManager ( or at least thats what the code appears like it wants to do )
@@ -55,7 +55,7 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s
::cppu::ContextEntry_Init aHandlerContextInfo[] =
{
- ::cppu::ContextEntry_Init( sApplication, uno::Any() ),
+ ::cppu::ContextEntry_Init( msApplication, uno::Any() ),
::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
::cppu::ContextEntry_Init( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.lang.theServiceManager" ) ), aSrvMgr )
};
@@ -74,7 +74,7 @@ VbaGlobalsBase::~VbaGlobalsBase()
// release document reference ( we don't wan't the component context trying to dispose that )
xNameContainer->removeByName( msDocCtxName );
// release application reference, as it is holding onto the context
- xNameContainer->removeByName( sApplication );
+ xNameContainer->removeByName( msApplication );
}
}
catch ( const uno::Exception& )
@@ -89,9 +89,9 @@ VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs )
for ( sal_Int32 nIndex = 0; nIndex < nLen; ++nIndex )
{
uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY_THROW );
- if ( aInitArgs[ nIndex ].Name.equals( sApplication ) )
+ if ( aInitArgs[ nIndex ].Name.equals( msApplication ) )
{
- xNameContainer->replaceByName( sApplication, aInitArgs[ nIndex ].Value );
+ xNameContainer->replaceByName( msApplication, aInitArgs[ nIndex ].Value );
uno::Reference< XHelperInterface > xParent( aInitArgs[ nIndex ].Value, uno::UNO_QUERY );
mxParent = xParent;
}
@@ -104,11 +104,11 @@ uno::Reference< uno::XInterface > SAL_CALL
VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
{
uno::Reference< uno::XInterface > xReturn;
- if ( aServiceSpecifier.equals( sAppService ) )
+ if ( aServiceSpecifier.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAppService)) )
{
// try to extract the Application from the context
uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
- xNameContainer->getByName( sApplication ) >>= xReturn;
+ xNameContainer->getByName( msApplication ) >>= xReturn;
}
else if ( hasServiceName( aServiceSpecifier ) )
xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext );
@@ -120,11 +120,11 @@ VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpec
{
uno::Reference< uno::XInterface > xReturn;
- if ( aServiceSpecifier.equals( sAppService ) )
+ if ( aServiceSpecifier.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAppService)) )
{
// try to extract the Application from the context
uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
- xNameContainer->getByName( sApplication ) >>= xReturn;
+ xNameContainer->getByName( msApplication ) >>= xReturn;
}
else if ( hasServiceName( aServiceSpecifier ) )
xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( aServiceSpecifier, Arguments, mxContext );
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 03525bafbfef..2f82c18e57fb 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -956,14 +956,14 @@ double UserFormGeometryHelper::getOffsetY() const
// ----------------------------------------------------------------------------
-static const ::rtl::OUString saPosXName( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
-static const ::rtl::OUString saPosYName( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
-static const ::rtl::OUString saWidthName( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
-static const ::rtl::OUString saHeightName( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+static const char saPosXName[] = "PositionX";
+static const char saPosYName[] = "PositionY";
+static const char saWidthName[] = "Width";
+static const char saHeightName[] = "Height";
double UserFormGeometryHelper::implGetPos( bool bPosY ) const
{
- sal_Int32 nPosAppFont = mxModelProps->getPropertyValue( bPosY ? saPosYName : saPosXName ).get< sal_Int32 >();
+ sal_Int32 nPosAppFont = mxModelProps->getPropertyValue( bPosY ? rtl::OUString(saPosYName) : rtl::OUString(saPosXName) ).get< sal_Int32 >();
// appfont to pixel
awt::Point aPosPixel = mxUnitConv->convertPointToPixel( awt::Point( nPosAppFont, nPosAppFont ), util::MeasureUnit::APPFONT );
// pixel to VBA points
@@ -978,12 +978,12 @@ void UserFormGeometryHelper::implSetPos( double fPos, bool bPosY )
awt::Point aPosPixel = mxUnitConv->convertPointToPixel( awt::Point( nPosPixel, nPosPixel ), util::MeasureUnit::POINT );
// pixel to appfont
awt::Point aPosAppFont = mxUnitConv->convertPointToLogic( aPosPixel, util::MeasureUnit::APPFONT );
- mxModelProps->setPropertyValue( bPosY ? saPosYName : saPosXName, uno::Any( bPosY ? aPosAppFont.Y : aPosAppFont.X ) );
+ mxModelProps->setPropertyValue( bPosY ? rtl::OUString(saPosYName) : rtl::OUString(saPosXName), uno::Any( bPosY ? aPosAppFont.Y : aPosAppFont.X ) );
}
double UserFormGeometryHelper::implGetSize( bool bHeight, bool bOuter ) const
{
- sal_Int32 nSizeAppFont = mxModelProps->getPropertyValue( bHeight ? saHeightName : saWidthName ).get< sal_Int32 >();
+ sal_Int32 nSizeAppFont = mxModelProps->getPropertyValue( bHeight ? rtl::OUString(saHeightName) : rtl::OUString(saWidthName) ).get< sal_Int32 >();
// appfont to pixel
awt::Size aSizePixel = mxUnitConv->convertSizeToPixel( awt::Size( nSizeAppFont, nSizeAppFont ), util::MeasureUnit::APPFONT );
@@ -1031,7 +1031,7 @@ void UserFormGeometryHelper::implSetSize( double fSize, bool bHeight, bool bOute
}
awt::Size aSizeAppFont = mxUnitConv->convertSizeToLogic( aSizePixel, util::MeasureUnit::APPFONT );
- mxModelProps->setPropertyValue( bHeight ? saHeightName : saWidthName, uno::Any( bHeight ? aSizeAppFont.Height : aSizeAppFont.Width ) );
+ mxModelProps->setPropertyValue( bHeight ? rtl::OUString(saHeightName) : rtl::OUString(saWidthName), uno::Any( bHeight ? aSizeAppFont.Height : aSizeAppFont.Width ) );
}
// ============================================================================