Line data Source code
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 : #ifndef SD_NAVIGATOR_HXX
21 : #define SD_NAVIGATOR_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <vcl/lstbox.hxx>
25 : #include <vcl/toolbox.hxx>
26 : #include <sfx2/ctrlitem.hxx>
27 : #include "sdtreelb.hxx"
28 : #include "pres.hxx"
29 :
30 : #define NAVSTATE_NONE 0x00000000
31 :
32 : #define NAVBTN_PEN_ENABLED 0x00000010
33 : #define NAVBTN_PEN_DISABLED 0x00000020
34 : #define NAVBTN_PEN_CHECKED 0x00000040
35 : #define NAVBTN_PEN_UNCHECKED 0x00000080
36 :
37 : #define NAVTLB_UPDATE 0x00000100
38 :
39 : #define NAVBTN_FIRST_ENABLED 0x00001000
40 : #define NAVBTN_FIRST_DISABLED 0x00002000
41 : #define NAVBTN_PREV_ENABLED 0x00004000
42 : #define NAVBTN_PREV_DISABLED 0x00008000
43 :
44 : #define NAVBTN_LAST_ENABLED 0x00010000
45 : #define NAVBTN_LAST_DISABLED 0x00020000
46 : #define NAVBTN_NEXT_ENABLED 0x00040000
47 : #define NAVBTN_NEXT_DISABLED 0x00080000
48 :
49 : // forward
50 : namespace sd {
51 : class DrawDocShell;
52 : class NavigatorChildWindow;
53 : }
54 : class Menu;
55 : class SdNavigatorControllerItem;
56 : class SdPageNameControllerItem;
57 :
58 : //------------------------------------------------------------------------
59 :
60 : class NavDocInfo
61 : {
62 : public:
63 0 : NavDocInfo() { mpDocShell = NULL; }
64 :
65 0 : sal_Bool HasName() { return( (sal_Bool) bName ); }
66 0 : sal_Bool IsActive() { return( (sal_Bool) bActive ); }
67 :
68 0 : void SetName( sal_Bool bOn = sal_True ) { bName = bOn; }
69 0 : void SetActive( sal_Bool bOn = sal_True ) { bActive = bOn; }
70 :
71 : private:
72 : friend class SdNavigatorWin;
73 : sal_Bool bName : 1;
74 : sal_Bool bActive : 1;
75 : ::sd::DrawDocShell* mpDocShell;
76 : };
77 :
78 : //------------------------------------------------------------------------
79 :
80 : class SdNavigatorWin
81 : : public Window
82 : {
83 : public:
84 : SdNavigatorWin(
85 : ::Window* pParent,
86 : ::sd::NavigatorChildWindow* pChildWinContext,
87 : const SdResId& rSdResId,
88 : SfxBindings* pBindings );
89 : virtual ~SdNavigatorWin();
90 :
91 : virtual void KeyInput( const KeyEvent& rKEvt );
92 :
93 : void InitTreeLB( const SdDrawDocument* pDoc );
94 : void RefreshDocumentLB( const String* pDocName = NULL );
95 :
96 : sal_Bool InsertFile(const String& rFileName);
97 :
98 : NavigatorDragType GetNavigatorDragType();
99 : void SetNavigatorDragType(NavigatorDragType eType) { meDragType = eType; }
100 :
101 : protected:
102 : virtual void Resize();
103 : virtual long Notify(NotifyEvent& rNEvt);
104 :
105 :
106 : private:
107 : friend class ::sd::NavigatorChildWindow;
108 : friend class SdNavigatorControllerItem;
109 : friend class SdPageNameControllerItem;
110 :
111 : ToolBox maToolbox;
112 : SdPageObjsTLB maTlbObjects;
113 : ListBox maLbDocs;
114 :
115 : ::sd::NavigatorChildWindow* mpChildWinContext;
116 : Size maSize;
117 : Size maMinSize;
118 : sal_Bool mbDocImported;
119 : String maDropFileName;
120 : NavigatorDragType meDragType;
121 : std::vector<NavDocInfo> maDocList;
122 : SfxBindings* mpBindings;
123 : SdNavigatorControllerItem* mpNavigatorCtrlItem;
124 : SdPageNameControllerItem* mpPageNameCtrlItem;
125 :
126 : ImageList maImageList;
127 :
128 : /** This flag controls whether all shapes or only the named shapes are
129 : shown.
130 : */
131 : bool mbShowAllShapes;
132 :
133 : sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False );
134 : NavDocInfo* GetDocInfo();
135 :
136 : DECL_LINK( GetFocusObjectsHdl, void * );
137 : DECL_LINK( SelectToolboxHdl, void * );
138 : DECL_LINK(ClickToolboxHdl, void *);
139 : DECL_LINK( DropdownClickToolBoxHdl, ToolBox * );
140 : DECL_LINK( ClickPageHdl, void * );
141 : DECL_LINK( ClickObjectHdl, void * );
142 : DECL_LINK( SelectDocumentHdl, void * );
143 : DECL_LINK( MenuSelectHdl, Menu * );
144 : DECL_LINK( ShapeFilterCallback, Menu * );
145 :
146 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
147 : void SetDragImage();
148 : void ApplyImageList();
149 : };
150 :
151 :
152 :
153 :
154 : /*************************************************************************
155 : |*
156 : |* ControllerItem fuer Navigator
157 : |*
158 : \************************************************************************/
159 :
160 0 : class SdNavigatorControllerItem : public SfxControllerItem
161 : {
162 : public:
163 : SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
164 :
165 : protected:
166 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
167 : const SfxPoolItem* pState );
168 :
169 : private:
170 : SdNavigatorWin* pNavigatorWin;
171 : };
172 :
173 :
174 :
175 : /*************************************************************************
176 : |*
177 : |* ControllerItem fuer Navigator zum Anzeigen der Seite in der TreeLB
178 : |*
179 : \************************************************************************/
180 :
181 0 : class SdPageNameControllerItem : public SfxControllerItem
182 : {
183 : public:
184 : SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* );
185 :
186 : protected:
187 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
188 : const SfxPoolItem* pState );
189 :
190 : private:
191 : SdNavigatorWin* pNavigatorWin;
192 : };
193 :
194 : #endif
195 :
196 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|