sc/inc/orcusfilters.hxx | 2 - sc/source/filter/inc/orcusfiltersimpl.hxx | 2 - sc/source/filter/orcus/orcusfiltersimpl.cxx | 32 +++++++++++++++++++--------- sc/source/ui/inc/xmlsourcedlg.hrc | 3 +- sc/source/ui/inc/xmlsourcedlg.hxx | 1 sc/source/ui/src/xmlsourcedlg.src | 6 +++++ sc/source/ui/xmlsource/xmlsourcedlg.cxx | 4 ++- 7 files changed, 36 insertions(+), 14 deletions(-)
New commits: commit a700919263c73714b52b631623dc6d2f4ef1f092 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Oct 5 17:48:48 2012 -0400 Use different icon image for the attribute entries. Change-Id: Icd053ba7906191f3bc937cdb3c76d037fd67dab5 diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx index 2ec5a49..7db7034 100644 --- a/sc/inc/orcusfilters.hxx +++ b/sc/inc/orcusfilters.hxx @@ -28,7 +28,7 @@ public: virtual bool loadXMLStructure( SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, - const Image& rImgDefaultElem, const Image& rImgRepeatElem) const = 0; + const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const = 0; }; #endif diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx index 311b6e0..2f42d0b 100644 --- a/sc/source/filter/inc/orcusfiltersimpl.hxx +++ b/sc/source/filter/inc/orcusfiltersimpl.hxx @@ -19,7 +19,7 @@ public: virtual bool loadXMLStructure( SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, - const Image& rImgDefaultElem, const Image& rImgRepeatElem) const; + const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const; }; #endif diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx index 4635175..824eea9 100644 --- a/sc/source/filter/orcus/orcusfiltersimpl.cxx +++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx @@ -175,7 +175,9 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons void populateTree( SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker, - const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent) + const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat, + const Image& rImgRepeatElem, const Image& rImgElemAttr, + SvLBoxEntry* pParent) { OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8); SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent); @@ -196,7 +198,9 @@ void populateTree( for (; it != itEnd; ++it) { orcus::xml_structure_tree::entity_name aAttrName = *it; - rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry); + SvLBoxEntry* pAttr = rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry); + rTreeCtrl.SetExpandedEntryBmp(pAttr, rImgElemAttr); + rTreeCtrl.SetCollapsedEntryBmp(pAttr, rImgElemAttr); } rTreeCtrl.Expand(pEntry); @@ -205,13 +209,14 @@ void populateTree( for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it) { orcus::xml_structure_tree::element aElem = rWalker.descend(*it); - populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, pEntry); + populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, rImgElemAttr, pEntry); rWalker.ascend(); } } bool ScOrcusFiltersImpl::loadXMLStructure( - SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, const Image& rImgDefaultElem, const Image& rImgRepeatElem) const + SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, + const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const { INetURLObject aURL(rPath); OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8); @@ -238,7 +243,7 @@ bool ScOrcusFiltersImpl::loadXMLStructure( // Root element. orcus::xml_structure_tree::element aElem = aWalker.root(); - populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, NULL); + populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, rImgElemAttr, NULL); } catch (const std::exception&) { diff --git a/sc/source/ui/inc/xmlsourcedlg.hrc b/sc/source/ui/inc/xmlsourcedlg.hrc index 24c40b1..ec10aff 100644 --- a/sc/source/ui/inc/xmlsourcedlg.hrc +++ b/sc/source/ui/inc/xmlsourcedlg.hrc @@ -21,6 +21,7 @@ #define IMG_ELEMENT_DEFAULT 50 #define IMG_ELEMENT_REPEAT 51 -#define IMG_FILE_OPEN 52 +#define IMG_ELEMENT_ATTRIBUTE 52 +#define IMG_FILE_OPEN 53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx index b6fb2ba..39bfa6b 100644 --- a/sc/source/ui/inc/xmlsourcedlg.hxx +++ b/sc/source/ui/inc/xmlsourcedlg.hxx @@ -42,6 +42,7 @@ class ScXMLSourceDlg : public ModalDialog Image maImgFileOpen; Image maImgElemDefault; Image maImgElemRepeat; + Image maImgElemAttribute; ScDocument* mpDoc; diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src index 564b9d1..8a7b13a 100644 --- a/sc/source/ui/src/xmlsourcedlg.src +++ b/sc/source/ui/src/xmlsourcedlg.src @@ -68,6 +68,12 @@ ModalDialog RID_SCDLG_XML_SOURCE MaskColor = STD_MASKCOLOR ; }; + Image IMG_ELEMENT_ATTRIBUTE + { + ImageBitmap = Bitmap { File = "time.png" ; }; + MaskColor = STD_MASKCOLOR ; + }; + Image IMG_FILE_OPEN { ImageBitmap = Bitmap { File = "file.png" ; }; diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 7f0a48b..2a94a9b 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -36,6 +36,7 @@ ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) : maImgFileOpen(ScResId(IMG_FILE_OPEN)), maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)), maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)), + maImgElemAttribute(ScResId(IMG_ELEMENT_ATTRIBUTE)), mpDoc(pDoc) { maBtnSelectSource.SetModeImage(maImgFileOpen); @@ -80,7 +81,8 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath) if (!pOrcus) return; - pOrcus->loadXMLStructure(maLbTree, rPath, maImgElemDefault, maImgElemRepeat); + pOrcus->loadXMLStructure( + maLbTree, rPath, maImgElemDefault, maImgElemRepeat, maImgElemAttribute); } IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn) commit 2c67a1b65d7027fb9362f83bf7b110a64e7b68c7 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Oct 5 17:41:33 2012 -0400 Add detected attributes to the tree too. Change-Id: I6d4b757f599ac8d33be3775ee55eaef61d89871a diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx index 8453043..4635175 100644 --- a/sc/source/filter/orcus/orcusfiltersimpl.cxx +++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx @@ -175,10 +175,8 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons void populateTree( SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker, - const orcus::xml_structure_tree::element_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent) + const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent) { - // TODO: Make use of bRepeat flag. - OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8); SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent); if (bRepeat) @@ -190,13 +188,22 @@ void populateTree( if (pParent) rTreeCtrl.Expand(pParent); - orcus::xml_structure_tree::element_names_type aChildElements; - rWalker.get_children(aChildElements); + orcus::xml_structure_tree::entity_names_type aNames; - orcus::xml_structure_tree::element_names_type::const_iterator it = aChildElements.begin(); - orcus::xml_structure_tree::element_names_type::const_iterator itEnd = aChildElements.end(); + rWalker.get_attributes(aNames); + orcus::xml_structure_tree::entity_names_type::const_iterator it = aNames.begin(); + orcus::xml_structure_tree::entity_names_type::const_iterator itEnd = aNames.end(); for (; it != itEnd; ++it) { + orcus::xml_structure_tree::entity_name aAttrName = *it; + rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry); + } + rTreeCtrl.Expand(pEntry); + + rWalker.get_children(aNames); + + for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it) + { orcus::xml_structure_tree::element aElem = rWalker.descend(*it); populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, pEntry); rWalker.ascend(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits