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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jul 20 20:45:51 UTC 2018


 sc/Library_sc.mk                            |    1 
 sc/source/filter/xml/xmlmappingi.cxx        |   33 +
 sc/source/filter/xml/xmlmappingi.hxx        |    4 
 sc/source/filter/xml/xmltransformationi.cxx |  510 ++++++++++++++++++++++++++++
 sc/source/filter/xml/xmltransformationi.hxx |  140 +++++++
 5 files changed, 686 insertions(+), 2 deletions(-)

New commits:
commit 842af5109646f0b2555c4cb48d79bb999ee6efff
Author:     Vikas Mahato <vikasmahato0 at gmail.com>
AuthorDate: Tue Jul 10 18:18:59 2018 +0530
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Fri Jul 20 22:45:23 2018 +0200

    Import ODF with data transformations
    
    Change-Id: Iee76ed28d0dcd4ee57115ec951a181b2cf8d35fd
    Reviewed-on: https://gerrit.libreoffice.org/57239
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 5425d681caab..dc2a2149f0a1 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -346,6 +346,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/filter/xml/xmlstyli \
     sc/source/filter/xml/xmlsubti \
     sc/source/filter/xml/xmltabi \
+    sc/source/filter/xml/xmltransformationi \
     sc/source/filter/xml/xmlwrap \
     sc/source/filter/chart/chart_imp \
     sc/source/filter/importfilterdata \
diff --git a/sc/source/filter/xml/xmlmappingi.cxx b/sc/source/filter/xml/xmlmappingi.cxx
index 907f4ea472e6..8f8babad1e26 100644
--- a/sc/source/filter/xml/xmlmappingi.cxx
+++ b/sc/source/filter/xml/xmlmappingi.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "xmlmappingi.hxx"
+#include "xmltransformationi.hxx"
 
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/nmspmap.hxx>
@@ -51,6 +52,11 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLMappingsContext::c
             pContext = new ScXMLMappingContext( GetScImport(), pAttribList );
         }
         break;
+        case XML_ELEMENT( CALC_EXT, XML_DATA_TRANSFORMATIONS):
+        {
+             pContext = new ScXMLTransformationsContext( GetScImport() );
+        }
+        break;
     }
 
     if( !pContext )
@@ -110,13 +116,36 @@ ScXMLMappingContext::ScXMLMappingContext( ScXMLImport& rImport,
         aSource.setID(aID);
         aSource.setDBData(aDBName);
         rDataMapper.insertDataSource(aSource);
-        auto& rDataSources = rDataMapper.getDataSources();
-        rDataSources[0].refresh(pDoc, true);
     }
 }
 
 ScXMLMappingContext::~ScXMLMappingContext()
 {
+    ScDocument* pDoc = GetScImport().GetDocument();
+    auto& rDataMapper = pDoc->GetExternalDataMapper();
+    auto& rDataSources = rDataMapper.getDataSources();
+    if(!rDataSources.empty())
+        rDataSources[0].refresh(pDoc, true);
 }
 
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLMappingContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& /*xAttrList*/)
+{
+    SvXMLImportContext *pContext = nullptr;
+
+    switch( nElement )
+    {
+        case XML_ELEMENT( CALC_EXT, XML_DATA_TRANSFORMATIONS):
+        {
+             pContext = new ScXMLTransformationsContext( GetScImport() );
+        }
+        break;
+    }
+
+    if( !pContext )
+        pContext = new SvXMLImportContext( GetImport() );
+
+    return pContext;
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlmappingi.hxx b/sc/source/filter/xml/xmlmappingi.hxx
index 41129c8a1c0d..4080f7dfe230 100644
--- a/sc/source/filter/xml/xmlmappingi.hxx
+++ b/sc/source/filter/xml/xmlmappingi.hxx
@@ -38,6 +38,10 @@ public:
                         const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList );
 
     virtual ~ScXMLMappingContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
 };
 
 
diff --git a/sc/source/filter/xml/xmltransformationi.cxx b/sc/source/filter/xml/xmltransformationi.cxx
new file mode 100644
index 000000000000..287485f69e91
--- /dev/null
+++ b/sc/source/filter/xml/xmltransformationi.cxx
@@ -0,0 +1,510 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "xmltransformationi.hxx"
+
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlerror.hxx>
+
+#include <datamapper.hxx>
+#include <document.hxx>
+#include <dbdata.hxx>
+#include <sax/tools/converter.hxx>
+
+using namespace com::sun::star;
+using namespace xmloff::token;
+
+ScXMLTransformationsContext::ScXMLTransformationsContext(ScXMLImport& rImport)
+    : ScXMLImportContext(rImport)
+{
+}
+
+ScXMLTransformationsContext::~ScXMLTransformationsContext() {}
+
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLTransformationsContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    SvXMLImportContext* pContext = nullptr;
+    sax_fastparser::FastAttributeList* pAttribList
+        = sax_fastparser::FastAttributeList::castToFastAttributeList(xAttrList);
+
+    switch (nElement)
+    {
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_REMOVE_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnRemoveContext(GetScImport(), pAttribList);
+        }
+        break;
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_SPLIT_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnSplitContext(GetScImport(), pAttribList);
+        }
+        break;
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_MERGE_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnMergeContext(GetScImport(), pAttribList);
+        }
+        break;
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_SORT_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnSortContext(GetScImport(), pAttribList);
+        }
+        break;
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_TEXT_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnTextContext(GetScImport(), pAttribList);
+        }
+        break;
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_AGGREGATE_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnAggregateContext(GetScImport(), pAttribList);
+        }
+        break;
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN_NUMBER_TRANSFORMATION):
+        {
+            pContext = new ScXMLColumnNumberContext(GetScImport(), pAttribList);
+        }
+        break;
+    }
+
+    if (!pContext)
+        pContext = new SvXMLImportContext(GetImport());
+
+    return pContext;
+}
+
+ScXMLColumnRemoveContext::ScXMLColumnRemoveContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& /*rAttrList*/)
+    : ScXMLImportContext(rImport)
+{
+}
+
+ScXMLColumnRemoveContext::~ScXMLColumnRemoveContext()
+{
+    ScDocument* pDoc = GetScImport().GetDocument();
+    auto& rDataSources = pDoc->GetExternalDataMapper().getDataSources();
+    if (!rDataSources.empty())
+    {
+        rDataSources[rDataSources.size() - 1].AddDataTransformation(
+            std::make_shared<sc::ColumnRemoveTransformation>(maColumns));
+    }
+}
+
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLColumnRemoveContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    sax_fastparser::FastAttributeList* pAttribList
+        = sax_fastparser::FastAttributeList::castToFastAttributeList(xAttrList);
+
+    const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList = pAttribList;
+
+    switch (nElement)
+    {
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+        {
+            if (rAttrList.is())
+            {
+                for (auto& aIter : *rAttrList)
+                {
+                    switch (aIter.getToken())
+                    {
+                        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+                        {
+                            maColumns.insert(aIter.toInt32());
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        break;
+    }
+
+    return new SvXMLImportContext(GetImport());
+}
+
+ScXMLColumnSplitContext::ScXMLColumnSplitContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList)
+    : ScXMLImportContext(rImport)
+{
+    SCCOL mnCol = 0;
+    OUString cSeparator;
+
+    if (rAttrList.is())
+    {
+        for (auto& aIter : *rAttrList)
+        {
+            switch (aIter.getToken())
+            {
+                case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+                {
+                    mnCol = aIter.toInt32();
+                }
+                break;
+                case XML_ELEMENT(CALC_EXT, XML_SEPARATOR):
+                {
+                    cSeparator = aIter.toString();
+                }
+                break;
+            }
+        }
+    }
+
+    if (mnCol > 0)
+    {
+        ScDocument* pDoc = GetScImport().GetDocument();
+        auto& rDataSources = pDoc->GetExternalDataMapper().getDataSources();
+        if (!rDataSources.empty())
+        {
+            rDataSources[rDataSources.size() - 1].AddDataTransformation(
+                std::make_shared<sc::SplitColumnTransformation>(mnCol, cSeparator.toChar()));
+        }
+    }
+}
+
+ScXMLColumnSplitContext::~ScXMLColumnSplitContext() {}
+
+ScXMLColumnMergeContext::ScXMLColumnMergeContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList)
+    : ScXMLImportContext(rImport)
+{
+    if (rAttrList.is())
+    {
+        for (auto& aIter : *rAttrList)
+        {
+            switch (aIter.getToken())
+            {
+                case XML_ELEMENT(CALC_EXT, XML_MERGE_STRING):
+                {
+                    maMergeString = aIter.toString();
+                }
+                break;
+            }
+        }
+    }
+}
+
+ScXMLColumnMergeContext::~ScXMLColumnMergeContext()
+{
+    ScDocument* pDoc = GetScImport().GetDocument();
+    auto& rDataSources = pDoc->GetExternalDataMapper().getDataSources();
+    if (!rDataSources.empty())
+    {
+        rDataSources[rDataSources.size() - 1].AddDataTransformation(
+            std::make_shared<sc::MergeColumnTransformation>(maColumns, maMergeString));
+    }
+}
+
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLColumnMergeContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    sax_fastparser::FastAttributeList* pAttribList
+        = sax_fastparser::FastAttributeList::castToFastAttributeList(xAttrList);
+    const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList = pAttribList;
+    switch (nElement)
+    {
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+        {
+            if (rAttrList.is())
+            {
+                for (auto& aIter : *rAttrList)
+                {
+                    switch (aIter.getToken())
+                    {
+                        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+                        {
+                            maColumns.insert(aIter.toInt32());
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        break;
+    }
+    return new SvXMLImportContext(GetImport());
+}
+
+ScXMLColumnSortContext::ScXMLColumnSortContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& /*rAttrList*/)
+    : ScXMLImportContext(rImport)
+{
+}
+
+ScXMLColumnSortContext::~ScXMLColumnSortContext() {}
+
+/*
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLColumnSortContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+
+}
+*/
+
+ScXMLColumnTextContext::ScXMLColumnTextContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList)
+    : ScXMLImportContext(rImport)
+{
+    OUString aType = OUString();
+
+    if (rAttrList.is())
+    {
+        for (auto& aIter : *rAttrList)
+        {
+            switch (aIter.getToken())
+            {
+                case XML_ELEMENT(CALC_EXT, XML_TYPE):
+                {
+                    aType = aIter.toString();
+                }
+                break;
+            }
+        }
+    }
+
+    if (!aType.isEmpty())
+    {
+        if (aType == "lowercase")
+            maType = sc::TEXT_TRANSFORM_TYPE::TO_LOWER;
+        else if (aType == "uppercase")
+            maType = sc::TEXT_TRANSFORM_TYPE::TO_UPPER;
+        else if (aType == "capitalize")
+            maType = sc::TEXT_TRANSFORM_TYPE::CAPITALIZE;
+        else if (aType == "trim")
+            maType = sc::TEXT_TRANSFORM_TYPE::TRIM;
+    }
+}
+
+ScXMLColumnTextContext::~ScXMLColumnTextContext()
+{
+    ScDocument* pDoc = GetScImport().GetDocument();
+    auto& rDataSources = pDoc->GetExternalDataMapper().getDataSources();
+    if (!rDataSources.empty())
+    {
+        rDataSources[rDataSources.size() - 1].AddDataTransformation(
+            std::make_shared<sc::TextTransformation>(maColumns, maType));
+    }
+}
+
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLColumnTextContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    sax_fastparser::FastAttributeList* pAttribList
+        = sax_fastparser::FastAttributeList::castToFastAttributeList(xAttrList);
+
+    const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList = pAttribList;
+
+    switch (nElement)
+    {
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+        {
+            if (rAttrList.is())
+            {
+                for (auto& aIter : *rAttrList)
+                {
+                    switch (aIter.getToken())
+                    {
+                        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+                        {
+                            maColumns.insert(aIter.toInt32());
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        break;
+    }
+    return new SvXMLImportContext(GetImport());
+}
+
+ScXMLColumnAggregateContext::ScXMLColumnAggregateContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList)
+    : ScXMLImportContext(rImport)
+{
+    OUString aType = OUString();
+
+    if (rAttrList.is())
+    {
+        for (auto& aIter : *rAttrList)
+        {
+            switch (aIter.getToken())
+            {
+                case XML_ELEMENT(CALC_EXT, XML_TYPE):
+                {
+                    aType = aIter.toString();
+                }
+                break;
+            }
+        }
+    }
+
+    if (!aType.isEmpty())
+    {
+        if (aType == "sum")
+            maType = sc::AGGREGATE_FUNCTION::SUM;
+        else if (aType == "average")
+            maType = sc::AGGREGATE_FUNCTION::AVERAGE;
+        else if (aType == "min")
+            maType = sc::AGGREGATE_FUNCTION::MIN;
+        else if (aType == "max")
+            maType = sc::AGGREGATE_FUNCTION::MAX;
+    }
+}
+
+ScXMLColumnAggregateContext::~ScXMLColumnAggregateContext()
+{
+    ScDocument* pDoc = GetScImport().GetDocument();
+    auto& rDataSources = pDoc->GetExternalDataMapper().getDataSources();
+    if (!rDataSources.empty())
+    {
+        rDataSources[rDataSources.size() - 1].AddDataTransformation(
+            std::make_shared<sc::AggregateFunction>(maColumns, maType));
+    }
+}
+
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLColumnAggregateContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    sax_fastparser::FastAttributeList* pAttribList
+        = sax_fastparser::FastAttributeList::castToFastAttributeList(xAttrList);
+    const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList = pAttribList;
+
+    switch (nElement)
+    {
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+        {
+            if (rAttrList.is())
+            {
+                for (auto& aIter : *rAttrList)
+                {
+                    switch (aIter.getToken())
+                    {
+                        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+                        {
+                            maColumns.insert(aIter.toInt32());
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        break;
+    }
+    return new SvXMLImportContext(GetImport());
+}
+
+ScXMLColumnNumberContext::ScXMLColumnNumberContext(
+    ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList)
+    : ScXMLImportContext(rImport)
+{
+    if (rAttrList.is())
+    {
+        for (auto& aIter : *rAttrList)
+        {
+            switch (aIter.getToken())
+            {
+                case XML_ELEMENT(CALC_EXT, XML_TYPE):
+                {
+                    aType = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT(CALC_EXT, XML_PRECISION):
+                {
+                    maPrecision = aIter.toInt32();
+                }
+                break;
+            }
+        }
+    }
+
+    if (!aType.isEmpty())
+    {
+        if (aType == "round")
+            maType = sc::NUMBER_TRANSFORM_TYPE::ROUND;
+        else if (aType == "round-up")
+            maType = sc::NUMBER_TRANSFORM_TYPE::ROUND_UP;
+        else if (aType == "round-down")
+            maType = sc::NUMBER_TRANSFORM_TYPE::ROUND_DOWN;
+        else if (aType == "abs")
+            maType = sc::NUMBER_TRANSFORM_TYPE::ABSOLUTE;
+        else if (aType == "log")
+            maType = sc::NUMBER_TRANSFORM_TYPE::LOG_E;
+        else if (aType == "log-base-10")
+            maType = sc::NUMBER_TRANSFORM_TYPE::LOG_10;
+        else if (aType == "cube")
+            maType = sc::NUMBER_TRANSFORM_TYPE::CUBE;
+        else if (aType == "number-square")
+            maType = sc::NUMBER_TRANSFORM_TYPE::SQUARE;
+        else if (aType == "square-root")
+            maType = sc::NUMBER_TRANSFORM_TYPE::SQUARE_ROOT;
+        else if (aType == "exponential")
+            maType = sc::NUMBER_TRANSFORM_TYPE::EXPONENT;
+        else if (aType == "even")
+            maType = sc::NUMBER_TRANSFORM_TYPE::IS_EVEN;
+        else if (aType == "odd")
+            maType = sc::NUMBER_TRANSFORM_TYPE::IS_ODD;
+        else if (aType == "sign")
+            maType = sc::NUMBER_TRANSFORM_TYPE::SIGN;
+    }
+}
+
+ScXMLColumnNumberContext::~ScXMLColumnNumberContext()
+{
+    ScDocument* pDoc = GetScImport().GetDocument();
+    auto& rDataSources = pDoc->GetExternalDataMapper().getDataSources();
+    if (!rDataSources.empty())
+    {
+        rDataSources[rDataSources.size() - 1].AddDataTransformation(
+            std::make_shared<sc::NumberTransformation>(maColumns, maType, maPrecision));
+    }
+}
+
+uno::Reference<xml::sax::XFastContextHandler>
+    SAL_CALL ScXMLColumnNumberContext::createFastChildContext(
+        sal_Int32 nElement, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+{
+    sax_fastparser::FastAttributeList* pAttribList
+        = sax_fastparser::FastAttributeList::castToFastAttributeList(xAttrList);
+    const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList = pAttribList;
+
+    switch (nElement)
+    {
+        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+        {
+            if (rAttrList.is())
+            {
+                for (auto& aIter : *rAttrList)
+                {
+                    switch (aIter.getToken())
+                    {
+                        case XML_ELEMENT(CALC_EXT, XML_COLUMN):
+                        {
+                            maColumns.insert(aIter.toInt32());
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        break;
+    }
+    return new SvXMLImportContext(GetImport());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmltransformationi.hxx b/sc/source/filter/xml/xmltransformationi.hxx
new file mode 100644
index 000000000000..42c8a66090f4
--- /dev/null
+++ b/sc/source/filter/xml/xmltransformationi.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLTRANSFORMATIONI_HXX
+#define INCLUDED_SC_SOURCE_FILTER_XML_XMLTRANSFORMATIONI_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+
+#include <datatransformation.hxx>
+
+#include "xmlimprt.hxx"
+#include "importcontext.hxx"
+
+class ScXMLTransformationsContext : public ScXMLImportContext
+{
+public:
+    ScXMLTransformationsContext(ScXMLImport& rImport);
+
+    virtual ~ScXMLTransformationsContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+};
+
+class ScXMLColumnRemoveContext : public ScXMLImportContext
+{
+    std::set<SCCOL> maColumns;
+
+public:
+    ScXMLColumnRemoveContext(ScXMLImport& rImport,
+                             const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnRemoveContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+};
+
+class ScXMLColumnSplitContext : public ScXMLImportContext
+{
+public:
+    ScXMLColumnSplitContext(ScXMLImport& rImport,
+                            const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnSplitContext() override;
+};
+
+class ScXMLColumnMergeContext : public ScXMLImportContext
+{
+    std::set<SCCOL> maColumns;
+    OUString maMergeString;
+
+public:
+    ScXMLColumnMergeContext(ScXMLImport& rImport,
+                            const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnMergeContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+};
+
+class ScXMLColumnSortContext : public ScXMLImportContext
+{
+    ScSortParam maSortParam;
+
+public:
+    ScXMLColumnSortContext(ScXMLImport& rImport,
+                           const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnSortContext() override;
+    /*
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+    */
+};
+
+class ScXMLColumnTextContext : public ScXMLImportContext
+{
+    std::set<SCCOL> maColumns;
+    sc::TEXT_TRANSFORM_TYPE maType;
+
+public:
+    ScXMLColumnTextContext(ScXMLImport& rImport,
+                           const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnTextContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+};
+
+class ScXMLColumnAggregateContext : public ScXMLImportContext
+{
+    std::set<SCCOL> maColumns;
+    sc::AGGREGATE_FUNCTION maType;
+
+public:
+    ScXMLColumnAggregateContext(ScXMLImport& rImport,
+                                const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnAggregateContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+};
+
+class ScXMLColumnNumberContext : public ScXMLImportContext
+{
+    OUString aType;
+    sc::NUMBER_TRANSFORM_TYPE maType;
+    int maPrecision;
+    std::set<SCCOL> maColumns;
+
+public:
+    ScXMLColumnNumberContext(ScXMLImport& rImport,
+                             const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList);
+
+    virtual ~ScXMLColumnNumberContext() override;
+
+    virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList) override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list