LibreOffice Module sd (master) 1
navigatr.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sfx2/ctrlitem.hxx>
24#include <sfx2/navigat.hxx>
25#include "sdtreelb.hxx"
26#include <pres.hxx>
27
28// forward
29namespace vcl { class Window; }
30
31namespace sd {
32class DrawDocShell;
33class SdNavigatorFloat;
34}
35class Menu;
38
39enum class NavState {
40 NONE = 0x000000,
41 TableUpdate = 0x000100,
42 BtnFirstEnabled = 0x001000,
43 BtnFirstDisabled = 0x002000,
44 BtnPrevEnabled = 0x004000,
45 BtnPrevDisabled = 0x008000,
46 BtnLastEnabled = 0x010000,
47 BtnLastDisabled = 0x020000,
48 BtnNextEnabled = 0x040000,
49 BtnNextDisabled = 0x080000,
50};
51namespace o3tl {
52 template<> struct typed_flags<NavState> : is_typed_flags<NavState, 0x0ff100> {};
53}
54
56{
57public:
59 : bName(false)
60 , bActive(false)
61 , mpDocShell(nullptr)
62 {
63 }
64
65 bool HasName() const { return bName; }
66 bool IsActive() const { return bActive; }
67
68 void SetName( bool bOn ) { bName = bOn; }
69 void SetActive( bool bOn ) { bActive = bOn; }
70
72
73private:
74 friend class SdNavigatorWin;
75 bool bName : 1;
76 bool bActive : 1;
78};
79
80namespace sd {
81
82class SdNavigatorFloat final : public SfxNavigator
83{
84private:
85 std::unique_ptr<SdNavigatorWin> m_xNavWin;
87
88public:
90 vcl::Window* pParent, SfxChildWinInfo* pInfo);
91 void InitTreeLB(const SdDrawDocument* pDoc);
92 void FreshTree(const SdDrawDocument* pDoc);
93 virtual void Activate() override;
94 virtual void dispose() override;
95 virtual ~SdNavigatorFloat() override;
96};
97
98}
99
101{
102public:
103 typedef ::std::function<void ()> UpdateRequestFunctor;
104
112 SdNavigatorWin(weld::Widget* pParent, SfxBindings* pBindings, SfxNavigator* pNavigatorDlg);
113 void SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest);
114 virtual ~SdNavigatorWin() override;
115
116 void InitTreeLB( const SdDrawDocument* pDoc );
117 void RefreshDocumentLB( const OUString* pDocName = nullptr );
118 void FirstFocus();
119
120 bool InsertFile(const OUString& rFileName);
121
122 NavigatorDragType GetNavigatorDragType();
123 SdPageObjsTLV& GetObjects();
124
125private:
126 friend class SdNavigatorFloat;
129
130 std::unique_ptr<weld::Toolbar> mxToolbox;
131 std::unique_ptr<SdPageObjsTLV> mxTlbObjects;
132 std::unique_ptr<weld::ComboBox> mxLbDocs;
133 std::unique_ptr<weld::Menu> mxDragModeMenu;
134 std::unique_ptr<weld::Menu> mxShapeMenu;
135
137
141 std::vector<NavDocInfo> maDocList;
143 std::unique_ptr<SdNavigatorControllerItem> mpNavigatorCtrlItem;
144 std::unique_ptr<SdPageNameControllerItem> mpPageNameCtrlItem;
145
149 // bool mbShowAllShapes;
150
151 static OUString GetDragTypeSdBmpId(NavigatorDragType eDT);
152 NavDocInfo* GetDocInfo();
153
154 DECL_DLLPRIVATE_LINK( SelectToolboxHdl, const OUString&, void );
155 DECL_DLLPRIVATE_LINK( DropdownClickToolBoxHdl, const OUString&, void );
156 DECL_DLLPRIVATE_LINK( ClickObjectHdl, weld::TreeView&, bool );
157 DECL_DLLPRIVATE_LINK( SelectDocumentHdl, weld::ComboBox&, void );
158 DECL_DLLPRIVATE_LINK( MenuSelectHdl, const OUString&, void );
159 DECL_DLLPRIVATE_LINK( ShapeFilterCallback, const OUString&, void );
160 DECL_DLLPRIVATE_LINK( KeyInputHdl, const KeyEvent&, bool );
162 DECL_LINK(CommandHdl, const CommandEvent&, bool);
163
164 void SetDragImage();
165
166 void ExecuteContextMenuAction(std::u16string_view rSelectedPopupEntry);
167
168public:
169 //when object is marked , fresh the corresponding entry tree .
170 void FreshTree ( const SdDrawDocument* pDoc );
171
172 virtual weld::Window* GetFrameWeld() const override;
173};
174
179{
180public:
183
184protected:
185 virtual void StateChangedAtToolBoxControl( sal_uInt16 nSId, SfxItemState eState,
186 const SfxPoolItem* pState ) override;
187
188private:
191};
192
197{
198public:
200
201protected:
202 virtual void StateChangedAtToolBoxControl( sal_uInt16 nSId, SfxItemState eState,
203 const SfxPoolItem* pState ) override;
204
205private:
207};
208
209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::sd::DrawDocShell * mpDocShell
Definition: navigatr.hxx:77
bool bActive
Definition: navigatr.hxx:76
bool IsActive() const
Definition: navigatr.hxx:66
void SetName(bool bOn)
Definition: navigatr.hxx:68
bool bName
Definition: navigatr.hxx:75
bool HasName() const
Definition: navigatr.hxx:65
void SetActive(bool bOn)
Definition: navigatr.hxx:69
::sd::DrawDocShell * GetDrawDocShell()
Definition: navigatr.hxx:71
virtual weld::Window * GetFrameWeld() const
ControllerItem for Navigator.
Definition: navigatr.hxx:179
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem *pState) override
Definition: navigatr.cxx:764
SdNavigatorWin * pNavigatorWin
Definition: navigatr.hxx:189
SdNavigatorControllerItem(sal_uInt16, SdNavigatorWin *, SfxBindings *, SdNavigatorWin::UpdateRequestFunctor aUpdateRequest)
ControllerItem for Navigator.
Definition: navigatr.cxx:753
const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest
Definition: navigatr.hxx:190
DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent &, bool)
std::unique_ptr< weld::Menu > mxDragModeMenu
Definition: navigatr.hxx:133
DECL_DLLPRIVATE_STATIC_LINK(SdNavigatorWin, MouseReleaseHdl, const MouseEvent &, bool)
std::unique_ptr< weld::Menu > mxShapeMenu
Definition: navigatr.hxx:134
std::vector< NavDocInfo > maDocList
Definition: navigatr.hxx:141
DECL_DLLPRIVATE_LINK(SelectDocumentHdl, weld::ComboBox &, void)
DECL_DLLPRIVATE_LINK(ShapeFilterCallback, const OUString &, void)
DECL_LINK(CommandHdl, const CommandEvent &, bool)
std::unique_ptr< weld::ComboBox > mxLbDocs
Definition: navigatr.hxx:132
std::unique_ptr< SdPageObjsTLV > mxTlbObjects
Definition: navigatr.hxx:131
DECL_DLLPRIVATE_LINK(MenuSelectHdl, const OUString &, void)
NavigatorDragType meDragType
Definition: navigatr.hxx:140
std::unique_ptr< SdPageNameControllerItem > mpPageNameCtrlItem
Definition: navigatr.hxx:144
bool mbDocImported
Definition: navigatr.hxx:138
VclPtr< SfxNavigator > mxNavigatorDlg
Definition: navigatr.hxx:136
OUString maDropFileName
Definition: navigatr.hxx:139
std::unique_ptr< weld::Toolbar > mxToolbox
Definition: navigatr.hxx:130
::std::function< void()> UpdateRequestFunctor
Definition: navigatr.hxx:103
SfxBindings * mpBindings
Definition: navigatr.hxx:142
DECL_DLLPRIVATE_LINK(DropdownClickToolBoxHdl, const OUString &, void)
DECL_DLLPRIVATE_LINK(SelectToolboxHdl, const OUString &, void)
DECL_DLLPRIVATE_LINK(ClickObjectHdl, weld::TreeView &, bool)
std::unique_ptr< SdNavigatorControllerItem > mpNavigatorCtrlItem
Definition: navigatr.hxx:143
ControllerItem for Navigator to show the page in the TreeLB.
Definition: navigatr.hxx:197
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem *pState) override
Definition: navigatr.cxx:844
SdPageNameControllerItem(sal_uInt16, SdNavigatorWin *, SfxBindings *)
ControllerItem for Navigator to show page in TreeLB.
Definition: navigatr.cxx:835
SdNavigatorWin * pNavigatorWin
Definition: navigatr.hxx:206
SfxChildWindow * pMgr
bool m_bSetInitialFocusOnActivate
Definition: navigatr.hxx:86
void InitTreeLB(const SdDrawDocument *pDoc)
virtual ~SdNavigatorFloat() override
void FreshTree(const SdDrawDocument *pDoc)
SdNavigatorFloat(SfxBindings *_pBindings, SfxChildWindow *pMgr, vcl::Window *pParent, SfxChildWinInfo *pInfo)
virtual void dispose() override
std::unique_ptr< SdNavigatorWin > m_xNavWin
Definition: navigatr.hxx:85
virtual void Activate() override
NONE
void InsertFile(SwUnoCursor *pUnoCursor, const OUString &rURL, const css::uno::Sequence< css::beans::PropertyValue > &rOptions)
NavState
Definition: navigatr.hxx:39
@ BtnNextEnabled
@ BtnPrevEnabled
@ BtnFirstDisabled
@ BtnPrevDisabled
@ BtnFirstEnabled
@ BtnLastDisabled
@ BtnNextDisabled
@ BtnLastEnabled
SfxItemState
NavigatorDragType
Definition: pres.hxx:65
#define SD_DLLPUBLIC
Definition: sddllapi.h:27