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

Generated by: LCOV version 1.10