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
;
40 enum class RegionMode
;
43 class SwNavigationPI final
: public PanelLayout
44 , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
47 friend class SwNavigatorWin
;
48 friend class SwContentTree
;
49 friend class SwGlobalTree
;
51 ::sfx2::sidebar::ControllerItem m_aDocFullName
;
52 ::sfx2::sidebar::ControllerItem m_aPageStats
;
54 std::unique_ptr
<weld::Toolbar
> m_xContent1ToolBox
;
55 std::unique_ptr
<weld::Toolbar
> m_xContent2ToolBox
;
56 std::unique_ptr
<weld::Toolbar
> m_xContent3ToolBox
;
57 std::unique_ptr
<weld::Toolbar
> m_xContent4ToolBox
;
58 std::unique_ptr
<weld::Toolbar
> m_xContent5ToolBox
;
59 std::unique_ptr
<weld::Toolbar
> m_xContent6ToolBox
;
60 std::unique_ptr
<ToolbarUnoDispatcher
> m_xContent2Dispatch
;
61 std::unique_ptr
<ToolbarUnoDispatcher
> m_xContent3Dispatch
;
62 std::unique_ptr
<weld::Menu
> m_xHeadingsMenu
;
63 std::unique_ptr
<weld::Menu
> m_xDragModeMenu
;
64 std::unique_ptr
<weld::Menu
> m_xUpdateMenu
;
65 std::unique_ptr
<weld::Menu
> m_xInsertMenu
;
66 std::unique_ptr
<weld::Toolbar
> m_xGlobalToolBox
;
67 std::unique_ptr
<weld::SpinButton
> m_xEdit
;
68 std::unique_ptr
<weld::Widget
> m_xContentBox
;
69 std::unique_ptr
<SwContentTree
> m_xContentTree
;
70 std::unique_ptr
<weld::Widget
> m_xGlobalBox
;
71 std::unique_ptr
<SwGlobalTree
> m_xGlobalTree
;
72 std::unique_ptr
<weld::ComboBox
> m_xDocListBox
;
74 OUString m_sContentFileName
;
75 OUString m_aStatusArr
[4];
77 VclPtr
<SfxNavigator
> m_xNavigatorDlg
;
79 std::optional
<SfxObjectShellLock
> m_oObjectShell
;
80 SwView
*m_pContentView
;
81 SwWrtShell
*m_pContentWrtShell
;
82 SwView
*m_pActContView
;
83 SwView
*m_pCreateView
;
85 SwNavigationConfig
*m_pConfig
;
86 SfxBindings
&m_rBindings
;
88 RegionMode m_nRegionMode
; // 0 - URL, 1 - region with link 2 - region without link
91 bool m_bIsZoomedIn
: 1;
92 bool m_bGlobalMode
: 1;
94 weld::ComboBox
* m_pNavigateByComboBox
;
96 bool IsZoomedIn() const {return m_bIsZoomedIn
;}
102 DECL_LINK( DocListBoxSelectHdl
, weld::ComboBox
&, void );
103 DECL_LINK( ToolBoxSelectHdl
, const OUString
&, void );
104 DECL_LINK( ToolBoxClickHdl
, const OUString
&, void );
105 DECL_LINK( ToolBox5DropdownClickHdl
, const OUString
&, void );
106 DECL_LINK( ToolBox6DropdownClickHdl
, const OUString
&, void );
107 DECL_LINK( DoneLink
, SfxPoolItem
const *, void );
108 DECL_LINK( DropModeMenuSelectHdl
, const OUString
&, void );
109 DECL_LINK( HeadingsMenuSelectHdl
, const OUString
&, void );
110 DECL_LINK( GlobalMenuSelectHdl
, const OUString
&, void );
111 DECL_LINK( ChangePageHdl
, Timer
*, void );
112 DECL_LINK( PageEditModifyHdl
, weld::SpinButton
&, void );
113 DECL_LINK( EditActionHdl
, weld::Entry
&, bool );
114 DECL_LINK( SetFocusChildHdl
, weld::Container
&, void );
115 DECL_LINK( NavigateByComboBoxSelectHdl
, weld::ComboBox
&, void );
120 void UpdateInitShow();
122 // release ObjectShellLock early enough for app end
123 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
126 void SetGlobalMode(bool bSet
) {m_bGlobalMode
= bSet
;}
128 void UpdateNavigateBy();
132 static std::unique_ptr
<PanelLayout
> Create(weld::Widget
* pParent
,
133 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
134 SfxBindings
* pBindings
);
135 SwNavigationPI(weld::Widget
* pParent
,
136 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
137 SfxBindings
* _pBindings
, SfxNavigator
* pNavigatorDlg
);
138 virtual ~SwNavigationPI() override
;
140 void UpdateListBox();
141 void MoveOutline(SwOutlineNodes::size_type nSource
, SwOutlineNodes::size_type nTarget
);
143 virtual void NotifyItemUpdate(const sal_uInt16 nSId
,
144 const SfxItemState eState
,
145 const SfxPoolItem
* pState
) override
;
147 virtual void GetControlState(const sal_uInt16
/*nSId*/,
148 boost::property_tree::ptree
& /*rState*/) override
{};
150 static OUString
CreateDropFileName( const TransferableDataHelper
& rData
);
151 static OUString
CleanEntry(const OUString
& rEntry
);
153 RegionMode
GetRegionDropMode() const {return m_nRegionMode
;}
154 void SetRegionDropMode(RegionMode nNewMode
);
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: */