LibreOffice Module sc (master)  1
content.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  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
22 
23 #include <vcl/weld.hxx>
24 #include <address.hxx>
25 #include <tools/solar.h>
26 #include <o3tl/enumarray.hxx>
27 
28 class ScAreaLink;
29 class ScLinkTransferObj;
30 class ScDocument;
31 class ScDocShell;
32 class ScNavigatorDlg;
33 struct ImplSVEvent;
34 
35 enum class ScContentId {
38  DRAWING, LAST = DRAWING
39 };
40 
42 
44 {
45  std::unique_ptr<weld::TreeView> m_xTreeView;
46  std::unique_ptr<weld::TreeIter> m_xScratchIter;
50  ScContentId nRootType; // set as Root
51  OUString aManualDoc; // Switched in Navigator (Title)
52  bool bHiddenDoc; // Hidden active?
53  OUString aHiddenName; // URL to load
54  OUString aHiddenTitle; // for display
55  ScDocument* pHiddenDocument; // temporary
57  bool m_bFreeze;
58  OUString sKeyString;
60 
62 
64 
67  void ClearAll();
68  void InsertContent( ScContentId nType, const OUString& rValue );
70 
71  void GetTableNames();
72  void GetAreaNames();
73  void GetDbNames();
74  void GetLinkNames();
75  void GetGraphicNames();
76  void GetOleNames();
77  void GetDrawingNames();
78  void GetNoteStrings();
79 
80  static bool IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier );
81 
83  bool NoteStringsChanged();
84 
85  ScAddress GetNotePos( sal_uLong nIndex );
86  const ScAreaLink* GetLink( sal_uLong nIndex );
87 
92  void GetEntryIndexes(ScContentId& rnRootIndex, sal_uLong& rnChildIndex, const weld::TreeIter* pEntry) const;
93 
97  sal_uLong GetChildIndex(const weld::TreeIter* pEntry) const;
98 
100 
101  void freeze()
102  {
103  m_xTreeView->freeze();
104  m_bFreeze = true;
105  }
106 
107  void thaw()
108  {
109  m_xTreeView->thaw();
110  m_bFreeze = false;
111  }
112 
114 
115  DECL_LINK(ContentDoubleClickHdl, weld::TreeView&, bool);
116  DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
117  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
118  DECL_LINK(AsyncStoreNavigatorSettings, void*, void);
119  DECL_LINK(CommandHdl, const CommandEvent&, bool);
120  DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
121  DECL_LINK(DragBeginHdl, bool&, bool);
122 
123 public:
124  ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNavigatorDlg* pNavigatorDlg);
125  ~ScContentTree();
126 
127  void ObjectFresh(ScContentId nType, const weld::TreeIter* pEntry = nullptr);
128  void SetNavigatorDlgFlag(bool isInNavigateDlg){ bisInNavigatoeDlg=isInNavigateDlg;};
129 
131  {
132  m_xTreeView->set_selection_mode(eMode);
133  }
134 
135  void set_size_request(int nWidth, int nHeight)
136  {
137  m_xTreeView->set_size_request(nWidth, nHeight);
138  }
139 
140  void hide()
141  {
142  m_xTreeView->hide();
143  }
144 
145  void show()
146  {
147  m_xTreeView->show();
148  }
149 
151 
152  void ToggleRoot();
153  void SetRootType( ScContentId nNew );
154  ScContentId GetRootType() const { return nRootType; }
155 
156  void ActiveDocChanged();
157  void ResetManualDoc();
158  void SetManualDoc(const OUString& rName);
159  void LoadFile(const OUString& rUrl);
160  void SelectDoc(const OUString& rName);
161  void SelectEntryByName(const ScContentId nRoot, const OUString& rName);
162 
163  const OUString& GetHiddenTitle() const { return aHiddenTitle; }
164 
166  void ApplyNavigatorSettings(bool bRestoreScrollPos = false, int nScrollPos = 0);
168  void StoreNavigatorSettings() const;
169 };
170 
171 #endif // INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
172 
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bFreeze
Definition: content.hxx:57
ScAddress GetNotePos(sal_uLong nIndex)
Definition: content.cxx:997
bool bisInNavigatoeDlg
Definition: content.hxx:56
DECL_LINK(ContentDoubleClickHdl, weld::TreeView &, bool)
void SetNavigatorDlgFlag(bool isInNavigateDlg)
Definition: content.hxx:128
const ScAreaLink * GetLink(sal_uLong nIndex)
Definition: content.cxx:946
void GetLinkNames()
Definition: content.cxx:923
sal_uIntPtr sal_uLong
bool NoteStringsChanged()
Definition: content.cxx:1006
VclPtr< ScNavigatorDlg > pParentWindow
Definition: content.hxx:48
const OUString & GetHiddenTitle() const
Definition: content.hxx:163
void SetManualDoc(const OUString &rName)
Definition: content.cxx:1483
bool bHiddenDoc
Definition: content.hxx:52
SelectionMode
o3tl::enumarray< ScContentId, sal_uInt16 > pPosList
Definition: content.hxx:61
ScContentId GetRootType() const
Definition: content.hxx:154
void GetAreaNames()
Definition: content.cxx:778
void ResetManualDoc()
Definition: content.cxx:1446
OUString aManualDoc
Definition: content.hxx:51
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: content.hxx:45
void show()
Definition: content.hxx:145
void GetOleNames()
Definition: content.cxx:913
void freeze()
Definition: content.hxx:101
void ApplyNavigatorSettings(bool bRestoreScrollPos=false, int nScrollPos=0)
Applies the navigator settings to the listbox.
Definition: content.cxx:1569
static bool IsPartOfType(ScContentId nContentType, sal_uInt16 nObjIdentifier)
Definition: content.cxx:834
OUString aHiddenName
Definition: content.hxx:53
OUString aHiddenTitle
Definition: content.hxx:54
void ActiveDocChanged()
Definition: content.cxx:1454
rtl::Reference< ScLinkTransferObj > m_xTransferObj
Definition: content.hxx:47
void ClearAll()
Definition: content.cxx:191
void InitRoot(ScContentId nType)
Definition: content.cxx:171
void GetGraphicNames()
Definition: content.cxx:908
ScContentId nRootType
Definition: content.hxx:50
void InsertContent(ScContentId nType, const OUString &rValue)
Definition: content.cxx:224
void hide()
Definition: content.hxx:140
ImplSVEvent * m_nAsyncMouseReleaseId
Definition: content.hxx:59
void GetNoteStrings()
Definition: content.cxx:981
ScDocShell * GetManualOrCurrent()
Definition: content.cxx:86
void ObjectFresh(ScContentId nType, const weld::TreeIter *pEntry=nullptr)
Definition: content.cxx:657
void set_selection_mode(SelectionMode eMode)
Definition: content.hxx:130
ScContentTree(std::unique_ptr< weld::TreeView > xTreeView, ScNavigatorDlg *pNavigatorDlg)
Definition: content.cxx:117
ScContentId
Definition: content.hxx:35
sal_uLong GetChildIndex(const weld::TreeIter *pEntry) const
Returns the child index of the specified listbox entry.
Definition: content.cxx:285
void GetDbNames()
Definition: content.cxx:816
void GetDrawNames(ScContentId nType)
Definition: content.cxx:854
std::unique_ptr< weld::TreeIter > m_xScratchIter
Definition: content.hxx:46
void GetDrawingNames()
Definition: content.cxx:918
void LaunchAsyncStoreNavigatorSettings()
Definition: content.cxx:386
void Refresh(ScContentId nType=ScContentId::ROOT)
Definition: content.cxx:706
void LoadFile(const OUString &rUrl)
Definition: content.cxx:1379
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
void SetRootType(ScContentId nNew)
Definition: content.cxx:1406
void GetEntryIndexes(ScContentId &rnRootIndex, sal_uLong &rnChildIndex, const weld::TreeIter *pEntry) const
Returns the indexes of the specified listbox entry.
Definition: content.cxx:238
ScDocument * pHiddenDocument
Definition: content.hxx:55
OUString sKeyString
Definition: content.hxx:58
ScDocument * GetSourceDocument()
Definition: content.cxx:642
void SelectEntryByName(const ScContentId nRoot, const OUString &rName)
Definition: content.cxx:1541
void ClearType(ScContentId nType)
Definition: content.cxx:208
bool DrawNamesChanged(ScContentId nType)
Definition: content.cxx:1036
void GetTableNames()
Definition: content.cxx:752
void StoreNavigatorSettings() const
Stores the current listbox state in the navigator settings.
Definition: content.cxx:1627
void ToggleRoot()
Definition: content.cxx:1418
void SelectDoc(const OUString &rName)
Definition: content.cxx:1493
o3tl::enumarray< ScContentId, std::unique_ptr< weld::TreeIter > > m_aRootNodes
Definition: content.hxx:49
void set_size_request(int nWidth, int nHeight)
Definition: content.hxx:135
void thaw()
Definition: content.hxx:107
const sal_uLong SC_CONTENT_NOCHILD
Definition: content.hxx:41