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