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

Generated by: LCOV version 1.11