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

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jan 21 14:56:11 PST 2011


 sc/inc/dpshttab.hxx             |   11 +++++++++++
 sc/source/ui/dbgui/pvlaydlg.cxx |   13 ++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit db6e01c44f61c3095c0368e32c5a24f2af420cf5
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jan 21 17:54:58 2011 -0500

    Properly display range name in the UI when appropriate.
    
    DataPilot main dialog now displays range name properly in lieu of
    the traditional raw range reference string if the source data range
    is referred to as a range name.

diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index c0fe2bd..918e32b 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -58,6 +58,17 @@ public:
     SC_DLLPUBLIC ScSheetSourceDesc(ScDocument* pDoc);
 
     SC_DLLPUBLIC void SetSourceRange(const ScRange& rRange);
+
+    /**
+     * Get the range that contains the source data.  In case the source data
+     * is referred to via a range name, it returns the range that the range
+     * name points to.
+     *
+     * <i>Note that currently only a single range is supported; if the
+     * range name contains multiple ranges, only the first range is used.</i>
+     *
+     * @return source range.
+     */
     SC_DLLPUBLIC const ScRange& GetSourceRange() const;
     void SetRangeName(const ::rtl::OUString& rName);
     const ::rtl::OUString& GetRangeName() const;
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index d619c41..686c93e 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -247,9 +247,16 @@ void ScDPLayoutDlg::Init(bool bNewOutput)
     {
         aEdInPos.Enable();
         aRbInPos.Enable();
-        aOldRange = xDlgDPObject->GetSheetDesc()->GetSourceRange();
-        aOldRange.Format( inString, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
-        aEdInPos.SetText(inString);
+        const ScSheetSourceDesc* p = xDlgDPObject->GetSheetDesc();
+        OUString aRangeName = p->GetRangeName();
+        if (aRangeName.getLength())
+            aEdInPos.SetText(aRangeName);
+        else
+        {
+            aOldRange = p->GetSourceRange();
+            aOldRange.Format( inString, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
+            aEdInPos.SetText(inString);
+        }
     }
     else
     {


More information about the Libreoffice-commits mailing list