[Libreoffice-commits] core.git: sc/source

Manuj Vashist manujvashist at gmail.com
Fri Jul 6 00:14:50 UTC 2018


 sc/source/ui/miscdlgs/dataproviderdlg.cxx |   59 +++++++++++++++++++++++++++---
 1 file changed, 55 insertions(+), 4 deletions(-)

New commits:
commit eac72845f5c9aac0fb346b2d48cee697006c057b
Author: Manuj Vashist <manujvashist at gmail.com>
Date:   Mon Jul 2 04:21:03 2018 +0530

    Added Delete Column Transformation in Data Provider Dialog
    
    Change-Id: Ibebd92c426d1653642c5b9d037d6368636561fcd
    Reviewed-on: https://gerrit.libreoffice.org/56786
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
index 8e07d04b8145..a94a5d4d41e1 100644
--- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx
+++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
@@ -271,6 +271,59 @@ void ScDataTransformationBaseControl::setAllocation(const Size &rAllocation)
     setLayoutPosSize(*maGrid, Point(0, 0), rAllocation);
 }
 
+class ScDeleteColumnTransformationControl : public ScDataTransformationBaseControl
+{
+private:
+    VclPtr<Edit> maColumnNums;
+
+public:
+    ScDeleteColumnTransformationControl(vcl::Window* pParent);
+    ~ScDeleteColumnTransformationControl() override;
+
+    virtual void dispose() override;
+
+    virtual std::shared_ptr<sc::DataTransformation> getTransformation() override;
+};
+
+ScDeleteColumnTransformationControl::ScDeleteColumnTransformationControl(vcl::Window* pParent):
+    ScDataTransformationBaseControl(pParent, "modules/scalc/ui/deletecolumnentry.ui")
+{
+    get(maColumnNums, "ed_columns");
+}
+
+ScDeleteColumnTransformationControl::~ScDeleteColumnTransformationControl()
+{
+    disposeOnce();
+}
+
+void ScDeleteColumnTransformationControl::dispose()
+{
+    maColumnNums.clear();
+
+    ScDataTransformationBaseControl::dispose();
+}
+
+std::shared_ptr<sc::DataTransformation> ScDeleteColumnTransformationControl::getTransformation()
+{
+    OUString aColumnString = maColumnNums->GetText();
+    std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';');
+    std::set<SCCOL> ColNums;
+    for (auto& rColStr : aSplitColumns)
+    {
+        sal_Int32 nCol = rColStr.toInt32();
+        if (nCol <= 0)
+            continue;
+
+        if (nCol > MAXCOL)
+            continue;
+
+        // translate from 1-based column notations to internal Calc one
+        ColNums.insert(nCol - 1);
+    }
+
+    return std::make_shared<sc::ColumnRemoveTransformation>(ColNums);
+}
+
 class ScSplitColumnTransformationControl : public ScDataTransformationBaseControl
 {
 private:
@@ -497,10 +550,8 @@ void ScDataProviderDlg::cancelAndQuit()
 
 void ScDataProviderDlg::deleteColumn()
 {
-    VclPtr<FixedText> mpText = VclPtr<FixedText>::Create(mpList);
-    mpText->SetText("Delete Column");
-    mpText->SetSizePixel(Size(400, 20));
-    mpList->addEntry(mpText);
+    VclPtr<ScDeleteColumnTransformationControl> pDeleteColumnEntry = VclPtr<ScDeleteColumnTransformationControl>::Create(mpList);
+    mpList->addEntry(pDeleteColumnEntry);
 }
 
 void ScDataProviderDlg::splitColumn()


More information about the Libreoffice-commits mailing list