update dev300-m58
[ooovba.git] / sc / source / ui / inc / navipi.hxx
blob99c4417bb47dc5cebf59dfa3848ae8b6c82e56be
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: navipi.hxx,v $
10 * $Revision: 1.13.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_NAVIPI_HXX
32 #define SC_NAVIPI_HXX
34 #include <vector>
35 #include <vcl/toolbox.hxx>
36 #include <vcl/field.hxx>
37 #include <vcl/lstbox.hxx>
38 #include <svtools/stdctrl.hxx>
39 #include <svtools/poolitem.hxx>
40 #include <svtools/lstner.hxx>
41 #include <sfx2/childwin.hxx>
42 #include "content.hxx"
43 #include <svtools/svmedit.hxx>
46 class ScTabViewShell;
47 class ScViewData;
48 class ScArea;
49 class ScScenarioWindow;
50 class ScNavigatorControllerItem;
51 class ScNavigatorDialogWrapper;
52 class ScNavigatorDlg;
53 class ScNavigatorSettings;
54 class ScRange;
56 //========================================================================
58 #define SC_DROPMODE_URL 0
59 #define SC_DROPMODE_LINK 1
60 #define SC_DROPMODE_COPY 2
62 enum NavListMode { NAV_LMODE_NONE = 0x4000,
63 NAV_LMODE_AREAS = 0x2000,
64 NAV_LMODE_DBAREAS = 0x1000,
65 NAV_LMODE_DOCS = 0x800,
66 NAV_LMODE_SCENARIOS = 0x400 };
68 //========================================================================
69 // class ScScenarioListBox -----------------------------------------------
70 //========================================================================
72 class ScScenarioListBox : public ListBox
74 public:
75 explicit ScScenarioListBox( ScScenarioWindow& rParent );
76 virtual ~ScScenarioListBox();
78 void UpdateEntries( List* pNewEntryList );
80 protected:
81 virtual void Select();
82 virtual void DoubleClick();
83 virtual long Notify( NotifyEvent& rNEvt );
85 private:
86 struct ScenarioEntry
88 String maName;
89 String maComment;
90 bool mbProtected;
92 inline explicit ScenarioEntry() : mbProtected( false ) {}
94 typedef ::std::vector< ScenarioEntry > ScenarioList;
96 private:
97 const ScenarioEntry* GetSelectedEntry() const;
99 void ExecuteScenarioSlot( USHORT nSlotId );
100 void SelectScenario();
101 void EditScenario();
102 void DeleteScenario( bool bQueryBox );
104 private:
105 ScScenarioWindow& mrParent;
106 ScenarioList maEntries;
109 //========================================================================
110 // class ScScenarioWindow ------------------------------------------------
111 //========================================================================
112 class ScScenarioWindow : public Window
114 public:
115 ScScenarioWindow( Window* pParent,const String& aQH_List,const String& aQH_Comment);
116 ~ScScenarioWindow();
118 void NotifyState( const SfxPoolItem* pState );
119 void SetComment( const String& rComment )
120 { aEdComment.SetText( rComment ); }
122 void SetSizePixel( const Size& rNewSize );
124 protected:
126 virtual void Paint( const Rectangle& rRec );
128 private:
129 ScScenarioListBox aLbScenario;
130 MultiLineEdit aEdComment;
133 //==================================================================
134 // class ColumnEdit
135 //==================================================================
136 class ColumnEdit : public SpinField
138 public:
139 ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId );
140 ~ColumnEdit();
142 SCCOL GetCol() { return nCol; }
143 void SetCol( SCCOL nColNo );
145 protected:
146 virtual long Notify( NotifyEvent& rNEvt );
147 virtual void LoseFocus();
148 virtual void Up();
149 virtual void Down();
150 virtual void First();
151 virtual void Last();
153 private:
154 ScNavigatorDlg& rDlg;
155 SCCOL nCol;
156 USHORT nKeyGroup;
158 void EvalText ();
159 void ExecuteCol ();
160 SCCOL AlphaToNum ( String& rStr );
161 SCCOL NumStrToAlpha ( String& rStr );
162 SCCOL NumToAlpha ( SCCOL nColNo, String& rStr );
166 //==================================================================
167 // class RowEdit
168 //==================================================================
169 class RowEdit : public NumericField
171 public:
172 RowEdit( ScNavigatorDlg* pParent, const ResId& rResId );
173 ~RowEdit();
175 SCROW GetRow() { return (SCROW)GetValue(); }
176 void SetRow( SCROW nRow ){ SetValue( nRow ); }
178 protected:
179 virtual long Notify( NotifyEvent& rNEvt );
180 virtual void LoseFocus();
182 private:
183 ScNavigatorDlg& rDlg;
185 void ExecuteRow();
189 //==================================================================
190 // class ScDocListBox
191 //==================================================================
192 class ScDocListBox : public ListBox
194 public:
195 ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId );
196 ~ScDocListBox();
198 protected:
199 virtual void Select();
201 private:
202 ScNavigatorDlg& rDlg;
206 //==================================================================
207 // class CommandToolBox
208 //==================================================================
209 class CommandToolBox : public ToolBox
211 public:
212 CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId );
213 ~CommandToolBox();
215 void Select( USHORT nId );
216 void UpdateButtons();
217 void InitImageList();
219 virtual void DataChanged( const DataChangedEvent& rDCEvt );
221 DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* );
223 protected:
224 virtual void Select();
225 virtual void Click();
227 private:
228 ScNavigatorDlg& rDlg;
231 //==================================================================
232 // class ScNavigatorDlg
233 //==================================================================
235 class ScNavigatorDlg : public Window, public SfxListener
237 friend class ScNavigatorControllerItem;
238 friend class ScNavigatorDialogWrapper;
239 friend class ColumnEdit;
240 friend class RowEdit;
241 friend class ScDocListBox;
242 friend class CommandToolBox;
243 friend class ScContentTree;
245 private:
246 SfxBindings& rBindings; // must be first member
248 ImageList aCmdImageList; // must be before aTbxCmd
249 ImageList aCmdImageListH;
250 FixedInfo aFtCol;
251 ColumnEdit aEdCol;
252 FixedInfo aFtRow;
253 RowEdit aEdRow;
254 CommandToolBox aTbxCmd;
255 ScContentTree aLbEntries;
256 ScScenarioWindow aWndScenarios;
257 ScDocListBox aLbDocuments;
259 Timer aContentTimer;
261 String aTitleBase;
262 String aStrDragMode;
263 String aStrDisplay;
264 String aStrActive;
265 String aStrNotActive;
266 String aStrHidden;
267 String aStrActiveWin;
269 SfxChildWindowContext* pContextWin;
270 Size aInitSize;
271 ScArea* pMarkArea;
272 ScViewData* pViewData;
274 long nBorderOffset;
275 long nListModeHeight;
276 long nInitListHeight;
277 NavListMode eListMode;
278 USHORT nDropMode;
279 SCCOL nCurCol;
280 SCROW nCurRow;
281 SCTAB nCurTab;
282 BOOL bFirstBig;
284 ScNavigatorControllerItem** ppBoundItems;
286 DECL_LINK( TimeHdl, Timer* );
288 void DoResize();
290 SfxBindings& GetBindings()
291 { return rBindings; }
293 void SetCurrentCell( SCCOL nCol, SCROW Row );
294 void SetCurrentCellStr( const String rName );
295 void SetCurrentTable( SCTAB nTab );
296 void SetCurrentTableStr( const String rName );
297 void SetCurrentObject( const String rName );
298 void SetCurrentDoc( const String& rDocName );
300 ScTabViewShell* GetTabViewShell() const;
301 ScNavigatorSettings* GetNavigatorSettings();
302 BOOL GetViewData();
304 void UpdateColumn ( const SCCOL* pCol = NULL );
305 void UpdateRow ( const SCROW* pRow = NULL );
306 void UpdateTable ( const SCTAB* pTab = NULL );
307 void UpdateAll ();
309 void GetDocNames(const String* pSelEntry = NULL);
311 void SetListMode ( NavListMode eMode, BOOL bSetSize = TRUE );
312 void ShowList ( BOOL bShow, BOOL bSetSize );
313 void ShowScenarios ( BOOL bShow, BOOL bSetSize );
315 void SetDropMode(USHORT nNew);
316 USHORT GetDropMode() const { return nDropMode; }
318 const String& GetStrDragMode() const { return aStrDragMode; }
319 const String& GetStrDisplay() const { return aStrDisplay; }
321 void CheckDataArea ();
322 void MarkDataArea ();
323 void UnmarkDataArea ();
324 void StartOfDataArea ();
325 void EndOfDataArea ();
327 static void ReleaseFocus();
329 protected:
330 virtual void Resize();
331 virtual void Paint( const Rectangle& rRec );
332 virtual void Resizing( Size& rSize );
334 public:
335 ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent );
336 ~ScNavigatorDlg();
338 using Window::Notify;
339 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
341 void CursorPosChanged();
343 virtual SfxChildAlignment
344 CheckAlignment(SfxChildAlignment,SfxChildAlignment);
345 virtual void DataChanged( const DataChangedEvent& rDCEvt );
348 //==================================================================
350 class ScNavigatorDialogWrapper: public SfxChildWindowContext
352 public:
353 ScNavigatorDialogWrapper( Window* pParent,
354 USHORT nId,
355 SfxBindings* pBindings,
356 SfxChildWinInfo* pInfo );
358 SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper)
360 virtual void Resizing( Size& rSize );
362 private:
363 ScNavigatorDlg* pNavigator;
368 #endif // SC_NAVIPI_HXX