From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- sc/source/ui/inc/xmlsourcedlg.hxx | 106 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sc/source/ui/inc/xmlsourcedlg.hxx (limited to 'sc/source/ui/inc/xmlsourcedlg.hxx') diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx new file mode 100644 index 0000000000..3d45d27a82 --- /dev/null +++ b/sc/source/ui/inc/xmlsourcedlg.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "anyrefdg.hxx" +#include + +#include +#include + +class ScDocument; +class ScRange; +class ScOrcusXMLContext; + +struct CustomCompare +{ + weld::TreeView& mrLbTree; + CustomCompare(weld::TreeView& rLbTree) + : mrLbTree(rLbTree) + { + } + bool operator()(const std::unique_ptr& lhs, + const std::unique_ptr& rhs) const + { + return mrLbTree.iter_compare(*lhs, *rhs) == -1; + } +}; + +class ScXMLSourceDlg : public ScAnyRefDlgController +{ + OUString maSrcPath; + + ScOrcusXMLTreeParam maXMLParam; + std::unique_ptr mxCurRefEntry; + std::unique_ptr mpXMLContext; + + ScDocument* mpDoc; + bool mbDlgLostFocus; + + formula::RefEdit* mpActiveEdit; + std::unique_ptr mxBtnSelectSource; + std::unique_ptr mxFtSourceFile; + + std::unique_ptr mxMapGrid; + + std::unique_ptr mxLbTree; + std::unique_ptr mxRefEdit; + std::unique_ptr mxRefBtn; + + std::unique_ptr mxBtnOk; + std::unique_ptr mxBtnCancel; + + CustomCompare maCustomCompare; + + std::set, CustomCompare> maCellLinks; + std::set, CustomCompare> maRangeLinks; + +public: + ScXMLSourceDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScDocument* pDoc); + virtual ~ScXMLSourceDlg() override; + + virtual bool IsRefInputMode() const override; + virtual void SetReference(const ScRange& rRange, ScDocument& rDoc) override; + virtual void Deactivate() override; + virtual void SetActive() override; + virtual void Close() override; + +private: + void SelectSourceFile(); + void LoadSourceFileStructure(const OUString& rPath); + void TreeItemSelected(); + void DefaultElementSelected(const weld::TreeIter& rEntry); + void RepeatElementSelected(const weld::TreeIter& rEntry); + void AttributeSelected(const weld::TreeIter& rEntry); + + void SetNonLinkable(); + void SetSingleLinkable(); + void SetRangeLinkable(); + void SelectAllChildEntries(const weld::TreeIter& rEntry); + + /** + * Check if any of its parents is linked or repeated. The passed entry is + * not checked; its parent is the first one to be checked, then all its + * parents get checked all the way to the root. + */ + bool IsParentDirty(const weld::TreeIter* pEntry) const; + + bool IsChildrenDirty(const weld::TreeIter* pEntry) const; + + void OkPressed(); + void CancelPressed(); + void RefEditModified(); + + DECL_LINK(BtnPressedHdl, weld::Button&, void); + DECL_LINK(TreeItemSelectHdl, weld::TreeView&, void); + DECL_LINK(RefModifiedHdl, formula::RefEdit&, void); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3