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