[Libreoffice-commits] .: 7 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Mar 1 13:19:20 PST 2011


 sc/inc/dpsdbtab.hxx                |   14 +-
 sc/inc/dpshttab.hxx                |    7 -
 sc/inc/dptabdat.hxx                |    4 
 sc/inc/scabstdlg.hxx               |    7 +
 sc/source/ui/attrdlg/scdlgfact.cxx |   19 +++-
 sc/source/ui/attrdlg/scdlgfact.hxx |    7 +
 sc/source/ui/dbgui/dapitype.cxx    |   44 ++++++++-
 sc/source/ui/dbgui/dapitype.hrc    |   40 ++++----
 sc/source/ui/dbgui/dapitype.src    |   37 +++++--
 sc/source/ui/inc/cellsh.hxx        |    2 
 sc/source/ui/inc/dapitype.hxx      |   12 ++
 sc/source/ui/view/cellsh1.cxx      |  175 +++++++++++++++++++++++++++++++++++++
 sc/source/ui/view/cellsh2.cxx      |  141 -----------------------------
 13 files changed, 317 insertions(+), 192 deletions(-)

New commits:
commit 4ab693968e8a7a8088324a64a5802dfb0c786a7e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 16:12:34 2011 -0500

    Moved the widgets a bit and shrank the dialog to make it look nicer.

diff --git a/sc/source/ui/dbgui/dapitype.src b/sc/source/ui/dbgui/dapitype.src
index a38760e..fa49dfb 100644
--- a/sc/source/ui/dbgui/dapitype.src
+++ b/sc/source/ui/dbgui/dapitype.src
@@ -35,13 +35,13 @@ ModalDialog RID_SCDLG_DAPITYPE
     OutputSize = TRUE ;
     HelpId = HID_DATAPILOT_TYPE ;
     SVLook = TRUE ;
-    Size = MAP_APPFONT ( 241 , 83 ) ;
+    Size = MAP_APPFONT ( 241 , 76 ) ;
     Moveable = TRUE ;
     Closeable = FALSE ;
 
     FixedLine FL_FRAME
     {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
+        Pos = MAP_APPFONT ( 6 , 6 ) ;
         Size = MAP_APPFONT ( 173 , 8 ) ;
         Text [ en-US ] = "Selection";
     };
@@ -66,35 +66,35 @@ ModalDialog RID_SCDLG_DAPITYPE
     };
     RadioButton BTN_SELECTION
     {
-        Pos = MAP_APPFONT ( 12 , 14 ) ;
+        Pos = MAP_APPFONT ( 12 , 18 ) ;
         Size = MAP_APPFONT ( 164 , 10 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "~Current selection";
     };
     RadioButton BTN_NAMED_RANGE
     {
-        Pos = MAP_APPFONT ( 12 , 28 ) ;
+        Pos = MAP_APPFONT ( 12 , 32 ) ;
         Size = MAP_APPFONT ( 70 , 10 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "~Named range";
     };
     ListBox LB_NAMED_RANGE
     {
-        Pos = MAP_APPFONT ( 90 , 27 ) ;
+        Pos = MAP_APPFONT ( 90 , 31 ) ;
         Size = MAP_APPFONT ( 70 , 10 ) ;
         TabStop = TRUE ;
         DropDown = TRUE ;
     };
     RadioButton BTN_DATABASE
     {
-        Pos = MAP_APPFONT ( 12 , 42 ) ;
+        Pos = MAP_APPFONT ( 12 , 46 ) ;
         Size = MAP_APPFONT ( 164 , 10 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "~Data source registered in %PRODUCTNAME";
     };
     RadioButton BTN_EXTERNAL
     {
-        Pos = MAP_APPFONT ( 12 , 56 ) ;
+        Pos = MAP_APPFONT ( 12 , 60 ) ;
         Size = MAP_APPFONT ( 164 , 10 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "~External source/interface";
commit ec14a6a5e1d4bd219419e62325585cd7a8cbcafd
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 16:01:31 2011 -0500

    Re-arranged widgets definitions a bit.

diff --git a/sc/source/ui/dbgui/dapitype.src b/sc/source/ui/dbgui/dapitype.src
index 1aef003..a38760e 100644
--- a/sc/source/ui/dbgui/dapitype.src
+++ b/sc/source/ui/dbgui/dapitype.src
@@ -31,12 +31,20 @@
 
 ModalDialog RID_SCDLG_DAPITYPE
 {
+    Text [ en-US ] = "Select Source";
     OutputSize = TRUE ;
     HelpId = HID_DATAPILOT_TYPE ;
     SVLook = TRUE ;
     Size = MAP_APPFONT ( 241 , 83 ) ;
     Moveable = TRUE ;
     Closeable = FALSE ;
+
+    FixedLine FL_FRAME
+    {
+        Pos = MAP_APPFONT ( 6 , 3 ) ;
+        Size = MAP_APPFONT ( 173 , 8 ) ;
+        Text [ en-US ] = "Selection";
+    };
     OKButton BTN_OK
     {
         Pos = MAP_APPFONT ( 185 , 6 ) ;
@@ -91,13 +99,6 @@ ModalDialog RID_SCDLG_DAPITYPE
         TabStop = TRUE ;
         Text [ en-US ] = "~External source/interface";
     };
-    FixedLine FL_FRAME
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 173 , 8 ) ;
-        Text [ en-US ] = "Selection";
-    };
-    Text [ en-US ] = "Select Source";
 };
 
 
commit 52a6ffdbd8d966a376b0214e2f7f0762e8cea3af
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 15:57:26 2011 -0500

    Put all the other pieces into place.
    
    Now you can specify a named range as the data source for a new
    data pilot table.

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 8bf02a2..53cbf44 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -98,7 +98,7 @@ public:
     virtual bool IsExternal() const = 0;
     virtual bool IsNamedRange() const = 0;
     virtual rtl::OUString GetSelectedNamedRange() const = 0;
-    virtual void SetNamedRanges(const ::std::vector<rtl::OUString>& rNames) = 0;
+    virtual void AppendNamedRange(const ::rtl::OUString& rName) = 0;
 };
 
 class AbstractScDataPilotServiceDlg : public VclAbstractDialog  //add for ScDataPilotServiceDlg
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 407e694..906bb88 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -270,9 +270,9 @@ rtl::OUString AbstractScDataPilotSourceTypeDlg_Impl::GetSelectedNamedRange() con
     return pDlg->GetSelectedNamedRange();
 }
 
-void AbstractScDataPilotSourceTypeDlg_Impl::SetNamedRanges(const std::vector<rtl::OUString>& rNames)
+void AbstractScDataPilotSourceTypeDlg_Impl::AppendNamedRange(const ::rtl::OUString& rName)
 {
-    pDlg->SetNamedRanges(rNames);
+    pDlg->AppendNamedRange(rName);
 }
 
 //AbstractScDataPilotSourceTypeDlg_Impl end
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index c0ecdad..a55d508 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -149,7 +149,7 @@ class AbstractScDataPilotSourceTypeDlg_Impl  :public AbstractScDataPilotSourceTy
     virtual bool IsExternal() const;
     virtual bool IsNamedRange() const;
     virtual rtl::OUString GetSelectedNamedRange() const;
-    virtual void SetNamedRanges(const ::std::vector<rtl::OUString>& rNames);
+    virtual void AppendNamedRange(const ::rtl::OUString& rName);
 };
 
 class AbstractScDataPilotServiceDlg_Impl : public AbstractScDataPilotServiceDlg  //add for ScDataPilotServiceDlg
diff --git a/sc/source/ui/dbgui/dapitype.cxx b/sc/source/ui/dbgui/dapitype.cxx
index 5f22686..34a0148 100644
--- a/sc/source/ui/dbgui/dapitype.cxx
+++ b/sc/source/ui/dbgui/dapitype.cxx
@@ -51,18 +51,26 @@ ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg( Window* pParent, BOOL bEnabl
     aFlFrame        ( this, ScResId( FL_FRAME ) ),
     aBtnSelection   ( this, ScResId( BTN_SELECTION ) ),
     aBtnNamedRange  ( this, ScResId( BTN_NAMED_RANGE ) ),
-    aLbNamedRange   ( this, ScResId( LB_NAMED_RANGE ) ),
     aBtnDatabase    ( this, ScResId( BTN_DATABASE ) ),
     aBtnExternal    ( this, ScResId( BTN_EXTERNAL ) ),
+    aLbNamedRange   ( this, ScResId( LB_NAMED_RANGE ) ),
     aBtnOk          ( this, ScResId( BTN_OK ) ),
     aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
     aBtnHelp        ( this, ScResId( BTN_HELP ) )
 {
+    aBtnSelection.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
+    aBtnNamedRange.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
+    aBtnDatabase.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
+    aBtnExternal.SetClickHdl( LINK(this, ScDataPilotSourceTypeDlg, RadioClickHdl) );
+
     if (!bEnableExternal)
         aBtnExternal.Disable();
 
     aBtnSelection.Check();
+
+    // Disabled unless at least one named range exists.
     aLbNamedRange.Disable();
+    aBtnNamedRange.Disable();
 
     FreeResource();
 }
@@ -83,16 +91,30 @@ bool ScDataPilotSourceTypeDlg::IsExternal() const
 
 bool ScDataPilotSourceTypeDlg::IsNamedRange() const
 {
-    return false;
+    return aBtnNamedRange.IsChecked();
 }
 
 OUString ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
 {
-    return OUString();
+    USHORT nPos = aLbNamedRange.GetSelectEntryPos();
+    return aLbNamedRange.GetEntry(nPos);
+}
+
+void ScDataPilotSourceTypeDlg::AppendNamedRange(const OUString& rName)
+{
+    aLbNamedRange.InsertEntry(rName);
+    if (aLbNamedRange.GetEntryCount() == 1)
+    {
+        // Select position 0 only for the first time.
+        aLbNamedRange.SelectEntryPos(0);
+        aBtnNamedRange.Enable();
+    }
 }
 
-void ScDataPilotSourceTypeDlg::SetNamedRanges(const ::std::vector<OUString>& rNames)
+IMPL_LINK( ScDataPilotSourceTypeDlg, RadioClickHdl, RadioButton*, pBtn )
 {
+    aLbNamedRange.Enable(pBtn == &aBtnNamedRange);
+    return 0;
 }
 
 //-------------------------------------------------------------------------
diff --git a/sc/source/ui/dbgui/dapitype.hrc b/sc/source/ui/dbgui/dapitype.hrc
index 0517505..9761636 100644
--- a/sc/source/ui/dbgui/dapitype.hrc
+++ b/sc/source/ui/dbgui/dapitype.hrc
@@ -29,27 +29,26 @@
 #define BTN_CANCEL		2
 #define BTN_HELP		3
 #define BTN_SELECTION	4
-#define BTN_DATABASE	5
-#define BTN_EXTERNAL	6
-#define FL_FRAME        7
+#define BTN_NAMED_RANGE 5
+#define BTN_DATABASE	6
+#define BTN_EXTERNAL	7
 
-#define FT_SERVICE		8
-#define LB_SERVICE		9
-#define FT_SOURCE		10
-#define ED_SOURCE		11
-#define FT_NAME			12
-#define ED_NAME			13
-#define FT_USER			14
-#define ED_USER			15
-#define FT_PASSWD		16
-#define ED_PASSWD		17
+#define FL_FRAME        8
+#define FT_SERVICE		9
+#define LB_SERVICE		10
+#define FT_SOURCE		11
+#define ED_SOURCE		12
+#define FT_NAME			13
+#define ED_NAME			14
+#define FT_USER			15
+#define ED_USER			16
+#define FT_PASSWD		17
+#define ED_PASSWD		18
+#define FT_DATABASE		19
+#define LB_DATABASE		20
+#define FT_OBJECT		21
+#define CB_OBJECT		22
+#define FT_OBJTYPE		23
+#define LB_OBJTYPE		24
 
-#define FT_DATABASE		18
-#define LB_DATABASE		19
-#define FT_OBJECT		20
-#define CB_OBJECT		21
-#define FT_OBJTYPE		22
-#define LB_OBJTYPE		23
-
-#define BTN_NAMED_RANGE 24
 #define LB_NAMED_RANGE  25
diff --git a/sc/source/ui/inc/dapitype.hxx b/sc/source/ui/inc/dapitype.hxx
index 2efe412..7ed2201 100644
--- a/sc/source/ui/inc/dapitype.hxx
+++ b/sc/source/ui/inc/dapitype.hxx
@@ -36,8 +36,6 @@
 #include <vcl/lstbox.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 
-#include <vector>
-
 //------------------------------------------------------------------------
 
 class ScDataPilotSourceTypeDlg : public ModalDialog
@@ -46,9 +44,9 @@ private:
     FixedLine       aFlFrame;
     RadioButton		aBtnSelection;
     RadioButton     aBtnNamedRange;
-    ListBox         aLbNamedRange;
     RadioButton		aBtnDatabase;
     RadioButton		aBtnExternal;
+    ListBox         aLbNamedRange;
     OKButton		aBtnOk;
     CancelButton	aBtnCancel;
     HelpButton		aBtnHelp;
@@ -61,7 +59,10 @@ public:
     bool IsExternal() const;
     bool IsNamedRange() const;
     rtl::OUString GetSelectedNamedRange() const;
-    void SetNamedRanges(const ::std::vector<rtl::OUString>& rNames);
+    void AppendNamedRange(const rtl::OUString& rNames);
+
+private:
+    DECL_LINK( RadioClickHdl, RadioButton * );
 };
 
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 15c9530..8b47d83 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -118,6 +118,7 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
 
 //------------------------------------------------------------------
 void ScCellShell::ExecuteEdit( SfxRequest& rReq )
@@ -2156,6 +2157,22 @@ void ScCellShell::ExecuteDataPilotDialog()
             pFact->CreateScDataPilotSourceTypeDlg(
                 pTabViewShell->GetDialogParent(), bEnableExt, RID_SCDLG_DAPITYPE));
 
+        // Populate named ranges (if any).
+        ScRangeName* pRangeName = pDoc->GetRangeName();
+        if (pRangeName)
+        {
+            USHORT n = pRangeName->GetCount();
+            for (USHORT i = 0; i < n; ++i)
+            {
+                ScRangeData* p = (*pRangeName)[i];
+                if (!p)
+                    // This shouldn't happen, but just in case....
+                    continue;
+
+                pTypeDlg->AppendNamedRange(p->GetName());
+            }
+        }
+
         DBG_ASSERT(pTypeDlg, "Dialog create fail!");
         if ( pTypeDlg->Execute() == RET_OK )
         {
@@ -2196,6 +2213,14 @@ void ScCellShell::ExecuteDataPilotDialog()
                     pNewDPObject->SetImportDesc( aImpDesc );
                 }
             }
+            else if (pTypeDlg->IsNamedRange())
+            {
+                OUString aName = pTypeDlg->GetSelectedNamedRange();
+                ScSheetSourceDesc aShtDesc(pDoc);
+                aShtDesc.SetRangeName(aName);
+                pNewDPObject.reset(new ScDPObject(pDoc));
+                pNewDPObject->SetSheetDesc(aShtDesc);
+            }
             else        // selection
             {
                 //! use database ranges (select before type dialog?)
commit a2f7b47b8a92fd216106a95b248809ceb8d69cdd
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 14:08:19 2011 -0500

    Initial change to display named range option in the source dialog.

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 12d6378..8bf02a2 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -94,8 +94,11 @@ public:
 class AbstractScDataPilotSourceTypeDlg  : public VclAbstractDialog  //add for ScDataPilotSourceTypeDlg
 {
 public:
-    virtual BOOL	IsDatabase() const = 0;
-    virtual BOOL	IsExternal() const = 0;
+    virtual bool IsDatabase() const = 0;
+    virtual bool IsExternal() const = 0;
+    virtual bool IsNamedRange() const = 0;
+    virtual rtl::OUString GetSelectedNamedRange() const = 0;
+    virtual void SetNamedRanges(const ::std::vector<rtl::OUString>& rNames) = 0;
 };
 
 class AbstractScDataPilotServiceDlg : public VclAbstractDialog  //add for ScDataPilotServiceDlg
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 42b6d85..407e694 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -250,16 +250,31 @@ void AbstractScDataPilotDatabaseDlg_Impl::GetValues( ScImportSourceDesc& rDesc )
 
 //AbstractScDataPilotSourceTypeDlg_Impl begin
 
-BOOL AbstractScDataPilotSourceTypeDlg_Impl::IsDatabase() const
+bool AbstractScDataPilotSourceTypeDlg_Impl::IsDatabase() const
 {
     return pDlg->IsDatabase();
 }
 
-BOOL AbstractScDataPilotSourceTypeDlg_Impl::IsExternal() const
+bool AbstractScDataPilotSourceTypeDlg_Impl::IsExternal() const
 {
     return pDlg->IsExternal();
 }
 
+bool AbstractScDataPilotSourceTypeDlg_Impl::IsNamedRange() const
+{
+    return pDlg->IsNamedRange();
+}
+
+rtl::OUString AbstractScDataPilotSourceTypeDlg_Impl::GetSelectedNamedRange() const
+{
+    return pDlg->GetSelectedNamedRange();
+}
+
+void AbstractScDataPilotSourceTypeDlg_Impl::SetNamedRanges(const std::vector<rtl::OUString>& rNames)
+{
+    pDlg->SetNamedRanges(rNames);
+}
+
 //AbstractScDataPilotSourceTypeDlg_Impl end
 
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index c079eb5..c0ecdad 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -145,8 +145,11 @@ class AbstractScDataPilotDatabaseDlg_Impl  :public AbstractScDataPilotDatabaseDl
 class AbstractScDataPilotSourceTypeDlg_Impl  :public AbstractScDataPilotSourceTypeDlg  //add for ScDataPilotSourceTypeDlg
 {
     DECL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl, ScDataPilotSourceTypeDlg)
-    virtual BOOL	IsDatabase() const;
-    virtual BOOL	IsExternal() const;
+    virtual bool IsDatabase() const;
+    virtual bool IsExternal() const;
+    virtual bool IsNamedRange() const;
+    virtual rtl::OUString GetSelectedNamedRange() const;
+    virtual void SetNamedRanges(const ::std::vector<rtl::OUString>& rNames);
 };
 
 class AbstractScDataPilotServiceDlg_Impl : public AbstractScDataPilotServiceDlg  //add for ScDataPilotServiceDlg
diff --git a/sc/source/ui/dbgui/dapitype.cxx b/sc/source/ui/dbgui/dapitype.cxx
index b4943d2..5f22686 100644
--- a/sc/source/ui/dbgui/dapitype.cxx
+++ b/sc/source/ui/dbgui/dapitype.cxx
@@ -41,6 +41,7 @@
 #include "dapitype.hrc"
 
 using namespace com::sun::star;
+using ::rtl::OUString;
 
 //-------------------------------------------------------------------------
 
@@ -49,6 +50,8 @@ ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg( Window* pParent, BOOL bEnabl
     //
     aFlFrame        ( this, ScResId( FL_FRAME ) ),
     aBtnSelection   ( this, ScResId( BTN_SELECTION ) ),
+    aBtnNamedRange  ( this, ScResId( BTN_NAMED_RANGE ) ),
+    aLbNamedRange   ( this, ScResId( LB_NAMED_RANGE ) ),
     aBtnDatabase    ( this, ScResId( BTN_DATABASE ) ),
     aBtnExternal    ( this, ScResId( BTN_EXTERNAL ) ),
     aBtnOk          ( this, ScResId( BTN_OK ) ),
@@ -59,6 +62,7 @@ ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg( Window* pParent, BOOL bEnabl
         aBtnExternal.Disable();
 
     aBtnSelection.Check();
+    aLbNamedRange.Disable();
 
     FreeResource();
 }
@@ -67,16 +71,30 @@ ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg()
 {
 }
 
-BOOL ScDataPilotSourceTypeDlg::IsDatabase() const
+bool ScDataPilotSourceTypeDlg::IsDatabase() const
 {
     return aBtnDatabase.IsChecked();
 }
 
-BOOL ScDataPilotSourceTypeDlg::IsExternal() const
+bool ScDataPilotSourceTypeDlg::IsExternal() const
 {
     return aBtnExternal.IsChecked();
 }
 
+bool ScDataPilotSourceTypeDlg::IsNamedRange() const
+{
+    return false;
+}
+
+OUString ScDataPilotSourceTypeDlg::GetSelectedNamedRange() const
+{
+    return OUString();
+}
+
+void ScDataPilotSourceTypeDlg::SetNamedRanges(const ::std::vector<OUString>& rNames)
+{
+}
+
 //-------------------------------------------------------------------------
 
 ScDataPilotServiceDlg::ScDataPilotServiceDlg( Window* pParent,
diff --git a/sc/source/ui/dbgui/dapitype.hrc b/sc/source/ui/dbgui/dapitype.hrc
index 425491b..0517505 100644
--- a/sc/source/ui/dbgui/dapitype.hrc
+++ b/sc/source/ui/dbgui/dapitype.hrc
@@ -50,3 +50,6 @@
 #define CB_OBJECT		21
 #define FT_OBJTYPE		22
 #define LB_OBJTYPE		23
+
+#define BTN_NAMED_RANGE 24
+#define LB_NAMED_RANGE  25
diff --git a/sc/source/ui/dbgui/dapitype.src b/sc/source/ui/dbgui/dapitype.src
index 3c03150..1aef003 100644
--- a/sc/source/ui/dbgui/dapitype.src
+++ b/sc/source/ui/dbgui/dapitype.src
@@ -34,7 +34,7 @@ ModalDialog RID_SCDLG_DAPITYPE
     OutputSize = TRUE ;
     HelpId = HID_DATAPILOT_TYPE ;
     SVLook = TRUE ;
-    Size = MAP_APPFONT ( 241 , 63 ) ;
+    Size = MAP_APPFONT ( 241 , 83 ) ;
     Moveable = TRUE ;
     Closeable = FALSE ;
     OKButton BTN_OK
@@ -63,16 +63,30 @@ ModalDialog RID_SCDLG_DAPITYPE
         TabStop = TRUE ;
         Text [ en-US ] = "~Current selection";
     };
-    RadioButton BTN_DATABASE
+    RadioButton BTN_NAMED_RANGE
     {
         Pos = MAP_APPFONT ( 12 , 28 ) ;
+        Size = MAP_APPFONT ( 70 , 10 ) ;
+        TabStop = TRUE ;
+        Text [ en-US ] = "~Named range";
+    };
+    ListBox LB_NAMED_RANGE
+    {
+        Pos = MAP_APPFONT ( 90 , 27 ) ;
+        Size = MAP_APPFONT ( 70 , 10 ) ;
+        TabStop = TRUE ;
+        DropDown = TRUE ;
+    };
+    RadioButton BTN_DATABASE
+    {
+        Pos = MAP_APPFONT ( 12 , 42 ) ;
         Size = MAP_APPFONT ( 164 , 10 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "~Data source registered in %PRODUCTNAME";
     };
     RadioButton BTN_EXTERNAL
     {
-        Pos = MAP_APPFONT ( 12 , 42 ) ;
+        Pos = MAP_APPFONT ( 12 , 56 ) ;
         Size = MAP_APPFONT ( 164 , 10 ) ;
         TabStop = TRUE ;
         Text [ en-US ] = "~External source/interface";
diff --git a/sc/source/ui/inc/dapitype.hxx b/sc/source/ui/inc/dapitype.hxx
index 5d483cb..2efe412 100644
--- a/sc/source/ui/inc/dapitype.hxx
+++ b/sc/source/ui/inc/dapitype.hxx
@@ -36,6 +36,8 @@
 #include <vcl/lstbox.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 
+#include <vector>
+
 //------------------------------------------------------------------------
 
 class ScDataPilotSourceTypeDlg : public ModalDialog
@@ -43,6 +45,8 @@ class ScDataPilotSourceTypeDlg : public ModalDialog
 private:
     FixedLine       aFlFrame;
     RadioButton		aBtnSelection;
+    RadioButton     aBtnNamedRange;
+    ListBox         aLbNamedRange;
     RadioButton		aBtnDatabase;
     RadioButton		aBtnExternal;
     OKButton		aBtnOk;
@@ -53,8 +57,11 @@ public:
             ScDataPilotSourceTypeDlg( Window* pParent, BOOL bEnableExternal );
             ~ScDataPilotSourceTypeDlg();
 
-    BOOL	IsDatabase() const;
-    BOOL	IsExternal() const;
+    bool IsDatabase() const;
+    bool IsExternal() const;
+    bool IsNamedRange() const;
+    rtl::OUString GetSelectedNamedRange() const;
+    void SetNamedRanges(const ::std::vector<rtl::OUString>& rNames);
 };
 
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f4caf55..15c9530 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2147,7 +2147,7 @@ void ScCellShell::ExecuteDataPilotDialog()
 
         //  first select type of source data
 
-        BOOL bEnableExt = ScDPObject::HasRegisteredSources();
+        bool bEnableExt = ScDPObject::HasRegisteredSources();
 
         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
@@ -2216,7 +2216,7 @@ void ScCellShell::ExecuteDataPilotDialog()
                         pTabViewShell->MarkRange(aRange);
                     }
 
-                    BOOL bOK = TRUE;
+                    bool bOK = true;
                     if ( pDoc->HasSubTotalCells( aRange ) )
                     {
                         //  confirm selection if it contains SubTotal cells
@@ -2225,7 +2225,7 @@ void ScCellShell::ExecuteDataPilotDialog()
                                         WinBits(WB_YES_NO | WB_DEF_YES),
                                         ScGlobal::GetRscString(STR_DATAPILOT_SUBTOTAL) );
                         if (aBox.Execute() == RET_NO)
-                            bOK = FALSE;
+                            bOK = false;
                     }
                     if (bOK)
                     {
commit f6abb7c54078be9000516ab7ff5081b1feba3f6c
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 12:22:39 2011 -0500

    Used boost::scoped_ptr to manage instances.

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f24e044..f4caf55 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -113,6 +113,8 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <cppuhelper/bootstrap.hxx>
 
+#include <boost/scoped_ptr.hpp>
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::uno;
@@ -2121,7 +2123,7 @@ void ScCellShell::ExecuteDataPilotDialog()
     ScViewData* pData = GetViewData();
     ScDocument* pDoc = pData->GetDocument();
 
-    ScDPObject* pNewDPObject = NULL;
+    ::boost::scoped_ptr<ScDPObject> pNewDPObject(NULL);
 
     // ScPivot is no longer used...
     ScDPObject* pDPObj = pDoc->GetDPAtCursor(
@@ -2129,7 +2131,7 @@ void ScCellShell::ExecuteDataPilotDialog()
                                 pData->GetTabNo() );
     if ( pDPObj )   // on an existing table?
     {
-        pNewDPObject = new ScDPObject( *pDPObj );
+        pNewDPObject.reset(new ScDPObject(*pDPObj));
     }
     else            // create new table
     {
@@ -2150,14 +2152,20 @@ void ScCellShell::ExecuteDataPilotDialog()
         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
 
-        AbstractScDataPilotSourceTypeDlg* pTypeDlg = pFact->CreateScDataPilotSourceTypeDlg( pTabViewShell->GetDialogParent(), bEnableExt, RID_SCDLG_DAPITYPE );
+        ::boost::scoped_ptr<AbstractScDataPilotSourceTypeDlg> pTypeDlg(
+            pFact->CreateScDataPilotSourceTypeDlg(
+                pTabViewShell->GetDialogParent(), bEnableExt, RID_SCDLG_DAPITYPE));
+
         DBG_ASSERT(pTypeDlg, "Dialog create fail!");
         if ( pTypeDlg->Execute() == RET_OK )
         {
             if ( pTypeDlg->IsExternal() )
             {
                 uno::Sequence<rtl::OUString> aSources = ScDPObject::GetRegisteredSources();
-                AbstractScDataPilotServiceDlg* pServDlg = pFact->CreateScDataPilotServiceDlg( pTabViewShell->GetDialogParent(), aSources, RID_SCDLG_DAPISERVICE );
+                ::boost::scoped_ptr<AbstractScDataPilotServiceDlg> pServDlg(
+                    pFact->CreateScDataPilotServiceDlg(
+                        pTabViewShell->GetDialogParent(), aSources, RID_SCDLG_DAPISERVICE));
+
                 DBG_ASSERT(pServDlg, "Dialog create fail!");
                 if ( pServDlg->Execute() == RET_OK )
                 {
@@ -2167,25 +2175,26 @@ void ScCellShell::ExecuteDataPilotDialog()
                             pServDlg->GetParName(),
                             pServDlg->GetParUser(),
                             pServDlg->GetParPass() );
-                    pNewDPObject = new ScDPObject( pDoc );
+                    pNewDPObject.reset(new ScDPObject(pDoc));
                     pNewDPObject->SetServiceData( aServDesc );
                 }
-                delete pServDlg;
             }
             else if ( pTypeDlg->IsDatabase() )
             {
                 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
 
-                AbstractScDataPilotDatabaseDlg* pDataDlg = pFact->CreateScDataPilotDatabaseDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DAPIDATA);
+                ::boost::scoped_ptr<AbstractScDataPilotDatabaseDlg> pDataDlg(
+                    pFact->CreateScDataPilotDatabaseDlg(
+                        pTabViewShell->GetDialogParent(), RID_SCDLG_DAPIDATA));
+
                 DBG_ASSERT(pDataDlg, "Dialog create fail!");
                 if ( pDataDlg->Execute() == RET_OK )
                 {
                     ScImportSourceDesc aImpDesc(pDoc);
                     pDataDlg->GetValues( aImpDesc );
-                    pNewDPObject = new ScDPObject( pDoc );
+                    pNewDPObject.reset(new ScDPObject(pDoc));
                     pNewDPObject->SetImportDesc( aImpDesc );
                 }
-                delete pDataDlg;
             }
             else        // selection
             {
@@ -2222,7 +2231,7 @@ void ScCellShell::ExecuteDataPilotDialog()
                     {
                         ScSheetSourceDesc aShtDesc(pDoc);
                         aShtDesc.SetSourceRange(aRange);
-                        pNewDPObject = new ScDPObject( pDoc );
+                        pNewDPObject.reset(new ScDPObject(pDoc));
                         pNewDPObject->SetSheetDesc( aShtDesc );
 
                         //  output below source data
@@ -2234,13 +2243,12 @@ void ScCellShell::ExecuteDataPilotDialog()
                 }
             }
         }
-        delete pTypeDlg;
 
         if ( pNewDPObject )
             pNewDPObject->SetOutRange( aDestPos );
     }
 
-    pTabViewShell->SetDialogDPObject( pNewDPObject );   // is copied
+    pTabViewShell->SetDialogDPObject( pNewDPObject.get() );   // is copied
     if ( pNewDPObject )
     {
         //  start layout dialog
@@ -2250,7 +2258,6 @@ void ScCellShell::ExecuteDataPilotDialog()
         SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
         pScMod->SetRefDialog( nId, pWnd ? FALSE : TRUE );
     }
-    delete pNewDPObject;
 }
 
 IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG )
commit b3838a63805c7793d8b0b0b0a2409d93aad70c52
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 12:16:12 2011 -0500

    Extracted datapilot handling code into its own method.

diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index 7405692..3614389 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -66,6 +66,8 @@ private:
                     const String& _rFile, const String& _rFilter, const String& _rOptions,
                     const String& _rSource, ULONG _nRefresh, SfxRequest& _rRequest );
 
+    void ExecuteDataPilotDialog();
+
     DECL_LINK( ClipboardChanged, TransferableDataHelper* );
     DECL_LINK( DialogClosed, AbstractScLinkedAreaDlg* );
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 15319ff..f24e044 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -94,6 +94,10 @@
 #include "spellparam.hxx"
 #include "postit.hxx"
 #include "clipparam.hxx"
+#include "pivot.hxx"
+#include "dpobject.hxx"
+#include "dpsdbtab.hxx"		// ScImportSourceDesc
+#include "dpshttab.hxx"		// ScSheetSourceDesc
 
 #include "globstr.hrc"
 #include "scui_def.hxx"
@@ -2110,6 +2114,145 @@ void ScCellShell::ExecuteExternalSource(
         _rRequest.Ignore();
 }
 
+void ScCellShell::ExecuteDataPilotDialog()
+{
+    ScModule* pScMod = SC_MOD();
+    ScTabViewShell* pTabViewShell   = GetViewData()->GetViewShell();
+    ScViewData* pData = GetViewData();
+    ScDocument* pDoc = pData->GetDocument();
+
+    ScDPObject* pNewDPObject = NULL;
+
+    // ScPivot is no longer used...
+    ScDPObject* pDPObj = pDoc->GetDPAtCursor(
+                                pData->GetCurX(), pData->GetCurY(),
+                                pData->GetTabNo() );
+    if ( pDPObj )   // on an existing table?
+    {
+        pNewDPObject = new ScDPObject( *pDPObj );
+    }
+    else            // create new table
+    {
+        //  select database range or data
+        pTabViewShell->GetDBData( TRUE, SC_DB_OLD );
+        ScMarkData& rMark = GetViewData()->GetMarkData();
+        if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
+            pTabViewShell->MarkDataArea( FALSE );
+
+        //  output to cursor position for non-sheet data
+        ScAddress aDestPos( pData->GetCurX(), pData->GetCurY(),
+                                pData->GetTabNo() );
+
+        //  first select type of source data
+
+        BOOL bEnableExt = ScDPObject::HasRegisteredSources();
+
+        ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+        DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
+
+        AbstractScDataPilotSourceTypeDlg* pTypeDlg = pFact->CreateScDataPilotSourceTypeDlg( pTabViewShell->GetDialogParent(), bEnableExt, RID_SCDLG_DAPITYPE );
+        DBG_ASSERT(pTypeDlg, "Dialog create fail!");
+        if ( pTypeDlg->Execute() == RET_OK )
+        {
+            if ( pTypeDlg->IsExternal() )
+            {
+                uno::Sequence<rtl::OUString> aSources = ScDPObject::GetRegisteredSources();
+                AbstractScDataPilotServiceDlg* pServDlg = pFact->CreateScDataPilotServiceDlg( pTabViewShell->GetDialogParent(), aSources, RID_SCDLG_DAPISERVICE );
+                DBG_ASSERT(pServDlg, "Dialog create fail!");
+                if ( pServDlg->Execute() == RET_OK )
+                {
+                    ScDPServiceDesc aServDesc(
+                            pServDlg->GetServiceName(),
+                            pServDlg->GetParSource(),
+                            pServDlg->GetParName(),
+                            pServDlg->GetParUser(),
+                            pServDlg->GetParPass() );
+                    pNewDPObject = new ScDPObject( pDoc );
+                    pNewDPObject->SetServiceData( aServDesc );
+                }
+                delete pServDlg;
+            }
+            else if ( pTypeDlg->IsDatabase() )
+            {
+                DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
+
+                AbstractScDataPilotDatabaseDlg* pDataDlg = pFact->CreateScDataPilotDatabaseDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DAPIDATA);
+                DBG_ASSERT(pDataDlg, "Dialog create fail!");
+                if ( pDataDlg->Execute() == RET_OK )
+                {
+                    ScImportSourceDesc aImpDesc(pDoc);
+                    pDataDlg->GetValues( aImpDesc );
+                    pNewDPObject = new ScDPObject( pDoc );
+                    pNewDPObject->SetImportDesc( aImpDesc );
+                }
+                delete pDataDlg;
+            }
+            else        // selection
+            {
+                //! use database ranges (select before type dialog?)
+                ScRange aRange;
+                ScMarkType eType = GetViewData()->GetSimpleArea(aRange);
+                if ( (eType & SC_MARK_SIMPLE) == SC_MARK_SIMPLE )
+                {
+                    // Shrink the range to the data area.
+                    SCCOL nStartCol = aRange.aStart.Col(), nEndCol = aRange.aEnd.Col();
+                    SCROW nStartRow = aRange.aStart.Row(), nEndRow = aRange.aEnd.Row();
+                    if (pDoc->ShrinkToDataArea(aRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow))
+                    {
+                        aRange.aStart.SetCol(nStartCol);
+                        aRange.aStart.SetRow(nStartRow);
+                        aRange.aEnd.SetCol(nEndCol);
+                        aRange.aEnd.SetRow(nEndRow);
+                        rMark.SetMarkArea(aRange);
+                        pTabViewShell->MarkRange(aRange);
+                    }
+
+                    BOOL bOK = TRUE;
+                    if ( pDoc->HasSubTotalCells( aRange ) )
+                    {
+                        //  confirm selection if it contains SubTotal cells
+
+                        QueryBox aBox( pTabViewShell->GetDialogParent(),
+                                        WinBits(WB_YES_NO | WB_DEF_YES),
+                                        ScGlobal::GetRscString(STR_DATAPILOT_SUBTOTAL) );
+                        if (aBox.Execute() == RET_NO)
+                            bOK = FALSE;
+                    }
+                    if (bOK)
+                    {
+                        ScSheetSourceDesc aShtDesc(pDoc);
+                        aShtDesc.SetSourceRange(aRange);
+                        pNewDPObject = new ScDPObject( pDoc );
+                        pNewDPObject->SetSheetDesc( aShtDesc );
+
+                        //  output below source data
+                        if ( aRange.aEnd.Row()+2 <= MAXROW - 4 )
+                            aDestPos = ScAddress( aRange.aStart.Col(),
+                                                    aRange.aEnd.Row()+2,
+                                                    aRange.aStart.Tab() );
+                    }
+                }
+            }
+        }
+        delete pTypeDlg;
+
+        if ( pNewDPObject )
+            pNewDPObject->SetOutRange( aDestPos );
+    }
+
+    pTabViewShell->SetDialogDPObject( pNewDPObject );   // is copied
+    if ( pNewDPObject )
+    {
+        //  start layout dialog
+
+        USHORT nId  = ScPivotLayoutWrapper::GetChildWindowId();
+        SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
+        SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+        pScMod->SetRefDialog( nId, pWnd ? FALSE : TRUE );
+    }
+    delete pNewDPObject;
+}
+
 IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG )
 {
     DBG_ASSERT( pImpl->m_pLinkedDlg, "ScCellShell::DialogClosed(): invalid request" );
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index e637b39..6773f02 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -68,10 +68,6 @@
 #include "pvlaydlg.hxx"
 #include "validat.hxx"
 #include "scresid.hxx"
-#include "pivot.hxx"
-#include "dpobject.hxx"
-#include "dpsdbtab.hxx"		// ScImportSourceDesc
-#include "dpshttab.hxx"		// ScSheetSourceDesc
 
 #include "validate.hrc" // ScValidationDlg
 #include "scui_def.hxx"
@@ -746,143 +742,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
             break;
 
         case SID_OPENDLG_PIVOTTABLE:
-            {
-                ScViewData* pData = GetViewData();
-                ScDocument* pDoc = pData->GetDocument();
-
-                ScDPObject* pNewDPObject = NULL;
-
-                // ScPivot is no longer used...
-                ScDPObject* pDPObj = pDoc->GetDPAtCursor(
-                                            pData->GetCurX(), pData->GetCurY(),
-                                            pData->GetTabNo() );
-                if ( pDPObj )	// on an existing table?
-                {
-                    pNewDPObject = new ScDPObject( *pDPObj );
-                }
-                else	 		// create new table
-                {
-                    //	select database range or data
-                    pTabViewShell->GetDBData( TRUE, SC_DB_OLD );
-                    ScMarkData& rMark = GetViewData()->GetMarkData();
-                    if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
-                        pTabViewShell->MarkDataArea( FALSE );
-
-                    //	output to cursor position for non-sheet data
-                    ScAddress aDestPos( pData->GetCurX(), pData->GetCurY(),
-                                            pData->GetTabNo() );
-
-                    //	first select type of source data
-
-                    BOOL bEnableExt = ScDPObject::HasRegisteredSources();
-
-                    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
-                    DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
-
-                    AbstractScDataPilotSourceTypeDlg* pTypeDlg = pFact->CreateScDataPilotSourceTypeDlg( pTabViewShell->GetDialogParent(), bEnableExt, RID_SCDLG_DAPITYPE );
-                    DBG_ASSERT(pTypeDlg, "Dialog create fail!");
-                    if ( pTypeDlg->Execute() == RET_OK )
-                    {
-                        if ( pTypeDlg->IsExternal() )
-                        {
-                            uno::Sequence<rtl::OUString> aSources = ScDPObject::GetRegisteredSources();
-                            AbstractScDataPilotServiceDlg* pServDlg = pFact->CreateScDataPilotServiceDlg( pTabViewShell->GetDialogParent(), aSources, RID_SCDLG_DAPISERVICE );
-                            DBG_ASSERT(pServDlg, "Dialog create fail!");
-                            if ( pServDlg->Execute() == RET_OK )
-                            {
-                                ScDPServiceDesc aServDesc(
-                                        pServDlg->GetServiceName(),
-                                        pServDlg->GetParSource(),
-                                        pServDlg->GetParName(),
-                                        pServDlg->GetParUser(),
-                                        pServDlg->GetParPass() );
-                                pNewDPObject = new ScDPObject( pDoc );
-                                pNewDPObject->SetServiceData( aServDesc );
-                            }
-                            delete pServDlg;
-                        }
-                        else if ( pTypeDlg->IsDatabase() )
-                        {
-                            DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
-
-                            AbstractScDataPilotDatabaseDlg* pDataDlg = pFact->CreateScDataPilotDatabaseDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DAPIDATA);
-                            DBG_ASSERT(pDataDlg, "Dialog create fail!");
-                            if ( pDataDlg->Execute() == RET_OK )
-                            {
-                                ScImportSourceDesc aImpDesc(pDoc);
-                                pDataDlg->GetValues( aImpDesc );
-                                pNewDPObject = new ScDPObject( pDoc );
-                                pNewDPObject->SetImportDesc( aImpDesc );
-                            }
-                            delete pDataDlg;
-                        }
-                        else		// selection
-                        {
-                            //!	use database ranges (select before type dialog?)
-                            ScRange aRange;
-                            ScMarkType eType = GetViewData()->GetSimpleArea(aRange);
-                            if ( (eType & SC_MARK_SIMPLE) == SC_MARK_SIMPLE )
-                            {
-                                // Shrink the range to the data area.
-                                SCCOL nStartCol = aRange.aStart.Col(), nEndCol = aRange.aEnd.Col();
-                                SCROW nStartRow = aRange.aStart.Row(), nEndRow = aRange.aEnd.Row();
-                                if (pDoc->ShrinkToDataArea(aRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow))
-                                {
-                                    aRange.aStart.SetCol(nStartCol);
-                                    aRange.aStart.SetRow(nStartRow);
-                                    aRange.aEnd.SetCol(nEndCol);
-                                    aRange.aEnd.SetRow(nEndRow);
-                                    rMark.SetMarkArea(aRange);
-                                    pTabViewShell->MarkRange(aRange);
-                                }
-
-                                BOOL bOK = TRUE;
-                                if ( pDoc->HasSubTotalCells( aRange ) )
-                                {
-                                    //	confirm selection if it contains SubTotal cells
-
-                                    QueryBox aBox( pTabViewShell->GetDialogParent(),
-                                                    WinBits(WB_YES_NO | WB_DEF_YES),
-                                                    ScGlobal::GetRscString(STR_DATAPILOT_SUBTOTAL) );
-                                    if (aBox.Execute() == RET_NO)
-                                        bOK = FALSE;
-                                }
-                                if (bOK)
-                                {
-                                    ScSheetSourceDesc aShtDesc(pDoc);
-                                    aShtDesc.SetSourceRange(aRange);
-                                    pNewDPObject = new ScDPObject( pDoc );
-                                    pNewDPObject->SetSheetDesc( aShtDesc );
-
-                                    //	output below source data
-                                    if ( aRange.aEnd.Row()+2 <= MAXROW - 4 )
-                                        aDestPos = ScAddress( aRange.aStart.Col(),
-                                                                aRange.aEnd.Row()+2,
-                                                                aRange.aStart.Tab() );
-                                }
-                            }
-                        }
-                    }
-                    delete pTypeDlg;
-
-                    if ( pNewDPObject )
-                        pNewDPObject->SetOutRange( aDestPos );
-                }
-
-                pTabViewShell->SetDialogDPObject( pNewDPObject );	// is copied
-                if ( pNewDPObject )
-                {
-                    //	start layout dialog
-
-                    USHORT nId  = ScPivotLayoutWrapper::GetChildWindowId();
-                    SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                    SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
-                    pScMod->SetRefDialog( nId, pWnd ? FALSE : TRUE );
-                }
-                delete pNewDPObject;
-            }
+            ExecuteDataPilotDialog();
             break;
-
         case SID_DEFINE_DBNAME:
             {
 
commit d9069755c86a7d428bac30531276e2618671e4d7
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 12:00:30 2011 -0500

    Cleanups and comments.

diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx
index 3b02841..8d4fb1d 100644
--- a/sc/inc/dpsdbtab.hxx
+++ b/sc/inc/dpsdbtab.hxx
@@ -39,22 +39,17 @@
 class ScDPCacheTable;
 class ScDocument;
 
-// --------------------------------------------------------------------
-//
-//	implementation of ScDPTableData with database data
-//
-
 struct ScImportSourceDesc
 {
     String	aDBName;
     String	aObject;
     USHORT	nType;			// enum DataImportMode
-    BOOL	bNative;
+    bool    bNative;
     ScDocument* mpDoc;
 
-    ScImportSourceDesc(ScDocument* pDoc) : nType(0), bNative(FALSE), mpDoc(pDoc) {}
+    ScImportSourceDesc(ScDocument* pDoc) : nType(0), bNative(false), mpDoc(pDoc) {}
 
-    BOOL operator==	( const ScImportSourceDesc& rOther ) const
+    bool operator== ( const ScImportSourceDesc& rOther ) const
         { return aDBName == rOther.aDBName &&
                  aObject == rOther.aObject &&
                  nType   == rOther.nType &&
@@ -64,6 +59,9 @@ struct ScImportSourceDesc
     ScDPCache* CreateCache() const;
 };
 
+/**
+ * This class represents source data from database source.
+ */
 class ScDatabaseDPData : public ScDPTableData
 {
 private:
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index 662e8ca..5772b78 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -98,10 +98,9 @@ private:
     ScDocument*     mpDoc;
 };
 
-// --------------------------------------------------------------------
-//
-//	implementation of ScDPTableData with sheet data
-//
+/**
+ * Implementation of ScDPTableData with sheet data.
+ */
 class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData
 {
 private:
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index b1dce11..9757e8c 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -90,6 +90,10 @@ class ScDPInitState;
 class ScDPResultMember;
 class ScDocument;
 
+/**
+ * Base class that abstracts different data source types of a datapilot
+ * table.
+ */
 class SC_DLLPUBLIC ScDPTableData
 {
     //	cached data for GetDatePart


More information about the Libreoffice-commits mailing list