LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svx - fmgridcl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 7 42.9 %
Date: 2013-07-09 Functions: 3 6 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             : #ifndef _SVX_FMGRIDCL_HXX
      20             : #define _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             :     ~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 );
      57             :     virtual void RequestHelp( const HelpEvent& rHEvt );
      58             :     virtual void Select();
      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 );
      79             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
      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          21 : 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             :     sal_Bool            m_bSelecting;
     104             :     sal_Bool            m_bInColumnMove : 1;
     105             : 
     106             : public:
     107             :     FmGridControl(
     108             :         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
     109             :         Window* pParent,
     110             :         FmXGridPeer* _pPeer,
     111             :         WinBits nBits);
     112             : 
     113             :     // Window
     114             :     virtual void KeyInput( const KeyEvent& rKEvt );
     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             :     sal_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             :     sal_Bool isColumnMarked(sal_uInt16 nId) const;
     130             : 
     131             :     sal_Int32   GetSelectedColumn() const;
     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  colum/row cell
     138             :         @return
     139             :             The name of the specified object.
     140             :     */
     141             :     virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
     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  colum/row cell
     148             :         @return
     149             :             The description of the specified object.
     150             :     */
     151             :     virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
     152             : 
     153             : protected:
     154             :     virtual void Command(const CommandEvent& rEvt);
     155             : 
     156             :     virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent);
     157             :     virtual long QueryMinimumRowHeight();
     158             :     virtual void RowHeightChanged();
     159             :     virtual void ColumnResized(sal_uInt16 nId);
     160             :     virtual void ColumnMoved(sal_uInt16 nId);
     161             :     virtual void DeleteSelectedRows();
     162             :     virtual void SetDesignMode(sal_Bool bMode);
     163             :     virtual void CellModified();
     164             :     virtual void HideColumn(sal_uInt16 nId);
     165             :     virtual void ShowColumn(sal_uInt16 nId);
     166             : 
     167          55 :     sal_Bool    IsInColumnMove() const {return m_bInColumnMove;}
     168             : 
     169             :     virtual void BeginCursorAction();
     170             :     virtual void EndCursorAction();
     171             :     virtual void Select();
     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);
     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          22 :     FmXGridPeer* GetPeer() const {return m_pPeer;}
     188             : 
     189             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
     190             :             getSelectionBookmarks();
     191             :     sal_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             :     sal_Bool isColumnSelected(sal_uInt16 nColumnId,DbGridColumn* _pColumn);
     202             : };
     203             : 
     204             : #endif // _SVX_FMGRIDCL_HXX
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10