[Libreoffice-commits] .: Branch 'feature/dp-named-range-source' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Jan 20 19:23:11 PST 2011


 sc/source/ui/dbgui/pvlaydlg.cxx |   18 +++++++++---------
 sc/source/ui/inc/pvlaydlg.hxx   |    8 +++++++-
 2 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 0bf9e51919d131e7c9b03d5a781468b46d262c08
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Jan 20 22:21:04 2011 -0500

    Store the data source type in the UI as we validate the string.

diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 9a7114c..77dab61 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -188,8 +188,8 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
                                 GetViewData() ),
         pDoc			( ((ScTabViewShell*)SfxViewShell::Current())->
                                 GetViewData()->GetDocument() ),
-        bRefInputMode   (false),
-        mbValidSrcRange (false)
+        meSrcType(SRC_INVALID),
+        bRefInputMode   (false)
 {
     xDlgDPObject->SetAlive( TRUE );     // needed to get structure information
     xDlgDPObject->FillOldParam( thePivotData, FALSE );
@@ -1419,9 +1419,9 @@ bool ScDPLayoutDlg::GetPivotArrays(
 
 void ScDPLayoutDlg::UpdateSrcRange()
 {
-    StackPrinter __stack_printer__("ScDPLayoutDlg::UpdateSrcRange");
     String  theCurPosStr = aEdInPos.GetText();
     USHORT  nResult = ScRange().Parse(theCurPosStr, pDoc, pDoc->GetAddressConvention());
+    meSrcType = SRC_INVALID;
 
     ScRange aNewRange;
     if (SCA_VALID == (nResult & SCA_VALID))
@@ -1432,6 +1432,7 @@ void ScDPLayoutDlg::UpdateSrcRange()
         aNewRange.aStart = start.GetAddress();
         aNewRange.aEnd = end.GetAddress();
         aEdInPos.SetRefValid(true);
+        meSrcType = SRC_REF;
     }
     else
     {
@@ -1453,17 +1454,16 @@ void ScDPLayoutDlg::UpdateSrcRange()
 
         aEdInPos.SetRefValid(bValid);
         if (!bValid)
+        {
             // All attempts have failed.  Give up.
+            aBtnOk.Disable();
             return;
-    }
+        }
 
-    {
-        String aStr;
-        aNewRange.Format(aStr, SCA_ABS_3D, pDoc);
-        fprintf(stdout, "ScDPLayoutDlg::UpdateSrcRange:   new range = '%s'\n",
-                rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
+        meSrcType = SRC_NAME;
     }
 
+    aBtnOk.Enable();
     ScSheetSourceDesc inSheet = *xDlgDPObject->GetSheetDesc();
 
     if (inSheet.aSourceRange == aNewRange)
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index 98c3ba1..14b1b61 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -75,6 +75,12 @@ class ScDPObject;
 
 class ScDPLayoutDlg : public ScAnyRefDlg
 {
+    /** data source type */
+    enum DataSrcType {
+        SRC_REF,     /// range reference
+        SRC_NAME,    /// range name
+        SRC_INVALID  /// invalid range
+    };
 public:
                             ScDPLayoutDlg(
                                 SfxBindings* pB,
@@ -179,8 +185,8 @@ private:
     ScPivotParam            thePivotData;
     ScViewData*             pViewData;
     ScDocument*             pDoc;
+    DataSrcType             meSrcType;
     bool                    bRefInputMode;
-    bool                    mbValidSrcRange;
 
 private:
     void                    Init            (bool bNewOutput);


More information about the Libreoffice-commits mailing list