nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / ui / inc / content.hxx
blob985b4665dfc8d73f349d8fc752b198608b02f5ed
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
23 #include <vcl/weld.hxx>
24 #include <address.hxx>
25 #include <tools/solar.h>
26 #include <o3tl/enumarray.hxx>
28 class ScAreaLink;
29 class ScLinkTransferObj;
30 class ScDocument;
31 class ScDocShell;
32 class ScNavigatorDlg;
33 struct ImplSVEvent;
35 enum class ScContentId {
36 ROOT, TABLE, RANGENAME, DBAREA,
37 GRAPHIC, OLEOBJECT, NOTE, AREALINK,
38 DRAWING, LAST = DRAWING
41 const sal_uLong SC_CONTENT_NOCHILD = ~0UL;
43 class ScContentTree
45 std::unique_ptr<weld::TreeView> m_xTreeView;
46 std::unique_ptr<weld::TreeIter> m_xScratchIter;
47 rtl::Reference<ScLinkTransferObj> m_xTransferObj;
48 VclPtr<ScNavigatorDlg> pParentWindow;
49 o3tl::enumarray<ScContentId, std::unique_ptr<weld::TreeIter>> m_aRootNodes;
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
56 bool bisInNavigatoeDlg;
57 bool m_bFreeze;
58 ImplSVEvent* m_nAsyncMouseReleaseId;
60 o3tl::enumarray<ScContentId, sal_uInt16> pPosList; // for the sequence
62 ScDocShell* GetManualOrCurrent();
64 void InitRoot(ScContentId nType);
65 void ClearType(ScContentId nType);
66 void ClearAll();
67 void InsertContent( ScContentId nType, const OUString& rValue );
68 void GetDrawNames( ScContentId nType );
70 void GetTableNames();
71 void GetAreaNames();
72 void GetDbNames();
73 void GetLinkNames();
74 void GetGraphicNames();
75 void GetOleNames();
76 void GetDrawingNames();
77 void GetNoteStrings();
79 static bool IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier );
81 bool DrawNamesChanged( ScContentId nType );
82 bool NoteStringsChanged();
84 ScAddress GetNotePos( sal_uLong nIndex );
85 const ScAreaLink* GetLink( sal_uLong nIndex );
87 /** Returns the indexes of the specified listbox entry.
88 @param rnRootIndex Root index of specified entry is returned.
89 @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
90 @param pEntry The entry to examine. */
91 void GetEntryIndexes(ScContentId& rnRootIndex, sal_uLong& rnChildIndex, const weld::TreeIter* pEntry) const;
93 /** Returns the child index of the specified listbox entry.
94 @param pEntry The entry to examine or NULL for the selected entry.
95 @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
96 sal_uLong GetChildIndex(const weld::TreeIter* pEntry) const;
98 ScDocument* GetSourceDocument();
100 void freeze()
102 m_xTreeView->freeze();
103 m_bFreeze = true;
106 void thaw()
108 m_xTreeView->thaw();
109 m_bFreeze = false;
112 void LaunchAsyncStoreNavigatorSettings();
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);
122 public:
123 ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNavigatorDlg* pNavigatorDlg);
124 ~ScContentTree();
126 void SetNavigatorDlgFlag(bool isInNavigateDlg){ bisInNavigatoeDlg=isInNavigateDlg;};
128 void set_selection_mode(SelectionMode eMode)
130 m_xTreeView->set_selection_mode(eMode);
133 void set_size_request(int nWidth, int nHeight)
135 m_xTreeView->set_size_request(nWidth, nHeight);
138 void hide()
140 m_xTreeView->hide();
143 void show()
145 m_xTreeView->show();
148 void Refresh( ScContentId nType = ScContentId::ROOT );
150 void ToggleRoot();
151 void SetRootType( ScContentId nNew );
152 ScContentId GetRootType() const { return nRootType; }
154 // return true if Refresh was called to allow detecting that the navigator
155 // tree is now up to date
156 bool 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);
163 const OUString& GetHiddenTitle() const { return aHiddenTitle; }
165 /** Applies the navigator settings to the listbox. */
166 void ApplyNavigatorSettings(bool bRestoreScrollPos = false, int nScrollPos = 0);
167 /** Stores the current listbox state in the navigator settings. */
168 void StoreNavigatorSettings();
171 #endif // INCLUDED_SC_SOURCE_UI_INC_CONTENT_HXX
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */