LCOV - code coverage report
Current view: top level - include/svx - fmgridcl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 8 37.5 %
Date: 2015-06-13 12:38:46 Functions: 3 7 42.9 %
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             : #ifndef INCLUDED_SVX_FMGRIDCL_HXX
      20             : #define INCLUDED_SVX_FMGRIDCL_HXX
      21             : 
      22             : #include <com/sun/star/container/XIndexContainer.hpp>
      23             : #include <com/sun/star/container/XNameContainer.hpp>
      24             : 
      25             : #include <svx/gridctrl.hxx>
      26             : #include <svtools/transfer.hxx>
      27             : #include <svx/svxdllapi.h>
      28             : 
      29             : 
      30             : // FmGridHeader
      31             : 
      32             : struct FmGridHeaderData;
      33             : class SVX_DLLPUBLIC SAL_WARN_UNUSED FmGridHeader
      34             :             :public ::svt::EditBrowserHeader
      35             :             ,public DropTargetHelper
      36             : {
      37             : protected:
      38             :     FmGridHeaderData*       m_pImpl;
      39             : 
      40             :     // trigger context menu execution
      41             :     void    triggerColumnContextMenu( const ::Point& _rPreferredPos );
      42             : 
      43             : public:
      44             :     FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
      45             :     virtual ~FmGridHeader();
      46             :     virtual void dispose() SAL_OVERRIDE;
      47             : 
      48             : public:
      49           0 :     struct AccessControl { friend class FmGridControl; private: AccessControl() { } };
      50             : 
      51           0 :     inline  void    triggerColumnContextMenu( const ::Point& _rPreferredPos, const AccessControl& )
      52             :     {
      53           0 :         triggerColumnContextMenu( _rPreferredPos );
      54           0 :     }
      55             : 
      56             : protected:
      57             :     virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
      58             :     virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
      59             :     virtual void Select() SAL_OVERRIDE;
      60             : 
      61             :     /** the value returned by GetItemPos is meaningless for the grid model if there are hidden columns,
      62             :         so use GetModelColumnPos instead
      63             :     */
      64             :     sal_uInt16 GetModelColumnPos(sal_uInt16 nId) const;
      65             : 
      66             :     /** This is called before executing a context menu for a column. rMenu contains the initial entries
      67             :         handled by this base class' method (which always has to be called).
      68             :         Derived classes may alter the menu in any way and handle any additional entries in
      69             :         PostExecuteColumnContextMenu.
      70             :         All disabled entries will be removed before executing the menu, so be careful with separators
      71             :         near entries you probably wish to disable ...
      72             :     */
      73             :     virtual void    PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu);
      74             :     /** After executing the context menu for a column this method is called.
      75             :     */
      76             :     virtual void    PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult);
      77             : 
      78             :     // DropTargetHelper
      79             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
      80             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
      81             : 
      82             :     /** selects the column at the selection supplier.
      83             :         @param  nColumnId
      84             :             The column id.
      85             :     */
      86             :     void notifyColumnSelect(sal_uInt16 nColumnId);
      87             : private:
      88             :     DECL_LINK( OnAsyncExecuteDrop, void* );
      89             : };
      90             : 
      91             : 
      92             : // FmGridControl
      93             : 
      94             : class FmXGridPeer;
      95          20 : class SVX_DLLPUBLIC SAL_WARN_UNUSED FmGridControl : public DbGridControl
      96             : 
      97             : {
      98             :     friend class FmGridHeader;
      99             :     friend class FmXGridPeer;
     100             : 
     101             :     FmXGridPeer*        m_pPeer;
     102             :     sal_Int32           m_nCurrentSelectedColumn;   // this is the column model (not the view) posisition ...
     103             :     sal_uInt16          m_nMarkedColumnId;
     104             :     bool                m_bSelecting;
     105             :     bool                m_bInColumnMove : 1;
     106             : 
     107             : public:
     108             :     FmGridControl(
     109             :         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
     110             :         vcl::Window* pParent,
     111             :         FmXGridPeer* _pPeer,
     112             :         WinBits nBits);
     113             : 
     114             :     // Window
     115             :     virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     116             : 
     117             :     // ::com::sun::star::beans::XPropertyChangeListener
     118             :     void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt);
     119             : 
     120             :     // ::com::sun::star::form::XPositioningListener
     121             :     void positioned(const ::com::sun::star::lang::EventObject& rEvent);
     122             : 
     123             :     // XBound
     124             :     bool commit();
     125             : 
     126             :     // ::com::sun::star::form::XInsertListener
     127             :     void inserted(const ::com::sun::star::lang::EventObject& rEvent);
     128             : 
     129             :     void markColumn(sal_uInt16 nId);
     130             :     bool isColumnMarked(sal_uInt16 nId) const;
     131             : 
     132           0 :     sal_Int32   GetSelectedColumn() const { return m_nCurrentSelectedColumn;}
     133             : 
     134             :     /** return the name of the specified object.
     135             :         @param  eObjType
     136             :             The type to ask for
     137             :         @param  _nPosition
     138             :             The position of a tablecell (index position), header bar  column/row cell
     139             :         @return
     140             :             The name of the specified object.
     141             :     */
     142             :     virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
     143             : 
     144             :     /** return the description of the specified object.
     145             :         @param  eObjType
     146             :             The type to ask for
     147             :         @param  _nPosition
     148             :             The position of a tablecell (index position), header bar  column/row cell
     149             :         @return
     150             :             The description of the specified object.
     151             :     */
     152             :     virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
     153             : 
     154             : protected:
     155             :     virtual void Command(const CommandEvent& rEvt) SAL_OVERRIDE;
     156             : 
     157             :     virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
     158             :     virtual long QueryMinimumRowHeight() SAL_OVERRIDE;
     159             :     virtual void RowHeightChanged() SAL_OVERRIDE;
     160             :     virtual void ColumnResized(sal_uInt16 nId) SAL_OVERRIDE;
     161             :     virtual void ColumnMoved(sal_uInt16 nId) SAL_OVERRIDE;
     162             :     virtual void DeleteSelectedRows() SAL_OVERRIDE;
     163             :     virtual void SetDesignMode(bool bMode) SAL_OVERRIDE;
     164             :     virtual void CellModified() SAL_OVERRIDE;
     165             :     virtual void HideColumn(sal_uInt16 nId) SAL_OVERRIDE;
     166             :     virtual void ShowColumn(sal_uInt16 nId) SAL_OVERRIDE;
     167             : 
     168          55 :     bool    IsInColumnMove() const {return m_bInColumnMove;}
     169             : 
     170             :     virtual void BeginCursorAction() SAL_OVERRIDE;
     171             :     virtual void EndCursorAction() SAL_OVERRIDE;
     172             :     virtual void Select() SAL_OVERRIDE;
     173             : 
     174             :     // Initialize columns
     175             :     // a.) only by column description
     176             :     void InitColumnsByModels(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xColumns);
     177             :     // b.) during alivemode by database fields
     178             :     virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) SAL_OVERRIDE;
     179             : 
     180             :             // some kind of impl version (for one single column) of our version of InitColumnsByFields
     181             :             static void InitColumnByField(
     182             :                     DbGridColumn* _pColumn,
     183             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumnModel,
     184             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxFieldsByNames,
     185             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxFieldsByIndex
     186             :                 );
     187             : 
     188          21 :     FmXGridPeer* GetPeer() const {return m_pPeer;}
     189             : 
     190             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
     191             :             getSelectionBookmarks();
     192             :     bool selectBookmarks(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& _rBookmarks);
     193             : 
     194             :     /** returns if a column is selected
     195             :         @param  nColumnId
     196             :             The column id.
     197             :         @param  _pColumn
     198             :             The column to compare with.
     199             :         @return
     200             :             <TRUE/> if the column is selected, otherwise <FALSE/>
     201             :     */
     202             :     bool isColumnSelected(sal_uInt16 nColumnId,DbGridColumn* _pColumn);
     203             : };
     204             : 
     205             : #endif // INCLUDED_SVX_FMGRIDCL_HXX
     206             : 
     207             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11