LibreOffice Module sc (master)  1
xmlsourcedlg.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_SC_SOURCE_UI_INC_XMLSOURCEDLG_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_XMLSOURCEDLG_HXX
12 
13 #include "anyrefdg.hxx"
14 #include <orcusxml.hxx>
15 
16 #include <set>
17 #include <memory>
18 
19 class ScDocument;
20 class ScRange;
21 class ScOrcusXMLContext;
22 
24 {
27  : mrLbTree(rLbTree)
28  {
29  }
30  bool operator()(const std::unique_ptr<weld::TreeIter>& lhs,
31  const std::unique_ptr<weld::TreeIter>& rhs) const
32  {
33  return mrLbTree.iter_compare(*lhs, *rhs) == -1;
34  }
35 };
36 
38 {
39  OUString maSrcPath;
40 
42  std::unique_ptr<weld::TreeIter> mxCurRefEntry;
43  std::unique_ptr<ScOrcusXMLContext> mpXMLContext;
44 
47 
49  std::unique_ptr<weld::Button> mxBtnSelectSource;
50  std::unique_ptr<weld::Label> mxFtSourceFile;
51 
52  std::unique_ptr<weld::Container> mxMapGrid;
53 
54  std::unique_ptr<weld::TreeView> mxLbTree;
55  std::unique_ptr<formula::RefEdit> mxRefEdit;
56  std::unique_ptr<formula::RefButton> mxRefBtn;
57 
58  std::unique_ptr<weld::Button> mxBtnOk;
59  std::unique_ptr<weld::Button> mxBtnCancel;
60 
62 
63  std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maCellLinks;
64  std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maRangeLinks;
65 
66 public:
68  virtual ~ScXMLSourceDlg() override;
69 
70  virtual bool IsRefInputMode() const override;
71  virtual void SetReference(const ScRange& rRange, ScDocument& rDoc) override;
72  virtual void Deactivate() override;
73  virtual void SetActive() override;
74  virtual void Close() override;
75 
76 private:
77  void SelectSourceFile();
78  void LoadSourceFileStructure(const OUString& rPath);
79  void TreeItemSelected();
82  void AttributeSelected(weld::TreeIter& rEntry);
83 
84  void SetNonLinkable();
85  void SetSingleLinkable();
86  void SetRangeLinkable();
88 
94  bool IsParentDirty(const weld::TreeIter* pEntry) const;
95 
96  bool IsChildrenDirty(const weld::TreeIter* pEntry) const;
97 
98  void OkPressed();
99  void CancelPressed();
100  void RefEditModified();
101 
102  DECL_LINK(BtnPressedHdl, weld::Button&, void);
103  DECL_LINK(TreeItemSelectHdl, weld::TreeView&, void);
104  DECL_LINK(RefModifiedHdl, formula::RefEdit&, void);
105 };
106 
107 #endif
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::TreeIter > mxCurRefEntry
void RefEditModified()
std::unique_ptr< weld::Label > mxFtSourceFile
CustomCompare(weld::TreeView &rLbTree)
weld::TreeView & mrLbTree
ScOrcusXMLTreeParam maXMLParam
void LoadSourceFileStructure(const OUString &rPath)
ScDocument * mpDoc
OUString maSrcPath
virtual void Close() override
std::unique_ptr< ScOrcusXMLContext > mpXMLContext
std::unique_ptr< formula::RefButton > mxRefBtn
void SetSingleLinkable()
std::unique_ptr< formula::RefEdit > mxRefEdit
void TreeItemSelected()
CustomCompare maCustomCompare
void RepeatElementSelected(weld::TreeIter &rEntry)
virtual void SetActive() override
void AttributeSelected(weld::TreeIter &rEntry)
virtual void Deactivate() override
formula::RefEdit * mpActiveEdit
void DefaultElementSelected(weld::TreeIter &rEntry)
std::set< std::unique_ptr< weld::TreeIter >, CustomCompare > maRangeLinks
virtual bool IsRefInputMode() const override
void SelectAllChildEntries(weld::TreeIter &rEntry)
bool IsChildrenDirty(const weld::TreeIter *pEntry) const
Parameter used during call to ScOrcusFilters::loadXMLStructure().
Definition: orcusxml.hxx:27
bool IsParentDirty(const weld::TreeIter *pEntry) const
Check if any of its parents is linked or repeated.
DECL_LINK(BtnPressedHdl, weld::Button &, void)
std::unique_ptr< weld::Button > mxBtnCancel
std::unique_ptr< weld::Button > mxBtnSelectSource
std::unique_ptr< weld::TreeView > mxLbTree
std::unique_ptr< weld::Container > mxMapGrid
std::set< std::unique_ptr< weld::TreeIter >, CustomCompare > maCellLinks
bool operator()(const std::unique_ptr< weld::TreeIter > &lhs, const std::unique_ptr< weld::TreeIter > &rhs) const
void SetRangeLinkable()
virtual ~ScXMLSourceDlg() override
virtual void SetReference(const ScRange &rRange, ScDocument &rDoc) override
ScXMLSourceDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScDocument *pDoc)
void SelectSourceFile()
std::unique_ptr< weld::Button > mxBtnOk
virtual int iter_compare(const TreeIter &a, const TreeIter &b) const =0