[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-11-21 Thread Libreoffice Gerrit user
 sc/inc/orcusxml.hxx |4 ++
 sc/source/core/tool/orcusxml.cxx|9 +
 sc/source/filter/orcus/xmlcontext.cxx   |   54 +++-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   31 ++
 4 files changed, 84 insertions(+), 14 deletions(-)

New commits:
commit ae9da93d4b4cbcd349e19c2bf4f9e7a27f31965f
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Wed Nov 21 15:21:41 2012 -0500

Correctly handle xml namespaces when importing xml content.

But it's still not working. I need to dig some more.

Change-Id: I06d4d70e1a4234b031741a496f2651d016c35ecc

diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index c3a981d..87be8a2 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -29,6 +29,7 @@ struct ScOrcusXMLTreeParam
 /** Custom data stored with each tree item. */
 struct EntryData
 {
+size_t mnNamespaceID; /// numerical ID for xml namespace
 EntryType meType;
 ScAddress maLinkedPos; /// linked cell position (invalid if unlinked)
 bool mbRangeParent:1;
@@ -72,8 +73,11 @@ struct ScOrcusImportXMLParam
 typedef std::vectorCellLink CellLinksType;
 typedef std::vectorRangeLink RangeLinksType;
 
+std::vectorsize_t maNamespaces;
 CellLinksType maCellLinks;
 RangeLinksType maRangeLinks;
+
+SC_DLLPUBLIC static rtl::OString getShortNamespaceName(size_t nIndex);
 };
 
 #endif
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 3f3c93c..cef0333 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -10,6 +10,7 @@
 #include orcusxml.hxx
 
 #include svtools/treelistbox.hxx
+#include rtl/strbuf.hxx
 
 ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
 meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID), 
mbRangeParent(false), mbLeafNode(true) {}
@@ -27,4 +28,12 @@ const ScOrcusXMLTreeParam::EntryData* 
ScOrcusXMLTreeParam::getUserData(const SvT
 ScOrcusImportXMLParam::CellLink::CellLink(const ScAddress rPos, const 
OString rPath) :
 maPos(rPos), maPath(rPath) {}
 
+OString ScOrcusImportXMLParam::getShortNamespaceName(size_t nIndex)
+{
+OStringBuffer aBuf;
+aBuf.append(ns);
+aBuf.append(static_castsal_Int32(nIndex));
+return aBuf.makeStringAndClear();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/xmlcontext.cxx 
b/sc/source/filter/orcus/xmlcontext.cxx
index 86865cd..3ad6951 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -31,6 +31,13 @@ ScOrcusXMLTreeParam::EntryData setUserDataToEntry(
 return rStore.back();
 }
 
+void setEntityNameToUserData(
+ScOrcusXMLTreeParam::EntryData rEntryData,
+const orcus::xml_structure_tree::entity_name entity, const 
orcus::xml_structure_tree::walker walker)
+{
+rEntryData.mnNamespaceID = walker.get_xmlns_index(entity.ns);
+}
+
 OUString toString(const orcus::xml_structure_tree::entity_name entity, const 
orcus::xml_structure_tree::walker walker)
 {
 OUStringBuffer aBuf;
@@ -43,9 +50,10 @@ OUString toString(const 
orcus::xml_structure_tree::entity_name entity, const or
 aBuf.append(???);
 else
 {
-aBuf.append(ns);
-aBuf.append(static_castsal_Int32(index));
+OString aName = 
ScOrcusImportXMLParam::getShortNamespaceName(index);
+aBuf.append(OUString(aName.getStr(), aName.getLength(), 
RTL_TEXTENCODING_UTF8));
 }
+
 aBuf.append(':');
 }
 aBuf.append(OUString(entity.name.get(), entity.name.size(), 
RTL_TEXTENCODING_UTF8));
@@ -66,6 +74,8 @@ void populateTree(
 *pEntry, rParam.maUserDataStore,
 bRepeat ? ScOrcusXMLTreeParam::ElementRepeat : 
ScOrcusXMLTreeParam::ElementDefault);
 
+setEntityNameToUserData(rEntryData, rElemName, rWalker);
+
 if (bRepeat)
 {
 // Recurring elements use different icon.
@@ -84,13 +94,16 @@ void populateTree(
 orcus::xml_structure_tree::entity_names_type::const_iterator itEnd = 
aNames.end();
 for (; it != itEnd; ++it)
 {
-orcus::xml_structure_tree::entity_name aAttrName = *it;
-SvTreeListEntry* pAttr = rTreeCtrl.InsertEntry(toString(aAttrName, 
rWalker), pEntry);
+const orcus::xml_structure_tree::entity_name rAttrName = *it;
+SvTreeListEntry* pAttr = rTreeCtrl.InsertEntry(toString(rAttrName, 
rWalker), pEntry);
 
 if (!pAttr)
 continue;
 
-setUserDataToEntry(*pAttr, rParam.maUserDataStore, 
ScOrcusXMLTreeParam::Attribute);
+ScOrcusXMLTreeParam::EntryData rAttrData =
+setUserDataToEntry(*pAttr, rParam.maUserDataStore, 
ScOrcusXMLTreeParam::Attribute);
+setEntityNameToUserData(rAttrData, rAttrName, rWalker);
+
 rTreeCtrl.SetExpandedEntryBmp(pAttr, rParam.maImgAttribute);
 rTreeCtrl.SetCollapsedEntryBmp(pAttr, rParam.maImgAttribute);
 

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-11-21 Thread Libreoffice Gerrit user
 sc/inc/orcusxml.hxx   |2 --
 sc/source/core/tool/orcusxml.cxx  |8 
 sc/source/filter/orcus/xmlcontext.cxx |   20 +++-
 3 files changed, 7 insertions(+), 23 deletions(-)

New commits:
commit dab53b371a10a341dcea647cb62273a65c984d98
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Wed Nov 21 21:19:58 2012 -0500

Use the method from orcus to get the short version of xml namespace name.

Change-Id: I5d64ae380982c09f53dacb1eac721430674e9a31

diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index 87be8a2..36c41dd 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -76,8 +76,6 @@ struct ScOrcusImportXMLParam
 std::vectorsize_t maNamespaces;
 CellLinksType maCellLinks;
 RangeLinksType maRangeLinks;
-
-SC_DLLPUBLIC static rtl::OString getShortNamespaceName(size_t nIndex);
 };
 
 #endif
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index cef0333..b3cbd46 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -28,12 +28,4 @@ const ScOrcusXMLTreeParam::EntryData* 
ScOrcusXMLTreeParam::getUserData(const SvT
 ScOrcusImportXMLParam::CellLink::CellLink(const ScAddress rPos, const 
OString rPath) :
 maPos(rPos), maPath(rPath) {}
 
-OString ScOrcusImportXMLParam::getShortNamespaceName(size_t nIndex)
-{
-OStringBuffer aBuf;
-aBuf.append(ns);
-aBuf.append(static_castsal_Int32(nIndex));
-return aBuf.makeStringAndClear();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/xmlcontext.cxx 
b/sc/source/filter/orcus/xmlcontext.cxx
index 3ad6951..c62d39b 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -21,6 +21,8 @@
 #include orcus/orcus_xml.hpp
 #include orcus/global.hpp
 
+#include string
+
 namespace {
 
 ScOrcusXMLTreeParam::EntryData setUserDataToEntry(
@@ -43,17 +45,9 @@ OUString toString(const 
orcus::xml_structure_tree::entity_name entity, const or
 OUStringBuffer aBuf;
 if (entity.ns)
 {
-// Namespace exists.  Namespaces are displayed as ns0, ns1, ns2, 
-size_t index = walker.get_xmlns_index(entity.ns);
-if (index == orcus::xml_structure_tree::walker::index_not_found)
-// This namespace doesn't exist in this context. Something has 
gone wrong.
-aBuf.append(???);
-else
-{
-OString aName = 
ScOrcusImportXMLParam::getShortNamespaceName(index);
-aBuf.append(OUString(aName.getStr(), aName.getLength(), 
RTL_TEXTENCODING_UTF8));
-}
-
+// Namespace exists.  Use the short version of the xml namespace name 
for display.
+std::string aShortName = walker.get_xmlns_short_name(entity.ns);
+aBuf.appendAscii(aShortName.c_str());
 aBuf.append(':');
 }
 aBuf.append(OUString(entity.name.get(), entity.name.size(), 
RTL_TEXTENCODING_UTF8));
@@ -212,8 +206,8 @@ public:
 if (nsid == orcus::XMLNS_UNKNOWN_ID)
 return;
 
-OString aAlias = ScOrcusImportXMLParam::getShortNamespaceName(index);
-mrFilter.set_namespace_alias(aAlias.getStr(), nsid);
+std::string alias = mrNsRepo.get_short_name(index);
+mrFilter.set_namespace_alias(alias.c_str(), nsid);
 }
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/Library_scfilt.mk sc/source

2012-11-19 Thread Libreoffice Gerrit user
 sc/Library_scfilt.mk|2 
 sc/inc/orcusfilters.hxx |   15 -
 sc/source/filter/inc/orcusfiltersimpl.hxx   |   19 +
 sc/source/filter/inc/orcusinterface.hxx |   63 
 sc/source/filter/orcus/interface.cxx|  121 +
 sc/source/filter/orcus/orcusfiltersimpl.cxx |  359 
 sc/source/filter/orcus/xmlcontext.cxx   |  221 +
 sc/source/ui/inc/xmlsourcedlg.hxx   |3 
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   14 -
 9 files changed, 449 insertions(+), 368 deletions(-)

New commits:
commit 08f35a4c7df2cba0ad56e2ccc225ca65cd9550e3
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Mon Nov 19 16:45:55 2012 -0500

Separate the XML part of orcus filters into own class.

Along with other reorganization of the orcus interface code...

This XML context object will be used to store data specific to each
loaded XML file, such as XML stream, namespace repository and so on.

Change-Id: I21c43ab0026954c5d52f4985a169934f8fb9f704

diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 7a5256e..8d3d22b 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -218,7 +218,9 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
 sc/source/filter/oox/worksheetfragment \
 sc/source/filter/oox/worksheethelper \
 sc/source/filter/oox/worksheetsettings \
+sc/source/filter/orcus/interface \
 sc/source/filter/orcus/orcusfiltersimpl \
+sc/source/filter/orcus/xmlcontext \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 1b94f67..dd9778d 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -17,6 +17,7 @@ class SvTreeListBox;
 class Image;
 struct ScOrcusXMLTreeParam;
 struct ScOrcusImportXMLParam;
+class ScOrcusXMLContext;
 
 /**
  * Collection of orcus filter wrappers.
@@ -28,11 +29,17 @@ public:
 
 virtual bool importCSV(ScDocument rDoc, const rtl::OUString rPath) const 
= 0;
 
-virtual bool loadXMLStructure(
-   const rtl::OUString rPath, SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const = 0;
+virtual ScOrcusXMLContext* createXMLContext(ScDocument rDoc, const 
rtl::OUString rPath) const = 0;
+};
+
+class ScOrcusXMLContext
+{
+public:
+virtual ~ScOrcusXMLContext() {}
+
+virtual bool loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const = 0;
 
-virtual bool importXML(
-ScDocument rDoc, const rtl::OUString rPath, const 
ScOrcusImportXMLParam rParam) const = 0;
+virtual bool importXML(const ScOrcusImportXMLParam rParam) const = 0;
 };
 
 #endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx 
b/sc/source/filter/inc/orcusfiltersimpl.hxx
index f2d2703..0b6ffa6 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -15,13 +15,24 @@
 class ScOrcusFiltersImpl : public ScOrcusFilters
 {
 public:
+static rtl::OString toSystemPath(const rtl::OUString rPath);
+
 virtual bool importCSV(ScDocument rDoc, const rtl::OUString rPath) const;
 
-virtual bool loadXMLStructure(
-const rtl::OUString rPath, SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const;
+virtual ScOrcusXMLContext* createXMLContext(ScDocument rDoc, const 
rtl::OUString rPath) const;
+};
+
+class ScOrcusXMLContextImpl : public ScOrcusXMLContext
+{
+ScDocument mrDoc;
+rtl::OUString maPath;
+public:
+ScOrcusXMLContextImpl(ScDocument rDoc, const rtl::OUString rPath);
+virtual ~ScOrcusXMLContextImpl();
+
+virtual bool loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const;
 
-virtual bool importXML(
-ScDocument rDoc, const rtl::OUString rPath, const 
ScOrcusImportXMLParam rParam) const;
+virtual bool importXML(const ScOrcusImportXMLParam rParam) const;
 };
 
 #endif
diff --git a/sc/source/filter/inc/orcusinterface.hxx 
b/sc/source/filter/inc/orcusinterface.hxx
new file mode 100644
index 000..e2c9c08
--- /dev/null
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -0,0 +1,63 @@
+/* -*- 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 __SC_ORCUSINTERFACE_HXX__
+#define __SC_ORCUSINTERFACE_HXX__
+
+#include address.hxx
+
+#define __ORCUS_STATIC_LIB
+#include orcus/spreadsheet/import_interface.hpp
+
+#include boost/ptr_container/ptr_vector.hpp
+
+class ScDocument;
+class ScOrcusSheet;
+
+class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
+{
+ScDocument mrDoc;
+boost::ptr_vectorScOrcusSheet maSheets;
+
+public:
+ScOrcusFactory(ScDocument rDoc);
+
+

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc

2012-11-19 Thread Libreoffice Gerrit user
 sc/inc/orcusfilters.hxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit bb09627230584b6f4847f54ac431bfd4d328018b
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Mon Nov 19 16:56:24 2012 -0500

Method description.

Change-Id: I754ef846c3bc2d032a818dce6c223da89b3f8ccd

diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index dd9778d..ee8d3f8 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -29,6 +29,15 @@ public:
 
 virtual bool importCSV(ScDocument rDoc, const rtl::OUString rPath) const 
= 0;
 
+/**
+ * Create a context for XML file.  The context object stores session
+ * information for each unique XML file.  You must create a new context
+ * for each XML file, and never to re-use the same context for multiple
+ * XML files.
+ *
+ * The caller is responsible for deleting the instance returned from this
+ * method when it's done.
+ */
 virtual ScOrcusXMLContext* createXMLContext(ScDocument rDoc, const 
rtl::OUString rPath) const = 0;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-11-19 Thread Libreoffice Gerrit user
 sc/inc/orcusfilters.hxx   |4 ++--
 sc/source/filter/inc/orcusfiltersimpl.hxx |9 +++--
 sc/source/filter/orcus/xmlcontext.cxx |7 +++
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 552e40269b8a8c6b3621303f0aa9a71cf44583e3
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Mon Nov 19 17:14:43 2012 -0500

Store the xml namespace repository with the context.

We need persistent xml namespaces between loading the structure and
importing the content.

Change-Id: I4b56a7e952ab89b93ea2590c8f0d6b5cb141f039

diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index ee8d3f8..bcf8881 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -46,9 +46,9 @@ class ScOrcusXMLContext
 public:
 virtual ~ScOrcusXMLContext() {}
 
-virtual bool loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const = 0;
+virtual bool loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) = 0;
 
-virtual bool importXML(const ScOrcusImportXMLParam rParam) const = 0;
+virtual bool importXML(const ScOrcusImportXMLParam rParam) = 0;
 };
 
 #endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx 
b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 0b6ffa6..673da91 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -12,6 +12,8 @@
 
 #include orcusfilters.hxx
 
+#include orcus/xml_namespace.hpp
+
 class ScOrcusFiltersImpl : public ScOrcusFilters
 {
 public:
@@ -26,13 +28,16 @@ class ScOrcusXMLContextImpl : public ScOrcusXMLContext
 {
 ScDocument mrDoc;
 rtl::OUString maPath;
+
+orcus::xmlns_repository maNsRepo; /// XML namespace repository for this 
context.
+
 public:
 ScOrcusXMLContextImpl(ScDocument rDoc, const rtl::OUString rPath);
 virtual ~ScOrcusXMLContextImpl();
 
-virtual bool loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const;
+virtual bool loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam);
 
-virtual bool importXML(const ScOrcusImportXMLParam rParam) const;
+virtual bool importXML(const ScOrcusImportXMLParam rParam);
 };
 
 #endif
diff --git a/sc/source/filter/orcus/xmlcontext.cxx 
b/sc/source/filter/orcus/xmlcontext.cxx
index d32a55c..9e0dbba 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -124,7 +124,7 @@ ScOrcusXMLContextImpl::ScOrcusXMLContextImpl(ScDocument 
rDoc, const OUString r
 
 ScOrcusXMLContextImpl::~ScOrcusXMLContextImpl() {}
 
-bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam) const
+bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox rTreeCtrl, 
ScOrcusXMLTreeParam rParam)
 {
 rParam.maUserDataStore.clear();
 
@@ -138,8 +138,7 @@ bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox 
rTreeCtrl, ScOrcusXM
 if (aStrm.empty())
 return false;
 
-orcus::xmlns_repository repo; // xml namespace repository.
-orcus::xmlns_context cxt = repo.create_context();
+orcus::xmlns_context cxt = maNsRepo.create_context();
 orcus::xml_structure_tree aXmlTree(cxt);
 try
 {
@@ -165,7 +164,7 @@ bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox 
rTreeCtrl, ScOrcusXM
 return true;
 }
 
-bool ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam rParam) 
const
+bool ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam rParam)
 {
 ScOrcusFactory aFactory(mrDoc);
 OString aSysPath = ScOrcusFiltersImpl::toSystemPath(maPath);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-11-09 Thread Libreoffice Gerrit user
 sc/inc/orcusxml.hxx |3 -
 sc/source/core/tool/orcusxml.cxx|2 
 sc/source/filter/orcus/orcusfiltersimpl.cxx |   67 -
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   75 +++-
 4 files changed, 122 insertions(+), 25 deletions(-)

New commits:
commit b5f009b9cfbda95571fe05d26326c9ca0ca29650
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Nov 9 22:10:54 2012 -0500

Register range links to orcus_xml too.

But range links fail to import. Looks like sheet names are corrupted.
I need to debug this...

Change-Id: If2aeb3b81db65749f05edfbdd2f3388be4f2539c

diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index 1a0b192..c3a981d 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -31,7 +31,8 @@ struct ScOrcusXMLTreeParam
 {
 EntryType meType;
 ScAddress maLinkedPos; /// linked cell position (invalid if unlinked)
-bool mbRangeParent;
+bool mbRangeParent:1;
+bool mbLeafNode:1; /// Leaf if it has no child elements. Child 
Attributes don't count.
 
 SC_DLLPUBLIC EntryData(EntryType eType);
 };
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 5ad41de..3f3c93c 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -12,7 +12,7 @@
 #include svtools/treelistbox.hxx
 
 ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
-meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID), 
mbRangeParent(false) {}
+meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID), 
mbRangeParent(false), mbLeafNode(true) {}
 
 ScOrcusXMLTreeParam::EntryData* 
ScOrcusXMLTreeParam::getUserData(SvTreeListEntry rEntry)
 {
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 2ced6b5..ba3701a 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -113,8 +113,11 @@ orcus::spreadsheet::iface::import_sheet* 
ScOrcusFactory::get_sheet(const char* s
 OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
 SCTAB nTab = -1;
 if (!mrDoc.GetTable(aTabName, nTab))
+{
 // Sheet by that name not found.
+fprintf(stdout, ScOrcusFactory::get_sheet:   no such sheet!!! 
(%s)\n, rtl::OUStringToOString(aTabName, RTL_TEXTENCODING_UTF8).getStr());
 return NULL;
+}
 
 // See if we already have an orcus sheet instance by that index.
 boost::ptr_vectorScOrcusSheet::iterator it =
@@ -211,11 +214,12 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument rDoc, 
const OUString rPath) cons
 
 namespace {
 
-void setUserDataToEntry(
+ScOrcusXMLTreeParam::EntryData setUserDataToEntry(
 SvTreeListEntry rEntry, ScOrcusXMLTreeParam::UserDataStoreType rStore, 
ScOrcusXMLTreeParam::EntryType eType)
 {
 rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType));
 rEntry.SetUserData(rStore.back());
+return rStore.back();
 }
 
 void populateTree(
@@ -229,7 +233,7 @@ void populateTree(
 // Can this ever happen!?
 return;
 
-setUserDataToEntry(
+ScOrcusXMLTreeParam::EntryData rEntryData = setUserDataToEntry(
 *pEntry, rParam.maUserDataStore,
 bRepeat ? ScOrcusXMLTreeParam::ElementRepeat : 
ScOrcusXMLTreeParam::ElementDefault);
 
@@ -266,6 +270,9 @@ void populateTree(
 
 rWalker.get_children(aNames);
 
+// Non-leaf if it has child elements, leaf otherwise.
+rEntryData.mbLeafNode = aNames.empty();
+
 // Insert child elements recursively.
 for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it)
 {
@@ -333,6 +340,22 @@ bool ScOrcusFiltersImpl::loadXMLStructure(
 return true;
 }
 
+namespace {
+
+class InsertFieldPath : std::unary_functionOString, void
+{
+orcus::orcus_xml mrFilter;
+public:
+InsertFieldPath(orcus::orcus_xml rFilter) : mrFilter(rFilter) {}
+void operator() (const OString rPath)
+{
+fprintf(stdout, InsertFieldPath::():   field path = '%s'\n, 
rPath.getStr());
+mrFilter.append_field_link(rPath.getStr());
+}
+};
+
+}
+
 bool ScOrcusFiltersImpl::importXML(
 ScDocument rDoc, const rtl::OUString rPath, const ScOrcusImportXMLParam 
rParam) const
 {
@@ -344,18 +367,38 @@ bool ScOrcusFiltersImpl::importXML(
 orcus::orcus_xml filter(aFactory, NULL);
 
 // Set cell links.
-ScOrcusImportXMLParam::CellLinksType::const_iterator it = 
rParam.maCellLinks.begin();
-ScOrcusImportXMLParam::CellLinksType::const_iterator itEnd = 
rParam.maCellLinks.end();
+{
+ScOrcusImportXMLParam::CellLinksType::const_iterator it = 
rParam.maCellLinks.begin();
+ScOrcusImportXMLParam::CellLinksType::const_iterator itEnd = 
rParam.maCellLinks.end();
+for (; it != itEnd; ++it)
+{
+const ScOrcusImportXMLParam::CellLink rLink = *it;

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-11-07 Thread Libreoffice Gerrit user
 sc/inc/orcusxml.hxx |4 ++--
 sc/source/core/tool/orcusxml.cxx|2 +-
 sc/source/filter/orcus/orcusfiltersimpl.cxx |8 
 sc/source/ui/inc/xmlsourcedlg.hxx   |   10 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   22 +++---
 5 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 4f2856c017310f8775b8617797f21bf2fbf208fb
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Wed Nov 7 13:06:35 2012 -0500

Get it to build again after the rebase.

The breakage is mostly due to my tree control rework on master.

Change-Id: I1db09fa18b4d997cf77fea2968e787cbce3b0a72

diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index 2c4b07b..a133b78 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -16,7 +16,7 @@
 
 #include boost/ptr_container/ptr_vector.hpp
 
-class SvLBoxEntry;
+class SvTreeListEntry;
 
 /**
  * Parameter used during call to ScOrcusFilters::loadXMLStructure().
@@ -47,7 +47,7 @@ struct ScOrcusXMLTreeParam
  */
 UserDataStoreType maUserDataStore;
 
-static SC_DLLPUBLIC EntryData* getUserData(SvLBoxEntry rEntry);
+static SC_DLLPUBLIC EntryData* getUserData(SvTreeListEntry rEntry);
 };
 
 #endif
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 068fddf..8d5d91b 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -14,7 +14,7 @@
 ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
 meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID), 
mbRangeParent(false) {}
 
-ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry 
rEntry)
+ScOrcusXMLTreeParam::EntryData* 
ScOrcusXMLTreeParam::getUserData(SvTreeListEntry rEntry)
 {
 return static_castScOrcusXMLTreeParam::EntryData*(rEntry.GetUserData());
 }
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index b4a1408..0549156 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -177,7 +177,7 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument rDoc, const 
OUString rPath) cons
 namespace {
 
 void setUserDataToEntry(
-SvLBoxEntry rEntry, ScOrcusXMLTreeParam::UserDataStoreType rStore, 
ScOrcusXMLTreeParam::EntryType eType)
+SvTreeListEntry rEntry, ScOrcusXMLTreeParam::UserDataStoreType rStore, 
ScOrcusXMLTreeParam::EntryType eType)
 {
 rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType));
 rEntry.SetUserData(rStore.back());
@@ -186,10 +186,10 @@ void setUserDataToEntry(
 void populateTree(
SvTreeListBox rTreeCtrl, orcus::xml_structure_tree::walker rWalker,
const orcus::xml_structure_tree::entity_name rElemName, bool bRepeat,
-   SvLBoxEntry* pParent, ScOrcusXMLTreeParam rParam)
+   SvTreeListEntry* pParent, ScOrcusXMLTreeParam rParam)
 {
 OUString aName(rElemName.name.get(), rElemName.name.size(), 
RTL_TEXTENCODING_UTF8);
-SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
+SvTreeListEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
 if (!pEntry)
 // Can this ever happen!?
 return;
@@ -217,7 +217,7 @@ void populateTree(
 for (; it != itEnd; ++it)
 {
 orcus::xml_structure_tree::entity_name aAttrName = *it;
-SvLBoxEntry* pAttr = rTreeCtrl.InsertEntry(
+SvTreeListEntry* pAttr = rTreeCtrl.InsertEntry(
 OUString(aAttrName.name.get(), aAttrName.name.size(), 
RTL_TEXTENCODING_UTF8), pEntry);
 
 if (!pAttr)
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx 
b/sc/source/ui/inc/xmlsourcedlg.hxx
index 0f8f0cb..c283ec4 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -74,9 +74,9 @@ private:
 void HandleGetFocus(Control* pCtrl);
 void HandleLoseFocus(Control* pCtrl);
 void TreeItemSelected();
-void DefaultElementSelected(SvLBoxEntry rEntry);
-void RepeatElementSelected(SvLBoxEntry rEntry);
-void AttributeSelected(SvLBoxEntry rEntry);
+void DefaultElementSelected(SvTreeListEntry rEntry);
+void RepeatElementSelected(SvTreeListEntry rEntry);
+void AttributeSelected(SvTreeListEntry rEntry);
 
 void SetNonLinkable();
 void SetSingleLinkable();
@@ -87,9 +87,9 @@ private:
  * not checked; its parent is the first one to be checked, then all its
  * parents get checked all the way to the root.
  */
-bool IsParentDirty(SvLBoxEntry* pEntry) const;
+bool IsParentDirty(SvTreeListEntry* pEntry) const;
 
-bool IsChildrenDirty(SvLBoxEntry* pEntry) const;
+bool IsChildrenDirty(SvTreeListEntry* pEntry) const;
 
 DECL_LINK(GetFocusHdl, Control*);
 DECL_LINK(LoseFocusHdl, Control*);
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index b9d518b..eae0f99 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ 

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/Library_scfilt.mk sc/Library_sc.mk sc/source

2012-10-12 Thread Libreoffice Gerrit user
 sc/Library_sc.mk|1 
 sc/Library_scfilt.mk|1 
 sc/inc/orcusxml.hxx |   11 ++-
 sc/source/core/tool/orcusxml.cxx|   22 ++
 sc/source/filter/orcus/orcusfiltersimpl.cxx |2 
 sc/source/filter/orcus/orcusxml.cxx |   15 
 sc/source/ui/inc/xmlsourcedlg.hrc   |4 -
 sc/source/ui/inc/xmlsourcedlg.hxx   |   15 ++--
 sc/source/ui/src/xmlsourcedlg.src   |   24 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |  100 +++-
 10 files changed, 131 insertions(+), 64 deletions(-)

New commits:
commit 1100902333b55264855f3423bfc1f463e19c8f18
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Oct 12 21:32:09 2012 -0400

More progress on the dialog.

Change-Id: Ib07d6d5de7cd0d72356bbb7859342f5038f05f95

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 2953b4a..89f231a 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -206,6 +206,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/navicfg \
sc/source/core/tool/odffmap \
sc/source/core/tool/optutil \
+   sc/source/core/tool/orcusxml \
sc/source/core/tool/parclass \
sc/source/core/tool/printopt \
sc/source/core/tool/prnsave \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 8809028..7a5256e 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -219,7 +219,6 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
 sc/source/filter/oox/worksheethelper \
 sc/source/filter/oox/worksheetsettings \
 sc/source/filter/orcus/orcusfiltersimpl \
-sc/source/filter/orcus/orcusxml \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index cdc4679..d615ab6 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -10,10 +10,13 @@
 #ifndef __SC_ORCUSXML_HXX__
 #define __SC_ORCUSXML_HXX__
 
+#include scdllapi.h
 #include vcl/image.hxx
 
 #include boost/ptr_container/ptr_vector.hpp
 
+class SvLBoxEntry;
+
 /**
  * Parameter used during call to ScOrcusFilters::loadXMLStructure().
  */
@@ -22,14 +25,14 @@ struct ScOrcusXMLTreeParam
 enum EntryType { ElementDefault, ElementRepeat, Attribute };
 
 /** Custom data stored with each tree item. */
-struct TreeEntryUserData
+struct EntryData
 {
 EntryType meType;
 
-TreeEntryUserData(EntryType eType);
+SC_DLLPUBLIC EntryData(EntryType eType);
 };
 
-typedef boost::ptr_vectorTreeEntryUserData UserDataStoreType;
+typedef boost::ptr_vectorEntryData UserDataStoreType;
 
 Image maImgElementDefault;
 Image maImgElementRepeat;
@@ -40,6 +43,8 @@ struct ScOrcusXMLTreeParam
  * the life cycle of user datas.
  */
 UserDataStoreType maUserDataStore;
+
+static SC_DLLPUBLIC EntryData* getUserData(SvLBoxEntry rEntry);
 };
 
 #endif
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
new file mode 100644
index 000..4e9ef80
--- /dev/null
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -0,0 +1,22 @@
+/* -*- 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 orcusxml.hxx
+
+#include svtools/treelistbox.hxx
+
+ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
+meType(eType) {}
+
+ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry 
rEntry)
+{
+return static_castScOrcusXMLTreeParam::EntryData*(rEntry.GetUserData());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index c5b8711..b4a1408 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -179,7 +179,7 @@ namespace {
 void setUserDataToEntry(
 SvLBoxEntry rEntry, ScOrcusXMLTreeParam::UserDataStoreType rStore, 
ScOrcusXMLTreeParam::EntryType eType)
 {
-rStore.push_back(new ScOrcusXMLTreeParam::TreeEntryUserData(eType));
+rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType));
 rEntry.SetUserData(rStore.back());
 }
 
diff --git a/sc/source/filter/orcus/orcusxml.cxx 
b/sc/source/filter/orcus/orcusxml.cxx
deleted file mode 100644
index 68746be..000
--- a/sc/source/filter/orcus/orcusxml.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- 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 

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-10-12 Thread Libreoffice Gerrit user
 sc/inc/orcusxml.hxx |2 ++
 sc/source/core/tool/orcusxml.cxx|2 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   22 +-
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit c4b0a72e246c2915339e3e5e0d3140944c48aa36
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Oct 12 21:47:20 2012 -0400

Keep track of linked cell positions.

Change-Id: I33e39e53b618270561ba7bfc236e8d8558bccffa

diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index d615ab6..4fa223e 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -11,6 +11,7 @@
 #define __SC_ORCUSXML_HXX__
 
 #include scdllapi.h
+#include address.hxx
 #include vcl/image.hxx
 
 #include boost/ptr_container/ptr_vector.hpp
@@ -28,6 +29,7 @@ struct ScOrcusXMLTreeParam
 struct EntryData
 {
 EntryType meType;
+ScAddress maLinkedPos; /// linked cell position (invalid if unlinked)
 
 SC_DLLPUBLIC EntryData(EntryType eType);
 };
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 4e9ef80..c5e0ac1 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -12,7 +12,7 @@
 #include svtools/treelistbox.hxx
 
 ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
-meType(eType) {}
+meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID) {}
 
 ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry 
rEntry)
 {
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index c4fb781..561f98d 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -88,6 +88,17 @@ void ScXMLSourceDlg::SetReference(const ScRange rRange, 
ScDocument* pDoc)
 OUString aStr;
 rRange.aStart.Format(aStr, SCA_ABS_3D, pDoc, pDoc-GetAddressConvention());
 mpActiveEdit-SetRefString(aStr);
+
+// Set this address to currently selected tree item.
+SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
+if (!pEntry)
+return;
+
+ScOrcusXMLTreeParam::EntryData* pUserData = 
ScOrcusXMLTreeParam::getUserData(*pEntry);
+if (!pUserData)
+return;
+
+pUserData-maLinkedPos = rRange.aStart;
 }
 
 void ScXMLSourceDlg::Deactivate()
@@ -188,10 +199,19 @@ void ScXMLSourceDlg::TreeItemSelected()
 return;
 
 ScOrcusXMLTreeParam::EntryData* pUserData = 
ScOrcusXMLTreeParam::getUserData(*pEntry);
-
 if (!pUserData)
 return;
 
+const ScAddress rPos = pUserData-maLinkedPos;
+if (rPos.IsValid())
+{
+OUString aStr;
+rPos.Format(aStr, SCA_ABS_3D, mpDoc, mpDoc-GetAddressConvention());
+maRefEdit.SetRefString(aStr);
+}
+else
+maRefEdit.SetRefString(OUString());
+
 switch (pUserData-meType)
 {
 case ScOrcusXMLTreeParam::Attribute:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/Library_sc.mk sc/Library_scui.mk sc/source

2012-10-10 Thread Libreoffice Gerrit user
 sc/Library_sc.mk|1 
 sc/Library_scui.mk  |1 
 sc/inc/scabstdlg.hxx|7 --
 sc/source/ui/app/scdll.cxx  |1 
 sc/source/ui/attrdlg/scdlgfact.cxx  |8 --
 sc/source/ui/attrdlg/scdlgfact.hxx  |7 --
 sc/source/ui/inc/reffact.hxx|1 
 sc/source/ui/inc/xmlsourcedlg.hrc   |8 ++
 sc/source/ui/inc/xmlsourcedlg.hxx   |   22 ---
 sc/source/ui/src/xmlsourcedlg.src   |   37 +++-
 sc/source/ui/view/cellsh1.cxx   |   12 --
 sc/source/ui/view/reffact.cxx   |4 +++
 sc/source/ui/view/tabvwsh.cxx   |1 
 sc/source/ui/view/tabvwshc.cxx  |7 ++
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   35 +++---
 15 files changed, 114 insertions(+), 38 deletions(-)

New commits:
commit f56d9195b960e7fdbcc968b19f77bf3c912f6f8a
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Wed Oct 10 20:45:55 2012 -0400

Turned the xml source dialog into a reference dialog.

Change-Id: Ifb3ebd3c0166343f42dd53bcee83c6b31c84f081

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 9bc420f..089e7f2 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -567,6 +567,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/viewfunc \
sc/source/ui/view/viewutil \
sc/source/ui/view/waitoff \
+   sc/source/ui/xmlsource/xmlsourcedlg \
 ))
 
 $(eval $(call gb_SdiTarget_SdiTarget,sc/sdi/scslots,sc/sdi/scalc))
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index c78faca..0cc4099 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -116,7 +116,6 @@ $(eval $(call gb_Library_add_exception_objects,scui,\
 sc/source/ui/pagedlg/tphf \
 sc/source/ui/pagedlg/tptable \
 sc/source/ui/styleui/styledlg \
-sc/source/ui/xmlsource/xmlsourcedlg \
 ))
 
 ifeq ($(OS),WNT)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 5c04cec..22261ce 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -334,11 +334,6 @@ public:
 virtual bool IsDateConversionSet() const = 0;
 };
 
-class AbstractScXMLSourceDlg : public VclAbstractDialog
-{
-public:
-};
-
 //---Scabstract fractory ---
 class ScAbstractDialogFactory
 {
@@ -537,8 +532,6 @@ public:
 virtual SfxAbstractTabDialog * CreateScSortDlg( Window*  pParent, 
//add for ScSortDlg
 const SfxItemSet* 
pArgSet,int nId ) = 0;
 
-virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, 
ScDocument* pDoc, int nId) = 0;
-
 // for tabpage
 virtual CreateTabPage   GetTabPageCreatorFunc( sal_uInt16 nId 
) = 0;
 virtual GetTabPageRangesGetTabPageRangesFunc( sal_uInt16 nId ) 
= 0;
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 651b46a..22e704b 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -257,6 +257,7 @@ void ScDLL::Init()
 
sal::static_int_castsal_uInt16(ScTabViewShell::GetInterfaceId()), pMod);
 ScSolverDlgWrapper  ::RegisterChildWindow(false, pMod);
 ScOptSolverDlgWrapper   ::RegisterChildWindow(false, pMod);
+ScXMLSourceDlgWrapper   ::RegisterChildWindow(false, pMod);
 ScNameDlgWrapper::RegisterChildWindow(false, pMod);
 ScNameDefDlgWrapper::RegisterChildWindow(false, pMod);
 ScPivotLayoutWrapper::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index d437807..2bca1ff 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -124,7 +124,6 @@ IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
 
 // AbstractTabDialog_Impl begin
@@ -1596,13 +1595,6 @@ SfxAbstractTabDialog * 
ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*
 return 0;
 }
 
-AbstractScXMLSourceDlg* 
ScAbstractDialogFactory_Impl::CreateScXMLSourceDlg(Window* pParent, ScDocument* 
pDoc, int nId)
-{
-ScXMLSourceDlg* pDlg = (nId == RID_SCDLG_XML_SOURCE) ? new 
ScXMLSourceDlg(pParent, pDoc) : NULL;
-
-return pDlg ? new AbstractScXMLSourceDlg_Impl(pDlg) : NULL;
-}
-
 #undef SfxTabDialog
 #undef AbstractTabDialog_Impl
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index c250582..22d9643 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -390,11 +390,6 @@ class AbstractScTextImportOptionsDlg_Impl : public 
AbstractScTextImportOptionsDl
 virtual bool IsDateConversionSet() const;

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-09-28 Thread Libreoffice Gerrit user
 sc/inc/scabstdlg.hxx|2 -
 sc/source/ui/attrdlg/scdlgfact.cxx  |4 +-
 sc/source/ui/attrdlg/scdlgfact.hxx  |2 -
 sc/source/ui/inc/xmlsourcedlg.hxx   |   14 +
 sc/source/ui/view/cellsh1.cxx   |2 -
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   46 ++--
 6 files changed, 62 insertions(+), 8 deletions(-)

New commits:
commit 6072c41d03ab3742c282e1b633380e552a684d25
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Sep 28 20:22:23 2012 -0400

Use file picker dialog to pick the source xml file.

Change-Id: Ie927d8a83fa93e3f61c2c2133fe655854667854c

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 9623615..5c04cec 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -537,7 +537,7 @@ public:
 virtual SfxAbstractTabDialog * CreateScSortDlg( Window*  pParent, 
//add for ScSortDlg
 const SfxItemSet* 
pArgSet,int nId ) = 0;
 
-virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, int 
nId) = 0;
+virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, 
ScDocument* pDoc, int nId) = 0;
 
 // for tabpage
 virtual CreateTabPage   GetTabPageCreatorFunc( sal_uInt16 nId 
) = 0;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 9257a9e..d437807 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1596,9 +1596,9 @@ SfxAbstractTabDialog * 
ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*
 return 0;
 }
 
-AbstractScXMLSourceDlg* 
ScAbstractDialogFactory_Impl::CreateScXMLSourceDlg(Window* pParent, int nId)
+AbstractScXMLSourceDlg* 
ScAbstractDialogFactory_Impl::CreateScXMLSourceDlg(Window* pParent, ScDocument* 
pDoc, int nId)
 {
-ScXMLSourceDlg* pDlg = (nId == RID_SCDLG_XML_SOURCE) ? new 
ScXMLSourceDlg(pParent) : NULL;
+ScXMLSourceDlg* pDlg = (nId == RID_SCDLG_XML_SOURCE) ? new 
ScXMLSourceDlg(pParent, pDoc) : NULL;
 
 return pDlg ? new AbstractScXMLSourceDlg_Impl(pDlg) : NULL;
 }
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index 73b35d9..c250582 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -610,7 +610,7 @@ public:
 virtual SfxAbstractTabDialog * CreateScSortDlg( Window*  pParent, 
//add for ScSortDlg
 const SfxItemSet* 
pArgSet,int nId );
 
-virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, int 
nId);
+virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, 
ScDocument* pDoc, int nId);
 
 // For TabPage
 virtual CreateTabPage   GetTabPageCreatorFunc( sal_uInt16 nId 
);
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx 
b/sc/source/ui/inc/xmlsourcedlg.hxx
index 2213d42..5a54c70 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -15,6 +15,10 @@
 #include vcl/fixed.hxx
 #include svtools/svtreebx.hxx
 
+#include boost/scoped_ptr.hpp
+
+class ScDocument;
+
 class ScXMLSourceTree : public SvTreeListBox
 {
 Image maImgElemDefault;
@@ -37,9 +41,17 @@ class ScXMLSourceDlg : public ModalDialog
 
 Image maImgFileOpen;
 
+ScDocument* mpDoc;
+
 public:
-ScXMLSourceDlg(Window* pParent);
+ScXMLSourceDlg(Window* pParent, ScDocument* pDoc);
 virtual ~ScXMLSourceDlg();
+
+private:
+
+void SelectSourceFile();
+
+DECL_LINK(BtnPressedHdl, Button*);
 };
 
 #endif
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 074f69a..4a3c6c8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2451,7 +2451,7 @@ void ScCellShell::ExecuteXMLSourceDialog()
 
 boost::scoped_ptrAbstractScXMLSourceDlg pDlg(
 pFact-CreateScXMLSourceDlg(
-pTabViewShell-GetDialogParent(), RID_SCDLG_XML_SOURCE));
+pTabViewShell-GetDialogParent(), GetViewData()-GetDocument(), 
RID_SCDLG_XML_SOURCE));
 
 if (!pDlg)
 return;
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 378ba5f..e44f5c0 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -11,6 +11,14 @@
 #include xmlsourcedlg.hrc
 
 #include scresid.hxx
+#include document.hxx
+
+#include com/sun/star/lang/XMultiServiceFactory.hpp
+#include com/sun/star/ui/dialogs/XFilePicker.hpp
+#include com/sun/star/ui/dialogs/ExecutableDialogResults.hpp
+
+using namespace com::sun::star;
+
 
 ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const ResId rResId) :
 SvTreeListBox(pParent, rResId),
@@ -30,7 +38,7 @@ ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const 
ResId rResId) :
 Expand(pPar);
 }
 
-ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent) :
+ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, 

[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/source

2012-09-28 Thread Libreoffice Gerrit user
 sc/inc/filter.hxx   |4 +++-
 sc/inc/orcusfilters.hxx |3 +++
 sc/source/filter/inc/orcusfiltersimpl.hxx   |2 ++
 sc/source/filter/orcus/orcusfiltersimpl.cxx |   19 ---
 sc/source/ui/inc/xmlsourcedlg.hxx   |1 +
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   13 +
 6 files changed, 38 insertions(+), 4 deletions(-)

New commits:
commit e26535de6ddc467d94eac1c4010e9e7ab55ae283
Author: Kohei Yoshida kohei.yosh...@gmail.com
Date:   Fri Sep 28 22:19:46 2012 -0400

Call orcus filter accessor from the dialog when a new source file is set.

For now it doesn't do anything.

Change-Id: I8e41c7e15c3b99ab0ddec8e68242176c97f368fc

diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index 2359927..7eef93d 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -32,6 +32,8 @@
 #include tools/string.hxx
 #include rtl/textenc.h
 
+#include scdllapi.h
+
 class SfxMedium;
 class SvStream;
 
@@ -133,7 +135,7 @@ extern C {
 
 class ScFormatFilter {
 public:
-static ScFormatFilterPlugin Get();
+SC_DLLPUBLIC static ScFormatFilterPlugin Get();
 };
 
 #endif
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index b7e3198..2379c67 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -13,6 +13,7 @@
 #include rtl/ustring.hxx
 
 class ScDocument;
+class SvTreeListBox;
 
 /**
  * Collection of orcus filter wrappers.
@@ -23,6 +24,8 @@ public:
 virtual ~ScOrcusFilters() {}
 
 virtual bool importCSV(ScDocument rDoc, const rtl::OUString rPath) const 
= 0;
+
+virtual bool loadXMLStructure(const rtl::OUString rPath, SvTreeListBox 
rTree) const = 0;
 };
 
 #endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx 
b/sc/source/filter/inc/orcusfiltersimpl.hxx
index e349120..f51f00f 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -16,6 +16,8 @@ class ScOrcusFiltersImpl : public ScOrcusFilters
 {
 public:
 virtual bool importCSV(ScDocument rDoc, const rtl::OUString rPath) const;
+
+virtual bool loadXMLStructure(const rtl::OUString rPath, SvTreeListBox 
rTree) const;
 };
 
 #endif
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 3c8c211..7152b68 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -7,11 +7,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include orcusfiltersimpl.hxx
+
 #include document.hxx
 
 #include tools/urlobj.hxx
-
-#include orcusfiltersimpl.hxx
+#include svtools/svtreebx.hxx
 
 #define __ORCUS_STATIC_LIB
 #include orcus/spreadsheet/import_interface.hpp
@@ -143,7 +144,8 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument rDoc, const 
OUString rPath) cons
 {
 ScOrcusFactory aFactory(rDoc);
 INetURLObject aURL(rPath);
-const char* path = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), 
RTL_TEXTENCODING_UTF8).getStr();
+OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), 
RTL_TEXTENCODING_UTF8);
+const char* path = aSysPath.getStr();
 
 try
 {
@@ -159,4 +161,15 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument rDoc, const 
OUString rPath) cons
 return true;
 }
 
+bool ScOrcusFiltersImpl::loadXMLStructure(const OUString rPath, 
SvTreeListBox /*rTree*/) const
+{
+INetURLObject aURL(rPath);
+OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), 
RTL_TEXTENCODING_UTF8);
+const char* path = aSysPath.getStr();
+fprintf(stdout, ScOrcusFiltersImpl::loadXMLStructure:   path = '%s'\n, 
path);
+
+// TODO: Load the tree box.
+return true;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx 
b/sc/source/ui/inc/xmlsourcedlg.hxx
index 5a54c70..44dd44e 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -50,6 +50,7 @@ public:
 private:
 
 void SelectSourceFile();
+void LoadSourceFileStructure(const OUString rPath);
 
 DECL_LINK(BtnPressedHdl, Button*);
 };
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index e44f5c0..e94d132 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -12,6 +12,8 @@
 
 #include scresid.hxx
 #include document.hxx
+#include orcusfilters.hxx
+#include filter.hxx
 
 #include com/sun/star/lang/XMultiServiceFactory.hpp
 #include com/sun/star/ui/dialogs/XFilePicker.hpp
@@ -81,6 +83,17 @@ void ScXMLSourceDlg::SelectSourceFile()
 
 // There should only be one file returned from the file picker.
 maFtSourceFile.SetText(aFiles[0]);
+
+LoadSourceFileStructure(aFiles[0]);
+}
+
+void ScXMLSourceDlg::LoadSourceFileStructure(const OUString rPath)
+{
+ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
+if (!pOrcus)
+