From af4ae63b94419007791116ff8e24b9a8afbc2299 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 27 Mar 2013 20:58:55 +0100 Subject: svx/source/inc/trace.hxx -> SAL_INFO Change-Id: I019f41aeb41ec150087e6f544cff3b36719d1845 --- svx/source/fmcomp/fmgridcl.cxx | 3 +- svx/source/fmcomp/gridctrl.cxx | 47 ++++++++---------- svx/source/fmcomp/trace.cxx | 105 ----------------------------------------- svx/source/inc/trace.hxx | 62 ------------------------ 4 files changed, 21 insertions(+), 196 deletions(-) delete mode 100644 svx/source/fmcomp/trace.cxx delete mode 100644 svx/source/inc/trace.hxx (limited to 'svx/source') diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 8b5ed3551153..f0ec0421841d 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -33,7 +33,6 @@ #include "svx/fmgridcl.hxx" #include "svx/svxdlg.hxx" #include "svx/svxids.hrc" -#include "trace.hxx" #include #include @@ -1404,7 +1403,7 @@ void FmGridControl::DeleteSelectedRows() //------------------------------------------------------------------------------ void FmGridControl::positioned(const ::com::sun::star::lang::EventObject& /*rEvent*/) { - TRACE_RANGE("FmGridControl::positioned"); + SAL_INFO("svx.fmcmop", "FmGridControl::positioned"); // position on the data source (force it to be done in the main thread) implAdjustInSolarThread(sal_False); } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 46e3ac79b493..ff983b6b894d 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -56,7 +56,6 @@ #include #include -#include "trace.hxx" #include @@ -72,7 +71,7 @@ using namespace ::com::sun::star::datatransfer; using namespace ::com::sun::star::container; using namespace com::sun::star::accessibility; -#define ROWSTATUS(row) !row.Is() ? "NULL" : row->GetStatus() == GRS_CLEAN ? "CLEAN" : row->GetStatus() == GRS_MODIFIED ? "MODIFIED" : row->GetStatus() == GRS_DELETED ? "DELETED" : "INVALID" +#define ROWSTATUS(row) (!row.Is() ? "NULL" : row->GetStatus() == GRS_CLEAN ? "CLEAN" : row->GetStatus() == GRS_MODIFIED ? "MODIFIED" : row->GetStatus() == GRS_DELETED ? "DELETED" : "INVALID") #define DEFAULT_BROWSE_MODE \ @@ -2223,7 +2222,7 @@ void DbGridControl::setDisplaySynchron(sal_Bool bSync) //------------------------------------------------------------------------------ void DbGridControl::AdjustDataSource(sal_Bool bFull) { - TRACE_RANGE("DbGridControl::AdjustDataSource"); + SAL_INFO("svx.fmcomp", "DbGridControl::AdjustDataSource"); SolarMutexGuard aGuard; // wird die aktuelle Zeile gerade neu bestimmt, // wird kein abgleich vorgenommen @@ -2251,7 +2250,7 @@ void DbGridControl::AdjustDataSource(sal_Bool bFull) // position of my data cursor is the same as the position our current row points tpo // sync the status, repaint, done DBG_ASSERT(m_xDataRow == m_xCurrentRow, "Fehler in den Datenzeilen"); - TRACE_RANGE_MESSAGE1("same position, new state : %s", ROWSTATUS(m_xCurrentRow)); + SAL_INFO("svx.fmcomp", "same position, new state: " << ROWSTATUS(m_xCurrentRow)); RowModified(m_nCurrentPos); return; } @@ -2767,7 +2766,7 @@ void DbGridControl::PostExecuteRowContextMenu(sal_uInt16 /*nRow*/, const PopupMe //------------------------------------------------------------------------------ void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException ) { - TRACE_RANGE("DbGridControl::DataSourcePropertyChanged"); + SAL_INFO("svx.fmcomp", "DbGridControl::DataSourcePropertyChanged"); SolarMutexGuard aGuard; // prop "IsModified" changed ? // during update don't care about the modified state @@ -2812,7 +2811,7 @@ void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) th m_xCurrentRow->SetStatus(::comphelper::getBOOL(evt.NewValue) ? GRS_MODIFIED : GRS_CLEAN); m_xCurrentRow->SetNew( bIsNew ); InvalidateStatusCell(m_nCurrentPos); - TRACE_RANGE_MESSAGE1("modified flag changed, new state : %s", ROWSTATUS(m_xCurrentRow)); + SAL_INFO("svx.fmcomp", "modified flag changed, new state: " << ROWSTATUS(m_xCurrentRow)); } } } @@ -2998,13 +2997,13 @@ void DbGridControl::InitController(CellControllerRef& /*rController*/, long /*nR //------------------------------------------------------------------------------ void DbGridControl::CellModified() { - TRACE_RANGE("DbGridControl::CellModified"); + SAL_INFO("svx.fmcomp", "DbGridControl::CellModified"); { ::osl::MutexGuard aGuard(m_aAdjustSafety); if (m_nAsynAdjustEvent) { - TRACE_RANGE_MESSAGE1("forcing a synchron call to ", m_bPendingAdjustRows ? "AdjustRows" : "AdustDataSource"); + SAL_INFO("svx.fmcomp", "forcing a synchron call to " << (m_bPendingAdjustRows ? "AdjustRows" : "AdustDataSource")); RemoveUserEvent(m_nAsynAdjustEvent); m_nAsynAdjustEvent = 0; @@ -3024,7 +3023,7 @@ void DbGridControl::CellModified() if (m_xCurrentRow->IsNew()) { m_xCurrentRow->SetStatus(GRS_MODIFIED); - TRACE_RANGE_MESSAGE("current row is new, new state : MODIFIED"); + SAL_INFO("svx.fmcomp", "current row is new, new state: MODIFIED"); // wenn noch keine Zeile hinzugefuegt wurde, dann neue hinzunehmen if (m_nCurrentPos == GetRowCount() - 1) { @@ -3037,9 +3036,9 @@ void DbGridControl::CellModified() else if (m_xCurrentRow->GetStatus() != GRS_MODIFIED) { m_xCurrentRow->SetState(m_pDataCursor, sal_False); - TRACE_RANGE_MESSAGE1("current row is not new, after SetState, new state : %s", ROWSTATUS(m_xCurrentRow)); + SAL_INFO("svx.fmcomp", "current row is not new, after SetState, new state: " << ROWSTATUS(m_xCurrentRow)); m_xCurrentRow->SetStatus(GRS_MODIFIED); - TRACE_RANGE_MESSAGE("current row is not new, new state : MODIFIED"); + SAL_INFO("svx.fmcomp", "current row is not new, new state: MODIFIED"); InvalidateStatusCell(m_nCurrentPos); } } @@ -3193,7 +3192,7 @@ sal_Bool DbGridControl::IsInsertionRow(long nRow) const //------------------------------------------------------------------------------ sal_Bool DbGridControl::SaveModified() { - TRACE_RANGE("DbGridControl::SaveModified"); + SAL_INFO("svx.fmcomp", "DbGridControl::SaveModified"); DBG_ASSERT(IsValid(m_xCurrentRow), "GridControl:: Invalid row"); if (!IsValid(m_xCurrentRow)) return sal_True; @@ -3223,15 +3222,13 @@ sal_Bool DbGridControl::SaveModified() if ( IsValid(m_xCurrentRow) ) { m_xCurrentRow->SetState(m_pDataCursor, sal_False); - TRACE_RANGE_MESSAGE1("explicit SetState, new state : %s", ROWSTATUS(m_xCurrentRow)); + SAL_INFO("svx.fmcomp", "explicit SetState, new state: " << ROWSTATUS(m_xCurrentRow)); InvalidateStatusCell( m_nCurrentPos ); } -#ifdef DBG_UTIL else { - TRACE_RANGE_MESSAGE1("no SetState, new state : %s", ROWSTATUS(m_xCurrentRow)); + SAL_INFO("svx.fmcomp", "no SetState, new state: " << ROWSTATUS(m_xCurrentRow)); } -#endif } else { @@ -3245,7 +3242,7 @@ sal_Bool DbGridControl::SaveModified() //------------------------------------------------------------------------------ sal_Bool DbGridControl::SaveRow() { - TRACE_RANGE("DbGridControl::SaveRow"); + SAL_INFO("svx.fmcomp", "DbGridControl::SaveRow"); // gueltige Zeile if (!IsValid(m_xCurrentRow) || !IsModified()) return sal_True; @@ -3283,7 +3280,7 @@ sal_Bool DbGridControl::SaveRow() // if we are appending we still sit on the insert row // we don't move just clear the flags not to move on the current row m_xCurrentRow->SetState(m_pDataCursor, sal_False); - TRACE_RANGE_MESSAGE1("explicit SetState after a successfull update, new state : %s", ROWSTATUS(m_xCurrentRow)); + SAL_INFO("svx.fmcomp", "explicit SetState after a successfull update, new state: " << ROWSTATUS(m_xCurrentRow)); m_xCurrentRow->SetNew(sal_False); // adjust the seekcursor if it is on the same position as the datacursor @@ -3541,27 +3538,23 @@ sal_uInt16 DbGridControl::GetModelColumnPos( sal_uInt16 nId ) const //------------------------------------------------------------------------------ void DbGridControl::implAdjustInSolarThread(sal_Bool _bRows) { - TRACE_RANGE("DbGridControl::implAdjustInSolarThread"); + SAL_INFO("svx.fmcomp", "DbGridControl::implAdjustInSolarThread"); ::osl::MutexGuard aGuard(m_aAdjustSafety); if (::osl::Thread::getCurrentIdentifier() != Application::GetMainThreadIdentifier()) { m_nAsynAdjustEvent = PostUserEvent(LINK(this, DbGridControl, OnAsyncAdjust), reinterpret_cast< void* >( _bRows )); m_bPendingAdjustRows = _bRows; -#ifdef DBG_UTIL if (_bRows) - TRACE_RANGE_MESSAGE("posting an AdjustRows") + SAL_INFO("svx.fmcomp", "posting an AdjustRows"); else - TRACE_RANGE_MESSAGE("posting an AdjustDataSource") -#endif + SAL_INFO("svx.fmcomp", "posting an AdjustDataSource"); } else { -#ifdef DBG_UTIL if (_bRows) - TRACE_RANGE_MESSAGE("doing an AdjustRows") + SAL_INFO("svx.fmcomp", "doing an AdjustRows"); else - TRACE_RANGE_MESSAGE("doing an AdjustDataSource") -#endif + SAL_INFO("svx.fmcomp", "doing an AdjustDataSource"); // always adjust the rows before adjusting the data source // If this is not necessary (because the row count did not change), nothing is done // The problem is that we can't rely on the order of which the calls come in: If the cursor was moved diff --git a/svx/source/fmcomp/trace.cxx b/svx/source/fmcomp/trace.cxx deleted file mode 100644 index f881f8b5e5c2..000000000000 --- a/svx/source/fmcomp/trace.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- 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 . - */ - -#include "trace.hxx" -#include -#include - -#if defined(DBG_UTIL) - -//============================================================================== - -//------------------------------------------------------------------------------ -::osl::Mutex Tracer::s_aMapSafety; -::std::map< ::oslThreadIdentifier, sal_Int32, ::std::less< oslThreadIdentifier > > - Tracer::s_aThreadIndents; - -//------------------------------------------------------------------------------ -Tracer::Tracer(const char* _pBlockDescription) - :m_sBlockDescription(_pBlockDescription) -{ - ::osl::MutexGuard aGuard(s_aMapSafety); - sal_uInt32 nIndent = s_aThreadIndents[ ::osl::Thread::getCurrentIdentifier() ]++; - - rtl::OStringBuffer sMessage; - sMessage.append(static_cast( - ::osl::Thread::getCurrentIdentifier())); - sMessage.append('\t'); - while (nIndent--) - sMessage.append('\t'); - sMessage.append(m_sBlockDescription); - sMessage.append(RTL_CONSTASCII_STRINGPARAM(" {")); - OSL_TRACE(sMessage.getStr()); -} - -//------------------------------------------------------------------------------ -Tracer::~Tracer() -{ - ::osl::MutexGuard aGuard(s_aMapSafety); - sal_Int32 nIndent = --s_aThreadIndents[ ::osl::Thread::getCurrentIdentifier() ]; - - rtl::OStringBuffer sMessage; - sMessage.append(static_cast( - ::osl::Thread::getCurrentIdentifier())); - sMessage.append('\t'); - while (nIndent--) - sMessage.append('\t'); - sMessage.append(RTL_CONSTASCII_STRINGPARAM("} // ")); - sMessage.append(m_sBlockDescription); - OSL_TRACE(sMessage.getStr()); -} - -//------------------------------------------------------------------------------ -void Tracer::TraceString(const char* _pMessage) -{ - ::osl::MutexGuard aGuard(s_aMapSafety); - sal_Int32 nIndent = s_aThreadIndents[ ::osl::Thread::getCurrentIdentifier() ]; - - rtl::OStringBuffer sMessage; - sMessage.append(static_cast( - ::osl::Thread::getCurrentIdentifier())); - sMessage.append('\t'); - while (nIndent--) - sMessage.append('\t'); - sMessage.append(m_sBlockDescription); - sMessage.append(RTL_CONSTASCII_STRINGPARAM(": ")); - sMessage.append(_pMessage); - OSL_TRACE(sMessage.getStr()); -} - -//------------------------------------------------------------------------------ -void Tracer::TraceString1StringParam(const char* _pMessage, const char* _pParam) -{ - ::osl::MutexGuard aGuard(s_aMapSafety); - sal_Int32 nIndent = s_aThreadIndents[ ::osl::Thread::getCurrentIdentifier() ]; - - rtl::OStringBuffer sMessage; - sMessage.append(static_cast( - ::osl::Thread::getCurrentIdentifier())); - sMessage.append('\t'); - while (nIndent--) - sMessage.append('\t'); - sMessage.append(m_sBlockDescription); - sMessage.append(RTL_CONSTASCII_STRINGPARAM(": ")); - sMessage.append(_pMessage); - OSL_TRACE(sMessage.getStr(), _pParam); -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/trace.hxx b/svx/source/inc/trace.hxx deleted file mode 100644 index 061cac082292..000000000000 --- a/svx/source/inc/trace.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- 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 _TRACE_HXX_ -#define _TRACE_HXX_ - -#if defined(DBG_UTIL) - -#include -#include -#include -#include - - -class Tracer -{ - rtl::OString m_sBlockDescription; - - DECLARE_STL_STDKEY_MAP( ::oslThreadIdentifier, sal_Int32, MapThreadId2Int ); - static MapThreadId2Int s_aThreadIndents; - - static ::osl::Mutex s_aMapSafety; - -public: - Tracer(const char* _pBlockDescription); - ~Tracer(); - - void TraceString(const char* _pMessage); - void TraceString1StringParam(const char* _pMessage, const char* _pParam); -}; - - -#define TRACE_RANGE(range_description) Tracer aTrace(range_description); -#define TRACE_RANGE_MESSAGE(message) { aTrace.TraceString(message); } -#define TRACE_RANGE_MESSAGE1(message, param) { aTrace.TraceString1StringParam(message, param); } - -#else - -#define TRACE_RANGE(range_description) ; -#define TRACE_RANGE_MESSAGE(message) ; -#define TRACE_RANGE_MESSAGE1(message, param) ; - -#endif - -#endif // _TRACE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit