LCOV - code coverage report
Current view: top level - sc/source/core/data - docpool.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 302 429 70.4 %
Date: 2015-06-13 12:38:46 Functions: 12 16 75.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 "scitems.hxx"
      21             : 
      22             : #include <comphelper/string.hxx>
      23             : #include <i18nutil/unicode.hxx>
      24             : #include <vcl/outdev.hxx>
      25             : #include <vcl/svapp.hxx>
      26             : #include <vcl/settings.hxx>
      27             : #include <svl/aeitem.hxx>
      28             : #include <svl/itemiter.hxx>
      29             : #include <svl/stritem.hxx>
      30             : #include <svx/algitem.hxx>
      31             : #include <editeng/boxitem.hxx>
      32             : #include <editeng/lineitem.hxx>
      33             : #include <editeng/brushitem.hxx>
      34             : #include <editeng/charreliefitem.hxx>
      35             : #include <editeng/contouritem.hxx>
      36             : #include <editeng/colritem.hxx>
      37             : #include <editeng/crossedoutitem.hxx>
      38             : #include <svx/dialmgr.hxx>
      39             : #include <editeng/emphasismarkitem.hxx>
      40             : #include <editeng/fhgtitem.hxx>
      41             : #include <editeng/fontitem.hxx>
      42             : #include <editeng/forbiddenruleitem.hxx>
      43             : #include <editeng/frmdiritem.hxx>
      44             : #include <editeng/hngpnctitem.hxx>
      45             : #include <editeng/itemtype.hxx>
      46             : #include <editeng/langitem.hxx>
      47             : #include <editeng/lrspitem.hxx>
      48             : #include <svx/pageitem.hxx>
      49             : #include <editeng/pbinitem.hxx>
      50             : #include <editeng/postitem.hxx>
      51             : #include <svx/rotmodit.hxx>
      52             : #include <editeng/scriptspaceitem.hxx>
      53             : #include <editeng/shaditem.hxx>
      54             : #include <editeng/shdditem.hxx>
      55             : #include <editeng/sizeitem.hxx>
      56             : #include <svx/svxitems.hrc>
      57             : #include <editeng/udlnitem.hxx>
      58             : #include <editeng/ulspitem.hxx>
      59             : #include <editeng/wghtitem.hxx>
      60             : #include <editeng/wrlmitem.hxx>
      61             : #include <editeng/xmlcnitm.hxx>
      62             : #include <editeng/justifyitem.hxx>
      63             : 
      64             : #include "docpool.hxx"
      65             : #include "global.hxx"
      66             : #include "attrib.hxx"
      67             : #include "patattr.hxx"
      68             : #include "globstr.hrc"
      69             : #include "document.hxx"
      70             : #include "sc.hrc"
      71             : 
      72             : #define SC_MAX_POOLREF      (SFX_ITEMS_OLD_MAXREF - 39)
      73             : #define SC_SAFE_POOLREF     (SC_MAX_POOLREF + 20)
      74             : 
      75             : // STATIC DATA -----------------------------------------------------------
      76             : 
      77             : sal_uInt16* ScDocumentPool::pVersionMap1 = 0;
      78             : sal_uInt16* ScDocumentPool::pVersionMap2 = 0;
      79             : sal_uInt16* ScDocumentPool::pVersionMap3 = 0;
      80             : sal_uInt16* ScDocumentPool::pVersionMap4 = 0;
      81             : sal_uInt16* ScDocumentPool::pVersionMap5 = 0;
      82             : sal_uInt16* ScDocumentPool::pVersionMap6 = 0;
      83             : sal_uInt16* ScDocumentPool::pVersionMap7 = 0;
      84             : sal_uInt16* ScDocumentPool::pVersionMap8 = 0;
      85             : sal_uInt16* ScDocumentPool::pVersionMap9 = 0;
      86             : sal_uInt16* ScDocumentPool::pVersionMap10 = 0;
      87             : sal_uInt16* ScDocumentPool::pVersionMap11 = 0;
      88             : sal_uInt16* ScDocumentPool::pVersionMap12 = 0;
      89             : 
      90             : // ATTR_FONT_TWOLINES (not used) was changed to ATTR_USERDEF (not saved in binary format) in 641c
      91             : 
      92             : static SfxItemInfo const  aItemInfos[] =
      93             : {
      94             :     { SID_ATTR_CHAR_FONT,           SfxItemPoolFlags::POOLABLE },    // ATTR_FONT
      95             :     { SID_ATTR_CHAR_FONTHEIGHT,     SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_HEIGHT
      96             :     { SID_ATTR_CHAR_WEIGHT,         SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_WEIGHT
      97             :     { SID_ATTR_CHAR_POSTURE,        SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_POSTURE
      98             :     { SID_ATTR_CHAR_UNDERLINE,      SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_UNDERLINE
      99             :     { SID_ATTR_CHAR_OVERLINE,       SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_OVERLINE
     100             :     { SID_ATTR_CHAR_STRIKEOUT,      SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_CROSSEDOUT
     101             :     { SID_ATTR_CHAR_CONTOUR,        SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_CONTOUR
     102             :     { SID_ATTR_CHAR_SHADOWED,       SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_SHADOWED
     103             :     { SID_ATTR_CHAR_COLOR,          SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_COLOR
     104             :     { SID_ATTR_CHAR_LANGUAGE,       SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_LANGUAGE
     105             :     { SID_ATTR_CHAR_CJK_FONT,       SfxItemPoolFlags::POOLABLE },    // ATTR_CJK_FONT            from 614
     106             :     { SID_ATTR_CHAR_CJK_FONTHEIGHT, SfxItemPoolFlags::POOLABLE },    // ATTR_CJK_FONT_HEIGHT     from 614
     107             :     { SID_ATTR_CHAR_CJK_WEIGHT,     SfxItemPoolFlags::POOLABLE },    // ATTR_CJK_FONT_WEIGHT     from 614
     108             :     { SID_ATTR_CHAR_CJK_POSTURE,    SfxItemPoolFlags::POOLABLE },    // ATTR_CJK_FONT_POSTURE    from 614
     109             :     { SID_ATTR_CHAR_CJK_LANGUAGE,   SfxItemPoolFlags::POOLABLE },    // ATTR_CJK_FONT_LANGUAGE   from 614
     110             :     { SID_ATTR_CHAR_CTL_FONT,       SfxItemPoolFlags::POOLABLE },    // ATTR_CTL_FONT            from 614
     111             :     { SID_ATTR_CHAR_CTL_FONTHEIGHT, SfxItemPoolFlags::POOLABLE },    // ATTR_CTL_FONT_HEIGHT     from 614
     112             :     { SID_ATTR_CHAR_CTL_WEIGHT,     SfxItemPoolFlags::POOLABLE },    // ATTR_CTL_FONT_WEIGHT     from 614
     113             :     { SID_ATTR_CHAR_CTL_POSTURE,    SfxItemPoolFlags::POOLABLE },    // ATTR_CTL_FONT_POSTURE    from 614
     114             :     { SID_ATTR_CHAR_CTL_LANGUAGE,   SfxItemPoolFlags::POOLABLE },    // ATTR_CTL_FONT_LANGUAGE   from 614
     115             :     { SID_ATTR_CHAR_EMPHASISMARK,   SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_EMPHASISMARK   from 614
     116             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_USERDEF             from 614 / 641c
     117             :     { SID_ATTR_CHAR_WORDLINEMODE,   SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_WORDLINE       from 632b
     118             :     { SID_ATTR_CHAR_RELIEF,         SfxItemPoolFlags::POOLABLE },    // ATTR_FONT_RELIEF         from 632b
     119             :     { SID_ATTR_ALIGN_HYPHENATION,   SfxItemPoolFlags::POOLABLE },    // ATTR_HYPHENATE           from 632b
     120             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_SCRIPTSPACE         from 614d
     121             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_HANGPUNCTUATION     from 614d
     122             :     { SID_ATTR_PARA_FORBIDDEN_RULES,SfxItemPoolFlags::POOLABLE },    // ATTR_FORBIDDEN_RULES     from 614d
     123             :     { SID_ATTR_ALIGN_HOR_JUSTIFY,   SfxItemPoolFlags::POOLABLE },    // ATTR_HOR_JUSTIFY
     124             :     { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SfxItemPoolFlags::POOLABLE }, // ATTR_HOR_JUSTIFY_METHOD
     125             :     { SID_ATTR_ALIGN_INDENT,        SfxItemPoolFlags::POOLABLE },    // ATTR_INDENT          from 350
     126             :     { SID_ATTR_ALIGN_VER_JUSTIFY,   SfxItemPoolFlags::POOLABLE },    // ATTR_VER_JUSTIFY
     127             :     { SID_ATTR_ALIGN_VER_JUSTIFY_METHOD, SfxItemPoolFlags::POOLABLE }, // ATTR_VER_JUSTIFY_METHOD
     128             :     { SID_ATTR_ALIGN_STACKED,       SfxItemPoolFlags::POOLABLE },    // ATTR_STACKED         from 680/dr14 (replaces ATTR_ORIENTATION)
     129             :     { SID_ATTR_ALIGN_DEGREES,       SfxItemPoolFlags::POOLABLE },    // ATTR_ROTATE_VALUE    from 367
     130             :     { SID_ATTR_ALIGN_LOCKPOS,       SfxItemPoolFlags::POOLABLE },    // ATTR_ROTATE_MODE     from 367
     131             :     { SID_ATTR_ALIGN_ASIANVERTICAL, SfxItemPoolFlags::POOLABLE },    // ATTR_VERTICAL_ASIAN  from 642
     132             :     { SID_ATTR_FRAMEDIRECTION,      SfxItemPoolFlags::POOLABLE },    // ATTR_WRITINGDIR      from 643
     133             :     { SID_ATTR_ALIGN_LINEBREAK,     SfxItemPoolFlags::POOLABLE },    // ATTR_LINEBREAK
     134             :     { SID_ATTR_ALIGN_SHRINKTOFIT,   SfxItemPoolFlags::POOLABLE },    // ATTR_SHRINKTOFIT     from 680/dr14
     135             :     { SID_ATTR_BORDER_DIAG_TLBR,    SfxItemPoolFlags::POOLABLE },    // ATTR_BORDER_TLBR     from 680/dr14
     136             :     { SID_ATTR_BORDER_DIAG_BLTR,    SfxItemPoolFlags::POOLABLE },    // ATTR_BORDER_BLTR     from 680/dr14
     137             :     { SID_ATTR_ALIGN_MARGIN,        SfxItemPoolFlags::POOLABLE },    // ATTR_MARGIN
     138             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_MERGE
     139             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_MERGE_FLAG
     140             :     { SID_ATTR_NUMBERFORMAT_VALUE,  SfxItemPoolFlags::POOLABLE },    // ATTR_VALUE_FORMAT
     141             :     { ATTR_LANGUAGE_FORMAT,         SfxItemPoolFlags::POOLABLE },    // ATTR_LANGUAGE_FORMAT from 329, is combined with SID_ATTR_NUMBERFORMAT_VALUE in the dialog
     142             :     { SID_ATTR_BRUSH,               SfxItemPoolFlags::POOLABLE },    // ATTR_BACKGROUND
     143             :     { SID_SCATTR_PROTECTION,        SfxItemPoolFlags::POOLABLE },    // ATTR_PROTECTION
     144             :     { SID_ATTR_BORDER_OUTER,        SfxItemPoolFlags::POOLABLE },    // ATTR_BORDER
     145             :     { SID_ATTR_BORDER_INNER,        SfxItemPoolFlags::POOLABLE },    // ATTR_BORDER_INNER
     146             :     { SID_ATTR_BORDER_SHADOW,       SfxItemPoolFlags::POOLABLE },    // ATTR_SHADOW
     147             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_VALIDDATA
     148             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_CONDITIONAL
     149             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_HYPERLINK
     150             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_PATTERN
     151             :     { SID_ATTR_LRSPACE,             SfxItemPoolFlags::POOLABLE },    // ATTR_LRSPACE
     152             :     { SID_ATTR_ULSPACE,             SfxItemPoolFlags::POOLABLE },    // ATTR_ULSPACE
     153             :     { SID_ATTR_PAGE,                SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE
     154             :     { 0,                            SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_PAPERTRAY, since 303 just a dummy
     155             :     { SID_ATTR_PAGE_PAPERBIN,       SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_PAPERBIN
     156             :     { SID_ATTR_PAGE_SIZE,           SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_SIZE
     157             :     { SID_ATTR_PAGE_MAXSIZE,        SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_MAXSIZE
     158             :     { SID_ATTR_PAGE_EXT1,           SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_HORCENTER
     159             :     { SID_ATTR_PAGE_EXT2,           SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_VERCENTER
     160             :     { SID_ATTR_PAGE_ON,             SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_ON
     161             :     { SID_ATTR_PAGE_DYNAMIC,        SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_DYNAMIC
     162             :     { SID_ATTR_PAGE_SHARED,         SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_SHARED
     163             :     { SID_SCATTR_PAGE_NOTES,        SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_NOTES
     164             :     { SID_SCATTR_PAGE_GRID,         SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_GRID
     165             :     { SID_SCATTR_PAGE_HEADERS,      SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_HEADERS
     166             :     { SID_SCATTR_PAGE_CHARTS,       SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_CHARTS
     167             :     { SID_SCATTR_PAGE_OBJECTS,      SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_OBJECTS
     168             :     { SID_SCATTR_PAGE_DRAWINGS,     SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_DRAWINGS
     169             :     { SID_SCATTR_PAGE_TOPDOWN,      SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_TOPDOWN
     170             :     { SID_SCATTR_PAGE_SCALE,        SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_SCALE
     171             :     { SID_SCATTR_PAGE_SCALETOPAGES, SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_SCALETOPAGES
     172             :     { SID_SCATTR_PAGE_FIRSTPAGENO,  SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_FIRSTPAGENO
     173             :     { SID_SCATTR_PAGE_PRINTAREA,    SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_PRINTAREA
     174             :     { SID_SCATTR_PAGE_REPEATROW,    SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_REPEATROW
     175             :     { SID_SCATTR_PAGE_REPEATCOL,    SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_REPEATCOL
     176             :     { SID_SCATTR_PAGE_PRINTTABLES,  SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_PRINTTABLES
     177             :     { SID_SCATTR_PAGE_HEADERLEFT,   SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_HEADERLEFT
     178             :     { SID_SCATTR_PAGE_FOOTERLEFT,   SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_FOOTERLEFT
     179             :     { SID_SCATTR_PAGE_HEADERRIGHT,  SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_HEADERRIGHT
     180             :     { SID_SCATTR_PAGE_FOOTERRIGHT,  SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_FOOTERRIGHT
     181             :     { SID_ATTR_PAGE_HEADERSET,      SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_HEADERSET
     182             :     { SID_ATTR_PAGE_FOOTERSET,      SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_FOOTERSET
     183             :     { SID_SCATTR_PAGE_FORMULAS,     SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_FORMULAS
     184             :     { SID_SCATTR_PAGE_NULLVALS,     SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_NULLVALS
     185             :     { SID_SCATTR_PAGE_SCALETO,      SfxItemPoolFlags::POOLABLE },    // ATTR_PAGE_SCALETO
     186             :     { 0,                            SfxItemPoolFlags::POOLABLE }     // ATTR_HIDDEN
     187             : };
     188             : static_assert(
     189             :     SAL_N_ELEMENTS(aItemInfos) == ATTR_ENDINDEX - ATTR_STARTINDEX + 1, "these must match");
     190             : 
     191        1378 : ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool)
     192             : 
     193             :     :   SfxItemPool ( OUString("ScDocumentPool"),
     194             :                         ATTR_STARTINDEX, ATTR_ENDINDEX,
     195             :                         aItemInfos, NULL, false/*bLoadRefCounts*/ ),
     196        1378 :         pSecondary  ( pSecPool )
     197             : {
     198             :     //  latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead
     199             :     vcl::Font aStdFont = OutputDevice::GetDefaultFont( DefaultFontType::LATIN_SPREADSHEET, LANGUAGE_ENGLISH_US,
     200        1378 :                                                     GetDefaultFontFlags::OnlyOne );
     201             :     SvxFontItem* pStdFont = new SvxFontItem( aStdFont.GetFamily(),
     202             :                                             aStdFont.GetName(), aStdFont.GetStyleName(),
     203        1378 :                                             aStdFont.GetPitch(), aStdFont.GetCharSet(),
     204        2756 :                                             ATTR_FONT );
     205             : 
     206        1378 :     SvxFontItem* pCjkFont = new SvxFontItem( ATTR_CJK_FONT );
     207        1378 :     SvxFontItem* pCtlFont = new SvxFontItem( ATTR_CTL_FONT );
     208        2756 :     SvxFontItem aDummy( ATTR_FONT );
     209        1378 :     GetDefaultFonts( aDummy, *pCjkFont, *pCtlFont );
     210             : 
     211        1378 :     SvxBoxInfoItem* pGlobalBorderInnerAttr = new SvxBoxInfoItem( ATTR_BORDER_INNER );
     212        1378 :     SfxItemSet*     pSet = new SfxItemSet( *this, ATTR_PATTERN_START, ATTR_PATTERN_END );
     213             :     SfxItemSet      aSetItemItemSet( *this,
     214             :                                      ATTR_BACKGROUND, ATTR_BACKGROUND,
     215             :                                      ATTR_BORDER,     ATTR_SHADOW,
     216             :                                      ATTR_LRSPACE,    ATTR_ULSPACE,
     217             :                                      ATTR_PAGE_SIZE,  ATTR_PAGE_SIZE,
     218             :                                      ATTR_PAGE_ON,    ATTR_PAGE_SHARED,
     219        2756 :                                      0 );
     220             : 
     221        1378 :     pGlobalBorderInnerAttr->SetLine(NULL, SvxBoxInfoItemLine::HORI);
     222        1378 :     pGlobalBorderInnerAttr->SetLine(NULL, SvxBoxInfoItemLine::VERT);
     223        1378 :     pGlobalBorderInnerAttr->SetTable(true);
     224        1378 :     pGlobalBorderInnerAttr->SetDist(true);
     225        1378 :     pGlobalBorderInnerAttr->SetMinDist(false);
     226             : 
     227        1378 :     ppPoolDefaults = new SfxPoolItem*[ATTR_ENDINDEX-ATTR_STARTINDEX+1];
     228             : 
     229        1378 :     ppPoolDefaults[ ATTR_FONT            - ATTR_STARTINDEX ] = pStdFont;
     230        1378 :     ppPoolDefaults[ ATTR_FONT_HEIGHT     - ATTR_STARTINDEX ] = new SvxFontHeightItem( 200, 100, ATTR_FONT_HEIGHT );       // 10 pt;
     231        1378 :     ppPoolDefaults[ ATTR_FONT_WEIGHT     - ATTR_STARTINDEX ] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_FONT_WEIGHT );
     232        1378 :     ppPoolDefaults[ ATTR_FONT_POSTURE    - ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_FONT_POSTURE );
     233        1378 :     ppPoolDefaults[ ATTR_FONT_UNDERLINE  - ATTR_STARTINDEX ] = new SvxUnderlineItem( UNDERLINE_NONE, ATTR_FONT_UNDERLINE );
     234        1378 :     ppPoolDefaults[ ATTR_FONT_OVERLINE   - ATTR_STARTINDEX ] = new SvxOverlineItem( UNDERLINE_NONE, ATTR_FONT_OVERLINE );
     235        1378 :     ppPoolDefaults[ ATTR_FONT_CROSSEDOUT - ATTR_STARTINDEX ] = new SvxCrossedOutItem( STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT );
     236        1378 :     ppPoolDefaults[ ATTR_FONT_CONTOUR    - ATTR_STARTINDEX ] = new SvxContourItem( false, ATTR_FONT_CONTOUR );
     237        1378 :     ppPoolDefaults[ ATTR_FONT_SHADOWED   - ATTR_STARTINDEX ] = new SvxShadowedItem( false, ATTR_FONT_SHADOWED );
     238        1378 :     ppPoolDefaults[ ATTR_FONT_COLOR      - ATTR_STARTINDEX ] = new SvxColorItem( Color(COL_AUTO), ATTR_FONT_COLOR );
     239        1378 :     ppPoolDefaults[ ATTR_FONT_LANGUAGE   - ATTR_STARTINDEX ] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW), ATTR_FONT_LANGUAGE );
     240        1378 :     ppPoolDefaults[ ATTR_CJK_FONT        - ATTR_STARTINDEX ] = pCjkFont;
     241        1378 :     ppPoolDefaults[ ATTR_CJK_FONT_HEIGHT - ATTR_STARTINDEX ] = new SvxFontHeightItem( 200, 100, ATTR_CJK_FONT_HEIGHT );
     242        1378 :     ppPoolDefaults[ ATTR_CJK_FONT_WEIGHT - ATTR_STARTINDEX ] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT );
     243        1378 :     ppPoolDefaults[ ATTR_CJK_FONT_POSTURE- ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_CJK_FONT_POSTURE );
     244        1378 :     ppPoolDefaults[ ATTR_CJK_FONT_LANGUAGE-ATTR_STARTINDEX ] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW),
     245        2756 :                                                                     ATTR_CJK_FONT_LANGUAGE );
     246        1378 :     ppPoolDefaults[ ATTR_CTL_FONT        - ATTR_STARTINDEX ] = pCtlFont;
     247        1378 :     ppPoolDefaults[ ATTR_CTL_FONT_HEIGHT - ATTR_STARTINDEX ] = new SvxFontHeightItem( 200, 100, ATTR_CTL_FONT_HEIGHT );
     248        1378 :     ppPoolDefaults[ ATTR_CTL_FONT_WEIGHT - ATTR_STARTINDEX ] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT );
     249        1378 :     ppPoolDefaults[ ATTR_CTL_FONT_POSTURE- ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_CTL_FONT_POSTURE );
     250        1378 :     ppPoolDefaults[ ATTR_CTL_FONT_LANGUAGE-ATTR_STARTINDEX ] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW),
     251        2756 :                                                                     ATTR_CTL_FONT_LANGUAGE );
     252        1378 :     ppPoolDefaults[ ATTR_FONT_EMPHASISMARK-ATTR_STARTINDEX ] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, ATTR_FONT_EMPHASISMARK );
     253        1378 :     ppPoolDefaults[ ATTR_USERDEF         - ATTR_STARTINDEX ] = new SvXMLAttrContainerItem( ATTR_USERDEF );
     254        1378 :     ppPoolDefaults[ ATTR_FONT_WORDLINE   - ATTR_STARTINDEX ] = new SvxWordLineModeItem(false, ATTR_FONT_WORDLINE );
     255        1378 :     ppPoolDefaults[ ATTR_FONT_RELIEF     - ATTR_STARTINDEX ] = new SvxCharReliefItem( RELIEF_NONE, ATTR_FONT_RELIEF );
     256        1378 :     ppPoolDefaults[ ATTR_HYPHENATE       - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_HYPHENATE );
     257        1378 :     ppPoolDefaults[ ATTR_SCRIPTSPACE     - ATTR_STARTINDEX ] = new SvxScriptSpaceItem( false, ATTR_SCRIPTSPACE);
     258        1378 :     ppPoolDefaults[ ATTR_HANGPUNCTUATION - ATTR_STARTINDEX ] = new SvxHangingPunctuationItem( false, ATTR_HANGPUNCTUATION);
     259        1378 :     ppPoolDefaults[ ATTR_FORBIDDEN_RULES - ATTR_STARTINDEX ] = new SvxForbiddenRuleItem( false, ATTR_FORBIDDEN_RULES);
     260        1378 :     ppPoolDefaults[ ATTR_HOR_JUSTIFY     - ATTR_STARTINDEX ] = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY);
     261        1378 :     ppPoolDefaults[ ATTR_HOR_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, ATTR_HOR_JUSTIFY_METHOD);
     262        1378 :     ppPoolDefaults[ ATTR_INDENT          - ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_INDENT, 0 );
     263        1378 :     ppPoolDefaults[ ATTR_VER_JUSTIFY     - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, ATTR_VER_JUSTIFY);
     264        1378 :     ppPoolDefaults[ ATTR_VER_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, ATTR_VER_JUSTIFY_METHOD);
     265        1378 :     ppPoolDefaults[ ATTR_STACKED         - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_STACKED, false );
     266        1378 :     ppPoolDefaults[ ATTR_ROTATE_VALUE    - ATTR_STARTINDEX ] = new SfxInt32Item( ATTR_ROTATE_VALUE, 0 );
     267        1378 :     ppPoolDefaults[ ATTR_ROTATE_MODE     - ATTR_STARTINDEX ] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE );
     268        1378 :     ppPoolDefaults[ ATTR_VERTICAL_ASIAN  - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_VERTICAL_ASIAN );
     269             :     //  The default for the ATTR_WRITINGDIR cell attribute must by FRMDIR_ENVIRONMENT,
     270             :     //  so that value is returned when asking for a default cell's attributes.
     271             :     //  The value from the page style is set as DefaultHorizontalTextDirection for the EditEngine.
     272        1378 :     ppPoolDefaults[ ATTR_WRITINGDIR      - ATTR_STARTINDEX ] = new SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, ATTR_WRITINGDIR );
     273        1378 :     ppPoolDefaults[ ATTR_LINEBREAK       - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_LINEBREAK );
     274        1378 :     ppPoolDefaults[ ATTR_SHRINKTOFIT     - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_SHRINKTOFIT );
     275        1378 :     ppPoolDefaults[ ATTR_BORDER_TLBR     - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_TLBR );
     276        1378 :     ppPoolDefaults[ ATTR_BORDER_BLTR     - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_BLTR );
     277        1378 :     ppPoolDefaults[ ATTR_MARGIN          - ATTR_STARTINDEX ] = new SvxMarginItem( ATTR_MARGIN );
     278        1378 :     ppPoolDefaults[ ATTR_MERGE           - ATTR_STARTINDEX ] = new ScMergeAttr;
     279        1378 :     ppPoolDefaults[ ATTR_MERGE_FLAG      - ATTR_STARTINDEX ] = new ScMergeFlagAttr;
     280        1378 :     ppPoolDefaults[ ATTR_VALUE_FORMAT    - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALUE_FORMAT, 0 );
     281        1378 :     ppPoolDefaults[ ATTR_LANGUAGE_FORMAT - ATTR_STARTINDEX ] = new SvxLanguageItem( ScGlobal::eLnge, ATTR_LANGUAGE_FORMAT );
     282        1378 :     ppPoolDefaults[ ATTR_BACKGROUND      - ATTR_STARTINDEX ] = new SvxBrushItem( Color(COL_TRANSPARENT), ATTR_BACKGROUND );
     283        1378 :     ppPoolDefaults[ ATTR_PROTECTION      - ATTR_STARTINDEX ] = new ScProtectionAttr;
     284        1378 :     ppPoolDefaults[ ATTR_BORDER          - ATTR_STARTINDEX ] = new SvxBoxItem( ATTR_BORDER );
     285        1378 :     ppPoolDefaults[ ATTR_BORDER_INNER    - ATTR_STARTINDEX ] = pGlobalBorderInnerAttr;
     286        1378 :     ppPoolDefaults[ ATTR_SHADOW          - ATTR_STARTINDEX ] = new SvxShadowItem( ATTR_SHADOW );
     287        1378 :     ppPoolDefaults[ ATTR_VALIDDATA       - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALIDDATA, 0 );
     288        1378 :     ppPoolDefaults[ ATTR_CONDITIONAL     - ATTR_STARTINDEX ] = new ScCondFormatItem;
     289        1378 :     ppPoolDefaults[ ATTR_HYPERLINK       - ATTR_STARTINDEX ] = new SfxStringItem( ATTR_HYPERLINK, OUString() ) ;
     290             : 
     291             :     // GetRscString only works after ScGlobal::Init (indicated by the EmptyBrushItem)
     292             :     // TODO: Write additional method ScGlobal::IsInit() or somesuch
     293             :     //       or detect whether this is the Secondary Pool for a MessagePool
     294        1378 :     if ( ScGlobal::GetEmptyBrushItem() )
     295        1326 :         ppPoolDefaults[ ATTR_PATTERN     - ATTR_STARTINDEX ] = new ScPatternAttr( pSet, ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
     296             :     else
     297          52 :         ppPoolDefaults[ ATTR_PATTERN     - ATTR_STARTINDEX ] = new ScPatternAttr( pSet,
     298         104 :             OUString(STRING_STANDARD) ); // FIXME: without name?
     299             : 
     300        1378 :     ppPoolDefaults[ ATTR_LRSPACE         - ATTR_STARTINDEX ] = new SvxLRSpaceItem( ATTR_LRSPACE );
     301        1378 :     ppPoolDefaults[ ATTR_ULSPACE         - ATTR_STARTINDEX ] = new SvxULSpaceItem( ATTR_ULSPACE );
     302        1378 :     ppPoolDefaults[ ATTR_PAGE            - ATTR_STARTINDEX ] = new SvxPageItem( ATTR_PAGE );
     303        1378 :     ppPoolDefaults[ ATTR_PAGE_PAPERTRAY  - ATTR_STARTINDEX ] = new SfxAllEnumItem( ATTR_PAGE_PAPERTRAY );
     304        1378 :     ppPoolDefaults[ ATTR_PAGE_PAPERBIN   - ATTR_STARTINDEX ] = new SvxPaperBinItem( ATTR_PAGE_PAPERBIN );
     305        1378 :     ppPoolDefaults[ ATTR_PAGE_SIZE       - ATTR_STARTINDEX ] = new SvxSizeItem( ATTR_PAGE_SIZE );
     306        1378 :     ppPoolDefaults[ ATTR_PAGE_MAXSIZE    - ATTR_STARTINDEX ] = new SvxSizeItem( ATTR_PAGE_MAXSIZE );
     307        1378 :     ppPoolDefaults[ ATTR_PAGE_HORCENTER  - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_HORCENTER );
     308        1378 :     ppPoolDefaults[ ATTR_PAGE_VERCENTER  - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_VERCENTER );
     309        1378 :     ppPoolDefaults[ ATTR_PAGE_ON         - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_ON, true );
     310        1378 :     ppPoolDefaults[ ATTR_PAGE_DYNAMIC    - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_DYNAMIC, true );
     311        1378 :     ppPoolDefaults[ ATTR_PAGE_SHARED     - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_SHARED, true );
     312        1378 :     ppPoolDefaults[ ATTR_PAGE_NOTES      - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_NOTES, false );
     313        1378 :     ppPoolDefaults[ ATTR_PAGE_GRID       - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_GRID, false );
     314        1378 :     ppPoolDefaults[ ATTR_PAGE_HEADERS    - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_HEADERS, false );
     315        1378 :     ppPoolDefaults[ ATTR_PAGE_CHARTS     - ATTR_STARTINDEX ] = new ScViewObjectModeItem( ATTR_PAGE_CHARTS );
     316        1378 :     ppPoolDefaults[ ATTR_PAGE_OBJECTS    - ATTR_STARTINDEX ] = new ScViewObjectModeItem( ATTR_PAGE_OBJECTS );
     317        1378 :     ppPoolDefaults[ ATTR_PAGE_DRAWINGS   - ATTR_STARTINDEX ] = new ScViewObjectModeItem( ATTR_PAGE_DRAWINGS );
     318        1378 :     ppPoolDefaults[ ATTR_PAGE_TOPDOWN    - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_TOPDOWN, true );
     319        1378 :     ppPoolDefaults[ ATTR_PAGE_SCALE      - ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_PAGE_SCALE, 100 );
     320        1378 :     ppPoolDefaults[ ATTR_PAGE_SCALETOPAGES-ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_PAGE_SCALETOPAGES, 1 );
     321        1378 :     ppPoolDefaults[ ATTR_PAGE_FIRSTPAGENO- ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, 1 );
     322        1378 :     ppPoolDefaults[ ATTR_PAGE_PRINTAREA  - ATTR_STARTINDEX ] = new ScRangeItem( ATTR_PAGE_PRINTAREA );
     323        1378 :     ppPoolDefaults[ ATTR_PAGE_REPEATROW  - ATTR_STARTINDEX ] = new ScRangeItem( ATTR_PAGE_REPEATROW );
     324        1378 :     ppPoolDefaults[ ATTR_PAGE_REPEATCOL  - ATTR_STARTINDEX ] = new ScRangeItem( ATTR_PAGE_REPEATCOL );
     325        1378 :     ppPoolDefaults[ ATTR_PAGE_PRINTTABLES- ATTR_STARTINDEX ] = new ScTableListItem( ATTR_PAGE_PRINTTABLES );
     326        1378 :     ppPoolDefaults[ ATTR_PAGE_HEADERLEFT - ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_HEADERLEFT );
     327        1378 :     ppPoolDefaults[ ATTR_PAGE_FOOTERLEFT - ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_FOOTERLEFT );
     328        1378 :     ppPoolDefaults[ ATTR_PAGE_HEADERRIGHT- ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_HEADERRIGHT );
     329        1378 :     ppPoolDefaults[ ATTR_PAGE_FOOTERRIGHT- ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT );
     330        1378 :     ppPoolDefaults[ ATTR_PAGE_HEADERSET  - ATTR_STARTINDEX ] = new SvxSetItem( ATTR_PAGE_HEADERSET, aSetItemItemSet );
     331        1378 :     ppPoolDefaults[ ATTR_PAGE_FOOTERSET  - ATTR_STARTINDEX ] = new SvxSetItem( ATTR_PAGE_FOOTERSET, aSetItemItemSet );
     332        1378 :     ppPoolDefaults[ ATTR_PAGE_FORMULAS   - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_FORMULAS, false );
     333        1378 :     ppPoolDefaults[ ATTR_PAGE_NULLVALS   - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_NULLVALS, true );
     334        1378 :     ppPoolDefaults[ ATTR_PAGE_SCALETO    - ATTR_STARTINDEX ] = new ScPageScaleToItem( 1, 1 );
     335        1378 :     ppPoolDefaults[ ATTR_HIDDEN          - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_HIDDEN, false );
     336             : 
     337        1378 :     SetDefaults( ppPoolDefaults );
     338             : 
     339        1378 :     if ( pSecondary )
     340           0 :         SetSecondaryPool( pSecondary );
     341             : 
     342             :     // ATTR_LANGUAGE_FORMAT from sv329 inserted, VersionMap in _ScGlobal__Init
     343        1378 :     SetVersionMap( 1, 100, 157, pVersionMap1 );
     344             : 
     345             :     // ATTR_VALIDDATA, ATTR_CONDITIONAL from 341
     346        1378 :     SetVersionMap( 2, 100, 158, pVersionMap2 );
     347             : 
     348             :     // ATTR_INDENT from 350
     349        1378 :     SetVersionMap( 3, 100, 160, pVersionMap3 );
     350             : 
     351             :     // ATTR_ROTATE_VALUE, ATTR_ROTATE_MODE from 367
     352        1378 :     SetVersionMap( 4, 100, 161, pVersionMap4 );
     353             : 
     354             :     // CJK, CTL, EMPHASISMARK, TWOLINES from 614
     355        1378 :     SetVersionMap( 5, 100, 163, pVersionMap5 );
     356             : 
     357             :     // ATTR_SCRIPTSPACE, ATTR_HANGPUNCTUATION, ATTR_FORBIDDEN_RULES from 614d
     358        1378 :     SetVersionMap( 6, 100, 175, pVersionMap6 );
     359             : 
     360             :     // ATTR_FONT_WORDLINE, ATTR_FONT_RELIEF, ATTR_HYPHENATE from 632b
     361        1378 :     SetVersionMap( 7, 100, 178, pVersionMap7 );
     362             : 
     363             :     // ATTR_VERTICAL_ASIAN from 642q
     364        1378 :     SetVersionMap( 8, 100, 181, pVersionMap8 );
     365             : 
     366             :     // ATTR_WRITINGDIR from 643y
     367        1378 :     SetVersionMap( 9, 100, 182, pVersionMap9 );
     368             : 
     369             :     // ATTR_PAGE_SCALETO added in 680/sab008
     370             :     // new version map not required
     371             : 
     372             :     // ATTR_SHRINKTOFIT, ATTR_BORDER_TL_BR, ATTR_BORDER_BL_TR added in 680/dr14
     373        1378 :     SetVersionMap( 10, 100, 184, pVersionMap10 );
     374             : 
     375             :     // ATTR_FONT_OVERLINE added in DEV300/overline2
     376        1378 :     SetVersionMap( 11, 100, 187, pVersionMap11 );
     377             :     // ATTR_HYERLINK added
     378        2756 :     SetVersionMap( 12, 100, 192, pVersionMap12 );
     379        1378 : }
     380             : 
     381        3927 : ScDocumentPool::~ScDocumentPool()
     382             : {
     383        1309 :     Delete();
     384             : 
     385      123046 :     for ( sal_uInt16 i=0; i < ATTR_ENDINDEX-ATTR_STARTINDEX+1; i++ )
     386             :     {
     387      121737 :         SetRefCount( *ppPoolDefaults[i], 0 );
     388      121737 :         delete ppPoolDefaults[i];
     389             :     }
     390             : 
     391        1309 :     delete[] ppPoolDefaults;
     392        1309 :     SfxItemPool::Free(pSecondary);
     393        2618 : }
     394             : 
     395          52 : void ScDocumentPool::InitVersionMaps()
     396             : {
     397             :     OSL_PRECOND( !pVersionMap1 && !pVersionMap2 &&
     398             :                 !pVersionMap3 && !pVersionMap4 &&
     399             :                 !pVersionMap5 && !pVersionMap6 &&
     400             :                 !pVersionMap7 && !pVersionMap8 &&
     401             :                 !pVersionMap9 && !pVersionMap10 &&
     402             :                 !pVersionMap11 && !pVersionMap12 , "InitVersionMaps call multiple times" );
     403             : 
     404             :     // Map old WhichId's
     405             :     // Do not count with ATTR_*, if they change again
     406             : 
     407             :     // First Map: ATTR_LANGUAGE_FORMAT from sv329 inserted
     408             : 
     409          52 :     const sal_uInt16 nMap1Start = 100;  // Old ATTR_STARTINDEX
     410          52 :     const sal_uInt16 nMap1End   = 157;  // Old ATTR_ENDINDEX
     411          52 :     const sal_uInt16 nMap1Count = nMap1End - nMap1Start + 1;
     412          52 :     const sal_uInt16 nMap1New   = 18;   // ATTR_LANGUAGE_FORMAT - ATTR_STARTINDEX
     413          52 :     pVersionMap1 = new sal_uInt16 [ nMap1Count ];
     414             :     sal_uInt16 i, j;
     415         988 :     for ( i=0, j=nMap1Start; i < nMap1New; i++, j++ )
     416         936 :         pVersionMap1[i] = j;
     417             :     // An entry inserted ...
     418        2132 :     for ( i=nMap1New, j=nMap1Start+nMap1New+1; i < nMap1Count; i++, j++ )
     419        2080 :         pVersionMap1[i] = j;
     420             : 
     421             :     // Second Map: ATTR_VALIDDATA and ATTR_CONDITIONAL from 341 inserted
     422             : 
     423          52 :     const sal_uInt16 nMap2Start = 100;  // ATTR_STARTINDEX
     424          52 :     const sal_uInt16 nMap2End   = 158;  // ATTR_ENDINDEX
     425          52 :     const sal_uInt16 nMap2Count = nMap2End - nMap2Start + 1;
     426          52 :     const sal_uInt16 nMap2New   = 24;   // ATTR_VALIDDATA - ATTR_STARTINDEX
     427          52 :     pVersionMap2 = new sal_uInt16 [ nMap2Count ];
     428        1300 :     for ( i=0, j=nMap2Start; i < nMap2New; i++, j++ )
     429        1248 :         pVersionMap2[i] = j;
     430             :     // Two entries inserted ...
     431        1872 :     for ( i=nMap2New, j=nMap2Start+nMap2New+2; i < nMap2Count; i++, j++ )
     432        1820 :         pVersionMap2[i] = j;
     433             : 
     434             :     // Third Map: ATTR_INDENT from 350 inserted
     435             : 
     436          52 :     const sal_uInt16 nMap3Start = 100;  // ATTR_STARTINDEX
     437          52 :     const sal_uInt16 nMap3End   = 160;  // ATTR_ENDINDEX
     438          52 :     const sal_uInt16 nMap3Count = nMap3End - nMap3Start + 1;
     439          52 :     const sal_uInt16 nMap3New   = 11;   // ATTR_INDENT - ATTR_STARTINDEX
     440          52 :     pVersionMap3 = new sal_uInt16 [ nMap3Count ];
     441         624 :     for ( i=0, j=nMap3Start; i < nMap3New; i++, j++ )
     442         572 :         pVersionMap3[i] = j;
     443             :     // An entry insterted ...
     444        2652 :     for ( i=nMap3New, j=nMap3Start+nMap3New+1; i < nMap3Count; i++, j++ )
     445        2600 :         pVersionMap3[i] = j;
     446             : 
     447             :     // Fourth Map: ATTR_ROTATE_VALUE and ATTR_ROTATE_MODE from 367 inserted
     448             : 
     449          52 :     const sal_uInt16 nMap4Start = 100;  // ATTR_STARTINDEX
     450          52 :     const sal_uInt16 nMap4End   = 161;  // ATTR_ENDINDEX
     451          52 :     const sal_uInt16 nMap4Count = nMap4End - nMap4Start + 1;
     452          52 :     const sal_uInt16 nMap4New   = 14;   // ATTR_ROTATE_VALUE - ATTR_STARTINDEX
     453          52 :     pVersionMap4 = new sal_uInt16 [ nMap4Count ];
     454         780 :     for ( i=0, j=nMap4Start; i < nMap4New; i++, j++ )
     455         728 :         pVersionMap4[i] = j;
     456             :     // Two entries inserted ...
     457        2548 :     for ( i=nMap4New, j=nMap4Start+nMap4New+2; i < nMap4Count; i++, j++ )
     458        2496 :         pVersionMap4[i] = j;
     459             : 
     460             :     // fifth map: CJK..., CTL..., EMPHASISMARK, TWOLINES (12 items) added in 614
     461             : 
     462          52 :     const sal_uInt16 nMap5Start = 100;  // ATTR_STARTINDEX
     463          52 :     const sal_uInt16 nMap5End   = 163;  // ATTR_ENDINDEX
     464          52 :     const sal_uInt16 nMap5Count = nMap5End - nMap5Start + 1;
     465          52 :     const sal_uInt16 nMap5New   = 10;   // ATTR_CJK_FONT - ATTR_STARTINDEX
     466          52 :     pVersionMap5 = new sal_uInt16 [ nMap5Count ];
     467         572 :     for ( i=0, j=nMap5Start; i < nMap5New; i++, j++ )
     468         520 :         pVersionMap5[i] = j;
     469             :     // 12 entries inserted
     470        2860 :     for ( i=nMap5New, j=nMap5Start+nMap5New+12; i < nMap5Count; i++, j++ )
     471        2808 :         pVersionMap5[i] = j;
     472             : 
     473             :     // sixth map: ATTR_SCRIPTSPACE, ATTR_HANGPUNCTUATION, ATTR_FORBIDDEN_RULES added in 614d
     474             : 
     475          52 :     const sal_uInt16 nMap6Start = 100;  // ATTR_STARTINDEX
     476          52 :     const sal_uInt16 nMap6End   = 175;  // ATTR_ENDINDEX
     477          52 :     const sal_uInt16 nMap6Count = nMap6End - nMap6Start + 1;
     478          52 :     const sal_uInt16 nMap6New   = 22;   // ATTR_SCRIPTSPACE - ATTR_STARTINDEX
     479          52 :     pVersionMap6 = new sal_uInt16 [ nMap6Count ];
     480        1196 :     for ( i=0, j=nMap6Start; i < nMap6New; i++, j++ )
     481        1144 :         pVersionMap6[i] = j;
     482             :     // 3 entries inserted
     483        2860 :     for ( i=nMap6New, j=nMap6Start+nMap6New+3; i < nMap6Count; i++, j++ )
     484        2808 :         pVersionMap6[i] = j;
     485             : 
     486             :     // seventh map: ATTR_FONT_WORDLINE, ATTR_FONT_RELIEF, ATTR_HYPHENATE added in 632b
     487             : 
     488          52 :     const sal_uInt16 nMap7Start = 100;  // ATTR_STARTINDEX
     489          52 :     const sal_uInt16 nMap7End   = 178;  // ATTR_ENDINDEX
     490          52 :     const sal_uInt16 nMap7Count = nMap7End - nMap7Start + 1;
     491          52 :     const sal_uInt16 nMap7New   = 22;   // ATTR_FONT_WORDLINE - ATTR_STARTINDEX
     492          52 :     pVersionMap7 = new sal_uInt16 [ nMap7Count ];
     493        1196 :     for ( i=0, j=nMap7Start; i < nMap7New; i++, j++ )
     494        1144 :         pVersionMap7[i] = j;
     495             :     // 3 entries inserted
     496        3016 :     for ( i=nMap7New, j=nMap7Start+nMap7New+3; i < nMap7Count; i++, j++ )
     497        2964 :         pVersionMap7[i] = j;
     498             : 
     499             :     // eighth map: ATTR_VERTICAL_ASIAN added in 642q
     500             : 
     501          52 :     const sal_uInt16 nMap8Start = 100;  // ATTR_STARTINDEX
     502          52 :     const sal_uInt16 nMap8End   = 181;  // ATTR_ENDINDEX
     503          52 :     const sal_uInt16 nMap8Count = nMap8End - nMap8Start + 1;
     504          52 :     const sal_uInt16 nMap8New   = 34;   // ATTR_VERTICAL_ASIAN - ATTR_STARTINDEX
     505          52 :     pVersionMap8 = new sal_uInt16 [ nMap8Count ];
     506        1820 :     for ( i=0, j=nMap8Start; i < nMap8New; i++, j++ )
     507        1768 :         pVersionMap8[i] = j;
     508             :     // 1 entry inserted
     509        2548 :     for ( i=nMap8New, j=nMap8Start+nMap8New+1; i < nMap8Count; i++, j++ )
     510        2496 :         pVersionMap8[i] = j;
     511             : 
     512             :     // 9th map: ATTR_WRITINGDIR added in 643y
     513             : 
     514          52 :     const sal_uInt16 nMap9Start = 100;  // ATTR_STARTINDEX
     515          52 :     const sal_uInt16 nMap9End   = 182;  // ATTR_ENDINDEX
     516          52 :     const sal_uInt16 nMap9Count = nMap9End - nMap9Start + 1;
     517          52 :     const sal_uInt16 nMap9New   = 35;   // ATTR_WRITINGDIR - ATTR_STARTINDEX
     518          52 :     pVersionMap9 = new sal_uInt16 [ nMap9Count ];
     519        1872 :     for ( i=0, j=nMap9Start; i < nMap9New; i++, j++ )
     520        1820 :         pVersionMap9[i] = j;
     521             :     // 1 entry inserted
     522        2548 :     for ( i=nMap9New, j=nMap9Start+nMap9New+1; i < nMap9Count; i++, j++ )
     523        2496 :         pVersionMap9[i] = j;
     524             : 
     525             :     // ATTR_PAGE_SCALETO added in 680/sab008
     526             : 
     527             :     // 10th map: ATTR_SHRINKTOFIT, ATTR_BORDER_TL_BR, ATTR_BORDER_BL_TR added in 680/dr14
     528             : 
     529          52 :     const sal_uInt16 nMap10Start = 100;  // ATTR_STARTINDEX
     530          52 :     const sal_uInt16 nMap10End   = 184;  // ATTR_ENDINDEX
     531          52 :     const sal_uInt16 nMap10Count = nMap10End - nMap10Start + 1;
     532          52 :     const sal_uInt16 nMap10New   = 37;   // ATTR_SHRINKTOFIT - ATTR_STARTINDEX
     533          52 :     pVersionMap10 = new sal_uInt16 [ nMap10Count ];
     534        1976 :     for ( i=0, j=nMap10Start; i < nMap10New; i++, j++ )
     535        1924 :         pVersionMap10[i] = j;
     536             :     // 3 entries inserted
     537        2548 :     for ( i=nMap10New, j=nMap10Start+nMap10New+3; i < nMap10Count; i++, j++ )
     538        2496 :         pVersionMap10[i] = j;
     539             : 
     540             :     // 11th map: ATTR_FONT_OVERLINE added in DEV300/overline2
     541             : 
     542          52 :     const sal_uInt16 nMap11Start = 100;  // ATTR_STARTINDEX
     543          52 :     const sal_uInt16 nMap11End   = 187;  // ATTR_ENDINDEX
     544          52 :     const sal_uInt16 nMap11Count = nMap11End - nMap11Start + 1;
     545          52 :     const sal_uInt16 nMap11New   = 5;    // ATTR_FONT_OVERLINE - ATTR_STARTINDEX
     546          52 :     pVersionMap11 = new sal_uInt16 [ nMap11Count ];
     547         312 :     for ( i=0, j=nMap11Start; i < nMap11New; i++, j++ )
     548         260 :         pVersionMap11[i] = j;
     549             :     // 1 entry inserted
     550        4368 :     for ( i=nMap11New, j=nMap11Start+nMap11New+1; i < nMap11Count; i++, j++ )
     551        4316 :         pVersionMap11[i] = j;
     552             : 
     553          52 :     const sal_uInt16 nMap12Start = 100;  // ATTR_STARTINDEX
     554          52 :     const sal_uInt16 nMap12End   = 192;  // ATTR_ENDINDEX
     555          52 :     const sal_uInt16 nMap12Count = nMap12End - nMap12Start + 1;
     556          52 :     const sal_uInt16 nMap12New   = 55;    // ATTR_HYPERLINK - ATTR_STARTINDEX
     557          52 :     pVersionMap12 = new sal_uInt16 [ nMap12Count ];
     558        2912 :     for ( i=0, j=nMap12Start; i < nMap12New; i++, j++ )
     559        2860 :         pVersionMap12[i] = j;
     560             :     // 1 entry inserted
     561        2028 :     for ( i=nMap12New, j=nMap12Start+nMap12New+1; i < nMap12Count; i++, j++ )
     562        1976 :         pVersionMap12[i] = j;
     563          52 : }
     564             : 
     565          16 : void ScDocumentPool::DeleteVersionMaps()
     566             : {
     567             :     OSL_PRECOND( pVersionMap1 && pVersionMap2 &&
     568             :                 pVersionMap3 && pVersionMap4 &&
     569             :                 pVersionMap5 && pVersionMap6 &&
     570             :                 pVersionMap7 && pVersionMap8 &&
     571             :                 pVersionMap9 && pVersionMap10 &&
     572             :                 pVersionMap11 && pVersionMap12 , "DeleteVersionMaps without maps" );
     573             : 
     574          16 :     delete[] pVersionMap12;
     575          16 :     pVersionMap12 = 0;
     576          16 :     delete[] pVersionMap11;
     577          16 :     pVersionMap11 = 0;
     578          16 :     delete[] pVersionMap10;
     579          16 :     pVersionMap10 = 0;
     580          16 :     delete[] pVersionMap9;
     581          16 :     pVersionMap9 = 0;
     582          16 :     delete[] pVersionMap8;
     583          16 :     pVersionMap8 = 0;
     584          16 :     delete[] pVersionMap7;
     585          16 :     pVersionMap7 = 0;
     586          16 :     delete[] pVersionMap6;
     587          16 :     pVersionMap6 = 0;
     588          16 :     delete[] pVersionMap5;
     589          16 :     pVersionMap5 = 0;
     590          16 :     delete[] pVersionMap4;
     591          16 :     pVersionMap4 = 0;
     592          16 :     delete[] pVersionMap3;
     593          16 :     pVersionMap3 = 0;
     594          16 :     delete[] pVersionMap2;
     595          16 :     pVersionMap2 = 0;
     596          16 :     delete[] pVersionMap1;
     597          16 :     pVersionMap1 = 0;
     598          16 : }
     599             : 
     600             : /**
     601             :  * The sal_uInt16 RefCount can overflow easily for the pattern attributes (SetItems):
     602             :  * E.g. Alternate formatting for 600 whole cells.
     603             :  * The RefCount is kept at SC_MAX_POOLREF and not increased/decreased anymore.
     604             :  * This RefCount is recalculated not until the next load.
     605             :  * The difference between SC_MAX_POOLREF and SC_SAFE_POOLREF is a little larger than it needs
     606             :  * to be, to allow for detecting accidental "normal" changes to the RefCount (assertions).
     607             :  */
     608      877321 : const SfxPoolItem& ScDocumentPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich )
     609             : {
     610      877321 :     if ( rItem.Which() != ATTR_PATTERN ) // Only Pattern is special
     611      417186 :         return SfxItemPool::Put( rItem, nWhich );
     612             : 
     613             :     // Don't copy the default pattern of this Pool
     614      460135 :     if (&rItem == ppPoolDefaults[ ATTR_PATTERN - ATTR_STARTINDEX ])
     615      184671 :         return rItem;
     616             : 
     617             :     // Else Put must always happen, because it could be another Pool
     618      275464 :     const SfxPoolItem& rNew = SfxItemPool::Put( rItem, nWhich );
     619      275464 :     CheckRef( rNew );
     620      275464 :     return rNew;
     621             : }
     622             : 
     623     3129845 : void ScDocumentPool::Remove( const SfxPoolItem& rItem )
     624             : {
     625     3129845 :     if ( rItem.Which() == ATTR_PATTERN ) // Only Pattern is special
     626             :     {
     627     3035855 :         sal_uLong nRef = rItem.GetRefCount();
     628     3035855 :         if ( nRef >= (sal_uLong) SC_MAX_POOLREF && nRef <= (sal_uLong) SFX_ITEMS_OLD_MAXREF )
     629             :         {
     630           0 :             if ( nRef != (sal_uLong) SC_SAFE_POOLREF )
     631             :             {
     632             :                 OSL_FAIL("Who fiddles with my ref counts?");
     633           0 :                 SetRefCount( (SfxPoolItem&)rItem, (sal_uLong) SC_SAFE_POOLREF );
     634             :             }
     635     3129845 :             return; // Do not decrement
     636             :         }
     637             :     }
     638     3129845 :     SfxItemPool::Remove( rItem );
     639             : }
     640             : 
     641      524004 : void ScDocumentPool::CheckRef( const SfxPoolItem& rItem )
     642             : {
     643      524004 :     sal_uLong nRef = rItem.GetRefCount();
     644      524004 :     if ( nRef >= (sal_uLong) SC_MAX_POOLREF && nRef <= (sal_uLong) SFX_ITEMS_OLD_MAXREF )
     645             :     {
     646             :         // At the Apply of the Cache we might increase by 2 (to MAX+1 or SAFE+2)
     647             :         // We only decrease by 1 (in LoadCompleted)
     648             :         OSL_ENSURE( nRef<=(sal_uLong)SC_MAX_POOLREF+1 || (nRef>=(sal_uLong)SC_SAFE_POOLREF-1 && nRef<=(sal_uLong)SC_SAFE_POOLREF+2),
     649             :                 "ScDocumentPool::CheckRef" );
     650           0 :         SetRefCount( (SfxPoolItem&)rItem, (sal_uLong) SC_SAFE_POOLREF );
     651             :     }
     652      524004 : }
     653             : 
     654           1 : void ScDocumentPool::StyleDeleted( ScStyleSheet* pStyle )
     655             : {
     656           1 :     sal_uInt32 nCount = GetItemCount2(ATTR_PATTERN);
     657           1 :     for (sal_uInt32 i=0; i<nCount; i++)
     658             :     {
     659           0 :         ScPatternAttr* pPattern = const_cast<ScPatternAttr*>(static_cast<const ScPatternAttr*>(GetItem2(ATTR_PATTERN, i)));
     660           0 :         if ( pPattern && pPattern->GetStyleSheet() == pStyle )
     661           0 :             pPattern->StyleToName();
     662             :     }
     663           1 : }
     664             : 
     665           4 : void ScDocumentPool::CellStyleCreated( const OUString& rName, ScDocument* pDoc )
     666             : {
     667             :     // If a style was created, don't keep any pattern with its name string in the pool,
     668             :     // because it would compare equal to a pattern with a pointer to the new style.
     669             :     // Calling StyleSheetChanged isn't enough because the pool may still contain items
     670             :     // for undo or clipboard content.
     671             : 
     672           4 :     sal_uInt32 nCount = GetItemCount2(ATTR_PATTERN);
     673           4 :     for (sal_uInt32 i=0; i<nCount; i++)
     674             :     {
     675             :         ScPatternAttr *const pPattern =
     676             :             const_cast<ScPatternAttr*>(
     677           0 :                 static_cast<ScPatternAttr const*>(GetItem2(ATTR_PATTERN, i)));
     678           0 :         if ( pPattern && pPattern->GetStyleSheet() == NULL )
     679             :         {
     680           0 :             const OUString* pStyleName = pPattern->GetStyleName();
     681           0 :             if ( pStyleName && *pStyleName == rName )
     682           0 :                 pPattern->UpdateStyleSheet(pDoc); // find and store style pointer
     683             :         }
     684             :     }
     685           4 : }
     686             : 
     687           0 : SfxItemPool* ScDocumentPool::Clone() const
     688             : {
     689           0 :     return new SfxItemPool (*this, true);
     690             : }
     691             : 
     692           0 : static bool lcl_HFPresentation
     693             : (
     694             :     const SfxPoolItem&  rItem,
     695             :     SfxMapUnit          eCoreMetric,
     696             :     SfxMapUnit          ePresentationMetric,
     697             :     OUString&           rText,
     698             :     const IntlWrapper* pIntl
     699             : )
     700             : {
     701           0 :     const SfxItemSet& rSet = static_cast<const SfxSetItem&>(rItem).GetItemSet();
     702             :     const SfxPoolItem* pItem;
     703             : 
     704           0 :     if ( SfxItemState::SET == rSet.GetItemState(ATTR_PAGE_ON,false,&pItem) )
     705             :     {
     706           0 :         if( !static_cast<const SfxBoolItem*>(pItem)->GetValue() )
     707           0 :             return false;
     708             :     }
     709             : 
     710           0 :     SfxItemIter aIter( rSet );
     711           0 :     pItem = aIter.FirstItem();
     712           0 :     OUString aText;
     713           0 :     OUString aDel(" + ");
     714             : 
     715           0 :     while( pItem )
     716             :     {
     717           0 :         sal_uInt16 nWhich = pItem->Which();
     718             : 
     719           0 :         aText.clear();
     720             : 
     721           0 :         switch( nWhich )
     722             :         {
     723             :             case ATTR_PAGE_ON:
     724             :             case ATTR_PAGE_DYNAMIC:
     725             :             case ATTR_PAGE_SHARED:
     726           0 :             break;
     727             : 
     728             :             case ATTR_LRSPACE:
     729             :             {
     730           0 :                 const SvxLRSpaceItem& rLRItem = static_cast<const SvxLRSpaceItem&>(*pItem);
     731           0 :                 sal_uInt16 nPropLeftMargin  = rLRItem.GetPropLeft();
     732           0 :                 sal_uInt16 nPropRightMargin = rLRItem.GetPropRight();
     733             :                 sal_uInt16 nLeftMargin, nRightMargin;
     734             :                 long nTmp;
     735           0 :                 nTmp = rLRItem.GetLeft();
     736           0 :                 nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
     737           0 :                 nTmp = rLRItem.GetRight();
     738           0 :                 nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
     739             : 
     740           0 :                 aText = EE_RESSTR(RID_SVXITEMS_LRSPACE_LEFT);
     741           0 :                 if ( 100 != nPropLeftMargin )
     742             :                 {
     743           0 :                     aText = aText + unicode::formatPercent(nPropLeftMargin,
     744           0 :                         Application::GetSettings().GetUILanguageTag());
     745             :                 }
     746             :                 else
     747             :                 {
     748           0 :                     aText += GetMetricText( (long)nLeftMargin,
     749           0 :                                            eCoreMetric, ePresentationMetric, pIntl );
     750           0 :                     aText += " " + EE_RESSTR(GetMetricId(ePresentationMetric));
     751             :                 }
     752           0 :                 aText += cpDelim;
     753             : 
     754             :                 // We don't have a nPropFirstLineOfst
     755           0 :                 aText += EE_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT);
     756           0 :                 if ( 100 != nPropRightMargin )
     757             :                 {
     758           0 :                     aText = aText + unicode::formatPercent(nPropLeftMargin,
     759           0 :                         Application::GetSettings().GetUILanguageTag());
     760             :                 }
     761             :                 else
     762             :                 {
     763           0 :                     aText += GetMetricText( (long)nRightMargin,
     764           0 :                                             eCoreMetric, ePresentationMetric, pIntl );
     765           0 :                     aText += " " + EE_RESSTR(GetMetricId(ePresentationMetric));
     766             :                 }
     767             :             }
     768           0 :             break;
     769             : 
     770             :             default:
     771           0 :                 if ( !pIntl )
     772           0 :                     pIntl = ScGlobal::GetScIntlWrapper();
     773           0 :                 pItem->GetPresentation( SFX_ITEM_PRESENTATION_COMPLETE, eCoreMetric, ePresentationMetric, aText, pIntl );
     774             : 
     775             :         }
     776             : 
     777           0 :         if ( aText.getLength() )
     778             :         {
     779           0 :             rText = rText + aText + aDel;
     780             :         }
     781             : 
     782           0 :         pItem = aIter.NextItem();
     783             :     }
     784             : 
     785           0 :     rText = comphelper::string::stripEnd(rText, ' ');
     786           0 :     rText = comphelper::string::stripEnd(rText, '+');
     787           0 :     rText = comphelper::string::stripEnd(rText, ' ');
     788           0 :     return true;
     789             : }
     790             : 
     791           0 : bool ScDocumentPool::GetPresentation(
     792             :     const SfxPoolItem&  rItem,
     793             :     SfxMapUnit          ePresentationMetric,
     794             :     OUString&           rText,
     795             :     const IntlWrapper* pIntl ) const
     796             : {
     797           0 :     sal_uInt16  nW = rItem.Which();
     798           0 :     OUString aStrYes  ( ScGlobal::GetRscString(STR_YES) );
     799           0 :     OUString aStrNo   ( ScGlobal::GetRscString(STR_NO) );
     800           0 :     OUString aStrSep(": ");
     801             : 
     802           0 :     bool ePresentationRet = true;
     803           0 :     switch( nW )
     804             :     {
     805             :         case ATTR_PAGE_TOPDOWN:
     806           0 :             rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_PRINTDIR) + aStrSep;
     807           0 :             rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ?
     808             :                 ScGlobal::GetRscString(STR_SCATTR_PAGE_TOPDOWN) :
     809           0 :                 ScGlobal::GetRscString(STR_SCATTR_PAGE_LEFTRIGHT) ;
     810           0 :         break;
     811             : 
     812             :         case ATTR_PAGE_HEADERS:
     813           0 :             rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_HEADERS) + aStrSep;
     814           0 :             rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
     815           0 :         break;
     816             : 
     817             :         case ATTR_PAGE_NULLVALS:
     818           0 :             rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_NULLVALS) + aStrSep;
     819           0 :             rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
     820           0 :         break;
     821             : 
     822             :         case ATTR_PAGE_FORMULAS:
     823           0 :             rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_FORMULAS) + aStrSep;
     824           0 :             rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
     825           0 :         break;
     826             : 
     827             :         case ATTR_PAGE_NOTES:
     828           0 :             rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_NOTES) + aStrSep;
     829           0 :             rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
     830           0 :         break;
     831             : 
     832             :         case ATTR_PAGE_GRID:
     833           0 :             rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_GRID) + aStrSep;
     834           0 :             rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
     835           0 :         break;
     836             : 
     837             :         case ATTR_PAGE_SCALETOPAGES:
     838             :         {
     839           0 :             sal_uInt16  nPagNo = static_cast<const SfxUInt16Item&>(rItem).GetValue();
     840             : 
     841           0 :             if( nPagNo )
     842             :             {
     843           0 :                 rText = ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALETOPAGES ) + aStrSep;
     844           0 :                 OUString aPages( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_PAGES ) );
     845           0 :                 aPages = aPages.replaceFirst( "%1", OUString::number( nPagNo ) );
     846           0 :                 rText += aPages;
     847             :             }
     848             :             else
     849             :             {
     850           0 :                 ePresentationRet = false;
     851             :             }
     852             :         }
     853           0 :         break;
     854             : 
     855             :         case ATTR_PAGE_FIRSTPAGENO:
     856             :         {
     857           0 :             sal_uInt16  nPagNo = static_cast<const SfxUInt16Item&>(rItem).GetValue();
     858             : 
     859           0 :             if( nPagNo )
     860             :             {
     861           0 :                 rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_FIRSTPAGENO) + aStrSep;
     862           0 :                 rText += OUString::number( nPagNo );
     863             :             }
     864             :             else
     865             :             {
     866           0 :                 ePresentationRet = false;
     867             :             }
     868             :         }
     869           0 :         break;
     870             : 
     871             :         case ATTR_PAGE_SCALE:
     872             :         {
     873           0 :             sal_uInt16  nPercent = static_cast<const SfxUInt16Item &>(rItem).GetValue();
     874             : 
     875           0 :             if( nPercent )
     876             :             {
     877           0 :                 rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_SCALE) + aStrSep;
     878           0 :                 rText = rText + unicode::formatPercent(nPercent,
     879           0 :                     Application::GetSettings().GetUILanguageTag());
     880             :             }
     881             :             else
     882             :             {
     883           0 :                 ePresentationRet = false;
     884             :             }
     885             :         }
     886           0 :         break;
     887             : 
     888             :         case ATTR_PAGE_HEADERSET:
     889             :         {
     890           0 :             OUString  aBuffer;
     891             : 
     892           0 :             if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) )
     893             :             {
     894           0 :                 rText = ScGlobal::GetRscString(STR_HEADER) + " ( " + aBuffer + " ) ";
     895           0 :             }
     896             :         }
     897           0 :         break;
     898             : 
     899             :         case ATTR_PAGE_FOOTERSET:
     900             :         {
     901           0 :             OUString  aBuffer;
     902             : 
     903           0 :             if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) )
     904             :             {
     905           0 :                 rText = ScGlobal::GetRscString(STR_FOOTER) + " ( " + aBuffer + " ) ";
     906           0 :             }
     907             :         }
     908           0 :         break;
     909             : 
     910             :         default:
     911           0 :             if ( !pIntl )
     912           0 :                 pIntl = ScGlobal::GetScIntlWrapper();
     913           0 :             ePresentationRet = rItem.GetPresentation( SFX_ITEM_PRESENTATION_COMPLETE, GetMetric( nW ), ePresentationMetric, rText, pIntl );
     914           0 :         break;
     915             :     }
     916             : 
     917           0 :     return ePresentationRet;
     918             : }
     919             : 
     920           0 : SfxMapUnit ScDocumentPool::GetMetric( sal_uInt16 nWhich ) const
     921             : {
     922             :     // Own attributes in Twips, everything else in 1/100 mm
     923           0 :     if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
     924           0 :         return SFX_MAPUNIT_TWIP;
     925             :     else
     926           0 :         return SFX_MAPUNIT_100TH_MM;
     927         156 : }
     928             : 
     929             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11