bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / navigatr.hxx
blob3febf4d9eaed31eebf0731142a316bcb6bc8fc83
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 #ifndef INCLUDED_SD_SOURCE_UI_INC_NAVIGATR_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_NAVIGATR_HXX
23 #include <vcl/lstbox.hxx>
24 #include <vcl/toolbox.hxx>
25 #include <sfx2/ctrlitem.hxx>
26 #include <svx/sidebar/PanelLayout.hxx>
27 #include "sdtreelb.hxx"
28 #include <pres.hxx>
30 // forward
31 namespace vcl { class Window; }
33 namespace sd {
34 class DrawDocShell;
35 class NavigatorChildWindow;
37 class Menu;
38 class SdNavigatorControllerItem;
39 class SdPageNameControllerItem;
41 enum class NavState {
42 NONE = 0x000000,
43 TableUpdate = 0x000100,
44 BtnFirstEnabled = 0x001000,
45 BtnFirstDisabled = 0x002000,
46 BtnPrevEnabled = 0x004000,
47 BtnPrevDisabled = 0x008000,
48 BtnLastEnabled = 0x010000,
49 BtnLastDisabled = 0x020000,
50 BtnNextEnabled = 0x040000,
51 BtnNextDisabled = 0x080000,
53 namespace o3tl {
54 template<> struct typed_flags<NavState> : is_typed_flags<NavState, 0x0ff100> {};
57 class NavDocInfo
59 public:
60 NavDocInfo()
61 : bName(false)
62 , bActive(false)
63 , mpDocShell(nullptr)
67 bool HasName() { return bName; }
68 bool IsActive() { return bActive; }
70 void SetName( bool bOn ) { bName = bOn; }
71 void SetActive( bool bOn ) { bActive = bOn; }
73 private:
74 friend class SdNavigatorWin;
75 bool bName : 1;
76 bool bActive : 1;
77 ::sd::DrawDocShell* mpDocShell;
80 class SD_DLLPUBLIC SdNavigatorWin : public PanelLayout
82 public:
83 typedef ::std::function<void ()> UpdateRequestFunctor;
85 /** Create a new instance of the navigator.
86 @param bUseActiveUpdate
87 When <TRUE/>, the default, then the SdNavigatorWin object
88 will make a SID_NAVIGATOR_INIT call whenever it thinks an
89 update is necessary. When <FALSE/> the navigator will
90 rely on others to trigger updates.
92 SdNavigatorWin(vcl::Window* pParent, SfxBindings* pBindings);
93 void SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest);
94 virtual ~SdNavigatorWin() override;
95 virtual void dispose() override;
97 virtual void KeyInput( const KeyEvent& rKEvt ) override;
99 void InitTreeLB( const SdDrawDocument* pDoc );
100 void RefreshDocumentLB( const OUString* pDocName = nullptr );
102 bool InsertFile(const OUString& rFileName);
104 NavigatorDragType GetNavigatorDragType();
105 VclPtr<SdPageObjsTLB> const & GetObjects();
107 protected:
108 virtual bool EventNotify(NotifyEvent& rNEvt) override;
110 private:
111 friend class ::sd::NavigatorChildWindow;
112 friend class SdNavigatorControllerItem;
113 friend class SdPageNameControllerItem;
115 VclPtr<ToolBox> maToolbox;
116 VclPtr<SdPageObjsTLB> maTlbObjects;
117 VclPtr<ListBox> maLbDocs;
119 bool mbDocImported;
120 OUString maDropFileName;
121 NavigatorDragType meDragType;
122 std::vector<NavDocInfo> maDocList;
123 SfxBindings* mpBindings;
124 std::unique_ptr<SdNavigatorControllerItem> mpNavigatorCtrlItem;
125 std::unique_ptr<SdPageNameControllerItem> mpPageNameCtrlItem;
127 /** This flag controls whether all shapes or only the named shapes are
128 shown.
130 // bool mbShowAllShapes;
132 static const char* GetDragTypeSdStrId(NavigatorDragType eDT);
133 static OUString GetDragTypeSdBmpId(NavigatorDragType eDT);
134 NavDocInfo* GetDocInfo();
136 DECL_LINK( SelectToolboxHdl, ToolBox *, void );
137 DECL_LINK( DropdownClickToolBoxHdl, ToolBox *, void );
138 DECL_LINK( ClickObjectHdl, SvTreeListBox*, bool );
139 DECL_LINK( SelectDocumentHdl, ListBox&, void );
140 DECL_LINK( MenuSelectHdl, Menu *, bool );
141 DECL_LINK( ShapeFilterCallback, Menu *, bool );
143 void SetDragImage();
145 public:
146 //when object is marked , fresh the corresponding entry tree .
147 void FreshTree ( const SdDrawDocument* pDoc );
148 void FreshEntry( );
152 * ControllerItem for Navigator
154 class SdNavigatorControllerItem : public SfxControllerItem
156 public:
157 SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*,
158 const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest);
160 protected:
161 virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
162 const SfxPoolItem* pState ) override;
164 private:
165 VclPtr<SdNavigatorWin> pNavigatorWin;
166 const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
170 * ControllerItem for Navigator to show the page in the TreeLB
172 class SdPageNameControllerItem : public SfxControllerItem
174 public:
175 SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*);
177 protected:
178 virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
179 const SfxPoolItem* pState ) override;
181 private:
182 VclPtr<SdNavigatorWin> pNavigatorWin;
185 #endif
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */