Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_NAVIPI_HXX
30 : : #define SC_NAVIPI_HXX
31 : :
32 : : #include <vector>
33 : : #include <vcl/toolbox.hxx>
34 : : #include <vcl/field.hxx>
35 : : #include <vcl/lstbox.hxx>
36 : : #include <svtools/stdctrl.hxx>
37 : : #include <svl/poolitem.hxx>
38 : : #include <svl/lstner.hxx>
39 : : #include <sfx2/childwin.hxx>
40 : : #include "content.hxx"
41 : : #include <svtools/svmedit.hxx>
42 : :
43 : :
44 : : class ScTabViewShell;
45 : : class ScViewData;
46 : : class ScArea;
47 : : class ScScenarioWindow;
48 : : class ScNavigatorControllerItem;
49 : : class ScNavigatorDialogWrapper;
50 : : class ScNavigatorDlg;
51 : : class ScNavigatorSettings;
52 : :
53 : : //========================================================================
54 : :
55 : : #define SC_DROPMODE_URL 0
56 : : #define SC_DROPMODE_LINK 1
57 : : #define SC_DROPMODE_COPY 2
58 : :
59 : : enum NavListMode { NAV_LMODE_NONE = 0x4000,
60 : : NAV_LMODE_AREAS = 0x2000,
61 : : NAV_LMODE_DBAREAS = 0x1000,
62 : : NAV_LMODE_DOCS = 0x800,
63 : : NAV_LMODE_SCENARIOS = 0x400 };
64 : :
65 : : //========================================================================
66 : : // class ScScenarioListBox -----------------------------------------------
67 : : //========================================================================
68 : :
69 : : class ScScenarioListBox : public ListBox
70 : : {
71 : : public:
72 : : explicit ScScenarioListBox( ScScenarioWindow& rParent );
73 : : virtual ~ScScenarioListBox();
74 : :
75 : : void UpdateEntries( const std::vector<String> &aNewEntryList );
76 : :
77 : : protected:
78 : : virtual void Select();
79 : : virtual void DoubleClick();
80 : : virtual long Notify( NotifyEvent& rNEvt );
81 : :
82 : : private:
83 [ # # ][ # # ]: 0 : struct ScenarioEntry
84 : : {
85 : : String maName;
86 : : String maComment;
87 : : bool mbProtected;
88 : :
89 [ # # ]: 0 : inline explicit ScenarioEntry() : mbProtected( false ) {}
90 : : };
91 : : typedef ::std::vector< ScenarioEntry > ScenarioList;
92 : :
93 : : private:
94 : : const ScenarioEntry* GetSelectedEntry() const;
95 : :
96 : : void ExecuteScenarioSlot( sal_uInt16 nSlotId );
97 : : void SelectScenario();
98 : : void EditScenario();
99 : : void DeleteScenario( bool bQueryBox );
100 : :
101 : : private:
102 : : ScScenarioWindow& mrParent;
103 : : ScenarioList maEntries;
104 : : };
105 : :
106 : : //========================================================================
107 : : // class ScScenarioWindow ------------------------------------------------
108 : : //========================================================================
109 : : class ScScenarioWindow : public Window
110 : : {
111 : : public:
112 : : ScScenarioWindow( Window* pParent,const String& aQH_List,const String& aQH_Comment);
113 : : ~ScScenarioWindow();
114 : :
115 : : void NotifyState( const SfxPoolItem* pState );
116 : 0 : void SetComment( const String& rComment )
117 : 0 : { aEdComment.SetText( rComment ); }
118 : :
119 : : void SetSizePixel( const Size& rNewSize );
120 : :
121 : : protected:
122 : :
123 : : virtual void Paint( const Rectangle& rRec );
124 : :
125 : : private:
126 : : ScScenarioListBox aLbScenario;
127 : : MultiLineEdit aEdComment;
128 : : };
129 : :
130 : : //==================================================================
131 : : // class ColumnEdit
132 : : //==================================================================
133 : : class ColumnEdit : public SpinField
134 : : {
135 : : public:
136 : : ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId );
137 : : ~ColumnEdit();
138 : :
139 : 0 : SCCOL GetCol() { return nCol; }
140 : : void SetCol( SCCOL nColNo );
141 : :
142 : : protected:
143 : : virtual long Notify( NotifyEvent& rNEvt );
144 : : virtual void LoseFocus();
145 : : virtual void Up();
146 : : virtual void Down();
147 : : virtual void First();
148 : : virtual void Last();
149 : :
150 : : private:
151 : : ScNavigatorDlg& rDlg;
152 : : SCCOL nCol;
153 : : sal_uInt16 nKeyGroup;
154 : :
155 : : void EvalText ();
156 : : void ExecuteCol ();
157 : : SCCOL AlphaToNum ( String& rStr );
158 : : SCCOL NumStrToAlpha ( String& rStr );
159 : : SCCOL NumToAlpha ( SCCOL nColNo, String& rStr );
160 : : };
161 : :
162 : :
163 : : //==================================================================
164 : : // class RowEdit
165 : : //==================================================================
166 : : class RowEdit : public NumericField
167 : : {
168 : : public:
169 : : RowEdit( ScNavigatorDlg* pParent, const ResId& rResId );
170 : : ~RowEdit();
171 : :
172 : 0 : SCROW GetRow() { return (SCROW)GetValue(); }
173 : 0 : void SetRow( SCROW nRow ){ SetValue( nRow ); }
174 : :
175 : : protected:
176 : : virtual long Notify( NotifyEvent& rNEvt );
177 : : virtual void LoseFocus();
178 : :
179 : : private:
180 : : ScNavigatorDlg& rDlg;
181 : :
182 : : void ExecuteRow();
183 : : };
184 : :
185 : :
186 : : //==================================================================
187 : : // class ScDocListBox
188 : : //==================================================================
189 : : class ScDocListBox : public ListBox
190 : : {
191 : : public:
192 : : ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId );
193 : : ~ScDocListBox();
194 : :
195 : : protected:
196 : : virtual void Select();
197 : :
198 : : private:
199 : : ScNavigatorDlg& rDlg;
200 : : };
201 : :
202 : :
203 : : //==================================================================
204 : : // class CommandToolBox
205 : : //==================================================================
206 : : class CommandToolBox : public ToolBox
207 : : {
208 : : public:
209 : : CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId );
210 : : ~CommandToolBox();
211 : :
212 : : void Select( sal_uInt16 nId );
213 : : void UpdateButtons();
214 : : void InitImageList();
215 : :
216 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
217 : :
218 : : DECL_LINK( ToolBoxDropdownClickHdl, void* );
219 : :
220 : : protected:
221 : : virtual void Select();
222 : : virtual void Click();
223 : :
224 : : private:
225 : : ScNavigatorDlg& rDlg;
226 : : };
227 : :
228 : : //==================================================================
229 : : // class ScNavigatorDlg
230 : : //==================================================================
231 : :
232 : : class ScNavigatorDlg : public Window, public SfxListener
233 : : {
234 : : friend class ScNavigatorControllerItem;
235 : : friend class ScNavigatorDialogWrapper;
236 : : friend class ColumnEdit;
237 : : friend class RowEdit;
238 : : friend class ScDocListBox;
239 : : friend class CommandToolBox;
240 : : friend class ScContentTree;
241 : :
242 : : private:
243 : : SfxBindings& rBindings; // must be first member
244 : :
245 : : ImageList aCmdImageList; // must be before aTbxCmd
246 : : FixedInfo aFtCol;
247 : : ColumnEdit aEdCol;
248 : : FixedInfo aFtRow;
249 : : RowEdit aEdRow;
250 : : CommandToolBox aTbxCmd;
251 : : ScContentTree aLbEntries;
252 : : ScScenarioWindow aWndScenarios;
253 : : ScDocListBox aLbDocuments;
254 : :
255 : : Timer aContentTimer;
256 : :
257 : : String aTitleBase;
258 : : String aStrDragMode;
259 : : String aStrDisplay;
260 : : String aStrActive;
261 : : String aStrNotActive;
262 : : String aStrHidden;
263 : : String aStrActiveWin;
264 : :
265 : : SfxChildWindowContext* pContextWin;
266 : : Size aInitSize;
267 : : ScArea* pMarkArea;
268 : : ScViewData* pViewData;
269 : :
270 : : long nBorderOffset;
271 : : long nListModeHeight;
272 : : long nInitListHeight;
273 : : NavListMode eListMode;
274 : : sal_uInt16 nDropMode;
275 : : SCCOL nCurCol;
276 : : SCROW nCurRow;
277 : : SCTAB nCurTab;
278 : : sal_Bool bFirstBig;
279 : :
280 : : ScNavigatorControllerItem** ppBoundItems;
281 : :
282 : : DECL_LINK( TimeHdl, Timer* );
283 : :
284 : : void DoResize();
285 : :
286 : : SfxBindings& GetBindings()
287 : : { return rBindings; }
288 : :
289 : : void SetCurrentCell( SCCOL nCol, SCROW Row );
290 : : void SetCurrentCellStr( const String rName );
291 : : void SetCurrentTable( SCTAB nTab );
292 : : void SetCurrentTableStr( const rtl::OUString& rName );
293 : : void SetCurrentObject( const String rName );
294 : : void SetCurrentDoc( const String& rDocName );
295 : :
296 : : ScTabViewShell* GetTabViewShell() const;
297 : : ScNavigatorSettings* GetNavigatorSettings();
298 : : sal_Bool GetViewData();
299 : :
300 : : void UpdateColumn ( const SCCOL* pCol = NULL );
301 : : void UpdateRow ( const SCROW* pRow = NULL );
302 : : void UpdateTable ( const SCTAB* pTab = NULL );
303 : : void UpdateAll ();
304 : :
305 : : void GetDocNames(const String* pSelEntry = NULL);
306 : :
307 : : void SetListMode ( NavListMode eMode, sal_Bool bSetSize = sal_True );
308 : : void ShowList ( sal_Bool bShow, sal_Bool bSetSize );
309 : : void ShowScenarios ( sal_Bool bShow, sal_Bool bSetSize );
310 : :
311 : : void SetDropMode(sal_uInt16 nNew);
312 : 0 : sal_uInt16 GetDropMode() const { return nDropMode; }
313 : :
314 : 0 : const String& GetStrDragMode() const { return aStrDragMode; }
315 : 0 : const String& GetStrDisplay() const { return aStrDisplay; }
316 : :
317 : : void CheckDataArea ();
318 : : void MarkDataArea ();
319 : : void UnmarkDataArea ();
320 : : void StartOfDataArea ();
321 : : void EndOfDataArea ();
322 : :
323 : : static void ReleaseFocus();
324 : :
325 : : protected:
326 : : virtual void Resize();
327 : : virtual void Paint( const Rectangle& rRec );
328 : : virtual void Resizing( Size& rSize );
329 : :
330 : : public:
331 : : ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent );
332 : : ~ScNavigatorDlg();
333 : :
334 : : using Window::Notify;
335 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
336 : :
337 : : void CursorPosChanged();
338 : :
339 : : virtual SfxChildAlignment
340 : : CheckAlignment(SfxChildAlignment,SfxChildAlignment);
341 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
342 : : };
343 : :
344 : : //==================================================================
345 : :
346 [ # # ]: 0 : class ScNavigatorDialogWrapper: public SfxChildWindowContext
347 : : {
348 : : public:
349 : : ScNavigatorDialogWrapper( Window* pParent,
350 : : sal_uInt16 nId,
351 : : SfxBindings* pBindings,
352 : : SfxChildWinInfo* pInfo );
353 : :
354 : : SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper)
355 : :
356 : : virtual void Resizing( Size& rSize );
357 : :
358 : : private:
359 : : ScNavigatorDlg* pNavigator;
360 : : };
361 : :
362 : :
363 : :
364 : : #endif // SC_NAVIPI_HXX
365 : :
366 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|