1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: stlpool.cxx,v $
10 * $Revision: 1.41.68.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <com/sun/star/lang/DisposedException.hpp>
35 #include <svx/eeitem.hxx>
36 #include <svx/fhgtitem.hxx>
37 #include <svx/colritem.hxx>
38 #include <svx/cntritem.hxx>
39 #include <svx/shdditem.hxx>
40 #include <svx/crsditem.hxx>
41 #include <svx/udlnitem.hxx>
42 #include <svx/wghtitem.hxx>
43 #include <svx/postitem.hxx>
44 #include <svx/fontitem.hxx>
45 #include <svtools/poolitem.hxx>
46 #include <svx/xfillit0.hxx>
47 #include <svx/xlineit0.hxx>
48 #include <svx/ulspitem.hxx>
49 #include <svx/numitem.hxx>
50 #include <svx/brshitem.hxx>
51 #include <svx/editeng.hxx>
52 #include <svtools/smplhint.hxx>
53 #include <svx/langitem.hxx>
54 #include <svx/charreliefitem.hxx>
55 #ifndef _SVX_EMPHITEM_HXX
56 #include <svx/emphitem.hxx>
58 #include <svx/sdr/table/tabledesign.hxx>
59 #include <svx/akrnitem.hxx>
61 #include <svx/svdattr.hxx>
63 #include <svx/xtable.hxx> // fuer RGB_Color
64 #include <svx/bulitem.hxx>
65 #include <svx/lrspitem.hxx>
66 #include <svx/adjitem.hxx>
67 #include <svtools/itempool.hxx>
72 #include "stlpool.hxx"
73 #include "sdresid.hxx"
74 #include "stlsheet.hxx"
77 #include "drawdoc.hxx"
81 #include <svtools/itemset.hxx>
83 using ::rtl::OUString
;
84 using namespace ::com::sun::star::uno
;
85 using namespace ::com::sun::star::lang
;
86 using namespace ::com::sun::star::style
;
87 using namespace ::com::sun::star::container
;
89 // ----------------------------------------------------------
91 SdStyleSheetPool::SdStyleSheetPool(SfxItemPool
const& _rPool
, SdDrawDocument
* pDocument
)
92 : SdStyleSheetPoolBase( _rPool
)
93 , mpActualStyleSheet(NULL
)
98 rtl::Reference
< SfxStyleSheetPool
> xPool( this );
100 // create graphics family
101 mxGraphicFamily
= new SdStyleFamily( xPool
, SD_STYLE_FAMILY_GRAPHICS
);
102 mxCellFamily
= new SdStyleFamily( xPool
, SD_STYLE_FAMILY_CELL
);
104 mxTableFamily
= sdr::table::CreateTableDesignFamily();
105 Reference
< XNamed
> xNamed( mxTableFamily
, UNO_QUERY
);
107 msTableFamilyName
= xNamed
->getName();
109 // create presentation families, one for each master page
110 const sal_uInt16 nCount
= mpDoc
->GetMasterSdPageCount(PK_STANDARD
);
111 for( sal_uInt16 nPage
= 0; nPage
< nCount
; ++nPage
)
112 AddStyleFamily( mpDoc
->GetMasterSdPage(nPage
,PK_STANDARD
) );
114 // StartListening( *mpDoc );
118 // ----------------------------------------------------------
120 SdStyleSheetPool::~SdStyleSheetPool()
122 DBG_ASSERT( mpDoc
== NULL
, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
125 // ----------------------------------------------------------
127 SfxStyleSheetBase
* SdStyleSheetPool::Create(const String
& rName
, SfxStyleFamily eFamily
, USHORT _nMask
)
129 return new SdStyleSheet(rName
, *this, eFamily
, _nMask
);
132 // ----------------------------------------------------------
134 SfxStyleSheetBase
* SdStyleSheetPool::Create(const SdStyleSheet
& rStyle
)
136 return new SdStyleSheet( rStyle
);
139 // ----------------------------------------------------------
141 SfxStyleSheetBase
* SdStyleSheetPool::GetTitleSheet(const String
& rLayoutName
)
143 String
aName(rLayoutName
);
144 aName
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR
));
145 aName
+= String(SdResId(STR_LAYOUT_TITLE
));
146 SfxStyleSheetBase
* pResult
= Find(aName
, SD_STYLE_FAMILY_MASTERPAGE
);
150 // ----------------------------------------------------------
151 // find layout name of first layout
152 // ----------------------------------------------------------
154 String
SdStyleSheetPool::GetLayoutName() const
156 String
aName( SdResId(STR_LAYOUT_DEFAULT_NAME
) );
157 sal_uInt32 nCount
= aStyles
.size();
159 for( sal_uInt32 n
= 0; n
< nCount
; n
++ )
161 aName
= aStyles
[n
]->GetName();
162 sal_uInt16 nPos
= aName
.SearchAscii( SD_LT_SEPARATOR
);
163 if( nPos
!= STRING_NOTFOUND
)
167 sal_uInt16 nPos
= aName
.Search( sal_Unicode( ' ' ));
168 if( nPos
!= STRING_NOTFOUND
)
169 aName
.Erase( nPos
); // removing blanks and number (e.g. "Gliederung 1")
174 /*************************************************************************
176 |* eine Liste der Gliederungstextvorlagen fuer ein Praesentationlayout
177 |* erstellen, der Aufrufer muss die Liste wieder loeschen
179 \************************************************************************/
181 List
* SdStyleSheetPool::CreateOutlineSheetList (const String
& rLayoutName
)
183 String
aName(rLayoutName
);
184 aName
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR
));
185 aName
+= String(SdResId(STR_LAYOUT_OUTLINE
));
186 List
* pList
= new List
;
187 for (USHORT nSheet
= 1; nSheet
< 10; nSheet
++)
189 String
aFullName(aName
);
190 aFullName
.Append( sal_Unicode( ' ' ));
191 aFullName
.Append( String::CreateFromInt32( (sal_Int32
)nSheet
));
192 SfxStyleSheetBase
* pSheet
= Find(aFullName
, SD_STYLE_FAMILY_MASTERPAGE
);
193 pList
->Insert(pSheet
, LIST_APPEND
);
198 /*************************************************************************
200 |* StyleSheets mit Defaultweren fuer das genannte Praesentationslayout erzeugen
202 \************************************************************************/
204 void SdStyleSheetPool::CreateLayoutStyleSheets(const String
& rLayoutName
, sal_Bool bCheck
/*= sal_False*/ )
206 const sal_uInt16 nUsedMask
= SFXSTYLEBIT_ALL
& ~SFXSTYLEBIT_USERDEF
;
209 sal_Bool bCreated
= sal_False
;
211 SfxStyleSheetBase
* pSheet
= NULL
;
213 String
aPrefix(rLayoutName
);
214 String
aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR
));
215 aPrefix
.Insert(aSep
);
217 Font aLatinFont
, aCJKFont
, aCTLFont
;
219 mpDoc
->getDefaultFonts( aLatinFont
, aCJKFont
, aCTLFont
);
221 // Font fuer Titel und Gliederung
222 SvxFontItem
aSvxFontItem( aLatinFont
.GetFamily(), aLatinFont
.GetName(), aLatinFont
.GetStyleName(), aLatinFont
.GetPitch(),
223 aLatinFont
.GetCharSet(), EE_CHAR_FONTINFO
);
225 SvxFontItem
aSvxFontItemCJK( aCJKFont
.GetFamily(), aCJKFont
.GetName(), aCJKFont
.GetStyleName(), aCJKFont
.GetPitch(),
226 aCJKFont
.GetCharSet(), EE_CHAR_FONTINFO_CJK
);
228 SvxFontItem
aSvxFontItemCTL( aCTLFont
.GetFamily(), aCTLFont
.GetName(), aCTLFont
.GetStyleName(), aCTLFont
.GetPitch(),
229 aCTLFont
.GetCharSet(), EE_CHAR_FONTINFO_CTL
);
231 Font
aBulletFont( GetBulletFont() );
233 /**************************************************************************
235 **************************************************************************/
236 String
aName(SdResId(STR_LAYOUT_OUTLINE
));
239 SfxStyleSheetBase
* pParent
= NULL
;
240 SvxLRSpaceItem
aSvxLRSpaceItem( EE_PARA_LRSPACE
);
241 SvxULSpaceItem
aSvxULSpaceItem( EE_PARA_ULSPACE
);
244 for( nLevel
= 1; nLevel
< 10; nLevel
++)
246 String
aLevelName(aName
);
247 aLevelName
.Append( sal_Unicode( ' ' ));
248 aLevelName
.Append( String::CreateFromInt32( sal_Int32( nLevel
)));
250 aLevelName
.Insert(aPrefix
, 0);
252 if (!Find(aLevelName
, SD_STYLE_FAMILY_MASTERPAGE
))
255 pSheet
= &Make(aLevelName
, SD_STYLE_FAMILY_MASTERPAGE
,nUsedMask
);
256 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_OUTLINE
+ nLevel
);
258 pSheet
->SetParent( String() );
260 // Attributierung fuer Level 1, die anderen Ebenen "erben"
263 SfxItemSet
& rSet
= pSheet
->GetItemSet();
265 rSet
.Put(aSvxFontItem
);
266 rSet
.Put(aSvxFontItemCJK
);
267 rSet
.Put(aSvxFontItemCTL
);
268 rSet
.Put( SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC
) );
269 rSet
.Put( SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CJK
) );
270 rSet
.Put( SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CTL
) );
271 rSet
.Put( SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT
) );
272 rSet
.Put( SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CJK
) );
273 rSet
.Put( SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CTL
) );
274 rSet
.Put( SvxUnderlineItem(UNDERLINE_NONE
, EE_CHAR_UNDERLINE
) );
275 rSet
.Put( SvxOverlineItem(UNDERLINE_NONE
, EE_CHAR_OVERLINE
) );
276 rSet
.Put( SvxCrossedOutItem(STRIKEOUT_NONE
, EE_CHAR_STRIKEOUT
) );
277 rSet
.Put( SvxShadowedItem(FALSE
, EE_CHAR_SHADOW
) );
278 rSet
.Put( SvxContourItem(FALSE
, EE_CHAR_OUTLINE
) );
279 rSet
.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE
, EE_CHAR_EMPHASISMARK
) );
280 rSet
.Put( SvxCharReliefItem(RELIEF_NONE
, EE_CHAR_RELIEF
) );
281 rSet
.Put( SvxColorItem( Color(COL_AUTO
), EE_CHAR_COLOR
) );
282 rSet
.Put( XLineStyleItem(XLINE_NONE
) );
283 rSet
.Put( XFillStyleItem(XFILL_NONE
) );
284 rSet
.Put( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT
) );
285 rSet
.Put( SdrTextAutoGrowHeightItem(FALSE
) );
286 // #i16874# enable kerning by default but only for new documents
287 rSet
.Put( SvxAutoKernItem( TRUE
, EE_CHAR_PAIRKERNING
) );
291 Font
f( GetBulletFont() );
292 PutNumBulletItem( pSheet
, f
);
296 ULONG nFontSize
= 20;
297 short nFirstIndent
= -600;
298 // USHORT nIndent = nLevel * 1200;
334 nFontSize
= (USHORT
)((nFontSize
* 2540L) / 72); // Pt --> 1/100 mm
335 SfxItemSet
& rOutlineSet
= pSheet
->GetItemSet();
336 rOutlineSet
.Put( SvxFontHeightItem( nFontSize
, 100, EE_CHAR_FONTHEIGHT
) );
337 rOutlineSet
.Put( SvxFontHeightItem( nFontSize
, 100, EE_CHAR_FONTHEIGHT_CJK
) );
338 rOutlineSet
.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( nFontSize
), 100, EE_CHAR_FONTHEIGHT_CTL
) );
342 aSvxLRSpaceItem.SetTxtFirstLineOfst(nFirstIndent);
343 aSvxLRSpaceItem.SetTxtLeft(nIndent);
344 aSvxLRSpaceItem.SetRight(0);
345 aSvxLRSpaceItem.SetBulletFI(TRUE);
346 pSheet->GetItemSet().Put(aSvxLRSpaceItem);
348 // Zeilendurchschuss (Abstand nach unten)
349 aSvxULSpaceItem
.SetLower(nLower
);
350 pSheet
->GetItemSet().Put(aSvxULSpaceItem
);
355 SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 1); // Bullets sichtbar
356 pSheet->GetItemSet().Put(aBulletStateItem);
362 // if we created outline styles, we need to chain them
366 for (nLevel
= 1; nLevel
< 10; nLevel
++)
368 String
aLevelName(aName
);
369 aLevelName
.Append( sal_Unicode( ' ' ));
370 aLevelName
.Append( String::CreateFromInt32( sal_Int32( nLevel
)));
372 aLevelName
.Insert(aPrefix
, 0);
374 pSheet
= Find(aLevelName
, SD_STYLE_FAMILY_MASTERPAGE
);
376 DBG_ASSERT( pSheet
, "missing layout style!");
381 pSheet
->SetParent(pParent
->GetName());
387 /**************************************************************************
389 **************************************************************************/
390 aName
= String(SdResId(STR_LAYOUT_TITLE
));
391 aName
.Insert(aPrefix
, 0);
393 if (!Find(aName
, SD_STYLE_FAMILY_MASTERPAGE
))
397 pSheet
= &Make(aName
, SD_STYLE_FAMILY_MASTERPAGE
,nUsedMask
);
398 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_TITLE
);
399 pSheet
->SetParent(String());
400 SfxItemSet
& rTitleSet
= pSheet
->GetItemSet();
401 rTitleSet
.Put(XLineStyleItem(XLINE_NONE
));
402 rTitleSet
.Put(XFillStyleItem(XFILL_NONE
));
403 rTitleSet
.Put(aSvxFontItem
);
404 rTitleSet
.Put(aSvxFontItemCJK
);
405 rTitleSet
.Put(aSvxFontItemCTL
);
406 rTitleSet
.Put(SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC
) );
407 rTitleSet
.Put(SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CJK
) );
408 rTitleSet
.Put(SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CTL
) );
409 rTitleSet
.Put(SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT
) );
410 rTitleSet
.Put(SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CJK
) );
411 rTitleSet
.Put(SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CTL
) );
412 rTitleSet
.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT
) ); // 44 pt
413 rTitleSet
.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK
) ); // 44 pt
414 rTitleSet
.Put(SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1552 ), 100, EE_CHAR_FONTHEIGHT_CTL
) ); // 44 pt
415 rTitleSet
.Put(SvxUnderlineItem(UNDERLINE_NONE
, EE_CHAR_UNDERLINE
));
416 rTitleSet
.Put(SvxOverlineItem(UNDERLINE_NONE
, EE_CHAR_OVERLINE
));
417 rTitleSet
.Put(SvxCrossedOutItem(STRIKEOUT_NONE
, EE_CHAR_STRIKEOUT
));
418 rTitleSet
.Put(SvxShadowedItem(FALSE
, EE_CHAR_SHADOW
));
419 rTitleSet
.Put(SvxContourItem(FALSE
, EE_CHAR_OUTLINE
));
420 rTitleSet
.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE
, EE_CHAR_EMPHASISMARK
) );
421 rTitleSet
.Put( SvxCharReliefItem(RELIEF_NONE
, EE_CHAR_RELIEF
) );
422 rTitleSet
.Put(SvxColorItem( Color(COL_AUTO
), EE_CHAR_COLOR
));
423 rTitleSet
.Put(SvxAdjustItem(SVX_ADJUST_CENTER
, EE_PARA_JUST
));
424 rTitleSet
.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER
) );
425 // rTitleSet.Put( SfxUInt16Item(EE_PARA_BULLETSTATE, 0) );
426 // #i16874# enable kerning by default but only for new documents
427 rTitleSet
.Put( SvxAutoKernItem( TRUE
, EE_CHAR_PAIRKERNING
) );
429 aBulletFont
.SetSize(Size(0,1552)); // 44 pt
430 PutNumBulletItem( pSheet
, aBulletFont
);
433 /**************************************************************************
435 **************************************************************************/
436 aName
= String(SdResId(STR_LAYOUT_SUBTITLE
));
437 aName
.Insert(aPrefix
, 0);
439 if (!Find(aName
, SD_STYLE_FAMILY_MASTERPAGE
))
443 pSheet
= &Make(aName
, SD_STYLE_FAMILY_MASTERPAGE
,nUsedMask
);
444 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_SUBTITLE
);
445 pSheet
->SetParent(String());
446 SfxItemSet
& rSubtitleSet
= pSheet
->GetItemSet();
447 rSubtitleSet
.Put(XLineStyleItem(XLINE_NONE
));
448 rSubtitleSet
.Put(XFillStyleItem(XFILL_NONE
));
449 rSubtitleSet
.Put(aSvxFontItem
);
450 rSubtitleSet
.Put(aSvxFontItemCJK
);
451 rSubtitleSet
.Put(aSvxFontItemCTL
);
452 rSubtitleSet
.Put(SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC
) );
453 rSubtitleSet
.Put(SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CJK
) );
454 rSubtitleSet
.Put(SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CTL
) );
455 rSubtitleSet
.Put(SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT
) );
456 rSubtitleSet
.Put(SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CJK
) );
457 rSubtitleSet
.Put(SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CTL
) );
458 rSubtitleSet
.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT
) ); // 32 pt
459 rSubtitleSet
.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK
) ); // 32 pt
460 rSubtitleSet
.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1129 ), 100, EE_CHAR_FONTHEIGHT_CTL
) ); // 32 pt
461 rSubtitleSet
.Put(SvxUnderlineItem(UNDERLINE_NONE
, EE_CHAR_UNDERLINE
));
462 rSubtitleSet
.Put(SvxOverlineItem(UNDERLINE_NONE
, EE_CHAR_OVERLINE
));
463 rSubtitleSet
.Put(SvxCrossedOutItem(STRIKEOUT_NONE
, EE_CHAR_STRIKEOUT
));
464 rSubtitleSet
.Put(SvxShadowedItem(FALSE
, EE_CHAR_SHADOW
));
465 rSubtitleSet
.Put(SvxContourItem(FALSE
, EE_CHAR_OUTLINE
));
466 rSubtitleSet
.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE
, EE_CHAR_EMPHASISMARK
) );
467 rSubtitleSet
.Put( SvxCharReliefItem(RELIEF_NONE
, EE_CHAR_RELIEF
) );
468 rSubtitleSet
.Put(SvxColorItem( Color(COL_AUTO
), EE_CHAR_COLOR
));
469 rSubtitleSet
.Put(SvxAdjustItem(SVX_ADJUST_CENTER
, EE_PARA_JUST
));
470 rSubtitleSet
.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER
) );
471 // rSubtitleSet.Put( SfxUInt16Item(EE_PARA_BULLETSTATE, 0) );
472 // #i16874# enable kerning by default but only for new documents
473 rSubtitleSet
.Put( SvxAutoKernItem( TRUE
, EE_CHAR_PAIRKERNING
) );
474 aSvxLRSpaceItem
.SetTxtLeft(0);
475 rSubtitleSet
.Put(aSvxLRSpaceItem
);
477 Font
aTmpFont( GetBulletFont() );
478 aTmpFont
.SetSize(Size(0, 1129)); // 32 pt
479 PutNumBulletItem( pSheet
, aTmpFont
);
482 /**************************************************************************
484 **************************************************************************/
485 aName
= String(SdResId(STR_LAYOUT_NOTES
));
486 aName
.Insert(aPrefix
, 0);
488 if (!Find(aName
, SD_STYLE_FAMILY_MASTERPAGE
))
492 pSheet
= &Make(aName
, SD_STYLE_FAMILY_MASTERPAGE
,nUsedMask
);
493 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_NOTES
);
494 pSheet
->SetParent(String());
495 SfxItemSet
& rNotesSet
= pSheet
->GetItemSet();
496 rNotesSet
.Put(XLineStyleItem(XLINE_NONE
));
497 rNotesSet
.Put(XFillStyleItem(XFILL_NONE
));
498 rNotesSet
.Put(aSvxFontItem
);
499 rNotesSet
.Put(aSvxFontItemCJK
);
500 rNotesSet
.Put(aSvxFontItemCTL
);
501 rNotesSet
.Put( SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC
) );
502 rNotesSet
.Put( SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CJK
) );
503 rNotesSet
.Put( SvxPostureItem( ITALIC_NONE
, EE_CHAR_ITALIC_CTL
) );
504 rNotesSet
.Put( SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT
) );
505 rNotesSet
.Put( SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CJK
) );
506 rNotesSet
.Put( SvxWeightItem( WEIGHT_NORMAL
, EE_CHAR_WEIGHT_CTL
) );
507 rNotesSet
.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT
) ); // 20 pt
508 rNotesSet
.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK
) ); // 20 pt
509 rNotesSet
.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 705 ), 100, EE_CHAR_FONTHEIGHT_CTL
) ); // 20 pt
510 rNotesSet
.Put( SvxUnderlineItem(UNDERLINE_NONE
, EE_CHAR_UNDERLINE
) );
511 rNotesSet
.Put( SvxOverlineItem(UNDERLINE_NONE
, EE_CHAR_OVERLINE
) );
512 rNotesSet
.Put( SvxCrossedOutItem(STRIKEOUT_NONE
, EE_CHAR_STRIKEOUT
) );
513 rNotesSet
.Put( SvxShadowedItem(FALSE
, EE_CHAR_SHADOW
) );
514 rNotesSet
.Put( SvxContourItem(FALSE
, EE_CHAR_OUTLINE
) );
515 rNotesSet
.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE
, EE_CHAR_EMPHASISMARK
) );
516 rNotesSet
.Put( SvxCharReliefItem(RELIEF_NONE
, EE_CHAR_RELIEF
) );
517 rNotesSet
.Put( SvxColorItem( Color(COL_AUTO
), EE_CHAR_COLOR
) );
518 // rNotesSet.Put( SfxUInt16Item(EE_PARA_BULLETSTATE, 0) );
519 rNotesSet
.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE
) );
520 // #i16874# enable kerning by default but only for new documents
521 rNotesSet
.Put( SvxAutoKernItem( TRUE
, EE_CHAR_PAIRKERNING
) );
524 SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rNotesSet.Get(EE_PARA_NUMBULLET) );
526 EditEngine::ImportBulletItem( aNumBullet, 0, NULL,
527 &(const SvxLRSpaceItem&) rNotesSet.Get( EE_PARA_LRSPACE ) );
529 ( (SfxItemSet&) rNotesSet).Put( aNumBullet );
534 /**************************************************************************
536 **************************************************************************/
537 aName
= String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS
));
538 aName
.Insert(aPrefix
, 0);
540 if (!Find(aName
, SD_STYLE_FAMILY_MASTERPAGE
))
544 pSheet
= &Make(aName
, SD_STYLE_FAMILY_MASTERPAGE
,nUsedMask
);
545 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_BACKGROUNDOBJECTS
);
546 pSheet
->SetParent(String());
547 SfxItemSet
& rBackgroundObjectsSet
= pSheet
->GetItemSet();
548 rBackgroundObjectsSet
.Put(SdrShadowItem(FALSE
));
549 rBackgroundObjectsSet
.Put(SdrShadowColorItem(String(), Color(COL_GRAY
)));
550 rBackgroundObjectsSet
.Put(SdrShadowXDistItem(300)); // 3 mm Schattendistanz
551 rBackgroundObjectsSet
.Put(SdrShadowYDistItem(300));
552 // #i16874# enable kerning by default but only for new documents
553 rBackgroundObjectsSet
.Put( SvxAutoKernItem( TRUE
, EE_CHAR_PAIRKERNING
) );
556 /**************************************************************************
558 **************************************************************************/
559 aName
= String(SdResId(STR_LAYOUT_BACKGROUND
));
560 aName
.Insert(aPrefix
, 0);
562 if (!Find(aName
, SD_STYLE_FAMILY_MASTERPAGE
))
566 pSheet
= &Make(aName
, SD_STYLE_FAMILY_MASTERPAGE
,nUsedMask
);
567 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_BACKGROUND
);
568 pSheet
->SetParent(String());
569 SfxItemSet
& rBackgroundSet
= pSheet
->GetItemSet();
570 rBackgroundSet
.Put(XLineStyleItem(XLINE_NONE
));
571 rBackgroundSet
.Put(XFillStyleItem(XFILL_NONE
));
572 // #i16874# enable kerning by default but only for new documents
573 rBackgroundSet
.Put( SvxAutoKernItem( TRUE
, EE_CHAR_PAIRKERNING
) );
576 DBG_ASSERT( !bCheck
|| !bCreated
, "missing layout style sheets detected!" );
579 /*************************************************************************
581 |* StyleSheets des genannten Praesentationslayouts loeschen
583 \************************************************************************/
585 void SdStyleSheetPool::EraseLayoutStyleSheets(const String
& rLayoutName
)
587 SfxStyleSheetBase
* pSheet
= NULL
;
589 List
* pNameList
= CreateLayoutSheetNames(rLayoutName
);
591 String
* pName
= (String
*)pNameList
->First();
594 pSheet
= Find(*pName
, SD_STYLE_FAMILY_MASTERPAGE
);
595 DBG_ASSERT(pSheet
, "EraseLayoutStyleSheets: Vorlage nicht gefunden");
599 pName
= (String
*)pNameList
->Next();
605 /*************************************************************************
607 |* Graphik-StyleSheets aus dem Quellpool in diesen Pool kopieren
609 |* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find
612 \************************************************************************/
614 void SdStyleSheetPool::CopyGraphicSheets(SdStyleSheetPool
& rSourcePool
)
616 CopySheets( rSourcePool
, SD_STYLE_FAMILY_GRAPHICS
);
619 void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool
& rSourcePool
)
621 CopySheets( rSourcePool
, SD_STYLE_FAMILY_CELL
);
624 void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool
& rSourcePool
)
626 Reference
< XIndexAccess
> xSource( rSourcePool
.mxTableFamily
, UNO_QUERY
);
627 Reference
< XNameContainer
> xTarget( mxTableFamily
, UNO_QUERY
);
628 Reference
< XSingleServiceFactory
> xFactory( mxTableFamily
, UNO_QUERY
);
630 if( xSource
.is() && xFactory
.is() && mxTableFamily
.is() )
632 for( sal_Int32 nIndex
= 0; nIndex
< xSource
->getCount(); nIndex
++ ) try
634 Reference
< XStyle
> xSourceTableStyle( xSource
->getByIndex( nIndex
), UNO_QUERY
);
635 if( xSourceTableStyle
.is() )
637 Reference
< XStyle
> xNewTableStyle( xFactory
->createInstance(), UNO_QUERY
);
638 if( xNewTableStyle
.is() )
640 Reference
< XNameAccess
> xSourceNames( xSourceTableStyle
, UNO_QUERY_THROW
);
642 Sequence
< OUString
> aStyleNames( xSourceNames
->getElementNames() );
643 OUString
* pStyleNames( aStyleNames
.getArray() );
645 Reference
< XNameReplace
> xTargetNames( xNewTableStyle
, UNO_QUERY
);
647 sal_Int32 nNames
= aStyleNames
.getLength();
650 const OUString
aName( *pStyleNames
++ );
651 Reference
< XStyle
> xSourceStyle( xSourceNames
->getByName( aName
), UNO_QUERY
);
652 Reference
< XStyle
> xTargetStyle
;
653 if( xSourceStyle
.is() ) try
655 mxCellFamily
->getByName( xSourceStyle
->getName() ) >>= xTargetStyle
;
659 DBG_ERROR( "sd::SdStyleSheetPool::CopyTableStyles(), exception caught!" );
662 if( xTargetStyle
.is() )
663 xTargetNames
->replaceByName( aName
, Any( xTargetStyle
) );
667 OUString
sName( Reference
< XNamed
>( xSourceTableStyle
, UNO_QUERY_THROW
)->getName() );
668 if( xTarget
->hasByName( sName
) )
669 xTarget
->replaceByName( sName
, Any( xNewTableStyle
) );
671 xTarget
->insertByName( sName
, Any( xNewTableStyle
) );
676 DBG_ERROR("sd::SdStyleSheetPool::CopyTableStyles(), exception caught!");
681 void SdStyleSheetPool::CopySheets(SdStyleSheetPool
& rSourcePool
, SfxStyleFamily eFamily
)
685 sal_uInt32 nCount
= rSourcePool
.aStyles
.size();
687 std::vector
< std::pair
< rtl::Reference
< SfxStyleSheetBase
>, String
> > aNewStyles
;
689 for (sal_uInt32 n
= 0; n
< nCount
; n
++)
691 rtl::Reference
< SfxStyleSheetBase
> xSheet( rSourcePool
.aStyles
[sal::static_int_cast
<sal_uInt16
>(n
)] );
693 if( xSheet
->GetFamily() == eFamily
)
695 String
aName( xSheet
->GetName() );
696 if ( !Find( aName
, eFamily
) )
698 rtl::Reference
< SfxStyleSheetBase
> xNewSheet( &Make( aName
, eFamily
) );
700 xNewSheet
->SetMask( xSheet
->GetMask() );
702 // #91588# Also set parent relation for copied style sheets
703 String
aParent( xSheet
->GetParent() );
705 aNewStyles
.push_back( std::pair
< rtl::Reference
< SfxStyleSheetBase
>, String
>( xNewSheet
, aParent
) );
707 xNewSheet
->SetHelpId( aHelpFile
, xSheet
->GetHelpId( aHelpFile
) );
708 xNewSheet
->GetItemSet().Put( xSheet
->GetItemSet() );
713 // set parents on newly added stylesheets
714 std::vector
< std::pair
< rtl::Reference
< SfxStyleSheetBase
>, String
> >::iterator aIter
;
715 for( aIter
= aNewStyles
.begin(); aIter
!= aNewStyles
.end(); aIter
++ )
717 DBG_ASSERT( rSourcePool
.Find( (*aIter
).second
, eFamily
), "StyleSheet has invalid parent: Family mismatch" );
718 (*aIter
).first
->SetParent( (*aIter
).second
);
723 /*************************************************************************
725 |* StyleSheets des genannten Praesentationslayouts aus dem Quellpool in diesen
726 |* Pool kopieren. Kopiert werden nur solche StyleSheets, die in diesem Pool
727 |* noch nicht vorhanden sind.
728 |* pCreatedSheets wird - wenn ungleich NULL - mit Zeigern auf die erzeugten
729 |* StyleSheets gefuellt.
731 |* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find
734 \************************************************************************/
736 void SdStyleSheetPool::CopyLayoutSheets(const String
& rLayoutName
, SdStyleSheetPool
& rSourcePool
, SdStyleSheetVector
& rCreatedSheets
)
738 SfxStyleSheetBase
* pSheet
= NULL
;
740 String
aOutlineTag(SdResId(STR_LAYOUT_OUTLINE
));
742 List
* pNameList
= CreateLayoutSheetNames(rLayoutName
);
745 String
* pName
= (String
*)pNameList
->First();
748 pSheet
= Find(*pName
, SD_STYLE_FAMILY_MASTERPAGE
);
751 SfxStyleSheetBase
* pSourceSheet
= rSourcePool
.Find(*pName
, SD_STYLE_FAMILY_MASTERPAGE
);
752 DBG_ASSERT(pSourceSheet
, "CopyLayoutSheets: Quellvorlage nicht gefunden");
755 // falls einer mit Methusalem-Doks. ankommt
756 SfxStyleSheetBase
& rNewSheet
= Make(*pName
, SD_STYLE_FAMILY_MASTERPAGE
);
757 rNewSheet
.SetHelpId( sEmpty
, pSourceSheet
->GetHelpId( sEmpty
) );
758 rNewSheet
.GetItemSet().Put(pSourceSheet
->GetItemSet());
759 rCreatedSheets
.push_back( SdStyleSheetRef( static_cast< SdStyleSheet
* >( &rNewSheet
) ) );
763 pName
= (String
*)pNameList
->Next();
767 // Sonderbehandlung fuer Gliederungsvorlagen: Parentbeziehungen aufbauen
768 List
* pOutlineSheets
= CreateOutlineSheetList(rLayoutName
);
769 SfxStyleSheetBase
* pParent
= (SfxStyleSheetBase
*)pOutlineSheets
->First();
770 pSheet
= (SfxStyleSheetBase
*)pOutlineSheets
->Next();
774 if (pSheet
->GetParent().Len() == 0)
775 pSheet
->SetParent(pParent
->GetName());
777 pSheet
= (SfxStyleSheetBase
*)pOutlineSheets
->Next();
779 delete pOutlineSheets
;
782 /*************************************************************************
784 |* Liste mit den Namen der Praesentationsvorlagen eines Layouts erzeugen.
785 |* Die Liste und die enthaltenen Strings gehoeren dem Caller!
787 \************************************************************************/
789 List
* SdStyleSheetPool::CreateLayoutSheetNames(const String
& rLayoutName
) const
791 String
aPrefix(rLayoutName
);
792 String
aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR
));
793 aPrefix
.Insert(aSep
);
795 List
* pNameList
= new List
;
797 String
aName(SdResId(STR_LAYOUT_OUTLINE
));
798 String
* pName
= NULL
;
800 for (USHORT nLevel
= 1; nLevel
< 10; nLevel
++)
802 pName
= new String(aName
);
803 pName
->Append( sal_Unicode( ' ' ));
804 pName
->Append( String::CreateFromInt32( sal_Int32( nLevel
)));
805 pName
->Insert(aPrefix
, 0);
806 pNameList
->Insert(pName
, LIST_APPEND
);
809 pName
= new String(SdResId(STR_LAYOUT_TITLE
));
810 pName
->Insert(aPrefix
, 0);
811 pNameList
->Insert(pName
, LIST_APPEND
);
813 pName
= new String(SdResId(STR_LAYOUT_SUBTITLE
));
814 pName
->Insert(aPrefix
, 0);
815 pNameList
->Insert(pName
, LIST_APPEND
);
817 pName
= new String(SdResId(STR_LAYOUT_NOTES
));
818 pName
->Insert(aPrefix
, 0);
819 pNameList
->Insert(pName
, LIST_APPEND
);
821 pName
= new String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS
));
822 pName
->Insert(aPrefix
, 0);
823 pNameList
->Insert(pName
, LIST_APPEND
);
825 pName
= new String(SdResId(STR_LAYOUT_BACKGROUND
));
826 pName
->Insert(aPrefix
, 0);
827 pNameList
->Insert(pName
, LIST_APPEND
);
832 /*************************************************************************
834 |* Liste mit Zeigern auf Praesentationsvorlagen eines Layouts erzeugen.
835 |* Die Liste gehoert dem Caller!
837 \************************************************************************/
839 void SdStyleSheetPool::CreateLayoutSheetList(const String
& rLayoutName
, SdStyleSheetVector
& rLayoutSheets
)
841 String
aLayoutNameWithSep(rLayoutName
);
842 aLayoutNameWithSep
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR
));
843 USHORT nLen
= aLayoutNameWithSep
.Len();
845 SfxStyleSheetIterator
aIter(this, SD_STYLE_FAMILY_MASTERPAGE
);
846 SfxStyleSheetBase
* pSheet
= aIter
.First();
850 if (pSheet
->GetName().Match(aLayoutNameWithSep
) == nLen
)
851 rLayoutSheets
.push_back( SdStyleSheetRef( static_cast< SdStyleSheet
* >( pSheet
) ) );
852 pSheet
= aIter
.Next();
856 /*************************************************************************
858 |* ggfs. PseudoStyleSheets erzeugen
860 \************************************************************************/
862 void SdStyleSheetPool::CreatePseudosIfNecessary()
866 SfxStyleSheetBase
* pSheet
= NULL
;
867 SfxStyleSheetBase
* pParent
= NULL
;
869 //USHORT nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
870 USHORT nUsedMask
= SFXSTYLEBIT_USED
;
872 aName
= String(SdResId(STR_PSEUDOSHEET_TITLE
));
873 if( (pSheet
= Find(aName
, SD_STYLE_FAMILY_PSEUDO
)) == 0 )
875 pSheet
= &Make(aName
, SD_STYLE_FAMILY_PSEUDO
, nUsedMask
);
876 pSheet
->SetParent( String() );
877 ((SfxStyleSheet
*)pSheet
)->StartListening(*this);
879 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_TITLE
);
881 aName
= String(SdResId(STR_PSEUDOSHEET_SUBTITLE
));
882 if( (pSheet
= Find(aName
, SD_STYLE_FAMILY_PSEUDO
)) == 0 )
884 pSheet
= &Make(aName
, SD_STYLE_FAMILY_PSEUDO
, nUsedMask
);
885 pSheet
->SetParent(String());
886 ((SfxStyleSheet
*)pSheet
)->StartListening(*this);
888 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_SUBTITLE
);
890 aName
= String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS
));
891 if( (pSheet
= Find(aName
, SD_STYLE_FAMILY_PSEUDO
)) == 0 )
893 pSheet
= &Make(aName
, SD_STYLE_FAMILY_PSEUDO
, nUsedMask
);
894 pSheet
->SetParent( String() );
895 ((SfxStyleSheet
*)pSheet
)->StartListening(*this);
897 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_BACKGROUNDOBJECTS
);
899 aName
= String(SdResId(STR_PSEUDOSHEET_BACKGROUND
));
900 if( (pSheet
= Find(aName
, SD_STYLE_FAMILY_PSEUDO
)) == 0 )
902 pSheet
= &Make(aName
, SD_STYLE_FAMILY_PSEUDO
, nUsedMask
);
903 pSheet
->SetParent( String() );
904 ((SfxStyleSheet
*)pSheet
)->StartListening(*this);
906 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_BACKGROUND
);
908 aName
= String(SdResId(STR_PSEUDOSHEET_NOTES
));
909 if( (pSheet
= Find(aName
, SD_STYLE_FAMILY_PSEUDO
)) == 0 )
911 pSheet
= &Make(aName
, SD_STYLE_FAMILY_PSEUDO
, nUsedMask
);
912 pSheet
->SetParent( String() );
913 ((SfxStyleSheet
*)pSheet
)->StartListening(*this);
915 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_NOTES
);
918 SetSearchMask(SD_STYLE_FAMILY_PSEUDO
);
919 aName
= String(SdResId(STR_PSEUDOSHEET_OUTLINE
));
920 for (USHORT nLevel
= 1; nLevel
< 10; nLevel
++)
922 String
aLevelName(aName
);
923 aLevelName
.Append( sal_Unicode( ' ' ));
924 aLevelName
.Append( String::CreateFromInt32( sal_Int32( nLevel
)));
926 if( (pSheet
= Find(aLevelName
, SD_STYLE_FAMILY_PSEUDO
)) == 0 )
928 pSheet
= &Make(aLevelName
, SD_STYLE_FAMILY_PSEUDO
, nUsedMask
);
933 pSheet
->SetParent(pParent
->GetName());
935 ((SfxStyleSheet
*)pSheet
)->StartListening(*this);
938 pSheet
->SetHelpId( aHelpFile
, HID_PSEUDOSHEET_OUTLINE
+ nLevel
);
943 /*************************************************************************
945 |* Standard-Styles den richtigen Namen in der Programm-Sprache geben
947 \************************************************************************/
949 void SdStyleSheetPool::UpdateStdNames()
952 sal_uInt32 nCount
= aStyles
.size();
953 List
* pEraseList
= NULL
;
955 for( sal_uInt32 n
=0; n
< nCount
; n
++ )
957 SfxStyleSheetBase
* pStyle
= aStyles
[ n
].get();
959 if( !pStyle
->IsUserDefined() )
961 String aOldName
= pStyle
->GetName();
962 ULONG nHelpId
= pStyle
->GetHelpId( aHelpFile
);
963 SfxStyleFamily eFam
= pStyle
->GetFamily();
965 BOOL bHelpKnown
= TRUE
;
970 case HID_STANDARD_STYLESHEET_NAME
: nNameId
= STR_STANDARD_STYLESHEET_NAME
; break;
971 case HID_POOLSHEET_OBJWITHARROW
: nNameId
= STR_POOLSHEET_OBJWITHARROW
; break;
972 case HID_POOLSHEET_OBJWITHSHADOW
: nNameId
= STR_POOLSHEET_OBJWITHSHADOW
; break;
973 case HID_POOLSHEET_OBJWITHOUTFILL
: nNameId
= STR_POOLSHEET_OBJWITHOUTFILL
; break;
974 case HID_POOLSHEET_TEXT
: nNameId
= STR_POOLSHEET_TEXT
; break;
975 case HID_POOLSHEET_TEXTBODY
: nNameId
= STR_POOLSHEET_TEXTBODY
; break;
976 case HID_POOLSHEET_TEXTBODY_JUSTIFY
:nNameId
= STR_POOLSHEET_TEXTBODY_JUSTIFY
;break;
977 case HID_POOLSHEET_TEXTBODY_INDENT
: nNameId
= STR_POOLSHEET_TEXTBODY_INDENT
;break;
978 case HID_POOLSHEET_TITLE
: nNameId
= STR_POOLSHEET_TITLE
; break;
979 case HID_POOLSHEET_TITLE1
: nNameId
= STR_POOLSHEET_TITLE1
; break;
980 case HID_POOLSHEET_TITLE2
: nNameId
= STR_POOLSHEET_TITLE2
; break;
981 case HID_POOLSHEET_HEADLINE
: nNameId
= STR_POOLSHEET_HEADLINE
; break;
982 case HID_POOLSHEET_HEADLINE1
: nNameId
= STR_POOLSHEET_HEADLINE1
; break;
983 case HID_POOLSHEET_HEADLINE2
: nNameId
= STR_POOLSHEET_HEADLINE2
; break;
984 case HID_POOLSHEET_MEASURE
: nNameId
= STR_POOLSHEET_MEASURE
; break;
986 case HID_PSEUDOSHEET_TITLE
: nNameId
= STR_PSEUDOSHEET_TITLE
; break;
987 case HID_PSEUDOSHEET_SUBTITLE
: nNameId
= STR_PSEUDOSHEET_SUBTITLE
; break;
988 case HID_PSEUDOSHEET_OUTLINE1
:
989 case HID_PSEUDOSHEET_OUTLINE2
:
990 case HID_PSEUDOSHEET_OUTLINE3
:
991 case HID_PSEUDOSHEET_OUTLINE4
:
992 case HID_PSEUDOSHEET_OUTLINE5
:
993 case HID_PSEUDOSHEET_OUTLINE6
:
994 case HID_PSEUDOSHEET_OUTLINE7
:
995 case HID_PSEUDOSHEET_OUTLINE8
:
996 case HID_PSEUDOSHEET_OUTLINE9
: nNameId
= STR_PSEUDOSHEET_OUTLINE
; break;
997 case HID_PSEUDOSHEET_BACKGROUNDOBJECTS
: nNameId
= STR_PSEUDOSHEET_BACKGROUNDOBJECTS
; break;
998 case HID_PSEUDOSHEET_BACKGROUND
: nNameId
= STR_PSEUDOSHEET_BACKGROUND
; break;
999 case HID_PSEUDOSHEET_NOTES
: nNameId
= STR_PSEUDOSHEET_NOTES
; break;
1001 case HID_SD_CELL_STYLE_DEFAULT
: nNameId
= STR_STANDARD_STYLESHEET_NAME
; break;
1002 case HID_SD_CELL_STYLE_BANDED
: nNameId
= STR_POOLSHEET_BANDED_CELL
; break;
1003 case HID_SD_CELL_STYLE_HEADER
: nNameId
= STR_POOLSHEET_HEADER
; break;
1004 case HID_SD_CELL_STYLE_TOTAL
: nNameId
= STR_POOLSHEET_TOTAL
; break;
1005 case HID_SD_CELL_STYLE_FIRST_COLUMN
: nNameId
= STR_POOLSHEET_FIRST_COLUMN
; break;
1006 case HID_SD_CELL_STYLE_LAST_COLUMN
: nNameId
= STR_POOLSHEET_LAST_COLUMN
; break;
1009 // 0 oder falsche (alte) HelpId
1016 aNewName
= String( SdResId( nNameId
) );
1017 if( nNameId
== STR_PSEUDOSHEET_OUTLINE
)
1019 aNewName
.Append( sal_Unicode( ' ' ));
1020 aNewName
.Append( String::CreateFromInt32( sal_Int32( nHelpId
- HID_PSEUDOSHEET_OUTLINE
)));
1024 if( aNewName
.Len() && aNewName
!= aOldName
)
1026 SfxStyleSheetBase
* pSheetFound
= Find( aNewName
, eFam
);
1030 // Sheet existiert noch nicht: Altes Sheet wird umbenannt
1031 pStyle
->SetName( aNewName
); // setzt auch Parents um
1035 // Sheet existiert schon: Altes Sheet muss entfernt werden
1038 pEraseList
= new List();
1041 pEraseList
->Insert( pStyle
);
1050 // Styles, welche nicht umbenannt werden konnten, muessen entfernt werden
1051 for ( ULONG i
= 0; i
< pEraseList
->Count(); i
++ )
1053 SfxStyleSheetBase
* pEraseSheet
= ( SfxStyleSheetBase
* ) pEraseList
->GetObject( i
);
1054 Remove( pEraseSheet
);
1061 // --------------------------------------------------------------------
1062 // Neues SvxNumBulletItem fuer das jeweilige StyleSheet setzen
1063 // --------------------------------------------------------------------
1065 void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase
* pSheet
,
1069 ULONG nHelpId
= pSheet
->GetHelpId( aHelpFile
);
1070 SfxItemSet
& rSet
= pSheet
->GetItemSet();
1074 case HID_STANDARD_STYLESHEET_NAME
:
1077 SvxNumberFormat
aNumberFormat(SVX_NUM_CHAR_SPECIAL
);
1078 aNumberFormat
.SetBulletFont(&rBulletFont
);
1079 aNumberFormat
.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
1080 aNumberFormat
.SetBulletRelSize(45);
1081 aNumberFormat
.SetBulletColor(Color(COL_AUTO
));
1082 aNumberFormat
.SetStart(1);
1083 aNumberFormat
.SetNumAdjust(SVX_ADJUST_LEFT
);
1085 SvxNumRule
aNumRule( NUM_BULLET_REL_SIZE
|NUM_BULLET_COLOR
|NUM_CHAR_TEXT_DISTANCE
, 10 , FALSE
);
1086 aNumberFormat
.SetLSpace( 0 );
1087 aNumberFormat
.SetAbsLSpace( 0 );
1088 aNumberFormat
.SetFirstLineOffset( 0 );
1089 aNumRule
.SetLevel( 0, aNumberFormat
);
1091 for( USHORT i
= 1; i
< aNumRule
.GetLevelCount(); i
++ )
1093 const short nLSpace
= (i
+ 1) * 600;
1094 aNumberFormat
.SetLSpace(nLSpace
);
1095 aNumberFormat
.SetAbsLSpace(nLSpace
);
1096 aNumberFormat
.SetFirstLineOffset(-600);
1097 aNumRule
.SetLevel( i
, aNumberFormat
);
1100 rSet
.Put( SvxNumBulletItem( aNumRule
, EE_PARA_NUMBULLET
) );
1101 ((SfxStyleSheet
*)pSheet
)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED
) );
1105 case HID_PSEUDOSHEET_TITLE
:
1106 /* #84013# title gets same bullet as subtitle and not that page symbol anymore */
1107 case HID_PSEUDOSHEET_SUBTITLE
:
1109 // Untertitel-Vorlage
1110 SvxNumRule
* pDefaultRule
= ((SvxNumBulletItem
*) rSet
.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET
))->GetNumRule();
1111 DBG_ASSERT( pDefaultRule
, "Wo ist mein Default? [CL]" );
1115 SvxNumRule
aNumRule(pDefaultRule
->GetFeatureFlags(), 10, FALSE
);
1116 for(USHORT i
=0; i
< aNumRule
.GetLevelCount(); i
++)
1118 SvxNumberFormat
aFrmt( pDefaultRule
->GetLevel(i
) );
1119 aFrmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
1121 aFrmt
.SetBulletRelSize(45);
1122 aFrmt
.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
1123 aFrmt
.SetBulletFont(&rBulletFont
);
1124 aNumRule
.SetLevel(i
, aFrmt
);
1127 rSet
.Put( SvxNumBulletItem( aNumRule
, EE_PARA_NUMBULLET
) );
1128 ((SfxStyleSheet
*)pSheet
)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED
) );
1133 case HID_PSEUDOSHEET_OUTLINE
+ 1 :
1135 // Gliederungs-Vorlage
1136 SvxNumberFormat
aNumberFormat(SVX_NUM_CHAR_SPECIAL
);
1137 aNumberFormat
.SetBulletColor(Color(COL_AUTO
));
1138 aNumberFormat
.SetStart(1);
1139 aNumberFormat
.SetNumAdjust(SVX_ADJUST_LEFT
);
1141 SvxNumRule
aNumRule( NUM_BULLET_REL_SIZE
|NUM_BULLET_COLOR
|NUM_CHAR_TEXT_DISTANCE
|NUM_SYMBOL_ALIGNMENT
,
1143 for( UINT16 i
= 0; i
< aNumRule
.GetLevelCount(); i
++ )
1145 aNumberFormat
.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
1146 aNumberFormat
.SetBulletRelSize(45);
1147 const short nLSpace
= (i
+ 1) * 1200;
1148 aNumberFormat
.SetLSpace(nLSpace
);
1149 aNumberFormat
.SetAbsLSpace(nLSpace
);
1150 short nFirstLineOffset
= -600;
1152 ULONG nFontSize
= 20;
1159 nFirstLineOffset
= -900;
1166 nFirstLineOffset
= -800;
1167 aNumberFormat
.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
1168 aNumberFormat
.SetBulletRelSize(75);
1180 aNumberFormat
.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
1181 aNumberFormat
.SetBulletRelSize(75);
1186 aNumberFormat
.SetFirstLineOffset(nFirstLineOffset
);
1187 nFontSize
= (USHORT
)((nFontSize
* 2540L) / 72); // Pt --> 1/100 mm
1188 rBulletFont
.SetSize(Size(0,846)); // 24 pt
1189 aNumberFormat
.SetBulletFont(&rBulletFont
);
1190 aNumRule
.SetLevel( i
, aNumberFormat
);
1193 rSet
.Put( SvxNumBulletItem( aNumRule
, EE_PARA_NUMBULLET
) );
1194 ((SfxStyleSheet
*)pSheet
)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED
) );
1200 /*************************************************************************
1202 |* Standard Bullet-Font erzeugen (ohne Groesse)
1204 \************************************************************************/
1206 Font
SdStyleSheetPool::GetBulletFont() const
1208 Font
aBulletFont( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )), Size(0, 1000) );
1209 aBulletFont
.SetCharSet(RTL_TEXTENCODING_UNICODE
);
1210 aBulletFont
.SetWeight(WEIGHT_NORMAL
);
1211 aBulletFont
.SetUnderline(UNDERLINE_NONE
);
1212 aBulletFont
.SetOverline(UNDERLINE_NONE
);
1213 aBulletFont
.SetStrikeout(STRIKEOUT_NONE
);
1214 aBulletFont
.SetItalic(ITALIC_NONE
);
1215 aBulletFont
.SetOutline(FALSE
);
1216 aBulletFont
.SetShadow(FALSE
);
1217 aBulletFont
.SetColor(Color(COL_AUTO
));
1218 aBulletFont
.SetTransparent(TRUE
);
1223 // --------------------------------------------------------------------
1225 void SdStyleSheetPool::AddStyleFamily( const SdPage
* pPage
)
1227 rtl::Reference
< SfxStyleSheetPool
> xPool( this );
1228 maStyleFamilyMap
[pPage
] = new SdStyleFamily( xPool
, pPage
);
1231 // --------------------------------------------------------------------
1233 void SdStyleSheetPool::RemoveStyleFamily( const SdPage
* pPage
)
1235 SdStyleFamilyMap::iterator
iter( maStyleFamilyMap
.find( pPage
) );
1236 if( iter
!= maStyleFamilyMap
.end() )
1238 SdStyleFamilyRef
xStyle( (*iter
).second
);
1239 maStyleFamilyMap
.erase( iter
);
1241 if( xStyle
.is() ) try
1251 // --------------------------------------------------------------------
1253 void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeException
)
1256 throw DisposedException();
1259 // --------------------------------------------------------------------
1261 // --------------------------------------------------------------------
1263 OUString SAL_CALL
SdStyleSheetPool::getImplementationName() throw(RuntimeException
)
1265 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdStyleSheetPool") );
1268 // --------------------------------------------------------------------
1270 static const sal_Char
* gpServiceName
= "com.sun.star.style.StyleFamilies";
1272 sal_Bool SAL_CALL
SdStyleSheetPool::supportsService( const OUString
& ServiceName
) throw(RuntimeException
)
1274 return ServiceName
.equalsAscii( gpServiceName
);
1277 // --------------------------------------------------------------------
1279 Sequence
< OUString
> SAL_CALL
SdStyleSheetPool::getSupportedServiceNames() throw(RuntimeException
)
1281 OUString
aStr( OUString::createFromAscii( gpServiceName
) );
1282 return Sequence
< OUString
>( &aStr
, 1 );
1285 // --------------------------------------------------------------------
1287 // --------------------------------------------------------------------
1289 Any SAL_CALL
SdStyleSheetPool::getByName( const OUString
& aName
) throw(NoSuchElementException
, WrappedTargetException
, RuntimeException
)
1293 if( mxGraphicFamily
->getName() == aName
)
1294 return Any( Reference
< XNameAccess
>( static_cast< XNameAccess
* >( mxGraphicFamily
.get() ) ) );
1296 if( mxCellFamily
->getName() == aName
)
1297 return Any( Reference
< XNameAccess
>( static_cast< XNameAccess
* >( mxCellFamily
.get() ) ) );
1299 if( msTableFamilyName
== aName
)
1300 return Any( mxTableFamily
);
1302 for( SdStyleFamilyMap::iterator
iter( maStyleFamilyMap
.begin() ); iter
!= maStyleFamilyMap
.end(); iter
++ )
1304 if( (*iter
).second
->getName() == aName
)
1305 return Any( Reference
< XNameAccess
>( static_cast< XNameAccess
* >( (*iter
).second
.get() ) ) );
1308 throw NoSuchElementException();
1311 // --------------------------------------------------------------------
1313 Sequence
< OUString
> SAL_CALL
SdStyleSheetPool::getElementNames() throw(RuntimeException
)
1317 Sequence
< OUString
> aNames( maStyleFamilyMap
.size() + 3 );
1318 OUString
* pNames
= aNames
.getArray();
1320 *pNames
++ = mxGraphicFamily
->getName();
1321 *pNames
++ = mxCellFamily
->getName();
1322 *pNames
++ = msTableFamilyName
;
1324 for( SdStyleFamilyMap::iterator
iter( maStyleFamilyMap
.begin() ); iter
!= maStyleFamilyMap
.end(); iter
++ )
1326 *pNames
++ = (*iter
).second
->getName();
1332 // --------------------------------------------------------------------
1334 sal_Bool SAL_CALL
SdStyleSheetPool::hasByName( const OUString
& aName
) throw(RuntimeException
)
1338 if( mxGraphicFamily
->getName() == aName
)
1341 if( mxCellFamily
->getName() == aName
)
1344 if( msTableFamilyName
== aName
)
1347 for( SdStyleFamilyMap::iterator
iter( maStyleFamilyMap
.begin() ); iter
!= maStyleFamilyMap
.end(); iter
++ )
1349 if( (*iter
).second
->getName() == aName
)
1356 // --------------------------------------------------------------------
1358 // --------------------------------------------------------------------
1360 Type SAL_CALL
SdStyleSheetPool::getElementType() throw(RuntimeException
)
1364 return XNameAccess::static_type();
1367 // --------------------------------------------------------------------
1369 sal_Bool SAL_CALL
SdStyleSheetPool::hasElements() throw(RuntimeException
)
1374 // --------------------------------------------------------------------
1376 // --------------------------------------------------------------------
1378 sal_Int32 SAL_CALL
SdStyleSheetPool::getCount() throw(RuntimeException
)
1382 return maStyleFamilyMap
.size() + 3;
1385 // --------------------------------------------------------------------
1387 Any SAL_CALL
SdStyleSheetPool::getByIndex( sal_Int32 Index
) throw(IndexOutOfBoundsException
, WrappedTargetException
, RuntimeException
)
1392 return Any( Reference
< XNameAccess
>( static_cast< XNameAccess
* >( mxGraphicFamily
.get() ) ) );
1395 return Any( Reference
< XNameAccess
>( static_cast< XNameAccess
* >( mxCellFamily
.get() ) ) );
1398 return Any( mxTableFamily
);
1403 if( (Index
< 0) || (Index
>= sal::static_int_cast
<sal_Int32
>(maStyleFamilyMap
.size())) )
1404 throw IndexOutOfBoundsException();
1405 SdStyleFamilyMap::iterator
iter( maStyleFamilyMap
.begin() );
1409 return Any( Reference
< XNameAccess
>( static_cast< XNameAccess
* >( (*iter
).second
.get() ) ) );
1414 // --------------------------------------------------------------------
1416 // --------------------------------------------------------------------
1418 void SAL_CALL
SdStyleSheetPool::dispose() throw (RuntimeException
)
1422 mxGraphicFamily
->dispose();
1423 mxGraphicFamily
.clear();
1424 mxCellFamily
->dispose();
1425 mxCellFamily
.clear();
1427 Reference
< XComponent
> xComp( mxTableFamily
, UNO_QUERY
);
1432 SdStyleFamilyMap aTempMap
;
1433 aTempMap
.swap( maStyleFamilyMap
);
1435 for( SdStyleFamilyMap::iterator
iter( aTempMap
.begin() ); iter
!= aTempMap
.end(); iter
++ ) try
1437 (*iter
).second
->dispose();
1443 // EndListening( *mpDoc );
1448 // --------------------------------------------------------------------
1450 void SAL_CALL
SdStyleSheetPool::addEventListener( const Reference
< XEventListener
>& /*xListener*/ ) throw (RuntimeException
)
1454 // --------------------------------------------------------------------
1456 void SAL_CALL
SdStyleSheetPool::removeEventListener( const Reference
< XEventListener
>& /*aListener*/ ) throw (RuntimeException
)
1460 // --------------------------------------------------------------------
1462 SdStyleSheetVector
SdStyleSheetPool::CreateChildList( SdStyleSheet
* pSheet
)
1464 SdStyleSheetVector aResult
;
1466 USHORT nListenerCount
= pSheet
->GetListenerCount();
1467 if (nListenerCount
> 0)
1469 for (USHORT n
= 0; n
< nListenerCount
; n
++)
1471 SdStyleSheet
* pChild
= dynamic_cast< SdStyleSheet
* >( pSheet
->GetListener(n
) );
1472 if(pChild
&& pChild
->GetParent() == pSheet
->GetName())
1474 aResult
.push_back( SdStyleSheetRef( pChild
) );
1482 // --------------------------------------------------------------------