Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / navipi.hxx
blob185c6e417ea3a4a6520e0bc0725a47f2c4585fec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 SC_NAVIPI_HXX
21 #define SC_NAVIPI_HXX
23 #include <vector>
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>
35 class ScTabViewShell;
36 class ScViewData;
37 class ScArea;
38 class ScScenarioWindow;
39 class ScNavigatorControllerItem;
40 class ScNavigatorDialogWrapper;
41 class ScNavigatorDlg;
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
62 public:
63 explicit ScScenarioListBox( ScScenarioWindow& rParent );
64 virtual ~ScScenarioListBox();
66 void UpdateEntries( const std::vector<OUString> &aNewEntryList );
68 protected:
69 virtual void Select();
70 virtual void DoubleClick();
71 virtual long Notify( NotifyEvent& rNEvt );
73 private:
74 struct ScenarioEntry
76 OUString maName;
77 OUString maComment;
78 bool mbProtected;
80 inline explicit ScenarioEntry() : mbProtected( false ) {}
82 typedef ::std::vector< ScenarioEntry > ScenarioList;
84 private:
85 const ScenarioEntry* GetSelectedEntry() const;
87 void ExecuteScenarioSlot( sal_uInt16 nSlotId );
88 void SelectScenario();
89 void EditScenario();
90 void DeleteScenario( bool bQueryBox );
92 private:
93 ScScenarioWindow& mrParent;
94 ScenarioList maEntries;
97 //========================================================================
98 // class ScScenarioWindow ------------------------------------------------
99 //========================================================================
100 class ScScenarioWindow : public Window
102 public:
103 ScScenarioWindow( Window* pParent, const OUString& aQH_List, const OUString& aQH_Comment);
104 ~ScScenarioWindow();
106 void NotifyState( const SfxPoolItem* pState );
107 void SetComment( const OUString& rComment )
108 { aEdComment.SetText( rComment ); }
110 void SetSizePixel( const Size& rNewSize );
112 protected:
114 virtual void Paint( const Rectangle& rRect );
116 private:
117 ScScenarioListBox aLbScenario;
118 MultiLineEdit aEdComment;
121 //==================================================================
122 // class ColumnEdit
123 //==================================================================
124 class ColumnEdit : public SpinField
126 public:
127 ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId );
128 ~ColumnEdit();
130 SCCOL GetCol() { return nCol; }
131 void SetCol( SCCOL nColNo );
133 protected:
134 virtual long Notify( NotifyEvent& rNEvt );
135 virtual void LoseFocus();
136 virtual void Up();
137 virtual void Down();
138 virtual void First();
139 virtual void Last();
141 private:
142 ScNavigatorDlg& rDlg;
143 SCCOL nCol;
144 sal_uInt16 nKeyGroup;
146 void EvalText ();
147 void ExecuteCol ();
148 SCCOL AlphaToNum ( OUString& rStr );
149 SCCOL NumStrToAlpha ( OUString& rStr );
150 SCCOL NumToAlpha ( SCCOL nColNo, OUString& rStr );
154 //==================================================================
155 // class RowEdit
156 //==================================================================
157 class RowEdit : public NumericField
159 public:
160 RowEdit( ScNavigatorDlg* pParent, const ResId& rResId );
161 ~RowEdit();
163 SCROW GetRow() { return (SCROW)GetValue(); }
164 void SetRow( SCROW nRow ){ SetValue( nRow ); }
166 protected:
167 virtual long Notify( NotifyEvent& rNEvt );
168 virtual void LoseFocus();
170 private:
171 ScNavigatorDlg& rDlg;
173 void ExecuteRow();
177 //==================================================================
178 // class ScDocListBox
179 //==================================================================
180 class ScDocListBox : public ListBox
182 public:
183 ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId );
184 ~ScDocListBox();
186 protected:
187 virtual void Select();
189 private:
190 ScNavigatorDlg& rDlg;
194 //==================================================================
195 // class CommandToolBox
196 //==================================================================
197 class CommandToolBox : public ToolBox
199 public:
200 CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId );
201 ~CommandToolBox();
203 void Select( sal_uInt16 nId );
204 void UpdateButtons();
205 void InitImageList();
207 virtual void DataChanged( const DataChangedEvent& rDCEvt );
209 DECL_LINK( ToolBoxDropdownClickHdl, void* );
211 protected:
212 virtual void Select();
213 virtual void Click();
215 private:
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;
233 private:
234 SfxBindings& rBindings; // must be first member
236 ImageList aCmdImageList; // must be before aTbxCmd
237 FixedInfo aFtCol;
238 ColumnEdit aEdCol;
239 FixedInfo aFtRow;
240 RowEdit aEdRow;
241 CommandToolBox aTbxCmd;
242 ScContentTree aLbEntries;
243 ScScenarioWindow aWndScenarios;
244 ScDocListBox aLbDocuments;
246 Timer aContentTimer;
248 OUString aTitleBase;
249 OUString aStrDragMode;
250 OUString aStrDisplay;
251 OUString aStrActive;
252 OUString aStrNotActive;
253 OUString aStrHidden;
254 OUString aStrActiveWin;
256 SfxChildWindowContext* pContextWin;
257 Size aInitSize;
258 ScArea* pMarkArea;
259 ScViewData* pViewData;
261 long nBorderOffset;
262 long nListModeHeight;
263 long nInitListHeight;
264 NavListMode eListMode;
265 sal_uInt16 nDropMode;
266 SCCOL nCurCol;
267 SCROW nCurRow;
268 SCTAB nCurTab;
269 sal_Bool bFirstBig;
270 bool mbUseStyleSettingsBackground;
272 ScNavigatorControllerItem** ppBoundItems;
274 DECL_LINK( TimeHdl, Timer* );
276 void DoResize();
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 );
295 void UpdateAll ();
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();
317 protected:
318 virtual void Resize();
319 virtual void Paint( const Rectangle& rRect );
320 virtual void Resizing( Size& rSize );
322 public:
323 ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent,
324 const bool bUseStyleSettingsBackground);
325 ~ScNavigatorDlg();
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
341 public:
342 ScNavigatorDialogWrapper( Window* pParent,
343 sal_uInt16 nId,
344 SfxBindings* pBindings,
345 SfxChildWinInfo* pInfo );
347 SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper)
349 virtual void Resizing( Size& rSize );
351 private:
352 ScNavigatorDlg* pNavigator;
357 #endif // SC_NAVIPI_HXX
359 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */