[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Apr 26 10:09:49 PDT 2011
sc/source/core/data/dpoutput.cxx | 47 +++++++++++++++++++++++++++++++--
sc/source/core/data/scdpoutputimpl.cxx | 10 +++----
sc/source/core/data/scdpoutputimpl.hxx | 8 ++---
3 files changed, 54 insertions(+), 11 deletions(-)
New commits:
commit b2928ab7a003948848732b4e799d7b3b18863943
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Apr 26 13:08:28 2011 -0400
Let's make the class name more descriptive and be consistent.
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 1611e25..4de081c 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -74,6 +74,48 @@ using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Any;
using ::rtl::OUString;
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class StackPrinter
+{
+public:
+ explicit StackPrinter(const char* msg) :
+ msMsg(msg)
+ {
+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+ mfStartTime = getTime();
+ }
+
+ ~StackPrinter()
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
+ }
+
+ void printTime(int line) const
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
+ }
+
+private:
+ double getTime() const
+ {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
+ }
+
+ ::std::string msMsg;
+ double mfStartTime;
+};
+
+}
+
// -----------------------------------------------------------------------
//! move to a header file
@@ -618,7 +660,7 @@ void ScDPOutput::HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
if ( nFlags & sheet::MemberResultFlags::SUBTOTAL )
{
- OutputImpl outputimp( pDoc, nTab,
+ ScDPOutputImpl outputimp( pDoc, nTab,
nTabStartCol, nTabStartRow, nMemberStartCol, nMemberStartRow,
nDataStartCol, nDataStartRow, nTabEndCol, nTabEndRow );
//! limit frames to horizontal or vertical?
@@ -764,6 +806,7 @@ sal_Int32 ScDPOutput::GetPositionType(const ScAddress& rPos)
void ScDPOutput::Output()
{
+ StackPrinter __stack_printer__("ScDPOutput::Output");
long nField;
SCTAB nTab = aStartPos.Tab();
const uno::Sequence<sheet::DataResult>* pRowAry = aData.getConstArray();
@@ -838,7 +881,7 @@ void ScDPOutput::Output()
STR_PIVOT_STYLE_INNER );
// output column headers:
- OutputImpl outputimp( pDoc, nTab,
+ ScDPOutputImpl outputimp( pDoc, nTab,
nTabStartCol, nTabStartRow, nMemberStartCol, nMemberStartRow,
nDataStartCol, nDataStartRow, nTabEndCol, nTabEndRow );
for (nField=0; nField<nColFieldCount; nField++)
diff --git a/sc/source/core/data/scdpoutputimpl.cxx b/sc/source/core/data/scdpoutputimpl.cxx
index 02c244b..b611bf6 100644
--- a/sc/source/core/data/scdpoutputimpl.cxx
+++ b/sc/source/core/data/scdpoutputimpl.cxx
@@ -42,7 +42,7 @@ namespace
}
-void OutputImpl::OutputDataArea()
+void ScDPOutputImpl::OutputDataArea()
{
AddRow( mnDataStartRow );
AddCol( mnDataStartCol );
@@ -86,7 +86,7 @@ void OutputImpl::OutputDataArea()
OutputBlockFrame( mnDataStartCol, mnTabStartRow, mnTabEndCol, mnDataStartRow-1 );
}
-OutputImpl::OutputImpl( ScDocument* pDoc, sal_uInt16 nTab,
+ScDPOutputImpl::ScDPOutputImpl( ScDocument* pDoc, sal_uInt16 nTab,
SCCOL nTabStartCol,
SCROW nTabStartRow,
SCCOL nMemberStartCol,
@@ -111,7 +111,7 @@ OutputImpl::OutputImpl( ScDocument* pDoc, sal_uInt16 nTab,
}
-sal_Bool OutputImpl::AddRow( SCROW nRow )
+bool ScDPOutputImpl::AddRow( SCROW nRow )
{
if ( !mbNeedLineRows[ nRow - mnDataStartRow ] )
{
@@ -123,7 +123,7 @@ sal_Bool OutputImpl::AddRow( SCROW nRow )
return false;
}
-sal_Bool OutputImpl::AddCol( SCCOL nCol )
+bool ScDPOutputImpl::AddCol( SCCOL nCol )
{
if ( !mbNeedLineCols[ nCol - mnDataStartCol ] )
@@ -136,7 +136,7 @@ sal_Bool OutputImpl::AddCol( SCCOL nCol )
return false;
}
-void OutputImpl::OutputBlockFrame ( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Bool bHori )
+void ScDPOutputImpl::OutputBlockFrame ( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Bool bHori )
{
Color color = SC_DP_FRAME_COLOR;
::editeng::SvxBorderLine aLine( &color, SC_DP_FRAME_INNER_BOLD );
diff --git a/sc/source/core/data/scdpoutputimpl.hxx b/sc/source/core/data/scdpoutputimpl.hxx
index 87c62c9..d2b840e 100644
--- a/sc/source/core/data/scdpoutputimpl.hxx
+++ b/sc/source/core/data/scdpoutputimpl.hxx
@@ -36,7 +36,7 @@
#define SC_DP_FRAME_COLOR Color(0,0,0) //( 0x20, 0x40, 0x68 )
-class OutputImpl
+class ScDPOutputImpl
{
ScDocument* mpDoc;
sal_uInt16 mnTab;
@@ -57,7 +57,7 @@ class OutputImpl
SCROW mnTabEndRow;
public:
- OutputImpl( ScDocument* pDoc, sal_uInt16 nTab,
+ ScDPOutputImpl( ScDocument* pDoc, sal_uInt16 nTab,
SCCOL nTabStartCol,
SCROW nTabStartRow,
SCCOL nMemberStartCol,
@@ -66,8 +66,8 @@ public:
SCROW nDataStartRow,
SCCOL nTabEndCol,
SCROW nTabEndRow );
- sal_Bool AddRow( SCROW nRow );
- sal_Bool AddCol( SCCOL nCol );
+ bool AddRow( SCROW nRow );
+ bool AddCol( SCCOL nCol );
void OutputDataArea();
void OutputBlockFrame ( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Bool bHori = false );
More information about the Libreoffice-commits
mailing list