LCOV - code coverage report
Current view: top level - libreoffice/editeng/source/items - optitems.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 52 0.0 %
Date: 2012-12-27 Functions: 0 22 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 <tools/shl.hxx>
      21             : #include <tools/resid.hxx>
      22             : #include <tools/stream.hxx>
      23             : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
      24             : 
      25             : #include <editeng/optitems.hxx>
      26             : #include <editeng/eerdll.hxx>
      27             : #include <editeng/editrids.hrc>
      28             : 
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::linguistic2;
      31             : 
      32             : // STATIC DATA -----------------------------------------------------------
      33             : 
      34           0 : TYPEINIT1(SfxSpellCheckItem, SfxPoolItem);
      35           0 : TYPEINIT1(SfxHyphenRegionItem, SfxPoolItem);
      36             : 
      37             : // class SfxSpellCheckItem -----------------------------------------------
      38             : 
      39           0 : SfxSpellCheckItem::SfxSpellCheckItem
      40             : (
      41             :     Reference< XSpellChecker1 > &xChecker,
      42             :     sal_uInt16 _nWhich
      43             : ) :
      44             : 
      45           0 :     SfxPoolItem( _nWhich )
      46             : {
      47           0 :     xSpellCheck = xChecker;
      48           0 : }
      49             : 
      50             : // -----------------------------------------------------------------------
      51             : 
      52           0 : SfxSpellCheckItem::SfxSpellCheckItem( const SfxSpellCheckItem& rItem ) :
      53             : 
      54             :     SfxPoolItem( rItem ),
      55           0 :     xSpellCheck( rItem.GetXSpellChecker() )
      56             : {
      57           0 : }
      58             : 
      59             : //------------------------------------------------------------------------
      60             : 
      61           0 : SfxItemPresentation SfxSpellCheckItem::GetPresentation
      62             : (
      63             :     SfxItemPresentation ePres,
      64             :     SfxMapUnit          ,
      65             :     SfxMapUnit          ,
      66             :     String&             rText,
      67             :     const IntlWrapper*
      68             : )   const
      69             : {
      70           0 :     switch ( ePres )
      71             :     {
      72             :         case SFX_ITEM_PRESENTATION_NONE:
      73           0 :             rText.Erase();
      74           0 :             return SFX_ITEM_PRESENTATION_NONE;
      75             : 
      76             :         case SFX_ITEM_PRESENTATION_NAMELESS:
      77             :         case SFX_ITEM_PRESENTATION_COMPLETE:
      78             :         {
      79           0 :             return ePres;
      80             :         }
      81             :         default:
      82           0 :             return SFX_ITEM_PRESENTATION_NONE;
      83             :     }
      84             : }
      85             : 
      86             : // -----------------------------------------------------------------------
      87             : 
      88           0 : SfxPoolItem* SfxSpellCheckItem::Clone( SfxItemPool* ) const
      89             : {
      90           0 :     return new SfxSpellCheckItem( *this );
      91             : }
      92             : 
      93             : // -----------------------------------------------------------------------
      94             : 
      95           0 : int SfxSpellCheckItem::operator==( const SfxPoolItem& rItem ) const
      96             : {
      97             :     DBG_ASSERT( SfxPoolItem::operator==(rItem), "unequal types" );
      98           0 :     return ( xSpellCheck == ( (const SfxSpellCheckItem& )rItem ).GetXSpellChecker() );
      99             : }
     100             : 
     101             : // class SfxHyphenRegionItem -----------------------------------------------
     102             : 
     103           0 : SfxHyphenRegionItem::SfxHyphenRegionItem( const sal_uInt16 nId ) :
     104             : 
     105           0 :     SfxPoolItem( nId )
     106             : {
     107           0 :     nMinLead = nMinTrail = 0;
     108           0 : }
     109             : 
     110             : // -----------------------------------------------------------------------
     111             : 
     112           0 : SfxHyphenRegionItem::SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem ) :
     113             : 
     114             :     SfxPoolItem ( rItem ),
     115             : 
     116           0 :     nMinLead    ( rItem.GetMinLead() ),
     117           0 :     nMinTrail   ( rItem.GetMinTrail() )
     118             : {
     119           0 : }
     120             : 
     121             : // -----------------------------------------------------------------------
     122             : 
     123           0 : int SfxHyphenRegionItem::operator==( const SfxPoolItem& rAttr ) const
     124             : {
     125             :     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
     126             : 
     127             :     return ( ( ( (SfxHyphenRegionItem&)rAttr ).nMinLead == nMinLead ) &&
     128           0 :              ( ( (SfxHyphenRegionItem&)rAttr ).nMinTrail == nMinTrail ) );
     129             : }
     130             : 
     131             : // -----------------------------------------------------------------------
     132             : 
     133           0 : SfxPoolItem* SfxHyphenRegionItem::Clone( SfxItemPool* ) const
     134             : {
     135           0 :     return new SfxHyphenRegionItem( *this );
     136             : }
     137             : 
     138             : //------------------------------------------------------------------------
     139             : 
     140           0 : SfxItemPresentation SfxHyphenRegionItem::GetPresentation
     141             : (
     142             :     SfxItemPresentation ePres,
     143             :     SfxMapUnit          ,
     144             :     SfxMapUnit          ,
     145             :     String&             rText,
     146             :     const IntlWrapper*
     147             : )   const
     148             : {
     149           0 :     switch ( ePres )
     150             :     {
     151             :         case SFX_ITEM_PRESENTATION_NONE:
     152           0 :             rText.Erase();
     153           0 :             return SFX_ITEM_PRESENTATION_NONE;
     154             : 
     155             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     156             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     157             :         {
     158           0 :             rText += String::CreateFromInt32( nMinLead );
     159           0 :             rText += EE_RESSTR( RID_SVXITEMS_HYPHEN_MINLEAD );
     160           0 :             rText += ',';
     161           0 :             rText += String::CreateFromInt32( nMinTrail );
     162           0 :             rText += EE_RESSTR( RID_SVXITEMS_HYPHEN_MINTRAIL );
     163           0 :             return ePres;
     164             :         }
     165             :         default:
     166           0 :             return SFX_ITEM_PRESENTATION_NONE;
     167             :     }
     168             : }
     169             : 
     170             : // -----------------------------------------------------------------------
     171             : 
     172           0 : SfxPoolItem* SfxHyphenRegionItem::Create(SvStream& rStrm, sal_uInt16 ) const
     173             : {
     174             :     sal_uInt8 _nMinLead, _nMinTrail;
     175           0 :     rStrm >> _nMinLead >> _nMinTrail;
     176           0 :     SfxHyphenRegionItem* pAttr = new SfxHyphenRegionItem( Which() );
     177           0 :     pAttr->GetMinLead() = _nMinLead;
     178           0 :     pAttr->GetMinTrail() = _nMinTrail;
     179           0 :     return pAttr;
     180             : }
     181             : 
     182             : // -----------------------------------------------------------------------
     183             : 
     184           0 : SvStream& SfxHyphenRegionItem::Store( SvStream& rStrm, sal_uInt16 ) const
     185             : {
     186           0 :     rStrm << (sal_uInt8) GetMinLead()
     187           0 :           << (sal_uInt8) GetMinTrail();
     188           0 :     return rStrm;
     189             : }
     190             : 
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10