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 
34 enum class ScContentId {
37  DRAWING, LAST = DRAWING
38 };
39 
41 
43 {
44  std::unique_ptr<weld::TreeView> m_xTreeView;
45  std::unique_ptr<weld::TreeIter> m_xScratchIter;
49  ScContentId nRootType; // set as Root
50  OUString aManualDoc; // Switched in Navigator (Title)
51  bool bHiddenDoc; // Hidden active?
52  OUString aHiddenName; // URL to load
53  OUString aHiddenTitle; // for display
54  ScDocument* pHiddenDocument; // temporary
56  bool m_bFreeze;
58 
60 
62 
65  void ClearAll();
66  void InsertContent( ScContentId nType, const OUString& rValue );
68 
69  void GetTableNames();
70  void GetAreaNames();
71  void GetDbNames();
72  void GetLinkNames();
73  void GetGraphicNames();
74  void GetOleNames();
75  void GetDrawingNames();
76  void GetNoteStrings();
77 
78  static bool IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier );
79 
81  bool NoteStringsChanged();
82 
83  ScAddress GetNotePos( sal_uLong nIndex );
84  const ScAreaLink* GetLink( sal_uLong nIndex );
85 
90  void GetEntryIndexes(ScContentId& rnRootIndex, sal_uLong& rnChildIndex, const weld::TreeIter* pEntry) const;
91 
95  sal_uLong GetChildIndex(const weld::TreeIter* pEntry) const;
96 
98 
99  void freeze()
100  {
101  m_xTreeView->freeze();
102  m_bFreeze = true;
103  }
104 
105  void thaw()
106  {
107  m_xTreeView->thaw();
108  m_bFreeze = false;
109  }
110 
112 
113  DECL_LINK(ContentDoubleClickHdl, weld::TreeView&, bool);
114  DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
115  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
116  DECL_LINK(AsyncStoreNavigatorSettings, void*, void);
117  DECL_LINK(CommandHdl, const CommandEvent&, bool);
118  DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
119  DECL_LINK(DragBeginHdl, bool&, bool);
120 
121 public:
122  ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNavigatorDlg* pNavigatorDlg);
123  ~ScContentTree();
124 
125  void SetNavigatorDlgFlag(bool isInNavigateDlg){ bIsInNavigatorDlg=isInNavigateDlg;};
126 
127  void hide()
128  {
129  m_xTreeView->hide();
130  }
131 
132  void show()
133  {
134  m_xTreeView->show();
135  }
136 
138 
139  void ToggleRoot();
140  void SetRootType( ScContentId nNew );
141  ScContentId GetRootType() const { return nRootType; }
142 
143  // return true if Refresh was called to allow detecting that the navigator
144  // tree is now up to date
145  bool ActiveDocChanged();
146  void ResetManualDoc();
147  void SetManualDoc(const OUString& rName);
148  void LoadFile(const OUString& rUrl);
149  void SelectDoc(const OUString& rName);
150  void SelectEntryByName(const ScContentId nRoot, std::u16string_view rName);
151 
152  const OUString& GetHiddenTitle() const { return aHiddenTitle; }
153 
155  void ApplyNavigatorSettings(bool bRestoreScrollPos = false, int nScrollPos = 0);
157  void StoreNavigatorSettings();
158 };
159 
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bFreeze
Definition: content.hxx:56
ScAddress GetNotePos(sal_uLong nIndex)
Definition: content.cxx:967
DECL_LINK(ContentDoubleClickHdl, weld::TreeView &, bool)
void SetNavigatorDlgFlag(bool isInNavigateDlg)
Definition: content.hxx:125
const ScAreaLink * GetLink(sal_uLong nIndex)
Definition: content.cxx:916
void GetLinkNames()
Definition: content.cxx:893
sal_uIntPtr sal_uLong
bool NoteStringsChanged()
Definition: content.cxx:976
const OUString & GetHiddenTitle() const
Definition: content.hxx:152
void SetManualDoc(const OUString &rName)
Definition: content.cxx:1461
bool bHiddenDoc
Definition: content.hxx:51
o3tl::enumarray< ScContentId, sal_uInt16 > pPosList
Definition: content.hxx:59
ScContentId GetRootType() const
Definition: content.hxx:141
void GetAreaNames()
Definition: content.cxx:741
void ResetManualDoc()
Definition: content.cxx:1416
OUString aManualDoc
Definition: content.hxx:50
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: content.hxx:44
void show()
Definition: content.hxx:132
void GetOleNames()
Definition: content.cxx:883
void freeze()
Definition: content.hxx:99
void ApplyNavigatorSettings(bool bRestoreScrollPos=false, int nScrollPos=0)
Applies the navigator settings to the listbox.
Definition: content.cxx:1547
static bool IsPartOfType(ScContentId nContentType, sal_uInt16 nObjIdentifier)
Definition: content.cxx:797
OUString aHiddenName
Definition: content.hxx:52
OUString aHiddenTitle
Definition: content.hxx:53
rtl::Reference< ScLinkTransferObj > m_xTransferObj
Definition: content.hxx:46
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:1605
void GetGraphicNames()
Definition: content.cxx:878
ScContentId nRootType
Definition: content.hxx:49
bool ActiveDocChanged()
Definition: content.cxx:1424
void InsertContent(ScContentId nType, const OUString &rValue)
Definition: content.cxx:232
void hide()
Definition: content.hxx:127
ImplSVEvent * m_nAsyncMouseReleaseId
Definition: content.hxx:57
void GetNoteStrings()
Definition: content.cxx:951
ScDocShell * GetManualOrCurrent()
Definition: content.cxx:90
ScContentTree(std::unique_ptr< weld::TreeView > xTreeView, ScNavigatorDlg *pNavigatorDlg)
Definition: content.cxx:121
ScContentId
Definition: content.hxx:34
bool bIsInNavigatorDlg
Definition: content.hxx:55
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:779
void GetDrawNames(ScContentId nType)
Definition: content.cxx:819
std::unique_ptr< weld::TreeIter > m_xScratchIter
Definition: content.hxx:45
void GetDrawingNames()
Definition: content.cxx:888
void LaunchAsyncStoreNavigatorSettings()
Definition: content.cxx:400
void Refresh(ScContentId nType=ScContentId::ROOT)
Definition: content.cxx:669
void LoadFile(const OUString &rUrl)
Definition: content.cxx:1349
ScNavigatorDlg * pParentWindow
Definition: content.hxx:47
void SelectEntryByName(const ScContentId nRoot, std::u16string_view rName)
Definition: content.cxx:1519
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
void SetRootType(ScContentId nNew)
Definition: content.cxx:1376
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:54
ScDocument * GetSourceDocument()
Definition: content.cxx:655
void ClearType(ScContentId nType)
Definition: content.cxx:216
bool DrawNamesChanged(ScContentId nType)
Definition: content.cxx:1006
void GetTableNames()
Definition: content.cxx:715
void ToggleRoot()
Definition: content.cxx:1388
void SelectDoc(const OUString &rName)
Definition: content.cxx:1471
o3tl::enumarray< ScContentId, std::unique_ptr< weld::TreeIter > > m_aRootNodes
Definition: content.hxx:48
void thaw()
Definition: content.hxx:105
const sal_uLong SC_CONTENT_NOCHILD
Definition: content.hxx:40