LCOV - code coverage report
Current view: top level - sw/source/core/uibase/utlui - uiitems.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 143 0.0 %
Date: 2014-04-14 Functions: 0 27 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 <editeng/itemtype.hxx>
      21             : #include <unosett.hxx>
      22             : 
      23             : #include "swtypes.hxx"
      24             : #include "cmdid.h"
      25             : #include "uiitems.hxx"
      26             : 
      27             : #include "utlui.hrc"
      28             : #include "attrdesc.hrc"
      29             : #include <unomid.h>
      30             : #include <numrule.hxx>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : using namespace ::com::sun::star::uno;
      34             : 
      35           0 : SwPageFtnInfoItem::SwPageFtnInfoItem( const sal_uInt16 nId, SwPageFtnInfo& rInfo) :
      36             :     SfxPoolItem( nId ),
      37           0 :     aFtnInfo(rInfo)
      38             : {
      39           0 : }
      40             : 
      41           0 : SwPageFtnInfoItem::SwPageFtnInfoItem( const SwPageFtnInfoItem& rItem ) :
      42             :     SfxPoolItem( rItem ),
      43           0 :     aFtnInfo(rItem.GetPageFtnInfo())
      44             : {
      45           0 : }
      46             : 
      47           0 :  SwPageFtnInfoItem::~SwPageFtnInfoItem()
      48             : {
      49           0 : }
      50             : 
      51           0 : SfxPoolItem*  SwPageFtnInfoItem::Clone( SfxItemPool * /*pPool*/ ) const
      52             : {
      53           0 :     return new SwPageFtnInfoItem( *this );
      54             : }
      55             : 
      56           0 : bool SwPageFtnInfoItem::operator==( const SfxPoolItem& rAttr ) const
      57             : {
      58             :     OSL_ENSURE( Which() == rAttr.Which(), "no equal attributes" );
      59           0 :     return ( aFtnInfo == ((SwPageFtnInfoItem&)rAttr).GetPageFtnInfo());
      60             : }
      61             : 
      62           0 : SfxItemPresentation  SwPageFtnInfoItem::GetPresentation
      63             : (
      64             :     SfxItemPresentation ePres,
      65             :     SfxMapUnit          eCoreUnit,
      66             :     SfxMapUnit          ePresUnit,
      67             :     OUString&           rText,
      68             :     const IntlWrapper*  pIntl
      69             : )   const
      70             : {
      71           0 :     switch ( ePres )
      72             :     {
      73             :         case SFX_ITEM_PRESENTATION_NONE:
      74           0 :             rText = OUString();
      75           0 :             return SFX_ITEM_PRESENTATION_NONE;
      76             :         case SFX_ITEM_PRESENTATION_NAMELESS:
      77             :         case SFX_ITEM_PRESENTATION_COMPLETE:
      78             :         {
      79           0 :             sal_uInt16 nHght = (sal_uInt16) GetPageFtnInfo().GetHeight();
      80           0 :             if ( nHght )
      81             :             {
      82           0 :                 rText = SW_RESSTR( STR_MAX_FTN_HEIGHT ) + " " +
      83           0 :                         ::GetMetricText( nHght, eCoreUnit, ePresUnit, pIntl ) + " " +
      84           0 :                         ::GetSvxString( ::GetMetricId( ePresUnit ) );
      85             :             }
      86           0 :             return ePres;
      87             :         }
      88             :         default:; //prevent warning
      89             :     }
      90           0 :     return SFX_ITEM_PRESENTATION_NONE;
      91             : }
      92             : 
      93           0 : bool SwPageFtnInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
      94             : {
      95           0 :     bool bRet = true;
      96           0 :     switch(nMemberId & ~CONVERT_TWIPS)
      97             :     {
      98           0 :         case MID_FTN_HEIGHT        :     rVal <<= (sal_Int32)convertTwipToMm100(aFtnInfo.GetHeight());break;
      99           0 :         case MID_LINE_WEIGHT       :     rVal <<= (sal_Int16)convertTwipToMm100(aFtnInfo.GetLineWidth());break;
     100           0 :         case MID_LINE_COLOR        :     rVal <<= (sal_Int32)aFtnInfo.GetLineColor().GetColor();break;
     101             :         case MID_LINE_RELWIDTH     :
     102             :         {
     103           0 :             Fraction aTmp( 100, 1 );
     104           0 :             aTmp *= aFtnInfo.GetWidth();
     105           0 :             rVal <<= (sal_Int8)(long)aTmp;
     106             :         }
     107           0 :         break;
     108           0 :         case MID_LINE_ADJUST       :     rVal <<= (sal_Int16)aFtnInfo.GetAdj();break;//text::HorizontalAdjust
     109           0 :         case MID_LINE_TEXT_DIST    :     rVal <<= (sal_Int32)convertTwipToMm100(aFtnInfo.GetTopDist());break;
     110           0 :         case MID_LINE_FOOTNOTE_DIST:     rVal <<= (sal_Int32)convertTwipToMm100(aFtnInfo.GetBottomDist());break;
     111             :         case MID_FTN_LINE_STYLE    :
     112             :         {
     113           0 :             switch ( aFtnInfo.GetLineStyle( ) )
     114             :             {
     115             :                 default:
     116           0 :                 case table::BorderLineStyle::NONE : rVal <<= sal_Int8(0); break;
     117           0 :                 case table::BorderLineStyle::SOLID: rVal <<= sal_Int8(1); break;
     118           0 :                 case table::BorderLineStyle::DOTTED: rVal <<= sal_Int8(2); break;
     119           0 :                 case table::BorderLineStyle::DASHED: rVal <<= sal_Int8(3); break;
     120             :             }
     121           0 :             break;
     122             :         }
     123             :         default:
     124           0 :             bRet = false;
     125             :     }
     126           0 :     return bRet;
     127             : }
     128             : 
     129           0 : bool SwPageFtnInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId)
     130             : {
     131           0 :     sal_Int32 nSet32 = 0;
     132           0 :     bool bRet = true;
     133           0 :     switch(nMemberId  & ~CONVERT_TWIPS)
     134             :     {
     135             :         case MID_LINE_COLOR        :
     136           0 :             rVal >>= nSet32;
     137           0 :             aFtnInfo.SetLineColor(nSet32);
     138           0 :         break;
     139             :         case MID_FTN_HEIGHT:
     140             :         case MID_LINE_TEXT_DIST    :
     141             :         case MID_LINE_FOOTNOTE_DIST:
     142           0 :                 rVal >>= nSet32;
     143           0 :                 if(nSet32 < 0)
     144           0 :                     bRet = false;
     145             :                 else
     146             :                 {
     147           0 :                     nSet32 = convertMm100ToTwip(nSet32);
     148           0 :                     switch(nMemberId & ~CONVERT_TWIPS)
     149             :                     {
     150           0 :                         case MID_FTN_HEIGHT:            aFtnInfo.SetHeight(nSet32);    break;
     151           0 :                         case MID_LINE_TEXT_DIST:        aFtnInfo.SetTopDist(nSet32);break;
     152           0 :                         case MID_LINE_FOOTNOTE_DIST:    aFtnInfo.SetBottomDist(nSet32);break;
     153             :                     }
     154             :                 }
     155           0 :         break;
     156             :         case MID_LINE_WEIGHT       :
     157             :         {
     158           0 :             sal_Int16 nSet = 0;
     159           0 :             rVal >>= nSet;
     160           0 :             if(nSet >= 0)
     161           0 :                 aFtnInfo.SetLineWidth(convertMm100ToTwip(nSet));
     162             :             else
     163           0 :                 bRet = false;
     164             :         }
     165           0 :         break;
     166             :         case MID_LINE_RELWIDTH     :
     167             :         {
     168           0 :             sal_Int8 nSet = 0;
     169           0 :             rVal >>= nSet;
     170           0 :             if(nSet < 0)
     171           0 :                 bRet = false;
     172             :             else
     173           0 :                 aFtnInfo.SetWidth(Fraction(nSet, 100));
     174             :         }
     175           0 :         break;
     176             :         case MID_LINE_ADJUST       :
     177             :         {
     178           0 :             sal_Int16 nSet = 0;
     179           0 :             rVal >>= nSet;
     180           0 :             if(nSet >= 0 && nSet < 3) //text::HorizontalAdjust
     181           0 :                 aFtnInfo.SetAdj((SwFtnAdj)nSet);
     182             :             else
     183           0 :                 bRet = false;
     184             :         }
     185             :         case MID_FTN_LINE_STYLE:
     186             :         {
     187           0 :             ::editeng::SvxBorderStyle eStyle = table::BorderLineStyle::NONE;
     188           0 :             sal_Int8 nSet = 0;
     189           0 :             rVal >>= nSet;
     190           0 :             switch ( nSet )
     191             :             {
     192           0 :                 case 1: eStyle = table::BorderLineStyle::SOLID; break;
     193           0 :                 case 2: eStyle = table::BorderLineStyle::DOTTED; break;
     194           0 :                 case 3: eStyle = table::BorderLineStyle::DASHED; break;
     195           0 :                 default: break;
     196             :             }
     197           0 :             aFtnInfo.SetLineStyle( eStyle );
     198             :         }
     199           0 :         break;
     200             :         default:
     201           0 :             bRet = false;
     202             :     }
     203           0 :     return bRet;
     204             : }
     205             : 
     206           0 : SwPtrItem::SwPtrItem( const sal_uInt16 nId, void* pPtr ) :
     207             :     SfxPoolItem( nId ),
     208           0 :     pMisc(pPtr)
     209             : {
     210           0 : }
     211             : 
     212             : // Copy constructor
     213             : 
     214           0 : SwPtrItem::SwPtrItem( const SwPtrItem& rItem ) : SfxPoolItem( rItem )
     215             : {
     216           0 :     pMisc = rItem.pMisc;
     217           0 : }
     218             : 
     219             : // Cloning
     220             : 
     221           0 : SfxPoolItem* SwPtrItem::Clone( SfxItemPool * /*pPool*/ ) const
     222             : {
     223           0 :     return new SwPtrItem( *this );
     224             : }
     225             : 
     226           0 : bool SwPtrItem::operator==( const SfxPoolItem& rAttr ) const
     227             : {
     228             :     OSL_ENSURE( SfxPoolItem::operator==(rAttr), "unequal types" );
     229           0 :     const SwPtrItem& rItem = (SwPtrItem&)rAttr;
     230           0 :     return ( pMisc == rItem.pMisc );
     231             : }
     232             : 
     233             : // SwUINumRuleItem for the NumTabPages of the FormatNumRule/Styleists
     234             : 
     235           0 : SwUINumRuleItem::SwUINumRuleItem( const SwNumRule& rRul, const sal_uInt16 nId )
     236           0 :     : SfxPoolItem( nId ), pRule( new SwNumRule( rRul ) )
     237             : {
     238           0 : }
     239             : 
     240           0 : SwUINumRuleItem::SwUINumRuleItem( const SwUINumRuleItem& rItem )
     241             :     : SfxPoolItem( rItem ),
     242           0 :     pRule( new SwNumRule( *rItem.pRule ))
     243             : {
     244           0 : }
     245             : 
     246           0 :  SwUINumRuleItem::~SwUINumRuleItem()
     247             : {
     248           0 :     delete pRule;
     249           0 : }
     250             : 
     251           0 : SfxPoolItem*  SwUINumRuleItem::Clone( SfxItemPool * /*pPool*/ ) const
     252             : {
     253           0 :     return new SwUINumRuleItem( *this );
     254             : }
     255             : 
     256           0 : bool SwUINumRuleItem::operator==( const SfxPoolItem& rAttr ) const
     257             : {
     258             :     OSL_ENSURE( SfxPoolItem::operator==(rAttr), "unequal types" );
     259           0 :     return *pRule == *((SwUINumRuleItem&)rAttr).pRule;
     260             : }
     261             : 
     262           0 : bool SwUINumRuleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
     263             : {
     264           0 :     uno::Reference< container::XIndexReplace >xRules = new SwXNumberingRules(*pRule);
     265           0 :     rVal.setValue(&xRules, ::getCppuType((uno::Reference< container::XIndexReplace>*)0));
     266           0 :     return true;
     267             : }
     268           0 : bool SwUINumRuleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     269             : {
     270           0 :     uno::Reference< container::XIndexReplace> xRulesRef;
     271           0 :     if(rVal >>= xRulesRef)
     272             :     {
     273           0 :         uno::Reference< lang::XUnoTunnel > xTunnel(xRulesRef, uno::UNO_QUERY);
     274           0 :         SwXNumberingRules* pSwXRules = xTunnel.is() ? reinterpret_cast<SwXNumberingRules*>(
     275           0 :                     xTunnel->getSomething(SwXNumberingRules::getUnoTunnelId())) : 0;
     276           0 :         if(pSwXRules)
     277             :         {
     278           0 :             *pRule = *pSwXRules->GetNumRule();
     279           0 :         }
     280             :     }
     281           0 :     return true;
     282             : }
     283             : 
     284           0 : SwBackgroundDestinationItem::SwBackgroundDestinationItem(sal_uInt16  _nWhich, sal_uInt16 nValue) :
     285           0 :     SfxUInt16Item(_nWhich, nValue)
     286             : {
     287           0 : }
     288             : 
     289           0 : SfxPoolItem*     SwBackgroundDestinationItem::Clone( SfxItemPool * /*pPool*/ ) const
     290             : {
     291           0 :     return new SwBackgroundDestinationItem(Which(), GetValue());
     292             : }
     293             : 
     294           0 : SwPaMItem::SwPaMItem( const sal_uInt16 nId, SwPaM* pPaM ) :
     295             :     SfxPoolItem( nId ),
     296           0 :     m_pPaM(pPaM)
     297             : {
     298           0 : }
     299             : 
     300           0 : SwPaMItem::SwPaMItem( const SwPaMItem& rItem ) : SfxPoolItem( rItem )
     301             : {
     302           0 :     m_pPaM = rItem.m_pPaM;
     303           0 : }
     304             : 
     305           0 : SfxPoolItem* SwPaMItem::Clone( SfxItemPool * /*pPool*/ ) const
     306             : {
     307           0 :     return new SwPaMItem( *this );
     308             : }
     309             : 
     310           0 : bool SwPaMItem::operator==( const SfxPoolItem& rAttr ) const
     311             : {
     312             :     OSL_ENSURE( SfxPoolItem::operator==(rAttr), "unequal types" );
     313           0 :     const SwPaMItem& rItem = (SwPaMItem&)rAttr;
     314           0 :     return ( m_pPaM == rItem.m_pPaM );
     315             : }
     316             : 
     317             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10