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 #pragma once
11 
12 #include "anyrefdg.hxx"
13 #include <orcusxml.hxx>
14 
15 #include <set>
16 #include <memory>
17 
18 class ScDocument;
19 class ScRange;
20 class ScOrcusXMLContext;
21 
23 {
26  : mrLbTree(rLbTree)
27  {
28  }
29  bool operator()(const std::unique_ptr<weld::TreeIter>& lhs,
30  const std::unique_ptr<weld::TreeIter>& rhs) const
31  {
32  return mrLbTree.iter_compare(*lhs, *rhs) == -1;
33  }
34 };
35 
37 {
38  OUString maSrcPath;
39 
41  std::unique_ptr<weld::TreeIter> mxCurRefEntry;
42  std::unique_ptr<ScOrcusXMLContext> mpXMLContext;
43 
46 
48  std::unique_ptr<weld::Button> mxBtnSelectSource;
49  std::unique_ptr<weld::Label> mxFtSourceFile;
50 
51  std::unique_ptr<weld::Container> mxMapGrid;
52 
53  std::unique_ptr<weld::TreeView> mxLbTree;
54  std::unique_ptr<formula::RefEdit> mxRefEdit;
55  std::unique_ptr<formula::RefButton> mxRefBtn;
56 
57  std::unique_ptr<weld::Button> mxBtnOk;
58  std::unique_ptr<weld::Button> mxBtnCancel;
59 
61 
62  std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maCellLinks;
63  std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maRangeLinks;
64 
65 public:
67  virtual ~ScXMLSourceDlg() override;
68 
69  virtual bool IsRefInputMode() const override;
70  virtual void SetReference(const ScRange& rRange, ScDocument& rDoc) override;
71  virtual void Deactivate() override;
72  virtual void SetActive() override;
73  virtual void Close() override;
74 
75 private:
76  void SelectSourceFile();
77  void LoadSourceFileStructure(const OUString& rPath);
78  void TreeItemSelected();
81  void AttributeSelected(weld::TreeIter& rEntry);
82 
83  void SetNonLinkable();
84  void SetSingleLinkable();
85  void SetRangeLinkable();
87 
93  bool IsParentDirty(const weld::TreeIter* pEntry) const;
94 
95  bool IsChildrenDirty(const weld::TreeIter* pEntry) const;
96 
97  void OkPressed();
98  void CancelPressed();
99  void RefEditModified();
100 
101  DECL_LINK(BtnPressedHdl, weld::Button&, void);
102  DECL_LINK(TreeItemSelectHdl, weld::TreeView&, void);
103  DECL_LINK(RefModifiedHdl, formula::RefEdit&, void);
104 };
105 
106 /* 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:26
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