Anonymous avatar Anonymous committed 431afa4 Merge

mib20: branch merge

Comments (0)

Files changed (6)

basic/source/classes/sb.cxx

 SbClassFactory::~SbClassFactory()
 {}
 
+
+struct DocBasicItem
+{
+	StarBASIC*		m_pDocBasic;
+	SbxObjectRef	m_xClassModules;
+
+	DocBasicItem( void )
+		: m_pDocBasic( NULL )
+	{}
+	DocBasicItem( StarBASIC* pDocBasic )
+		: m_pDocBasic( pDocBasic )
+	{
+		m_xClassModules = new SbxObject( String() );
+	}
+};
+typedef std::vector< DocBasicItem > DocBasicItemVector;
+static DocBasicItemVector GaDocBasicItems;
+
+inline DocBasicItemVector::iterator lcl_findDocBasicItem( StarBASIC* pDocBasic )
+{
+	DocBasicItemVector::iterator it;
+	for( it = GaDocBasicItems.begin() ; it != GaDocBasicItems.end() ; ++it )
+	{
+		if( it->m_pDocBasic == pDocBasic )
+			break;
+	}
+	return it;
+}
+
+inline StarBASIC* lcl_getDocBasicForModule( SbModule* pModule )
+{
+	StarBASIC* pRetBasic = NULL;
+    SbxObject* pCurParent = pModule;
+	while( pCurParent->GetParent() != NULL )
+	{
+		pCurParent = pCurParent->GetParent();
+		StarBASIC* pDocBasic = PTR_CAST( StarBASIC, pCurParent );
+		if( pDocBasic != NULL && pDocBasic->IsDocBasic() )
+		{
+			pRetBasic = pDocBasic;
+			break;
+		}
+	}
+	return pRetBasic;
+}
+
 void SbClassFactory::AddClassModule( SbModule* pClassModule )
 {
+	SbxObjectRef xToUseClassModules = xClassModules;
+
+	StarBASIC* pDocBasic = lcl_getDocBasicForModule( pClassModule );
+	if( pDocBasic != NULL )
+	{
+		DocBasicItemVector::iterator it = lcl_findDocBasicItem( pDocBasic );
+		if( it != GaDocBasicItems.end() )
+			xToUseClassModules = it->m_xClassModules;
+	}
+
 	SbxObject* pParent = pClassModule->GetParent();
-	xClassModules->Insert( pClassModule );
+	xToUseClassModules->Insert( pClassModule );
 	pClassModule->SetParent( pParent );
 }
 
 
 SbxObject* SbClassFactory::CreateObject( const String& rClassName )
 {
-	SbxVariable* pVar = xClassModules->Find( rClassName, SbxCLASS_DONTCARE );
+	SbxObjectRef xToUseClassModules = xClassModules;
+
+	SbModule* pMod = pMOD;
+	StarBASIC* pDocBasic = pMod != NULL ? lcl_getDocBasicForModule( pMod ) : NULL;
+	if( pDocBasic != NULL )
+	{
+		DocBasicItemVector::iterator it = lcl_findDocBasicItem( pDocBasic );
+		if( it != GaDocBasicItems.end() )
+			xToUseClassModules = it->m_xClassModules;
+	}
+
+	SbxVariable* pVar = xToUseClassModules->Find( rClassName, SbxCLASS_OBJECT );
 	SbxObject* pRet = NULL;
 	if( pVar )
 	{
-		SbModule* pMod = (SbModule*)pVar;
-		pRet = new SbClassModuleObject( pMod );
+		SbModule* pVarMod = (SbModule*)pVar;
+		pRet = new SbClassModuleObject( pVarMod );
 	}
 	return pRet;
 }
 	return pMod;
 }
 
-typedef std::vector< StarBASIC* > DocBasicVector;
-static DocBasicVector GaDocBasics;
-
 StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic  )
 	: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic )
 {
 	bQuit = FALSE;
 
 	if( bDocBasic )
-		GaDocBasics.push_back( this );
+		GaDocBasicItems.push_back( DocBasicItem( this ) );
 }
 
 // #51727 Override SetModified so that the modified state
 
 StarBASIC::~StarBASIC()
 {
+	// Needs to be first action as it can trigger events
+	disposeComVariablesForBasic( this );
+
 	if( !--GetSbData()->nInst )
 	{
 		RemoveFactory( pSBFAC );
 	{
 	    SbxError eOld = SbxBase::GetError();
 
-		DocBasicVector::iterator it;
-		for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
+		DocBasicItemVector::iterator it = lcl_findDocBasicItem( this );
+		if( it != GaDocBasicItems.end() )
+			GaDocBasicItems.erase( it );
+		for( it = GaDocBasicItems.begin() ; it != GaDocBasicItems.end() ; ++it )
 		{
-			if( *it == this )
-			{
-				GaDocBasics.erase( it );
-				break;
-			}
-		}
-		for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
-		{
-			StarBASIC* pBasic = *it;
+			StarBASIC* pBasic = it->m_pDocBasic;
 			pBasic->implClearDependingVarsOnDelete( this );
 		}
 
     }
 
     clearUnoMethodsForBasic( this );
-	disposeComVariablesForBasic( this );
 }
 
 // Override new() operator, so that everyone can create a new instance

basic/source/comp/sbcomp.cxx

 // with TraceCommand( "PCodeOn" / "PCodeOff" ), see below
 static bool	GbIncludePCodes = false;
 
+// GbInitOnlyAtOfficeStart:
+// true = Tracing is only intialized onces after Office start when
+// Basic runs the first time. Further calls to Basic, e.g. via events
+// use the same output file. The trace ini file is not read again.
+static bool	GbInitOnlyAtOfficeStart = false;
+
 static int	GnIndentPerCallLevel = 4;
 static int	GnIndentForPCode = 2;
 
 									long as it can be converted to string
 */
 
+#ifdef DBG_TRACE_PROFILING
+
+#include <algorithm>
+#include <stack>
+#include "canvas/elapsedtime.hxx"
+
+//*** Profiling ***
+// GbTimerOn:
+// true = including time stamps
+static bool	GbTimerOn = true;
+
+// GbTimeStampForEachStep:
+// true = prints time stamp after each command / pcode (very slow)
+static bool	GbTimeStampForEachStep = false;
+
+// GbBlockAllAfterFirstFunctionUsage:
+// true = everything (commands, pcodes, functions) is only printed
+// for the first usage (improves performance when tracing / pro-
+// filing large macros)
+static bool	GbBlockAllAfterFirstFunctionUsage = false;
+
+// GbBlockStepsAfterFirstFunctionUsage:
+// true = commands / pcodes are only printed for the first time
+// a function is executed. Afterwards only the entering/leaving
+// messages are logged (improves performance when tracing / pro-
+// filing large macros)
+static bool	GbBlockStepsAfterFirstFunctionUsage = false;
+
+#endif
+
+
 static void lcl_skipWhites( char*& rpc )
 {
 	while( *rpc == ' ' || *rpc == '\t' )
 		if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 )
 			GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0);
 		else
+		if( strcmp( VarNameBuffer, "GbInitOnlyAtOfficeStart") == 0 )
+			GbInitOnlyAtOfficeStart = (strcmp( ValBuffer, "true" ) == 0);
+		else
 		if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 )
 			GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 );
 		else
 		if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 )
 			GnIndentForPCode = strtol( ValBuffer, NULL, 10 );
+#ifdef DBG_TRACE_PROFILING
+		else
+		if( strcmp( VarNameBuffer, "GbTimerOn") == 0 )
+			GbTimerOn = (strcmp( ValBuffer, "true" ) == 0);
+		else
+		if( strcmp( VarNameBuffer, "GbTimeStampForEachStep") == 0 )
+			GbTimeStampForEachStep = (strcmp( ValBuffer, "true" ) == 0);
+		else
+		if( strcmp( VarNameBuffer, "GbBlockAllAfterFirstFunctionUsage") == 0 )
+			GbBlockAllAfterFirstFunctionUsage = (strcmp( ValBuffer, "true" ) == 0);
+		else
+		if( strcmp( VarNameBuffer, "GbBlockStepsAfterFirstFunctionUsage") == 0 )
+			GbBlockStepsAfterFirstFunctionUsage = (strcmp( ValBuffer, "true" ) == 0);
+#endif
 	}
 	fclose( pFile );
 }
 	pModule->Disassemble( aDisassemblyStr );
 }
 
-static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL )
+static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL, const char* pPostStr = NULL )
 {
 	const char* pPrintFirst = (pPreStr != NULL) ? pPreStr : "";
+	const char* pPrintLast = (pPostStr != NULL) ? pPostStr : "";
 	FILE* pFile = fopen( pFileName, "a+" );
 	if( pFile != NULL )
 	{
-		fprintf( pFile, "%s%s\n", pPrintFirst, pStr );
+		fprintf( pFile, "%s%s%s\n", pPrintFirst, pStr, pPrintLast );
 		fclose( pFile );
 	}
 }
 
 
 // Public functions
+static bool	GbSavTraceOn = false;
 
-static bool	GbSavTraceOn = false;
+#ifdef DBG_TRACE_PROFILING
+static canvas::tools::ElapsedTime* GpTimer = NULL;
+static double GdStartTime = 0.0;
+static double GdLastTime = 0.0;
+static bool GbBlockSteps = false;
+static bool GbBlockAll = false;
+
+struct FunctionItem
+{
+	String		m_aCompleteFunctionName;
+	double		m_dTotalTime;
+	double		m_dNetTime;
+	int			m_nCallCount;
+	bool		m_bBlockAll;
+	bool		m_bBlockSteps;
+
+	FunctionItem( void )
+		: m_dTotalTime( 0.0 )
+		, m_dNetTime( 0.0 )
+		, m_nCallCount( 0 )
+		, m_bBlockAll( false )
+		, m_bBlockSteps( false )
+	{}
+};
+typedef std::hash_map< ::rtl::OUString, FunctionItem*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > FunctionItemMap;
+
+static std::stack< double >				GaCallEnterTimeStack;
+static std::stack< FunctionItem* >		GaFunctionItemStack;
+static FunctionItemMap					GaFunctionItemMap;
+
+bool compareFunctionNetTime( FunctionItem* p1, FunctionItem* p2 )
+{
+	return (p1->m_dNetTime > p2->m_dNetTime);
+}
+
+void lcl_printTimeOutput( void )
+{
+	// Overall time output
+	lcl_lineOut( GpTraceFileName, "" );
+	lcl_lineOut( GpTraceFileName, "***** Time Output *****" );
+	char TimeBuffer[500];
+	double dTotalTime = GpTimer->getElapsedTime() - GdStartTime;
+	sprintf( TimeBuffer, "Total execution time = %f ms", dTotalTime*1000.0 );
+	lcl_lineOut( GpTraceFileName, TimeBuffer );
+	lcl_lineOut( GpTraceFileName, "" );
+
+	if( GbTimerOn )
+	{
+		lcl_lineOut( GpTraceFileName, "Functions:" );
+
+		std::vector<FunctionItem*> avFunctionItems;
+
+		FunctionItemMap::iterator it;
+		for( it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
+		{
+			FunctionItem* pFunctionItem = it->second;
+			if( pFunctionItem != NULL )
+				avFunctionItems.push_back( pFunctionItem );
+		}
+
+		std::sort( avFunctionItems.begin(), avFunctionItems.end(), compareFunctionNetTime );
+
+		std::vector<FunctionItem*>::iterator itv;
+		for( itv = avFunctionItems.begin() ; itv != avFunctionItems.end() ; ++itv )
+		{
+			FunctionItem* pFunctionItem = *itv;
+			if( pFunctionItem != NULL )
+			{
+				rtl::OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
+				const char* pName = OUStringToOString( aCompleteFunctionName, RTL_TEXTENCODING_ASCII_US ).getStr();
+				int nNameLen = aCompleteFunctionName.getLength();
+
+				double dFctTotalTime = pFunctionItem->m_dTotalTime;
+				double dFctNetTime = pFunctionItem->m_dNetTime;
+				double dFctTotalTimePercent = 100.0 * dFctTotalTime / dTotalTime;
+				double dFctNetTimePercent = 100.0 * dFctNetTime / dTotalTime;
+				int nSpaceCount = 30 - nNameLen;
+				if( nSpaceCount < 0 )
+					nSpaceCount = 2;
+				sprintf( TimeBuffer, "%s:%sCalled %d times\t%f ms (%f%%) / net %f (%f%%) ms",
+					pName, lcl_getSpaces( nSpaceCount ), pFunctionItem->m_nCallCount,
+					dFctTotalTime*1000.0, dFctTotalTimePercent, dFctNetTime*1000.0, dFctNetTimePercent );
+				lcl_lineOut( GpTraceFileName, TimeBuffer );
+			}
+		}
+	}
+}
+#endif
+
+
+static bool GbInitTraceAlreadyCalled = false;
+
 void dbg_InitTrace( void )
 {
+	if( GbInitOnlyAtOfficeStart && GbInitTraceAlreadyCalled )
+	{
+#ifdef DBG_TRACE_PROFILING
+		if( GbTimerOn )
+			GpTimer->continueTimer();
+#endif
+		return;
+	}
+	GbInitTraceAlreadyCalled = true;
+
 	if( GpTraceIniFile != NULL )
 		lcl_ReadIniFile( GpTraceIniFile );
 
 	GbSavTraceOn = GbTraceOn;
 	if( !GbTraceOn )
 		lcl_lineOut( GpTraceFileName, "### Program started with trace off ###" );
+
+#ifdef DBG_TRACE_PROFILING
+	GpTimer = new canvas::tools::ElapsedTime();
+	GdStartTime = GpTimer->getElapsedTime();
+	GdLastTime = GdStartTime;
+	GbBlockSteps = false;
+	GbBlockAll = false;
+#endif
 }
 
 void dbg_DeInitTrace( void )
 {
 	GbTraceOn = GbSavTraceOn;
+	
+#ifdef DBG_TRACE_PROFILING
+	while( !GaCallEnterTimeStack.empty() )
+		GaCallEnterTimeStack.pop();
+	while( !GaFunctionItemStack.empty() )
+		GaFunctionItemStack.pop();
+
+	lcl_printTimeOutput();
+
+	for( FunctionItemMap::iterator it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
+		delete it->second;
+	GaFunctionItemMap.clear();
+
+	if( GbInitOnlyAtOfficeStart )
+	{
+		if( GbTimerOn )
+			GpTimer->pauseTimer();
+	}
+	else
+		delete GpTimer;
+#endif
 }
 
 static INT32 GnLastCallLvl = 0;
 {
 	if( !GbTraceOn )
 		return;
+
+#ifdef DBG_TRACE_PROFILING
+	if( GbBlockSteps || GbBlockAll )
+		return;
+
+	double dCurTime = 0.0;
+	bool bPrintTimeStamp = false;
+	if( GbTimerOn )
+	{
+		GpTimer->pauseTimer();
+		dCurTime = GpTimer->getElapsedTime();
+		bPrintTimeStamp = GbTimeStampForEachStep;
+	}
+#else
+	bool bPrintTimeStamp = false;
+#endif
+
 	GnLastCallLvl = nCallLvl;
 
+
 	SbModule* pTraceMod = pModule;
 	if( pTraceMod->ISA(SbClassModuleObject) )
 	{
 
 	const TraceTextData& rTraceTextData = itInner->second;
 	const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
+	bool bSTMT = false;
 	if( rStr_STMNT.getLength() )
-		lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ) );
+		bSTMT = true;
+
+	char TimeBuffer[200];
+#ifdef DBG_TRACE_PROFILING
+	if( bPrintTimeStamp )
+	{
+		double dDiffTime = dCurTime - GdLastTime;
+		GdLastTime = dCurTime;
+		sprintf( TimeBuffer, "\t\t// Time = %f ms / += %f ms", dCurTime*1000.0, dDiffTime*1000.0 );
+	}
+#endif
+
+	if( bSTMT )
+	{
+		lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ),
+			(bPrintTimeStamp && !GbIncludePCodes) ? TimeBuffer : NULL );
+	}
 
 	if( !GbIncludePCodes )
+	{
+#ifdef DBG_TRACE_PROFILING
+		if( GbTimerOn )
+			GpTimer->continueTimer();
+#endif
 		return;
+	}
 
 	nIndent += GnIndentForPCode;
 	const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
 	if( rStr_PCode.getLength() )
-		lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ) );
+	{
+		lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ),
+			bPrintTimeStamp ? TimeBuffer : NULL );
+	}
+
+#ifdef DBG_TRACE_PROFILING
+	if( GbTimerOn )
+		GpTimer->continueTimer();
+#endif
 }
 
+
 void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave )
 {
 	static const char* pSeparator = "' ================================================================================";
 
 	if( !GbTraceOn )
 		return;
+
+#ifdef DBG_TRACE_PROFILING
+	double dCurTime = 0.0;
+	double dExecutionTime = 0.0;
+	if( GbTimerOn )
+	{
+		dCurTime = GpTimer->getElapsedTime();
+		GpTimer->pauseTimer();
+	}
+#endif
+
 	GnLastCallLvl = nCallLvl;
 
 	SbModule* pTraceMod = pModule;
 		pTraceMod = pClassModuleObj->getClassModule();
 	}
 
+	String aCompleteFunctionName = pTraceMod->GetName();
+	if( pMethod != NULL )
+	{
+		aCompleteFunctionName.AppendAscii( "::" );
+		String aMethodName = pMethod->GetName();
+		aCompleteFunctionName += aMethodName;
+	}
+	else
+	{
+		aCompleteFunctionName.AppendAscii( "/RunInit" );
+	}
+
+	bool bOwnBlockSteps = false;
+#ifdef DBG_TRACE_PROFILING
+	bool bOwnBlockAll = false;
+	FunctionItem* pFunctionItem = NULL;
+	if( GbTimerOn )
+	{
+		FunctionItemMap::iterator itFunctionItem = GaFunctionItemMap.find( aCompleteFunctionName );
+		if( itFunctionItem != GaFunctionItemMap.end() )
+			pFunctionItem = itFunctionItem->second;
+
+		if( pFunctionItem == NULL )
+		{
+			DBG_ASSERT( !bLeave, "No FunctionItem in leave!" );
+
+			pFunctionItem = new FunctionItem();
+			pFunctionItem->m_aCompleteFunctionName = aCompleteFunctionName;
+			GaFunctionItemMap[ aCompleteFunctionName ] = pFunctionItem;
+		}
+		else if( GbBlockAllAfterFirstFunctionUsage && !bLeave )
+		{
+			pFunctionItem->m_bBlockAll = true;
+		}
+		else if( GbBlockStepsAfterFirstFunctionUsage && !bLeave )
+		{
+			pFunctionItem->m_bBlockSteps = true;
+		}
+
+		if( bLeave )
+		{
+			bOwnBlockAll = GbBlockAll;
+			bOwnBlockSteps = GbBlockSteps;
+			GbBlockAll = false;
+			GbBlockSteps = false;
+
+			dExecutionTime = dCurTime - GaCallEnterTimeStack.top();
+			GaCallEnterTimeStack.pop();
+
+			pFunctionItem->m_dTotalTime += dExecutionTime;
+			pFunctionItem->m_dNetTime += dExecutionTime;
+			pFunctionItem->m_nCallCount++;
+
+			GaFunctionItemStack.pop();
+			if( !GaFunctionItemStack.empty() )
+			{
+				FunctionItem* pParentItem = GaFunctionItemStack.top();
+				if( pParentItem != NULL )
+				{
+					pParentItem->m_dNetTime -= dExecutionTime;
+
+					GbBlockSteps = pParentItem->m_bBlockSteps;
+					GbBlockAll = pParentItem->m_bBlockAll;
+				}
+			}
+		}
+		else
+		{
+			GbBlockSteps = bOwnBlockSteps = pFunctionItem->m_bBlockSteps;
+			GbBlockAll = bOwnBlockAll = pFunctionItem->m_bBlockAll;
+
+			GaCallEnterTimeStack.push( dCurTime );
+			GaFunctionItemStack.push( pFunctionItem );
+		}
+	}
+
+	if( bOwnBlockAll )
+	{
+		if( GbTimerOn )
+			GpTimer->continueTimer();
+		return;
+	}
+#endif
+
 	if( nCallLvl > 0 )
 		nCallLvl--;
 	int nIndent = nCallLvl * GnIndentPerCallLevel;
-	if( !bLeave )
+	if( !bLeave && !bOwnBlockSteps )
 	{
 		lcl_lineOut( GpTraceFileName, "" );
 		lcl_lineOut( GpTraceFileName, pSeparator, lcl_getSpaces( nIndent ) );
 	String aStr;
 	if( bLeave )
 	{
-		lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) );
-		aStr.AppendAscii( "' Leaving " );
+		if( !bOwnBlockSteps )
+		{
+			lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) );
+			aStr.AppendAscii( "' Leaving " );
+		}
 	}
 	else
 	{
 		aStr.AppendAscii( "Entering " );
 	}
-	String aModuleName = pTraceMod->GetName();
-	aStr += aModuleName;
-	if( pMethod != NULL )
-	{
-		aStr.AppendAscii( "::" );
-		String aMethodName = pMethod->GetName();
-		aStr += aMethodName;
-	}
-	else
-	{
-		aStr.AppendAscii( "/RunInit" );
-	}
+	if( !bLeave || !bOwnBlockSteps )
+		aStr += aCompleteFunctionName;
 
-	if( pClassModuleObj != NULL )
+	if( !bOwnBlockSteps && pClassModuleObj != NULL )
 	{
 		aStr.AppendAscii( "[this=" );
 		aStr += pClassModuleObj->GetName();
 	if( !bLeave )
 		aStr += lcl_dumpMethodParameters( pMethod );
 
-	lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
+	const char* pPostStr = NULL;
+#ifdef DBG_TRACE_PROFILING
+	char TimeBuffer[200];
+	if( GbTimerOn && bLeave )
+	{
+		sprintf( TimeBuffer, "    // Execution Time = %f ms", dExecutionTime*1000.0 );
+		pPostStr = TimeBuffer;
+	}
+#endif
+	lcl_lineOut( GpTraceFileName, (!bLeave || !bOwnBlockSteps) ? OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr() : "}",
+		lcl_getSpaces( nIndent ), pPostStr );
 	if( !bLeave )
 		lcl_lineOut( GpTraceFileName, "{", lcl_getSpaces( nIndent ) );
 
-	if( bLeave )
+	if( bLeave && !bOwnBlockSteps )
 		lcl_lineOut( GpTraceFileName, "" );
+
+#ifdef DBG_TRACE_PROFILING
+	if( GbTimerOn )
+		GpTimer->continueTimer();
+#endif
 }
 
 void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl )
 {
 	if( !GbTraceOn )
 		return;
+#ifdef DBG_TRACE_PROFILING
+	if( GbBlockSteps || GbBlockAll )
+		return;
+#endif
 	GnLastCallLvl = nCallLvl;
 
 	rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );

basic/source/inc/sbtrace.hxx

 
 //#define DBG_TRACE_BASIC
 
+// ###############################################################################
+// ###
+// ###    ATTENTION:
+// ###
+// ###  - DBG_TRACE_PROFILING can only be activated together with DBG_TRACE_BASIC
+// ###
+// ###  - If you activate DBG_TRACE_PROFILING you also need to uncomment line
+// ###    # SHL1STDLIBS+=$(CANVASTOOLSLIB) in basic/util/makefile.mk (search
+// ###    for DBG_TRACE_PROFILING there)
+// ###
+// ###############################################################################
+//#define DBG_TRACE_PROFILING
+
 #ifdef DBG_TRACE_BASIC
 void dbg_InitTrace( void );
 void dbg_DeInitTrace( void );

basic/util/makefile.mk

 			$(VOSLIB) \
 		    $(XMLSCRIPTLIB)
 
+# Uncomment the following line if DBG_TRACE_PROFILING is active in source/inc/sbtrace.hxx
+# SHL1STDLIBS+=$(CANVASTOOLSLIB)
+
 .IF "$(SOLAR_JAVA)" != "TRUE"
 SHL1STDLIBS+=$(SJLIB)
 .ENDIF

vbahelper/inc/vbahelper/vbahelper.hxx

         
 		VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
 		VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
-	    VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
-    	VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-	    VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical);
+	    VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( const css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
+    	VBAHELPER_DLLPUBLIC double PointsToPixels( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+	    VBAHELPER_DLLPUBLIC double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical);
     	VBAHELPER_DLLPUBLIC sal_Int32 PointsToHmm( double fPoints );
 	    VBAHELPER_DLLPUBLIC double HmmToPoints( sal_Int32 nHmm );
         VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );

vbahelper/source/vbahelper/vbahelper.cxx

 	return sResult.makeStringAndClear( );
 }
 
-double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
+double getPixelTo100thMillimeterConversionFactor( const css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
 {
 	double fConvertFactor = 1.0;
 	if( bVertical )
 	return fConvertFactor;
 }
 
-double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
+double PointsToPixels( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
 {
 	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
 	return PointsToHmm( fPoints ) * fConvertFactor;
 }
-double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
+double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
 {
 	double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
 	return HmmToPoints( fPixels/fConvertFactor );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.