1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_NAVIPI_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_NAVIPI_HXX
22 #include <vcl/idle.hxx>
23 #include <svl/lstner.hxx>
24 #include <vcl/transfer.hxx>
25 #include <sfx2/childwin.hxx>
26 #include <sfx2/objsh.hxx>
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 #include <sfx2/navigat.hxx>
29 #include <sfx2/weldutils.hxx>
30 #include <sfx2/sidebar/PanelLayout.hxx>
31 #include "conttree.hxx"
38 class SwNavigationConfig
;
42 class SwNavigationPI final
: public PanelLayout
43 , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
46 friend class SwNavigatorWin
;
47 friend class SwContentTree
;
48 friend class SwGlobalTree
;
50 ::sfx2::sidebar::ControllerItem m_aDocFullName
;
51 ::sfx2::sidebar::ControllerItem m_aPageStats
;
52 ::sfx2::sidebar::ControllerItem m_aNavElement
;
54 css::uno::Reference
<css::frame::XFrame
> m_xFrame
;
56 std::unique_ptr
<weld::Toolbar
> m_xContent1ToolBox
;
57 std::unique_ptr
<weld::Toolbar
> m_xContent2ToolBox
;
58 std::unique_ptr
<weld::Toolbar
> m_xContent3ToolBox
;
59 std::unique_ptr
<weld::Toolbar
> m_xContent4ToolBox
;
60 std::unique_ptr
<weld::Toolbar
> m_xContent5ToolBox
;
61 std::unique_ptr
<weld::Toolbar
> m_xContent6ToolBox
;
62 std::unique_ptr
<ToolbarUnoDispatcher
> m_xContent2Dispatch
;
63 std::unique_ptr
<ToolbarUnoDispatcher
> m_xContent3Dispatch
;
64 std::unique_ptr
<weld::Menu
> m_xHeadingsMenu
;
65 std::unique_ptr
<weld::Menu
> m_xUpdateMenu
;
66 std::unique_ptr
<weld::Menu
> m_xInsertMenu
;
67 std::unique_ptr
<weld::Toolbar
> m_xGlobalToolBox
;
68 std::unique_ptr
<weld::SpinButton
> m_xGotoPageSpinButton
;
69 std::unique_ptr
<weld::Widget
> m_xContentBox
;
70 std::unique_ptr
<SwContentTree
> m_xContentTree
;
71 std::unique_ptr
<weld::Widget
> m_xGlobalBox
;
72 std::unique_ptr
<SwGlobalTree
> m_xGlobalTree
;
73 std::unique_ptr
<weld::ComboBox
> m_xDocListBox
;
74 OUString m_sContentFileName
;
76 VclPtr
<SfxNavigator
> m_xNavigatorDlg
;
78 std::optional
<SfxObjectShellLock
> m_oObjectShell
;
79 SwView
*m_pContentView
;
80 SwWrtShell
*m_pContentWrtShell
;
81 SwView
*m_pActContView
;
82 SwView
*m_pCreateView
;
84 SwNavigationConfig
*m_pConfig
;
85 SfxBindings
&m_rBindings
;
89 bool m_bIsZoomedIn
: 1;
90 bool m_bGlobalMode
: 1;
92 weld::ComboBox
* m_pNavigateByComboBox
;
94 std::unique_ptr
<weld::Toolbar
> m_xHeadingsContentFunctionsToolbar
;
95 std::unique_ptr
<weld::Toolbar
> m_xDeleteFunctionToolbar
;
96 std::unordered_map
<ContentTypeId
, std::unique_ptr
<weld::Toolbar
>> m_aContentTypeUnoToolbarMap
;
97 std::unordered_map
<ContentTypeId
, std::unique_ptr
<ToolbarUnoDispatcher
>> m_aContentTypeToolbarUnoDispatcherMap
;
98 std::unordered_map
<ContentTypeId
, std::unique_ptr
<weld::Toolbar
>> m_aContentUnoToolbarMap
;
99 std::unordered_map
<ContentTypeId
, std::unique_ptr
<ToolbarUnoDispatcher
>> m_aContentToolbarUnoDispatcherMap
;
100 void InitContentFunctionsToolbar();
101 void UpdateContentFunctionsToolbar();
102 DECL_LINK(ContentFunctionsToolbarSelectHdl
, const OUString
&, void );
104 bool IsZoomedIn() const {return m_bIsZoomedIn
;}
110 DECL_LINK( DocListBoxSelectHdl
, weld::ComboBox
&, void );
111 DECL_LINK( ToolBoxSelectHdl
, const OUString
&, void );
112 DECL_LINK( ToolBoxClickHdl
, const OUString
&, void );
113 DECL_LINK( ToolBox5DropdownClickHdl
, const OUString
&, void );
114 DECL_LINK( DoneLink
, SfxPoolItem
const *, void );
115 DECL_LINK( HeadingsMenuSelectHdl
, const OUString
&, void );
116 DECL_LINK( GlobalMenuSelectHdl
, const OUString
&, void );
117 DECL_LINK( SetFocusChildHdl
, weld::Container
&, void );
118 DECL_LINK( NavigateByComboBoxSelectHdl
, weld::ComboBox
&, void );
119 DECL_LINK(GotoPageSpinButtonValueChangedHdl
, weld::SpinButton
&, void);
121 void UpdateInitShow();
123 // release ObjectShellLock early enough for app end
124 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
127 void SetGlobalMode(bool bSet
) {m_bGlobalMode
= bSet
;}
129 void UpdateNavigateBy();
131 void SetContent3And4ToolBoxVisibility();
135 static std::unique_ptr
<PanelLayout
> Create(weld::Widget
* pParent
,
136 const css::uno::Reference
< css::frame::XFrame
>& rxFrame
,
137 SfxBindings
* pBindings
);
138 SwNavigationPI(weld::Widget
* pParent
,
139 const css::uno::Reference
< css::frame::XFrame
>& rxFrame
,
140 SfxBindings
* _pBindings
, SfxNavigator
* pNavigatorDlg
);
141 virtual ~SwNavigationPI() override
;
143 void UpdateListBox();
144 void MoveOutline(SwOutlineNodes::size_type nSource
, SwOutlineNodes::size_type nTarget
);
146 virtual void NotifyItemUpdate(const sal_uInt16 nSId
,
147 const SfxItemState eState
,
148 const SfxPoolItem
* pState
) override
;
150 virtual void GetControlState(const sal_uInt16
/*nSId*/,
151 boost::property_tree::ptree
& /*rState*/) override
{};
153 static OUString
CreateDropFileName( const TransferableDataHelper
& rData
);
154 static OUString
CleanEntry(const OUString
& rEntry
);
156 sal_Int8
AcceptDrop();
157 sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
159 bool IsGlobalDoc() const;
160 bool IsGlobalMode() const {return m_bGlobalMode
;}
162 SwView
* GetCreateView() const;
164 virtual weld::Window
* GetFrameWeld() const override
;
166 void SelectNavigateByContentType(const OUString
& rContentTypeName
);
169 class SwNavigatorWrapper final
: public SfxNavigatorWrapper
172 SwNavigatorWrapper(vcl::Window
*pParent
, sal_uInt16 nId
,
173 SfxBindings
* pBindings
, SfxChildWinInfo
* pInfo
);
174 SFX_DECL_CHILDWINDOW(SwNavigatorWrapper
);
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */