[Libreoffice-commits] .: Branch 'feature/calc-dp-unlimited-fields' - 3 commits - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Dec 15 17:40:32 PST 2010
sc/source/core/data/dpoutput.cxx | 61 --------------------------------------
sc/source/ui/dbgui/fieldwnd.cxx | 62 +++++++++++----------------------------
sc/source/ui/dbgui/pvlaydlg.cxx | 55 ----------------------------------
sc/source/ui/inc/fieldwnd.hxx | 7 ++++
4 files changed, 26 insertions(+), 159 deletions(-)
New commits:
commit 3ceb39b15fa268fbad260c2254ea07690529479a
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Dec 15 20:39:46 2010 -0500
Fixed the mouse cursor pos to field index conversion method.
For row field control.
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 7c5950d..802b2d8 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -1004,7 +1004,23 @@ bool ScDPRowFieldControl::GetFieldIndex( const Point& rPos, size_t& rnIndex )
if (rPos.X() < 0 || rPos.Y() < 0)
return false;
- rnIndex = rPos.Y() / GetFieldSize().Height() + maScroll.GetThumbPos();
+ long nFldH = GetFieldSize().Height();
+ long nThreshold = OUTER_MARGIN_VER + nFldH + ROW_FIELD_BTN_GAP / 2;
+
+ size_t nIndex = 0;
+ for (; nIndex < mnColumnBtnCount; ++nIndex)
+ {
+ if (rPos.Y() < nThreshold)
+ break;
+
+ nThreshold += nFldH + ROW_FIELD_BTN_GAP;
+ }
+
+ if (nIndex >= mnColumnBtnCount)
+ nIndex = mnColumnBtnCount - 1;
+
+ nIndex += maScroll.GetThumbPos();
+ rnIndex = nIndex;
return IsValidIndex(rnIndex);
}
@@ -1074,6 +1090,8 @@ void ScDPRowFieldControl::CalcSize()
bool ScDPRowFieldControl::IsValidIndex(size_t /*nIndex*/) const
{
+ // This method is here in case we decide to impose an arbitrary upper
+ // boundary on the number of fields.
return true;
}
commit 295990097592f9ffe25e4c0c6d85e341f10a6fa2
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Dec 15 19:44:21 2010 -0500
Removed all my debug statements.
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index e846203..a486c9c 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -77,48 +77,6 @@ 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
@@ -413,7 +371,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
bSizeOverflow( FALSE ),
mbHeaderLayout( false )
{
- StackPrinter __stack_printer__("ScDPOutput::ScDPOutput");
nTabStartCol = nMemberStartCol = nDataStartCol = nTabEndCol = 0;
nTabStartRow = nMemberStartRow = nDataStartRow = nTabEndRow = 0;
@@ -434,7 +391,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
long nDimCount = xDims->getCount();
for (long nDim=0; nDim<nDimCount; nDim++)
{
- fprintf(stdout, "ScDPOutput::ScDPOutput: dimension = %ld\n", nDim);
uno::Reference<uno::XInterface> xDim =
ScUnoHelpFunctions::AnyToInterface( xDims->getByIndex(nDim) );
uno::Reference<beans::XPropertySet> xDimProp( xDim, uno::UNO_QUERY );
@@ -455,7 +411,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
if ( eDimOrient != sheet::DataPilotFieldOrientation_HIDDEN )
{
- fprintf(stdout, "ScDPOutput::ScDPOutput: not hidden\n");
uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
long nHierarchy = ScUnoHelpFunctions::GetLongProperty(
@@ -495,7 +450,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
switch ( eDimOrient )
{
case sheet::DataPilotFieldOrientation_COLUMN:
- fprintf(stdout, "ScDPOutput::ScDPOutput: column\n");
pColFields[nColFieldCount].nDim = nDim;
pColFields[nColFieldCount].nHier = nHierarchy;
pColFields[nColFieldCount].nLevel = nLev;
@@ -508,7 +462,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
++nColFieldCount;
break;
case sheet::DataPilotFieldOrientation_ROW:
- fprintf(stdout, "ScDPOutput::ScDPOutput: row\n");
pRowFields[nRowFieldCount].nDim = nDim;
pRowFields[nRowFieldCount].nHier = nHierarchy;
pRowFields[nRowFieldCount].nLevel = nLev;
@@ -524,7 +477,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
}
break;
case sheet::DataPilotFieldOrientation_PAGE:
- fprintf(stdout, "ScDPOutput::ScDPOutput: page\n");
pPageFields[nPageFieldCount].nDim = nDim;
pPageFields[nPageFieldCount].nHier = nHierarchy;
pPageFields[nPageFieldCount].nLevel = nLev;
@@ -538,7 +490,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
break;
default:
{
- fprintf(stdout, "ScDPOutput::ScDPOutput: none of the above\n");
// added to avoid warnings
}
}
@@ -546,7 +497,6 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
// get number formats from data dimensions
if ( bIsDataLayout )
{
- fprintf(stdout, "ScDPOutput::ScDPOutput: data layout\n");
if (bRowFieldHasMember)
mbHasDataLayout = true;
@@ -562,14 +512,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS
}
else if ( bIsDataLayout )
{
- fprintf(stdout, "ScDPOutput::ScDPOutput: hidden data layout\n");
// data layout dimension is hidden (allowed if there is only one data dimension)
// -> use the number format from the first data dimension for all results
nSingleNumFmt = lcl_GetFirstNumberFormat( xDims );
}
- else
- fprintf(stdout, "ScDPOutput::ScDPOutput: just hidden ?\n");
}
}
lcl_SortFields( pColFields, nColFieldCount );
@@ -767,11 +714,6 @@ void ScDPOutput::CalcSizes()
// Insert an extra header row only when there is no column field.
nHeaderSize = 2;
- fprintf(stdout, "ScDPOutput::CalcSizes: header size = %d\n", nHeaderSize);
-
- fprintf(stdout, "ScDPOutput::CalcSizes: col fields = %d row fields = %d\n",
- nColFieldCount, nRowFieldCount);
-
// calculate output positions and sizes
long nPageSize = 0; //! use page fields!
@@ -806,9 +748,6 @@ void ScDPOutput::CalcSizes()
else
nTabEndRow = nDataStartRow; // single row will remain empty
bSizesValid = TRUE;
-
- fprintf(stdout, "ScDPOutput::CalcSizes: table size (col=%ld,row=%ld) - (col=%ld,row=%ld)\n",
- nTabStartCol,nTabStartRow,nTabEndCol,nTabEndRow);
}
}
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index e0bdf66..7c5950d 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -49,48 +49,6 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::WeakReference;
using ::com::sun::star::accessibility::XAccessible;
-#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;
-};
-
-}
-
const size_t INVALID_INDEX = static_cast<size_t>(-1);
ScDPFieldControlBase::ScDPFieldControlBase( ScDPLayoutDlg* pParent, const ResId& rResId, FixedText* pCaption ) :
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index c207744..b9b273f 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -58,48 +58,6 @@
#include "sc.hrc"
#include "scabstdlg.hxx"
-#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;
-};
-
-}
-
using namespace com::sun::star;
using ::rtl::OUString;
using ::std::vector;
@@ -473,7 +431,6 @@ void ScDPLayoutDlg::InitFields()
void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Point& rAtPos )
{
- fprintf(stdout, "ScDPLayoutDlg::AddField: from index = %d pos = (%ld, %ld)\n", nFromIndex, rAtPos.X(), rAtPos.Y());
ScDPFuncData fData( *(aSelectArr[nFromIndex]) );
size_t nAt = 0;
ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
@@ -548,8 +505,6 @@ void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Po
void ScDPLayoutDlg::AppendField(size_t nFromIndex, ScDPFieldType eToType)
{
- StackPrinter __stack_printer__("ScDPLayoutDlg::AppendField");
- fprintf(stdout, "ScDPLayoutDlg::AppendField: from index = %d to type = %d\n", nFromIndex, eToType);
ScDPFuncData aFuncData = *aSelectArr[nFromIndex];
size_t nAt = 0;
@@ -621,8 +576,6 @@ void ScDPLayoutDlg::AppendField(size_t nFromIndex, ScDPFieldType eToType)
void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPFieldType eToType, const Point& rAtPos )
{
- StackPrinter __stack_printer__("ScDPLayoutDlg::MoveField");
- fprintf(stdout, "ScDPLayoutDlg::MoveField: from type = %d from index = %d to type = %d\n", eFromType, nFromIndex, eToType);
if ( eFromType == TYPE_SELECT )
AddField( nFromIndex, eToType, rAtPos );
else if ( eFromType != eToType )
@@ -767,10 +720,6 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF
void ScDPLayoutDlg::MoveFieldToEnd( ScDPFieldType eFromType, size_t nFromIndex, ScDPFieldType eToType )
{
- StackPrinter __stack_printer__("ScDPLayoutDlg::MoveFieldToEnd");
- fprintf(stdout, "ScDPLayoutDlg::MoveFieldToEnd: from type = %d from index = %d to type = %d\n",
- eFromType, nFromIndex, eToType);
-
if ( eFromType == TYPE_SELECT )
AppendField( nFromIndex, eToType );
else if ( eFromType != eToType )
@@ -907,8 +856,6 @@ void ScDPLayoutDlg::MoveFieldToEnd( ScDPFieldType eFromType, size_t nFromIndex,
void ScDPLayoutDlg::RemoveField( ScDPFieldType eFromType, size_t nIndex )
{
- StackPrinter __stack_printer__("ScDPLayoutDlg::RemoveField");
- fprintf(stdout, "ScDPLayoutDlg::RemoveField: from type = %d index = %d\n", eFromType, nIndex);
ScDPFuncDataVec* pArr = GetFieldDataArray(eFromType);
if( pArr )
@@ -927,7 +874,6 @@ void ScDPLayoutDlg::RemoveField( ScDPFieldType eFromType, size_t nIndex )
void ScDPLayoutDlg::NotifyMouseButtonUp( const Point& rAt )
{
- StackPrinter __stack_printer__("ScDPLayoutDlg::NotifyMouseButtonUp");
if ( bIsDrag )
{
bIsDrag = FALSE;
@@ -1431,7 +1377,6 @@ bool ScDPLayoutDlg::GetPivotArrays(
void ScDPLayoutDlg::UpdateSrcRange()
{
- StackPrinter __stack_printer__("ScDPLayoutDlg::UpdateSrcRange");
String theCurPosStr = aEdInPos.GetText();
USHORT nResult = ScRange().Parse(theCurPosStr, pDoc, pDoc->GetAddressConvention());
commit c7e7a4f56c6fb09829264ab2819e2f2c10693465
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Dec 15 17:46:36 2010 -0500
Added some class descriptions.
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index 22defb6..f681021 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -230,6 +230,10 @@ private:
// ============================================================================
+/**
+ * Base class for field control with a horizontal scroll bar at the bottom.
+ * Page, column, data and select fields are derived from this class.
+ */
class ScDPHorFieldControl : public ScDPFieldControlBase
{
protected:
@@ -295,6 +299,9 @@ public:
// ============================================================================
+/**
+ * Row field control with a vertical scroll bar.
+ */
class ScDPRowFieldControl : public ScDPFieldControlBase
{
public:
More information about the Libreoffice-commits
mailing list