[Libreoffice-commits] .: 3 commits - basic/inc basic/source cppcanvas/source sc/source sfx2/source unusedcode.easy xmlhelp/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Aug 9 04:50:25 PDT 2012
basic/inc/basic/sbstar.hxx | 2 -
basic/source/classes/sb.cxx | 16 ++++---------
basic/source/classes/sbunoobj.cxx | 20 ++++++++++------
basic/source/runtime/step0.cxx | 20 ++++++++++------
cppcanvas/source/wrapper/implsprite.cxx | 21 -----------------
cppcanvas/source/wrapper/implsprite.hxx | 5 ----
sc/source/core/tool/interpr1.cxx | 13 +++-------
sfx2/source/doc/objxtor.cxx | 12 +++++-----
unusedcode.easy | 1
xmlhelp/source/cxxhelp/provider/databases.cxx | 31 ++++++++++----------------
10 files changed, 54 insertions(+), 87 deletions(-)
New commits:
commit 7e071e5383560c1a85722b134f5a8637585999e5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 9 12:40:36 2012 +0100
remove some unused methods
Change-Id: I8b89f49eff059f5650bfb531bcb568db1d97c3a3
diff --git a/cppcanvas/source/wrapper/implsprite.cxx b/cppcanvas/source/wrapper/implsprite.cxx
index 9e6ce32..9ff68ef 100644
--- a/cppcanvas/source/wrapper/implsprite.cxx
+++ b/cppcanvas/source/wrapper/implsprite.cxx
@@ -64,27 +64,6 @@ namespace cppcanvas
OSL_ENSURE( mpTransformArbiter.get(), "ImplSprite::ImplSprite(): Invalid transformation arbiter");
}
- ImplSprite::ImplSprite( const uno::Reference< rendering::XSpriteCanvas >& rParentCanvas,
- const uno::Reference< rendering::XAnimatedSprite >& rSprite,
- const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter ) :
- mxGraphicDevice(),
- mxSprite( uno::Reference< rendering::XSprite >(rSprite,
- uno::UNO_QUERY) ),
- mxAnimatedSprite( rSprite ),
- mpTransformArbiter( rTransformArbiter )
- {
- // Avoiding ternary operator in initializer list (Solaris
- // compiler bug, when function call and temporary is
- // involved)
- if( rParentCanvas.is() )
- mxGraphicDevice = rParentCanvas->getDevice();
-
- OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas");
- OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device");
- OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite");
- OSL_ENSURE( mpTransformArbiter.get(), "ImplSprite::ImplSprite(): Invalid transformation arbiter");
- }
-
ImplSprite::~ImplSprite()
{
// hide the sprite on the canvas. If we don't hide the
diff --git a/cppcanvas/source/wrapper/implsprite.hxx b/cppcanvas/source/wrapper/implsprite.hxx
index d75cd7c..025d3e3 100644
--- a/cppcanvas/source/wrapper/implsprite.hxx
+++ b/cppcanvas/source/wrapper/implsprite.hxx
@@ -51,11 +51,6 @@ namespace cppcanvas
const ::com::sun::star::uno::Reference<
::com::sun::star::rendering::XSprite >& rSprite,
const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter );
- ImplSprite( const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XSpriteCanvas >& rParentCanvas,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::rendering::XAnimatedSprite >& rSprite,
- const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter );
virtual ~ImplSprite();
virtual void setAlpha( const double& rAlpha );
diff --git a/unusedcode.easy b/unusedcode.easy
index 5188d8f..11c9818 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -112,7 +112,6 @@ connectivity::mozab::MQueryHelper::next()
connectivity::sdbcx::OGroup::OGroup(rtl::OUString const&, unsigned char)
connectivity::sdbcx::OGroup::OGroup(unsigned char)
connectivity::toString(com::sun::star::uno::Any const&)
-cppcanvas::internal::ImplSprite::ImplSprite(com::sun::star::uno::Reference<com::sun::star::rendering::XSpriteCanvas> const&, com::sun::star::uno::Reference<com::sun::star::rendering::XAnimatedSprite> const&, boost::shared_ptr<cppcanvas::internal::ImplSpriteCanvas::TransformationArbiter> const&)
dbtools::getConnection(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&)
formula::FormulaTokenIterator::First()
jfw_plugin::VendorBase::createInstance()
commit 16f75f1f773035df36437763588d5a3acbb70935
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 9 12:32:07 2012 +0100
reduce static_initialization_and_destruction chain
Change-Id: I9fdefd428b858fd5581412d6f8e896a0eb680fef
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index 1b0cd71..6a75304 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -172,7 +172,7 @@ public:
SbxObjectRef getRTL( void ) { return pRtl; }
sal_Bool IsDocBasic() { return bDocBasic; }
- SbxVariable* VBAFind( const String& rName, SbxClassType t );
+ SbxVariable* VBAFind( const rtl::OUString& rName, SbxClassType t );
bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
void QuitAndExitApplication();
sal_Bool IsQuitApplication() { return bQuit; };
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 8535808..1a625bd 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -230,10 +230,9 @@ SbxObject* StarBASIC::getVBAGlobals( )
}
// i#i68894#
-SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t )
+SbxVariable* StarBASIC::VBAFind( const rtl::OUString& rName, SbxClassType t )
{
- const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
- if( rName == aThisComponent )
+ if( rName == "ThisComponent" )
return NULL;
// rename to init globals
if ( getVBAGlobals( ) )
@@ -778,15 +777,13 @@ SbxVariable* SbClassModuleObject::Find( const rtl::OUString& rName, SbxClassType
void SbClassModuleObject::triggerInitializeEvent( void )
{
- static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Class_Initialize") );
-
if( mbInitializeEventDone )
return;
mbInitializeEventDone = true;
// Search method
- SbxVariable* pMeth = SbxObject::Find( aInitMethodName, SbxCLASS_METHOD );
+ SbxVariable* pMeth = SbxObject::Find(rtl::OUString("Class_Initialize"), SbxCLASS_METHOD);
if( pMeth )
{
SbxValues aVals;
@@ -796,13 +793,11 @@ void SbClassModuleObject::triggerInitializeEvent( void )
void SbClassModuleObject::triggerTerminateEvent( void )
{
- static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Class_Terminate") );
-
if( !mbInitializeEventDone || GetSbData()->bRunInit )
return;
// Search method
- SbxVariable* pMeth = SbxObject::Find( aTermMethodName, SbxCLASS_METHOD );
+ SbxVariable* pMeth = SbxObject::Find( rtl::OUString("Class_Terminate"), SbxCLASS_METHOD );
if( pMeth )
{
SbxValues aVals;
@@ -1264,8 +1259,6 @@ void StarBASIC::DeInitAllModules( void )
// If this fails again a conventional search over objects is performend.
SbxVariable* StarBASIC::Find( const rtl::OUString& rName, SbxClassType t )
{
- static String aMainStr( RTL_CONSTASCII_USTRINGPARAM("Main") );
-
SbxVariable* pRes = NULL;
SbModule* pNamed = NULL;
// "Extended" search in Runtime Lib
@@ -1314,6 +1307,7 @@ SbxVariable* StarBASIC::Find( const rtl::OUString& rName, SbxClassType t )
break;
}
}
+ rtl::OUString aMainStr("Main");
if( !pRes && pNamed && ( t == SbxCLASS_METHOD || t == SbxCLASS_DONTCARE ) &&
!pNamed->GetName().EqualsIgnoreCaseAscii( aMainStr ) )
pRes = pNamed->Find( aMainStr, SbxCLASS_METHOD );
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 4a8a8f7..b9ec529 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -30,8 +30,9 @@
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
-#include <rtl/ustrbuf.hxx>
+#include <rtl/instance.hxx>
#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp>
#include <com/sun/star/script/NativeObjectWrapper.hpp>
@@ -530,32 +531,35 @@ struct ObjectItem
: m_xNativeObj( pNativeObj )
{}
};
-static std::vector< ObjectItem > GaNativeObjectWrapperVector;
+
+typedef std::vector< ObjectItem > NativeObjectWrapperVector;
+class GaNativeObjectWrapperVector : public rtl::Static<NativeObjectWrapperVector, GaNativeObjectWrapperVector> {};
void clearNativeObjectWrapperVector( void )
{
- GaNativeObjectWrapperVector.clear();
+ GaNativeObjectWrapperVector::get().clear();
}
sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj )
{
- sal_uInt32 nIndex = GaNativeObjectWrapperVector.size();
- GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) );
+ NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get();
+ sal_uInt32 nIndex = rNativeObjectWrapperVector.size();
+ rNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) );
return nIndex;
}
SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
{
SbxObjectRef xRetObj;
- if( nIndex < GaNativeObjectWrapperVector.size() )
+ NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get();
+ if( nIndex < rNativeObjectWrapperVector.size() )
{
- ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ];
+ ObjectItem& rItem = rNativeObjectWrapperVector[ nIndex ];
xRetObj = rItem.m_xNativeObj;
}
return xRetObj;
}
-
// convert from Uno to Sbx
SbxDataType unoToSbxType( TypeClass eType )
{
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index d2bc2d5..9a48a9b 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -30,6 +30,7 @@
#include "image.hxx"
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/util/SearchOptions.hpp>
+#include <rtl/instance.hxx>
#include <vcl/svapp.hxx>
#include <unotools/textsearch.hxx>
@@ -459,13 +460,14 @@ struct SbxVariablePtrHash
typedef boost::unordered_map< SbxVariable*, DimAsNewRecoverItem,
SbxVariablePtrHash > DimAsNewRecoverHash;
-static DimAsNewRecoverHash GaDimAsNewRecoverHash;
+class GaDimAsNewRecoverHash : public rtl::Static<DimAsNewRecoverHash, GaDimAsNewRecoverHash> {};
void removeDimAsNewRecoverItem( SbxVariable* pVar )
{
- DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar );
- if( it != GaDimAsNewRecoverHash.end() )
- GaDimAsNewRecoverHash.erase( it );
+ DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
+ DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( pVar );
+ if( it != rDimAsNewRecoverHash.end() )
+ rDimAsNewRecoverHash.erase( it );
}
@@ -620,8 +622,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if( xPrevVarObj.Is() )
{
// Object is overwritten with NULL, instantiate init object
- DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar );
- if( it != GaDimAsNewRecoverHash.end() )
+ DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
+ DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( refVar );
+ if( it != rDimAsNewRecoverHash.end() )
{
const DimAsNewRecoverItem& rItem = it->second;
if( rItem.m_pClassModule != NULL )
@@ -654,15 +657,16 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
String aObjClass = pValObj->GetClassName();
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase);
+ DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
if( pClassModuleObj != NULL )
{
SbModule* pClassModule = pClassModuleObj->getClassModule();
- GaDimAsNewRecoverHash[refVar] =
+ rDimAsNewRecoverHash[refVar] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
}
else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
{
- GaDimAsNewRecoverHash[refVar] =
+ rDimAsNewRecoverHash[refVar] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL );
}
}
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index c6e3acd..a9bb168 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XTitle.hpp>
#include <osl/mutex.hxx>
-
+#include <rtl/instance.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/svapp.hxx>
@@ -115,7 +115,7 @@ DBG_NAME(SfxObjectShell)
namespace {
-static WeakReference< XInterface > s_xCurrentComponent;
+class theCurrentComponent : public rtl::Static< WeakReference< XInterface >, theCurrentComponent > {};
#ifndef DISABLE_SCRIPTING
@@ -932,7 +932,9 @@ sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex()
void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
{
- Reference< XInterface > xOldCurrentComp(s_xCurrentComponent);
+ WeakReference< XInterface >& rTheCurrentComponent = theCurrentComponent::get();
+
+ Reference< XInterface > xOldCurrentComp(rTheCurrentComponent);
if ( _rxComponent == xOldCurrentComp )
// nothing to do
return;
@@ -943,7 +945,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
#ifndef DISABLE_SCRIPTING
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- s_xCurrentComponent = _rxComponent;
+ rTheCurrentComponent = _rxComponent;
if ( pAppMgr )
{
// set "ThisComponent" for Basic
@@ -975,7 +977,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
Reference< XInterface > SfxObjectShell::GetCurrentComponent()
{
- return s_xCurrentComponent;
+ return theCurrentComponent::get();
}
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 51ef2cb..69f02c1 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -82,8 +82,6 @@ using namespace com::sun::star::deployment;
using namespace com::sun::star::beans;
-static rtl::OUString aSlash("/");
-
rtl::OUString Databases::expandURL( const rtl::OUString& aURL )
{
osl::MutexGuard aGuard( m_aMutex );
@@ -600,7 +598,7 @@ Db* Databases::getBerkeley( const rtl::OUString& Database,
rtl::OUString aFileExt( helpText ? rtl::OUString(".ht") : rtl::OUString(".db") );
- rtl::OUString dbFileName = aSlash + Database + aFileExt;
+ rtl::OUString dbFileName = rtl::OUStringBuffer().append('/').append(Database).append(aFileExt).makeStringAndClear();
rtl::OUString key;
if( pExtensionPath == NULL )
key = processLang( Language ) + dbFileName;
@@ -1027,7 +1025,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja
{
return Reference< XHierarchicalNameAccess >( 0 );
}
- rtl::OUString key = processLang(Language) + aSlash + jar;
+ rtl::OUString key = rtl::OUStringBuffer(processLang(Language)).append('/').append(jar).makeStringAndClear();
osl::MutexGuard aGuard( m_aMutex );
@@ -1049,7 +1047,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja
rtl::OUStringBuffer aStrBuf;
aStrBuf.append( aExtensionPath );
- aStrBuf.append( aSlash );
+ aStrBuf.append( '/' );
aStrBuf.append( aPureJar );
zipFile = expandURL( aStrBuf.makeStringAndClear() );
@@ -1618,11 +1616,11 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage(
{
rtl::OUStringBuffer aStrBuf;
aStrBuf.append( xPackage->getRegistrationDataURL().Value);
- aStrBuf.append( aSlash );
+ aStrBuf.append( '/' );
aStrBuf.append( aLanguage );
if( !bLangFolderOnly )
{
- aStrBuf.append( aSlash );
+ aStrBuf.append( '/' );
aStrBuf.append( "help" );
aStrBuf.append( rFileExtension );
}
@@ -1765,8 +1763,7 @@ Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xP
Db* pRetDb = NULL;
if (optRegData.IsPresent && !optRegData.Value.isEmpty())
{
- rtl::OUString aRegDataUrl(optRegData.Value);
- aRegDataUrl += aSlash;
+ rtl::OUString aRegDataUrl = rtl::OUStringBuffer(optRegData.Value).append('/').makeStringAndClear();
rtl::OUString aHelpFilesBaseName("help");
@@ -1798,7 +1795,7 @@ Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xP
*o_pExtensionPath = aRegDataUrl + aUsedLanguage;
if( o_pExtensionRegistryPath )
- *o_pExtensionRegistryPath = xPackage->getURL() + aSlash + aUsedLanguage;
+ *o_pExtensionRegistryPath = rtl::OUStringBuffer(xPackage->getURL()).append('/').append(aUsedLanguage).makeStringAndClear();
}
return pRetDb;
@@ -1818,10 +1815,9 @@ rtl::OUString KeyDataBaseFileIterator::nextDbFile( bool& o_rbExtension )
switch( m_eState )
{
case INITIAL_MODULE:
- aRetFile =
- m_rDatabases.getInstallPathAsURL() +
- m_rDatabases.processLang( m_aLanguage ) + aSlash + m_aInitialModule +
- rtl::OUString( ".key" );
+ aRetFile = rtl::OUStringBuffer(m_rDatabases.getInstallPathAsURL()).
+ append(m_rDatabases.processLang(m_aLanguage)).append('/').
+ append(m_aInitialModule).append(".key").makeStringAndClear();
o_rbExtension = false;
@@ -2022,10 +2018,9 @@ rtl::OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o
switch( m_eState )
{
case INITIAL_MODULE:
- aIndexFolder =
- m_rDatabases.getInstallPathAsURL() +
- m_rDatabases.processLang( m_aLanguage ) + aSlash + m_aInitialModule +
- rtl::OUString( ".idxl" );
+ aIndexFolder = rtl::OUStringBuffer(m_rDatabases.getInstallPathAsURL()).
+ append(m_rDatabases.processLang(m_aLanguage)).append('/').
+ append(m_aInitialModule).append(".idxl").makeStringAndClear();
o_rbTemporary = false;
o_rbExtension = false;
commit 490b51371dede5910fed770fe70fd1870db0fffa
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 9 10:57:47 2012 +0100
String::AllocBuffer -> rtl::OUStringBuffer
Change-Id: I9fa73190aa68c5c19fcf76b327dca6942697cf2a
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index b10aea7..489a53b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8041,17 +8041,12 @@ void ScInterpreter::ScRept()
PushString( EMPTY_STRING );
else
{
- xub_StrLen n = (xub_StrLen) fAnz;
const xub_StrLen nLen = aStr.Len();
- String aRes;
- const sal_Unicode* const pSrc = aStr.GetBuffer();
- sal_Unicode* pDst = aRes.AllocBuffer( n * nLen );
+ xub_StrLen n = (xub_StrLen) fAnz;
+ rtl::OUStringBuffer aRes(n*nLen);
while( n-- )
- {
- memcpy( pDst, pSrc, nLen * sizeof(sal_Unicode) );
- pDst += nLen;
- }
- PushString( aRes );
+ aRes.append(aStr);
+ PushString( aRes.makeStringAndClear() );
}
}
}
More information about the Libreoffice-commits
mailing list