LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/core/data - attrib.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 207 532 38.9 %
Date: 2013-07-09 Functions: 86 142 60.6 %
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 <com/sun/star/util/CellProtection.hpp>
      21             : #include <com/sun/star/util/XProtectable.hpp>
      22             : #include <com/sun/star/text/XText.hpp>
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : 
      25             : #include "scitems.hxx"
      26             : #include <editeng/eeitem.hxx>
      27             : 
      28             : #include <editeng/boxitem.hxx>
      29             : #include <editeng/editdata.hxx>
      30             : #include <editeng/editeng.hxx>
      31             : #include <editeng/editobj.hxx>
      32             : #include <editeng/flditem.hxx>
      33             : 
      34             : #include "attrib.hxx"
      35             : #include "global.hxx"
      36             : #include "editutil.hxx"
      37             : #include "sc.hrc"
      38             : #include "globstr.hrc"
      39             : 
      40             : #include "textuno.hxx"  // ScHeaderFooterContentObj
      41             : 
      42             : using namespace com::sun::star;
      43             : 
      44             : //------------------------------------------------------------------------
      45             : 
      46        1618 : TYPEINIT1(ScMergeAttr,          SfxPoolItem);
      47        1830 : TYPEINIT1_AUTOFACTORY(ScProtectionAttr,     SfxPoolItem);
      48        4311 : TYPEINIT1(ScRangeItem,          SfxPoolItem);
      49        1437 : TYPEINIT1(ScTableListItem,      SfxPoolItem);
      50        7370 : TYPEINIT1(ScPageHFItem,         SfxPoolItem);
      51        4314 : TYPEINIT1(ScViewObjectModeItem, SfxEnumItem);
      52          31 : TYPEINIT1(ScDoubleItem,         SfxPoolItem);
      53        1437 : TYPEINIT1(ScPageScaleToItem,    SfxPoolItem);
      54        9374 : TYPEINIT1(ScCondFormatItem,    SfxPoolItem);
      55             : 
      56             : //------------------------------------------------------------------------
      57             : 
      58             : //
      59             : //      General Help Function
      60             : //
      61             : 
      62         581 : bool ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther )
      63             : {
      64             : 
      65         581 :     if (!pThis)
      66         509 :         return false;
      67          72 :     if (!pOther)
      68          68 :         return true;
      69             : 
      70           4 :     sal_uInt16 nThisSize = pThis->GetOutWidth() + pThis->GetDistance() + pThis->GetInWidth();
      71           4 :     sal_uInt16 nOtherSize = pOther->GetOutWidth() + pOther->GetDistance() + pOther->GetInWidth();
      72             : 
      73           4 :     if (nThisSize > nOtherSize)
      74           0 :         return true;
      75           4 :     else if (nThisSize < nOtherSize)
      76           0 :         return false;
      77             :     else
      78             :     {
      79           4 :         if ( pOther->GetInWidth() && !pThis->GetInWidth() )
      80           0 :             return true;
      81           4 :         else if ( pThis->GetInWidth() && !pOther->GetInWidth() )
      82           0 :             return false;
      83             :         else
      84             :         {
      85           4 :             return true;            //! ???
      86             :         }
      87             :     }
      88             : }
      89             : 
      90             : 
      91             : //
      92             : //      Item - Implementierungen
      93             : //
      94             : 
      95             : //------------------------------------------------------------------------
      96             : // Merge
      97             : //------------------------------------------------------------------------
      98             : 
      99         610 : ScMergeAttr::ScMergeAttr():
     100             :     SfxPoolItem(ATTR_MERGE),
     101             :     nColMerge(0),
     102         610 :     nRowMerge(0)
     103         610 : {}
     104             : 
     105             : //------------------------------------------------------------------------
     106             : 
     107         444 : ScMergeAttr::ScMergeAttr( SCsCOL nCol, SCsROW nRow):
     108             :     SfxPoolItem(ATTR_MERGE),
     109             :     nColMerge(nCol),
     110         444 :     nRowMerge(nRow)
     111         444 : {}
     112             : 
     113             : //------------------------------------------------------------------------
     114             : 
     115          32 : ScMergeAttr::ScMergeAttr(const ScMergeAttr& rItem):
     116          32 :     SfxPoolItem(ATTR_MERGE)
     117             : {
     118          32 :     nColMerge = rItem.nColMerge;
     119          32 :     nRowMerge = rItem.nRowMerge;
     120          32 : }
     121             : 
     122        1460 : ScMergeAttr::~ScMergeAttr()
     123             : {
     124        1460 : }
     125             : 
     126             : //------------------------------------------------------------------------
     127             : 
     128           0 : OUString ScMergeAttr::GetValueText() const
     129             : {
     130             :     OUString aRet = "("
     131           0 :         + OUString::number(static_cast<sal_Int32>(nColMerge))
     132           0 :         + ","
     133           0 :         + OUString::number(static_cast<sal_Int32>(nRowMerge))
     134           0 :         + ")";
     135           0 :     return aRet;
     136             : }
     137             : 
     138             : //------------------------------------------------------------------------
     139             : 
     140        1952 : int ScMergeAttr::operator==( const SfxPoolItem& rItem ) const
     141             : {
     142             :     OSL_ENSURE( Which() != rItem.Which() || Type() == rItem.Type(), "which ==, type !=" );
     143        1952 :     return (Which() == rItem.Which())
     144        1952 :              && (nColMerge == ((ScMergeAttr&)rItem).nColMerge)
     145        3442 :              && (nRowMerge == ((ScMergeAttr&)rItem).nRowMerge);
     146             : }
     147             : 
     148             : //------------------------------------------------------------------------
     149             : 
     150          32 : SfxPoolItem* ScMergeAttr::Clone( SfxItemPool * ) const
     151             : {
     152          32 :     return new ScMergeAttr(*this);
     153             : }
     154             : 
     155             : //------------------------------------------------------------------------
     156             : 
     157           0 : SfxPoolItem* ScMergeAttr::Create( SvStream& rStream, sal_uInt16 /* nVer */ ) const
     158             : {
     159             :     sal_Int16   nCol;
     160             :     sal_Int16   nRow;
     161           0 :     rStream >> nCol;
     162           0 :     rStream >> nRow;
     163           0 :     return new ScMergeAttr(static_cast<SCCOL>(nCol),static_cast<SCROW>(nRow));
     164             : }
     165             : 
     166             : //------------------------------------------------------------------------
     167             : // MergeFlag
     168             : //------------------------------------------------------------------------
     169             : 
     170         610 : ScMergeFlagAttr::ScMergeFlagAttr():
     171         610 :     SfxInt16Item(ATTR_MERGE_FLAG, 0)
     172             : {
     173         610 : }
     174             : 
     175             : //------------------------------------------------------------------------
     176             : 
     177        6842 : ScMergeFlagAttr::ScMergeFlagAttr(sal_Int16 nFlags):
     178        6842 :     SfxInt16Item(ATTR_MERGE_FLAG, nFlags)
     179             : {
     180        6842 : }
     181             : 
     182        7800 : ScMergeFlagAttr::~ScMergeFlagAttr()
     183             : {
     184        7800 : }
     185             : 
     186          11 : bool ScMergeFlagAttr::HasPivotButton() const
     187             : {
     188          11 :     return (GetValue() & SC_MF_BUTTON) != 0;
     189             : }
     190             : 
     191           0 : bool ScMergeFlagAttr::HasPivotPopupButton() const
     192             : {
     193           0 :     return (GetValue() & SC_MF_BUTTON_POPUP) != 0;
     194             : }
     195             : 
     196             : //------------------------------------------------------------------------
     197             : // Protection
     198             : //------------------------------------------------------------------------
     199             : 
     200         610 : ScProtectionAttr::ScProtectionAttr():
     201             :     SfxPoolItem(ATTR_PROTECTION),
     202             :     bProtection(true),
     203             :     bHideFormula(false),
     204             :     bHideCell(false),
     205         610 :     bHidePrint(false)
     206             : {
     207         610 : }
     208             : 
     209             : //------------------------------------------------------------------------
     210             : 
     211         115 : ScProtectionAttr::ScProtectionAttr( bool bProtect, bool bHFormula,
     212             :                                     bool bHCell, bool bHPrint):
     213             :     SfxPoolItem(ATTR_PROTECTION),
     214             :     bProtection(bProtect),
     215             :     bHideFormula(bHFormula),
     216             :     bHideCell(bHCell),
     217         115 :     bHidePrint(bHPrint)
     218             : {
     219         115 : }
     220             : 
     221             : //------------------------------------------------------------------------
     222             : 
     223          29 : ScProtectionAttr::ScProtectionAttr(const ScProtectionAttr& rItem):
     224          29 :     SfxPoolItem(ATTR_PROTECTION)
     225             : {
     226          29 :     bProtection  = rItem.bProtection;
     227          29 :     bHideFormula = rItem.bHideFormula;
     228          29 :     bHideCell    = rItem.bHideCell;
     229          29 :     bHidePrint   = rItem.bHidePrint;
     230          29 : }
     231             : 
     232        1132 : ScProtectionAttr::~ScProtectionAttr()
     233             : {
     234        1132 : }
     235             : 
     236             : //------------------------------------------------------------------------
     237             : 
     238          19 : bool ScProtectionAttr::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
     239             : {
     240          19 :     nMemberId &= ~CONVERT_TWIPS;
     241          19 :     switch ( nMemberId  )
     242             :     {
     243             :         case 0 :
     244             :         {
     245          19 :             util::CellProtection aProtection;
     246          19 :             aProtection.IsLocked        = bProtection;
     247          19 :             aProtection.IsFormulaHidden = bHideFormula;
     248          19 :             aProtection.IsHidden        = bHideCell;
     249          19 :             aProtection.IsPrintHidden   = bHidePrint;
     250          19 :             rVal <<= aProtection;
     251          19 :             break;
     252             :         }
     253             :         case MID_1 :
     254           0 :             rVal <<= (sal_Bool ) bProtection; break;
     255             :         case MID_2 :
     256           0 :             rVal <<= (sal_Bool ) bHideFormula; break;
     257             :         case MID_3 :
     258           0 :             rVal <<= (sal_Bool ) bHideCell; break;
     259             :         case MID_4 :
     260           0 :             rVal <<= (sal_Bool ) bHidePrint; break;
     261             :         default:
     262             :             OSL_FAIL("Wrong MemberID!");
     263           0 :             return false;
     264             :     }
     265             : 
     266          19 :     return true;
     267             : }
     268             : 
     269           7 : bool ScProtectionAttr::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     270             : {
     271           7 :     bool bRet = false;
     272           7 :     sal_Bool bVal = sal_False;
     273           7 :     nMemberId &= ~CONVERT_TWIPS;
     274           7 :     switch ( nMemberId )
     275             :     {
     276             :         case 0 :
     277             :         {
     278           7 :             util::CellProtection aProtection;
     279           7 :             if ( rVal >>= aProtection )
     280             :             {
     281           7 :                 bProtection  = aProtection.IsLocked;
     282           7 :                 bHideFormula = aProtection.IsFormulaHidden;
     283           7 :                 bHideCell    = aProtection.IsHidden;
     284           7 :                 bHidePrint   = aProtection.IsPrintHidden;
     285           7 :                 bRet = true;
     286             :             }
     287             :             else
     288             :             {
     289             :                 OSL_FAIL("exception - wrong argument");
     290             :             }
     291           7 :             break;
     292             :         }
     293             :         case MID_1 :
     294           0 :             bRet = (rVal >>= bVal); if (bRet) bProtection=bVal; break;
     295             :         case MID_2 :
     296           0 :             bRet = (rVal >>= bVal); if (bRet) bHideFormula=bVal; break;
     297             :         case MID_3 :
     298           0 :             bRet = (rVal >>= bVal); if (bRet) bHideCell=bVal; break;
     299             :         case MID_4 :
     300           0 :             bRet = (rVal >>= bVal); if (bRet) bHidePrint=bVal; break;
     301             :         default:
     302             :             OSL_FAIL("Wrong MemberID!");
     303             :     }
     304             : 
     305           7 :     return bRet;
     306             : }
     307             : 
     308             : //------------------------------------------------------------------------
     309             : 
     310           0 : OUString ScProtectionAttr::GetValueText() const
     311             : {
     312           0 :     const OUString aStrYes ( ScGlobal::GetRscString(STR_YES) );
     313           0 :     const OUString aStrNo  ( ScGlobal::GetRscString(STR_NO) );
     314             : 
     315             :     const OUString aValue  = "("
     316           0 :         + (bProtection ? aStrYes : aStrNo)
     317           0 :         + ","
     318           0 :         + (bHideFormula ? aStrYes : aStrNo)
     319           0 :         + ","
     320           0 :         + (bHideCell ? aStrYes : aStrNo)
     321           0 :         + ","
     322           0 :         + (bHidePrint ? aStrYes : aStrNo)
     323           0 :         + ")";
     324             : 
     325           0 :     return aValue;
     326             : }
     327             : 
     328             : //------------------------------------------------------------------------
     329             : 
     330           0 : SfxItemPresentation ScProtectionAttr::GetPresentation
     331             :     (
     332             :         SfxItemPresentation ePres,
     333             :         SfxMapUnit /* eCoreMetric */,
     334             :         SfxMapUnit /* ePresMetric */,
     335             :         OUString& rText,
     336             :         const IntlWrapper* /* pIntl */
     337             :     ) const
     338             : {
     339           0 :     const OUString aStrYes ( ScGlobal::GetRscString(STR_YES) );
     340           0 :     const OUString aStrNo  ( ScGlobal::GetRscString(STR_NO) );
     341             : 
     342           0 :     switch ( ePres )
     343             :     {
     344             :         case SFX_ITEM_PRESENTATION_NONE:
     345           0 :             rText = OUString();
     346           0 :             break;
     347             : 
     348             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     349           0 :             rText = GetValueText();
     350           0 :             break;
     351             : 
     352             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     353           0 :             rText  = ScGlobal::GetRscString(STR_PROTECTION)
     354           0 :                 + ": "
     355           0 :                 + (bProtection ? aStrYes : aStrNo)
     356           0 :                 + ", "
     357           0 :                 + ScGlobal::GetRscString(STR_FORMULAS)
     358           0 :                 + ": "
     359           0 :                 + (!bHideFormula ? aStrYes : aStrNo)
     360           0 :                 + ", "
     361           0 :                 + ScGlobal::GetRscString(STR_HIDE)
     362           0 :                 + ": "
     363           0 :                 + (bHideCell ? aStrYes : aStrNo)
     364           0 :                 + ", "
     365           0 :                 + ScGlobal::GetRscString(STR_PRINT)
     366           0 :                 + ": "
     367           0 :                 + (!bHidePrint ? aStrYes : aStrNo);
     368           0 :             break;
     369             : 
     370             :         default:
     371           0 :             ePres = SFX_ITEM_PRESENTATION_NONE;
     372             :     }
     373             : 
     374           0 :     return ePres;
     375             : }
     376             : 
     377             : //------------------------------------------------------------------------
     378             : 
     379         111 : int ScProtectionAttr::operator==( const SfxPoolItem& rItem ) const
     380             : {
     381             :     OSL_ENSURE( Which() != rItem.Which() || Type() == rItem.Type(), "which ==, type !=" );
     382         111 :     return (Which() == rItem.Which())
     383         111 :              && (bProtection == ((ScProtectionAttr&)rItem).bProtection)
     384          99 :              && (bHideFormula == ((ScProtectionAttr&)rItem).bHideFormula)
     385          99 :              && (bHideCell == ((ScProtectionAttr&)rItem).bHideCell)
     386         210 :              && (bHidePrint == ((ScProtectionAttr&)rItem).bHidePrint);
     387             : }
     388             : 
     389             : //------------------------------------------------------------------------
     390             : 
     391          29 : SfxPoolItem* ScProtectionAttr::Clone( SfxItemPool * ) const
     392             : {
     393          29 :     return new ScProtectionAttr(*this);
     394             : }
     395             : 
     396             : //------------------------------------------------------------------------
     397             : 
     398           0 : SfxPoolItem* ScProtectionAttr::Create( SvStream& rStream, sal_uInt16 /* n */ ) const
     399             : {
     400             :     sal_Bool bProtect;
     401             :     sal_Bool bHFormula;
     402             :     sal_Bool bHCell;
     403             :     sal_Bool bHPrint;
     404             : 
     405           0 :     rStream >> bProtect;
     406           0 :     rStream >> bHFormula;
     407           0 :     rStream >> bHCell;
     408           0 :     rStream >> bHPrint;
     409             : 
     410           0 :     return new ScProtectionAttr(bProtect,bHFormula,bHCell,bHPrint);
     411             : }
     412             : 
     413             : //------------------------------------------------------------------------
     414             : 
     415           0 : bool ScProtectionAttr::SetProtection( bool bProtect)
     416             : {
     417           0 :     bProtection =  bProtect;
     418           0 :     return true;
     419             : }
     420             : 
     421             : //------------------------------------------------------------------------
     422             : 
     423           0 : bool ScProtectionAttr::SetHideFormula( bool bHFormula)
     424             : {
     425           0 :     bHideFormula = bHFormula;
     426           0 :     return true;
     427             : }
     428             : 
     429             : //------------------------------------------------------------------------
     430             : 
     431           0 : bool ScProtectionAttr::SetHideCell( bool bHCell)
     432             : {
     433           0 :     bHideCell = bHCell;
     434           0 :     return true;
     435             : }
     436             : 
     437             : //------------------------------------------------------------------------
     438             : 
     439           0 : bool ScProtectionAttr::SetHidePrint( bool bHPrint)
     440             : {
     441           0 :     bHidePrint = bHPrint;
     442           0 :     return true;
     443             : }
     444             : 
     445             : // -----------------------------------------------------------------------
     446             : //      ScRangeItem - Tabellenbereich
     447             : // -----------------------------------------------------------------------
     448             : 
     449           0 : int ScRangeItem::operator==( const SfxPoolItem& rAttr ) const
     450             : {
     451             :     OSL_ENSURE( SfxPoolItem::operator==(rAttr), "unequal types" );
     452             : 
     453           0 :     return ( aRange == ( (ScRangeItem&)rAttr ).aRange );
     454             : }
     455             : 
     456             : // -----------------------------------------------------------------------
     457             : 
     458           0 : SfxPoolItem* ScRangeItem::Clone( SfxItemPool* ) const
     459             : {
     460           0 :     return new ScRangeItem( *this );
     461             : }
     462             : 
     463             : //------------------------------------------------------------------------
     464             : 
     465           0 : SfxItemPresentation ScRangeItem::GetPresentation
     466             :     (
     467             :         SfxItemPresentation ePres,
     468             :         SfxMapUnit          /* eCoreUnit */,
     469             :         SfxMapUnit          /* ePresUnit */,
     470             :         OUString&           rText,
     471             :         const IntlWrapper*  /* pIntl */
     472             :     ) const
     473             : {
     474           0 :     rText = OUString();
     475             : 
     476           0 :     switch ( ePres )
     477             :     {
     478             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     479           0 :         rText = ScGlobal::GetRscString(STR_AREA) + ": ";
     480             :         /* !!! fall-through !!! */
     481             : 
     482             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     483             :         {
     484           0 :             String aText;
     485             :             /* Always use OOo:A1 format */
     486           0 :             aRange.Format( aText );
     487           0 :             rText += aText;
     488             :         }
     489           0 :         break;
     490             : 
     491             :         default:
     492             :         {
     493             :             // added to avoid warnings
     494             :         }
     495             :     }
     496             : 
     497           0 :     return ePres;
     498             : }
     499             : 
     500             : // -----------------------------------------------------------------------
     501             : //      ScTableListItem - List from Tables (-numbers)
     502             : // -----------------------------------------------------------------------
     503             : 
     504           0 : ScTableListItem::ScTableListItem( const ScTableListItem& rCpy )
     505           0 :     :   SfxPoolItem ( rCpy.Which() ),
     506           0 :         nCount      ( rCpy.nCount )
     507             : {
     508           0 :     if ( nCount > 0 )
     509             :     {
     510           0 :         pTabArr = new SCTAB [nCount];
     511             : 
     512           0 :         for ( sal_uInt16 i=0; i<nCount; i++ )
     513           0 :             pTabArr[i] = rCpy.pTabArr[i];
     514             :     }
     515             :     else
     516           0 :         pTabArr = NULL;
     517           0 : }
     518             : 
     519             : // -----------------------------------------------------------------------
     520             : 
     521             : 
     522        1437 : ScTableListItem::~ScTableListItem()
     523             : {
     524         479 :     delete [] pTabArr;
     525         958 : }
     526             : 
     527             : // -----------------------------------------------------------------------
     528             : 
     529           0 : ScTableListItem& ScTableListItem::operator=( const ScTableListItem& rCpy )
     530             : {
     531           0 :     delete [] pTabArr;
     532             : 
     533           0 :     if ( rCpy.nCount > 0 )
     534             :     {
     535           0 :         pTabArr = new SCTAB [rCpy.nCount];
     536           0 :         for ( sal_uInt16 i=0; i<rCpy.nCount; i++ )
     537           0 :             pTabArr[i] = rCpy.pTabArr[i];
     538             :     }
     539             :     else
     540           0 :         pTabArr = NULL;
     541             : 
     542           0 :     nCount = rCpy.nCount;
     543             : 
     544           0 :     return *this;
     545             : }
     546             : 
     547             : // -----------------------------------------------------------------------
     548             : 
     549           0 : int ScTableListItem::operator==( const SfxPoolItem& rAttr ) const
     550             : {
     551             :     OSL_ENSURE( SfxPoolItem::operator==(rAttr), "unequal types" );
     552             : 
     553           0 :     ScTableListItem&    rCmp   = (ScTableListItem&)rAttr;
     554           0 :     bool                bEqual = (nCount == rCmp.nCount);
     555             : 
     556           0 :     if ( nCount > 0 )
     557             :     {
     558           0 :         sal_uInt16  i=0;
     559             : 
     560           0 :         bEqual = ( pTabArr && rCmp.pTabArr );
     561             : 
     562           0 :         while ( bEqual && i<nCount )
     563             :         {
     564           0 :             bEqual = ( pTabArr[i] == rCmp.pTabArr[i] );
     565           0 :             i++;
     566             :         }
     567             :     }
     568           0 :     return bEqual;
     569             : }
     570             : 
     571             : // -----------------------------------------------------------------------
     572             : 
     573           0 : SfxPoolItem* ScTableListItem::Clone( SfxItemPool* ) const
     574             : {
     575           0 :     return new ScTableListItem( *this );
     576             : }
     577             : 
     578             : //------------------------------------------------------------------------
     579             : 
     580           0 : SfxItemPresentation ScTableListItem::GetPresentation
     581             :     (
     582             :         SfxItemPresentation ePres,
     583             :         SfxMapUnit          /* eCoreUnit */,
     584             :         SfxMapUnit          /* ePresUnit */,
     585             :         OUString&           rText,
     586             :         const IntlWrapper* /* pIntl */
     587             :     ) const
     588             : {
     589           0 :     switch ( ePres )
     590             :     {
     591             :         case SFX_ITEM_PRESENTATION_NONE:
     592           0 :             rText = OUString();
     593           0 :             return ePres;
     594             : 
     595             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     596             :             {
     597           0 :             rText  = "(";
     598           0 :             if ( nCount>0 && pTabArr )
     599           0 :                 for ( sal_uInt16 i=0; i<nCount; i++ )
     600             :                 {
     601           0 :                     rText += OUString::number( pTabArr[i] );
     602           0 :                     if ( i<(nCount-1) )
     603           0 :                         rText += ",";
     604             :                 }
     605           0 :             rText += ")";
     606             :             }
     607           0 :             return ePres;
     608             : 
     609             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     610           0 :             rText = OUString();
     611           0 :             return SFX_ITEM_PRESENTATION_NONE;
     612             : 
     613             :         default:
     614             :         {
     615             :             // added to avoid warnings
     616             :         }
     617             :     }
     618             : 
     619           0 :     return SFX_ITEM_PRESENTATION_NONE;
     620             : }
     621             : 
     622             : 
     623             : // -----------------------------------------------------------------------
     624             : //      ScPageHFItem - Dates from the Head and Foot lines
     625             : // -----------------------------------------------------------------------
     626             : 
     627        3130 : ScPageHFItem::ScPageHFItem( sal_uInt16 nWhichP )
     628             :     :   SfxPoolItem ( nWhichP ),
     629             :         pLeftArea   ( NULL ),
     630             :         pCenterArea ( NULL ),
     631        3130 :         pRightArea  ( NULL )
     632             : {
     633        3130 : }
     634             : 
     635             : //------------------------------------------------------------------------
     636             : 
     637        3793 : ScPageHFItem::ScPageHFItem( const ScPageHFItem& rItem )
     638             :     :   SfxPoolItem ( rItem ),
     639             :         pLeftArea   ( NULL ),
     640             :         pCenterArea ( NULL ),
     641        3793 :         pRightArea  ( NULL )
     642             : {
     643        3793 :     if ( rItem.pLeftArea )
     644        1769 :         pLeftArea = rItem.pLeftArea->Clone();
     645        3793 :     if ( rItem.pCenterArea )
     646        1799 :         pCenterArea = rItem.pCenterArea->Clone();
     647        3793 :     if ( rItem.pRightArea )
     648        1767 :         pRightArea = rItem.pRightArea->Clone();
     649        3793 : }
     650             : 
     651             : //------------------------------------------------------------------------
     652             : 
     653       18959 : ScPageHFItem::~ScPageHFItem()
     654             : {
     655        6341 :     delete pLeftArea;
     656        6341 :     delete pCenterArea;
     657        6341 :     delete pRightArea;
     658       12618 : }
     659             : 
     660             : //------------------------------------------------------------------------
     661             : 
     662         811 : bool ScPageHFItem::QueryValue( uno::Any& rVal, sal_uInt8 /* nMemberId */ ) const
     663             : {
     664             :     uno::Reference<sheet::XHeaderFooterContent> xContent =
     665         811 :         new ScHeaderFooterContentObj( pLeftArea, pCenterArea, pRightArea );
     666             : 
     667         811 :     rVal <<= xContent;
     668         811 :     return true;
     669             : }
     670             : 
     671         670 : bool ScPageHFItem::PutValue( const uno::Any& rVal, sal_uInt8 /* nMemberId */ )
     672             : {
     673         670 :     bool bRet = false;
     674         670 :     uno::Reference<sheet::XHeaderFooterContent> xContent;
     675         670 :     if ( rVal >>= xContent )
     676             :     {
     677         670 :         if ( xContent.is() )
     678             :         {
     679             :             ScHeaderFooterContentObj* pImp =
     680         670 :                     ScHeaderFooterContentObj::getImplementation( xContent );
     681         670 :             if (pImp)
     682             :             {
     683         670 :                 const EditTextObject* pImpLeft = pImp->GetLeftEditObject();
     684         670 :                 delete pLeftArea;
     685         670 :                 pLeftArea = pImpLeft ? pImpLeft->Clone() : NULL;
     686             : 
     687         670 :                 const EditTextObject* pImpCenter = pImp->GetCenterEditObject();
     688         670 :                 delete pCenterArea;
     689         670 :                 pCenterArea = pImpCenter ? pImpCenter->Clone() : NULL;
     690             : 
     691         670 :                 const EditTextObject* pImpRight = pImp->GetRightEditObject();
     692         670 :                 delete pRightArea;
     693         670 :                 pRightArea = pImpRight ? pImpRight->Clone() : NULL;
     694             : 
     695         670 :                 if ( !pLeftArea || !pCenterArea || !pRightArea )
     696             :                 {
     697             :                     // no Text with Null are left
     698          50 :                     ScEditEngineDefaulter aEngine( EditEngine::CreatePool(), true );
     699          50 :                     if (!pLeftArea)
     700          50 :                         pLeftArea = aEngine.CreateTextObject();
     701          50 :                     if (!pCenterArea)
     702           0 :                         pCenterArea = aEngine.CreateTextObject();
     703          50 :                     if (!pRightArea)
     704          50 :                         pRightArea = aEngine.CreateTextObject();
     705             :                 }
     706             : 
     707         670 :                 bRet = true;
     708             :             }
     709             :         }
     710             :     }
     711             : 
     712         670 :     if (!bRet)
     713             :     {
     714             :         OSL_FAIL("exception - wrong argument");
     715             :     }
     716             : 
     717         670 :     return true;
     718             : }
     719             : 
     720             : //------------------------------------------------------------------------
     721             : 
     722           0 : OUString ScPageHFItem::GetValueText() const
     723             : {
     724           0 :     return OUString("ScPageHFItem");
     725             : }
     726             : 
     727             : //------------------------------------------------------------------------
     728             : 
     729        3900 : int ScPageHFItem::operator==( const SfxPoolItem& rItem ) const
     730             : {
     731             :     OSL_ENSURE( SfxPoolItem::operator==( rItem ), "unequal Which or Type" );
     732             : 
     733        3900 :     const ScPageHFItem& r = (const ScPageHFItem&)rItem;
     734             : 
     735        3900 :     return    ScGlobal::EETextObjEqual(pLeftArea,   r.pLeftArea)
     736         783 :            && ScGlobal::EETextObjEqual(pCenterArea, r.pCenterArea)
     737        4107 :            && ScGlobal::EETextObjEqual(pRightArea,  r.pRightArea);
     738             : }
     739             : 
     740             : //------------------------------------------------------------------------
     741             : 
     742        3793 : SfxPoolItem* ScPageHFItem::Clone( SfxItemPool* ) const
     743             : {
     744        3793 :     return new ScPageHFItem( *this );
     745             : }
     746             : 
     747             : //------------------------------------------------------------------------
     748             : 
     749           0 : static void lcl_SetSpace( String& rStr, const ESelection& rSel )
     750             : {
     751             :     // Text replaced by a space to ensure they are positions:
     752             : 
     753           0 :     xub_StrLen nLen = rSel.nEndPos-rSel.nStartPos;
     754           0 :     rStr.Erase( rSel.nStartPos, nLen-1 );
     755           0 :     rStr.SetChar( rSel.nStartPos, ' ' );
     756           0 : }
     757             : 
     758           0 : static bool lcl_ConvertFields(EditEngine& rEng, const String* pCommands)
     759             : {
     760           0 :     bool bChange = false;
     761           0 :     sal_Int32 nParCnt = rEng.GetParagraphCount();
     762           0 :     for (sal_Int32 nPar = 0; nPar<nParCnt; nPar++)
     763             :     {
     764           0 :         String aStr = rEng.GetText( nPar );
     765             :         xub_StrLen nPos;
     766             : 
     767           0 :         while ((nPos = aStr.Search(pCommands[0])) != STRING_NOTFOUND)
     768             :         {
     769           0 :             ESelection aSel( nPar,nPos, nPar,nPos+pCommands[0].Len() );
     770           0 :             rEng.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), aSel );
     771           0 :             lcl_SetSpace(aStr, aSel ); bChange = true;
     772             :         }
     773           0 :         while ((nPos = aStr.Search(pCommands[1])) != STRING_NOTFOUND)
     774             :         {
     775           0 :             ESelection aSel( nPar,nPos, nPar,nPos+pCommands[1].Len() );
     776           0 :             rEng.QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), aSel );
     777           0 :             lcl_SetSpace(aStr, aSel ); bChange = true;
     778             :         }
     779           0 :         while ((nPos = aStr.Search(pCommands[2])) != STRING_NOTFOUND)
     780             :         {
     781           0 :             ESelection aSel( nPar,nPos, nPar,nPos+pCommands[2].Len() );
     782           0 :             rEng.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD), aSel );
     783           0 :             lcl_SetSpace(aStr, aSel ); bChange = true;
     784             :         }
     785           0 :         while ((nPos = aStr.Search(pCommands[3])) != STRING_NOTFOUND)
     786             :         {
     787           0 :             ESelection aSel( nPar,nPos, nPar,nPos+pCommands[3].Len() );
     788           0 :             rEng.QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD ), aSel );
     789           0 :             lcl_SetSpace(aStr, aSel ); bChange = true;
     790             :         }
     791           0 :         while ((nPos = aStr.Search(pCommands[4])) != STRING_NOTFOUND)
     792             :         {
     793           0 :             ESelection aSel( nPar,nPos, nPar,nPos+pCommands[4].Len() );
     794           0 :             rEng.QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), aSel );
     795           0 :             lcl_SetSpace(aStr, aSel ); bChange = true;
     796             :         }
     797           0 :         while ((nPos = aStr.Search(pCommands[5])) != STRING_NOTFOUND)
     798             :         {
     799           0 :             ESelection aSel( nPar,nPos, nPar,nPos+pCommands[5].Len() );
     800           0 :             rEng.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), aSel );
     801           0 :             lcl_SetSpace(aStr, aSel ); bChange = true;
     802             :         }
     803           0 :     }
     804           0 :     return bChange;
     805             : }
     806             : 
     807             : #define SC_FIELD_COUNT  6
     808             : 
     809           0 : SfxPoolItem* ScPageHFItem::Create( SvStream& rStream, sal_uInt16 nVer ) const
     810             : {
     811           0 :     EditTextObject* pLeft   = EditTextObject::Create(rStream);
     812           0 :     EditTextObject* pCenter = EditTextObject::Create(rStream);
     813           0 :     EditTextObject* pRight  = EditTextObject::Create(rStream);
     814             : 
     815             :     OSL_ENSURE( pLeft && pCenter && pRight, "Error reading ScPageHFItem" );
     816             : 
     817           0 :     if ( pLeft == NULL   || pLeft->GetParagraphCount() == 0 ||
     818           0 :          pCenter == NULL || pCenter->GetParagraphCount() == 0 ||
     819           0 :          pRight == NULL  || pRight->GetParagraphCount() == 0 )
     820             :     {
     821             :         //  If successfully loaded, each object contains at least one paragraph.
     822             :         //  Excel import in 5.1 created broken TextObjects (#67442#) that are
     823             :         //  corrected here to avoid saving wrong files again (#90487#).
     824             : 
     825           0 :         ScEditEngineDefaulter aEngine( EditEngine::CreatePool(), true );
     826           0 :         if ( pLeft == NULL || pLeft->GetParagraphCount() == 0 )
     827             :         {
     828           0 :             delete pLeft;
     829           0 :             pLeft = aEngine.CreateTextObject();
     830             :         }
     831           0 :         if ( pCenter == NULL || pCenter->GetParagraphCount() == 0 )
     832             :         {
     833           0 :             delete pCenter;
     834           0 :             pCenter = aEngine.CreateTextObject();
     835             :         }
     836           0 :         if ( pRight == NULL || pRight->GetParagraphCount() == 0 )
     837             :         {
     838           0 :             delete pRight;
     839           0 :             pRight = aEngine.CreateTextObject();
     840           0 :         }
     841             :     }
     842             : 
     843           0 :     if ( nVer < 1 )             //old field command conversions
     844             :     {
     845             :         sal_uInt16 i;
     846           0 :         const String& rDel = ScGlobal::GetRscString( STR_HFCMD_DELIMITER );
     847           0 :         String aCommands[SC_FIELD_COUNT];
     848           0 :         for (i=0; i<SC_FIELD_COUNT; i++)
     849           0 :             aCommands[i] = rDel;
     850           0 :         aCommands[0] += ScGlobal::GetRscString(STR_HFCMD_PAGE);
     851           0 :         aCommands[1] += ScGlobal::GetRscString(STR_HFCMD_PAGES);
     852           0 :         aCommands[2] += ScGlobal::GetRscString(STR_HFCMD_DATE);
     853           0 :         aCommands[3] += ScGlobal::GetRscString(STR_HFCMD_TIME);
     854           0 :         aCommands[4] += ScGlobal::GetRscString(STR_HFCMD_FILE);
     855           0 :         aCommands[5] += ScGlobal::GetRscString(STR_HFCMD_TABLE);
     856           0 :         for (i=0; i<SC_FIELD_COUNT; i++)
     857           0 :             aCommands[i] += rDel;
     858             : 
     859           0 :         ScEditEngineDefaulter aEngine( EditEngine::CreatePool(), true );
     860           0 :         aEngine.SetText(*pLeft);
     861           0 :         if (lcl_ConvertFields(aEngine,aCommands))
     862             :         {
     863           0 :             delete pLeft;
     864           0 :             pLeft = aEngine.CreateTextObject();
     865             :         }
     866           0 :         aEngine.SetText(*pCenter);
     867           0 :         if (lcl_ConvertFields(aEngine,aCommands))
     868             :         {
     869           0 :             delete pCenter;
     870           0 :             pCenter = aEngine.CreateTextObject();
     871             :         }
     872           0 :         aEngine.SetText(*pRight);
     873           0 :         if (lcl_ConvertFields(aEngine,aCommands))
     874             :         {
     875           0 :             delete pRight;
     876           0 :             pRight = aEngine.CreateTextObject();
     877           0 :         }
     878             :     }
     879             :     else if ( nVer < 2 )
     880             :     {   // not to do, SvxFileField is not exchanged for SvxExtFileField
     881             :     }
     882             : 
     883           0 :     ScPageHFItem* pItem = new ScPageHFItem( Which() );
     884           0 :     pItem->SetArea( pLeft,    SC_HF_LEFTAREA   );
     885           0 :     pItem->SetArea( pCenter, SC_HF_CENTERAREA );
     886           0 :     pItem->SetArea( pRight,  SC_HF_RIGHTAREA  );
     887             : 
     888           0 :     return pItem;
     889             : }
     890             : 
     891             : //------------------------------------------------------------------------
     892             : 
     893             : 
     894        1262 : void ScPageHFItem::SetLeftArea( const EditTextObject& rNew )
     895             : {
     896        1262 :     delete pLeftArea;
     897        1262 :     pLeftArea = rNew.Clone();
     898        1262 : }
     899             : 
     900             : //------------------------------------------------------------------------
     901             : 
     902        1316 : void ScPageHFItem::SetCenterArea( const EditTextObject& rNew )
     903             : {
     904        1316 :     delete pCenterArea;
     905        1316 :     pCenterArea = rNew.Clone();
     906        1316 : }
     907             : 
     908             : //------------------------------------------------------------------------
     909             : 
     910        1260 : void ScPageHFItem::SetRightArea( const EditTextObject& rNew )
     911             : {
     912        1260 :     delete pRightArea;
     913        1260 :     pRightArea = rNew.Clone();
     914        1260 : }
     915             : 
     916           0 : void ScPageHFItem::SetArea( EditTextObject *pNew, int nArea )
     917             : {
     918           0 :     switch ( nArea )
     919             :     {
     920           0 :         case SC_HF_LEFTAREA:    delete pLeftArea;   pLeftArea   = pNew; break;
     921           0 :         case SC_HF_CENTERAREA:  delete pCenterArea; pCenterArea = pNew; break;
     922           0 :         case SC_HF_RIGHTAREA:   delete pRightArea;  pRightArea  = pNew; break;
     923             :         default:
     924             :             OSL_FAIL( "New Area?" );
     925             :     }
     926           0 : }
     927             : 
     928             : //-----------------------------------------------------------------------
     929             : //  ScViewObjectModeItem - Display Mode of View Objects
     930             : //-----------------------------------------------------------------------
     931             : 
     932        1830 : ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP )
     933        1830 :     : SfxEnumItem( nWhichP, VOBJ_MODE_SHOW )
     934             : {
     935        1830 : }
     936             : 
     937             : //------------------------------------------------------------------------
     938             : 
     939          24 : ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP, ScVObjMode eMode )
     940          24 :     : SfxEnumItem( nWhichP, sal::static_int_cast<sal_uInt16>(eMode) )
     941             : {
     942          24 : }
     943             : 
     944             : //------------------------------------------------------------------------
     945             : 
     946        2946 : ScViewObjectModeItem::~ScViewObjectModeItem()
     947             : {
     948        2946 : }
     949             : 
     950             : //------------------------------------------------------------------------
     951             : 
     952           0 : SfxItemPresentation ScViewObjectModeItem::GetPresentation
     953             : (
     954             :     SfxItemPresentation ePres,
     955             :     SfxMapUnit          /* eCoreUnit */,
     956             :     SfxMapUnit          /* ePresUnit */,
     957             :     OUString&           rText,
     958             :     const IntlWrapper* /* pIntl */
     959             : )   const
     960             : {
     961           0 :     OUString aDel(": ");
     962           0 :     rText = OUString();
     963             : 
     964           0 :     switch ( ePres )
     965             :     {
     966             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     967           0 :         switch( Which() )
     968             :         {
     969             :             case SID_SCATTR_PAGE_CHARTS:
     970           0 :             rText = ScGlobal::GetRscString(STR_VOBJ_CHART) + aDel;
     971           0 :             break;
     972             : 
     973             :             case SID_SCATTR_PAGE_OBJECTS:
     974           0 :             rText = ScGlobal::GetRscString(STR_VOBJ_OBJECT) + aDel;
     975           0 :             break;
     976             : 
     977             :             case SID_SCATTR_PAGE_DRAWINGS:
     978           0 :             rText = ScGlobal::GetRscString(STR_VOBJ_DRAWINGS) + aDel;
     979           0 :             break;
     980             : 
     981             :             default:
     982           0 :             ePres = SFX_ITEM_PRESENTATION_NAMELESS;//this always goes!
     983           0 :             break;
     984             :         }
     985             :         /* !!! fall-through !!! */
     986             : 
     987             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     988           0 :         rText += ScGlobal::GetRscString(STR_VOBJ_MODE_SHOW+GetValue());
     989           0 :         break;
     990             : 
     991             :         default:
     992             :         {
     993             :             // added to avoid warnings
     994             :         }
     995             :     }
     996             : 
     997           0 :     return ePres;
     998             : }
     999             : 
    1000             : //------------------------------------------------------------------------
    1001             : 
    1002           0 : OUString ScViewObjectModeItem::GetValueText( sal_uInt16 nVal ) const
    1003             : {
    1004             :     OSL_ENSURE( nVal <= VOBJ_MODE_HIDE, "enum overflow!" );
    1005             : 
    1006           0 :     return ScGlobal::GetRscString( STR_VOBJ_MODE_SHOW + (nVal % 2));
    1007             : }
    1008             : 
    1009             : //------------------------------------------------------------------------
    1010             : 
    1011           0 : sal_uInt16 ScViewObjectModeItem::GetValueCount() const
    1012             : {
    1013           0 :     return 2;
    1014             : }
    1015             : 
    1016             : //------------------------------------------------------------------------
    1017             : 
    1018          24 : SfxPoolItem* ScViewObjectModeItem::Clone( SfxItemPool* ) const
    1019             : {
    1020          24 :     return new ScViewObjectModeItem( *this );
    1021             : }
    1022             : 
    1023             : //------------------------------------------------------------------------
    1024             : 
    1025           0 : sal_uInt16 ScViewObjectModeItem::GetVersion( sal_uInt16 /* nFileVersion */ ) const
    1026             : {
    1027           0 :     return 1;
    1028             : }
    1029             : 
    1030             : //------------------------------------------------------------------------
    1031             : 
    1032           0 : SfxPoolItem* ScViewObjectModeItem::Create(
    1033             :                                     SvStream&   rStream,
    1034             :                                     sal_uInt16      nVersion ) const
    1035             : {
    1036           0 :     if ( nVersion == 0 )
    1037             :     {
    1038             :         // Old Version with AllEnuItem -> produce with Mode "Show"
    1039           0 :         return new ScViewObjectModeItem( Which() );
    1040             :     }
    1041             :     else
    1042             :     {
    1043             :         sal_uInt16 nVal;
    1044           0 :         rStream >> nVal;
    1045             : 
    1046             :         //#i80528# adapt to new range eventually
    1047           0 :         if((sal_uInt16)VOBJ_MODE_HIDE < nVal) nVal = (sal_uInt16)VOBJ_MODE_SHOW;
    1048             : 
    1049           0 :         return new ScViewObjectModeItem( Which(), (ScVObjMode)nVal);
    1050             :     }
    1051             : }
    1052             : 
    1053             : // -----------------------------------------------------------------------
    1054             : //      double
    1055             : // -----------------------------------------------------------------------
    1056             : 
    1057           0 : ScDoubleItem::ScDoubleItem( sal_uInt16 nWhichP, double nVal )
    1058             :     :   SfxPoolItem ( nWhichP ),
    1059           0 :         nValue  ( nVal )
    1060             : {
    1061           0 : }
    1062             : 
    1063             : //------------------------------------------------------------------------
    1064             : 
    1065           0 : ScDoubleItem::ScDoubleItem( const ScDoubleItem& rItem )
    1066           0 :     :   SfxPoolItem ( rItem )
    1067             : {
    1068           0 :         nValue = rItem.nValue;
    1069           0 : }
    1070             : 
    1071             : //------------------------------------------------------------------------
    1072             : 
    1073           0 : OUString ScDoubleItem::GetValueText() const
    1074             : {
    1075           0 :     return OUString("ScDoubleItem");
    1076             : }
    1077             : 
    1078             : //------------------------------------------------------------------------
    1079             : 
    1080           0 : int ScDoubleItem::operator==( const SfxPoolItem& rItem ) const
    1081             : {
    1082             :     OSL_ENSURE( SfxPoolItem::operator==( rItem ), "unequal Which or Type" );
    1083           0 :     const ScDoubleItem& _rItem = (const ScDoubleItem&)rItem;
    1084           0 :     return int(nValue == _rItem.nValue);
    1085             : }
    1086             : 
    1087             : //------------------------------------------------------------------------
    1088             : 
    1089           0 : SfxPoolItem* ScDoubleItem::Clone( SfxItemPool* ) const
    1090             : {
    1091           0 :     return new ScDoubleItem( *this );
    1092             : }
    1093             : 
    1094             : //------------------------------------------------------------------------
    1095             : 
    1096           0 : SfxPoolItem* ScDoubleItem::Create( SvStream& rStream, sal_uInt16 /* nVer */ ) const
    1097             : {
    1098           0 :     double nTmp=0;
    1099           0 :     rStream >> nTmp;
    1100             : 
    1101           0 :     ScDoubleItem* pItem = new ScDoubleItem( Which(), nTmp );
    1102             : 
    1103           0 :     return pItem;
    1104             : }
    1105             : 
    1106             : //------------------------------------------------------------------------
    1107             : 
    1108           0 : ScDoubleItem::~ScDoubleItem()
    1109             : {
    1110           0 : }
    1111             : 
    1112             : 
    1113             : // ============================================================================
    1114             : 
    1115         831 : ScPageScaleToItem::ScPageScaleToItem() :
    1116             :     SfxPoolItem( ATTR_PAGE_SCALETO ),
    1117             :     mnWidth( 0 ),
    1118         831 :     mnHeight( 0 )
    1119             : {
    1120         831 : }
    1121             : 
    1122         610 : ScPageScaleToItem::ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight ) :
    1123             :     SfxPoolItem( ATTR_PAGE_SCALETO ),
    1124             :     mnWidth( nWidth ),
    1125         610 :     mnHeight( nHeight )
    1126             : {
    1127         610 : }
    1128             : 
    1129        3453 : ScPageScaleToItem::~ScPageScaleToItem()
    1130             : {
    1131        3453 : }
    1132             : 
    1133         836 : ScPageScaleToItem* ScPageScaleToItem::Clone( SfxItemPool* ) const
    1134             : {
    1135         836 :     return new ScPageScaleToItem( *this );
    1136             : }
    1137             : 
    1138           3 : int ScPageScaleToItem::operator==( const SfxPoolItem& rCmp ) const
    1139             : {
    1140             :     OSL_ENSURE( SfxPoolItem::operator==( rCmp ), "ScPageScaleToItem::operator== - unequal wid or type" );
    1141           3 :     const ScPageScaleToItem& rPageCmp = static_cast< const ScPageScaleToItem& >( rCmp );
    1142           3 :     return ((mnWidth == rPageCmp.mnWidth) && (mnHeight == rPageCmp.mnHeight)) ? 1 : 0;
    1143             : }
    1144             : 
    1145             : namespace {
    1146           0 : void lclAppendScalePageCount( OUString& rText, sal_uInt16 nPages )
    1147             : {
    1148           0 :     rText += ": ";
    1149           0 :     if( nPages )
    1150             :     {
    1151           0 :         OUString aPages( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_PAGES ) );
    1152           0 :         rText += aPages.replaceFirst( "%1", OUString::number( nPages ) );
    1153             :     }
    1154             :     else
    1155           0 :         rText += ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_AUTO );
    1156           0 : }
    1157             : } // namespace
    1158             : 
    1159           0 : SfxItemPresentation ScPageScaleToItem::GetPresentation(
    1160             :         SfxItemPresentation ePres, SfxMapUnit, SfxMapUnit, OUString& rText, const IntlWrapper* ) const
    1161             : {
    1162           0 :     rText = OUString();
    1163           0 :     if( !IsValid() || (ePres == SFX_ITEM_PRESENTATION_NONE) )
    1164           0 :         return SFX_ITEM_PRESENTATION_NONE;
    1165             : 
    1166           0 :     OUString aName( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALETO ) );
    1167           0 :     OUString aValue( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_WIDTH ) );
    1168           0 :     lclAppendScalePageCount( aValue, mnWidth );
    1169           0 :     aValue = aValue + ", " + ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_HEIGHT );
    1170           0 :     lclAppendScalePageCount( aValue, mnHeight );
    1171             : 
    1172           0 :     switch( ePres )
    1173             :     {
    1174             :         case SFX_ITEM_PRESENTATION_NONE:
    1175           0 :         break;
    1176             : 
    1177             :         case SFX_ITEM_PRESENTATION_NAMEONLY:
    1178           0 :             rText = aName;
    1179           0 :         break;
    1180             : 
    1181             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    1182           0 :             rText = aValue;
    1183           0 :         break;
    1184             : 
    1185             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    1186           0 :             rText = aName + " (" + aValue + ")";
    1187           0 :         break;
    1188             : 
    1189             :         default:
    1190             :             OSL_FAIL( "ScPageScaleToItem::GetPresentation - unknown presentation mode" );
    1191           0 :             ePres = SFX_ITEM_PRESENTATION_NONE;
    1192             :     }
    1193           0 :     return ePres;
    1194             : }
    1195             : 
    1196           0 : bool ScPageScaleToItem::QueryValue( uno::Any& rAny, sal_uInt8 nMemberId ) const
    1197             : {
    1198           0 :     bool bRet = true;
    1199           0 :     switch( nMemberId )
    1200             :     {
    1201           0 :         case SC_MID_PAGE_SCALETO_WIDTH:     rAny <<= mnWidth;   break;
    1202           0 :         case SC_MID_PAGE_SCALETO_HEIGHT:    rAny <<= mnHeight;  break;
    1203             :         default:
    1204             :             OSL_FAIL( "ScPageScaleToItem::QueryValue - unknown member ID" );
    1205           0 :             bRet = false;
    1206             :     }
    1207           0 :     return bRet;
    1208             : }
    1209             : 
    1210           0 : bool ScPageScaleToItem::PutValue( const uno::Any& rAny, sal_uInt8 nMemberId )
    1211             : {
    1212           0 :     bool bRet = false;
    1213           0 :     switch( nMemberId )
    1214             :     {
    1215           0 :         case SC_MID_PAGE_SCALETO_WIDTH:     bRet = rAny >>= mnWidth;    break;
    1216           0 :         case SC_MID_PAGE_SCALETO_HEIGHT:    bRet = rAny >>= mnHeight;   break;
    1217             :         default:
    1218             :             OSL_FAIL( "ScPageScaleToItem::PutValue - unknown member ID" );
    1219             :     }
    1220           0 :     return bRet;
    1221             : }
    1222             : 
    1223             : // ============================================================================
    1224             : 
    1225        4970 : ScCondFormatItem::ScCondFormatItem():
    1226        4970 :     SfxPoolItem( ATTR_CONDITIONAL )
    1227             : {
    1228        4970 : }
    1229             : 
    1230         464 : ScCondFormatItem::ScCondFormatItem( const std::vector<sal_uInt32>& rIndex ):
    1231             :     SfxPoolItem( ATTR_CONDITIONAL ),
    1232         464 :     maIndex( rIndex )
    1233             : {
    1234         464 : }
    1235             : 
    1236        6244 : ScCondFormatItem::~ScCondFormatItem()
    1237             : {
    1238        6244 : }
    1239             : 
    1240       10701 : int ScCondFormatItem::operator==( const SfxPoolItem& rCmp ) const
    1241             : {
    1242       10701 :     return maIndex == static_cast<const ScCondFormatItem&>(rCmp).maIndex;
    1243             : }
    1244             : 
    1245         464 : ScCondFormatItem* ScCondFormatItem::Clone(SfxItemPool*) const
    1246             : {
    1247         464 :     return new ScCondFormatItem(maIndex);
    1248             : }
    1249             : 
    1250    10547594 : const std::vector<sal_uInt32>& ScCondFormatItem::GetCondFormatData() const
    1251             : {
    1252    10547594 :     return maIndex;
    1253             : }
    1254             : 
    1255           0 : void ScCondFormatItem::AddCondFormatData( sal_uInt32 nIndex )
    1256             : {
    1257           0 :     maIndex.push_back(nIndex);
    1258           0 : }
    1259             : 
    1260        4360 : void ScCondFormatItem::SetCondFormatData( const std::vector<sal_uInt32>& rIndex )
    1261             : {
    1262        4360 :     maIndex = rIndex;
    1263        4453 : }
    1264             : 
    1265             : 
    1266             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10