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

Generated by: LCOV version 1.10