LCOV - code coverage report
Current view: top level - toolkit/source/controls/grid - gridcontrol.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 15 15 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCONTROL_HXX
      21             : #define INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCONTROL_HXX
      22             : 
      23             : #include <com/sun/star/awt/grid/XGridControl.hpp>
      24             : #include <com/sun/star/awt/grid/XGridRowSelection.hpp>
      25             : 
      26             : #include <toolkit/controls/unocontrolbase.hxx>
      27             : #include <toolkit/controls/unocontrolmodel.hxx>
      28             : #include <toolkit/helper/servicenames.hxx>
      29             : #include <cppuhelper/implbase2.hxx>
      30             : #include <comphelper/sequence.hxx>
      31             : #include <toolkit/helper/listenermultiplexer.hxx>
      32             : 
      33             : #include <boost/scoped_ptr.hpp>
      34             : 
      35             : namespace toolkit
      36             : {
      37             : 
      38             : class GridEventForwarder;
      39             : 
      40             : 
      41             : // = UnoGridModel
      42             : 
      43          20 : class UnoGridModel : public UnoControlModel
      44             : {
      45             : protected:
      46             :     ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const SAL_OVERRIDE;
      47             :     ::cppu::IPropertyArrayHelper&   SAL_CALL getInfoHelper() SAL_OVERRIDE;
      48             : 
      49             : public:
      50             :     explicit UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_factory );
      51             :     UnoGridModel( const UnoGridModel& rModel );
      52             : 
      53             :     UnoControlModel* Clone() const SAL_OVERRIDE;
      54             : 
      55             :     // ::com::sun::star::lang::XComponent
      56             :     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      57             : 
      58             :     // ::com::sun::star::beans::XMultiPropertySet
      59             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      60             : 
      61             :     // ::com::sun::star::io::XPersistObject
      62             :     OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             : 
      64             :     // OPropertySetHelper
      65             :     void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
      66             : 
      67             :     // XServiceInfo
      68           1 :     OUString SAL_CALL getImplementationName()
      69             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      70           1 :     { return OUString("stardiv.Toolkit.GridControlModel"); }
      71             : 
      72           2 :     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
      73             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      74             :     {
      75           2 :         auto s(UnoControlModel::getSupportedServiceNames());
      76           2 :         s.realloc(s.getLength() + 1);
      77           2 :         s[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGridModel";
      78           2 :         return s;
      79             :     }
      80             : };
      81             : 
      82             : 
      83             : 
      84             : // = UnoGridControl
      85             : 
      86             : typedef ::cppu::ImplInheritanceHelper2  <   UnoControlBase
      87             :                                         ,   ::com::sun::star::awt::grid::XGridControl
      88             :                                         ,   ::com::sun::star::awt::grid::XGridRowSelection
      89             :                                         >   UnoGridControl_Base;
      90             : class UnoGridControl : public UnoGridControl_Base
      91             : {
      92             : public:
      93             :     UnoGridControl();
      94             :     OUString             GetComponentServiceName() SAL_OVERRIDE;
      95             : 
      96             :     // ::com::sun::star::lang::XComponent
      97             :     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             : 
      99             :     // ::com::sun::star::awt::XControl
     100             :     void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             : 
     103             :     // ::com::sun::star::awt::grid::XGridControl
     104             :     virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             :     virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     106             :     virtual ::sal_Int32 SAL_CALL getCurrentColumn(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     107             :     virtual ::sal_Int32 SAL_CALL getCurrentRow(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             :     virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::util::VetoException, std::exception) SAL_OVERRIDE;
     109             : 
     110             :     // ::com::sun::star::awt::grid::XGridRowSelection
     111             :     virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception ) SAL_OVERRIDE;
     112             :     virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception ) SAL_OVERRIDE;
     114             :     virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             :     virtual sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             :     virtual sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     118             :     virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :     virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             : 
     121             :     // ::com::sun::star::lang::XServiceInfo
     122           1 :     OUString SAL_CALL getImplementationName()
     123             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     124           1 :     { return OUString("stardiv.Toolkit.GridControl"); }
     125             : 
     126           1 :     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
     127             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     128             :     {
     129           1 :         auto s(UnoControlBase::getSupportedServiceNames());
     130           1 :         s.realloc(s.getLength() + 1);
     131           1 :         s[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGrid";
     132           1 :         return s;
     133             :     }
     134             : 
     135             :     using UnoControl::getPeer;
     136             : 
     137             : protected:
     138             :     virtual ~UnoGridControl();
     139             : 
     140             : private:
     141             :     SelectionListenerMultiplexer                m_aSelectionListeners;
     142             :     ::boost::scoped_ptr< GridEventForwarder >   m_pEventForwarder;
     143             : };
     144             : 
     145             : } // toolkit
     146             : 
     147             : #endif // _TOOLKIT_TREE_CONTROL_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11