1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
24 #include <vcl/toolbox.hxx>
25 #include <vcl/field.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <svtools/stdctrl.hxx>
28 #include <svl/poolitem.hxx>
29 #include <svl/lstner.hxx>
30 #include <sfx2/childwin.hxx>
31 #include "content.hxx"
32 #include <svtools/svmedit.hxx>
38 class ScScenarioWindow
;
39 class ScNavigatorControllerItem
;
40 class ScNavigatorDialogWrapper
;
42 class ScNavigatorSettings
;
44 //========================================================================
46 #define SC_DROPMODE_URL 0
47 #define SC_DROPMODE_LINK 1
48 #define SC_DROPMODE_COPY 2
50 enum NavListMode
{ NAV_LMODE_NONE
= 0x4000,
51 NAV_LMODE_AREAS
= 0x2000,
52 NAV_LMODE_DBAREAS
= 0x1000,
53 NAV_LMODE_DOCS
= 0x800,
54 NAV_LMODE_SCENARIOS
= 0x400 };
56 //========================================================================
57 // class ScScenarioListBox -----------------------------------------------
58 //========================================================================
60 class ScScenarioListBox
: public ListBox
63 explicit ScScenarioListBox( ScScenarioWindow
& rParent
);
64 virtual ~ScScenarioListBox();
66 void UpdateEntries( const std::vector
<OUString
> &aNewEntryList
);
69 virtual void Select();
70 virtual void DoubleClick();
71 virtual long Notify( NotifyEvent
& rNEvt
);
80 inline explicit ScenarioEntry() : mbProtected( false ) {}
82 typedef ::std::vector
< ScenarioEntry
> ScenarioList
;
85 const ScenarioEntry
* GetSelectedEntry() const;
87 void ExecuteScenarioSlot( sal_uInt16 nSlotId
);
88 void SelectScenario();
90 void DeleteScenario( bool bQueryBox
);
93 ScScenarioWindow
& mrParent
;
94 ScenarioList maEntries
;
97 //========================================================================
98 // class ScScenarioWindow ------------------------------------------------
99 //========================================================================
100 class ScScenarioWindow
: public Window
103 ScScenarioWindow( Window
* pParent
, const OUString
& aQH_List
, const OUString
& aQH_Comment
);
106 void NotifyState( const SfxPoolItem
* pState
);
107 void SetComment( const OUString
& rComment
)
108 { aEdComment
.SetText( rComment
); }
110 void SetSizePixel( const Size
& rNewSize
);
114 virtual void Paint( const Rectangle
& rRect
);
117 ScScenarioListBox aLbScenario
;
118 MultiLineEdit aEdComment
;
121 //==================================================================
123 //==================================================================
124 class ColumnEdit
: public SpinField
127 ColumnEdit( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
130 SCCOL
GetCol() { return nCol
; }
131 void SetCol( SCCOL nColNo
);
134 virtual long Notify( NotifyEvent
& rNEvt
);
135 virtual void LoseFocus();
138 virtual void First();
142 ScNavigatorDlg
& rDlg
;
144 sal_uInt16 nKeyGroup
;
148 SCCOL
AlphaToNum ( OUString
& rStr
);
149 SCCOL
NumStrToAlpha ( OUString
& rStr
);
150 SCCOL
NumToAlpha ( SCCOL nColNo
, OUString
& rStr
);
154 //==================================================================
156 //==================================================================
157 class RowEdit
: public NumericField
160 RowEdit( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
163 SCROW
GetRow() { return (SCROW
)GetValue(); }
164 void SetRow( SCROW nRow
){ SetValue( nRow
); }
167 virtual long Notify( NotifyEvent
& rNEvt
);
168 virtual void LoseFocus();
171 ScNavigatorDlg
& rDlg
;
177 //==================================================================
178 // class ScDocListBox
179 //==================================================================
180 class ScDocListBox
: public ListBox
183 ScDocListBox( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
187 virtual void Select();
190 ScNavigatorDlg
& rDlg
;
194 //==================================================================
195 // class CommandToolBox
196 //==================================================================
197 class CommandToolBox
: public ToolBox
200 CommandToolBox( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
203 void Select( sal_uInt16 nId
);
204 void UpdateButtons();
205 void InitImageList();
207 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
209 DECL_LINK( ToolBoxDropdownClickHdl
, void* );
212 virtual void Select();
213 virtual void Click();
216 ScNavigatorDlg
& rDlg
;
219 //==================================================================
220 // class ScNavigatorDlg
221 //==================================================================
223 class ScNavigatorDlg
: public Window
, public SfxListener
225 friend class ScNavigatorControllerItem
;
226 friend class ScNavigatorDialogWrapper
;
227 friend class ColumnEdit
;
228 friend class RowEdit
;
229 friend class ScDocListBox
;
230 friend class CommandToolBox
;
231 friend class ScContentTree
;
234 SfxBindings
& rBindings
; // must be first member
236 ImageList aCmdImageList
; // must be before aTbxCmd
241 CommandToolBox aTbxCmd
;
242 ScContentTree aLbEntries
;
243 ScScenarioWindow aWndScenarios
;
244 ScDocListBox aLbDocuments
;
249 OUString aStrDragMode
;
250 OUString aStrDisplay
;
252 OUString aStrNotActive
;
254 OUString aStrActiveWin
;
256 SfxChildWindowContext
* pContextWin
;
259 ScViewData
* pViewData
;
262 long nListModeHeight
;
263 long nInitListHeight
;
264 NavListMode eListMode
;
265 sal_uInt16 nDropMode
;
270 bool mbUseStyleSettingsBackground
;
272 ScNavigatorControllerItem
** ppBoundItems
;
274 DECL_LINK( TimeHdl
, Timer
* );
278 SfxBindings
& GetBindings()
279 { return rBindings
; }
281 void SetCurrentCell( SCCOL nCol
, SCROW Row
);
282 void SetCurrentCellStr( const OUString rName
);
283 void SetCurrentTable( SCTAB nTab
);
284 void SetCurrentTableStr( const OUString
& rName
);
285 void SetCurrentObject( const OUString rName
);
286 void SetCurrentDoc( const OUString
& rDocName
);
288 ScTabViewShell
* GetTabViewShell() const;
289 ScNavigatorSettings
* GetNavigatorSettings();
290 sal_Bool
GetViewData();
292 void UpdateColumn ( const SCCOL
* pCol
= NULL
);
293 void UpdateRow ( const SCROW
* pRow
= NULL
);
294 void UpdateTable ( const SCTAB
* pTab
= NULL
);
297 void GetDocNames(const OUString
* pSelEntry
= NULL
);
299 void SetListMode ( NavListMode eMode
, sal_Bool bSetSize
= sal_True
);
300 void ShowList ( sal_Bool bShow
, sal_Bool bSetSize
);
301 void ShowScenarios ( sal_Bool bShow
, sal_Bool bSetSize
);
303 void SetDropMode(sal_uInt16 nNew
);
304 sal_uInt16
GetDropMode() const { return nDropMode
; }
306 const OUString
& GetStrDragMode() const { return aStrDragMode
; }
307 const OUString
& GetStrDisplay() const { return aStrDisplay
; }
309 void CheckDataArea ();
310 void MarkDataArea ();
311 void UnmarkDataArea ();
312 void StartOfDataArea ();
313 void EndOfDataArea ();
315 static void ReleaseFocus();
318 virtual void Resize();
319 virtual void Paint( const Rectangle
& rRect
);
320 virtual void Resizing( Size
& rSize
);
323 ScNavigatorDlg( SfxBindings
* pB
, SfxChildWindowContext
* pCW
, Window
* pParent
,
324 const bool bUseStyleSettingsBackground
);
327 using Window::Notify
;
328 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
330 void CursorPosChanged();
332 virtual SfxChildAlignment
333 CheckAlignment(SfxChildAlignment
,SfxChildAlignment
);
334 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
337 //==================================================================
339 class ScNavigatorDialogWrapper
: public SfxChildWindowContext
342 ScNavigatorDialogWrapper( Window
* pParent
,
344 SfxBindings
* pBindings
,
345 SfxChildWinInfo
* pInfo
);
347 SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper
)
349 virtual void Resizing( Size
& rSize
);
352 ScNavigatorDlg
* pNavigator
;
357 #endif // SC_NAVIPI_HXX
359 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */