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.18.32.1 $
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_sc.hxx"
35 //------------------------------------------------------------------------
37 #include "scitems.hxx"
38 #include <svx/eeitem.hxx>
39 #include <svx/algitem.hxx>
40 #include <svx/boxitem.hxx>
41 #include <svx/brshitem.hxx>
42 #include <svx/editdata.hxx>
43 #include <svx/editeng.hxx>
44 #include <svx/editobj.hxx>
45 #include <svx/fhgtitem.hxx>
46 #include <svx/flditem.hxx>
47 #include <svx/fontitem.hxx>
48 #include <svx/pageitem.hxx>
49 #include <svx/postitem.hxx>
50 #include <svx/udlnitem.hxx>
51 #include <svx/wghtitem.hxx>
52 #include <svtools/itemset.hxx>
53 #include <svtools/zforlist.hxx>
54 #include <unotools/charclass.hxx>
55 #include <vcl/fontcvt.hxx>
56 #include <vcl/outdev.hxx>
57 #include <vcl/svapp.hxx>
62 #include "globstr.hrc"
63 #include "document.hxx"
64 #include "docpool.hxx"
65 #include "stlpool.hxx"
66 #include "stlsheet.hxx"
67 #include "rechead.hxx"
68 #include "editutil.hxx"
69 #include "patattr.hxx"
72 //========================================================================
74 ScStyleSheetPool::ScStyleSheetPool( SfxItemPool
& rPoolP
,
75 ScDocument
* pDocument
)
76 : SfxStyleSheetPool( rPoolP
),
77 pActualStyleSheet( NULL
),
83 //------------------------------------------------------------------------
85 __EXPORT
ScStyleSheetPool::~ScStyleSheetPool()
89 //------------------------------------------------------------------------
91 void ScStyleSheetPool::SetDocument( ScDocument
* pDocument
)
96 //------------------------------------------------------------------------
98 //UNUSED2009-05 void ScStyleSheetPool::SetForceStdName( const String* pSet )
100 //UNUSED2009-05 pForceStdName = pSet;
103 //------------------------------------------------------------------------
105 SfxStyleSheetBase
& ScStyleSheetPool::Make( const String
& rName
,
106 SfxStyleFamily eFam
, USHORT mask
, USHORT nPos
)
108 // When updating styles from a template, Office 5.1 sometimes created
109 // files with multiple default styles.
110 // Create new styles in that case:
112 //! only when loading?
114 if ( rName
.EqualsAscii(STRING_STANDARD
) && Find( rName
, eFam
) != NULL
)
116 DBG_ERROR("renaming additional default style");
117 sal_uInt32 nCount
= aStyles
.size();
118 for ( sal_uInt32 nAdd
= 1; nAdd
<= nCount
; nAdd
++ )
120 String aNewName
= ScGlobal::GetRscString(STR_STYLENAME_STANDARD
);
121 aNewName
+= String::CreateFromInt32( nAdd
);
122 if ( Find( aNewName
, eFam
) == NULL
)
123 return SfxStyleSheetPool::Make( aNewName
, eFam
, mask
, nPos
);
127 return SfxStyleSheetPool::Make( rName
, eFam
, mask
, nPos
);
130 //------------------------------------------------------------------------
132 SfxStyleSheetBase
* __EXPORT
ScStyleSheetPool::Create(
134 SfxStyleFamily eFamily
,
137 ScStyleSheet
* pSheet
= new ScStyleSheet( rName
, *this, eFamily
, nMaskP
);
138 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& ScGlobal::GetRscString(STR_STYLENAME_STANDARD
) != rName
)
139 pSheet
->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD
) );
144 //------------------------------------------------------------------------
146 SfxStyleSheetBase
* __EXPORT
ScStyleSheetPool::Create( const SfxStyleSheetBase
& rStyle
)
148 DBG_ASSERT( rStyle
.ISA(ScStyleSheet
), "Invalid StyleSheet-class! :-/" );
149 return new ScStyleSheet( (const ScStyleSheet
&) rStyle
);
152 //------------------------------------------------------------------------
154 void __EXPORT
ScStyleSheetPool::Remove( SfxStyleSheetBase
* pStyle
)
158 DBG_ASSERT( IS_SET( SFXSTYLEBIT_USERDEF
, pStyle
->GetMask() ),
159 "SFXSTYLEBIT_USERDEF not set!" );
161 ((ScDocumentPool
&)rPool
).StyleDeleted((ScStyleSheet
*)pStyle
);
162 SfxStyleSheetPool::Remove(pStyle
);
166 //------------------------------------------------------------------------
168 void ScStyleSheetPool::CopyStyleFrom( ScStyleSheetPool
* pSrcPool
,
169 const String
& rName
, SfxStyleFamily eFamily
)
171 // this ist Dest-Pool
173 SfxStyleSheetBase
* pStyleSheet
= pSrcPool
->Find( rName
, eFamily
);
176 const SfxItemSet
& rSourceSet
= pStyleSheet
->GetItemSet();
177 SfxStyleSheetBase
* pDestSheet
= Find( rName
, eFamily
);
179 pDestSheet
= &Make( rName
, eFamily
);
180 SfxItemSet
& rDestSet
= pDestSheet
->GetItemSet();
181 rDestSet
.PutExtended( rSourceSet
, SFX_ITEM_DONTCARE
, SFX_ITEM_DEFAULT
);
183 const SfxPoolItem
* pItem
;
184 if ( eFamily
== SFX_STYLE_FAMILY_PAGE
)
188 if ( rSourceSet
.GetItemState( ATTR_PAGE_HEADERSET
, FALSE
, &pItem
) == SFX_ITEM_SET
)
190 const SfxItemSet
& rSrcSub
= ((const SvxSetItem
*) pItem
)->GetItemSet();
191 SfxItemSet
aDestSub( *rDestSet
.GetPool(), rSrcSub
.GetRanges() );
192 aDestSub
.PutExtended( rSrcSub
, SFX_ITEM_DONTCARE
, SFX_ITEM_DEFAULT
);
193 rDestSet
.Put( SvxSetItem( ATTR_PAGE_HEADERSET
, aDestSub
) );
195 if ( rSourceSet
.GetItemState( ATTR_PAGE_FOOTERSET
, FALSE
, &pItem
) == SFX_ITEM_SET
)
197 const SfxItemSet
& rSrcSub
= ((const SvxSetItem
*) pItem
)->GetItemSet();
198 SfxItemSet
aDestSub( *rDestSet
.GetPool(), rSrcSub
.GetRanges() );
199 aDestSub
.PutExtended( rSrcSub
, SFX_ITEM_DONTCARE
, SFX_ITEM_DEFAULT
);
200 rDestSet
.Put( SvxSetItem( ATTR_PAGE_FOOTERSET
, aDestSub
) );
205 // #b5017505# number format exchange list has to be handled here, too
207 if ( pDoc
&& pDoc
->GetFormatExchangeList() &&
208 rSourceSet
.GetItemState( ATTR_VALUE_FORMAT
, FALSE
, &pItem
) == SFX_ITEM_SET
)
210 ULONG nOldFormat
= static_cast<const SfxUInt32Item
*>(pItem
)->GetValue();
211 sal_uInt32
* pNewFormat
= static_cast<sal_uInt32
*>(pDoc
->GetFormatExchangeList()->Get( nOldFormat
));
213 rDestSet
.Put( SfxUInt32Item( ATTR_VALUE_FORMAT
, *pNewFormat
) );
219 //------------------------------------------------------------------------
223 //------------------------------------------------------------------------
225 #define SCSTR(id) ScGlobal::GetRscString(id)
227 void ScStyleSheetPool::CopyStdStylesFrom( ScStyleSheetPool
* pSrcPool
)
229 // Default-Styles kopieren
231 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_STANDARD
), SFX_STYLE_FAMILY_PARA
);
232 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_RESULT
), SFX_STYLE_FAMILY_PARA
);
233 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_RESULT1
), SFX_STYLE_FAMILY_PARA
);
234 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_HEADLINE
), SFX_STYLE_FAMILY_PARA
);
235 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_HEADLINE1
), SFX_STYLE_FAMILY_PARA
);
236 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_STANDARD
), SFX_STYLE_FAMILY_PAGE
);
237 CopyStyleFrom( pSrcPool
, SCSTR(STR_STYLENAME_REPORT
), SFX_STYLE_FAMILY_PAGE
);
240 //------------------------------------------------------------------------
242 void lcl_CheckFont( SfxItemSet
& rSet
, LanguageType eLang
, USHORT nFontType
, USHORT nItemId
)
244 if ( eLang
!= LANGUAGE_NONE
&& eLang
!= LANGUAGE_DONTKNOW
&& eLang
!= LANGUAGE_SYSTEM
)
246 Font aDefFont
= OutputDevice::GetDefaultFont( nFontType
, eLang
, DEFAULTFONT_FLAGS_ONLYONE
);
247 SvxFontItem
aNewItem( aDefFont
.GetFamily(), aDefFont
.GetName(), aDefFont
.GetStyleName(),
248 aDefFont
.GetPitch(), aDefFont
.GetCharSet(), nItemId
);
249 if ( aNewItem
!= rSet
.Get( nItemId
) )
251 // put item into style's ItemSet only if different from (static) default
252 rSet
.Put( aNewItem
);
257 void ScStyleSheetPool::CreateStandardStyles()
259 // neue Eintraege auch bei CopyStdStylesFrom eintragen
261 Color
aColBlack ( COL_BLACK
);
262 Color
aColGrey ( COL_LIGHTGRAY
);
265 String aHelpFile
;//XXX JN welcher Text???
266 //ULONG nNumFmt = 0L;
267 SfxItemSet
* pSet
= NULL
;
268 SfxItemSet
* pHFSet
= NULL
;
269 SvxSetItem
* pHFSetItem
= NULL
;
270 ScEditEngineDefaulter
* pEdEngine
= new ScEditEngineDefaulter( EditEngine::CreatePool(), TRUE
);
271 pEdEngine
->SetUpdateMode( FALSE
);
272 EditTextObject
* pEmptyTxtObj
= pEdEngine
->CreateTextObject();
273 EditTextObject
* pTxtObj
= NULL
;
274 ScPageHFItem
* pHeaderItem
= new ScPageHFItem( ATTR_PAGE_HEADERRIGHT
);
275 ScPageHFItem
* pFooterItem
= new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT
);
276 ScStyleSheet
* pSheet
= NULL
;
277 SvxBorderLine
aBorderLine ( &aColBlack
, DEF_LINE_WIDTH_2
);
278 SvxBoxItem
aBoxItem ( ATTR_BORDER
);
279 SvxBoxInfoItem
aBoxInfoItem ( ATTR_BORDER_INNER
);
281 String aStrStandard
= ScGlobal::GetRscString(STR_STYLENAME_STANDARD
);
283 //==========================================================
284 // Zellformatvorlagen:
285 //==========================================================
290 pSheet
= (ScStyleSheet
*) &Make( aStrStandard
, SFX_STYLE_FAMILY_PARA
, SCSTYLEBIT_STANDARD
);
291 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_CELL_STD
);
293 // if default fonts for the document's languages are different from the pool default,
294 // put them into the default style
295 // (not as pool defaults, because pool defaults can't be changed by the user)
296 // the document languages must be set before creating the default styles!
298 pSet
= &pSheet
->GetItemSet();
299 LanguageType eLatin
, eCjk
, eCtl
;
300 pDoc
->GetLanguage( eLatin
, eCjk
, eCtl
);
302 // #108374# / #107782#: If the UI language is Korean, the default Latin font has to
303 // be queried for Korean, too (the Latin language from the document can't be Korean).
304 // This is the same logic as in SwDocShell::InitNew.
305 LanguageType eUiLanguage
= Application::GetSettings().GetUILanguage();
306 switch( eUiLanguage
)
308 case LANGUAGE_KOREAN
:
309 case LANGUAGE_KOREAN_JOHAB
:
310 eLatin
= eUiLanguage
;
314 lcl_CheckFont( *pSet
, eLatin
, DEFAULTFONT_LATIN_SPREADSHEET
, ATTR_FONT
);
315 lcl_CheckFont( *pSet
, eCjk
, DEFAULTFONT_CJK_SPREADSHEET
, ATTR_CJK_FONT
);
316 lcl_CheckFont( *pSet
, eCtl
, DEFAULTFONT_CTL_SPREADSHEET
, ATTR_CTL_FONT
);
318 // #i55300# default CTL font size for Thai has to be larger
319 // #i59408# The 15 point size causes problems with row heights, so no different
320 // size is used for Thai in Calc for now.
321 // if ( eCtl == LANGUAGE_THAI )
322 // pSet->Put( SvxFontHeightItem( 300, 100, ATTR_CTL_FONT_HEIGHT ) ); // 15 pt
328 pSheet
= (ScStyleSheet
*) &Make( SCSTR( STR_STYLENAME_RESULT
),
329 SFX_STYLE_FAMILY_PARA
,
330 SCSTYLEBIT_STANDARD
);
331 pSheet
->SetParent( aStrStandard
);
332 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_CELL_ERG
);
333 pSet
= &pSheet
->GetItemSet();
334 pSet
->Put( SvxWeightItem( WEIGHT_BOLD
, ATTR_FONT_WEIGHT
) );
335 pSet
->Put( SvxPostureItem( ITALIC_NORMAL
, ATTR_FONT_POSTURE
) );
336 pSet
->Put( SvxUnderlineItem( UNDERLINE_SINGLE
, ATTR_FONT_UNDERLINE
) );
342 pSheet
= (ScStyleSheet
*) &Make( SCSTR( STR_STYLENAME_RESULT1
),
343 SFX_STYLE_FAMILY_PARA
,
344 SCSTYLEBIT_STANDARD
);
346 pSheet
->SetParent( SCSTR( STR_STYLENAME_RESULT
) );
347 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_CELL_ERG1
);
348 // will now be done in GetItemSet();
349 // pSet = &pSheet->GetItemSet();
350 // nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY,
351 // ScGlobal::eLnge );
352 // pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
358 pSheet
= (ScStyleSheet
*) &Make( SCSTR( STR_STYLENAME_HEADLINE
),
359 SFX_STYLE_FAMILY_PARA
,
360 SCSTYLEBIT_STANDARD
);
362 pSheet
->SetParent( aStrStandard
);
363 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_CELL_UEB
);
364 pSet
= &pSheet
->GetItemSet();
365 pSet
->Put( SvxFontHeightItem( 320, 100, ATTR_FONT_HEIGHT
) ); // 16pt
366 pSet
->Put( SvxWeightItem( WEIGHT_BOLD
, ATTR_FONT_WEIGHT
) );
367 pSet
->Put( SvxPostureItem( ITALIC_NORMAL
, ATTR_FONT_POSTURE
) );
368 pSet
->Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER
, ATTR_HOR_JUSTIFY
) );
374 pSheet
= (ScStyleSheet
*) &Make( SCSTR( STR_STYLENAME_HEADLINE1
),
375 SFX_STYLE_FAMILY_PARA
,
376 SCSTYLEBIT_STANDARD
);
378 pSheet
->SetParent( SCSTR( STR_STYLENAME_HEADLINE
) );
379 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_CELL_UEB1
);
380 pSet
= &pSheet
->GetItemSet();
381 pSet
->Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 9000 ) );
383 //==========================================================
384 // Seitenformat-Vorlagen:
385 //==========================================================
391 pSheet
= (ScStyleSheet
*) &Make( aStrStandard
,
392 SFX_STYLE_FAMILY_PAGE
,
393 SCSTYLEBIT_STANDARD
);
395 pSet
= &pSheet
->GetItemSet();
396 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_PAGE_STD
);
398 // Abstand der Kopf-/Fusszeilen von der Tabelle
399 pHFSetItem
= new SvxSetItem( ((SvxSetItem
&)pSet
->Get( ATTR_PAGE_HEADERSET
) ) );
400 pSet
->Put( *pHFSetItem
, ATTR_PAGE_HEADERSET
);
401 pSet
->Put( *pHFSetItem
, ATTR_PAGE_FOOTERSET
);
402 DELETEZ( pHFSetItem
);
404 //----------------------------------------
406 // [leer][\TABELLE\][leer]
407 //----------------------------------------
408 pEdEngine
->SetText(EMPTY_STRING
);
409 pEdEngine
->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD
), ESelection() );
410 pTxtObj
= pEdEngine
->CreateTextObject();
411 pHeaderItem
->SetLeftArea ( *pEmptyTxtObj
);
412 pHeaderItem
->SetCenterArea( *pTxtObj
);
413 pHeaderItem
->SetRightArea ( *pEmptyTxtObj
);
414 pSet
->Put( *pHeaderItem
);
417 //----------------------------------------
419 // [leer][Seite \SEITE\][leer]
420 //----------------------------------------
421 aStr
= SCSTR( STR_PAGE
); aStr
+= ' ';
422 pEdEngine
->SetText( aStr
);
423 nStrLen
= aStr
.Len();
424 pEdEngine
->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD
), ESelection(0,nStrLen
,0,nStrLen
) );
425 pTxtObj
= pEdEngine
->CreateTextObject();
426 pFooterItem
->SetLeftArea ( *pEmptyTxtObj
);
427 pFooterItem
->SetCenterArea( *pTxtObj
);
428 pFooterItem
->SetRightArea ( *pEmptyTxtObj
);
429 pSet
->Put( *pFooterItem
);
436 pSheet
= (ScStyleSheet
*) &Make( SCSTR( STR_STYLENAME_REPORT
),
437 SFX_STYLE_FAMILY_PAGE
,
438 SCSTYLEBIT_STANDARD
);
439 pSet
= &pSheet
->GetItemSet();
440 pSheet
->SetHelpId( aHelpFile
, HID_SC_SHEET_PAGE_REP
);
442 // Hintergrund und Umrandung
443 aBoxItem
.SetLine( &aBorderLine
, BOX_LINE_TOP
);
444 aBoxItem
.SetLine( &aBorderLine
, BOX_LINE_BOTTOM
);
445 aBoxItem
.SetLine( &aBorderLine
, BOX_LINE_LEFT
);
446 aBoxItem
.SetLine( &aBorderLine
, BOX_LINE_RIGHT
);
447 aBoxItem
.SetDistance( 10 ); // 0.2mm
448 aBoxInfoItem
.SetValid( VALID_TOP
, TRUE
);
449 aBoxInfoItem
.SetValid( VALID_BOTTOM
, TRUE
);
450 aBoxInfoItem
.SetValid( VALID_LEFT
, TRUE
);
451 aBoxInfoItem
.SetValid( VALID_RIGHT
, TRUE
);
452 aBoxInfoItem
.SetValid( VALID_DISTANCE
, TRUE
);
453 aBoxInfoItem
.SetTable( FALSE
);
454 aBoxInfoItem
.SetDist ( TRUE
);
456 pHFSetItem
= new SvxSetItem( ((SvxSetItem
&)pSet
->Get( ATTR_PAGE_HEADERSET
) ) );
457 pHFSet
= &(pHFSetItem
->GetItemSet());
459 pHFSet
->Put( SvxBrushItem( aColGrey
, ATTR_BACKGROUND
) );
460 pHFSet
->Put( aBoxItem
);
461 pHFSet
->Put( aBoxInfoItem
);
462 pSet
->Put( *pHFSetItem
, ATTR_PAGE_HEADERSET
);
463 pSet
->Put( *pHFSetItem
, ATTR_PAGE_FOOTERSET
);
464 DELETEZ( pHFSetItem
);
466 //----------------------------------------
468 // [\TABELLE\ (\DATEI\)][leer][\DATUM\, \ZEIT\]
469 //----------------------------------------
470 aStr
= String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(" ()"));
471 pEdEngine
->SetText( aStr
);
472 pEdEngine
->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD
), ESelection(0,2,0,2) );
473 pEdEngine
->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD
), ESelection() );
474 pTxtObj
= pEdEngine
->CreateTextObject();
475 pHeaderItem
->SetLeftArea( *pTxtObj
);
476 pHeaderItem
->SetCenterArea( *pEmptyTxtObj
);
478 aStr
= String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(", "));
479 pEdEngine
->SetText( aStr
);
480 pEdEngine
->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD
), ESelection(0,2,0,2) );
481 pEdEngine
->QuickInsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR
), EE_FEATURE_FIELD
),
483 pTxtObj
= pEdEngine
->CreateTextObject();
484 pHeaderItem
->SetRightArea( *pTxtObj
);
486 pSet
->Put( *pHeaderItem
);
488 //----------------------------------------
490 // [leer][Seite: \SEITE\ / \SEITEN\][leer]
491 //----------------------------------------
492 aStr
= SCSTR( STR_PAGE
); aStr
+= ' ';
493 nStrLen
= aStr
.Len();
494 aStr
.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" / "));
495 xub_StrLen nStrLen2
= aStr
.Len();
496 pEdEngine
->SetText( aStr
);
497 pEdEngine
->QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD
), ESelection(0,nStrLen2
,0,nStrLen2
) );
498 pEdEngine
->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD
), ESelection(0,nStrLen
,0,nStrLen
) );
499 pTxtObj
= pEdEngine
->CreateTextObject();
500 pFooterItem
->SetLeftArea ( *pEmptyTxtObj
);
501 pFooterItem
->SetCenterArea( *pTxtObj
);
502 pFooterItem
->SetRightArea ( *pEmptyTxtObj
);
503 pSet
->Put( *pFooterItem
);
506 //----------------------------------------------------
507 DELETEZ( pEmptyTxtObj
);
508 DELETEZ( pHeaderItem
);
509 DELETEZ( pFooterItem
);
510 DELETEZ( pEdEngine
);
513 //------------------------------------------------------------------------
515 //UNUSED2008-05 void ScStyleSheetPool::UpdateStdNames()
517 //UNUSED2008-05 // Standard-Styles den richtigen Namen in der Programm-Sprache geben
519 //UNUSED2008-05 String aHelpFile;
520 //UNUSED2008-05 sal_uInt32 nCount = aStyles.size();
521 //UNUSED2008-05 for (sal_uInt32 n=0; n<nCount; n++)
523 //UNUSED2008-05 SfxStyleSheetBase* pStyle = aStyles[n].get();
524 //UNUSED2008-05 if (!pStyle->IsUserDefined())
526 //UNUSED2008-05 String aOldName = pStyle->GetName();
527 //UNUSED2008-05 ULONG nHelpId = pStyle->GetHelpId( aHelpFile );
528 //UNUSED2008-05 SfxStyleFamily eFam = pStyle->GetFamily();
530 //UNUSED2008-05 BOOL bHelpKnown = TRUE;
531 //UNUSED2008-05 String aNewName;
532 //UNUSED2008-05 USHORT nNameId = 0;
533 //UNUSED2008-05 switch( nHelpId )
535 //UNUSED2008-05 case HID_SC_SHEET_CELL_STD:
536 //UNUSED2008-05 case HID_SC_SHEET_PAGE_STD: nNameId = STR_STYLENAME_STANDARD; break;
537 //UNUSED2008-05 case HID_SC_SHEET_CELL_ERG: nNameId = STR_STYLENAME_RESULT; break;
538 //UNUSED2008-05 case HID_SC_SHEET_CELL_ERG1: nNameId = STR_STYLENAME_RESULT1; break;
539 //UNUSED2008-05 case HID_SC_SHEET_CELL_UEB: nNameId = STR_STYLENAME_HEADLINE; break;
540 //UNUSED2008-05 case HID_SC_SHEET_CELL_UEB1: nNameId = STR_STYLENAME_HEADLINE1; break;
541 //UNUSED2008-05 case HID_SC_SHEET_PAGE_REP: nNameId = STR_STYLENAME_REPORT; break;
542 //UNUSED2008-05 default:
543 //UNUSED2008-05 // 0 oder falsche (alte) HelpId
544 //UNUSED2008-05 bHelpKnown = FALSE;
546 //UNUSED2008-05 if (bHelpKnown)
548 //UNUSED2008-05 if ( nNameId )
549 //UNUSED2008-05 aNewName = SCSTR( nNameId );
551 //UNUSED2008-05 if ( aNewName.Len() && aNewName != aOldName && !Find( aNewName, eFam ) )
553 //UNUSED2008-05 DBG_TRACE( "Renaming style..." );
555 //UNUSED2008-05 pStyle->SetName( aNewName ); // setzt auch Parents um
557 //UNUSED2008-05 // Styles in Patterns sind schon auf Pointer umgesetzt
558 //UNUSED2008-05 if (eFam == SFX_STYLE_FAMILY_PAGE)
560 //UNUSED2008-05 // Page-Styles umsetzen
561 //UNUSED2008-05 // TableCount am Doc ist noch nicht initialisiert
562 //UNUSED2008-05 for (SCTAB nTab=0; nTab<=MAXTAB && pDoc->HasTable(nTab); nTab++)
563 //UNUSED2008-05 if (pDoc->GetPageStyle(nTab) == aOldName)
564 //UNUSED2008-05 pDoc->SetPageStyle(nTab, aNewName);
570 //UNUSED2008-05 // wrong or no HelpId -> set new HelpId
572 //UNUSED2008-05 // no assertion for wrong HelpIds because this happens
573 //UNUSED2008-05 // with old files (#67218#) or with old files that were
574 //UNUSED2008-05 // saved again with a new version in a different language
575 //UNUSED2008-05 // (so SrcVersion doesn't help)
577 //UNUSED2008-05 USHORT nNewId = 0;
578 //UNUSED2008-05 if ( eFam == SFX_STYLE_FAMILY_PARA )
580 //UNUSED2008-05 if ( aOldName == SCSTR( STR_STYLENAME_STANDARD ) )
581 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_STD;
582 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_RESULT ) )
583 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_ERG;
584 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_RESULT1 ) )
585 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_ERG1;
586 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_HEADLINE ) )
587 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_UEB;
588 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_HEADLINE1 ) )
589 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_UEB1;
591 //UNUSED2008-05 else // PAGE
593 //UNUSED2008-05 if ( aOldName == SCSTR( STR_STYLENAME_STANDARD ) )
594 //UNUSED2008-05 nNewId = HID_SC_SHEET_PAGE_STD;
595 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_REPORT ) )
596 //UNUSED2008-05 nNewId = HID_SC_SHEET_PAGE_REP;
599 //UNUSED2008-05 if ( nNewId ) // new ID found from name -> set ID
601 //UNUSED2008-05 pStyle->SetHelpId( aHelpFile, nNewId );
603 //UNUSED2008-05 else if ( nHelpId == 0 ) // no old and no new ID
605 //UNUSED2008-05 // #71471# probably user defined style without SFXSTYLEBIT_USERDEF set
606 //UNUSED2008-05 // (from StarCalc 1.0 import), fixed in src563 and above
607 //UNUSED2008-05 //! may also be default style from a different language
608 //UNUSED2008-05 //! test if name was generated from StarCalc 1.0 import?
609 //UNUSED2008-05 DBG_ASSERT(pDoc->GetSrcVersion() <= SC_SUBTOTAL_BUGFIX,
610 //UNUSED2008-05 "user defined style without SFXSTYLEBIT_USERDEF");
611 //UNUSED2008-05 pStyle->SetMask( pStyle->GetMask() | SFXSTYLEBIT_USERDEF );
613 //UNUSED2008-05 // else: wrong old ID and no new ID found:
614 //UNUSED2008-05 // probably default style from a different language
615 //UNUSED2008-05 // -> leave unchanged (HelpId will be set if loaded with matching
616 //UNUSED2008-05 // language version later)
622 //------------------------------------------------------------------------
624 ScStyleSheet
* ScStyleSheetPool::FindCaseIns( const String
& rName
, SfxStyleFamily eFam
)
626 String aUpSearch
= rName
;
627 ScGlobal::pCharClass
->toUpper(aUpSearch
);
629 sal_uInt32 nCount
= aStyles
.size();
630 for (sal_uInt32 n
=0; n
<nCount
; n
++)
632 SfxStyleSheetBase
* pStyle
= aStyles
[n
].get();
633 if ( pStyle
->GetFamily() == eFam
)
635 String aUpName
= pStyle
->GetName();
636 ScGlobal::pCharClass
->toUpper(aUpName
);
637 if (aUpName
== aUpSearch
)
638 return (ScStyleSheet
*)pStyle
;