tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / xmlsourcedlg.hxx
blob3d45d27a824d4f206b507e15c5587775a0ffd1ec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
12 #include "anyrefdg.hxx"
13 #include <orcusxml.hxx>
15 #include <set>
16 #include <memory>
18 class ScDocument;
19 class ScRange;
20 class ScOrcusXMLContext;
22 struct CustomCompare
24 weld::TreeView& mrLbTree;
25 CustomCompare(weld::TreeView& rLbTree)
26 : mrLbTree(rLbTree)
29 bool operator()(const std::unique_ptr<weld::TreeIter>& lhs,
30 const std::unique_ptr<weld::TreeIter>& rhs) const
32 return mrLbTree.iter_compare(*lhs, *rhs) == -1;
36 class ScXMLSourceDlg : public ScAnyRefDlgController
38 OUString maSrcPath;
40 ScOrcusXMLTreeParam maXMLParam;
41 std::unique_ptr<weld::TreeIter> mxCurRefEntry;
42 std::unique_ptr<ScOrcusXMLContext> mpXMLContext;
44 ScDocument* mpDoc;
45 bool mbDlgLostFocus;
47 formula::RefEdit* mpActiveEdit;
48 std::unique_ptr<weld::Button> mxBtnSelectSource;
49 std::unique_ptr<weld::Label> mxFtSourceFile;
51 std::unique_ptr<weld::Container> mxMapGrid;
53 std::unique_ptr<weld::TreeView> mxLbTree;
54 std::unique_ptr<formula::RefEdit> mxRefEdit;
55 std::unique_ptr<formula::RefButton> mxRefBtn;
57 std::unique_ptr<weld::Button> mxBtnOk;
58 std::unique_ptr<weld::Button> mxBtnCancel;
60 CustomCompare maCustomCompare;
62 std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maCellLinks;
63 std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maRangeLinks;
65 public:
66 ScXMLSourceDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScDocument* pDoc);
67 virtual ~ScXMLSourceDlg() override;
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;
75 private:
76 void SelectSourceFile();
77 void LoadSourceFileStructure(const OUString& rPath);
78 void TreeItemSelected();
79 void DefaultElementSelected(const weld::TreeIter& rEntry);
80 void RepeatElementSelected(const weld::TreeIter& rEntry);
81 void AttributeSelected(const weld::TreeIter& rEntry);
83 void SetNonLinkable();
84 void SetSingleLinkable();
85 void SetRangeLinkable();
86 void SelectAllChildEntries(const weld::TreeIter& rEntry);
88 /**
89 * Check if any of its parents is linked or repeated. The passed entry is
90 * not checked; its parent is the first one to be checked, then all its
91 * parents get checked all the way to the root.
93 bool IsParentDirty(const weld::TreeIter* pEntry) const;
95 bool IsChildrenDirty(const weld::TreeIter* pEntry) const;
97 void OkPressed();
98 void CancelPressed();
99 void RefEditModified();
101 DECL_LINK(BtnPressedHdl, weld::Button&, void);
102 DECL_LINK(TreeItemSelectHdl, weld::TreeView&, void);
103 DECL_LINK(RefModifiedHdl, formula::RefEdit&, void);
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */