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

Generated by: LCOV version 1.10