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

Generated by: LCOV version 1.10