LCOV - code coverage report
Current view: top level - libreoffice/forms/source/component - Hidden.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 59 0.0 %
Date: 2012-12-27 Functions: 0 14 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 "Hidden.hxx"
      21             : #include "property.hxx"
      22             : #include "property.hrc"
      23             : #include "services.hxx"
      24             : #include <tools/debug.hxx>
      25             : #include <comphelper/basicio.hxx>
      26             : 
      27             : //.........................................................................
      28             : namespace frm
      29             : {
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::com::sun::star::sdb;
      32             : using namespace ::com::sun::star::sdbc;
      33             : using namespace ::com::sun::star::sdbcx;
      34             : using namespace ::com::sun::star::beans;
      35             : using namespace ::com::sun::star::container;
      36             : using namespace ::com::sun::star::form;
      37             : using namespace ::com::sun::star::awt;
      38             : using namespace ::com::sun::star::io;
      39             : using namespace ::com::sun::star::lang;
      40             : using namespace ::com::sun::star::util;
      41             : 
      42             : //------------------------------------------------------------------
      43           0 : InterfaceRef SAL_CALL OHiddenModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
      44             : {
      45           0 :     return *(new OHiddenModel(_rxFactory));
      46             : }
      47             : 
      48             : //------------------------------------------------------------------
      49             : DBG_NAME( OHiddenModel )
      50             : //------------------------------------------------------------------
      51           0 : OHiddenModel::OHiddenModel(const Reference<XMultiServiceFactory>& _rxFactory)
      52           0 :     :OControlModel(_rxFactory, ::rtl::OUString())
      53             : {
      54             :     DBG_CTOR( OHiddenModel, NULL );
      55           0 :     m_nClassId = FormComponentType::HIDDENCONTROL;
      56           0 : }
      57             : 
      58             : //------------------------------------------------------------------
      59           0 : OHiddenModel::OHiddenModel( const OHiddenModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory )
      60           0 :     :OControlModel( _pOriginal, _rxFactory )
      61             : {
      62             :     DBG_CTOR( OHiddenModel, NULL );
      63           0 :     m_sHiddenValue = _pOriginal->m_sHiddenValue;
      64           0 : }
      65             : 
      66             : //------------------------------------------------------------------------------
      67           0 : OHiddenModel::~OHiddenModel( )
      68             : {
      69             :     DBG_CTOR( OHiddenModel, NULL );
      70           0 : }
      71             : 
      72             : //------------------------------------------------------------------------------
      73           0 : IMPLEMENT_DEFAULT_CLONING( OHiddenModel )
      74             : 
      75             : //------------------------------------------------------------------------------
      76           0 : void OHiddenModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
      77             : {
      78           0 :     switch (_nHandle)
      79             :     {
      80           0 :         case PROPERTY_ID_HIDDEN_VALUE : _rValue <<= m_sHiddenValue; break;
      81             :         default:
      82           0 :             OControlModel::getFastPropertyValue(_rValue, _nHandle);
      83             :     }
      84           0 : }
      85             : 
      86             : //------------------------------------------------------------------------------
      87           0 : void OHiddenModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::uno::Exception)
      88             : {
      89           0 :     switch (_nHandle)
      90             :     {
      91             :         case PROPERTY_ID_HIDDEN_VALUE :
      92             :             DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, "OHiddenModel::setFastPropertyValue_NoBroadcast : invalid type !" );
      93           0 :             _rValue >>= m_sHiddenValue;
      94           0 :             break;
      95             :         default:
      96           0 :             OControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
      97             :     }
      98           0 : }
      99             : 
     100             : //------------------------------------------------------------------------------
     101           0 : sal_Bool OHiddenModel::convertFastPropertyValue(
     102             :             Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue)
     103             :             throw (IllegalArgumentException)
     104             : {
     105           0 :     sal_Bool bModified(sal_False);
     106           0 :     switch (_nHandle)
     107             :     {
     108             :         case PROPERTY_ID_HIDDEN_VALUE :
     109           0 :             bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_sHiddenValue);
     110           0 :             break;
     111             :         default:
     112           0 :             bModified = OControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
     113           0 :             break;
     114             :     }
     115           0 :     return bModified;
     116             : }
     117             : 
     118             : //------------------------------------------------------------------------------
     119           0 : void OHiddenModel::describeFixedProperties( Sequence< Property >& _rProps ) const
     120             : {
     121           0 :     BEGIN_DESCRIBE_BASE_PROPERTIES(4)
     122           0 :         DECL_PROP2(CLASSID,         sal_Int16,          READONLY, TRANSIENT);
     123           0 :         DECL_PROP1(HIDDEN_VALUE,    ::rtl::OUString,    BOUND);
     124           0 :         DECL_PROP1(NAME,            ::rtl::OUString,    BOUND);
     125           0 :         DECL_PROP1(TAG,             ::rtl::OUString,    BOUND);
     126             :     END_DESCRIBE_PROPERTIES();
     127           0 : }
     128             : 
     129             : // XServiceInfo
     130             : //------------------------------------------------------------------------------
     131           0 : StringSequence SAL_CALL OHiddenModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
     132             : {
     133           0 :     StringSequence aSupported( 2 );
     134           0 :     aSupported[ 0 ] = FRM_SUN_COMPONENT_HIDDENCONTROL;
     135           0 :     aSupported[ 1 ] = FRM_SUN_FORMCOMPONENT;
     136           0 :     return aSupported;
     137             : }
     138             : 
     139             : //------------------------------------------------------------------------------
     140           0 : ::rtl::OUString SAL_CALL OHiddenModel::getServiceName() throw(RuntimeException)
     141             : {
     142           0 :     return FRM_COMPONENT_HIDDEN;    // old (non-sun) name for compatibility !
     143             : }
     144             : 
     145             : //------------------------------------------------------------------------------
     146           0 : void SAL_CALL OHiddenModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
     147             :     throw(IOException, RuntimeException)
     148             : {
     149             :     // Version
     150           0 :     _rxOutStream->writeShort(0x0002);
     151             : 
     152             :     // Wert
     153           0 :     _rxOutStream << m_sHiddenValue;
     154             : 
     155           0 :     OControlModel::write(_rxOutStream);
     156           0 : }
     157             : 
     158             : //------------------------------------------------------------------------------
     159           0 : void SAL_CALL OHiddenModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException)
     160             : {
     161             :     // Version
     162           0 :     sal_uInt16 nVersion = _rxInStream->readShort();
     163             : 
     164             :     // Name
     165             :     DBG_ASSERT(nVersion != 1, "OHiddenModel::read : this version is obsolete !");
     166           0 :     switch (nVersion)
     167             :     {
     168           0 :         case 1 : { ::rtl::OUString sDummy; _rxInStream >> sDummy; _rxInStream >> m_sHiddenValue; } break;
     169           0 :         case 2 : _rxInStream >> m_sHiddenValue; break;
     170           0 :         default : OSL_FAIL("OHiddenModel::read : unknown version !"); m_sHiddenValue = ::rtl::OUString();
     171             :     }
     172           0 :     OControlModel::read(_rxInStream);
     173           0 : }
     174             : 
     175             : //.........................................................................
     176             : }
     177             : //.........................................................................
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10