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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_NAVIPI_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_NAVIPI_HXX
24 #include <vcl/toolbox.hxx>
25 #include <vcl/field.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <vcl/idle.hxx>
28 #include <svtools/stdctrl.hxx>
29 #include <svl/poolitem.hxx>
30 #include <svl/lstner.hxx>
31 #include <sfx2/childwin.hxx>
32 #include "content.hxx"
33 #include <svtools/svmedit.hxx>
38 class ScScenarioWindow
;
39 class ScNavigatorControllerItem
;
40 class ScNavigatorDialogWrapper
;
42 class ScNavigatorSettings
;
44 #define SC_DROPMODE_URL 0
45 #define SC_DROPMODE_LINK 1
46 #define SC_DROPMODE_COPY 2
48 enum NavListMode
{ NAV_LMODE_NONE
= 0x4000,
49 NAV_LMODE_AREAS
= 0x2000,
50 NAV_LMODE_DBAREAS
= 0x1000,
51 NAV_LMODE_DOCS
= 0x800,
52 NAV_LMODE_SCENARIOS
= 0x400 };
54 // class ScScenarioListBox -----------------------------------------------
56 class ScScenarioListBox
: public ListBox
59 explicit ScScenarioListBox( ScScenarioWindow
& rParent
);
60 virtual ~ScScenarioListBox();
62 void UpdateEntries( const std::vector
<OUString
> &aNewEntryList
);
65 virtual void Select() SAL_OVERRIDE
;
66 virtual void DoubleClick() SAL_OVERRIDE
;
67 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
76 inline explicit ScenarioEntry() : mbProtected( false ) {}
78 typedef ::std::vector
< ScenarioEntry
> ScenarioList
;
81 const ScenarioEntry
* GetSelectedEntry() const;
83 void ExecuteScenarioSlot( sal_uInt16 nSlotId
);
84 void SelectScenario();
86 void DeleteScenario( bool bQueryBox
);
89 ScScenarioWindow
& mrParent
;
90 ScenarioList maEntries
;
93 // class ScScenarioWindow ------------------------------------------------
95 class ScScenarioWindow
: public vcl::Window
98 ScScenarioWindow( vcl::Window
* pParent
, const OUString
& aQH_List
, const OUString
& aQH_Comment
);
99 virtual ~ScScenarioWindow();
100 virtual void dispose() SAL_OVERRIDE
;
102 void NotifyState( const SfxPoolItem
* pState
);
103 void SetComment( const OUString
& rComment
)
104 { aEdComment
->SetText( rComment
); }
106 void SetSizePixel( const Size
& rNewSize
) SAL_OVERRIDE
;
110 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
113 VclPtr
<ScScenarioListBox
> aLbScenario
;
114 VclPtr
<MultiLineEdit
> aEdComment
;
119 class ColumnEdit
: public SpinField
122 ColumnEdit( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
123 virtual ~ColumnEdit();
125 SCCOL
GetCol() { return nCol
; }
126 void SetCol( SCCOL nColNo
);
129 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
130 virtual void LoseFocus() SAL_OVERRIDE
;
131 virtual void Up() SAL_OVERRIDE
;
132 virtual void Down() SAL_OVERRIDE
;
133 virtual void First() SAL_OVERRIDE
;
134 virtual void Last() SAL_OVERRIDE
;
137 ScNavigatorDlg
& rDlg
;
139 sal_uInt16 nKeyGroup
;
143 static SCCOL
AlphaToNum ( OUString
& rStr
);
144 static SCCOL
NumStrToAlpha ( OUString
& rStr
);
145 static SCCOL
NumToAlpha ( SCCOL nColNo
, OUString
& rStr
);
150 class RowEdit
: public NumericField
153 RowEdit( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
156 SCROW
GetRow() { return (SCROW
)GetValue(); }
157 void SetRow( SCROW nRow
){ SetValue( nRow
); }
160 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
161 virtual void LoseFocus() SAL_OVERRIDE
;
164 ScNavigatorDlg
& rDlg
;
169 // class ScDocListBox
171 class ScDocListBox
: public ListBox
174 ScDocListBox( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
175 virtual ~ScDocListBox();
178 virtual void Select() SAL_OVERRIDE
;
181 ScNavigatorDlg
& rDlg
;
184 // class CommandToolBox
186 class CommandToolBox
: public ToolBox
189 CommandToolBox( ScNavigatorDlg
* pParent
, const ResId
& rResId
);
190 virtual ~CommandToolBox();
192 void Select( sal_uInt16 nId
);
193 void UpdateButtons();
194 void InitImageList();
196 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
198 DECL_LINK_TYPED( ToolBoxDropdownClickHdl
, ToolBox
*, void );
201 virtual void Select() SAL_OVERRIDE
;
202 virtual void Click() SAL_OVERRIDE
;
205 ScNavigatorDlg
& rDlg
;
208 // class ScNavigatorDlg
210 class ScNavigatorDlg
: public vcl::Window
, public SfxListener
212 friend class ScNavigatorControllerItem
;
213 friend class ScNavigatorDialogWrapper
;
214 friend class ColumnEdit
;
215 friend class RowEdit
;
216 friend class ScDocListBox
;
217 friend class CommandToolBox
;
218 friend class ScContentTree
;
221 SfxBindings
& rBindings
; // must be first member
223 ImageList aCmdImageList
; // must be before aTbxCmd
224 VclPtr
<FixedInfo
> aFtCol
;
225 VclPtr
<ColumnEdit
> aEdCol
;
226 VclPtr
<FixedInfo
> aFtRow
;
227 VclPtr
<RowEdit
> aEdRow
;
228 VclPtr
<CommandToolBox
> aTbxCmd
;
229 VclPtr
<ScContentTree
> aLbEntries
;
230 VclPtr
<ScScenarioWindow
> aWndScenarios
;
231 VclPtr
<ScDocListBox
> aLbDocuments
;
236 OUString aStrDragMode
;
237 OUString aStrDisplay
;
239 OUString aStrNotActive
;
241 OUString aStrActiveWin
;
243 SfxChildWindowContext
* pContextWin
;
246 ScViewData
* pViewData
;
249 long nListModeHeight
;
250 long nInitListHeight
;
251 NavListMode eListMode
;
252 sal_uInt16 nDropMode
;
257 bool mbUseStyleSettingsBackground
;
259 ScNavigatorControllerItem
** ppBoundItems
;
261 DECL_LINK_TYPED( TimeHdl
, Idle
*, void );
265 SfxBindings
& GetBindings()
266 { return rBindings
; }
268 void SetCurrentCell( SCCOL nCol
, SCROW Row
);
269 void SetCurrentCellStr( const OUString
& rName
);
270 void SetCurrentTable( SCTAB nTab
);
271 void SetCurrentTableStr( const OUString
& rName
);
272 void SetCurrentObject( const OUString
& rName
);
273 void SetCurrentDoc( const OUString
& rDocName
);
275 static ScTabViewShell
* GetTabViewShell();
276 static ScNavigatorSettings
* GetNavigatorSettings();
279 void UpdateColumn ( const SCCOL
* pCol
= NULL
);
280 void UpdateRow ( const SCROW
* pRow
= NULL
);
281 void UpdateTable ( const SCTAB
* pTab
= NULL
);
284 void GetDocNames(const OUString
* pSelEntry
= NULL
);
286 void SetListMode ( NavListMode eMode
, bool bSetSize
= true );
287 void ShowList ( bool bShow
, bool bSetSize
);
288 void ShowScenarios ( bool bShow
, bool bSetSize
);
290 void SetDropMode(sal_uInt16 nNew
);
291 sal_uInt16
GetDropMode() const { return nDropMode
; }
293 const OUString
& GetStrDragMode() const { return aStrDragMode
; }
294 const OUString
& GetStrDisplay() const { return aStrDisplay
; }
296 void CheckDataArea ();
297 void MarkDataArea ();
298 void UnmarkDataArea ();
299 void StartOfDataArea ();
300 void EndOfDataArea ();
302 static void ReleaseFocus();
305 virtual void Resize() SAL_OVERRIDE
;
306 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
307 void Resizing( Size
& rSize
);
310 ScNavigatorDlg( SfxBindings
* pB
, SfxChildWindowContext
* pCW
, vcl::Window
* pParent
,
311 const bool bUseStyleSettingsBackground
);
312 virtual ~ScNavigatorDlg();
313 virtual void dispose() SAL_OVERRIDE
;
315 using Window::Notify
;
316 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
318 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
321 class ScNavigatorDialogWrapper
: public SfxChildWindowContext
324 ScNavigatorDialogWrapper( vcl::Window
* pParent
,
326 SfxBindings
* pBindings
,
327 SfxChildWinInfo
* pInfo
);
329 SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper
)
331 virtual void Resizing( Size
& rSize
) SAL_OVERRIDE
;
334 VclPtr
<ScNavigatorDlg
> pNavigator
;
337 #endif // INCLUDED_SC_SOURCE_UI_INC_NAVIPI_HXX
339 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */