LCOV - code coverage report
Current view: top level - sd/source/core - stlpool.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 458 765 59.9 %
Date: 2015-06-13 12:38:46 Functions: 20 55 36.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/lang/DisposedException.hpp>
      21             : #include <cppuhelper/supportsservice.hxx>
      22             : #include <editeng/eeitem.hxx>
      23             : #include <editeng/fhgtitem.hxx>
      24             : #include <editeng/colritem.hxx>
      25             : #include <editeng/contouritem.hxx>
      26             : #include <editeng/shdditem.hxx>
      27             : #include <editeng/crossedoutitem.hxx>
      28             : #include <editeng/udlnitem.hxx>
      29             : #include <editeng/wghtitem.hxx>
      30             : #include <editeng/postitem.hxx>
      31             : #include <editeng/fontitem.hxx>
      32             : #include <svl/poolitem.hxx>
      33             : #include <svx/xfillit0.hxx>
      34             : #include <svx/xlineit0.hxx>
      35             : #include <editeng/ulspitem.hxx>
      36             : #include <editeng/numitem.hxx>
      37             : #include <editeng/brushitem.hxx>
      38             : #include <editeng/editeng.hxx>
      39             : #include <editeng/cmapitem.hxx>
      40             : #include <svl/smplhint.hxx>
      41             : #include <editeng/langitem.hxx>
      42             : #include <editeng/charreliefitem.hxx>
      43             : #include <editeng/emphasismarkitem.hxx>
      44             : #include <svx/sdr/table/tabledesign.hxx>
      45             : #include <editeng/autokernitem.hxx>
      46             : 
      47             : #include <svx/svdattr.hxx>
      48             : #include <editeng/outliner.hxx>
      49             : #include <svx/xtable.hxx>
      50             : #include <editeng/bulletitem.hxx>
      51             : #include <editeng/lrspitem.hxx>
      52             : #include <editeng/adjustitem.hxx>
      53             : #include <editeng/numdef.hxx>
      54             : #include <svl/itempool.hxx>
      55             : #include <svl/IndexedStyleSheets.hxx>
      56             : 
      57             : #include "stlpool.hxx"
      58             : #include "sdresid.hxx"
      59             : #include "stlsheet.hxx"
      60             : #include "glob.hrc"
      61             : #include "glob.hxx"
      62             : #include "drawdoc.hxx"
      63             : #include "sdmod.hxx"
      64             : #include "sdpage.hxx"
      65             : #include "helpids.h"
      66             : #include <svl/itemset.hxx>
      67             : #include "app.hrc"
      68             : 
      69             : #include <com/sun/star/drawing/LineStyle.hpp>
      70             : 
      71             : using namespace ::com::sun::star;
      72             : using namespace ::com::sun::star::uno;
      73             : using namespace ::com::sun::star::lang;
      74             : using namespace ::com::sun::star::style;
      75             : using namespace ::com::sun::star::container;
      76             : 
      77             : namespace
      78             : {
      79             : 
      80           0 : OUString lcl_findRenamedStyleName(std::vector< std::pair< OUString, OUString > > &rRenamedList, OUString& aOriginalName )
      81             : {
      82           0 :     std::vector< std::pair< OUString, OUString > >::iterator aIter;
      83           0 :     for( aIter = rRenamedList.begin(); aIter != rRenamedList.end(); ++aIter )
      84             :     {
      85           0 :         if((*aIter).first == aOriginalName )
      86           0 :             return (*aIter).second;
      87             :     }
      88           0 :     return OUString();
      89             : }
      90             : 
      91           0 : SfxStyleSheet *lcl_findStyle(SdStyleSheetVector& rStyles, const OUString& aStyleName)
      92             : {
      93           0 :     if( aStyleName.isEmpty() )
      94           0 :         return NULL;
      95           0 :     for(SdStyleSheetVector::const_iterator aIt(rStyles.begin()), aLast(rStyles.end()); aIt != aLast; ++aIt)
      96             :     {
      97           0 :         if((*aIt)->GetName() == aStyleName)
      98           0 :             return (*aIt).get();
      99             :     }
     100           0 :     return NULL;
     101             : }
     102             : 
     103             : }
     104             : 
     105         320 : SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pDocument)
     106             : :   SdStyleSheetPoolBase( _rPool )
     107             : ,   mpActualStyleSheet(NULL)
     108         320 : ,   mpDoc(pDocument)
     109             : {
     110         320 :     if( mpDoc )
     111             :     {
     112         320 :         rtl::Reference< SfxStyleSheetPool > xPool( this );
     113             : 
     114             :         // create graphics family
     115         320 :         mxGraphicFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_GRAPHICS );
     116         320 :         mxCellFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_CELL );
     117             : 
     118         320 :         mxTableFamily = sdr::table::CreateTableDesignFamily();
     119         640 :         Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
     120         320 :         if( xNamed.is() )
     121         320 :             msTableFamilyName = xNamed->getName();
     122             : 
     123             :         // create presentation families, one for each master page
     124         320 :         const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD);
     125         320 :         for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
     126         320 :             AddStyleFamily( mpDoc->GetMasterSdPage(nPage,PK_STANDARD) );
     127             : 
     128             :     }
     129         320 : }
     130             : 
     131         630 : SdStyleSheetPool::~SdStyleSheetPool()
     132             : {
     133             :     DBG_ASSERT( mpDoc == NULL, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
     134         630 : }
     135             : 
     136       20044 : SfxStyleSheetBase* SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 _nMask )
     137             : {
     138       20044 :     return new SdStyleSheet(rName, *this, eFamily, _nMask);
     139             : }
     140             : 
     141           0 : SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(const OUString& rLayoutName)
     142             : {
     143           0 :     OUString aName(rLayoutName);
     144           0 :     aName += SD_LT_SEPARATOR;
     145           0 :     aName += SD_RESSTR(STR_LAYOUT_TITLE);
     146           0 :     SfxStyleSheetBase* pResult = Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     147           0 :     return pResult;
     148             : }
     149             : 
     150             : /*************************************************************************
     151             : |*
     152             : |* Create a list of outline text templates for a presentation layout.
     153             : |* The caller has to delete the list.
     154             : |*
     155             : \************************************************************************/
     156             : 
     157         353 : void SdStyleSheetPool::CreateOutlineSheetList (const OUString& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles)
     158             : {
     159         353 :     OUString aName(rLayoutName);
     160         353 :     aName += SD_LT_SEPARATOR;
     161         353 :     aName += SD_RESSTR(STR_LAYOUT_OUTLINE);
     162             : 
     163        3530 :     for (sal_Int32 nSheet = 1; nSheet < 10; nSheet++)
     164             :     {
     165        3177 :         OUString aFullName(aName + " " + OUString::number( nSheet ) );
     166        3177 :         SfxStyleSheetBase* pSheet = Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
     167             : 
     168        3177 :         if (pSheet)
     169        3177 :             rOutlineStyles.push_back(pSheet);
     170        3530 :     }
     171         353 : }
     172             : 
     173             : /*************************************************************************
     174             : |*
     175             : |* Create style sheets with default values for the named presentation layout
     176             : |*
     177             : \************************************************************************/
     178             : 
     179         272 : void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck /*= sal_False*/ )
     180             : {
     181         272 :     const sal_uInt16 nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
     182             : 
     183             :     (void)bCheck;
     184         272 :     bool bCreated = false;
     185             : 
     186         272 :     SfxStyleSheetBase* pSheet = NULL;
     187             : 
     188         272 :     OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
     189             : 
     190         544 :     vcl::Font aLatinFont, aCJKFont, aCTLFont;
     191             : 
     192         272 :     mpDoc->getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
     193             : 
     194             :     // Font for title and outline
     195         272 :     SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
     196         816 :                               aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
     197             : 
     198         272 :     SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
     199         816 :                                  aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
     200             : 
     201         272 :     SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
     202         816 :                                  aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
     203             : 
     204         544 :     vcl::Font aBulletFont( GetBulletFont() );
     205             : 
     206             :     /**************************************************************************
     207             :     * outline levels
     208             :     **************************************************************************/
     209         544 :     OUString aName(SD_RESSTR(STR_LAYOUT_OUTLINE));
     210         544 :     OUString aHelpFile;
     211             : 
     212         272 :     SfxStyleSheetBase* pParent = NULL;
     213         544 :     SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
     214         544 :     SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE );
     215             : 
     216        2720 :     for( sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     217             :     {
     218        2448 :         OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) ) ;
     219             : 
     220        2448 :         if (!Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE))
     221             :         {
     222        2421 :             bCreated = true;
     223        2421 :             pSheet = &Make(aLevelName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     224        2421 :             pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
     225             : 
     226        2421 :             pSheet->SetParent( OUString() );
     227             : 
     228             :             // attributing for level 1, the others levels inherit
     229        2421 :             if (nLevel == 1)
     230             :             {
     231         269 :                 SfxItemSet&     rSet = pSheet->GetItemSet();
     232             : 
     233         269 :                 rSet.Put(aSvxFontItem);
     234         269 :                 rSet.Put(aSvxFontItemCJK);
     235         269 :                 rSet.Put(aSvxFontItemCTL);
     236         269 :                 rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     237         269 :                 rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     238         269 :                 rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     239         269 :                 rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     240         269 :                 rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     241         269 :                 rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     242         269 :                 rSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
     243         269 :                 rSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
     244         269 :                 rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
     245         269 :                 rSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) );
     246         269 :                 rSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) );
     247         269 :                 rSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) );
     248         269 :                 rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     249         269 :                 rSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
     250         269 :                 rSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR) );
     251         269 :                 rSet.Put( SvxBackgroundColorItem( Color (COL_AUTO), EE_CHAR_BKGCOLOR )  );
     252         269 :                 rSet.Put( XLineStyleItem(com::sun::star::drawing::LineStyle_NONE) );
     253         269 :                 rSet.Put( XFillStyleItem(drawing::FillStyle_NONE) );
     254         269 :                 rSet.Put( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
     255         269 :                 rSet.Put( makeSdrTextAutoGrowHeightItem(false) );
     256             :                 // #i16874# enable kerning by default but only for new documents
     257         269 :                 rSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     258             : 
     259         269 :                 if( nLevel == 1 )
     260             :                 {
     261         269 :                     vcl::Font f( GetBulletFont() );
     262         269 :                     PutNumBulletItem( pSheet, f );
     263             :                 }
     264             :             }
     265             : 
     266        2421 :             sal_uLong nFontSize = 20;
     267        2421 :             sal_uInt16 nUpper = 100;
     268             : 
     269        2421 :             switch (nLevel)
     270             :             {
     271             :                 case 1:
     272             :                 {
     273         269 :                     nFontSize = 32;
     274         269 :                     nUpper = 500;
     275             :                 }
     276         269 :                 break;
     277             : 
     278             :                 case 2:
     279             :                 {
     280         269 :                     nFontSize = 28;
     281         269 :                     nUpper = 400;
     282             :                 }
     283         269 :                 break;
     284             : 
     285             :                 case 3:
     286             :                 {
     287         269 :                     nFontSize = 24;
     288         269 :                     nUpper = 300;
     289             :                 }
     290         269 :                 break;
     291             : 
     292             :                 case 4:
     293             :                 {
     294         269 :                     nUpper = 200;
     295             :                 }
     296         269 :                 break;
     297             :             }
     298             : 
     299             :             // FontSize
     300        2421 :             nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72);  // Pt --> 1/100 mm
     301        2421 :             SfxItemSet& rOutlineSet = pSheet->GetItemSet();
     302        2421 :             rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT ) );
     303        2421 :             rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CJK ) );
     304        2421 :             rOutlineSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( nFontSize ), 100, EE_CHAR_FONTHEIGHT_CTL ) );
     305             : 
     306             :             // Line distance (upwards). Stuff around here cleaned up in i35937
     307        2421 :             aSvxULSpaceItem.SetUpper(nUpper);
     308        2421 :             pSheet->GetItemSet().Put(aSvxULSpaceItem);
     309             :         }
     310        2448 :     }
     311             : 
     312             :     // if we created outline styles, we need to chain them
     313         272 :     if( bCreated )
     314             :     {
     315         269 :         pParent = NULL;
     316        2690 :         for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     317             :         {
     318        2421 :             OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) );
     319             : 
     320        2421 :             pSheet = Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE);
     321             : 
     322             :             DBG_ASSERT( pSheet, "missing layout style!");
     323             : 
     324        2421 :             if( pSheet )
     325             :             {
     326        2421 :                 if (pParent)
     327        2152 :                     pSheet->SetParent(pParent->GetName());
     328        2421 :                 pParent = pSheet;
     329             :             }
     330        2421 :         }
     331             :     }
     332             : 
     333             :     /**************************************************************************
     334             :     * Title
     335             :     **************************************************************************/
     336         272 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_TITLE);
     337             : 
     338         272 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     339             :     {
     340         269 :         bCreated = true;
     341             : 
     342         269 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     343         269 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
     344         269 :         pSheet->SetParent( OUString() );
     345         269 :         SfxItemSet& rTitleSet = pSheet->GetItemSet();
     346         269 :         rTitleSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
     347         269 :         rTitleSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
     348         269 :         rTitleSet.Put(aSvxFontItem);
     349         269 :         rTitleSet.Put(aSvxFontItemCJK);
     350         269 :         rTitleSet.Put(aSvxFontItemCTL);
     351         269 :         rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     352         269 :         rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     353         269 :         rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     354         269 :         rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     355         269 :         rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     356         269 :         rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     357         269 :         rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT ) );                 // 44 pt
     358         269 :         rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK ) );                 // 44 pt
     359         269 :         rTitleSet.Put(SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1552 ), 100, EE_CHAR_FONTHEIGHT_CTL ) );                   // 44 pt
     360         269 :         rTitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
     361         269 :         rTitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
     362         269 :         rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
     363         269 :         rTitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
     364         269 :         rTitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
     365         269 :         rTitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
     366         269 :         rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     367         269 :         rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
     368         269 :         rTitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
     369         269 :         rTitleSet.Put(SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR ));
     370         269 :         rTitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
     371         269 :         rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
     372             :         // #i16874# enable kerning by default but only for new documents
     373         269 :         rTitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     374             : 
     375         269 :         aBulletFont.SetSize(Size(0,1552));                  // 44 pt
     376         269 :         PutNumBulletItem( pSheet, aBulletFont );
     377             :     }
     378             : 
     379             :     /**************************************************************************
     380             :     * Subtitle
     381             :     **************************************************************************/
     382         272 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_SUBTITLE);
     383             : 
     384         272 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     385             :     {
     386         269 :         bCreated = true;
     387             : 
     388         269 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     389         269 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
     390         269 :         pSheet->SetParent( OUString() );
     391         269 :         SfxItemSet& rSubtitleSet = pSheet->GetItemSet();
     392         269 :         rSubtitleSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
     393         269 :         rSubtitleSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
     394         269 :         rSubtitleSet.Put(aSvxFontItem);
     395         269 :         rSubtitleSet.Put(aSvxFontItemCJK);
     396         269 :         rSubtitleSet.Put(aSvxFontItemCTL);
     397         269 :         rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     398         269 :         rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     399         269 :         rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     400         269 :         rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     401         269 :         rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     402         269 :         rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     403         269 :         rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT ) );     // 32 pt
     404         269 :         rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 32 pt
     405         269 :         rSubtitleSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1129 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 32 pt
     406         269 :         rSubtitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
     407         269 :         rSubtitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
     408         269 :         rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
     409         269 :         rSubtitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
     410         269 :         rSubtitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
     411         269 :         rSubtitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
     412         269 :         rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     413         269 :         rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
     414         269 :         rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
     415         269 :         rSubtitleSet.Put(SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR ));
     416         269 :         rSubtitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
     417         269 :         rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
     418             :         // #i16874# enable kerning by default but only for new documents
     419         269 :         rSubtitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     420         269 :         aSvxLRSpaceItem.SetTextLeft(0);
     421         269 :         rSubtitleSet.Put(aSvxLRSpaceItem);
     422             : 
     423         269 :         vcl::Font aTmpFont( GetBulletFont() );
     424         269 :         aTmpFont.SetSize(Size(0, 1129));        // 32 pt
     425         269 :         PutNumBulletItem( pSheet, aTmpFont );
     426             :     }
     427             : 
     428             :     /**************************************************************************
     429             :     * Notes
     430             :     **************************************************************************/
     431         272 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_NOTES);
     432             : 
     433         272 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     434             :     {
     435         269 :         bCreated = true;
     436             : 
     437         269 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     438         269 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
     439         269 :         pSheet->SetParent( OUString() );
     440         269 :         SfxItemSet& rNotesSet = pSheet->GetItemSet();
     441         269 :         rNotesSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
     442         269 :         rNotesSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
     443         269 :         rNotesSet.Put(aSvxFontItem);
     444         269 :         rNotesSet.Put(aSvxFontItemCJK);
     445         269 :         rNotesSet.Put(aSvxFontItemCTL);
     446         269 :         rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     447         269 :         rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     448         269 :         rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     449         269 :         rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     450         269 :         rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     451         269 :         rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     452         269 :         rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT ) );     // 20 pt
     453         269 :         rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 20 pt
     454         269 :         rNotesSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 705 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 20 pt
     455         269 :         rNotesSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
     456         269 :         rNotesSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
     457         269 :         rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
     458         269 :         rNotesSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) );
     459         269 :         rNotesSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) );
     460         269 :         rNotesSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) );
     461         269 :         rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     462         269 :         rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
     463         269 :         rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) );
     464         269 :         rNotesSet.Put( SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR ) );
     465         269 :         rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE  ) );
     466             :         // #i16874# enable kerning by default but only for new documents
     467         269 :         rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     468             : 
     469             : /* #i35937# */
     470             : 
     471             :     }
     472             : 
     473             :     /**************************************************************************
     474             :     * Background objects
     475             :     **************************************************************************/
     476         272 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUNDOBJECTS);
     477             : 
     478         272 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     479             :     {
     480         269 :         bCreated = true;
     481             : 
     482         269 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     483         269 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
     484         269 :         pSheet->SetParent( OUString() );
     485         269 :         SfxItemSet& rBackgroundObjectsSet = pSheet->GetItemSet();
     486         269 :         rBackgroundObjectsSet.Put(makeSdrShadowItem(false));
     487         269 :         rBackgroundObjectsSet.Put(makeSdrShadowColorItem(Color(COL_GRAY)));
     488         269 :         rBackgroundObjectsSet.Put(makeSdrShadowXDistItem(200)); // 3 mm shadow distance
     489         269 :         rBackgroundObjectsSet.Put(makeSdrShadowYDistItem(200));
     490             :         // #i16874# enable kerning by default but only for new documents
     491         269 :         rBackgroundObjectsSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     492         269 :         rBackgroundObjectsSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
     493             :     }
     494             : 
     495             :     /**************************************************************************
     496             :     * Background
     497             :     **************************************************************************/
     498         272 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUND);
     499             : 
     500         272 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     501             :     {
     502         269 :         bCreated = true;
     503             : 
     504         269 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     505         269 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
     506         269 :         pSheet->SetParent( OUString() );
     507         269 :         SfxItemSet& rBackgroundSet = pSheet->GetItemSet();
     508         269 :         rBackgroundSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
     509         269 :         rBackgroundSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
     510             :         // #i16874# enable kerning by default but only for new documents
     511         269 :         rBackgroundSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     512             :     }
     513             : 
     514         272 :     DBG_ASSERT( !bCheck || !bCreated, "missing layout style sheets detected!" );
     515         272 : }
     516             : 
     517             : /*************************************************************************
     518             : |*
     519             : |* Copy graphic style sheets from source pool into this pool
     520             : |*
     521             : |* (rSourcePool can not be const since SfxStyleSheetPoolBase::Find isn't const)
     522             : |*
     523             : \************************************************************************/
     524             : 
     525           0 : void SdStyleSheetPool::CopyGraphicSheets(SdStyleSheetPool& rSourcePool)
     526             : {
     527           0 :     CopySheets( rSourcePool, SD_STYLE_FAMILY_GRAPHICS );
     528           0 : }
     529             : 
     530           0 : void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool)
     531             : {
     532           0 :     CopySheets( rSourcePool, SD_STYLE_FAMILY_CELL );
     533           0 : }
     534             : 
     535           0 : void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool)
     536             : {
     537           0 :     Reference< XIndexAccess > xSource( rSourcePool.mxTableFamily, UNO_QUERY );
     538           0 :     Reference< XNameContainer > xTarget( mxTableFamily, UNO_QUERY );
     539           0 :     Reference< XSingleServiceFactory > xFactory( mxTableFamily, UNO_QUERY );
     540             : 
     541           0 :     if( xSource.is() && xFactory.is() && mxTableFamily.is() )
     542             :     {
     543           0 :         for( sal_Int32 nIndex = 0; nIndex < xSource->getCount(); nIndex++ ) try
     544             :         {
     545           0 :             Reference< XStyle > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY );
     546           0 :             if( xSourceTableStyle.is() )
     547             :             {
     548           0 :                 Reference< XStyle > xNewTableStyle( xFactory->createInstance(), UNO_QUERY );
     549           0 :                 if( xNewTableStyle.is() )
     550             :                 {
     551           0 :                     Reference< XNameAccess> xSourceNames( xSourceTableStyle, UNO_QUERY_THROW );
     552             : 
     553           0 :                     Sequence< OUString > aStyleNames( xSourceNames->getElementNames() );
     554           0 :                     OUString* pStyleNames( aStyleNames.getArray() );
     555             : 
     556           0 :                     Reference< XNameReplace > xTargetNames( xNewTableStyle, UNO_QUERY );
     557             : 
     558           0 :                     sal_Int32 nNames = aStyleNames.getLength();
     559           0 :                     while( nNames-- )
     560             :                     {
     561           0 :                         const OUString aName( *pStyleNames++ );
     562           0 :                         Reference< XStyle > xSourceStyle( xSourceNames->getByName( aName ), UNO_QUERY );
     563           0 :                         Reference< XStyle > xTargetStyle;
     564           0 :                         if( xSourceStyle.is() ) try
     565             :                         {
     566           0 :                             mxCellFamily->getByName( xSourceStyle->getName() ) >>= xTargetStyle;
     567             :                         }
     568           0 :                         catch( Exception& )
     569             :                         {
     570             :                             OSL_FAIL( "sd::SdStyleSheetPool::CopyTableStyles(), exception caught!" );
     571             :                         }
     572             : 
     573           0 :                         if( xTargetStyle.is() )
     574           0 :                             xTargetNames->replaceByName( aName, Any( xTargetStyle ) );
     575           0 :                     }
     576             :                 }
     577             : 
     578           0 :                 OUString sName( xSourceTableStyle->getName() );
     579           0 :                 if( xTarget->hasByName( sName ) )
     580           0 :                     xTarget->replaceByName( sName, Any( xNewTableStyle ) );
     581             :                 else
     582           0 :                     xTarget->insertByName( sName, Any( xNewTableStyle ) );
     583           0 :             }
     584             :         }
     585           0 :         catch( Exception& )
     586             :         {
     587             :             OSL_FAIL("sd::SdStyleSheetPool::CopyTableStyles(), exception caught!");
     588             :         }
     589           0 :     }
     590           0 : }
     591             : 
     592           0 : void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets)
     593             : {
     594           0 :     CopySheets( rSourcePool, SD_STYLE_FAMILY_CELL, rCreatedSheets );
     595           0 : }
     596             : 
     597           0 : void SdStyleSheetPool::RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix)
     598             : {
     599           0 :     RenameAndCopySheets( rSourcePool, SD_STYLE_FAMILY_GRAPHICS, rCreatedSheets, rRenameSuffix );
     600           0 : }
     601             : 
     602           0 : void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily )
     603             : {
     604           0 :     SdStyleSheetVector aTmpSheets;
     605           0 :     CopySheets(rSourcePool, eFamily, aTmpSheets);
     606           0 : }
     607             : 
     608           0 : void SdStyleSheetPool::RenameAndCopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix)
     609             : {
     610           0 :     CopySheets( rSourcePool, eFamily, rCreatedSheets, rRenameSuffix );
     611           0 : }
     612             : 
     613           0 : void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets)
     614             : {
     615           0 :     OUString emptyName;
     616           0 :     CopySheets(rSourcePool, eFamily, rCreatedSheets, emptyName);
     617           0 : }
     618             : 
     619             : namespace
     620             : {
     621             : 
     622           0 : struct HasFamilyPredicate : svl::StyleSheetPredicate
     623             : {
     624           0 :     HasFamilyPredicate(SfxStyleFamily eFamily)
     625           0 :     : meFamily(eFamily) {;}
     626             : 
     627           0 :     bool Check(const SfxStyleSheetBase& sheet) SAL_OVERRIDE
     628             :     {
     629           0 :         return sheet.GetFamily() == meFamily;
     630             :     }
     631             :     SfxStyleFamily meFamily;
     632             : };
     633             : 
     634             : }
     635             : 
     636           0 : void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString& rRenameSuffix)
     637             : {
     638           0 :     std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, OUString > > aNewStyles;
     639           0 :     std::vector< std::pair< OUString, OUString > > aRenamedList;
     640             : 
     641             :     // find all style sheets of the source pool which have the same family
     642           0 :     HasFamilyPredicate aHasFamilyPredicate(eFamily);
     643           0 :     std::vector<unsigned> aSheetsWithFamily = rSourcePool.GetIndexedStyleSheets().FindPositionsByPredicate(aHasFamilyPredicate);
     644             : 
     645           0 :     for (std::vector<unsigned>::const_iterator it = aSheetsWithFamily.begin();
     646           0 :          it != aSheetsWithFamily.end(); ++it )
     647             :     {
     648             :         rtl::Reference<SfxStyleSheetBase> const xSheet =
     649           0 :             rSourcePool.GetStyleSheetByPositionInIndex( *it );
     650           0 :         if( !xSheet.is() )
     651           0 :             continue;
     652           0 :         rtl::OUString aName( xSheet->GetName() );
     653             : 
     654             :         // now check whether we already have a sheet with the same name
     655           0 :         std::vector<unsigned> aSheetsWithName = GetIndexedStyleSheets().FindPositionsByName(aName);
     656           0 :         bool bAddToList = false;
     657           0 :         SfxStyleSheetBase * pExistingSheet = 0;
     658           0 :         if (!aSheetsWithName.empty())
     659             :         {
     660             :             // if we have a rename suffix, try to find a new name
     661             :             pExistingSheet =
     662           0 :                 GetStyleSheetByPositionInIndex(aSheetsWithName.front()).get();
     663           0 :             sal_Int32 nHash = xSheet->GetItemSet().getHash();
     664           0 :             if (!rRenameSuffix.isEmpty() &&
     665           0 :                 pExistingSheet->GetItemSet().getHash() != nHash)
     666             :             {
     667             :                 // we have found a sheet with the same name, but different contents. Try to find a new name.
     668             :                 // If we already have a sheet with the new name, and it is equal to the one in the source pool,
     669             :                 // do nothing.
     670           0 :                 OUString aTmpName = aName + rRenameSuffix;
     671           0 :                 sal_Int32 nSuffix = 1;
     672           0 :                 do
     673             :                 {
     674           0 :                     aTmpName = aName + rRenameSuffix + OUString::number(nSuffix);
     675           0 :                     pExistingSheet = Find(aTmpName, eFamily);
     676           0 :                     nSuffix++;
     677           0 :                 } while( pExistingSheet && pExistingSheet->GetItemSet().getHash() != nHash );
     678           0 :                 aName = aTmpName;
     679           0 :                 bAddToList = true;
     680             :             }
     681             :         }
     682             :         // we do not already have a sheet with the same name and contents. Create a new one.
     683           0 :         if (!pExistingSheet)
     684             :         {
     685             :             assert(!Find(aName, eFamily));
     686           0 :             rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
     687             : 
     688           0 :             xNewSheet->SetMask( xSheet->GetMask() );
     689             : 
     690             :             // Also set parent relation for copied style sheets
     691           0 :             OUString aParent( xSheet->GetParent() );
     692           0 :             if( !aParent.isEmpty() )
     693           0 :                 aNewStyles.push_back( std::pair< rtl::Reference< SfxStyleSheetBase >, OUString >( xNewSheet, aParent ) );
     694             : 
     695           0 :             if( !bAddToList )
     696             :             {
     697           0 :                 OUString aHelpFile;
     698           0 :                 xNewSheet->SetHelpId( aHelpFile, xSheet->GetHelpId( aHelpFile ) );
     699             :             }
     700           0 :             xNewSheet->GetItemSet().Put( xSheet->GetItemSet() );
     701             : 
     702           0 :             rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( xNewSheet.get() ) ) );
     703           0 :             aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
     704             :         }
     705           0 :         else if (bAddToList)
     706             :         {
     707             :             // Add to list - used for renaming
     708           0 :             rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pExistingSheet ) ) );
     709           0 :             aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
     710             :         }
     711           0 :     }
     712             : 
     713             :     // set parents on newly added stylesheets
     714           0 :     std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, OUString > >::iterator aIter;
     715           0 :     for( aIter = aNewStyles.begin(); aIter != aNewStyles.end(); ++aIter )
     716             :     {
     717           0 :         if( !rRenameSuffix.isEmpty() )
     718             :         {
     719           0 :             SfxStyleSheet *pParent = lcl_findStyle(rCreatedSheets, lcl_findRenamedStyleName(aRenamedList, (*aIter).second));
     720           0 :             if( pParent )
     721             :             {
     722           0 :                 (*aIter).first->SetParent( pParent->GetName() );
     723           0 :                 continue;
     724             :             }
     725             :         }
     726             :         DBG_ASSERT( rSourcePool.Find( (*aIter).second, eFamily ), "StyleSheet has invalid parent: Family mismatch" );
     727           0 :         (*aIter).first->SetParent( (*aIter).second );
     728             :     }
     729             :     // we have changed names of style sheets. Trigger reindexing.
     730           0 :     Reindex();
     731           0 : }
     732             : 
     733             : /*************************************************************************
     734             : |*
     735             : |* Copy style sheets of the named presentation layout from the source pool into
     736             : |* this pool. Copies only the style sheets which aren't yet in this pool.
     737             : |* If not NULL, pCreatedSheets is filled with pointers to the created style
     738             : |* sheets.
     739             : |*
     740             : |* (rSourcePool can not be const since SfxStyleSheetPoolBase::Find isn't const)
     741             : |*
     742             : \************************************************************************/
     743             : 
     744           0 : void SdStyleSheetPool::CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets)
     745             : {
     746           0 :     SfxStyleSheetBase* pSheet = NULL;
     747             : 
     748           0 :     std::vector<OUString> aNameList;
     749           0 :     CreateLayoutSheetNames(rLayoutName,aNameList);
     750             : 
     751           0 :     OUString sEmpty;
     752           0 :     for (std::vector<OUString>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
     753             :     {
     754           0 :         pSheet = Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
     755           0 :         if (!pSheet)
     756             :         {
     757           0 :             SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
     758             :             DBG_ASSERT(pSourceSheet, "CopyLayoutSheets: Style sheet missing");
     759           0 :             if (pSourceSheet)
     760             :             {
     761             :                 // In the case one comes with Methusalem-Docs.
     762           0 :                 SfxStyleSheetBase& rNewSheet = Make(*it, SD_STYLE_FAMILY_MASTERPAGE);
     763           0 :                 rNewSheet.SetHelpId( sEmpty, pSourceSheet->GetHelpId( sEmpty ) );
     764           0 :                 rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
     765           0 :                 rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( &rNewSheet ) ) );
     766             :             }
     767             :         }
     768             :     }
     769             : 
     770             :     // Special treatment for outline templates: create parent relation
     771           0 :     std::vector<SfxStyleSheetBase*> aOutlineSheets;
     772           0 :     CreateOutlineSheetList(rLayoutName,aOutlineSheets);
     773             : 
     774           0 :     if( !aOutlineSheets.empty() )
     775             :     {
     776           0 :         std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
     777           0 :         SfxStyleSheetBase* pParent = *it;
     778           0 :         ++it;
     779             : 
     780           0 :         while (it != aOutlineSheets.end())
     781             :         {
     782           0 :             pSheet = *it;
     783             : 
     784           0 :             if (!pSheet)
     785           0 :                 break;
     786             : 
     787           0 :             if (pSheet->GetParent().isEmpty())
     788           0 :                 pSheet->SetParent(pParent->GetName());
     789             : 
     790           0 :             pParent = pSheet;
     791             : 
     792           0 :             ++it;
     793             :         }
     794           0 :     }
     795           0 : }
     796             : 
     797             : /*************************************************************************
     798             : |*
     799             : |* Create list with names of the presentation templates of a layout.
     800             : |* The list and the containing strings are owned by the caller!
     801             : |*
     802             : \************************************************************************/
     803             : 
     804           0 : void SdStyleSheetPool::CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList)
     805             : {
     806           0 :     OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
     807           0 :     OUString aName(SD_RESSTR(STR_LAYOUT_OUTLINE));
     808             : 
     809           0 :     for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     810           0 :         aNameList.push_back( aPrefix + aName + " " + OUString::number( nLevel ) );
     811             : 
     812           0 :     aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_TITLE) );
     813           0 :     aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_SUBTITLE) );
     814           0 :     aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_NOTES) );
     815           0 :     aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUNDOBJECTS) );
     816           0 :     aNameList.push_back( aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUND) );
     817           0 : }
     818             : 
     819             : /*************************************************************************
     820             : |*
     821             : |* Create a list with pointer to presentation templates of a layout.
     822             : |* The list is owned by the caller!
     823             : |*
     824             : \************************************************************************/
     825             : 
     826           0 : void SdStyleSheetPool::CreateLayoutSheetList(const OUString& rLayoutName, SdStyleSheetVector& rLayoutSheets )
     827             : {
     828           0 :     OUString aLayoutNameWithSep(rLayoutName + SD_LT_SEPARATOR);
     829             : 
     830           0 :     SfxStyleSheetIterator aIter(this, SD_STYLE_FAMILY_MASTERPAGE);
     831           0 :     SfxStyleSheetBase* pSheet = aIter.First();
     832             : 
     833           0 :     while (pSheet)
     834             :     {
     835           0 :         if (pSheet->GetName().startsWith(aLayoutNameWithSep))
     836           0 :             rLayoutSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pSheet ) ) );
     837           0 :         pSheet = aIter.Next();
     838           0 :     }
     839           0 : }
     840             : 
     841             : /*************************************************************************
     842             : |*
     843             : |* Create pseudo style sheets if necessary
     844             : |*
     845             : \************************************************************************/
     846             : 
     847         255 : void SdStyleSheetPool::CreatePseudosIfNecessary()
     848             : {
     849         255 :     OUString aName;
     850         510 :     OUString aHelpFile;
     851         255 :     SfxStyleSheetBase* pSheet = NULL;
     852         255 :     SfxStyleSheetBase* pParent = NULL;
     853             : 
     854         255 :     sal_uInt16 nUsedMask = SFXSTYLEBIT_USED;
     855             : 
     856         255 :     aName = SD_RESSTR(STR_PSEUDOSHEET_TITLE);
     857         255 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     858             :     {
     859         252 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     860         252 :         pSheet->SetParent( OUString() );
     861         252 :         static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
     862             :     }
     863         255 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
     864             : 
     865         255 :     aName = SD_RESSTR(STR_PSEUDOSHEET_SUBTITLE);
     866         255 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     867             :     {
     868         252 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     869         252 :         pSheet->SetParent( OUString() );
     870         252 :         static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
     871             :     }
     872         255 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
     873             : 
     874         255 :     aName = SD_RESSTR(STR_PSEUDOSHEET_BACKGROUNDOBJECTS);
     875         255 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     876             :     {
     877         252 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     878         252 :         pSheet->SetParent( OUString() );
     879         252 :         static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
     880             :     }
     881         255 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
     882             : 
     883         255 :     aName = SD_RESSTR(STR_PSEUDOSHEET_BACKGROUND);
     884         255 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     885             :     {
     886         252 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     887         252 :         pSheet->SetParent( OUString() );
     888         252 :         static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
     889             :     }
     890         255 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
     891             : 
     892         255 :     aName = SD_RESSTR(STR_PSEUDOSHEET_NOTES);
     893         255 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     894             :     {
     895         252 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     896         252 :         pSheet->SetParent( OUString() );
     897         252 :         static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
     898             :     }
     899         255 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
     900             : 
     901         255 :     pParent = NULL;
     902         255 :     SetSearchMask(SD_STYLE_FAMILY_PSEUDO);
     903         255 :     aName = SD_RESSTR(STR_PSEUDOSHEET_OUTLINE);
     904        2550 :     for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     905             :     {
     906        2295 :         OUString aLevelName( aName + " " + OUString::number( nLevel ) );
     907             : 
     908        2295 :         if( (pSheet = Find(aLevelName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     909             :         {
     910        2268 :             pSheet = &Make(aLevelName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     911             : 
     912        2268 :             if (pSheet)
     913             :             {
     914        2268 :                 if (pParent)
     915        2016 :                     pSheet->SetParent(pParent->GetName());
     916        2268 :                 pParent = pSheet;
     917        2268 :                 static_cast<SfxStyleSheet*>(pSheet)->StartListening(*this);
     918             :             }
     919             :         }
     920        2295 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
     921        2550 :     }
     922         255 : }
     923             : 
     924             : /*************************************************************************
     925             : |*
     926             : |* Set the correct name in the program language to the standard styles
     927             : |*
     928             : \************************************************************************/
     929             : 
     930             : namespace
     931             : {
     932           0 : struct StyleSheetIsUserDefinedPredicate : svl::StyleSheetPredicate
     933             : {
     934           0 :     StyleSheetIsUserDefinedPredicate()
     935           0 :     {;}
     936             : 
     937           0 :     bool Check(const SfxStyleSheetBase& sheet) SAL_OVERRIDE
     938             :     {
     939           0 :         return sheet.IsUserDefined();
     940             :     }
     941             : };
     942             : }
     943             : 
     944           0 : void SdStyleSheetPool::UpdateStdNames()
     945             : {
     946           0 :     OUString aHelpFile;
     947           0 :     StyleSheetIsUserDefinedPredicate aPredicate;
     948           0 :     std::vector<SfxStyleSheetBase*> aEraseList;
     949           0 :     std::vector<unsigned> aUserDefinedStyles = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate);
     950           0 :     for (std::vector<unsigned>::const_iterator it = aUserDefinedStyles.begin();
     951           0 :             it != aUserDefinedStyles.end(); ++it)
     952             :     {
     953           0 :         SfxStyleSheetBase* pStyle = GetStyleSheetByPositionInIndex(*it).get();
     954             : 
     955           0 :         if( !pStyle->IsUserDefined() )
     956             :         {
     957           0 :             OUString aOldName   = pStyle->GetName();
     958           0 :             sal_uLong nHelpId   = pStyle->GetHelpId( aHelpFile );
     959           0 :             SfxStyleFamily eFam = pStyle->GetFamily();
     960             : 
     961           0 :             bool bHelpKnown = true;
     962           0 :             OUString aNewName;
     963           0 :             sal_uInt16 nNameId = 0;
     964           0 :             switch( nHelpId )
     965             :             {
     966           0 :                 case HID_STANDARD_STYLESHEET_NAME:  nNameId = STR_STANDARD_STYLESHEET_NAME; break;
     967           0 :                 case HID_POOLSHEET_OBJWITHARROW:    nNameId = STR_POOLSHEET_OBJWITHARROW;   break;
     968           0 :                 case HID_POOLSHEET_OBJWITHSHADOW:   nNameId = STR_POOLSHEET_OBJWITHSHADOW;  break;
     969           0 :                 case HID_POOLSHEET_OBJWITHOUTFILL:  nNameId = STR_POOLSHEET_OBJWITHOUTFILL; break;
     970           0 :                 case HID_POOLSHEET_OBJNOLINENOFILL: nNameId = STR_POOLSHEET_OBJNOLINENOFILL;break;
     971           0 :                 case HID_POOLSHEET_TEXT:            nNameId = STR_POOLSHEET_TEXT;           break;
     972           0 :                 case HID_POOLSHEET_TEXTBODY:        nNameId = STR_POOLSHEET_TEXTBODY;       break;
     973           0 :                 case HID_POOLSHEET_TEXTBODY_JUSTIFY:nNameId = STR_POOLSHEET_TEXTBODY_JUSTIFY;break;
     974           0 :                 case HID_POOLSHEET_TEXTBODY_INDENT: nNameId = STR_POOLSHEET_TEXTBODY_INDENT;break;
     975           0 :                 case HID_POOLSHEET_TITLE:           nNameId = STR_POOLSHEET_TITLE;          break;
     976           0 :                 case HID_POOLSHEET_TITLE1:          nNameId = STR_POOLSHEET_TITLE1;         break;
     977           0 :                 case HID_POOLSHEET_TITLE2:          nNameId = STR_POOLSHEET_TITLE2;         break;
     978           0 :                 case HID_POOLSHEET_HEADLINE:        nNameId = STR_POOLSHEET_HEADLINE;       break;
     979           0 :                 case HID_POOLSHEET_HEADLINE1:       nNameId = STR_POOLSHEET_HEADLINE1;      break;
     980           0 :                 case HID_POOLSHEET_HEADLINE2:       nNameId = STR_POOLSHEET_HEADLINE2;      break;
     981           0 :                 case HID_POOLSHEET_MEASURE:         nNameId = STR_POOLSHEET_MEASURE;        break;
     982             : 
     983           0 :                 case HID_PSEUDOSHEET_TITLE:         nNameId = STR_PSEUDOSHEET_TITLE;        break;
     984           0 :                 case HID_PSEUDOSHEET_SUBTITLE:      nNameId = STR_PSEUDOSHEET_SUBTITLE;     break;
     985             :                 case HID_PSEUDOSHEET_OUTLINE1:
     986             :                 case HID_PSEUDOSHEET_OUTLINE2:
     987             :                 case HID_PSEUDOSHEET_OUTLINE3:
     988             :                 case HID_PSEUDOSHEET_OUTLINE4:
     989             :                 case HID_PSEUDOSHEET_OUTLINE5:
     990             :                 case HID_PSEUDOSHEET_OUTLINE6:
     991             :                 case HID_PSEUDOSHEET_OUTLINE7:
     992             :                 case HID_PSEUDOSHEET_OUTLINE8:
     993           0 :                 case HID_PSEUDOSHEET_OUTLINE9:      nNameId = STR_PSEUDOSHEET_OUTLINE;      break;
     994           0 :                 case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_PSEUDOSHEET_BACKGROUNDOBJECTS; break;
     995           0 :                 case HID_PSEUDOSHEET_BACKGROUND:    nNameId = STR_PSEUDOSHEET_BACKGROUND;   break;
     996           0 :                 case HID_PSEUDOSHEET_NOTES:         nNameId = STR_PSEUDOSHEET_NOTES;        break;
     997             : 
     998           0 :                 case HID_SD_CELL_STYLE_DEFAULT:         nNameId = STR_STANDARD_STYLESHEET_NAME; break;
     999           0 :                 case HID_SD_CELL_STYLE_BANDED:          nNameId = STR_POOLSHEET_BANDED_CELL; break;
    1000           0 :                 case HID_SD_CELL_STYLE_HEADER:          nNameId = STR_POOLSHEET_HEADER; break;
    1001           0 :                 case HID_SD_CELL_STYLE_TOTAL:           nNameId = STR_POOLSHEET_TOTAL; break;
    1002           0 :                 case HID_SD_CELL_STYLE_FIRST_COLUMN:    nNameId = STR_POOLSHEET_FIRST_COLUMN; break;
    1003           0 :                 case HID_SD_CELL_STYLE_LAST_COLUMN:     nNameId = STR_POOLSHEET_LAST_COLUMN; break;
    1004             : 
    1005             :                 default:
    1006             :                     // 0 or wrong (old) HelpId
    1007           0 :                     bHelpKnown = false;
    1008             :             }
    1009           0 :             if( bHelpKnown )
    1010             :             {
    1011           0 :                 if( nNameId )
    1012             :                 {
    1013           0 :                     aNewName = SD_RESSTR( nNameId );
    1014           0 :                     if( nNameId == STR_PSEUDOSHEET_OUTLINE )
    1015             :                     {
    1016           0 :                         aNewName += " " + OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ) );
    1017             :                     }
    1018             :                 }
    1019             : 
    1020           0 :                 if( !aNewName.isEmpty() && aNewName != aOldName )
    1021             :                 {
    1022           0 :                     SfxStyleSheetBase* pSheetFound = Find( aNewName, eFam );
    1023             : 
    1024           0 :                     if ( !pSheetFound )
    1025             :                     {
    1026             :                         // Sheet does not yet exist: rename old sheet
    1027           0 :                         pStyle->SetName( aNewName );    // transform also parents
    1028             :                     }
    1029             :                     else
    1030             :                     {
    1031             :                         // Sheet does exist: old sheet has to be removed
    1032           0 :                         aEraseList.push_back( pStyle );
    1033             :                     }
    1034             :                 }
    1035           0 :             }
    1036             :         }
    1037             :     }
    1038             : 
    1039           0 :     if (!aEraseList.empty())
    1040             :     {
    1041             :         // styles that could not be renamed, must be removed
    1042           0 :         for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
    1043           0 :             Remove( aEraseList[ i ] );
    1044           0 :         Reindex();
    1045           0 :     }
    1046           0 : }
    1047             : 
    1048        3110 : void SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat)
    1049             : {
    1050        3110 :     rNumberFormat.SetBulletChar( 0x25CF );  // StarBats: 0xF000 + 34
    1051        3110 :     rNumberFormat.SetBulletRelSize(45);
    1052        3110 :     const short nLSpace = (i + 1) * 1200;
    1053        3110 :     rNumberFormat.SetAbsLSpace(nLSpace);
    1054        3110 :     short nFirstLineOffset = -600;
    1055             : 
    1056        3110 :     switch(i)
    1057             :     {
    1058             :         case 0:
    1059             :         {
    1060         311 :             nFirstLineOffset = -900;
    1061             :         }
    1062         311 :         break;
    1063             : 
    1064             :         case 1:
    1065             :         {
    1066         311 :             rNumberFormat.SetBulletChar( 0x2013 );  // StarBats: 0xF000 + 150
    1067         311 :             rNumberFormat.SetBulletRelSize(75);
    1068         311 :             nFirstLineOffset = -900;
    1069             :         }
    1070         311 :         break;
    1071             : 
    1072             :         case 2:
    1073             :         {
    1074         311 :             nFirstLineOffset = -800;
    1075             :         }
    1076         311 :         break;
    1077             : 
    1078             :         case 3:
    1079             :         {
    1080         311 :             rNumberFormat.SetBulletChar( 0x2013 );  // StarBats: 0xF000 + 150
    1081         311 :             rNumberFormat.SetBulletRelSize(75);
    1082             :         }
    1083         311 :         break;
    1084             :     }
    1085             : 
    1086        3110 :     rNumberFormat.SetFirstLineOffset(nFirstLineOffset);
    1087        3110 : }
    1088             : 
    1089             : // Set new SvxNumBulletItem for the respective style sheet
    1090        1240 : void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
    1091             :                                          vcl::Font& rBulletFont )
    1092             : {
    1093        1240 :     OUString aHelpFile;
    1094        1240 :     sal_uLong nHelpId = pSheet->GetHelpId( aHelpFile );
    1095        1240 :     SfxItemSet& rSet = pSheet->GetItemSet();
    1096             : 
    1097        1240 :     switch ( nHelpId )
    1098             :     {
    1099             :         case HID_STANDARD_STYLESHEET_NAME :
    1100             :         {
    1101             :             // Standard template
    1102         299 :             SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
    1103         299 :             aNumberFormat.SetBulletFont(&rBulletFont);
    1104         299 :             aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
    1105         299 :             aNumberFormat.SetBulletRelSize(45);
    1106         299 :             aNumberFormat.SetBulletColor(Color(COL_AUTO));
    1107         299 :             aNumberFormat.SetStart(1);
    1108         299 :             aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
    1109             : 
    1110         598 :             SvxNumRule aNumRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::BULLET_COLOR | SvxNumRuleFlags::CHAR_TEXT_DISTANCE, SVX_MAX_NUM, false);
    1111             : 
    1112        3289 :             for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
    1113             :             {
    1114        2990 :                 const short nLSpace = (i + 1) * 600;
    1115        2990 :                 aNumberFormat.SetAbsLSpace(nLSpace);
    1116        2990 :                 aNumberFormat.SetFirstLineOffset(-600);
    1117        2990 :                 aNumRule.SetLevel( i, aNumberFormat );
    1118             :             }
    1119             : 
    1120         299 :             rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
    1121         598 :             static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
    1122             :         }
    1123         299 :         break;
    1124             : 
    1125             :         case HID_PSEUDOSHEET_TITLE:
    1126             :             /* title gets same bullet as subtitle and not that page symbol anymore */
    1127             :         case HID_PSEUDOSHEET_SUBTITLE :
    1128             :         {
    1129             :             // Subtitle template
    1130         624 :             SvxNumRule* pDefaultRule = static_cast<const SvxNumBulletItem*>( rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule();
    1131             :             DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" );
    1132             : 
    1133         624 :             if(pDefaultRule)
    1134             :             {
    1135         624 :                 SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 10, false);
    1136        6864 :                 for(sal_uInt16 i=0; i < aNumRule.GetLevelCount(); i++)
    1137             :                 {
    1138        6240 :                     SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) );
    1139        6240 :                     aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
    1140             :                     // #i93908# clear suffix for bullet lists
    1141        6240 :                     aFrmt.SetPrefix(OUString());
    1142        6240 :                     aFrmt.SetSuffix(OUString());
    1143        6240 :                     aFrmt.SetStart(1);
    1144        6240 :                     aFrmt.SetBulletRelSize(45);
    1145        6240 :                     aFrmt.SetBulletChar( 0x25CF );  // StarBats: 0xF000 + 34
    1146        6240 :                     aFrmt.SetBulletFont(&rBulletFont);
    1147        6240 :                     aNumRule.SetLevel(i, aFrmt);
    1148        6240 :                 }
    1149             : 
    1150         624 :                 rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
    1151         624 :                 static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
    1152             :             }
    1153             :         }
    1154         624 :         break;
    1155             : 
    1156             :         case HID_PSEUDOSHEET_OUTLINE + 1 :
    1157             :         {
    1158             :             // Outline template
    1159         311 :             SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
    1160         311 :             aNumberFormat.SetBulletColor(Color(COL_AUTO));
    1161         311 :             aNumberFormat.SetStart(1);
    1162         311 :             aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
    1163             : 
    1164             :             SvxNumRule aNumRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::BULLET_COLOR |
    1165         622 :                                  SvxNumRuleFlags::CHAR_TEXT_DISTANCE | SvxNumRuleFlags::SYMBOL_ALIGNMENT,
    1166         622 :                                  SVX_MAX_NUM, false );
    1167        3421 :             for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
    1168             :             {
    1169        3110 :                 setDefaultOutlineNumberFormatBulletAndIndent(i, aNumberFormat);
    1170             : 
    1171        3110 :                 sal_uLong nFontSize = 20;
    1172        3110 :                 switch(i)
    1173             :                 {
    1174             :                     case 0:
    1175             :                     {
    1176         311 :                         nFontSize = 32;
    1177             :                     }
    1178         311 :                     break;
    1179             : 
    1180             :                     case 1:
    1181             :                     {
    1182         311 :                         nFontSize = 32;
    1183             :                     }
    1184         311 :                     break;
    1185             : 
    1186             :                     case 2:
    1187             :                     {
    1188         311 :                         nFontSize = 28;
    1189             :                     }
    1190         311 :                     break;
    1191             : 
    1192             :                     case 3:
    1193             :                     {
    1194         311 :                         nFontSize = 24;
    1195             :                     }
    1196         311 :                     break;
    1197             :                 }
    1198             : 
    1199        3110 :                 nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72);  // Pt --> 1/100 mm
    1200        3110 :                 rBulletFont.SetSize(Size(0,846));       // 24 pt
    1201        3110 :                 aNumberFormat.SetBulletFont(&rBulletFont);
    1202        3110 :                 aNumRule.SetLevel( i, aNumberFormat );
    1203             :             }
    1204             : 
    1205         311 :             rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
    1206         622 :             static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
    1207             :         }
    1208         311 :         break;
    1209        1240 :     }
    1210        1240 : }
    1211             : 
    1212             : /*************************************************************************
    1213             : |*
    1214             : |* Create standard bullet font (without size)
    1215             : |*
    1216             : \************************************************************************/
    1217             : 
    1218        1385 : vcl::Font SdStyleSheetPool::GetBulletFont()
    1219             : {
    1220        1385 :     vcl::Font aBulletFont( OUString( "StarSymbol" ), Size(0, 1000) );
    1221        1385 :     aBulletFont.SetCharSet(RTL_TEXTENCODING_UNICODE);
    1222        1385 :     aBulletFont.SetWeight(WEIGHT_NORMAL);
    1223        1385 :     aBulletFont.SetUnderline(UNDERLINE_NONE);
    1224        1385 :     aBulletFont.SetOverline(UNDERLINE_NONE);
    1225        1385 :     aBulletFont.SetStrikeout(STRIKEOUT_NONE);
    1226        1385 :     aBulletFont.SetItalic(ITALIC_NONE);
    1227        1385 :     aBulletFont.SetOutline(false);
    1228        1385 :     aBulletFont.SetShadow(false);
    1229        1385 :     aBulletFont.SetColor(Color(COL_AUTO));
    1230        1385 :     aBulletFont.SetTransparent(true);
    1231             : 
    1232        1385 :     return aBulletFont;
    1233             : }
    1234             : 
    1235         268 : void SdStyleSheetPool::AddStyleFamily( const SdPage* pPage )
    1236             : {
    1237         268 :     rtl::Reference< SfxStyleSheetPool > xPool( this );
    1238         268 :     maStyleFamilyMap[pPage] = new SdStyleFamily( xPool, pPage );
    1239         268 : }
    1240             : 
    1241         263 : void SdStyleSheetPool::RemoveStyleFamily( const SdPage* pPage )
    1242             : {
    1243         263 :     SdStyleFamilyMap::iterator iter( maStyleFamilyMap.find( pPage ) );
    1244         263 :     if( iter != maStyleFamilyMap.end() )
    1245             :     {
    1246         263 :         SdStyleFamilyRef xStyle( (*iter).second );
    1247         263 :         maStyleFamilyMap.erase( iter );
    1248             : 
    1249         263 :         if( xStyle.is() ) try
    1250             :         {
    1251         263 :             xStyle->dispose();
    1252             :         }
    1253           0 :         catch( Exception& )
    1254             :         {
    1255         263 :         }
    1256             :     }
    1257         263 : }
    1258             : 
    1259        4572 : void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeException)
    1260             : {
    1261        4572 :     if( mpDoc == NULL )
    1262           0 :         throw DisposedException();
    1263        4572 : }
    1264             : 
    1265             : // XServiceInfo
    1266           0 : OUString SAL_CALL SdStyleSheetPool::getImplementationName() throw(RuntimeException, std::exception)
    1267             : {
    1268           0 :     return OUString( "SdStyleSheetPool" );
    1269             : }
    1270             : 
    1271           0 : sal_Bool SAL_CALL SdStyleSheetPool::supportsService( const OUString& ServiceName ) throw(RuntimeException, std::exception)
    1272             : {
    1273           0 :     return cppu::supportsService(this, ServiceName);
    1274             : }
    1275             : 
    1276           0 : Sequence< OUString > SAL_CALL SdStyleSheetPool::getSupportedServiceNames() throw(RuntimeException, std::exception)
    1277             : {
    1278           0 :     OUString aStr("com.sun.star.style.StyleFamilies");
    1279           0 :     return Sequence< OUString >( &aStr, 1 );
    1280             : }
    1281             : 
    1282             : // XNameAccess
    1283        3265 : Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
    1284             : {
    1285        3265 :     throwIfDisposed();
    1286             : 
    1287        3265 :     if( mxGraphicFamily->getName() == aName )
    1288        1393 :         return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
    1289             : 
    1290        1872 :     if( mxCellFamily->getName() == aName )
    1291         107 :         return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
    1292             : 
    1293        1765 :     if( msTableFamilyName == aName )
    1294         277 :         return Any( mxTableFamily );
    1295             : 
    1296        1526 :     for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
    1297             :     {
    1298        1526 :         if( (*iter).second->getName() == aName )
    1299        1488 :             return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
    1300             :     }
    1301             : 
    1302           0 :     throw NoSuchElementException();
    1303             : }
    1304             : 
    1305           0 : Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames() throw(RuntimeException, std::exception)
    1306             : {
    1307           0 :     throwIfDisposed();
    1308             : 
    1309           0 :     Sequence< OUString > aNames( maStyleFamilyMap.size() + 3 );
    1310           0 :     OUString* pNames = aNames.getArray();
    1311             : 
    1312           0 :     *pNames++ = mxGraphicFamily->getName();
    1313           0 :     *pNames++ = mxCellFamily->getName();
    1314           0 :     *pNames++ = msTableFamilyName;
    1315             : 
    1316           0 :     for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
    1317             :     {
    1318           0 :         *pNames++ = (*iter).second->getName();
    1319             :     }
    1320             : 
    1321           0 :     return aNames;
    1322             : }
    1323             : 
    1324        1307 : sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName ) throw(RuntimeException, std::exception)
    1325             : {
    1326        1307 :     throwIfDisposed();
    1327             : 
    1328        1307 :     if( mxGraphicFamily->getName() == aName )
    1329          44 :         return sal_True;
    1330             : 
    1331        1263 :     if( mxCellFamily->getName() == aName )
    1332          15 :         return sal_True;
    1333             : 
    1334        1248 :     if( msTableFamilyName == aName )
    1335           0 :         return sal_True;
    1336             : 
    1337        1957 :     for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
    1338             :     {
    1339        1279 :         if( (*iter).second->getName() == aName )
    1340         570 :             return sal_True;
    1341             :     }
    1342             : 
    1343         678 :     return sal_False;
    1344             : }
    1345             : 
    1346             : // XElementAccess
    1347             : 
    1348           0 : Type SAL_CALL SdStyleSheetPool::getElementType() throw(RuntimeException, std::exception)
    1349             : {
    1350           0 :     throwIfDisposed();
    1351             : 
    1352           0 :     return cppu::UnoType<XNameAccess>::get();
    1353             : }
    1354             : 
    1355           0 : sal_Bool SAL_CALL SdStyleSheetPool::hasElements() throw(RuntimeException, std::exception)
    1356             : {
    1357           0 :     return sal_True;
    1358             : }
    1359             : 
    1360             : // XIndexAccess
    1361             : 
    1362           0 : sal_Int32 SAL_CALL SdStyleSheetPool::getCount() throw(RuntimeException, std::exception)
    1363             : {
    1364           0 :     throwIfDisposed();
    1365             : 
    1366           0 :     return maStyleFamilyMap.size() + 3;
    1367             : }
    1368             : 
    1369           0 : Any SAL_CALL SdStyleSheetPool::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
    1370             : {
    1371           0 :     switch( Index )
    1372             :     {
    1373             :     case 0:
    1374           0 :         return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
    1375             : 
    1376             :     case 1:
    1377           0 :         return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
    1378             : 
    1379             :     case 2:
    1380           0 :         return Any( mxTableFamily );
    1381             : 
    1382             :     default:
    1383             :         {
    1384           0 :             Index -= 3;
    1385           0 :             if( (Index < 0) || (Index >= sal::static_int_cast<sal_Int32>(maStyleFamilyMap.size())) )
    1386           0 :                 throw IndexOutOfBoundsException();
    1387           0 :             SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() );
    1388           0 :             while( Index-- )
    1389           0 :                 ++iter;
    1390             : 
    1391           0 :             return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
    1392             :         }
    1393             :     }
    1394             : }
    1395             : 
    1396             : // XComponent
    1397             : 
    1398         315 : void SAL_CALL SdStyleSheetPool::dispose() throw (RuntimeException, std::exception)
    1399             : {
    1400         315 :     if( mpDoc )
    1401             :     {
    1402         315 :         mxGraphicFamily->dispose();
    1403         315 :         mxGraphicFamily.clear();
    1404         315 :         mxCellFamily->dispose();
    1405         315 :         mxCellFamily.clear();
    1406             : 
    1407         315 :         Reference< XComponent > xComp( mxTableFamily, UNO_QUERY );
    1408         315 :         if( xComp.is() )
    1409         315 :             xComp->dispose();
    1410         315 :         mxTableFamily = 0;
    1411             : 
    1412         630 :         SdStyleFamilyMap aTempMap;
    1413         315 :         aTempMap.swap( maStyleFamilyMap );
    1414             : 
    1415         315 :         for( SdStyleFamilyMap::iterator iter( aTempMap.begin() ); iter != aTempMap.end(); ++iter ) try
    1416             :         {
    1417           0 :             (*iter).second->dispose();
    1418             :         }
    1419           0 :         catch( Exception& )
    1420             :         {
    1421             :         }
    1422             : 
    1423         315 :         mpDoc = 0;
    1424             : 
    1425         630 :         Clear();
    1426             :     }
    1427         315 : }
    1428             : 
    1429           0 : void SAL_CALL SdStyleSheetPool::addEventListener( const Reference< XEventListener >& /*xListener*/ ) throw (RuntimeException, std::exception)
    1430             : {
    1431           0 : }
    1432             : 
    1433           0 : void SAL_CALL SdStyleSheetPool::removeEventListener( const Reference< XEventListener >& /*aListener*/ ) throw (RuntimeException, std::exception)
    1434             : {
    1435           0 : }
    1436             : 
    1437           0 : SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
    1438             : {
    1439           0 :     SdStyleSheetVector aResult;
    1440             : 
    1441           0 :     const size_t nListenerCount = pSheet->GetSizeOfVector();
    1442           0 :     for (size_t n = 0; n < nListenerCount; ++n)
    1443             :     {
    1444           0 :         SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
    1445           0 :         if(pChild && pChild->GetParent() == pSheet->GetName())
    1446             :         {
    1447           0 :             aResult.push_back( SdStyleSheetRef( pChild ) );
    1448             :         }
    1449             :     }
    1450             : 
    1451           0 :     return aResult;
    1452             : }
    1453             : 
    1454       26839 : void SAL_CALL SdStyleSheetPool::acquire() throw ()
    1455             : {
    1456       26839 :     SdStyleSheetPoolBase::acquire();
    1457       26839 : }
    1458             : 
    1459       26424 : void SAL_CALL SdStyleSheetPool::release() throw ()
    1460             : {
    1461       26424 :     SdStyleSheetPoolBase::release();
    1462       26490 : }
    1463             : 
    1464             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11