tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / content.hxx
blobb57e49eb55f23adce8d9a4be088b5cce78561dbd
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 #pragma once
22 #include <vcl/weld.hxx>
23 #include <address.hxx>
24 #include <tools/solar.h>
25 #include <o3tl/enumarray.hxx>
27 class ScAreaLink;
28 class ScLinkTransferObj;
29 class ScDocument;
30 class ScDocShell;
31 class ScNavigatorDlg;
32 struct ImplSVEvent;
33 enum class SdrObjKind : sal_uInt16;
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 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 bIsInNavigatorDlg;
53 bool m_bFreeze;
54 ImplSVEvent* m_nAsyncMouseReleaseId;
56 o3tl::enumarray<ScContentId, sal_uInt16> pPosList; // for the sequence
58 std::unique_ptr<std::locale> m_pResLocaleForLOK; //it needed only in case of LOK
60 ScDocShell* GetManualOrCurrent();
62 void InitRoot(ScContentId nType);
63 void ClearType(ScContentId nType);
64 void ClearAll();
65 void InsertContent( ScContentId nType, const OUString& rValue );
66 void GetDrawNames( ScContentId nType );
68 void GetTableNames();
69 void GetAreaNames();
70 void GetDbNames();
71 void GetLinkNames();
72 void GetGraphicNames();
73 void GetOleNames();
74 void GetDrawingNames();
75 void GetNoteStrings();
77 static bool IsPartOfType( ScContentId nContentType, SdrObjKind nObjIdentifier );
79 bool DrawNamesChanged( ScContentId nType );
80 bool NoteStringsChanged();
82 ScAddress GetNotePos( sal_uLong nIndex );
83 const ScAreaLink* GetLink( sal_uLong nIndex );
85 /** Returns the indexes of the specified listbox entry.
86 @param rnRootIndex Root index of specified entry is returned.
87 @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
88 @param pEntry The entry to examine. */
89 void GetEntryIndexes(ScContentId& rnRootIndex, sal_uLong& rnChildIndex, const weld::TreeIter* pEntry) const;
91 /** Returns the child index of the specified listbox entry.
92 @param pEntry The entry to examine or NULL for the selected entry.
93 @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */
94 sal_uLong GetChildIndex(const weld::TreeIter* pEntry) const;
96 ScDocument* GetSourceDocument();
98 void freeze()
100 m_xTreeView->freeze();
101 m_bFreeze = true;
104 void thaw()
106 m_xTreeView->thaw();
107 m_bFreeze = false;
110 void LaunchAsyncStoreNavigatorSettings();
112 DECL_LINK(ContentDoubleClickHdl, weld::TreeView&, bool);
113 DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
114 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
115 DECL_LINK(AsyncStoreNavigatorSettings, void*, void);
116 DECL_LINK(CommandHdl, const CommandEvent&, bool);
117 DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
118 DECL_LINK(DragBeginHdl, bool&, bool);
120 public:
121 ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNavigatorDlg* pNavigatorDlg);
122 ~ScContentTree();
124 void SetNavigatorDlgFlag(bool isInNavigateDlg){ bIsInNavigatorDlg=isInNavigateDlg;};
126 void hide()
128 m_xTreeView->hide();
131 void show()
133 m_xTreeView->show();
136 void Refresh( ScContentId nType = ScContentId::ROOT );
138 void ToggleRoot();
139 void SetRootType( ScContentId nNew );
140 ScContentId GetRootType() const { return nRootType; }
142 // return true if Refresh was called to allow detecting that the navigator
143 // tree is now up to date
144 bool ActiveDocChanged();
145 void ResetManualDoc();
146 void SetManualDoc(const OUString& rName);
147 void SelectDoc(const OUString& rName);
148 void SelectEntryByName(const ScContentId nRoot, std::u16string_view rName);
150 /** Applies the navigator settings to the listbox. */
151 void ApplyNavigatorSettings();
152 /** Stores the current listbox state in the navigator settings. */
153 void StoreNavigatorSettings();
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */