LCOV - code coverage report
Current view: top level - include/svtools - editbrowsebox.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 27 45 60.0 %
Date: 2014-04-11 Functions: 26 52 50.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10