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 __SC_XMLSOURCEDLG_HXX__
11 : #define __SC_XMLSOURCEDLG_HXX__
12 :
13 : #include "vcl/button.hxx"
14 : #include "vcl/fixed.hxx"
15 : #include "svtools/treelistbox.hxx"
16 :
17 : #include "expftext.hxx"
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 ScXMLSourceTree : public SvTreeListBox
30 : {
31 : public:
32 : ScXMLSourceTree(Window* pParent, const ResId& rResId);
33 : };
34 :
35 : class ScXMLSourceDlg : public ScAnyRefDlg
36 : {
37 : FixedLine maFlSourceFile;
38 : ImageButton maBtnSelectSource;
39 : ScExpandedFixedText maFtSourceFile;
40 :
41 : FixedLine maFtMapXmlDoc;
42 :
43 : FixedText maFtMappedCellTitle;
44 :
45 : ScXMLSourceTree maLbTree;
46 : formula::RefEdit maRefEdit;
47 : formula::RefButton maRefBtn;
48 :
49 : OKButton maBtnOk;
50 : CancelButton maBtnCancel;
51 :
52 : Image maImgFileOpen;
53 :
54 : rtl::OUString maSrcPath;
55 :
56 : ScOrcusXMLTreeParam maXMLParam;
57 : std::set<const SvTreeListEntry*> maCellLinks;
58 : std::set<const SvTreeListEntry*> maRangeLinks;
59 : std::vector<SvTreeListEntry*> maHighlightedEntries;
60 : SvTreeListEntry* mpCurRefEntry;
61 : boost::scoped_ptr<ScOrcusXMLContext> mpXMLContext;
62 :
63 : ScDocument* mpDoc;
64 :
65 : formula::RefEdit* mpActiveEdit;
66 : bool mbDlgLostFocus;
67 :
68 : public:
69 : ScXMLSourceDlg(
70 : SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc);
71 : virtual ~ScXMLSourceDlg();
72 :
73 : virtual sal_Bool IsRefInputMode() const;
74 : virtual void SetReference(const ScRange& rRange, ScDocument* pDoc);
75 : virtual void Deactivate();
76 : virtual void SetActive();
77 : virtual sal_Bool Close();
78 :
79 : private:
80 :
81 : void SelectSourceFile();
82 : void LoadSourceFileStructure(const OUString& rPath);
83 : void HandleGetFocus(Control* pCtrl);
84 : void HandleLoseFocus(Control* pCtrl);
85 : void TreeItemSelected();
86 : void DefaultElementSelected(SvTreeListEntry& rEntry);
87 : void RepeatElementSelected(SvTreeListEntry& rEntry);
88 : void AttributeSelected(SvTreeListEntry& rEntry);
89 :
90 : void SetNonLinkable();
91 : void SetSingleLinkable();
92 : void SetRangeLinkable();
93 : void SelectAllChildEntries(SvTreeListEntry& rEntry);
94 :
95 : /**
96 : * Check if any of its parents is linked or repeated. The passed entry is
97 : * not checked; its parent is the first one to be checked, then all its
98 : * parents get checked all the way to the root.
99 : */
100 : bool IsParentDirty(SvTreeListEntry* pEntry) const;
101 :
102 : bool IsChildrenDirty(SvTreeListEntry* pEntry) const;
103 :
104 : void OkPressed();
105 : void CancelPressed();
106 : void RefEditModified();
107 :
108 : DECL_LINK(GetFocusHdl, Control*);
109 : DECL_LINK(LoseFocusHdl, Control*);
110 : DECL_LINK(BtnPressedHdl, Button*);
111 : DECL_LINK(TreeItemSelectHdl, void*);
112 : DECL_LINK(RefModifiedHdl, void*);
113 : };
114 :
115 : #endif
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|