[Libreoffice-commits] .: Branch 'feature/calc-dp-unlimited-fields' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Nov 18 13:45:25 PST 2010


 sc/source/ui/dbgui/dpuiglobal.hxx |    2 
 sc/source/ui/dbgui/fieldwnd.cxx   |   15 ------
 sc/source/ui/dbgui/pvlaydlg.cxx   |   88 +++-----------------------------------
 sc/source/ui/inc/pvlaydlg.hxx     |    3 -
 4 files changed, 9 insertions(+), 99 deletions(-)

New commits:
commit 67487fa4eb3bbfb1fb31a4878967b80a0d798553
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Nov 18 16:45:08 2010 -0500

    More work on select field control rework.

diff --git a/sc/source/ui/dbgui/dpuiglobal.hxx b/sc/source/ui/dbgui/dpuiglobal.hxx
index 8b5c743..5fd4ed2 100644
--- a/sc/source/ui/dbgui/dpuiglobal.hxx
+++ b/sc/source/ui/dbgui/dpuiglobal.hxx
@@ -36,7 +36,7 @@
 #define ROW_FIELD_BTN_GAP    2     // must be an even number
 #define FIELD_BTN_WIDTH     81
 #define FIELD_BTN_HEIGHT    23
-#define SELECT_FIELD_BTN_SPACE   5
+#define SELECT_FIELD_BTN_SPACE   2
 #define FIELD_AREA_GAP       3   // gap between row/column/data/page areas
 
 #endif
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index a9f0ab3..04c25ce 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -663,8 +663,6 @@ void ScDPFieldControlBase::SetSelectionHome()
     const FieldNames& rFields = GetFieldNames();
     if( !rFields.empty() )
     {
-        if( GetFieldType() == TYPE_SELECT )
-            mpDlg->NotifyMoveSlider( KEY_HOME );
         SetSelection( 0 );
     }
 }
@@ -674,8 +672,6 @@ void ScDPFieldControlBase::SetSelectionEnd()
     const FieldNames& rFields = GetFieldNames();
     if( !rFields.empty() )
     {
-        if( GetFieldType() == TYPE_SELECT )
-            mpDlg->NotifyMoveSlider( KEY_END );
         SetSelection( rFields.size() - 1 );
     }
 }
@@ -683,17 +679,6 @@ void ScDPFieldControlBase::SetSelectionEnd()
 void ScDPFieldControlBase::MoveSelection( USHORT nKeyCode, SCsCOL nDX, SCsROW nDY )
 {
     size_t nNewIndex = CalcNewFieldIndex( nDX, nDY );
-    if( (GetFieldType() == TYPE_SELECT) && (nNewIndex == GetSelectedField()) )
-    {
-        if( mpDlg->NotifyMoveSlider( nKeyCode ) )
-        {
-            switch( nKeyCode )
-            {
-                case KEY_UP:    nNewIndex += (LINE_SIZE - 1);   break;
-                case KEY_DOWN:  nNewIndex -= (LINE_SIZE - 1);   break;
-            }
-        }
-    }
     SetSelection( nNewIndex );
 }
 
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 530776c..a0f84ca 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -147,7 +147,6 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
         aFtData         ( this, ScResId( FT_DATA ) ),
         aWndData        ( this, ScResId( WND_DATA ), &aFtData ),
         aWndSelect      ( this, ScResId( WND_SELECT ), NULL ),
-        aSlider			( this, ScResId( WND_HSCROLL ) ),
         aFtInfo			( this, ScResId( FT_INFO ) ),
 
         aFlAreas        ( this, ScResId( FL_OUTPUT ) ),
@@ -243,8 +242,6 @@ void ScDPLayoutDlg::Init(bool bNewOutput)
 
     CalcWndSizes();
 
-    aSelectArr.resize( PAGE_SIZE );
-
     ScRange inRange;
     String inString;
     if (xDlgDPObject->GetSheetDesc())
@@ -387,22 +384,21 @@ void ScDPLayoutDlg::StateChanged( StateChangedType nStateChange )
 
 void ScDPLayoutDlg::InitWndSelect( const vector<ScDPLabelDataRef>& rLabels )
 {
+    StackPrinter __stack_printer__("ScDPLayoutDlg::InitWndSelect");
     size_t nLabelCount = rLabels.size();
     if (nLabelCount > MAX_LABELS)
         nLabelCount = MAX_LABELS;
-    size_t nLast = (nLabelCount > PAGE_SIZE) ? (PAGE_SIZE - 1) : (nLabelCount - 1);
 
     aLabelDataArr.clear();
     aLabelDataArr.reserve( nLabelCount );
     for ( size_t i=0; i < nLabelCount; i++ )
     {
+        fprintf(stdout, "ScDPLayoutDlg::InitWndSelect:   label data = %s\n",
+                rtl::OUStringToOString(rLabels[i]->getDisplayName(), RTL_TEXTENCODING_UTF8).getStr());
         aLabelDataArr.push_back(*rLabels[i]);
-
-        if ( i <= nLast )
-        {
-            aWndSelect.AddField(aLabelDataArr[i].getDisplayName(), i);
-            aSelectArr[i].reset( new ScDPFuncData( aLabelDataArr[i].mnCol, aLabelDataArr[i].mnFuncMask ) );
-        }
+        aWndSelect.AddField(aLabelDataArr[i].getDisplayName(), i);
+        ScDPFuncDataRef p(new ScDPFuncData(aLabelDataArr[i].mnCol, aLabelDataArr[i].mnFuncMask));
+        aSelectArr.push_back(p);
     }
 }
 
@@ -473,20 +469,6 @@ void ScDPLayoutDlg::InitFields()
     InitFieldWindow(thePivotData.maColFields, TYPE_COL);
     InitFieldWindow(thePivotData.maRowFields, TYPE_ROW);
     InitFieldWindow(thePivotData.maDataFields, TYPE_DATA);
-
-    size_t nLabels = thePivotData.maLabelArray.size();
-    aSlider.SetPageSize( PAGE_SIZE );
-    aSlider.SetVisibleSize( PAGE_SIZE );
-    aSlider.SetLineSize( LINE_SIZE );
-    aSlider.SetRange( Range( 0, static_cast<long>(((nLabels+LINE_SIZE-1)/LINE_SIZE)*LINE_SIZE) ) );
-
-    if ( nLabels > PAGE_SIZE )
-    {
-        aSlider.SetEndScrollHdl( LINK( this, ScDPLayoutDlg, ScrollHdl ) );
-        aSlider.Show();
-    }
-    else
-        aSlider.Hide();
 }
 
 //----------------------------------------------------------------------------
@@ -1189,25 +1171,6 @@ void ScDPLayoutDlg::NotifyRemoveField( ScDPFieldType eType, size_t nFieldIndex )
         RemoveField( eType, nFieldIndex );
 }
 
-//----------------------------------------------------------------------------
-
-BOOL ScDPLayoutDlg::NotifyMoveSlider( USHORT nKeyCode )
-{
-    long nOldPos = aSlider.GetThumbPos();
-    switch( nKeyCode )
-    {
-        case KEY_HOME:  aSlider.DoScroll( 0 );                      break;
-        case KEY_END:   aSlider.DoScroll( aSlider.GetRangeMax() );  break;
-        case KEY_UP:
-        case KEY_LEFT:  aSlider.DoScrollAction( SCROLL_LINEUP );    break;
-        case KEY_DOWN:
-        case KEY_RIGHT: aSlider.DoScrollAction( SCROLL_LINEDOWN );  break;
-    }
-    return nOldPos != aSlider.GetThumbPos();
-}
-
-//----------------------------------------------------------------------------
-
 void ScDPLayoutDlg::Deactivate()
 {
     /*  #107616# If the dialog has been deactivated (click into document), the LoseFocus
@@ -1388,15 +1351,8 @@ void ScDPLayoutDlg::CalcWndSizes()
 
     // selection area
     aWndSelect.SetSizePixel(
-        Size(2 * nFldW + SELECT_FIELD_BTN_SPACE,
-             LINE_SIZE * nFldH + (LINE_SIZE - 1) * SELECT_FIELD_BTN_SPACE));
-
-    // scroll bar
-    Point aSliderPos( aWndSelect.GetPosPixel() );
-    Size aSliderSize( aWndSelect.GetSizePixel() );
-    aSliderPos.Y() += aSliderSize.Height() + SELECT_FIELD_BTN_SPACE;
-    aSliderSize.Height() = GetSettings().GetStyleSettings().GetScrollBarSize();
-    aSlider.SetPosSizePixel( aSliderPos, aSliderSize );
+        Size(2 * nFldW + ROW_FIELD_BTN_GAP,
+             LINE_SIZE * nFldH + (LINE_SIZE - 1) * ROW_FIELD_BTN_GAP));
 
     aRectPage   = Rectangle( aWndPage.GetPosPixel(),    aWndPage.GetSizePixel() );
     aRectRow	= Rectangle( aWndRow.GetPosPixel(),		aWndRow.GetSizePixel() );
@@ -1922,34 +1878,6 @@ IMPL_LINK( ScDPLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG )
     return 0;
 }
 
-//----------------------------------------------------------------------------
-
-IMPL_LINK( ScDPLayoutDlg, ScrollHdl, ScrollBar *, EMPTYARG )
-{
-    long nNewOffset = aSlider.GetThumbPos();
-    long nOffsetDiff = nNewOffset - nOffset;
-    nOffset = nNewOffset;
-
-    size_t nFields = std::min< size_t >( aLabelDataArr.size() - nOffset, PAGE_SIZE );
-
-    aWndSelect.ClearFields();
-
-    size_t i=0;
-    for ( i=0; i<nFields; i++ )
-    {
-        const ScDPLabelData& rData = aLabelDataArr[nOffset+i];
-        aWndSelect.AddField(rData.getDisplayName(), i);
-        aSelectArr[i].reset( new ScDPFuncData( rData.mnCol, rData.mnFuncMask ) );
-    }
-    for ( ; i<aSelectArr.size(); i++ )
-        aSelectArr[i].reset();
-
-    aWndSelect.ModifySelectionOffset( nOffsetDiff );    // adjusts selection & redraws
-    return 0;
-}
-
-//----------------------------------------------------------------------------
-
 IMPL_LINK( ScDPLayoutDlg, GetFocusHdl, Control*, pCtrl )
 {
     pEditActive = NULL;
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index 3416243..01b4fe9 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -97,7 +97,6 @@ public:
     void                    NotifyFieldFocus     ( ScDPFieldType eType, BOOL bGotFocus );
     void                    NotifyMoveFieldToEnd      ( ScDPFieldType eToType );
     void                    NotifyRemoveField    ( ScDPFieldType eType, size_t nFieldIndex );
-    BOOL                    NotifyMoveSlider     ( USHORT nKeyCode );   // return TRUE, if position changed
 
 protected:
     virtual void            Deactivate();
@@ -117,7 +116,6 @@ private:
     FixedText               aFtData;
     ScDPDataFieldControl    aWndData;
     ScDPSelectFieldControl  aWndSelect;
-    ScrollBar               aSlider;
     FixedInfo               aFtInfo;
 
     FixedLine               aFlAreas;
@@ -235,7 +233,6 @@ private:
 
     // Handler
     DECL_LINK( ClickHdl, PushButton * );
-    DECL_LINK( ScrollHdl, ScrollBar * );
     DECL_LINK( SelAreaHdl, ListBox * );
     DECL_LINK( MoreClickHdl, MoreButton * );
     DECL_LINK( EdModifyHdl, Edit * );


More information about the Libreoffice-commits mailing list