ooo-build r11584 - in trunk: . patches/src680



Author: kyoshida
Date: Thu Feb 14 19:39:17 2008
New Revision: 11584
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11584&view=rev

Log:
2008-02-14  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/sc-datapilot-dynamic-range.diff: fixed tab order, 
	commit the change when the OK is pressed, not when the source range
	is modified, and lots of code cleanups.


Modified:
   trunk/ChangeLog
   trunk/patches/src680/sc-datapilot-dynamic-range.diff

Modified: trunk/patches/src680/sc-datapilot-dynamic-range.diff
==============================================================================
--- trunk/patches/src680/sc-datapilot-dynamic-range.diff	(original)
+++ trunk/patches/src680/sc-datapilot-dynamic-range.diff	Thu Feb 14 19:39:17 2008
@@ -26,7 +26,16 @@
  #define PIVOTSTR_AVG			3
 diff -urp --exclude=CVS sc.clean/source/ui/dbgui/pivot.src sc/source/ui/dbgui/pivot.src
 --- sc.clean/source/ui/dbgui/pivot.src	2008-02-05 11:16:56.000000000 -0500
-+++ sc/source/ui/dbgui/pivot.src	2008-02-13 17:29:26.000000000 -0500
++++ sc/source/ui/dbgui/pivot.src	2008-02-14 09:52:45.000000000 -0500
+@@ -163,7 +163,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
+         Size = MAP_APPFONT ( 50 , 14 ) ;
+ 		TabStop = TRUE ;
+ 		MapUnit = MAP_APPFONT ;
+-        Delta = 73 ;
++        Delta = 90 ;
+ 	};
+ 	Window WND_FIELD
+ 	{
 @@ -183,9 +183,50 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
  		Text [ en-US ] = "Result" ;
  		Hide = TRUE ;
@@ -162,14 +171,8 @@
 Only in sc/source/ui/dbgui: pivot.src~
 diff -urp --exclude=CVS sc.clean/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
 --- sc.clean/source/ui/dbgui/pvlaydlg.cxx	2008-02-05 11:16:56.000000000 -0500
-+++ sc/source/ui/dbgui/pvlaydlg.cxx	2008-02-13 18:15:29.000000000 -0500
-@@ -36,11 +36,12 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
- 
--
-+#include <stdio.h>
- 
++++ sc/source/ui/dbgui/pvlaydlg.cxx	2008-02-14 14:29:15.000000000 -0500
+@@ -41,6 +41,7 @@
  //----------------------------------------------------------------------------
  
  #include "pvlaydlg.hxx"
@@ -185,17 +188,19 @@
  #include "scmod.hxx"
  
  #include "sc.hrc" //CHINA001
-@@ -129,6 +131,9 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBinding
+@@ -125,6 +127,11 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBinding
+ 		aFtInfo			( this, ScResId( FT_INFO ) ),
+ 
+         aFlAreas        ( this, ScResId( FL_OUTPUT ) ),
++
++        aFtInArea		( this, ScResId( FT_INAREA) ),
++        aEdInPos		( this, ScResId( ED_INAREA) ),
++        aRbInPos		( this, ScResId( RB_INAREA ), &aEdInPos ),
++
+ 		aLbOutPos		( this, ScResId( LB_OUTAREA ) ),
  		aFtOutArea		( this, ScResId( FT_OUTAREA ) ),
  		aEdOutPos		( this, ScResId( ED_OUTAREA ) ),
- 		aRbOutPos		( this, ScResId( RB_OUTAREA ), &aEdOutPos ),
-+		aFtInArea		( this, ScResId( FT_INAREA) ),
-+		aEdInPos		( this, ScResId( ED_INAREA) ),
-+		aRbInPos		( this, ScResId( RB_INAREA ), &aEdInPos ),
- 		aBtnIgnEmptyRows( this, ScResId( BTN_IGNEMPTYROWS ) ),
- 		aBtnDetectCat	( this, ScResId( BTN_DETECTCAT ) ),
- 		aBtnTotalCol	( this, ScResId( BTN_TOTALCOL ) ),
-@@ -148,6 +153,8 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBinding
+@@ -148,6 +155,8 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBinding
  
  		bIsDrag			( FALSE ),
  
@@ -204,27 +209,28 @@
          eLastActiveType ( TYPE_SELECT ),
  		nOffset			( 0 ),
  		//
-@@ -209,6 +216,9 @@ void __EXPORT ScDPLayoutDlg::Init()
+@@ -209,6 +218,10 @@ void __EXPORT ScDPLayoutDlg::Init()
      for ( USHORT i = 0; i < FUNC_COUNT; ++i )
          aFuncNameArr.push_back( String( ScResId( i + 1 ) ) );
  
++    aBtnMore.AddWindow( &aFlAreas );
 +    aBtnMore.AddWindow( &aFtInArea );
 +    aBtnMore.AddWindow( &aEdInPos );
 +    aBtnMore.AddWindow( &aRbInPos );
  	aBtnMore.AddWindow( &aFtOutArea );
  	aBtnMore.AddWindow( &aLbOutPos );
  	aBtnMore.AddWindow( &aEdOutPos );
-@@ -221,6 +231,7 @@ void __EXPORT ScDPLayoutDlg::Init()
+@@ -219,7 +232,6 @@ void __EXPORT ScDPLayoutDlg::Init()
+ 	aBtnMore.AddWindow( &aBtnTotalRow );
+     aBtnMore.AddWindow( &aBtnFilter );
      aBtnMore.AddWindow( &aBtnDrillDown );
-     aBtnMore.AddWindow( &aFlAreas );
+-    aBtnMore.AddWindow( &aFlAreas );
      aBtnMore.SetClickHdl( LINK( this, ScDPLayoutDlg, MoreClickHdl ) );
-+    aBtnMore.SetDelta(90);
  
  	{
-         Size aFieldSize( Window( this, ScResId( WND_FIELD ) ).GetSizePixel() );
-@@ -243,6 +254,23 @@ void __EXPORT ScDPLayoutDlg::Init()
- 	InitWnd( thePivotData.aRowArr,  static_cast<long>(thePivotData.nRowCount),  TYPE_ROW );
- 	InitWnd( thePivotData.aDataArr, static_cast<long>(thePivotData.nDataCount), TYPE_DATA );
+@@ -237,6 +249,23 @@ void __EXPORT ScDPLayoutDlg::Init()
+     aRowArr.resize( MAX_FIELDS );
+     aDataArr.resize( MAX_FIELDS );
  
 +    ScRange inRange;
 +    String inString;
@@ -242,11 +248,11 @@
 +        aEdInPos.Disable();
 +        aRbInPos.Disable();
 +    }
-+	
-     aSlider.SetPageSize( PAGE_SIZE );
-     aSlider.SetVisibleSize( PAGE_SIZE );
-     aSlider.SetLineSize( LINE_SIZE );
-@@ -260,8 +288,14 @@ void __EXPORT ScDPLayoutDlg::Init()
++
+ 	InitWndSelect( thePivotData.ppLabelArr, static_cast<long>(thePivotData.nLabels) );
+     InitWnd( thePivotData.aPageArr, static_cast<long>(thePivotData.nPageCount), TYPE_PAGE );
+ 	InitWnd( thePivotData.aColArr,  static_cast<long>(thePivotData.nColCount),  TYPE_COL );
+@@ -260,8 +289,14 @@ void __EXPORT ScDPLayoutDlg::Init()
  
      aLbOutPos .SetSelectHdl( LINK( this, ScDPLayoutDlg, SelAreaHdl ) );
      aEdOutPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdModifyHdl ) );
@@ -261,7 +267,49 @@
  
  	if ( pViewData && pDoc )
  	{
-@@ -1319,18 +1353,24 @@ BOOL ScDPLayoutDlg::GetPivotArrays(    P
+@@ -1314,23 +1349,66 @@ BOOL ScDPLayoutDlg::GetPivotArrays(    P
+ 	return bFit;
+ }
+ 
++bool ScDPLayoutDlg::UpdateSrcRange()
++{
++    String  theCurPosStr = aEdInPos.GetText();
++    USHORT  nResult = ScRange().Parse(theCurPosStr, pDoc);
++
++    if ( SCA_VALID != (nResult & SCA_VALID) )
++        // invalid source range.
++        return false;
++
++    ScRefAddress start, end;
++    ConvertDoubleRef(pDoc, theCurPosStr, 1,  start, end);
++    ScRange aNewRange(start.GetAddress(), end.GetAddress());
++    ScSheetSourceDesc inSheet = *xDlgDPObject->GetSheetDesc();
++
++    if (inSheet.aSourceRange == aNewRange)
++        // new range is identical to the current range.  Nothing to do.
++        return true;
++
++    ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
++    inSheet.aSourceRange = aNewRange;
++    xDlgDPObject->SetSheetDesc(inSheet);
++    xDlgDPObject->InvalidateSource();
++    xDlgDPObject->Output();
++    xDlgDPObject->SetAlive(true);     // needed to get structure information
++    xDlgDPObject->FillOldParam(thePivotData, true);
++    xDlgDPObject->FillLabelData(thePivotData);
++
++    pTabViewShell->SetDialogDPObject(xDlgDPObject.get());
++    aLabelDataArr.clear();
++    aWndSelect.ClearFields();
++    aWndData.ClearFields();
++    aWndRow.ClearFields();
++    aWndCol.ClearFields();
++    aWndPage.ClearFields();
++
++    return true;
++}
+ 
+ //----------------------------------------------------------------------------
  
  void ScDPLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
  {
@@ -298,7 +346,7 @@
  }
  
  
-@@ -1340,8 +1380,13 @@ void ScDPLayoutDlg::SetActive()
+@@ -1340,8 +1418,13 @@ void ScDPLayoutDlg::SetActive()
  {
  	if ( bRefInputMode )
  	{
@@ -314,17 +362,20 @@
  	}
  	else
  	{
-@@ -1489,7 +1534,8 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButto
- 		ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ),
- 				 ScGlobal::GetRscString( STR_INVALID_TABREF )
- 				).Execute();
--		aEdOutPos.GrabFocus();
-+        if ( pEditActive )
-+            pEditActive->GrabFocus();
- 	}
- 	return 0;
- }
-@@ -1514,9 +1560,18 @@ IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, 
+@@ -1384,6 +1467,12 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButto
+ 	if (   bToNewTable
+ 		|| ( (aOutPosStr.Len() > 0) && (SCA_VALID == (nResult & SCA_VALID)) ) )
+ 	{
++        if (!UpdateSrcRange())
++        {
++            ErrorBox( this, WinBits(WB_OK | WB_DEF_OK), ScGlobal::GetRscString(STR_INVALID_TABREF) ).Execute();
++            aEdInPos.GrabFocus();
++            return 0;
++        }
+ 		//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
+ 		//SFX_APPWINDOW->Enable();
+ 
+@@ -1514,9 +1603,18 @@ IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, 
  		bRefInputMode = TRUE;
  		//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
  		//SFX_APPWINDOW->Enable();
@@ -346,99 +397,12 @@
  	}
  	else
  	{
-@@ -1557,6 +1612,99 @@ IMPL_LINK( ScDPLayoutDlg, EdModifyHdl, E
+@@ -1557,6 +1655,12 @@ IMPL_LINK( ScDPLayoutDlg, EdModifyHdl, E
  }
  
  
 +IMPL_LINK( ScDPLayoutDlg, EdInModifyHdl, Edit *, EMPTYARG )
 +{
-+    String  theCurPosStr = aEdInPos.GetText();
-+
-+    ScSheetSourceDesc inSheet = *(xDlgDPObject->GetSheetDesc());
-+    ScRange aR = xDlgDPObject->GetSheetDesc()->aSourceRange;
-+    ScRefAddress start, end;
-+    ConvertDoubleRef (pDoc, theCurPosStr, 1,  start, end );
-+    inSheet.aSourceRange = ScRange(start.GetAddress(), end.GetAddress());
-+    xDlgDPObject->SetSheetDesc( inSheet);
-+    xDlgDPObject->InvalidateSource();
-+    xDlgDPObject->Output();
-+    xDlgDPObject->SetAlive( TRUE );     // needed to get structure information
-+    xDlgDPObject->FillOldParam( thePivotData, FALSE );
-+    xDlgDPObject->FillLabelData( thePivotData );
-+
-+    ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
-+    ScDPObject tmpDPObject(*xDlgDPObject);
-+    pTabViewShell->SetDialogDPObject(&tmpDPObject);
-+            
-+    aR = xDlgDPObject->GetSheetDesc()->aSourceRange;
-+    
-+    aLabelDataArr.clear();
-+    aWndSelect.ClearFields();
-+    aWndData.ClearFields();
-+    aWndRow.ClearFields();
-+    aWndCol.ClearFields();
-+    aWndPage.ClearFields();
-+    
-+    USHORT i;
-+    for ( i=0; i<MAX_LABELS; i++ )
-+        aSelectArr[i].reset();
-+
-+    for ( i=0; i<MAX_FIELDS; i++ )
-+    {
-+        RemoveField (TYPE_COL, i);
-+        RemoveField (TYPE_ROW, i);
-+        RemoveField (TYPE_DATA, i);
-+    }
-+    for ( i=0; i<MAX_PAGEFIELDS; i++ )
-+        RemoveField (TYPE_PAGE, i);
-+
-+    InitWndSelect( thePivotData.ppLabelArr, thePivotData.nLabels );
-+    InitWnd( thePivotData.aColArr,  thePivotData.nColCount,  TYPE_COL );
-+    InitWnd( thePivotData.aRowArr,  thePivotData.nRowCount,  TYPE_ROW );
-+    InitWnd( thePivotData.aDataArr, thePivotData.nDataCount, TYPE_DATA );
-+    InitWnd( thePivotData.aPageArr, thePivotData.nPageCount, TYPE_PAGE );
-+    aSlider.SetPageSize( PAGE_SIZE );
-+    aSlider.SetVisibleSize( PAGE_SIZE );
-+    aSlider.SetLineSize( LINE_SIZE );
-+    aSlider.SetRange( Range( 0, ((thePivotData.nLabels+LINE_SIZE-1)/LINE_SIZE)*LINE_SIZE ) );
-+
-+    if ( thePivotData.nLabels > PAGE_SIZE )
-+    {
-+        aSlider.SetEndScrollHdl( LINK( this, ScDPLayoutDlg, ScrollHdl ) );
-+        aSlider.Show();
-+    }
-+    else
-+        aSlider.Hide();
-+
-+    if ( pViewData && pDoc )
-+    {
-+        /*
-+         * Aus den RangeNames des Dokumentes werden nun die
-+         * in einem Zeiger-Array gemerkt, bei denen es sich
-+         * um sinnvolle Bereiche handelt
-+         */
-+
-+        aLbOutPos.Clear();
-+        aLbOutPos.InsertEntry( aStrUndefined, 0 );
-+        aLbOutPos.InsertEntry( aStrNewTable,  1 );
-+
-+        ScAreaNameIterator aIter( pDoc );
-+        String aName;
-+        ScRange aRange;
-+        String aRefStr;
-+        while ( aIter.Next( aName, aRange ) )
-+        {
-+            if ( !aIter.WasDBName() )       // hier keine DB-Bereiche !
-+            {
-+                USHORT nInsert = aLbOutPos.InsertEntry( aName );
-+
-+                aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc );
-+                aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) );
-+            }
-+        }
-+    }
-+
-+    aEdInPos.GrabFocus();
 +    return 0;
 +}
 +
@@ -446,7 +410,7 @@
  //----------------------------------------------------------------------------
  
  IMPL_LINK( ScDPLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG )
-@@ -1610,4 +1758,16 @@ IMPL_LINK( ScDPLayoutDlg, ScrollHdl, Scr
+@@ -1610,4 +1714,16 @@ IMPL_LINK( ScDPLayoutDlg, ScrollHdl, Scr
  	return 0;
  }
  
@@ -466,21 +430,27 @@
 Only in sc/source/ui/dbgui: pvlaydlg.cxx.orig
 diff -urp --exclude=CVS sc.clean/source/ui/inc/pvlaydlg.hxx sc/source/ui/inc/pvlaydlg.hxx
 --- sc.clean/source/ui/inc/pvlaydlg.hxx	2008-02-05 11:16:55.000000000 -0500
-+++ sc/source/ui/inc/pvlaydlg.hxx	2008-02-13 16:32:46.000000000 -0500
-@@ -147,6 +147,12 @@ private:
-     FixedText               aFtOutArea;
-     ScRefEdit               aEdOutPos;
-     ScRefButton             aRbOutPos;
++++ sc/source/ui/inc/pvlaydlg.hxx	2008-02-14 14:25:26.000000000 -0500
+@@ -143,10 +143,18 @@ private:
+     FixedInfo               aFtInfo;
+ 
+     FixedLine               aFlAreas;
 +
-+    // For DP source selection
++    // DP source selection
 +    FixedText               aFtInArea;
 +    ScRefEdit               aEdInPos;
 +    ScRefButton             aRbInPos;
 +
++    // DP output location
+     ListBox                 aLbOutPos;
+     FixedText               aFtOutArea;
+     ScRefEdit               aEdOutPos;
+     ScRefButton             aRbOutPos;
++
      CheckBox                aBtnIgnEmptyRows;
      CheckBox                aBtnDetectCat;
      CheckBox                aBtnTotalCol;
-@@ -169,6 +175,8 @@ private:
+@@ -169,6 +177,8 @@ private:
      size_t                  nDnDFromIndex;
      BOOL                    bIsDrag;
  
@@ -489,11 +459,20 @@
      Rectangle               aRectPage;
      Rectangle               aRectRow;
      Rectangle               aRectCol;
-@@ -227,8 +235,10 @@ private:
+@@ -221,14 +231,19 @@ private:
+                                               USHORT&       rColCount,
+                                               USHORT&       rRowCount,
+                                               USHORT&       rDataCount );
++
++    bool                    UpdateSrcRange();
++
+ 	// Handler
+     DECL_LINK( ClickHdl, PushButton * );
+ 	DECL_LINK( ScrollHdl, ScrollBar * );
  	DECL_LINK( SelAreaHdl, ListBox * );
  	DECL_LINK( MoreClickHdl, MoreButton * );
  	DECL_LINK( EdModifyHdl, Edit * );
-+	DECL_LINK( EdInModifyHdl, Edit * );
++    DECL_LINK( EdInModifyHdl, Edit * );
  	DECL_LINK( OkHdl, OKButton * );
  	DECL_LINK( CancelHdl, CancelButton * );
 +    DECL_LINK( GetFocusHdl, Control* );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]