diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-03 10:33:09 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-28 13:28:22 -0500 |
commit | 19b2f5dfb63f3c4d7b00d10a389b4d19f5d5fcea (patch) | |
tree | 830af36f3f05fbb1bb794ec102f557d9e506cc8a | |
parent | 5d979234d3205e290efae6a643c9156260d149ef (diff) |
Use different icon for recurring elements.
Change-Id: I3869e4a1f2f4b68d57641395daaf79d911a1a891
-rw-r--r-- | sc/inc/orcusfilters.hxx | 5 | ||||
-rw-r--r-- | sc/source/filter/inc/orcusfiltersimpl.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/orcus/orcusfiltersimpl.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/inc/xmlsourcedlg.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/src/xmlsourcedlg.src | 6 | ||||
-rw-r--r-- | sc/source/ui/xmlsource/xmlsourcedlg.cxx | 12 |
6 files changed, 32 insertions, 16 deletions
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx index 2379c670105f..2ec5a490afc7 100644 --- a/sc/inc/orcusfilters.hxx +++ b/sc/inc/orcusfilters.hxx @@ -14,6 +14,7 @@ class ScDocument; class SvTreeListBox; +class Image; /** * Collection of orcus filter wrappers. @@ -25,7 +26,9 @@ public: virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0; - virtual bool loadXMLStructure(const rtl::OUString& rPath, SvTreeListBox& rTree) const = 0; + virtual bool loadXMLStructure( + SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, + const Image& rImgDefaultElem, const Image& rImgRepeatElem) const = 0; }; #endif diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx index f51f00f9550d..311b6e08d502 100644 --- a/sc/source/filter/inc/orcusfiltersimpl.hxx +++ b/sc/source/filter/inc/orcusfiltersimpl.hxx @@ -17,7 +17,9 @@ 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; + virtual bool loadXMLStructure( + SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, + const Image& rImgDefaultElem, const Image& rImgRepeatElem) const; }; #endif diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx index 721e5eea227d..845304380330 100644 --- a/sc/source/filter/orcus/orcusfiltersimpl.cxx +++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx @@ -175,12 +175,18 @@ 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, SvLBoxEntry* pParent) + const orcus::xml_structure_tree::element_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) + { + rTreeCtrl.SetExpandedEntryBmp(pEntry, rImgRepeatElem); + rTreeCtrl.SetCollapsedEntryBmp(pEntry, rImgRepeatElem); + } + if (pParent) rTreeCtrl.Expand(pParent); @@ -192,12 +198,13 @@ void populateTree( for (; it != itEnd; ++it) { orcus::xml_structure_tree::element aElem = rWalker.descend(*it); - populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, pEntry); + populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, pEntry); rWalker.ascend(); } } -bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTreeCtrl) const +bool ScOrcusFiltersImpl::loadXMLStructure( + SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, const Image& rImgDefaultElem, const Image& rImgRepeatElem) const { INetURLObject aURL(rPath); OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8); @@ -217,12 +224,14 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& aXmlTree.parse(&aStrm[0], aStrm.size()); rTreeCtrl.Clear(); + rTreeCtrl.SetDefaultCollapsedEntryBmp(rImgDefaultElem); + rTreeCtrl.SetDefaultExpandedEntryBmp(rImgDefaultElem); orcus::xml_structure_tree::walker aWalker = aXmlTree.get_walker(); // Root element. orcus::xml_structure_tree::element aElem = aWalker.root(); - populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, NULL); + populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, NULL); } catch (const std::exception&) { diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx index 6e32d1282242..b6fb2ba7886b 100644 --- a/sc/source/ui/inc/xmlsourcedlg.hxx +++ b/sc/source/ui/inc/xmlsourcedlg.hxx @@ -23,8 +23,6 @@ class ScDocument; class ScXMLSourceTree : public SvTreeListBox { - Image maImgElemDefault; - Image maImgElemRepeat; public: ScXMLSourceTree(Window* pParent, const ResId& rResId); }; @@ -42,6 +40,8 @@ class ScXMLSourceDlg : public ModalDialog CancelButton maBtnCancel; Image maImgFileOpen; + Image maImgElemDefault; + Image maImgElemRepeat; ScDocument* mpDoc; diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src index f55110bc22c3..564b9d163355 100644 --- a/sc/source/ui/src/xmlsourcedlg.src +++ b/sc/source/ui/src/xmlsourcedlg.src @@ -62,6 +62,12 @@ ModalDialog RID_SCDLG_XML_SOURCE MaskColor = STD_MASKCOLOR ; }; + Image IMG_ELEMENT_REPEAT + { + ImageBitmap = Bitmap { File = "pages.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 39ccbe5d1ccf..7f0a48bdc6d5 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -23,13 +23,7 @@ using namespace com::sun::star; ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const ResId& rResId) : - SvTreeListBox(pParent, rResId), - maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)), - maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)) -{ - SetDefaultExpandedEntryBmp(maImgElemDefault); - SetDefaultCollapsedEntryBmp(maImgElemDefault); -} + SvTreeListBox(pParent, rResId) {} ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) : ModalDialog(pParent, ScResId(RID_SCDLG_XML_SOURCE)), @@ -40,6 +34,8 @@ ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) : maLbTree(this, ScResId(LB_SOURCE_TREE)), maBtnCancel(this, ScResId(BTN_CANCEL)), maImgFileOpen(ScResId(IMG_FILE_OPEN)), + maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)), + maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)), mpDoc(pDoc) { maBtnSelectSource.SetModeImage(maImgFileOpen); @@ -84,7 +80,7 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath) if (!pOrcus) return; - pOrcus->loadXMLStructure(rPath, maLbTree); + pOrcus->loadXMLStructure(maLbTree, rPath, maImgElemDefault, maImgElemRepeat); } IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn) |