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/ctrlitem.hxx>
27 #include <sfx2/tbxctrl.hxx>
28 #include <sfx2/sidebar/ControllerItem.hxx>
29 #include <sfx2/sidebar/SidebarToolBox.hxx>
30 #include <sfx2/weldutils.hxx>
31 #include <svx/sidebar/PanelLayout.hxx>
32 #include "conttree.hxx"
38 class SwNavigationChild
;
40 class SwNavigationConfig
;
42 class SfxObjectShellLock
;
43 class SfxChildWindowContext
;
44 enum class RegionMode
;
47 class SwNavigationPI
: public PanelLayout
48 , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
51 friend class SwNavigationChild
;
52 friend class SwContentTree
;
53 friend class SwGlobalTree
;
54 friend class SwNavigationPIUIObject
;
56 ::sfx2::sidebar::ControllerItem m_aDocFullName
;
57 ::sfx2::sidebar::ControllerItem m_aPageStats
;
59 std::unique_ptr
<weld::Toolbar
> m_xContent1ToolBox
;
60 std::unique_ptr
<weld::Toolbar
> m_xContent2ToolBox
;
61 std::unique_ptr
<weld::Toolbar
> m_xContent3ToolBox
;
62 std::unique_ptr
<ToolbarUnoDispatcher
> m_xContent1Dispatch
;
63 std::unique_ptr
<weld::Menu
> m_xHeadingsMenu
;
64 std::unique_ptr
<weld::Menu
> m_xDragModeMenu
;
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_xEdit
;
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
;
75 OUString m_sContentFileName
;
76 OUString m_aStatusArr
[4];
78 std::unique_ptr
<SfxObjectShellLock
> m_pxObjectShell
;
79 SwView
*m_pContentView
;
80 SwWrtShell
*m_pContentWrtShell
;
81 SwView
*m_pActContView
;
82 SwView
*m_pCreateView
;
84 SwNavigationConfig
*m_pConfig
;
85 SfxBindings
&m_rBindings
;
87 RegionMode m_nRegionMode
; // 0 - URL, 1 - region with link 2 - region without link
90 bool m_bIsZoomedIn
: 1;
91 bool m_bGlobalMode
: 1;
93 bool IsZoomedIn() const {return m_bIsZoomedIn
;}
99 DECL_LINK( DocListBoxSelectHdl
, weld::ComboBox
&, void );
100 DECL_LINK( ToolBoxSelectHdl
, const OString
&, void );
101 DECL_LINK( ToolBoxClickHdl
, const OString
&, void );
102 DECL_LINK( ToolBox2DropdownClickHdl
, const OString
&, void );
103 DECL_LINK( ToolBox3DropdownClickHdl
, const OString
&, void );
104 DECL_LINK( DoneLink
, SfxPoolItem
const *, void );
105 DECL_LINK( DropModeMenuSelectHdl
, const OString
&, void );
106 DECL_LINK( HeadingsMenuSelectHdl
, const OString
&, void );
107 DECL_LINK( GlobalMenuSelectHdl
, const OString
&, void );
108 DECL_LINK( ChangePageHdl
, Timer
*, void );
109 DECL_LINK( PageEditModifyHdl
, weld::SpinButton
&, void );
115 // release ObjectShellLock early enough for app end
116 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
119 void SetGlobalMode(bool bSet
) {m_bGlobalMode
= bSet
;}
123 static VclPtr
<vcl::Window
> Create(vcl::Window
* pParent
,
124 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
125 SfxBindings
* pBindings
);
126 SwNavigationPI(vcl::Window
* pParent
,
127 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
128 SfxBindings
* _pBindings
);
129 virtual ~SwNavigationPI() override
;
130 virtual void dispose() override
;
132 void UpdateListBox();
133 void MoveOutline(SwOutlineNodes::size_type nSource
, SwOutlineNodes::size_type nTarget
);
135 virtual void NotifyItemUpdate(const sal_uInt16 nSId
,
136 const SfxItemState eState
,
137 const SfxPoolItem
* pState
) override
;
139 virtual void GetControlState(const sal_uInt16
/*nSId*/,
140 boost::property_tree::ptree
& /*rState*/) override
{};
142 virtual void StateChanged(StateChangedType nStateChange
) override
;
144 static OUString
CreateDropFileName( TransferableDataHelper
& rData
);
145 static OUString
CleanEntry(const OUString
& rEntry
);
147 RegionMode
GetRegionDropMode() const {return m_nRegionMode
;}
148 void SetRegionDropMode(RegionMode nNewMode
);
150 sal_Int8
AcceptDrop();
151 sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
153 bool IsGlobalDoc() const;
154 bool IsGlobalMode() const {return m_bGlobalMode
;}
156 SwView
* GetCreateView() const;
158 FactoryFunction
GetUITestFactory() const override
;
161 class SwNavigationChild
: public SfxChildWindowContext
164 SwNavigationChild( vcl::Window
* ,
169 static std::unique_ptr
<SfxChildWindowContext
> CreateImpl(vcl::Window
*pParent
,
170 SfxBindings
*pBindings
, SfxChildWinInfo
* pInfo
);
171 static void RegisterChildWindowContext(SfxModule
*pMod
);
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */