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