Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SVTOOLS_EDITBROWSEBOX_HXX
21 : #define INCLUDED_SVTOOLS_EDITBROWSEBOX_HXX
22 : #define SVTOOLS_IN_EDITBROWSEBOX_HXX
23 :
24 : #include <svtools/svtdllapi.h>
25 : #include <tools/ref.hxx>
26 : #include <tools/rtti.hxx>
27 : #include <vcl/window.hxx>
28 : #include <vcl/combobox.hxx>
29 : #include <vcl/lstbox.hxx>
30 : #include <vcl/spinfld.hxx>
31 :
32 : #include <vcl/button.hxx>
33 : #include <svtools/brwbox.hxx>
34 : #include <vcl/timer.hxx>
35 : #include <svtools/brwhead.hxx>
36 : #include <svtools/svmedit.hxx>
37 : #include <vcl/svapp.hxx>
38 :
39 :
40 : // EditBrowseBoxFlags (EBBF)
41 :
42 : #define EBBF_NONE ((sal_Int32)0x0000)
43 : /** if this bit is _not_ set, the handle column will be invalidated upon
44 : changing the row in the browse box. This is for forcing the row picture to
45 : be repainted. If you do not have row pictures or text, you don't need this
46 : invalidation, then you would specify this bit to prevent flicker
47 : */
48 : #define EBBF_NO_HANDLE_COLUMN_CONTENT ((sal_Int32)0x0001)
49 : /** set this bit to activate the cell on a MouseButtonDown, not a MouseButtonUp event
50 : */
51 : #define EBBF_ACTIVATE_ON_BUTTONDOWN ((sal_Int32)0x0002)
52 : /** if this bit is set and EBBF_NO_HANDLE_COLUMN_CONTENT is _not_ set, the handle
53 : column is drawn with the text contained in column 0 instead of an image
54 : */
55 : #define EBBF_HANDLE_COLUMN_TEXT ((sal_Int32)0x0004)
56 :
57 : /** If this bit is set, tab traveling is somewhat modified<br/>
58 : If the control gets the focus because the user pressed the TAB key, then the
59 : first or last cell (depending on whether the traveling was cycling forward or backward)
60 : gets activated.
61 : @see Window::GetGetFocusFlags
62 : @see GETFOCUS_*
63 : */
64 : #define EBBF_SMART_TAB_TRAVEL ((sal_Int32)0x0008)
65 :
66 : /// @deprecated
67 : #define EBBF_NOROWPICTURE EBBF_NO_HANDLE_COLUMN_CONTENT
68 :
69 :
70 :
71 : class Edit;
72 : class SpinField;
73 : class FormattedField;
74 :
75 :
76 : namespace svt
77 : {
78 : class SVT_DLLPUBLIC CellController : public SvRefBase
79 : {
80 : friend class EditBrowseBox;
81 :
82 : protected:
83 : Control* pWindow;
84 : bool bSuspended; // <true> if the window is hidden and disabled
85 :
86 : public:
87 : TYPEINFO();
88 :
89 : CellController(Control* pW);
90 : virtual ~CellController();
91 :
92 93 : Control& GetWindow() const { return *const_cast< CellController* >( this )->pWindow; }
93 :
94 : virtual void SetModified();
95 : virtual void ClearModified() = 0;
96 : virtual bool IsModified() const = 0;
97 :
98 : // commit any current changes. Especially, do any reformatting you need (from input formatting
99 : // to output formatting) here
100 : virtual void CommitModifications();
101 :
102 : // suspending the controller is not culmulative!
103 : void suspend( );
104 : void resume( );
105 4 : inline bool isSuspended( ) const { return bSuspended; }
106 :
107 : protected:
108 : virtual bool MoveAllowed(const KeyEvent& rEvt) const;
109 : virtual void SetModifyHdl(const Link& rLink) = 0;
110 : virtual bool WantMouseEvent() const;
111 : };
112 :
113 : typedef tools::SvRef<CellController> CellControllerRef;
114 :
115 :
116 : //= IEditImplementation
117 :
118 124 : class SVT_DLLPUBLIC IEditImplementation
119 : {
120 : public:
121 : virtual ~IEditImplementation() = 0;
122 :
123 : virtual Control& GetControl() = 0;
124 :
125 : virtual OUString GetText( LineEnd aSeparator ) const = 0;
126 : virtual void SetText( const OUString& _rStr ) = 0;
127 :
128 : virtual bool IsReadOnly() const = 0;
129 : virtual void SetReadOnly( bool bReadOnly ) = 0;
130 :
131 : virtual sal_Int32 GetMaxTextLen() const = 0;
132 : virtual void SetMaxTextLen( sal_Int32 _nMaxLen ) = 0;
133 :
134 : virtual Selection GetSelection() const = 0;
135 : virtual void SetSelection( const Selection& _rSelection ) = 0;
136 :
137 : virtual void ReplaceSelected( const OUString& _rStr ) = 0;
138 : virtual void DeleteSelected() = 0;
139 : virtual OUString GetSelected( LineEnd aSeparator ) const = 0;
140 :
141 : virtual void SetModified() = 0;
142 : virtual bool IsModified() const = 0;
143 : virtual void ClearModified() = 0;
144 : virtual void SetModifyHdl( const Link& _rLink ) = 0;
145 : };
146 :
147 :
148 : //= GenericEditImplementation
149 :
150 : template <class EDIT>
151 180 : class GenericEditImplementation : public IEditImplementation
152 : {
153 : EDIT& m_rEdit;
154 : public:
155 : GenericEditImplementation( EDIT& _rEdit );
156 :
157 0 : EDIT& GetEditWindow() { return static_cast< EDIT& >( GetControl() ); }
158 :
159 : virtual Control& GetControl() SAL_OVERRIDE;
160 :
161 : virtual OUString GetText( LineEnd aSeparator ) const SAL_OVERRIDE;
162 : virtual void SetText( const OUString& _rStr ) SAL_OVERRIDE;
163 :
164 : virtual bool IsReadOnly() const SAL_OVERRIDE;
165 : virtual void SetReadOnly( bool bReadOnly ) SAL_OVERRIDE;
166 :
167 : virtual sal_Int32 GetMaxTextLen() const SAL_OVERRIDE;
168 : virtual void SetMaxTextLen( sal_Int32 _nMaxLen ) SAL_OVERRIDE;
169 :
170 : virtual Selection GetSelection() const SAL_OVERRIDE;
171 : virtual void SetSelection( const Selection& _rSelection ) SAL_OVERRIDE;
172 :
173 : virtual void ReplaceSelected( const OUString& _rStr ) SAL_OVERRIDE;
174 : virtual void DeleteSelected() SAL_OVERRIDE;
175 : virtual OUString GetSelected( LineEnd aSeparator ) const SAL_OVERRIDE;
176 :
177 : virtual void SetModified() SAL_OVERRIDE;
178 : virtual bool IsModified() const SAL_OVERRIDE;
179 : virtual void ClearModified() SAL_OVERRIDE;
180 : virtual void SetModifyHdl( const Link& _rLink ) SAL_OVERRIDE;
181 : };
182 :
183 : #include <svtools/editimplementation.hxx>
184 :
185 :
186 : //= MultiLineTextCell
187 :
188 : /** a multi line edit which can be used in a cell of a EditBrowseBox
189 : */
190 136 : class SVT_DLLPUBLIC MultiLineTextCell : public MultiLineEdit
191 : {
192 : public:
193 68 : MultiLineTextCell( vcl::Window* _pParent, WinBits _nStyle )
194 68 : :MultiLineEdit( _pParent, _nStyle )
195 : {
196 68 : }
197 :
198 : protected:
199 : // Window overridables
200 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
201 :
202 : // MultiLineEdit overridables
203 : virtual void Modify() SAL_OVERRIDE;
204 :
205 : private:
206 : bool dispatchKeyEvent( const KeyEvent& _rEvent );
207 : };
208 :
209 :
210 : //= concrete edit implementations
211 :
212 : typedef GenericEditImplementation< Edit > EditImplementation;
213 :
214 : typedef GenericEditImplementation< MultiLineTextCell > MultiLineEditImplementation_Base;
215 136 : class SVT_DLLPUBLIC MultiLineEditImplementation : public MultiLineEditImplementation_Base
216 : {
217 : public:
218 68 : MultiLineEditImplementation( MultiLineTextCell& _rEdit ) : MultiLineEditImplementation_Base( _rEdit )
219 : {
220 68 : }
221 :
222 : virtual OUString GetText( LineEnd aSeparator ) const SAL_OVERRIDE;
223 : virtual OUString GetSelected( LineEnd aSeparator ) const SAL_OVERRIDE;
224 : };
225 :
226 :
227 : //= EditCellController
228 :
229 : class SVT_DLLPUBLIC EditCellController : public CellController
230 : {
231 : IEditImplementation* m_pEditImplementation;
232 : bool m_bOwnImplementation; // did we create m_pEditImplementation?
233 :
234 : public:
235 : TYPEINFO_OVERRIDE();
236 : EditCellController( Edit* _pEdit );
237 : EditCellController( IEditImplementation* _pImplementation );
238 : virtual ~EditCellController( );
239 :
240 : const IEditImplementation* GetEditImplementation( ) const { return m_pEditImplementation; }
241 0 : IEditImplementation* GetEditImplementation( ) { return m_pEditImplementation; }
242 :
243 : virtual void SetModified() SAL_OVERRIDE;
244 : virtual bool IsModified() const SAL_OVERRIDE;
245 : virtual void ClearModified() SAL_OVERRIDE;
246 :
247 : protected:
248 : virtual bool MoveAllowed(const KeyEvent& rEvt) const SAL_OVERRIDE;
249 : virtual void SetModifyHdl(const Link& rLink) SAL_OVERRIDE;
250 : };
251 :
252 :
253 : //= SpinCellController
254 :
255 0 : class SVT_DLLPUBLIC SpinCellController : public CellController
256 : {
257 : public:
258 : TYPEINFO_OVERRIDE();
259 : SpinCellController(SpinField* pSpinField);
260 0 : const SpinField& GetSpinWindow() const { return static_cast<const SpinField &>(GetWindow()); }
261 0 : SpinField& GetSpinWindow() { return static_cast<SpinField &>(GetWindow()); }
262 :
263 : virtual void SetModified() SAL_OVERRIDE;
264 : virtual bool IsModified() const SAL_OVERRIDE;
265 : virtual void ClearModified() SAL_OVERRIDE;
266 :
267 : protected:
268 : virtual bool MoveAllowed(const KeyEvent& rEvt) const SAL_OVERRIDE;
269 : virtual void SetModifyHdl(const Link& rLink) SAL_OVERRIDE;
270 : };
271 :
272 :
273 : //= CheckBoxControl
274 :
275 : class SVT_DLLPUBLIC CheckBoxControl : public Control
276 : {
277 : CheckBox* pBox;
278 : Rectangle aFocusRect;
279 : Link m_aClickLink,m_aModifyLink;
280 :
281 : public:
282 : CheckBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0);
283 : virtual ~CheckBoxControl();
284 :
285 : virtual void GetFocus() SAL_OVERRIDE;
286 : virtual bool PreNotify(NotifyEvent& rEvt) SAL_OVERRIDE;
287 : virtual void Paint(const Rectangle& rClientRect) SAL_OVERRIDE;
288 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
289 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
290 : virtual void DataChanged( const DataChangedEvent& _rEvent ) SAL_OVERRIDE;
291 : virtual void Resize() SAL_OVERRIDE;
292 :
293 0 : void SetClickHdl(const Link& rHdl) {m_aClickLink = rHdl;}
294 : const Link& GetClickHdl() const {return m_aClickLink;}
295 :
296 0 : void SetModifyHdl(const Link& rHdl) {m_aModifyLink = rHdl;}
297 : const Link& GetModifyHdl() const {return m_aModifyLink;}
298 :
299 0 : CheckBox& GetBox() {return *pBox;};
300 :
301 : private:
302 : DECL_LINK( OnClick, void* );
303 : };
304 :
305 :
306 : //= CheckBoxCellController
307 :
308 0 : class SVT_DLLPUBLIC CheckBoxCellController : public CellController
309 : {
310 : public:
311 : TYPEINFO_OVERRIDE();
312 :
313 0 : CheckBoxCellController(CheckBoxControl* pWin):CellController(pWin){}
314 : CheckBox& GetCheckBox() const;
315 :
316 : virtual bool IsModified() const SAL_OVERRIDE;
317 : virtual void ClearModified() SAL_OVERRIDE;
318 :
319 : protected:
320 : virtual void SetModifyHdl(const Link& rLink) SAL_OVERRIDE;
321 : virtual bool WantMouseEvent() const SAL_OVERRIDE;
322 : };
323 :
324 :
325 : //= ComboBoxControl
326 :
327 0 : class SVT_DLLPUBLIC ComboBoxControl : public ComboBox
328 : {
329 : friend class ComboBoxCellController;
330 :
331 : public:
332 : ComboBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0);
333 :
334 : protected:
335 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
336 : };
337 :
338 :
339 : //= ComboBoxCellController
340 :
341 0 : class SVT_DLLPUBLIC ComboBoxCellController : public CellController
342 : {
343 : public:
344 : TYPEINFO_OVERRIDE();
345 :
346 : ComboBoxCellController(ComboBoxControl* pParent);
347 0 : ComboBoxControl& GetComboBox() const { return static_cast<ComboBoxControl &>(GetWindow()); }
348 :
349 : virtual bool IsModified() const SAL_OVERRIDE;
350 : virtual void ClearModified() SAL_OVERRIDE;
351 :
352 : protected:
353 : virtual bool MoveAllowed(const KeyEvent& rEvt) const SAL_OVERRIDE;
354 : virtual void SetModifyHdl(const Link& rLink) SAL_OVERRIDE;
355 : };
356 :
357 :
358 : //= ListBoxControl
359 :
360 0 : class SVT_DLLPUBLIC ListBoxControl : public ListBox
361 : {
362 : friend class ListBoxCellController;
363 :
364 : public:
365 : ListBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0);
366 :
367 : protected:
368 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
369 : };
370 :
371 :
372 : //= ListBoxCellController
373 :
374 0 : class SVT_DLLPUBLIC ListBoxCellController : public CellController
375 : {
376 : public:
377 : TYPEINFO_OVERRIDE();
378 :
379 : ListBoxCellController(ListBoxControl* pParent);
380 0 : const ListBoxControl& GetListBox() const { return static_cast<const ListBoxControl &>(GetWindow()); }
381 0 : ListBoxControl& GetListBox() { return static_cast<ListBoxControl &>(GetWindow()); }
382 :
383 : virtual bool IsModified() const SAL_OVERRIDE;
384 : virtual void ClearModified() SAL_OVERRIDE;
385 :
386 : protected:
387 : virtual bool MoveAllowed(const KeyEvent& rEvt) const SAL_OVERRIDE;
388 : virtual void SetModifyHdl(const Link& rLink) SAL_OVERRIDE;
389 : };
390 :
391 :
392 : //= FormattedFieldCellController
393 :
394 56 : class SVT_DLLPUBLIC FormattedFieldCellController : public EditCellController
395 : {
396 : public:
397 : TYPEINFO_OVERRIDE();
398 : FormattedFieldCellController( FormattedField* _pFormatted );
399 :
400 : virtual void CommitModifications() SAL_OVERRIDE;
401 : };
402 :
403 :
404 : //= EditBrowserHeader
405 :
406 41 : class SVT_DLLPUBLIC EditBrowserHeader : public BrowserHeader
407 : {
408 : public:
409 41 : EditBrowserHeader( BrowseBox* pParent, WinBits nWinBits = WB_BUTTONSTYLE )
410 41 : :BrowserHeader(pParent, nWinBits){}
411 :
412 : protected:
413 : virtual void DoubleClick() SAL_OVERRIDE;
414 : };
415 :
416 :
417 : //= EditBrowseBox
418 :
419 : class EditBrowseBoxImpl;
420 : class SVT_DLLPUBLIC EditBrowseBox: public BrowseBox
421 : {
422 : friend class EditBrowserHeader;
423 :
424 : enum BrowseInfo
425 : {
426 : COLSELECT = 1,
427 : ROWSELECT = 2,
428 : ROWCHANGE = 4,
429 : COLCHANGE = 8
430 : };
431 :
432 : public:
433 : enum RowStatus
434 : {
435 : CLEAN = 0,
436 : CURRENT = 1,
437 : CURRENTNEW = 2,
438 : MODIFIED = 3,
439 : NEW = 4,
440 : DELETED = 5,
441 : PRIMARYKEY = 6,
442 : CURRENT_PRIMARYKEY = 7,
443 : FILTER = 8,
444 : HEADERFOOTER = 9
445 : };
446 :
447 : private:
448 : // forbid these ones
449 : EditBrowseBox(EditBrowseBox&);
450 : EditBrowseBox& operator=(EditBrowseBox&);
451 :
452 : class BrowserMouseEventPtr
453 : {
454 : BrowserMouseEvent* pEvent;
455 : bool bDown;
456 :
457 : public:
458 41 : BrowserMouseEventPtr()
459 : : pEvent(NULL)
460 41 : , bDown(false)
461 : {
462 41 : }
463 41 : ~BrowserMouseEventPtr(){Clear();}
464 :
465 79 : bool Is() const {return pEvent != NULL;}
466 0 : bool IsDown() const {return bDown;}
467 0 : const BrowserMouseEvent* operator->() const {return pEvent;}
468 : const BrowserMouseEvent& operator*() const {return *pEvent;}
469 :
470 : SVT_DLLPUBLIC void Clear();
471 : void Set(const BrowserMouseEvent* pEvt, bool bIsDown);
472 : } aMouseEvent;
473 :
474 : CellControllerRef aController,
475 : aOldController;
476 :
477 : ImplSVEvent * nStartEvent, * nEndEvent, * nCellModifiedEvent; // event ids
478 : vcl::Window* m_pFocusWhileRequest;
479 : // In ActivateCell, we grab the focus asynchronously, but if between requesting activation
480 : // and the asynchornous event the focus has changed, we won't grab it for ourself.
481 :
482 : long nPaintRow; // row being painted
483 : long nEditRow, nOldEditRow;
484 : sal_uInt16 nEditCol, nOldEditCol;
485 :
486 : bool bHasFocus : 1;
487 : mutable bool bPaintStatus : 1; // paint a status (image) in the handle column
488 : bool bActiveBeforeTracking;
489 :
490 : CheckBoxControl* pCheckBoxPaint;
491 :
492 : sal_Int32 m_nBrowserFlags;
493 : ImageList m_aStatusImages;
494 : ::std::unique_ptr< EditBrowseBoxImpl> m_aImpl;
495 :
496 : protected:
497 : BrowserHeader* pHeader;
498 :
499 : bool isGetCellFocusPending() const { return nStartEvent != 0; }
500 : void cancelGetCellFocus() { if (nStartEvent) Application::RemoveUserEvent(nStartEvent); nStartEvent = 0; }
501 : void forceGetCellFocus() { cancelGetCellFocus(); LINK(this, EditBrowseBox, StartEditHdl).Call((void*)NULL); }
502 :
503 0 : BrowserMouseEventPtr& getMouseEvent() { return aMouseEvent; }
504 :
505 : protected:
506 47 : BrowserHeader* GetHeaderBar() const {return pHeader;}
507 :
508 : virtual BrowserHeader* CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
509 :
510 : // if you want to have an own header ...
511 : virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent);
512 :
513 : virtual void ColumnMoved(sal_uInt16 nId) SAL_OVERRIDE;
514 : virtual void ColumnResized(sal_uInt16 nColId) SAL_OVERRIDE;
515 : virtual void Resize() SAL_OVERRIDE;
516 : virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY);
517 : virtual bool SeekRow(long nRow) SAL_OVERRIDE;
518 :
519 : virtual void GetFocus() SAL_OVERRIDE;
520 : virtual void LoseFocus() SAL_OVERRIDE;
521 : virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
522 : virtual void MouseButtonDown(const BrowserMouseEvent& rEvt) SAL_OVERRIDE;
523 : virtual void MouseButtonUp(const BrowserMouseEvent& rEvt) SAL_OVERRIDE;
524 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
525 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
526 :
527 : using BrowseBox::MouseButtonUp;
528 : using BrowseBox::MouseButtonDown;
529 :
530 : virtual bool PreNotify(NotifyEvent& rNEvt ) SAL_OVERRIDE;
531 : virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE;
532 :
533 : virtual void EndScroll() SAL_OVERRIDE;
534 :
535 : // should be used instead of GetFieldRectPixel, 'cause this method here takes into account the borders
536 : Rectangle GetCellRect(long nRow, sal_uInt16 nColId, bool bRelToBrowser = true) const;
537 : virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
538 : virtual sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId);
539 :
540 : virtual void PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const;
541 : virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const = 0;
542 :
543 : virtual RowStatus GetRowStatus(long nRow) const;
544 :
545 : virtual void RowHeightChanged() SAL_OVERRIDE;
546 :
547 : // callbacks for the data window
548 : virtual void ImplStartTracking() SAL_OVERRIDE;
549 : virtual void ImplTracking() SAL_OVERRIDE;
550 : virtual void ImplEndTracking() SAL_OVERRIDE;
551 :
552 : // when changing a row:
553 : // CursorMoving: cursor is being moved, but GetCurRow() still provides the old row
554 : virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol);
555 :
556 : // cursor has been moved
557 : virtual void CursorMoved() SAL_OVERRIDE;
558 :
559 : virtual void CellModified(); // called whenever a cell has been modified
560 : virtual bool SaveModified(); // called whenever a cell should be left, and it's content should be saved
561 : // return sal_False prevents leaving the cell
562 : virtual bool SaveRow(); // commit the current row
563 :
564 6 : virtual bool IsModified() const {return aController.Is() && aController->IsModified();}
565 :
566 : virtual CellController* GetController(long nRow, sal_uInt16 nCol);
567 : virtual void InitController(CellControllerRef& rController, long nRow, sal_uInt16 nCol);
568 : virtual void ResizeController(CellControllerRef& rController, const Rectangle&);
569 : virtual void ReleaseController(CellControllerRef& pController, long nRow, sal_uInt16 nCol);
570 : virtual void DoubleClick(const BrowserMouseEvent&) SAL_OVERRIDE;
571 :
572 73 : void ActivateCell() { ActivateCell(GetCurRow(), GetCurColumnId()); }
573 :
574 : // retrieve the image for the row status
575 : virtual Image GetImage(RowStatus) const;
576 :
577 : // inserting columns
578 : // if you don't set a width, this will be calculated automatically
579 : // if the id isn't set the smallest unused will do it ...
580 : virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth = 0, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1);
581 :
582 : // called whenever (Shift)Tab or Enter is pressed. If true is returned, these keys
583 : // result in traveling to the next or to th previous cell
584 : virtual bool IsTabAllowed(bool bForward) const;
585 :
586 : virtual bool IsCursorMoveAllowed(long nNewRow, sal_uInt16 nNewColId) const SAL_OVERRIDE;
587 :
588 : void PaintTristate(OutputDevice& rDev, const Rectangle& rRect, const TriState& eState, bool _bEnabled=true) const;
589 :
590 : void AsynchGetFocus();
591 : // secure starting of StartEditHdl
592 :
593 : public:
594 : EditBrowseBox(vcl::Window* pParent, sal_Int32 nBrowserFlags = EBBF_NONE, WinBits nBits = WB_TABSTOP, BrowserMode nMode = 0 );
595 : EditBrowseBox(vcl::Window* pParent, const ResId& rId, sal_Int32 nBrowserFlags = EBBF_NONE, BrowserMode nMode = 0 );
596 : virtual ~EditBrowseBox();
597 :
598 347 : bool IsEditing() const {return aController.Is();}
599 46 : void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);}
600 : void InvalidateHandleColumn();
601 :
602 : // late construction
603 : virtual void Init();
604 : virtual void RemoveRows();
605 : virtual void Dispatch(sal_uInt16 nId);
606 :
607 81 : CellControllerRef Controller() const { return aController; }
608 41 : sal_Int32 GetBrowserFlags() const { return m_nBrowserFlags; }
609 : void SetBrowserFlags(sal_Int32 nFlags);
610 :
611 : virtual void ActivateCell(long nRow, sal_uInt16 nCol, bool bSetCellFocus = true);
612 : virtual void DeactivateCell(bool bUpdate = true);
613 : // Children ---------------------------------------------------------------
614 :
615 : /** Creates the accessible object of a data table cell.
616 : @param nRow
617 : The row index of the cell.
618 : @param nColumnId
619 : The column ID of the cell.
620 : @return
621 : The XAccessible interface of the specified cell. */
622 : virtual ::com::sun::star::uno::Reference<
623 : ::com::sun::star::accessibility::XAccessible >
624 : CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) SAL_OVERRIDE;
625 :
626 : /** @return The count of additional controls of the control area. */
627 : virtual sal_Int32 GetAccessibleControlCount() const SAL_OVERRIDE;
628 :
629 : /** Creates the accessible object of an additional control.
630 : @param nIndex
631 : The 0-based index of the control.
632 : @return
633 : The XAccessible interface of the specified control. */
634 : virtual ::com::sun::star::uno::Reference<
635 : ::com::sun::star::accessibility::XAccessible >
636 : CreateAccessibleControl( sal_Int32 nIndex ) SAL_OVERRIDE;
637 :
638 : /** Creates the accessible object of a column header.
639 : @param nColumnId
640 : The column ID of the header.
641 : @return
642 : The XAccessible interface of the specified column header. */
643 : virtual ::com::sun::star::uno::Reference<
644 : ::com::sun::star::accessibility::XAccessible >
645 : CreateAccessibleRowHeader( sal_Int32 _nRow ) SAL_OVERRIDE;
646 :
647 : /** Sets focus to current cell of the data table. */
648 : virtual void GrabTableFocus() SAL_OVERRIDE;
649 :
650 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
651 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
652 :
653 : ::com::sun::star::uno::Reference<
654 : ::com::sun::star::accessibility::XAccessible > CreateAccessibleCheckBoxCell(long _nRow, sal_uInt16 _nColumnPos,const TriState& eState);
655 : protected:
656 : // creates the accessible which wraps the active cell
657 : void implCreateActiveAccessible( );
658 :
659 : private:
660 : virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect,
661 : sal_uInt16 nColumnId ) const SAL_OVERRIDE;
662 : using Control::ImplInitSettings;
663 : SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
664 : SVT_DLLPRIVATE void DetermineFocus( const sal_uInt16 _nGetFocusFlags = 0);
665 : inline void HideAndDisable(CellControllerRef& rController);
666 : inline void EnableAndShow() const;
667 :
668 : SVT_DLLPRIVATE void implActivateCellOnMouseEvent(const BrowserMouseEvent& _rEvt, bool _bUp);
669 : SVT_DLLPRIVATE void impl_construct();
670 :
671 : DECL_DLLPRIVATE_LINK(ModifyHdl, void* );
672 : DECL_DLLPRIVATE_LINK(StartEditHdl, void* );
673 : DECL_DLLPRIVATE_LINK(EndEditHdl, void* );
674 : DECL_DLLPRIVATE_LINK(CellModifiedHdl, void* );
675 : };
676 :
677 :
678 : } // namespace svt
679 :
680 :
681 : #undef SVTOOLS_IN_EDITBROWSEBOX_HXX
682 : #endif // INCLUDED_SVTOOLS_EDITBROWSEBOX_HXX
683 :
684 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|