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 #pragma once
21 
22 #include <vcl/weld.hxx>
23 #include <address.hxx>
24 #include <tools/solar.h>
25 #include <o3tl/enumarray.hxx>
26 
27 class ScAreaLink;
28 class ScLinkTransferObj;
29 class ScDocument;
30 class ScDocShell;
31 class ScNavigatorDlg;
32 struct ImplSVEvent;
33 enum class SdrObjKind : sal_uInt16;
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;
59 
61 
63 
66  void ClearAll();
67  void InsertContent( ScContentId nType, const OUString& rValue );
69 
70  void GetTableNames();
71  void GetAreaNames();
72  void GetDbNames();
73  void GetLinkNames();
74  void GetGraphicNames();
75  void GetOleNames();
76  void GetDrawingNames();
77  void GetNoteStrings();
78 
79  static bool IsPartOfType( ScContentId nContentType, SdrObjKind nObjIdentifier );
80 
82  bool NoteStringsChanged();
83 
84  ScAddress GetNotePos( sal_uLong nIndex );
85  const ScAreaLink* GetLink( sal_uLong nIndex );
86 
91  void GetEntryIndexes(ScContentId& rnRootIndex, sal_uLong& rnChildIndex, const weld::TreeIter* pEntry) const;
92 
96  sal_uLong GetChildIndex(const weld::TreeIter* pEntry) const;
97 
99 
100  void freeze()
101  {
102  m_xTreeView->freeze();
103  m_bFreeze = true;
104  }
105 
106  void thaw()
107  {
108  m_xTreeView->thaw();
109  m_bFreeze = false;
110  }
111 
113 
114  DECL_LINK(ContentDoubleClickHdl, weld::TreeView&, bool);
115  DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
116  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
117  DECL_LINK(AsyncStoreNavigatorSettings, void*, void);
118  DECL_LINK(CommandHdl, const CommandEvent&, bool);
119  DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
120  DECL_LINK(DragBeginHdl, bool&, bool);
121 
122 public:
123  ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNavigatorDlg* pNavigatorDlg);
124  ~ScContentTree();
125 
126  void SetNavigatorDlgFlag(bool isInNavigateDlg){ bIsInNavigatorDlg=isInNavigateDlg;};
127 
128  void hide()
129  {
130  m_xTreeView->hide();
131  }
132 
133  void show()
134  {
135  m_xTreeView->show();
136  }
137 
139 
140  void ToggleRoot();
141  void SetRootType( ScContentId nNew );
142  ScContentId GetRootType() const { return nRootType; }
143 
144  // return true if Refresh was called to allow detecting that the navigator
145  // tree is now up to date
146  bool ActiveDocChanged();
147  void ResetManualDoc();
148  void SetManualDoc(const OUString& rName);
149  void LoadFile(const OUString& rUrl);
150  void SelectDoc(const OUString& rName);
151  void SelectEntryByName(const ScContentId nRoot, std::u16string_view rName);
152 
153  const OUString& GetHiddenTitle() const { return aHiddenTitle; }
154 
156  void ApplyNavigatorSettings();
158  void StoreNavigatorSettings();
159 };
160 
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bFreeze
Definition: content.hxx:57
static bool IsPartOfType(ScContentId nContentType, SdrObjKind nObjIdentifier)
Definition: content.cxx:796
ScAddress GetNotePos(sal_uLong nIndex)
Definition: content.cxx:971
DECL_LINK(ContentDoubleClickHdl, weld::TreeView &, bool)
void SetNavigatorDlgFlag(bool isInNavigateDlg)
Definition: content.hxx:126
const ScAreaLink * GetLink(sal_uLong nIndex)
Definition: content.cxx:915
void GetLinkNames()
Definition: content.cxx:892
sal_uIntPtr sal_uLong
bool NoteStringsChanged()
Definition: content.cxx:980
const OUString & GetHiddenTitle() const
Definition: content.hxx:153
void SetManualDoc(const OUString &rName)
Definition: content.cxx:1465
bool bHiddenDoc
Definition: content.hxx:52
o3tl::enumarray< ScContentId, sal_uInt16 > pPosList
Definition: content.hxx:60
ScContentId GetRootType() const
Definition: content.hxx:142
void GetAreaNames()
Definition: content.cxx:740
void ResetManualDoc()
Definition: content.cxx:1420
OUString aManualDoc
Definition: content.hxx:51
SdrObjKind
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: content.hxx:45
void show()
Definition: content.hxx:133
void GetOleNames()
Definition: content.cxx:882
void freeze()
Definition: content.hxx:100
OUString aHiddenName
Definition: content.hxx:53
OUString aHiddenTitle
Definition: content.hxx:54
void ApplyNavigatorSettings()
Applies the navigator settings to the listbox.
Definition: content.cxx:1551
rtl::Reference< ScLinkTransferObj > m_xTransferObj
Definition: content.hxx:47
void ClearAll()
Definition: content.cxx:199
void InitRoot(ScContentId nType)
Definition: content.cxx:179
void StoreNavigatorSettings()
Stores the current listbox state in the navigator settings.
Definition: content.cxx:1606
void GetGraphicNames()
Definition: content.cxx:877
ScContentId nRootType
Definition: content.hxx:50
bool ActiveDocChanged()
Definition: content.cxx:1428
void InsertContent(ScContentId nType, const OUString &rValue)
Definition: content.cxx:232
void hide()
Definition: content.hxx:128
ImplSVEvent * m_nAsyncMouseReleaseId
Definition: content.hxx:58
void GetNoteStrings()
Definition: content.cxx:950
ScDocShell * GetManualOrCurrent()
Definition: content.cxx:90
ScContentTree(std::unique_ptr< weld::TreeView > xTreeView, ScNavigatorDlg *pNavigatorDlg)
Definition: content.cxx:121
ScContentId
Definition: content.hxx:35
bool bIsInNavigatorDlg
Definition: content.hxx:56
sal_uLong GetChildIndex(const weld::TreeIter *pEntry) const
Returns the child index of the specified listbox entry.
Definition: content.cxx:293
void GetDbNames()
Definition: content.cxx:778
void GetDrawNames(ScContentId nType)
Definition: content.cxx:818
TABLE
std::unique_ptr< weld::TreeIter > m_xScratchIter
Definition: content.hxx:46
void GetDrawingNames()
Definition: content.cxx:887
void LaunchAsyncStoreNavigatorSettings()
Definition: content.cxx:400
void Refresh(ScContentId nType=ScContentId::ROOT)
Definition: content.cxx:668
void LoadFile(const OUString &rUrl)
Definition: content.cxx:1353
ScNavigatorDlg * pParentWindow
Definition: content.hxx:48
void SelectEntryByName(const ScContentId nRoot, std::u16string_view rName)
Definition: content.cxx:1523
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
void SetRootType(ScContentId nNew)
Definition: content.cxx:1380
void GetEntryIndexes(ScContentId &rnRootIndex, sal_uLong &rnChildIndex, const weld::TreeIter *pEntry) const
Returns the indexes of the specified listbox entry.
Definition: content.cxx:246
ScDocument * pHiddenDocument
Definition: content.hxx:55
ScDocument * GetSourceDocument()
Definition: content.cxx:654
void ClearType(ScContentId nType)
Definition: content.cxx:216
bool DrawNamesChanged(ScContentId nType)
Definition: content.cxx:1010
void GetTableNames()
Definition: content.cxx:714
void ToggleRoot()
Definition: content.cxx:1392
void SelectDoc(const OUString &rName)
Definition: content.cxx:1475
o3tl::enumarray< ScContentId, std::unique_ptr< weld::TreeIter > > m_aRootNodes
Definition: content.hxx:49
void thaw()
Definition: content.hxx:106
const sal_uLong SC_CONTENT_NOCHILD
Definition: content.hxx:41