LCOV - code coverage report
Current view: top level - sd/source/core - stlpool.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 753 0.0 %
Date: 2014-04-14 Functions: 0 53 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      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           0 : SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pDocument)
     106             : :   SdStyleSheetPoolBase( _rPool )
     107             : ,   mpActualStyleSheet(NULL)
     108           0 : ,   mpDoc(pDocument)
     109             : {
     110           0 :     if( mpDoc )
     111             :     {
     112           0 :         rtl::Reference< SfxStyleSheetPool > xPool( this );
     113             : 
     114             :         // create graphics family
     115           0 :         mxGraphicFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_GRAPHICS );
     116           0 :         mxCellFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_CELL );
     117             : 
     118           0 :         mxTableFamily = sdr::table::CreateTableDesignFamily();
     119           0 :         Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
     120           0 :         if( xNamed.is() )
     121           0 :             msTableFamilyName = xNamed->getName();
     122             : 
     123             :         // create presentation families, one for each master page
     124           0 :         const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD);
     125           0 :         for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
     126           0 :             AddStyleFamily( mpDoc->GetMasterSdPage(nPage,PK_STANDARD) );
     127             : 
     128             :     }
     129           0 : }
     130             : 
     131           0 : SdStyleSheetPool::~SdStyleSheetPool()
     132             : {
     133             :     DBG_ASSERT( mpDoc == NULL, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
     134           0 : }
     135             : 
     136             : 
     137             : 
     138           0 : SfxStyleSheetBase* SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 _nMask )
     139             : {
     140           0 :     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           0 : void SdStyleSheetPool::CreateOutlineSheetList (const OUString& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles)
     169             : {
     170           0 :     OUString aName(rLayoutName);
     171           0 :     aName += SD_LT_SEPARATOR;
     172           0 :     aName += SD_RESSTR(STR_LAYOUT_OUTLINE);
     173             : 
     174           0 :     for (sal_Int32 nSheet = 1; nSheet < 10; nSheet++)
     175             :     {
     176           0 :         OUString aFullName(aName + " " + OUString::number( nSheet ) );
     177           0 :         SfxStyleSheetBase* pSheet = Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
     178             : 
     179           0 :         if (pSheet)
     180           0 :             rOutlineStyles.push_back(pSheet);
     181           0 :     }
     182           0 : }
     183             : 
     184             : /*************************************************************************
     185             : |*
     186             : |* Create style sheets with default values for the named presentation layout
     187             : |*
     188             : \************************************************************************/
     189             : 
     190           0 : void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, sal_Bool bCheck /*= sal_False*/ )
     191             : {
     192           0 :     const sal_uInt16 nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
     193             : 
     194             :     (void)bCheck;
     195           0 :     sal_Bool bCreated = sal_False;
     196             : 
     197           0 :     SfxStyleSheetBase* pSheet = NULL;
     198             : 
     199           0 :     OUString aPrefix(rLayoutName + SD_LT_SEPARATOR);
     200             : 
     201           0 :     Font aLatinFont, aCJKFont, aCTLFont;
     202             : 
     203           0 :     mpDoc->getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
     204             : 
     205             :     // Font for title and outline
     206           0 :     SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
     207           0 :                               aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
     208             : 
     209           0 :     SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
     210           0 :                                  aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
     211             : 
     212           0 :     SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
     213           0 :                                  aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
     214             : 
     215           0 :     Font aBulletFont( GetBulletFont() );
     216             : 
     217             :     /**************************************************************************
     218             :     * outline levels
     219             :     **************************************************************************/
     220           0 :     OUString aName(SD_RESSTR(STR_LAYOUT_OUTLINE));
     221           0 :     OUString aHelpFile;
     222             : 
     223           0 :     SfxStyleSheetBase* pParent = NULL;
     224           0 :     SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
     225           0 :     SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE );
     226             : 
     227           0 :     for( sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     228             :     {
     229           0 :         OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) ) ;
     230             : 
     231           0 :         if (!Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE))
     232             :         {
     233           0 :             bCreated = sal_True;
     234           0 :             pSheet = &Make(aLevelName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     235           0 :             pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
     236             : 
     237           0 :             pSheet->SetParent( OUString() );
     238             : 
     239             :             // attributing for level 1, the others levels inherit
     240           0 :             if (nLevel == 1)
     241             :             {
     242           0 :                 SfxItemSet&     rSet = pSheet->GetItemSet();
     243             : 
     244           0 :                 rSet.Put(aSvxFontItem);
     245           0 :                 rSet.Put(aSvxFontItemCJK);
     246           0 :                 rSet.Put(aSvxFontItemCTL);
     247           0 :                 rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     248           0 :                 rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     249           0 :                 rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     250           0 :                 rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     251           0 :                 rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     252           0 :                 rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     253           0 :                 rSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
     254           0 :                 rSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
     255           0 :                 rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
     256           0 :                 rSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) );
     257           0 :                 rSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) );
     258           0 :                 rSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) );
     259           0 :                 rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     260           0 :                 rSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
     261           0 :                 rSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR) );
     262           0 :                 rSet.Put( XLineStyleItem(XLINE_NONE) );
     263           0 :                 rSet.Put( XFillStyleItem(XFILL_NONE) );
     264           0 :                 rSet.Put( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
     265           0 :                 rSet.Put( SdrTextAutoGrowHeightItem(false) );
     266             :                 // #i16874# enable kerning by default but only for new documents
     267           0 :                 rSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     268             : 
     269           0 :                 if( nLevel == 1 )
     270             :                 {
     271           0 :                     Font f( GetBulletFont() );
     272           0 :                     PutNumBulletItem( pSheet, f );
     273             :                 }
     274             :             }
     275             : 
     276           0 :             sal_uLong nFontSize = 20;
     277           0 :             sal_uInt16 nLower = 100;
     278             : 
     279           0 :             switch (nLevel)
     280             :             {
     281             :                 case 1:
     282             :                 {
     283           0 :                     nFontSize = 32;
     284           0 :                     nLower = 500;
     285             :                 }
     286           0 :                 break;
     287             : 
     288             :                 case 2:
     289             :                 {
     290           0 :                     nFontSize = 28;
     291           0 :                     nLower = 400;
     292             :                 }
     293           0 :                 break;
     294             : 
     295             :                 case 3:
     296             :                 {
     297           0 :                     nFontSize = 24;
     298           0 :                     nLower = 300;
     299             :                 }
     300           0 :                 break;
     301             : 
     302             :                 case 4:
     303             :                 {
     304           0 :                     nLower = 200;
     305             :                 }
     306           0 :                 break;
     307             :             }
     308             : 
     309             :             // FontSize
     310           0 :             nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72);  // Pt --> 1/100 mm
     311           0 :             SfxItemSet& rOutlineSet = pSheet->GetItemSet();
     312           0 :             rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT ) );
     313           0 :             rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CJK ) );
     314           0 :             rOutlineSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( nFontSize ), 100, EE_CHAR_FONTHEIGHT_CTL ) );
     315             : 
     316             :             // Line distance (downwards). Stuff around here cleaned up in i35937
     317           0 :             aSvxULSpaceItem.SetLower(nLower);
     318           0 :             pSheet->GetItemSet().Put(aSvxULSpaceItem);
     319             :         }
     320           0 :     }
     321             : 
     322             :     // if we created outline styles, we need to chain them
     323           0 :     if( bCreated )
     324             :     {
     325           0 :         pParent = NULL;
     326           0 :         for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     327             :         {
     328           0 :             OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) );
     329             : 
     330           0 :             pSheet = Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE);
     331             : 
     332             :             DBG_ASSERT( pSheet, "missing layout style!");
     333             : 
     334           0 :             if( pSheet )
     335             :             {
     336           0 :                 if (pParent)
     337           0 :                     pSheet->SetParent(pParent->GetName());
     338           0 :                 pParent = pSheet;
     339             :             }
     340           0 :         }
     341             :     }
     342             : 
     343             :     /**************************************************************************
     344             :     * Title
     345             :     **************************************************************************/
     346           0 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_TITLE);
     347             : 
     348           0 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     349             :     {
     350           0 :         bCreated = sal_True;
     351             : 
     352           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     353           0 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
     354           0 :         pSheet->SetParent( OUString() );
     355           0 :         SfxItemSet& rTitleSet = pSheet->GetItemSet();
     356           0 :         rTitleSet.Put(XLineStyleItem(XLINE_NONE));
     357           0 :         rTitleSet.Put(XFillStyleItem(XFILL_NONE));
     358           0 :         rTitleSet.Put(aSvxFontItem);
     359           0 :         rTitleSet.Put(aSvxFontItemCJK);
     360           0 :         rTitleSet.Put(aSvxFontItemCTL);
     361           0 :         rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     362           0 :         rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     363           0 :         rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     364           0 :         rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     365           0 :         rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     366           0 :         rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     367           0 :         rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT ) );                 // 44 pt
     368           0 :         rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK ) );                 // 44 pt
     369           0 :         rTitleSet.Put(SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1552 ), 100, EE_CHAR_FONTHEIGHT_CTL ) );                   // 44 pt
     370           0 :         rTitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
     371           0 :         rTitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
     372           0 :         rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
     373           0 :         rTitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
     374           0 :         rTitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
     375           0 :         rTitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
     376           0 :         rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     377           0 :         rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
     378           0 :         rTitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
     379           0 :         rTitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
     380           0 :         rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
     381             :         // #i16874# enable kerning by default but only for new documents
     382           0 :         rTitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     383             : 
     384           0 :         aBulletFont.SetSize(Size(0,1552));                  // 44 pt
     385           0 :         PutNumBulletItem( pSheet, aBulletFont );
     386             :     }
     387             : 
     388             :     /**************************************************************************
     389             :     * Subtitle
     390             :     **************************************************************************/
     391           0 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_SUBTITLE);
     392             : 
     393           0 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     394             :     {
     395           0 :         bCreated = sal_True;
     396             : 
     397           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     398           0 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
     399           0 :         pSheet->SetParent( OUString() );
     400           0 :         SfxItemSet& rSubtitleSet = pSheet->GetItemSet();
     401           0 :         rSubtitleSet.Put(XLineStyleItem(XLINE_NONE));
     402           0 :         rSubtitleSet.Put(XFillStyleItem(XFILL_NONE));
     403           0 :         rSubtitleSet.Put(aSvxFontItem);
     404           0 :         rSubtitleSet.Put(aSvxFontItemCJK);
     405           0 :         rSubtitleSet.Put(aSvxFontItemCTL);
     406           0 :         rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     407           0 :         rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     408           0 :         rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     409           0 :         rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     410           0 :         rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     411           0 :         rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     412           0 :         rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT ) );     // 32 pt
     413           0 :         rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 32 pt
     414           0 :         rSubtitleSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1129 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 32 pt
     415           0 :         rSubtitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
     416           0 :         rSubtitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
     417           0 :         rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
     418           0 :         rSubtitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ));
     419           0 :         rSubtitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW ));
     420           0 :         rSubtitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE ));
     421           0 :         rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     422           0 :         rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
     423           0 :         rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
     424           0 :         rSubtitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
     425           0 :         rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
     426             :         // #i16874# enable kerning by default but only for new documents
     427           0 :         rSubtitleSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     428           0 :         aSvxLRSpaceItem.SetTxtLeft(0);
     429           0 :         rSubtitleSet.Put(aSvxLRSpaceItem);
     430             : 
     431           0 :         Font aTmpFont( GetBulletFont() );
     432           0 :         aTmpFont.SetSize(Size(0, 1129));        // 32 pt
     433           0 :         PutNumBulletItem( pSheet, aTmpFont );
     434             :     }
     435             : 
     436             :     /**************************************************************************
     437             :     * Notes
     438             :     **************************************************************************/
     439           0 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_NOTES);
     440             : 
     441           0 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     442             :     {
     443           0 :         bCreated = sal_True;
     444             : 
     445           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     446           0 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
     447           0 :         pSheet->SetParent( OUString() );
     448           0 :         SfxItemSet& rNotesSet = pSheet->GetItemSet();
     449           0 :         rNotesSet.Put(XLineStyleItem(XLINE_NONE));
     450           0 :         rNotesSet.Put(XFillStyleItem(XFILL_NONE));
     451           0 :         rNotesSet.Put(aSvxFontItem);
     452           0 :         rNotesSet.Put(aSvxFontItemCJK);
     453           0 :         rNotesSet.Put(aSvxFontItemCTL);
     454           0 :         rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
     455           0 :         rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
     456           0 :         rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
     457           0 :         rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
     458           0 :         rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
     459           0 :         rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
     460           0 :         rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT ) );     // 20 pt
     461           0 :         rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 20 pt
     462           0 :         rNotesSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 705 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 20 pt
     463           0 :         rNotesSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
     464           0 :         rNotesSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
     465           0 :         rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
     466           0 :         rNotesSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) );
     467           0 :         rNotesSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) );
     468           0 :         rNotesSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) );
     469           0 :         rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
     470           0 :         rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
     471           0 :         rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) );
     472           0 :         rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE  ) );
     473             :         // #i16874# enable kerning by default but only for new documents
     474           0 :         rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     475             : 
     476             : /* #i35937# */
     477             : 
     478             :     }
     479             : 
     480             :     /**************************************************************************
     481             :     * Background objects
     482             :     **************************************************************************/
     483           0 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUNDOBJECTS);
     484             : 
     485           0 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     486             :     {
     487           0 :         bCreated = sal_True;
     488             : 
     489           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     490           0 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
     491           0 :         pSheet->SetParent( OUString() );
     492           0 :         SfxItemSet& rBackgroundObjectsSet = pSheet->GetItemSet();
     493           0 :         rBackgroundObjectsSet.Put(SdrShadowItem(false));
     494           0 :         rBackgroundObjectsSet.Put(SdrShadowColorItem(Color(COL_GRAY)));
     495           0 :         rBackgroundObjectsSet.Put(SdrShadowXDistItem(200)); // 3 mm shadow distance
     496           0 :         rBackgroundObjectsSet.Put(SdrShadowYDistItem(200));
     497             :         // #i16874# enable kerning by default but only for new documents
     498           0 :         rBackgroundObjectsSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     499           0 :         rBackgroundObjectsSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
     500             :     }
     501             : 
     502             :     /**************************************************************************
     503             :     * Background
     504             :     **************************************************************************/
     505           0 :     aName = aPrefix + SD_RESSTR(STR_LAYOUT_BACKGROUND);
     506             : 
     507           0 :     if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
     508             :     {
     509           0 :         bCreated = sal_True;
     510             : 
     511           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
     512           0 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
     513           0 :         pSheet->SetParent( OUString() );
     514           0 :         SfxItemSet& rBackgroundSet = pSheet->GetItemSet();
     515           0 :         rBackgroundSet.Put(XLineStyleItem(XLINE_NONE));
     516           0 :         rBackgroundSet.Put(XFillStyleItem(XFILL_NONE));
     517             :         // #i16874# enable kerning by default but only for new documents
     518           0 :         rBackgroundSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
     519             :     }
     520             : 
     521           0 :     DBG_ASSERT( !bCheck || !bCreated, "missing layout style sheets detected!" );
     522           0 : }
     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           0 : void SdStyleSheetPool::CreatePseudosIfNecessary()
     850             : {
     851           0 :     OUString aName;
     852           0 :     OUString aHelpFile;
     853           0 :     SfxStyleSheetBase* pSheet = NULL;
     854           0 :     SfxStyleSheetBase* pParent = NULL;
     855             : 
     856           0 :     sal_uInt16 nUsedMask = SFXSTYLEBIT_USED;
     857             : 
     858           0 :     aName = SD_RESSTR(STR_PSEUDOSHEET_TITLE);
     859           0 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     860             :     {
     861           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     862           0 :         pSheet->SetParent( OUString() );
     863           0 :         ((SfxStyleSheet*)pSheet)->StartListening(*this);
     864             :     }
     865           0 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
     866             : 
     867           0 :     aName = SD_RESSTR(STR_PSEUDOSHEET_SUBTITLE);
     868           0 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     869             :     {
     870           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     871           0 :         pSheet->SetParent( OUString() );
     872           0 :         ((SfxStyleSheet*)pSheet)->StartListening(*this);
     873             :     }
     874           0 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
     875             : 
     876           0 :     aName = SD_RESSTR(STR_PSEUDOSHEET_BACKGROUNDOBJECTS);
     877           0 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     878             :     {
     879           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     880           0 :         pSheet->SetParent( OUString() );
     881           0 :         ((SfxStyleSheet*)pSheet)->StartListening(*this);
     882             :     }
     883           0 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
     884             : 
     885           0 :     aName = SD_RESSTR(STR_PSEUDOSHEET_BACKGROUND);
     886           0 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     887             :     {
     888           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     889           0 :         pSheet->SetParent( OUString() );
     890           0 :         ((SfxStyleSheet*)pSheet)->StartListening(*this);
     891             :     }
     892           0 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
     893             : 
     894           0 :     aName = SD_RESSTR(STR_PSEUDOSHEET_NOTES);
     895           0 :     if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     896             :     {
     897           0 :         pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     898           0 :         pSheet->SetParent( OUString() );
     899           0 :         ((SfxStyleSheet*)pSheet)->StartListening(*this);
     900             :     }
     901           0 :     pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
     902             : 
     903           0 :     pParent = NULL;
     904           0 :     SetSearchMask(SD_STYLE_FAMILY_PSEUDO);
     905           0 :     aName = SD_RESSTR(STR_PSEUDOSHEET_OUTLINE);
     906           0 :     for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++)
     907             :     {
     908           0 :         OUString aLevelName( aName + " " + OUString::number( nLevel ) );
     909             : 
     910           0 :         if( (pSheet = Find(aLevelName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
     911             :         {
     912           0 :             pSheet = &Make(aLevelName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
     913             : 
     914           0 :             if (pSheet)
     915             :             {
     916           0 :                 if (pParent)
     917           0 :                     pSheet->SetParent(pParent->GetName());
     918           0 :                 pParent = pSheet;
     919           0 :                 ((SfxStyleSheet*)pSheet)->StartListening(*this);
     920             :             }
     921             :         }
     922           0 :         pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
     923           0 :     }
     924           0 : }
     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           0 : void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
    1053             :                                          Font& rBulletFont )
    1054             : {
    1055           0 :     OUString aHelpFile;
    1056           0 :     sal_uLong nHelpId = pSheet->GetHelpId( aHelpFile );
    1057           0 :     SfxItemSet& rSet = pSheet->GetItemSet();
    1058             : 
    1059           0 :     switch ( nHelpId )
    1060             :     {
    1061             :         case HID_STANDARD_STYLESHEET_NAME :
    1062             :         {
    1063             :             // Standard template
    1064           0 :             SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
    1065           0 :             aNumberFormat.SetBulletFont(&rBulletFont);
    1066           0 :             aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
    1067           0 :             aNumberFormat.SetBulletRelSize(45);
    1068           0 :             aNumberFormat.SetBulletColor(Color(COL_AUTO));
    1069           0 :             aNumberFormat.SetStart(1);
    1070           0 :             aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
    1071             : 
    1072           0 :             SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM, false);
    1073             : 
    1074           0 :             for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
    1075             :             {
    1076           0 :                 const short nLSpace = (i + 1) * 600;
    1077           0 :                 aNumberFormat.SetLSpace(nLSpace);
    1078           0 :                 aNumberFormat.SetAbsLSpace(nLSpace);
    1079           0 :                 aNumberFormat.SetFirstLineOffset(-600);
    1080           0 :                 aNumRule.SetLevel( i, aNumberFormat );
    1081             :             }
    1082             : 
    1083           0 :             rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
    1084           0 :             ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
    1085             :         }
    1086           0 :         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           0 :             SvxNumRule* pDefaultRule = ((SvxNumBulletItem*) rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule();
    1094             :             DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" );
    1095             : 
    1096           0 :             if(pDefaultRule)
    1097             :             {
    1098           0 :                 SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 10, false);
    1099           0 :                 for(sal_uInt16 i=0; i < aNumRule.GetLevelCount(); i++)
    1100             :                 {
    1101           0 :                     SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) );
    1102           0 :                     aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
    1103             :                     // #i93908# clear suffix for bullet lists
    1104           0 :                     aFrmt.SetPrefix(OUString());
    1105           0 :                     aFrmt.SetSuffix(OUString());
    1106           0 :                     aFrmt.SetStart(1);
    1107           0 :                     aFrmt.SetBulletRelSize(45);
    1108           0 :                     aFrmt.SetBulletChar( 0x25CF );  // StarBats: 0xF000 + 34
    1109           0 :                     aFrmt.SetBulletFont(&rBulletFont);
    1110           0 :                     aNumRule.SetLevel(i, aFrmt);
    1111           0 :                 }
    1112             : 
    1113           0 :                 rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
    1114           0 :                 ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
    1115             :             }
    1116             :         }
    1117           0 :         break;
    1118             : 
    1119             :         case HID_PSEUDOSHEET_OUTLINE + 1 :
    1120             :         {
    1121             :             // Outline template
    1122           0 :             SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
    1123           0 :             aNumberFormat.SetBulletColor(Color(COL_AUTO));
    1124           0 :             aNumberFormat.SetStart(1);
    1125           0 :             aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
    1126             : 
    1127             :             SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,
    1128           0 :                                  SVX_MAX_NUM, false );
    1129           0 :             for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
    1130             :             {
    1131           0 :                 aNumberFormat.SetBulletChar( 0x25CF );  // StarBats: 0xF000 + 34
    1132           0 :                 aNumberFormat.SetBulletRelSize(45);
    1133           0 :                 const short nLSpace = (i + 1) * 1200;
    1134           0 :                 aNumberFormat.SetLSpace(nLSpace);
    1135           0 :                 aNumberFormat.SetAbsLSpace(nLSpace);
    1136           0 :                 short nFirstLineOffset = -600;
    1137             : 
    1138           0 :                 sal_uLong nFontSize = 20;
    1139           0 :                 switch(i)
    1140             :                 {
    1141             :                     case 0:
    1142             :                     {
    1143           0 :                         nFontSize = 32;
    1144           0 :                         nFirstLineOffset = -900;
    1145             :                     }
    1146           0 :                     break;
    1147             : 
    1148             :                     case 1:
    1149             :                     {
    1150           0 :                         aNumberFormat.SetBulletChar( 0x2013 );  // StarBats: 0xF000 + 150
    1151           0 :                         aNumberFormat.SetBulletRelSize(75);
    1152           0 :                         nFontSize = 32;
    1153           0 :                         nFirstLineOffset = -900;
    1154             :                     }
    1155           0 :                     break;
    1156             : 
    1157             :                     case 2:
    1158             :                     {
    1159           0 :                         nFontSize = 28;
    1160           0 :                         nFirstLineOffset = -800;
    1161             :                     }
    1162           0 :                     break;
    1163             : 
    1164             :                     case 3:
    1165             :                     {
    1166           0 :                         aNumberFormat.SetBulletChar( 0x2013 );  // StarBats: 0xF000 + 150
    1167           0 :                         aNumberFormat.SetBulletRelSize(75);
    1168           0 :                         nFontSize = 24;
    1169             :                     }
    1170           0 :                     break;
    1171             :                 }
    1172             : 
    1173           0 :                 aNumberFormat.SetFirstLineOffset(nFirstLineOffset);
    1174           0 :                 nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72);  // Pt --> 1/100 mm
    1175           0 :                 rBulletFont.SetSize(Size(0,846));       // 24 pt
    1176           0 :                 aNumberFormat.SetBulletFont(&rBulletFont);
    1177           0 :                 aNumRule.SetLevel( i, aNumberFormat );
    1178             :             }
    1179             : 
    1180           0 :             rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
    1181           0 :             ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
    1182             :         }
    1183           0 :         break;
    1184           0 :     }
    1185           0 : }
    1186             : 
    1187             : /*************************************************************************
    1188             : |*
    1189             : |* Create standard bullet font (without size)
    1190             : |*
    1191             : \************************************************************************/
    1192             : 
    1193           0 : Font SdStyleSheetPool::GetBulletFont() const
    1194             : {
    1195           0 :     Font aBulletFont( OUString( "StarSymbol" ), Size(0, 1000) );
    1196           0 :     aBulletFont.SetCharSet(RTL_TEXTENCODING_UNICODE);
    1197           0 :     aBulletFont.SetWeight(WEIGHT_NORMAL);
    1198           0 :     aBulletFont.SetUnderline(UNDERLINE_NONE);
    1199           0 :     aBulletFont.SetOverline(UNDERLINE_NONE);
    1200           0 :     aBulletFont.SetStrikeout(STRIKEOUT_NONE);
    1201           0 :     aBulletFont.SetItalic(ITALIC_NONE);
    1202           0 :     aBulletFont.SetOutline(false);
    1203           0 :     aBulletFont.SetShadow(false);
    1204           0 :     aBulletFont.SetColor(Color(COL_AUTO));
    1205           0 :     aBulletFont.SetTransparent(true);
    1206             : 
    1207           0 :     return aBulletFont;
    1208             : }
    1209             : 
    1210             : 
    1211             : 
    1212           0 : void SdStyleSheetPool::AddStyleFamily( const SdPage* pPage )
    1213             : {
    1214           0 :     rtl::Reference< SfxStyleSheetPool > xPool( this );
    1215           0 :     maStyleFamilyMap[pPage] = new SdStyleFamily( xPool, pPage );
    1216           0 : }
    1217             : 
    1218             : 
    1219             : 
    1220           0 : void SdStyleSheetPool::RemoveStyleFamily( const SdPage* pPage )
    1221             : {
    1222           0 :     SdStyleFamilyMap::iterator iter( maStyleFamilyMap.find( pPage ) );
    1223           0 :     if( iter != maStyleFamilyMap.end() )
    1224             :     {
    1225           0 :         SdStyleFamilyRef xStyle( (*iter).second );
    1226           0 :         maStyleFamilyMap.erase( iter );
    1227             : 
    1228           0 :         if( xStyle.is() ) try
    1229             :         {
    1230           0 :             xStyle->dispose();
    1231             :         }
    1232           0 :         catch( Exception& )
    1233             :         {
    1234           0 :         }
    1235             :     }
    1236           0 : }
    1237             : 
    1238             : 
    1239             : 
    1240           0 : void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeException)
    1241             : {
    1242           0 :     if( mpDoc == NULL )
    1243           0 :         throw DisposedException();
    1244           0 : }
    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           0 : Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
    1265             : {
    1266           0 :     throwIfDisposed();
    1267             : 
    1268           0 :     if( mxGraphicFamily->getName() == aName )
    1269           0 :         return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
    1270             : 
    1271           0 :     if( mxCellFamily->getName() == aName )
    1272           0 :         return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
    1273             : 
    1274           0 :     if( msTableFamilyName == aName )
    1275           0 :         return Any( mxTableFamily );
    1276             : 
    1277           0 :     for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
    1278             :     {
    1279           0 :         if( (*iter).second->getName() == aName )
    1280           0 :             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           0 : sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName ) throw(RuntimeException, std::exception)
    1310             : {
    1311           0 :     throwIfDisposed();
    1312             : 
    1313           0 :     if( mxGraphicFamily->getName() == aName )
    1314           0 :         return sal_True;
    1315             : 
    1316           0 :     if( mxCellFamily->getName() == aName )
    1317           0 :         return sal_True;
    1318             : 
    1319           0 :     if( msTableFamilyName == aName )
    1320           0 :         return sal_True;
    1321             : 
    1322           0 :     for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
    1323             :     {
    1324           0 :         if( (*iter).second->getName() == aName )
    1325           0 :             return sal_True;
    1326             :     }
    1327             : 
    1328           0 :     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           0 : void SAL_CALL SdStyleSheetPool::dispose() throw (RuntimeException, std::exception)
    1394             : {
    1395           0 :     if( mpDoc )
    1396             :     {
    1397           0 :         mxGraphicFamily->dispose();
    1398           0 :         mxGraphicFamily.clear();
    1399           0 :         mxCellFamily->dispose();
    1400           0 :         mxCellFamily.clear();
    1401             : 
    1402           0 :         Reference< XComponent > xComp( mxTableFamily, UNO_QUERY );
    1403           0 :         if( xComp.is() )
    1404           0 :             xComp->dispose();
    1405           0 :         mxTableFamily = 0;
    1406             : 
    1407           0 :         SdStyleFamilyMap aTempMap;
    1408           0 :         aTempMap.swap( maStyleFamilyMap );
    1409             : 
    1410           0 :         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           0 :         mpDoc = 0;
    1419             : 
    1420           0 :         Clear();
    1421             :     }
    1422           0 : }
    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           0 : void SAL_CALL SdStyleSheetPool::acquire (void) throw ()
    1461             : {
    1462           0 :     SdStyleSheetPoolBase::acquire();
    1463           0 : }
    1464             : 
    1465           0 : void SAL_CALL SdStyleSheetPool::release (void) throw ()
    1466             : {
    1467           0 :     SdStyleSheetPoolBase::release();
    1468           0 : }
    1469             : 
    1470             : 
    1471             : 
    1472             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10