Line data Source code
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 <vcl/button.hxx>
14 : #include <vcl/fixed.hxx>
15 : #include <vcl/layout.hxx>
16 : #include <svtools/treelistbox.hxx>
17 :
18 : #include "anyrefdg.hxx"
19 : #include "orcusxml.hxx"
20 :
21 : #include <set>
22 : #include <vector>
23 : #include <boost/scoped_ptr.hpp>
24 :
25 : class ScDocument;
26 : class ScRange;
27 : class ScOrcusXMLContext;
28 :
29 0 : class ScXMLSourceDlg : public ScAnyRefDlg
30 : {
31 : PushButton* mpBtnSelectSource;
32 : FixedText* mpFtSourceFile;
33 :
34 : VclContainer* mpMapGrid;
35 :
36 : SvTreeListBox* mpLbTree;
37 : formula::RefEdit* mpRefEdit;
38 : formula::RefButton* mpRefBtn;
39 :
40 : PushButton* mpBtnOk;
41 : CancelButton* mpBtnCancel;
42 :
43 : OUString maSrcPath;
44 :
45 : ScOrcusXMLTreeParam maXMLParam;
46 : std::set<const SvTreeListEntry*> maCellLinks;
47 : std::set<const SvTreeListEntry*> maRangeLinks;
48 : std::vector<SvTreeListEntry*> maHighlightedEntries;
49 : SvTreeListEntry* mpCurRefEntry;
50 : boost::scoped_ptr<ScOrcusXMLContext> mpXMLContext;
51 :
52 : ScDocument* mpDoc;
53 :
54 : formula::RefEdit* mpActiveEdit;
55 : bool mbDlgLostFocus;
56 :
57 : public:
58 : ScXMLSourceDlg(
59 : SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScDocument* pDoc);
60 :
61 : virtual bool IsRefInputMode() const SAL_OVERRIDE;
62 : virtual void SetReference(const ScRange& rRange, ScDocument* pDoc) SAL_OVERRIDE;
63 : virtual void Deactivate() SAL_OVERRIDE;
64 : virtual void SetActive() SAL_OVERRIDE;
65 : virtual bool Close() SAL_OVERRIDE;
66 :
67 : private:
68 :
69 : void SelectSourceFile();
70 : void LoadSourceFileStructure(const OUString& rPath);
71 : void HandleGetFocus(Control* pCtrl);
72 : void HandleLoseFocus(Control* pCtrl);
73 : void TreeItemSelected();
74 : void DefaultElementSelected(SvTreeListEntry& rEntry);
75 : void RepeatElementSelected(SvTreeListEntry& rEntry);
76 : void AttributeSelected(SvTreeListEntry& rEntry);
77 :
78 : void SetNonLinkable();
79 : void SetSingleLinkable();
80 : void SetRangeLinkable();
81 : void SelectAllChildEntries(SvTreeListEntry& rEntry);
82 :
83 : /**
84 : * Check if any of its parents is linked or repeated. The passed entry is
85 : * not checked; its parent is the first one to be checked, then all its
86 : * parents get checked all the way to the root.
87 : */
88 : bool IsParentDirty(SvTreeListEntry* pEntry) const;
89 :
90 : bool IsChildrenDirty(SvTreeListEntry* pEntry) const;
91 :
92 : void OkPressed();
93 : void CancelPressed();
94 : void RefEditModified();
95 :
96 : DECL_LINK(GetFocusHdl, Control*);
97 : DECL_LINK(LoseFocusHdl, Control*);
98 : DECL_LINK(BtnPressedHdl, Button*);
99 : DECL_LINK(TreeItemSelectHdl, void*);
100 : DECL_LINK(RefModifiedHdl, void*);
101 : };
102 :
103 : #endif
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|