update dev300-m57
[ooovba.git] / sc / source / core / data / stlpool.cxx
blob0fd6fb056a98599b5d14f34f71039fe41fa5965f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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>
59 #include "sc.hrc"
60 #include "attrib.hxx"
61 #include "global.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 ),
78 pDoc( pDocument ),
79 pForceStdName( NULL )
83 //------------------------------------------------------------------------
85 __EXPORT ScStyleSheetPool::~ScStyleSheetPool()
89 //------------------------------------------------------------------------
91 void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
93 pDoc = pDocument;
96 //------------------------------------------------------------------------
98 //UNUSED2009-05 void ScStyleSheetPool::SetForceStdName( const String* pSet )
99 //UNUSED2009-05 {
100 //UNUSED2009-05 pForceStdName = pSet;
101 //UNUSED2009-05 }
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(
133 const String& rName,
134 SfxStyleFamily eFamily,
135 USHORT nMaskP )
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) );
141 return pSheet;
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 )
156 if ( 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 );
174 if (pStyleSheet)
176 const SfxItemSet& rSourceSet = pStyleSheet->GetItemSet();
177 SfxStyleSheetBase* pDestSheet = Find( rName, eFamily );
178 if (!pDestSheet)
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 )
186 // Set-Items
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 ) );
203 else // cell styles
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 ));
212 if (pNewFormat)
213 rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, *pNewFormat ) );
219 //------------------------------------------------------------------------
221 // Standard-Vorlagen
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 );
263 String aStr;
264 xub_StrLen nStrLen;
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 //==========================================================
287 //------------
288 // 1. Standard
289 //------------
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;
311 break;
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
324 //------------
325 // 2. Ergebnis
326 //------------
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 ) );
338 //-------------
339 // 3. Ergebnis1
340 //-------------
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 pSet = &pSheet->GetItemSet();
349 nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY,
350 ScGlobal::eLnge );
351 pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
353 //----------------
354 // 4. Ueberschrift
355 //----------------
357 pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_HEADLINE ),
358 SFX_STYLE_FAMILY_PARA,
359 SCSTYLEBIT_STANDARD );
361 pSheet->SetParent( aStrStandard );
362 pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_UEB );
363 pSet = &pSheet->GetItemSet();
364 pSet->Put( SvxFontHeightItem( 320, 100, ATTR_FONT_HEIGHT ) ); // 16pt
365 pSet->Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
366 pSet->Put( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
367 pSet->Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
369 //-----------------
370 // 5. Ueberschrift1
371 //-----------------
373 pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_HEADLINE1 ),
374 SFX_STYLE_FAMILY_PARA,
375 SCSTYLEBIT_STANDARD );
377 pSheet->SetParent( SCSTR( STR_STYLENAME_HEADLINE ) );
378 pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_UEB1 );
379 pSet = &pSheet->GetItemSet();
380 pSet->Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
382 //==========================================================
383 // Seitenformat-Vorlagen:
384 //==========================================================
386 //------------
387 // 1. Standard
388 //------------
390 pSheet = (ScStyleSheet*) &Make( aStrStandard,
391 SFX_STYLE_FAMILY_PAGE,
392 SCSTYLEBIT_STANDARD );
394 pSet = &pSheet->GetItemSet();
395 pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_STD );
397 // Abstand der Kopf-/Fusszeilen von der Tabelle
398 pHFSetItem = new SvxSetItem( ((SvxSetItem&)pSet->Get( ATTR_PAGE_HEADERSET ) ) );
399 pSet->Put( *pHFSetItem, ATTR_PAGE_HEADERSET );
400 pSet->Put( *pHFSetItem, ATTR_PAGE_FOOTERSET );
401 DELETEZ( pHFSetItem );
403 //----------------------------------------
404 // Kopfzeile:
405 // [leer][\TABELLE\][leer]
406 //----------------------------------------
407 pEdEngine->SetText(EMPTY_STRING);
408 pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
409 pTxtObj = pEdEngine->CreateTextObject();
410 pHeaderItem->SetLeftArea ( *pEmptyTxtObj );
411 pHeaderItem->SetCenterArea( *pTxtObj );
412 pHeaderItem->SetRightArea ( *pEmptyTxtObj );
413 pSet->Put( *pHeaderItem );
414 DELETEZ( pTxtObj );
416 //----------------------------------------
417 // Fusszeile:
418 // [leer][Seite \SEITE\][leer]
419 //----------------------------------------
420 aStr = SCSTR( STR_PAGE ); aStr += ' ';
421 pEdEngine->SetText( aStr );
422 nStrLen = aStr.Len();
423 pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
424 pTxtObj = pEdEngine->CreateTextObject();
425 pFooterItem->SetLeftArea ( *pEmptyTxtObj );
426 pFooterItem->SetCenterArea( *pTxtObj );
427 pFooterItem->SetRightArea ( *pEmptyTxtObj );
428 pSet->Put( *pFooterItem );
429 DELETEZ( pTxtObj );
431 //----------
432 // 2. Report
433 //----------
435 pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_REPORT ),
436 SFX_STYLE_FAMILY_PAGE,
437 SCSTYLEBIT_STANDARD );
438 pSet = &pSheet->GetItemSet();
439 pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_REP );
441 // Hintergrund und Umrandung
442 aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP );
443 aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM );
444 aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT );
445 aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT );
446 aBoxItem.SetDistance( 10 ); // 0.2mm
447 aBoxInfoItem.SetValid( VALID_TOP, TRUE );
448 aBoxInfoItem.SetValid( VALID_BOTTOM, TRUE );
449 aBoxInfoItem.SetValid( VALID_LEFT, TRUE );
450 aBoxInfoItem.SetValid( VALID_RIGHT, TRUE );
451 aBoxInfoItem.SetValid( VALID_DISTANCE, TRUE );
452 aBoxInfoItem.SetTable( FALSE );
453 aBoxInfoItem.SetDist ( TRUE );
455 pHFSetItem = new SvxSetItem( ((SvxSetItem&)pSet->Get( ATTR_PAGE_HEADERSET ) ) );
456 pHFSet = &(pHFSetItem->GetItemSet());
458 pHFSet->Put( SvxBrushItem( aColGrey, ATTR_BACKGROUND ) );
459 pHFSet->Put( aBoxItem );
460 pHFSet->Put( aBoxInfoItem );
461 pSet->Put( *pHFSetItem, ATTR_PAGE_HEADERSET );
462 pSet->Put( *pHFSetItem, ATTR_PAGE_FOOTERSET );
463 DELETEZ( pHFSetItem );
465 //----------------------------------------
466 // Kopfzeile:
467 // [\TABELLE\ (\DATEI\)][leer][\DATUM\, \ZEIT\]
468 //----------------------------------------
469 aStr = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(" ()"));
470 pEdEngine->SetText( aStr );
471 pEdEngine->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
472 pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
473 pTxtObj = pEdEngine->CreateTextObject();
474 pHeaderItem->SetLeftArea( *pTxtObj );
475 pHeaderItem->SetCenterArea( *pEmptyTxtObj );
476 DELETEZ( pTxtObj );
477 aStr = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(", "));
478 pEdEngine->SetText( aStr );
479 pEdEngine->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
480 pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR), EE_FEATURE_FIELD),
481 ESelection() );
482 pTxtObj = pEdEngine->CreateTextObject();
483 pHeaderItem->SetRightArea( *pTxtObj );
484 DELETEZ( pTxtObj );
485 pSet->Put( *pHeaderItem );
487 //----------------------------------------
488 // Fusszeile:
489 // [leer][Seite: \SEITE\ / \SEITEN\][leer]
490 //----------------------------------------
491 aStr = SCSTR( STR_PAGE ); aStr += ' ';
492 nStrLen = aStr.Len();
493 aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" / "));
494 xub_StrLen nStrLen2 = aStr.Len();
495 pEdEngine->SetText( aStr );
496 pEdEngine->QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) );
497 pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
498 pTxtObj = pEdEngine->CreateTextObject();
499 pFooterItem->SetLeftArea ( *pEmptyTxtObj );
500 pFooterItem->SetCenterArea( *pTxtObj );
501 pFooterItem->SetRightArea ( *pEmptyTxtObj );
502 pSet->Put( *pFooterItem );
503 DELETEZ( pTxtObj );
505 //----------------------------------------------------
506 DELETEZ( pEmptyTxtObj );
507 DELETEZ( pHeaderItem );
508 DELETEZ( pFooterItem );
509 DELETEZ( pEdEngine );
512 //------------------------------------------------------------------------
514 //UNUSED2008-05 void ScStyleSheetPool::UpdateStdNames()
515 //UNUSED2008-05 {
516 //UNUSED2008-05 // Standard-Styles den richtigen Namen in der Programm-Sprache geben
517 //UNUSED2008-05
518 //UNUSED2008-05 String aHelpFile;
519 //UNUSED2008-05 sal_uInt32 nCount = aStyles.size();
520 //UNUSED2008-05 for (sal_uInt32 n=0; n<nCount; n++)
521 //UNUSED2008-05 {
522 //UNUSED2008-05 SfxStyleSheetBase* pStyle = aStyles[n].get();
523 //UNUSED2008-05 if (!pStyle->IsUserDefined())
524 //UNUSED2008-05 {
525 //UNUSED2008-05 String aOldName = pStyle->GetName();
526 //UNUSED2008-05 ULONG nHelpId = pStyle->GetHelpId( aHelpFile );
527 //UNUSED2008-05 SfxStyleFamily eFam = pStyle->GetFamily();
528 //UNUSED2008-05
529 //UNUSED2008-05 BOOL bHelpKnown = TRUE;
530 //UNUSED2008-05 String aNewName;
531 //UNUSED2008-05 USHORT nNameId = 0;
532 //UNUSED2008-05 switch( nHelpId )
533 //UNUSED2008-05 {
534 //UNUSED2008-05 case HID_SC_SHEET_CELL_STD:
535 //UNUSED2008-05 case HID_SC_SHEET_PAGE_STD: nNameId = STR_STYLENAME_STANDARD; break;
536 //UNUSED2008-05 case HID_SC_SHEET_CELL_ERG: nNameId = STR_STYLENAME_RESULT; break;
537 //UNUSED2008-05 case HID_SC_SHEET_CELL_ERG1: nNameId = STR_STYLENAME_RESULT1; break;
538 //UNUSED2008-05 case HID_SC_SHEET_CELL_UEB: nNameId = STR_STYLENAME_HEADLINE; break;
539 //UNUSED2008-05 case HID_SC_SHEET_CELL_UEB1: nNameId = STR_STYLENAME_HEADLINE1; break;
540 //UNUSED2008-05 case HID_SC_SHEET_PAGE_REP: nNameId = STR_STYLENAME_REPORT; break;
541 //UNUSED2008-05 default:
542 //UNUSED2008-05 // 0 oder falsche (alte) HelpId
543 //UNUSED2008-05 bHelpKnown = FALSE;
544 //UNUSED2008-05 }
545 //UNUSED2008-05 if (bHelpKnown)
546 //UNUSED2008-05 {
547 //UNUSED2008-05 if ( nNameId )
548 //UNUSED2008-05 aNewName = SCSTR( nNameId );
549 //UNUSED2008-05
550 //UNUSED2008-05 if ( aNewName.Len() && aNewName != aOldName && !Find( aNewName, eFam ) )
551 //UNUSED2008-05 {
552 //UNUSED2008-05 DBG_TRACE( "Renaming style..." );
553 //UNUSED2008-05
554 //UNUSED2008-05 pStyle->SetName( aNewName ); // setzt auch Parents um
555 //UNUSED2008-05
556 //UNUSED2008-05 // Styles in Patterns sind schon auf Pointer umgesetzt
557 //UNUSED2008-05 if (eFam == SFX_STYLE_FAMILY_PAGE)
558 //UNUSED2008-05 {
559 //UNUSED2008-05 // Page-Styles umsetzen
560 //UNUSED2008-05 // TableCount am Doc ist noch nicht initialisiert
561 //UNUSED2008-05 for (SCTAB nTab=0; nTab<=MAXTAB && pDoc->HasTable(nTab); nTab++)
562 //UNUSED2008-05 if (pDoc->GetPageStyle(nTab) == aOldName)
563 //UNUSED2008-05 pDoc->SetPageStyle(nTab, aNewName);
564 //UNUSED2008-05 }
565 //UNUSED2008-05 }
566 //UNUSED2008-05 }
567 //UNUSED2008-05 else
568 //UNUSED2008-05 {
569 //UNUSED2008-05 // wrong or no HelpId -> set new HelpId
570 //UNUSED2008-05
571 //UNUSED2008-05 // no assertion for wrong HelpIds because this happens
572 //UNUSED2008-05 // with old files (#67218#) or with old files that were
573 //UNUSED2008-05 // saved again with a new version in a different language
574 //UNUSED2008-05 // (so SrcVersion doesn't help)
575 //UNUSED2008-05
576 //UNUSED2008-05 USHORT nNewId = 0;
577 //UNUSED2008-05 if ( eFam == SFX_STYLE_FAMILY_PARA )
578 //UNUSED2008-05 {
579 //UNUSED2008-05 if ( aOldName == SCSTR( STR_STYLENAME_STANDARD ) )
580 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_STD;
581 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_RESULT ) )
582 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_ERG;
583 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_RESULT1 ) )
584 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_ERG1;
585 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_HEADLINE ) )
586 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_UEB;
587 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_HEADLINE1 ) )
588 //UNUSED2008-05 nNewId = HID_SC_SHEET_CELL_UEB1;
589 //UNUSED2008-05 }
590 //UNUSED2008-05 else // PAGE
591 //UNUSED2008-05 {
592 //UNUSED2008-05 if ( aOldName == SCSTR( STR_STYLENAME_STANDARD ) )
593 //UNUSED2008-05 nNewId = HID_SC_SHEET_PAGE_STD;
594 //UNUSED2008-05 else if ( aOldName == SCSTR( STR_STYLENAME_REPORT ) )
595 //UNUSED2008-05 nNewId = HID_SC_SHEET_PAGE_REP;
596 //UNUSED2008-05 }
597 //UNUSED2008-05
598 //UNUSED2008-05 if ( nNewId ) // new ID found from name -> set ID
599 //UNUSED2008-05 {
600 //UNUSED2008-05 pStyle->SetHelpId( aHelpFile, nNewId );
601 //UNUSED2008-05 }
602 //UNUSED2008-05 else if ( nHelpId == 0 ) // no old and no new ID
603 //UNUSED2008-05 {
604 //UNUSED2008-05 // #71471# probably user defined style without SFXSTYLEBIT_USERDEF set
605 //UNUSED2008-05 // (from StarCalc 1.0 import), fixed in src563 and above
606 //UNUSED2008-05 //! may also be default style from a different language
607 //UNUSED2008-05 //! test if name was generated from StarCalc 1.0 import?
608 //UNUSED2008-05 DBG_ASSERT(pDoc->GetSrcVersion() <= SC_SUBTOTAL_BUGFIX,
609 //UNUSED2008-05 "user defined style without SFXSTYLEBIT_USERDEF");
610 //UNUSED2008-05 pStyle->SetMask( pStyle->GetMask() | SFXSTYLEBIT_USERDEF );
611 //UNUSED2008-05 }
612 //UNUSED2008-05 // else: wrong old ID and no new ID found:
613 //UNUSED2008-05 // probably default style from a different language
614 //UNUSED2008-05 // -> leave unchanged (HelpId will be set if loaded with matching
615 //UNUSED2008-05 // language version later)
616 //UNUSED2008-05 }
617 //UNUSED2008-05 }
618 //UNUSED2008-05 }
619 //UNUSED2008-05 }
621 //------------------------------------------------------------------------
623 ScStyleSheet* ScStyleSheetPool::FindCaseIns( const String& rName, SfxStyleFamily eFam )
625 String aUpSearch = rName;
626 ScGlobal::pCharClass->toUpper(aUpSearch);
628 sal_uInt32 nCount = aStyles.size();
629 for (sal_uInt32 n=0; n<nCount; n++)
631 SfxStyleSheetBase* pStyle = aStyles[n].get();
632 if ( pStyle->GetFamily() == eFam )
634 String aUpName = pStyle->GetName();
635 ScGlobal::pCharClass->toUpper(aUpName);
636 if (aUpName == aUpSearch)
637 return (ScStyleSheet*)pStyle;
641 return NULL;