1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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 ************************************************************************/
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>
49 class ScScenarioWindow
;
50 class ScNavigatorControllerItem
;
51 class ScNavigatorDialogWrapper
;
53 class ScNavigatorSettings
;
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
75 explicit ScScenarioListBox( ScScenarioWindow
& rParent
);
76 virtual ~ScScenarioListBox();
78 void UpdateEntries( List
* pNewEntryList
);
81 virtual void Select();
82 virtual void DoubleClick();
83 virtual long Notify( NotifyEvent
& rNEvt
);
92 inline explicit ScenarioEntry() : mbProtected( false ) {}
94 typedef ::std::vector
< ScenarioEntry
> ScenarioList
;
97 const ScenarioEntry
* GetSelectedEntry() const;
99 void ExecuteScenarioSlot( USHORT nSlotId
);
100 void SelectScenario();
102 void DeleteScenario( bool bQueryBox
);
105 ScScenarioWindow
& mrParent
;
106 ScenarioList maEntries
;
109 //========================================================================
110 // class ScScenarioWindow ------------------------------------------------
111 //========================================================================
112 class ScScenarioWindow
: public Window
115 ScScenarioWindow( Window
* pParent
,const String
& aQH_List
,const String
& aQH_Comment
);
118 void NotifyState( const SfxPoolItem
* pState
);
119 void SetComment( const String
& rComment
)
120 { aEdComment
.SetText( rComment
); }
122 void SetSizePixel( const Size
& rNewSize
);
126 virtual void Paint( const Rectangle
& rRec
);
129 ScScenarioListBox aLbScenario
;
130 MultiLineEdit aEdComment
;
133 //==================================================================
135 //==================================================================
136 class ColumnEdit
: public SpinField
139 ColumnEdit( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
142 SCCOL
GetCol() { return nCol
; }
143 void SetCol( SCCOL nColNo
);
146 virtual long Notify( NotifyEvent
& rNEvt
);
147 virtual void LoseFocus();
150 virtual void First();
154 ScNavigatorDlg
& rDlg
;
160 SCCOL
AlphaToNum ( String
& rStr
);
161 SCCOL
NumStrToAlpha ( String
& rStr
);
162 SCCOL
NumToAlpha ( SCCOL nColNo
, String
& rStr
);
166 //==================================================================
168 //==================================================================
169 class RowEdit
: public NumericField
172 RowEdit( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
175 SCROW
GetRow() { return (SCROW
)GetValue(); }
176 void SetRow( SCROW nRow
){ SetValue( nRow
); }
179 virtual long Notify( NotifyEvent
& rNEvt
);
180 virtual void LoseFocus();
183 ScNavigatorDlg
& rDlg
;
189 //==================================================================
190 // class ScDocListBox
191 //==================================================================
192 class ScDocListBox
: public ListBox
195 ScDocListBox( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
199 virtual void Select();
202 ScNavigatorDlg
& rDlg
;
206 //==================================================================
207 // class CommandToolBox
208 //==================================================================
209 class CommandToolBox
: public ToolBox
212 CommandToolBox( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
215 void Select( USHORT nId
);
216 void UpdateButtons();
217 void InitImageList();
219 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
221 DECL_LINK( ToolBoxDropdownClickHdl
, ToolBox
* );
224 virtual void Select();
225 virtual void Click();
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
;
246 SfxBindings
& rBindings
; // must be first member
248 ImageList aCmdImageList
; // must be before aTbxCmd
249 ImageList aCmdImageListH
;
254 CommandToolBox aTbxCmd
;
255 ScContentTree aLbEntries
;
256 ScScenarioWindow aWndScenarios
;
257 ScDocListBox aLbDocuments
;
265 String aStrNotActive
;
267 String aStrActiveWin
;
269 SfxChildWindowContext
* pContextWin
;
272 ScViewData
* pViewData
;
275 long nListModeHeight
;
276 long nInitListHeight
;
277 NavListMode eListMode
;
284 ScNavigatorControllerItem
** ppBoundItems
;
286 DECL_LINK( TimeHdl
, Timer
* );
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();
304 void UpdateColumn ( const SCCOL
* pCol
= NULL
);
305 void UpdateRow ( const SCROW
* pRow
= NULL
);
306 void UpdateTable ( const SCTAB
* pTab
= NULL
);
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();
330 virtual void Resize();
331 virtual void Paint( const Rectangle
& rRec
);
332 virtual void Resizing( Size
& rSize
);
335 ScNavigatorDlg( SfxBindings
* pB
, SfxChildWindowContext
* pCW
, Window
* pParent
);
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
353 ScNavigatorDialogWrapper( Window
* pParent
,
355 SfxBindings
* pBindings
,
356 SfxChildWinInfo
* pInfo
);
358 SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper
)
360 virtual void Resizing( Size
& rSize
);
363 ScNavigatorDlg
* pNavigator
;
368 #endif // SC_NAVIPI_HXX