LCOV - code coverage report
Current view: top level - libreoffice/forms/source/component - Columns.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 287 0.0 %
Date: 2012-12-27 Functions: 0 82 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 <string.h>
      21             : 
      22             : #include "Columns.hxx"
      23             : #include "property.hrc"
      24             : #include "property.hxx"
      25             : #include "componenttools.hxx"
      26             : #include "ids.hxx"
      27             : #include "findpos.hxx"
      28             : #include <com/sun/star/io/XPersistObject.hpp>
      29             : #include <com/sun/star/io/XObjectOutputStream.hpp>
      30             : #include <com/sun/star/io/XObjectInputStream.hpp>
      31             : #include <com/sun/star/io/XMarkableStream.hpp>
      32             : #include <com/sun/star/form/XFormComponent.hpp>
      33             : #include <com/sun/star/lang/XServiceInfo.hpp>
      34             : #include <com/sun/star/form/binding/XBindableValue.hpp>
      35             : #include <com/sun/star/beans/XPropertyContainer.hpp>
      36             : #include <com/sun/star/text/XText.hpp>
      37             : #include <comphelper/sequence.hxx>
      38             : #include <comphelper/property.hxx>
      39             : #include <comphelper/basicio.hxx>
      40             : #include <comphelper/types.hxx>
      41             : #include <comphelper/servicehelper.hxx>
      42             : #include "services.hxx"
      43             : #include "frm_resource.hrc"
      44             : #include <tools/debug.hxx>
      45             : 
      46             : //.........................................................................
      47             : namespace frm
      48             : {
      49             : //.........................................................................
      50             : using namespace ::com::sun::star::uno;
      51             : using namespace ::com::sun::star::beans;
      52             : using namespace ::com::sun::star::container;
      53             : using namespace ::com::sun::star::form;
      54             : using namespace ::com::sun::star::awt;
      55             : using namespace ::com::sun::star::io;
      56             : using namespace ::com::sun::star::lang;
      57             : using namespace ::com::sun::star::util;
      58             : using namespace ::com::sun::star::text;
      59             : using namespace ::com::sun::star::form::binding;
      60             : 
      61             : const sal_uInt16 WIDTH              = 0x0001;
      62             : const sal_uInt16 ALIGN              = 0x0002;
      63             : const sal_uInt16 OLD_HIDDEN         = 0x0004;
      64             : const sal_uInt16 COMPATIBLE_HIDDEN  = 0x0008;
      65             : 
      66             : //------------------------------------------------------------------------------
      67           0 : const StringSequence& getColumnTypes()
      68             : {
      69           0 :     static StringSequence aColumnTypes(10);
      70           0 :     if (aColumnTypes.getConstArray()[0].isEmpty())
      71             :     {
      72           0 :         ::rtl::OUString* pNames = aColumnTypes.getArray();
      73           0 :         pNames[TYPE_CHECKBOX]       = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckBox" ) );
      74           0 :         pNames[TYPE_COMBOBOX]       = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboBox" ) );
      75           0 :         pNames[TYPE_CURRENCYFIELD]  = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencyField" ) );
      76           0 :         pNames[TYPE_DATEFIELD]      = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateField" ) );
      77           0 :         pNames[TYPE_FORMATTEDFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormattedField" ) );
      78           0 :         pNames[TYPE_LISTBOX]        = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListBox" ) );
      79           0 :         pNames[TYPE_NUMERICFIELD]   = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumericField" ) );
      80           0 :         pNames[TYPE_PATTERNFIELD]   = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PatternField" ) );
      81           0 :         pNames[TYPE_TEXTFIELD]      = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) );
      82           0 :         pNames[TYPE_TIMEFIELD]      = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeField" ) );
      83             :     }
      84           0 :     return aColumnTypes;
      85             : }
      86             : 
      87             : //------------------------------------------------------------------------------
      88           0 : sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName)
      89             : {
      90           0 :     const ::rtl::OUString aModelPrefix (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.") );
      91           0 :     const ::rtl::OUString aCompatibleModelPrefix (RTL_CONSTASCII_USTRINGPARAM("stardiv.one.form.component.") );
      92             : 
      93           0 :     sal_Int32 nTypeId = -1;
      94           0 :     if (aModelName == FRM_COMPONENT_EDIT)
      95           0 :         nTypeId = TYPE_TEXTFIELD;
      96             :     else
      97             :     {
      98           0 :         sal_Int32 nPrefixPos = aModelName.indexOf(aModelPrefix);
      99             : #ifdef DBG_UTIL
     100             :         sal_Int32 nCompatiblePrefixPos = aModelName.indexOf(aCompatibleModelPrefix);
     101             : #endif
     102             :         DBG_ASSERT( (nPrefixPos != -1) ||   (nCompatiblePrefixPos != -1),
     103             :                 "::getColumnTypeByModelName() : wrong servivce !");
     104             : 
     105             :         ::rtl::OUString aColumnType = (nPrefixPos != -1)
     106             :             ? aModelName.copy(aModelPrefix.getLength())
     107           0 :             : aModelName.copy(aCompatibleModelPrefix.getLength());
     108             : 
     109           0 :         const StringSequence& rColumnTypes = getColumnTypes();
     110           0 :         nTypeId = ::detail::findPos(aColumnType, rColumnTypes);
     111             :     }
     112           0 :     return nTypeId;
     113             : }
     114             : 
     115             : /*************************************************************************/
     116             : 
     117             : namespace
     118             : {
     119             :     class theOGridColumnImplementationId : public rtl::Static< UnoTunnelIdInit, theOGridColumnImplementationId > {};
     120             : }
     121             : 
     122           0 : const Sequence<sal_Int8>& OGridColumn::getUnoTunnelImplementationId()
     123             : {
     124           0 :     return theOGridColumnImplementationId::get().getSeq();
     125             : }
     126             : 
     127             : //------------------------------------------------------------------
     128           0 : sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence<sal_Int8>& _rIdentifier) throw(RuntimeException)
     129             : {
     130           0 :     sal_Int64 nReturn(0);
     131             : 
     132           0 :     if  (   (_rIdentifier.getLength() == 16)
     133           0 :         &&  (0 == memcmp( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
     134             :         )
     135             :     {
     136           0 :         nReturn = reinterpret_cast<sal_Int64>(this);
     137             :     }
     138             :     else
     139             :     {
     140           0 :         Reference< XUnoTunnel > xAggTunnel;
     141           0 :         if ( query_aggregation( m_xAggregate, xAggTunnel ) )
     142           0 :             return xAggTunnel->getSomething( _rIdentifier );
     143             :     }
     144           0 :     return nReturn;
     145             : }
     146             : 
     147             : //------------------------------------------------------------------
     148           0 : Sequence<sal_Int8> SAL_CALL OGridColumn::getImplementationId() throw(RuntimeException)
     149             : {
     150           0 :     return OImplementationIds::getImplementationId(getTypes());
     151             : }
     152             : 
     153             : //------------------------------------------------------------------
     154           0 : Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
     155             : {
     156           0 :     TypeBag aTypes( OGridColumn_BASE::getTypes() );
     157             :     // erase the types which we do not support
     158           0 :     aTypes.removeType( XFormComponent::static_type() );
     159           0 :     aTypes.removeType( XServiceInfo::static_type() );
     160           0 :     aTypes.removeType( XBindableValue::static_type() );
     161           0 :     aTypes.removeType( XPropertyContainer::static_type() );
     162             : 
     163             :     // but re-add their base class(es)
     164           0 :     aTypes.addType( XChild::static_type() );
     165             : 
     166           0 :     Reference< XTypeProvider > xProv;
     167           0 :     if ( query_aggregation( m_xAggregate, xProv ))
     168           0 :         aTypes.addTypes( xProv->getTypes() );
     169             : 
     170           0 :     aTypes.removeType( XTextRange::static_type() );
     171           0 :     aTypes.removeType( XSimpleText::static_type() );
     172           0 :     aTypes.removeType( XText::static_type() );
     173             : 
     174           0 :     return aTypes.getTypes();
     175             : }
     176             : 
     177             : //------------------------------------------------------------------
     178           0 : Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeException)
     179             : {
     180           0 :     Any aReturn;
     181             :     // some functionality at our aggregate cannot be reasonably fullfilled here.
     182           0 :     if  (   _rType.equals(::getCppuType(static_cast< Reference< XFormComponent >* >(NULL)))
     183           0 :         ||  _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL)))
     184           0 :         ||  _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL)))
     185           0 :         ||  _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL)))
     186           0 :         ||  comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType)
     187             :         )
     188           0 :         return aReturn;
     189             : 
     190           0 :     aReturn = OGridColumn_BASE::queryAggregation(_rType);
     191           0 :     if (!aReturn.hasValue())
     192             :     {
     193           0 :         aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
     194           0 :         if (!aReturn.hasValue() && m_xAggregate.is())
     195           0 :             aReturn = m_xAggregate->queryAggregation(_rType);
     196             :     }
     197             : 
     198           0 :     return aReturn;
     199             : }
     200             : 
     201             : DBG_NAME(OGridColumn);
     202             : //------------------------------------------------------------------------------
     203           0 : OGridColumn::OGridColumn( const comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName )
     204             :     :OGridColumn_BASE(m_aMutex)
     205             :     ,OPropertySetAggregationHelper(OGridColumn_BASE::rBHelper)
     206             :     ,m_aHidden( makeAny( sal_False ) )
     207             :     ,m_aContext( _rContext )
     208           0 :     ,m_aModelName(_sModelName)
     209             : {
     210             :     DBG_CTOR(OGridColumn,NULL);
     211             : 
     212             :     // Create the UnoControlModel
     213           0 :     if ( !m_aModelName.isEmpty() ) // is there a to-be-aggregated model?
     214             :     {
     215           0 :         increment( m_refCount );
     216             : 
     217             :         {
     218           0 :             m_xAggregate.set( m_aContext.createComponent( m_aModelName ), UNO_QUERY );
     219           0 :             setAggregation( m_xAggregate );
     220             :         }
     221             : 
     222           0 :         if ( m_xAggregate.is() )
     223             :         {   // don't omit those brackets - they ensure that the following temporary is properly deleted
     224           0 :             m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) );
     225             :         }
     226             : 
     227             :         // Set refcount back to zero
     228           0 :         decrement( m_refCount );
     229             :     }
     230           0 : }
     231             : 
     232             : //------------------------------------------------------------------------------
     233           0 : OGridColumn::OGridColumn( const OGridColumn* _pOriginal )
     234             :     :OGridColumn_BASE( m_aMutex )
     235             :     ,OPropertySetAggregationHelper( OGridColumn_BASE::rBHelper )
     236           0 :     ,m_aContext( _pOriginal->m_aContext )
     237             : {
     238             :     DBG_CTOR(OGridColumn,NULL);
     239             : 
     240           0 :     m_aWidth = _pOriginal->m_aWidth;
     241           0 :     m_aAlign = _pOriginal->m_aAlign;
     242           0 :     m_aHidden = _pOriginal->m_aHidden;
     243           0 :     m_aModelName = _pOriginal->m_aModelName;
     244           0 :     m_aLabel = _pOriginal->m_aLabel;
     245             : 
     246           0 :     increment( m_refCount );
     247             :     {
     248             :         {
     249           0 :             m_xAggregate = createAggregateClone( _pOriginal );
     250           0 :             setAggregation( m_xAggregate );
     251             :         }
     252             : 
     253           0 :         if ( m_xAggregate.is() )
     254             :         {   // don't omit this brackets - they ensure that the following temporary is properly deleted
     255           0 :             m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) );
     256             :         }
     257             :     }
     258           0 :     decrement( m_refCount );
     259           0 : }
     260             : 
     261             : //------------------------------------------------------------------------------
     262           0 : OGridColumn::~OGridColumn()
     263             : {
     264           0 :     if (!OGridColumn_BASE::rBHelper.bDisposed)
     265             :     {
     266           0 :         acquire();
     267           0 :         dispose();
     268             :     }
     269             : 
     270             :     // Free the aggregate
     271           0 :     if (m_xAggregate.is())
     272             :     {
     273           0 :         InterfaceRef  xIface;
     274           0 :         m_xAggregate->setDelegator(xIface);
     275             :     }
     276             : 
     277             :     DBG_DTOR(OGridColumn,NULL);
     278           0 : }
     279             : 
     280             : // XEventListener
     281             : //------------------------------------------------------------------------------
     282           0 : void SAL_CALL OGridColumn::disposing(const EventObject& _rSource) throw(RuntimeException)
     283             : {
     284           0 :     OPropertySetAggregationHelper::disposing(_rSource);
     285             : 
     286           0 :     Reference<XEventListener>  xEvtLstner;
     287           0 :     if (query_aggregation(m_xAggregate, xEvtLstner))
     288           0 :         xEvtLstner->disposing(_rSource);
     289           0 : }
     290             : 
     291             : // OGridColumn_BASE
     292             : //-----------------------------------------------------------------------------
     293           0 : void OGridColumn::disposing()
     294             : {
     295           0 :     OGridColumn_BASE::disposing();
     296           0 :     OPropertySetAggregationHelper::disposing();
     297             : 
     298           0 :     Reference<XComponent>  xComp;
     299           0 :     if (query_aggregation(m_xAggregate, xComp))
     300           0 :         xComp->dispose();
     301           0 : }
     302             : 
     303             : //------------------------------------------------------------------------------
     304           0 : void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_Bool bAllowDropDown )
     305             : {
     306             :     // some properties are not to be exposed to the outer world
     307           0 :     ::std::set< ::rtl::OUString > aForbiddenProperties;
     308           0 :     aForbiddenProperties.insert( PROPERTY_ALIGN );
     309           0 :     aForbiddenProperties.insert( PROPERTY_AUTOCOMPLETE );
     310           0 :     aForbiddenProperties.insert( PROPERTY_BACKGROUNDCOLOR );
     311           0 :     aForbiddenProperties.insert( PROPERTY_BORDER );
     312           0 :     aForbiddenProperties.insert( PROPERTY_BORDERCOLOR );
     313           0 :     aForbiddenProperties.insert( PROPERTY_ECHO_CHAR );
     314           0 :     aForbiddenProperties.insert( PROPERTY_FILLCOLOR );
     315           0 :     aForbiddenProperties.insert( PROPERTY_FONT );
     316           0 :     aForbiddenProperties.insert( PROPERTY_FONT_NAME );
     317           0 :     aForbiddenProperties.insert( PROPERTY_FONT_STYLENAME );
     318           0 :     aForbiddenProperties.insert( PROPERTY_FONT_FAMILY );
     319           0 :     aForbiddenProperties.insert( PROPERTY_FONT_CHARSET );
     320           0 :     aForbiddenProperties.insert( PROPERTY_FONT_HEIGHT );
     321           0 :     aForbiddenProperties.insert( PROPERTY_FONT_WEIGHT );
     322           0 :     aForbiddenProperties.insert( PROPERTY_FONT_SLANT );
     323           0 :     aForbiddenProperties.insert( PROPERTY_FONT_UNDERLINE );
     324           0 :     aForbiddenProperties.insert( PROPERTY_FONT_STRIKEOUT );
     325           0 :     aForbiddenProperties.insert( PROPERTY_FONT_WORDLINEMODE );
     326           0 :     aForbiddenProperties.insert( PROPERTY_TEXTLINECOLOR );
     327           0 :     aForbiddenProperties.insert( PROPERTY_FONTEMPHASISMARK );
     328           0 :     aForbiddenProperties.insert( PROPERTY_FONTRELIEF );
     329           0 :     aForbiddenProperties.insert( PROPERTY_HARDLINEBREAKS );
     330           0 :     aForbiddenProperties.insert( PROPERTY_HSCROLL );
     331           0 :     aForbiddenProperties.insert( PROPERTY_LABEL );
     332           0 :     aForbiddenProperties.insert( PROPERTY_LINECOLOR );
     333           0 :     aForbiddenProperties.insert( PROPERTY_MULTISELECTION );
     334           0 :     aForbiddenProperties.insert( PROPERTY_PRINTABLE );
     335           0 :     aForbiddenProperties.insert( PROPERTY_TABINDEX );
     336           0 :     aForbiddenProperties.insert( PROPERTY_TABSTOP );
     337           0 :     aForbiddenProperties.insert( PROPERTY_TEXTCOLOR );
     338           0 :     aForbiddenProperties.insert( PROPERTY_VSCROLL );
     339           0 :     aForbiddenProperties.insert( PROPERTY_CONTROLLABEL );
     340           0 :     aForbiddenProperties.insert( PROPERTY_RICH_TEXT );
     341           0 :     aForbiddenProperties.insert( PROPERTY_VERTICAL_ALIGN );
     342           0 :     aForbiddenProperties.insert( PROPERTY_IMAGE_URL );
     343           0 :     aForbiddenProperties.insert( PROPERTY_IMAGE_POSITION );
     344           0 :     aForbiddenProperties.insert( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) );
     345           0 :     if ( !bAllowDropDown )
     346           0 :         aForbiddenProperties.insert( PROPERTY_DROPDOWN );
     347             : 
     348           0 :     Sequence< Property > aNewProps( _rProps.getLength() );
     349           0 :     Property* pNewProps = aNewProps.getArray();
     350             : 
     351           0 :     const Property* pProps = _rProps.getConstArray();
     352           0 :     const Property* pPropsEnd = pProps + _rProps.getLength();
     353           0 :     for ( ; pProps != pPropsEnd; ++pProps )
     354             :     {
     355           0 :         if ( aForbiddenProperties.find( pProps->Name ) == aForbiddenProperties.end() )
     356           0 :             *pNewProps++ = *pProps;
     357             :     }
     358             : 
     359           0 :     aNewProps.realloc( pNewProps - aNewProps.getArray() );
     360           0 :     _rProps = aNewProps;
     361           0 : }
     362             : 
     363             : //------------------------------------------------------------------------------
     364           0 : void OGridColumn::setOwnProperties(Sequence<Property>& aDescriptor)
     365             : {
     366           0 :     aDescriptor.realloc(5);
     367           0 :     Property* pProperties = aDescriptor.getArray();
     368           0 :     DECL_PROP1(LABEL,               ::rtl::OUString,    BOUND);
     369           0 :     DECL_PROP3(WIDTH,               sal_Int32,          BOUND, MAYBEVOID, MAYBEDEFAULT);
     370           0 :     DECL_PROP3(ALIGN,               sal_Int16,          BOUND, MAYBEVOID, MAYBEDEFAULT);
     371           0 :     DECL_BOOL_PROP2(HIDDEN,                             BOUND, MAYBEDEFAULT);
     372           0 :     DECL_PROP1(COLUMNSERVICENAME,   ::rtl::OUString,    READONLY);
     373           0 : }
     374             : 
     375             : // Reference<XPropertySet>
     376             : //------------------------------------------------------------------------------
     377           0 : void OGridColumn::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const
     378             : {
     379           0 :     switch (nHandle)
     380             :     {
     381             :         case PROPERTY_ID_COLUMNSERVICENAME:
     382           0 :             rValue <<= m_aModelName;
     383           0 :             break;
     384             :         case PROPERTY_ID_LABEL:
     385           0 :             rValue <<= m_aLabel;
     386           0 :             break;
     387             :         case PROPERTY_ID_WIDTH:
     388           0 :             rValue = m_aWidth;
     389           0 :             break;
     390             :         case PROPERTY_ID_ALIGN:
     391           0 :             rValue = m_aAlign;
     392           0 :             break;
     393             :         case PROPERTY_ID_HIDDEN:
     394           0 :             rValue = m_aHidden;
     395           0 :             break;
     396             :         default:
     397           0 :             OPropertySetAggregationHelper::getFastPropertyValue(rValue, nHandle);
     398             :     }
     399           0 : }
     400             : 
     401             : //------------------------------------------------------------------------------
     402           0 : sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue,
     403             :                                             sal_Int32 nHandle, const Any& rValue )throw( IllegalArgumentException )
     404             : {
     405           0 :     sal_Bool bModified(sal_False);
     406           0 :     switch (nHandle)
     407             :     {
     408             :         case PROPERTY_ID_LABEL:
     409           0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aLabel);
     410           0 :             break;
     411             :         case PROPERTY_ID_WIDTH:
     412           0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth, ::getCppuType((const sal_Int32*)NULL));
     413           0 :             break;
     414             :         case PROPERTY_ID_ALIGN:
     415           0 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType( (const sal_Int32*)NULL ) );
     416             :             // strange enough, css.awt.TextAlign is a 32-bit integer, while the Align property (both here for grid controls
     417             :             // and for ordinary toolkit controls) is a 16-bit integer. So, allow for 32 bit, but normalize it to 16 bit
     418           0 :             if ( bModified )
     419             :             {
     420           0 :                 sal_Int32 nAlign( 0 );
     421           0 :                 if ( rConvertedValue >>= nAlign )
     422           0 :                     rConvertedValue <<= (sal_Int16)nAlign;
     423             :             }
     424           0 :             break;
     425             :         case PROPERTY_ID_HIDDEN:
     426           0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getBOOL(m_aHidden));
     427           0 :             break;
     428             :     }
     429           0 :     return bModified;
     430             : }
     431             : 
     432             : //------------------------------------------------------------------------------
     433           0 : void OGridColumn::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (::com::sun::star::uno::Exception)
     434             : {
     435           0 :     switch (nHandle)
     436             :     {
     437             :         case PROPERTY_ID_LABEL:
     438             :             DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" );
     439           0 :             rValue >>= m_aLabel;
     440           0 :             break;
     441             :         case PROPERTY_ID_WIDTH:
     442           0 :             m_aWidth = rValue;
     443           0 :             break;
     444             :         case PROPERTY_ID_ALIGN:
     445           0 :             m_aAlign = rValue;
     446           0 :             break;
     447             :         case PROPERTY_ID_HIDDEN:
     448           0 :             m_aHidden = rValue;
     449           0 :             break;
     450             :     }
     451           0 : }
     452             : 
     453             : 
     454             : // XPropertyState
     455             : //------------------------------------------------------------------------------
     456           0 : Any OGridColumn::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
     457             : {
     458           0 :     switch (nHandle)
     459             :     {
     460             :         case PROPERTY_ID_WIDTH:
     461             :         case PROPERTY_ID_ALIGN:
     462           0 :             return Any();
     463             :         case PROPERTY_ID_HIDDEN:
     464           0 :             return makeAny((sal_Bool)sal_False);
     465             :         default:
     466           0 :             return OPropertySetAggregationHelper::getPropertyDefaultByHandle(nHandle);
     467             :     }
     468             : }
     469             : 
     470             : // XCloneable
     471             : //------------------------------------------------------------------------------
     472           0 : Reference< XCloneable > SAL_CALL OGridColumn::createClone(  ) throw (RuntimeException)
     473             : {
     474           0 :     OGridColumn* pNewColumn = createCloneColumn();
     475           0 :     return pNewColumn;
     476             : }
     477             : 
     478             : // XPersistObject
     479             : //------------------------------------------------------------------------------
     480           0 : void SAL_CALL OGridColumn::write(const Reference<XObjectOutputStream>& _rxOutStream)
     481             : {
     482             :     // 1. Write the UnoControl
     483           0 :     Reference<XMarkableStream>  xMark(_rxOutStream, UNO_QUERY);
     484           0 :     sal_Int32 nMark = xMark->createMark();
     485             : 
     486           0 :     sal_Int32 nLen = 0;
     487           0 :     _rxOutStream->writeLong(nLen);
     488             : 
     489           0 :     Reference<XPersistObject>  xPersist;
     490           0 :     if (query_aggregation(m_xAggregate, xPersist))
     491           0 :         xPersist->write(_rxOutStream);
     492             : 
     493             :     // Calculate the length
     494           0 :     nLen = xMark->offsetToMark(nMark) - 4;
     495           0 :     xMark->jumpToMark(nMark);
     496           0 :     _rxOutStream->writeLong(nLen);
     497           0 :     xMark->jumpToFurthest();
     498           0 :     xMark->deleteMark(nMark);
     499             : 
     500             :     // 2. Write a version number
     501           0 :     _rxOutStream->writeShort(0x0002);
     502             : 
     503           0 :     sal_uInt16 nAnyMask = 0;
     504           0 :     if (m_aWidth.getValueType().getTypeClass() == TypeClass_LONG)
     505           0 :         nAnyMask |= WIDTH;
     506             : 
     507           0 :     if (m_aAlign.getValueTypeClass() == TypeClass_SHORT)
     508           0 :         nAnyMask |= ALIGN;
     509             : 
     510           0 :     nAnyMask |= COMPATIBLE_HIDDEN;
     511             : 
     512           0 :     _rxOutStream->writeShort(nAnyMask);
     513             : 
     514           0 :     if (nAnyMask & WIDTH)
     515           0 :         _rxOutStream->writeLong(getINT32(m_aWidth));
     516           0 :     if (nAnyMask & ALIGN)
     517           0 :         _rxOutStream->writeShort(getINT16(m_aAlign));
     518             : 
     519             :     // Name
     520           0 :     _rxOutStream << m_aLabel;
     521             : 
     522             :     // the new place for the hidden flag : after m_aLabel, so older office version read the correct label, too
     523           0 :     if (nAnyMask & COMPATIBLE_HIDDEN)
     524           0 :         _rxOutStream->writeBoolean(getBOOL(m_aHidden));
     525           0 : }
     526             : 
     527             : //------------------------------------------------------------------------------
     528           0 : void SAL_CALL OGridColumn::read(const Reference<XObjectInputStream>& _rxInStream)
     529             : {
     530             :     // 1. Read the UnoControl
     531           0 :     sal_Int32 nLen = _rxInStream->readLong();
     532           0 :     if (nLen)
     533             :     {
     534           0 :         Reference<XMarkableStream>  xMark(_rxInStream, UNO_QUERY);
     535           0 :         sal_Int32 nMark = xMark->createMark();
     536           0 :         Reference<XPersistObject>  xPersist;
     537           0 :         if (query_aggregation(m_xAggregate, xPersist))
     538           0 :             xPersist->read(_rxInStream);
     539             : 
     540           0 :         xMark->jumpToMark(nMark);
     541           0 :         _rxInStream->skipBytes(nLen);
     542           0 :         xMark->deleteMark(nMark);
     543             :     }
     544             : 
     545             :     // 2. Write a version number
     546           0 :     sal_uInt16 nVersion = _rxInStream->readShort(); (void)nVersion;
     547           0 :     sal_uInt16 nAnyMask = _rxInStream->readShort();
     548             : 
     549           0 :     if (nAnyMask & WIDTH)
     550             :     {
     551           0 :         sal_Int32 nValue = _rxInStream->readLong();
     552           0 :         m_aWidth <<= (sal_Int32)nValue;
     553             :     }
     554             : 
     555           0 :     if (nAnyMask & ALIGN)
     556             :     {
     557           0 :         sal_Int16 nValue = _rxInStream->readShort();
     558           0 :         m_aAlign <<= nValue;
     559             :     }
     560           0 :     if (nAnyMask & OLD_HIDDEN)
     561             :     {
     562           0 :         sal_Bool bValue = _rxInStream->readBoolean();
     563           0 :         m_aHidden <<= (sal_Bool)bValue;
     564             :     }
     565             : 
     566             :     // Name
     567           0 :     _rxInStream >> m_aLabel;
     568             : 
     569           0 :     if (nAnyMask & COMPATIBLE_HIDDEN)
     570             :     {
     571           0 :         sal_Bool bValue = _rxInStream->readBoolean();
     572           0 :         m_aHidden <<= (sal_Bool)bValue;
     573             :     }
     574           0 : }
     575             : 
     576             : //------------------------------------------------------------------------------
     577           0 : IMPL_COLUMN(TextFieldColumn,        FRM_SUN_COMPONENT_TEXTFIELD,        sal_False);
     578           0 : IMPL_COLUMN(PatternFieldColumn,     FRM_SUN_COMPONENT_PATTERNFIELD,     sal_False);
     579           0 : IMPL_COLUMN(DateFieldColumn,        FRM_SUN_COMPONENT_DATEFIELD,        sal_True);
     580           0 : IMPL_COLUMN(TimeFieldColumn,        FRM_SUN_COMPONENT_TIMEFIELD,        sal_False);
     581           0 : IMPL_COLUMN(NumericFieldColumn,     FRM_SUN_COMPONENT_NUMERICFIELD,     sal_False);
     582           0 : IMPL_COLUMN(CurrencyFieldColumn,    FRM_SUN_COMPONENT_CURRENCYFIELD,    sal_False);
     583           0 : IMPL_COLUMN(CheckBoxColumn,         FRM_SUN_COMPONENT_CHECKBOX,         sal_False);
     584           0 : IMPL_COLUMN(ComboBoxColumn,         FRM_SUN_COMPONENT_COMBOBOX,         sal_False);
     585           0 : IMPL_COLUMN(ListBoxColumn,          FRM_SUN_COMPONENT_LISTBOX,          sal_False);
     586           0 : IMPL_COLUMN(FormattedFieldColumn,   FRM_SUN_COMPONENT_FORMATTEDFIELD,   sal_False);
     587             : 
     588             : //.........................................................................
     589             : }   // namespace frm
     590             : //.........................................................................
     591             : 
     592             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10