LCOV - code coverage report
Current view: top level - toolkit/source/controls/grid - gridcolumn.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 121 0.0 %
Date: 2014-04-14 Functions: 0 38 0.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             : #include "gridcolumn.hxx"
      21             : 
      22             : #include <com/sun/star/uno/XComponentContext.hpp>
      23             : #include <comphelper/sequence.hxx>
      24             : #include <cppuhelper/supportsservice.hxx>
      25             : #include <cppuhelper/typeprovider.hxx>
      26             : 
      27             : namespace toolkit
      28             : {
      29             :     using namespace ::com::sun::star;
      30             :     using namespace ::com::sun::star::uno;
      31             :     using namespace ::com::sun::star::awt;
      32             :     using namespace ::com::sun::star::awt::grid;
      33             :     using namespace ::com::sun::star::lang;
      34             :     using namespace ::com::sun::star::util;
      35             :     using namespace ::com::sun::star::style;
      36             : 
      37             : 
      38             :     //= DefaultGridColumnModel
      39             : 
      40             : 
      41           0 :     GridColumn::GridColumn()
      42             :         :GridColumn_Base( m_aMutex )
      43             :         ,m_aIdentifier()
      44             :         ,m_nIndex(-1)
      45             :         ,m_nDataColumnIndex(-1)
      46             :         ,m_nColumnWidth(4)
      47             :         ,m_nMaxWidth(0)
      48             :         ,m_nMinWidth(0)
      49             :         ,m_nFlexibility(1)
      50             :         ,m_bResizeable(true)
      51           0 :         ,m_eHorizontalAlign( HorizontalAlignment_LEFT )
      52             :     {
      53           0 :     }
      54             : 
      55             : 
      56           0 :     GridColumn::GridColumn( GridColumn const & i_copySource )
      57             :         :cppu::BaseMutex()
      58             :         ,GridColumn_Base( m_aMutex )
      59             :         ,m_aIdentifier( i_copySource.m_aIdentifier )
      60             :         ,m_nIndex( -1 )
      61             :         ,m_nDataColumnIndex( i_copySource.m_nDataColumnIndex )
      62             :         ,m_nColumnWidth( i_copySource.m_nColumnWidth )
      63             :         ,m_nMaxWidth( i_copySource.m_nMaxWidth )
      64             :         ,m_nMinWidth( i_copySource.m_nMinWidth )
      65             :         ,m_nFlexibility( i_copySource.m_nFlexibility )
      66             :         ,m_bResizeable( i_copySource.m_bResizeable )
      67             :         ,m_sTitle( i_copySource.m_sTitle )
      68             :         ,m_sHelpText( i_copySource.m_sHelpText )
      69           0 :         ,m_eHorizontalAlign( i_copySource.m_eHorizontalAlign )
      70             :     {
      71           0 :     }
      72             : 
      73             : 
      74           0 :     GridColumn::~GridColumn()
      75             :     {
      76           0 :     }
      77             : 
      78             : 
      79           0 :     void GridColumn::broadcast_changed( sal_Char const * const i_asciiAttributeName, Any i_oldValue, Any i_newValue,
      80             :         ::comphelper::ComponentGuard& i_Guard )
      81             :     {
      82           0 :         Reference< XInterface > const xSource( static_cast< ::cppu::OWeakObject* >( this ) );
      83             :         GridColumnEvent const aEvent(
      84             :             xSource, OUString::createFromAscii( i_asciiAttributeName ),
      85             :             i_oldValue, i_newValue, m_nIndex
      86           0 :         );
      87             : 
      88           0 :         ::cppu::OInterfaceContainerHelper* pIter = rBHelper.getContainer( cppu::UnoType<XGridColumnListener>::get() );
      89             : 
      90           0 :         i_Guard.clear();
      91           0 :         if( pIter )
      92           0 :             pIter->notifyEach( &XGridColumnListener::columnChanged, aEvent );
      93           0 :     }
      94             : 
      95             : 
      96           0 :     ::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException, std::exception)
      97             :     {
      98           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
      99           0 :         return m_aIdentifier;
     100             :     }
     101             : 
     102             : 
     103           0 :     void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException, std::exception)
     104             :     {
     105           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     106           0 :         m_aIdentifier = value;
     107           0 :     }
     108             : 
     109             : 
     110           0 :     ::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException, std::exception)
     111             :     {
     112           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     113           0 :         return m_nColumnWidth;
     114             :     }
     115             : 
     116             : 
     117           0 :     void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException, std::exception)
     118             :     {
     119           0 :         impl_set( m_nColumnWidth, value, "ColumnWidth" );
     120           0 :     }
     121             : 
     122             : 
     123           0 :     ::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException, std::exception)
     124             :     {
     125           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     126           0 :         return m_nMaxWidth;
     127             :     }
     128             : 
     129             : 
     130           0 :     void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException, std::exception)
     131             :     {
     132           0 :         impl_set( m_nMaxWidth, value, "MaxWidth" );
     133           0 :     }
     134             : 
     135             : 
     136           0 :     ::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException, std::exception)
     137             :     {
     138           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     139           0 :         return m_nMinWidth;
     140             :     }
     141             : 
     142             : 
     143           0 :     void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException, std::exception)
     144             :     {
     145           0 :         impl_set( m_nMinWidth, value, "MinWidth" );
     146           0 :     }
     147             : 
     148             : 
     149           0 :     OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException, std::exception)
     150             :     {
     151           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     152           0 :         return m_sTitle;
     153             :     }
     154             : 
     155             : 
     156           0 :     void SAL_CALL GridColumn::setTitle(const OUString & value) throw (::com::sun::star::uno::RuntimeException, std::exception)
     157             :     {
     158           0 :         impl_set( m_sTitle, value, "Title" );
     159           0 :     }
     160             : 
     161             : 
     162           0 :     OUString SAL_CALL GridColumn::getHelpText() throw (RuntimeException, std::exception)
     163             :     {
     164           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     165           0 :         return m_sHelpText;
     166             :     }
     167             : 
     168             : 
     169           0 :     void SAL_CALL GridColumn::setHelpText( const OUString & value ) throw (RuntimeException, std::exception)
     170             :     {
     171           0 :         impl_set( m_sHelpText, value, "HelpText" );
     172           0 :     }
     173             : 
     174             : 
     175           0 :     sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException, std::exception)
     176             :     {
     177           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     178           0 :         return m_bResizeable;
     179             :     }
     180             : 
     181             : 
     182           0 :     void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException, std::exception)
     183             :     {
     184           0 :         impl_set( m_bResizeable, bool(value), "Resizeable" );
     185           0 :     }
     186             : 
     187             : 
     188           0 :     ::sal_Int32 SAL_CALL GridColumn::getFlexibility() throw (RuntimeException, std::exception)
     189             :     {
     190           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     191           0 :         return m_nFlexibility;
     192             :     }
     193             : 
     194             : 
     195           0 :     void SAL_CALL GridColumn::setFlexibility( ::sal_Int32 i_value ) throw (IllegalArgumentException, RuntimeException, std::exception)
     196             :     {
     197           0 :         if ( i_value < 0 )
     198           0 :             throw IllegalArgumentException( OUString(), *this, 1 );
     199           0 :         impl_set( m_nFlexibility, i_value, "Flexibility" );
     200           0 :     }
     201             : 
     202             : 
     203           0 :     HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException, std::exception)
     204             :     {
     205           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     206           0 :         return m_eHorizontalAlign;
     207             :     }
     208             : 
     209             : 
     210           0 :     void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException, std::exception)
     211             :     {
     212           0 :         impl_set( m_eHorizontalAlign, align, "HorizontalAlign" );
     213           0 :     }
     214             : 
     215             : 
     216           0 :     void SAL_CALL GridColumn::addGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException, std::exception)
     217             :     {
     218           0 :         rBHelper.addListener( cppu::UnoType<XGridColumnListener>::get(), xListener );
     219           0 :     }
     220             : 
     221             : 
     222           0 :     void SAL_CALL GridColumn::removeGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException, std::exception)
     223             :     {
     224           0 :         rBHelper.removeListener( cppu::UnoType<XGridColumnListener>::get(), xListener );
     225           0 :     }
     226             : 
     227             : 
     228           0 :     void SAL_CALL GridColumn::disposing()
     229             :     {
     230           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     231           0 :         m_aIdentifier.clear();
     232           0 :         m_sTitle = m_sHelpText = OUString();
     233           0 :     }
     234             : 
     235             : 
     236           0 :     ::sal_Int32 SAL_CALL GridColumn::getIndex() throw (RuntimeException, std::exception)
     237             :     {
     238           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     239           0 :         return m_nIndex;
     240             :     }
     241             : 
     242             : 
     243           0 :     void GridColumn::setIndex( sal_Int32 const i_index )
     244             :     {
     245           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     246           0 :         m_nIndex = i_index;
     247           0 :     }
     248             : 
     249             : 
     250           0 :     ::sal_Int32 SAL_CALL GridColumn::getDataColumnIndex() throw(RuntimeException, std::exception)
     251             :     {
     252           0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     253           0 :         return m_nDataColumnIndex;
     254             :     }
     255             : 
     256             : 
     257           0 :     void SAL_CALL GridColumn::setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(RuntimeException, std::exception)
     258             :     {
     259           0 :         impl_set( m_nDataColumnIndex, i_dataColumnIndex, "DataColumnIndex" );
     260           0 :     }
     261             : 
     262             : 
     263           0 :     OUString SAL_CALL GridColumn::getImplementationName(  ) throw (RuntimeException, std::exception)
     264             :     {
     265           0 :         return OUString( "org.openoffice.comp.toolkit.GridColumn" );
     266             :     }
     267             : 
     268           0 :     sal_Bool SAL_CALL GridColumn::supportsService( const OUString& i_serviceName ) throw (RuntimeException, std::exception)
     269             :     {
     270           0 :         return cppu::supportsService(this, i_serviceName);
     271             :     }
     272             : 
     273           0 :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL GridColumn::getSupportedServiceNames(  ) throw (RuntimeException, std::exception)
     274             :     {
     275           0 :         const OUString aServiceName("com.sun.star.awt.grid.GridColumn");
     276           0 :         const Sequence< OUString > aSeq( &aServiceName, 1 );
     277           0 :         return aSeq;
     278             :     }
     279             : 
     280             : 
     281           0 :     Reference< XCloneable > SAL_CALL GridColumn::createClone(  ) throw (RuntimeException, std::exception)
     282             :     {
     283           0 :         return new GridColumn( *this );
     284             :     }
     285             : 
     286             : 
     287           0 :     sal_Int64 SAL_CALL GridColumn::getSomething( const Sequence< sal_Int8 >& i_identifier ) throw(RuntimeException, std::exception)
     288             :     {
     289           0 :         if ( ( i_identifier.getLength() == 16 ) && ( i_identifier == getUnoTunnelId() ) )
     290           0 :             return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
     291           0 :         return 0;
     292             :     }
     293             : 
     294             : 
     295           0 :     Sequence< sal_Int8 > GridColumn::getUnoTunnelId() throw()
     296             :     {
     297           0 :         static ::cppu::OImplementationId const aId;
     298           0 :         return aId.getImplementationId();
     299             :     }
     300             : 
     301             : 
     302           0 :     GridColumn* GridColumn::getImplementation( const Reference< XInterface >& i_component )
     303             :     {
     304           0 :         Reference< XUnoTunnel > const xTunnel( i_component, UNO_QUERY );
     305           0 :         if ( xTunnel.is() )
     306           0 :             return reinterpret_cast< GridColumn* >( ::sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( getUnoTunnelId() ) ) );
     307           0 :         return NULL;
     308             :     }
     309             : }
     310             : 
     311             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     312           0 : org_openoffice_comp_toolkit_GridColumn_get_implementation(
     313             :     css::uno::XComponentContext *,
     314             :     css::uno::Sequence<css::uno::Any> const &)
     315             : {
     316           0 :     return cppu::acquire(new toolkit::GridColumn());
     317             : }
     318             : 
     319             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10