Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "scitems.hxx"
21 : #include <editeng/eeitem.hxx>
22 : #include <i18npool/mslangid.hxx>
23 : #include <svx/algitem.hxx>
24 : #include <editeng/boxitem.hxx>
25 : #include <editeng/brshitem.hxx>
26 : #include <editeng/editdata.hxx>
27 : #include <editeng/editeng.hxx>
28 : #include <editeng/editobj.hxx>
29 : #include <editeng/fhgtitem.hxx>
30 : #include <editeng/flditem.hxx>
31 : #include <editeng/fontitem.hxx>
32 : #include <svx/pageitem.hxx>
33 : #include <editeng/postitem.hxx>
34 : #include <editeng/udlnitem.hxx>
35 : #include <editeng/wghtitem.hxx>
36 : #include <editeng/justifyitem.hxx>
37 : #include <svl/itemset.hxx>
38 : #include <svl/zforlist.hxx>
39 : #include <unotools/charclass.hxx>
40 : #include <unotools/fontcvt.hxx>
41 : #include <vcl/outdev.hxx>
42 : #include <vcl/svapp.hxx>
43 :
44 : #include "sc.hrc"
45 : #include "attrib.hxx"
46 : #include "global.hxx"
47 : #include "globstr.hrc"
48 : #include "document.hxx"
49 : #include "docpool.hxx"
50 : #include "stlpool.hxx"
51 : #include "stlsheet.hxx"
52 : #include "rechead.hxx"
53 : #include "editutil.hxx"
54 : #include "patattr.hxx"
55 :
56 :
57 : //========================================================================
58 :
59 189 : ScStyleSheetPool::ScStyleSheetPool( SfxItemPool& rPoolP,
60 : ScDocument* pDocument )
61 : : SfxStyleSheetPool( rPoolP ),
62 : pActualStyleSheet( NULL ),
63 : pDoc( pDocument ),
64 189 : pForceStdName( NULL )
65 : {
66 189 : }
67 :
68 : //------------------------------------------------------------------------
69 :
70 216 : ScStyleSheetPool::~ScStyleSheetPool()
71 : {
72 216 : }
73 :
74 : //------------------------------------------------------------------------
75 :
76 109 : void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
77 : {
78 109 : pDoc = pDocument;
79 109 : }
80 :
81 : //------------------------------------------------------------------------
82 :
83 838 : SfxStyleSheetBase& ScStyleSheetPool::Make( const String& rName,
84 : SfxStyleFamily eFam, sal_uInt16 mask, sal_uInt16 nPos )
85 : {
86 : // When updating styles from a template, Office 5.1 sometimes created
87 : // files with multiple default styles.
88 : // Create new styles in that case:
89 :
90 : //! only when loading?
91 :
92 838 : if ( rName.EqualsAscii(STRING_STANDARD) && Find( rName, eFam ) != NULL )
93 : {
94 : OSL_FAIL("renaming additional default style");
95 0 : sal_uInt32 nCount = aStyles.size();
96 0 : for ( sal_uInt32 nAdd = 1; nAdd <= nCount; nAdd++ )
97 : {
98 0 : String aNewName = ScGlobal::GetRscString(STR_STYLENAME_STANDARD);
99 0 : aNewName += String::CreateFromInt32( nAdd );
100 0 : if ( Find( aNewName, eFam ) == NULL )
101 0 : return SfxStyleSheetPool::Make( aNewName, eFam, mask, nPos );
102 0 : }
103 : }
104 :
105 838 : return SfxStyleSheetPool::Make( rName, eFam, mask, nPos );
106 : }
107 :
108 : //------------------------------------------------------------------------
109 :
110 838 : SfxStyleSheetBase* ScStyleSheetPool::Create(
111 : const String& rName,
112 : SfxStyleFamily eFamily,
113 : sal_uInt16 nMaskP )
114 : {
115 838 : ScStyleSheet* pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP );
116 838 : if ( eFamily == SFX_STYLE_FAMILY_PARA && ScGlobal::GetRscString(STR_STYLENAME_STANDARD) != rName )
117 525 : pSheet->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
118 :
119 838 : return pSheet;
120 : }
121 :
122 : //------------------------------------------------------------------------
123 :
124 0 : SfxStyleSheetBase* ScStyleSheetPool::Create( const SfxStyleSheetBase& rStyle )
125 : {
126 : OSL_ENSURE( rStyle.ISA(ScStyleSheet), "Invalid StyleSheet-class! :-/" );
127 0 : return new ScStyleSheet( (const ScStyleSheet&) rStyle );
128 : }
129 :
130 : //------------------------------------------------------------------------
131 :
132 0 : void ScStyleSheetPool::Remove( SfxStyleSheetBase* pStyle )
133 : {
134 0 : if ( pStyle )
135 : {
136 : OSL_ENSURE( IS_SET( SFXSTYLEBIT_USERDEF, pStyle->GetMask() ),
137 : "SFXSTYLEBIT_USERDEF not set!" );
138 :
139 0 : ((ScDocumentPool&)rPool).StyleDeleted((ScStyleSheet*)pStyle);
140 0 : SfxStyleSheetPool::Remove(pStyle);
141 : }
142 0 : }
143 :
144 : //------------------------------------------------------------------------
145 :
146 0 : void ScStyleSheetPool::CopyStyleFrom( ScStyleSheetPool* pSrcPool,
147 : const String& rName, SfxStyleFamily eFamily )
148 : {
149 : // this ist Dest-Pool
150 :
151 0 : SfxStyleSheetBase* pStyleSheet = pSrcPool->Find( rName, eFamily );
152 0 : if (pStyleSheet)
153 : {
154 0 : const SfxItemSet& rSourceSet = pStyleSheet->GetItemSet();
155 0 : SfxStyleSheetBase* pDestSheet = Find( rName, eFamily );
156 0 : if (!pDestSheet)
157 0 : pDestSheet = &Make( rName, eFamily );
158 0 : SfxItemSet& rDestSet = pDestSheet->GetItemSet();
159 0 : rDestSet.PutExtended( rSourceSet, SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT );
160 :
161 : const SfxPoolItem* pItem;
162 0 : if ( eFamily == SFX_STYLE_FAMILY_PAGE )
163 : {
164 : // Set-Items
165 :
166 0 : if ( rSourceSet.GetItemState( ATTR_PAGE_HEADERSET, false, &pItem ) == SFX_ITEM_SET )
167 : {
168 0 : const SfxItemSet& rSrcSub = ((const SvxSetItem*) pItem)->GetItemSet();
169 0 : SfxItemSet aDestSub( *rDestSet.GetPool(), rSrcSub.GetRanges() );
170 0 : aDestSub.PutExtended( rSrcSub, SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT );
171 0 : rDestSet.Put( SvxSetItem( ATTR_PAGE_HEADERSET, aDestSub ) );
172 : }
173 0 : if ( rSourceSet.GetItemState( ATTR_PAGE_FOOTERSET, false, &pItem ) == SFX_ITEM_SET )
174 : {
175 0 : const SfxItemSet& rSrcSub = ((const SvxSetItem*) pItem)->GetItemSet();
176 0 : SfxItemSet aDestSub( *rDestSet.GetPool(), rSrcSub.GetRanges() );
177 0 : aDestSub.PutExtended( rSrcSub, SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT );
178 0 : rDestSet.Put( SvxSetItem( ATTR_PAGE_FOOTERSET, aDestSub ) );
179 : }
180 : }
181 : else // cell styles
182 : {
183 : // number format exchange list has to be handled here, too
184 :
185 0 : if ( pDoc && pDoc->GetFormatExchangeList() &&
186 0 : rSourceSet.GetItemState( ATTR_VALUE_FORMAT, false, &pItem ) == SFX_ITEM_SET )
187 : {
188 0 : sal_uLong nOldFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
189 0 : SvNumberFormatterIndexTable::const_iterator it = pDoc->GetFormatExchangeList()->find(nOldFormat);
190 0 : if (it != pDoc->GetFormatExchangeList()->end())
191 : {
192 0 : sal_uInt32 nNewFormat = it->second;
193 0 : rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
194 : }
195 : }
196 : }
197 : }
198 0 : }
199 :
200 : //------------------------------------------------------------------------
201 : //
202 : // Standard-Vorlagen
203 : //
204 : //------------------------------------------------------------------------
205 :
206 : #define SCSTR(id) ScGlobal::GetRscString(id)
207 :
208 0 : void ScStyleSheetPool::CopyStdStylesFrom( ScStyleSheetPool* pSrcPool )
209 : {
210 : // Default-Styles kopieren
211 :
212 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA );
213 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_RESULT), SFX_STYLE_FAMILY_PARA );
214 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_RESULT1), SFX_STYLE_FAMILY_PARA );
215 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_HEADLINE), SFX_STYLE_FAMILY_PARA );
216 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_HEADLINE1), SFX_STYLE_FAMILY_PARA );
217 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PAGE );
218 0 : CopyStyleFrom( pSrcPool, SCSTR(STR_STYLENAME_REPORT), SFX_STYLE_FAMILY_PAGE );
219 0 : }
220 :
221 : //------------------------------------------------------------------------
222 :
223 213 : static void lcl_CheckFont( SfxItemSet& rSet, LanguageType eLang, sal_uInt16 nFontType, sal_uInt16 nItemId )
224 : {
225 213 : if ( eLang != LANGUAGE_NONE && eLang != LANGUAGE_DONTKNOW && eLang != LANGUAGE_SYSTEM )
226 : {
227 213 : Font aDefFont = OutputDevice::GetDefaultFont( nFontType, eLang, DEFAULTFONT_FLAGS_ONLYONE );
228 213 : SvxFontItem aNewItem( aDefFont.GetFamily(), aDefFont.GetName(), aDefFont.GetStyleName(),
229 426 : aDefFont.GetPitch(), aDefFont.GetCharSet(), nItemId );
230 213 : if ( aNewItem != rSet.Get( nItemId ) )
231 : {
232 : // put item into style's ItemSet only if different from (static) default
233 142 : rSet.Put( aNewItem );
234 213 : }
235 : }
236 213 : }
237 :
238 71 : void ScStyleSheetPool::CreateStandardStyles()
239 : {
240 : // neue Eintraege auch bei CopyStdStylesFrom eintragen
241 :
242 71 : Color aColBlack ( COL_BLACK );
243 71 : Color aColGrey ( COL_LIGHTGRAY );
244 71 : String aStr;
245 : xub_StrLen nStrLen;
246 71 : String aHelpFile;//XXX JN welcher Text???
247 71 : SfxItemSet* pSet = NULL;
248 71 : SfxItemSet* pHFSet = NULL;
249 71 : SvxSetItem* pHFSetItem = NULL;
250 71 : ScEditEngineDefaulter* pEdEngine = new ScEditEngineDefaulter( EditEngine::CreatePool(), sal_True );
251 71 : pEdEngine->SetUpdateMode( false );
252 71 : EditTextObject* pEmptyTxtObj = pEdEngine->CreateTextObject();
253 71 : EditTextObject* pTxtObj = NULL;
254 71 : ScPageHFItem* pHeaderItem = new ScPageHFItem( ATTR_PAGE_HEADERRIGHT );
255 71 : ScPageHFItem* pFooterItem = new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT );
256 71 : ScStyleSheet* pSheet = NULL;
257 71 : ::editeng::SvxBorderLine aBorderLine ( &aColBlack, DEF_LINE_WIDTH_2 );
258 71 : SvxBoxItem aBoxItem ( ATTR_BORDER );
259 71 : SvxBoxInfoItem aBoxInfoItem ( ATTR_BORDER_INNER );
260 :
261 71 : String aStrStandard = ScGlobal::GetRscString(STR_STYLENAME_STANDARD);
262 :
263 : //==========================================================
264 : // Zellformatvorlagen:
265 : //==========================================================
266 :
267 : //------------
268 : // 1. Standard
269 : //------------
270 71 : pSheet = (ScStyleSheet*) &Make( aStrStandard, SFX_STYLE_FAMILY_PARA, SCSTYLEBIT_STANDARD );
271 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_STD );
272 :
273 : // if default fonts for the document's languages are different from the pool default,
274 : // put them into the default style
275 : // (not as pool defaults, because pool defaults can't be changed by the user)
276 : // the document languages must be set before creating the default styles!
277 :
278 71 : pSet = &pSheet->GetItemSet();
279 : LanguageType eLatin, eCjk, eCtl;
280 71 : pDoc->GetLanguage( eLatin, eCjk, eCtl );
281 :
282 : // If the UI language is Korean, the default Latin font has to
283 : // be queried for Korean, too (the Latin language from the document can't be Korean).
284 : // This is the same logic as in SwDocShell::InitNew.
285 71 : LanguageType eUiLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
286 71 : if (MsLangId::isKorean(eUiLanguage))
287 0 : eLatin = eUiLanguage;
288 :
289 71 : lcl_CheckFont( *pSet, eLatin, DEFAULTFONT_LATIN_SPREADSHEET, ATTR_FONT );
290 71 : lcl_CheckFont( *pSet, eCjk, DEFAULTFONT_CJK_SPREADSHEET, ATTR_CJK_FONT );
291 71 : lcl_CheckFont( *pSet, eCtl, DEFAULTFONT_CTL_SPREADSHEET, ATTR_CTL_FONT );
292 :
293 : // #i55300# default CTL font size for Thai has to be larger
294 : // #i59408# The 15 point size causes problems with row heights, so no different
295 : // size is used for Thai in Calc for now.
296 : // if ( eCtl == LANGUAGE_THAI )
297 : // pSet->Put( SvxFontHeightItem( 300, 100, ATTR_CTL_FONT_HEIGHT ) ); // 15 pt
298 :
299 : //------------
300 : // 2. Ergebnis
301 : //------------
302 :
303 71 : pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_RESULT ),
304 : SFX_STYLE_FAMILY_PARA,
305 142 : SCSTYLEBIT_STANDARD );
306 71 : pSheet->SetParent( aStrStandard );
307 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_ERG );
308 71 : pSet = &pSheet->GetItemSet();
309 71 : pSet->Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
310 71 : pSet->Put( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
311 71 : pSet->Put( SvxUnderlineItem( UNDERLINE_SINGLE, ATTR_FONT_UNDERLINE ) );
312 :
313 : //-------------
314 : // 3. Ergebnis1
315 : //-------------
316 :
317 71 : pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_RESULT1 ),
318 : SFX_STYLE_FAMILY_PARA,
319 142 : SCSTYLEBIT_STANDARD );
320 :
321 71 : pSheet->SetParent( SCSTR( STR_STYLENAME_RESULT ) );
322 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_ERG1 );
323 :
324 : //----------------
325 : // 4. Ueberschrift
326 : //----------------
327 :
328 71 : pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_HEADLINE ),
329 : SFX_STYLE_FAMILY_PARA,
330 142 : SCSTYLEBIT_STANDARD );
331 :
332 71 : pSheet->SetParent( aStrStandard );
333 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_UEB );
334 71 : pSet = &pSheet->GetItemSet();
335 71 : pSet->Put( SvxFontHeightItem( 320, 100, ATTR_FONT_HEIGHT ) ); // 16pt
336 71 : pSet->Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
337 71 : pSet->Put( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
338 71 : pSet->Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
339 :
340 : //-----------------
341 : // 5. Ueberschrift1
342 : //-----------------
343 :
344 71 : pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_HEADLINE1 ),
345 : SFX_STYLE_FAMILY_PARA,
346 142 : SCSTYLEBIT_STANDARD );
347 :
348 71 : pSheet->SetParent( SCSTR( STR_STYLENAME_HEADLINE ) );
349 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_UEB1 );
350 71 : pSet = &pSheet->GetItemSet();
351 71 : pSet->Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
352 :
353 : //==========================================================
354 : // Seitenformat-Vorlagen:
355 : //==========================================================
356 :
357 : //------------
358 : // 1. Standard
359 : //------------
360 :
361 : pSheet = (ScStyleSheet*) &Make( aStrStandard,
362 : SFX_STYLE_FAMILY_PAGE,
363 71 : SCSTYLEBIT_STANDARD );
364 :
365 71 : pSet = &pSheet->GetItemSet();
366 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_STD );
367 :
368 : // Abstand der Kopf-/Fusszeilen von der Tabelle
369 71 : pHFSetItem = new SvxSetItem( ((SvxSetItem&)pSet->Get( ATTR_PAGE_HEADERSET ) ) );
370 71 : pSet->Put( *pHFSetItem, ATTR_PAGE_HEADERSET );
371 71 : pSet->Put( *pHFSetItem, ATTR_PAGE_FOOTERSET );
372 71 : DELETEZ( pHFSetItem );
373 :
374 : //----------------------------------------
375 : // Kopfzeile:
376 : // [leer][\TABELLE\][leer]
377 : //----------------------------------------
378 71 : pEdEngine->SetText(EMPTY_STRING);
379 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
380 71 : pTxtObj = pEdEngine->CreateTextObject();
381 71 : pHeaderItem->SetLeftArea ( *pEmptyTxtObj );
382 71 : pHeaderItem->SetCenterArea( *pTxtObj );
383 71 : pHeaderItem->SetRightArea ( *pEmptyTxtObj );
384 71 : pSet->Put( *pHeaderItem );
385 71 : DELETEZ( pTxtObj );
386 :
387 : //----------------------------------------
388 : // Fusszeile:
389 : // [leer][Seite \SEITE\][leer]
390 : //----------------------------------------
391 71 : aStr = SCSTR( STR_PAGE ); aStr += ' ';
392 71 : pEdEngine->SetText( aStr );
393 71 : nStrLen = aStr.Len();
394 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
395 71 : pTxtObj = pEdEngine->CreateTextObject();
396 71 : pFooterItem->SetLeftArea ( *pEmptyTxtObj );
397 71 : pFooterItem->SetCenterArea( *pTxtObj );
398 71 : pFooterItem->SetRightArea ( *pEmptyTxtObj );
399 71 : pSet->Put( *pFooterItem );
400 71 : DELETEZ( pTxtObj );
401 :
402 : //----------
403 : // 2. Report
404 : //----------
405 :
406 71 : pSheet = (ScStyleSheet*) &Make( SCSTR( STR_STYLENAME_REPORT ),
407 : SFX_STYLE_FAMILY_PAGE,
408 142 : SCSTYLEBIT_STANDARD );
409 71 : pSet = &pSheet->GetItemSet();
410 71 : pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_REP );
411 :
412 : // Hintergrund und Umrandung
413 71 : aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP );
414 71 : aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM );
415 71 : aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT );
416 71 : aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT );
417 71 : aBoxItem.SetDistance( 10 ); // 0.2mm
418 71 : aBoxInfoItem.SetValid( VALID_TOP, sal_True );
419 71 : aBoxInfoItem.SetValid( VALID_BOTTOM, sal_True );
420 71 : aBoxInfoItem.SetValid( VALID_LEFT, sal_True );
421 71 : aBoxInfoItem.SetValid( VALID_RIGHT, sal_True );
422 71 : aBoxInfoItem.SetValid( VALID_DISTANCE, sal_True );
423 71 : aBoxInfoItem.SetTable( false );
424 71 : aBoxInfoItem.SetDist ( sal_True );
425 :
426 71 : pHFSetItem = new SvxSetItem( ((SvxSetItem&)pSet->Get( ATTR_PAGE_HEADERSET ) ) );
427 71 : pHFSet = &(pHFSetItem->GetItemSet());
428 :
429 71 : pHFSet->Put( SvxBrushItem( aColGrey, ATTR_BACKGROUND ) );
430 71 : pHFSet->Put( aBoxItem );
431 71 : pHFSet->Put( aBoxInfoItem );
432 71 : pSet->Put( *pHFSetItem, ATTR_PAGE_HEADERSET );
433 71 : pSet->Put( *pHFSetItem, ATTR_PAGE_FOOTERSET );
434 71 : DELETEZ( pHFSetItem );
435 :
436 : //----------------------------------------
437 : // Kopfzeile:
438 : // [\TABELLE\ (\DATEI\)][leer][\DATUM\, \ZEIT\]
439 : //----------------------------------------
440 71 : aStr = rtl::OUString(" ()");
441 71 : pEdEngine->SetText( aStr );
442 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
443 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
444 71 : pTxtObj = pEdEngine->CreateTextObject();
445 71 : pHeaderItem->SetLeftArea( *pTxtObj );
446 71 : pHeaderItem->SetCenterArea( *pEmptyTxtObj );
447 71 : DELETEZ( pTxtObj );
448 71 : aStr = rtl::OUString(", ");
449 71 : pEdEngine->SetText( aStr );
450 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
451 : pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD),
452 71 : ESelection() );
453 71 : pTxtObj = pEdEngine->CreateTextObject();
454 71 : pHeaderItem->SetRightArea( *pTxtObj );
455 71 : DELETEZ( pTxtObj );
456 71 : pSet->Put( *pHeaderItem );
457 :
458 : //----------------------------------------
459 : // Fusszeile:
460 : // [leer][Seite: \SEITE\ / \SEITEN\][leer]
461 : //----------------------------------------
462 71 : aStr = SCSTR( STR_PAGE ); aStr += ' ';
463 71 : nStrLen = aStr.Len();
464 71 : aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" / "));
465 71 : xub_StrLen nStrLen2 = aStr.Len();
466 71 : pEdEngine->SetText( aStr );
467 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) );
468 71 : pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
469 71 : pTxtObj = pEdEngine->CreateTextObject();
470 71 : pFooterItem->SetLeftArea ( *pEmptyTxtObj );
471 71 : pFooterItem->SetCenterArea( *pTxtObj );
472 71 : pFooterItem->SetRightArea ( *pEmptyTxtObj );
473 71 : pSet->Put( *pFooterItem );
474 71 : DELETEZ( pTxtObj );
475 :
476 : //----------------------------------------------------
477 71 : DELETEZ( pEmptyTxtObj );
478 71 : DELETEZ( pHeaderItem );
479 71 : DELETEZ( pFooterItem );
480 71 : DELETEZ( pEdEngine );
481 71 : }
482 :
483 : //------------------------------------------------------------------------
484 :
485 :
486 0 : ScStyleSheet* ScStyleSheetPool::FindCaseIns( const String& rName, SfxStyleFamily eFam )
487 : {
488 0 : String aUpSearch = ScGlobal::pCharClass->uppercase(rName);
489 :
490 0 : sal_uInt32 nCount = aStyles.size();
491 0 : for (sal_uInt32 n=0; n<nCount; n++)
492 : {
493 0 : SfxStyleSheetBase* pStyle = aStyles[n].get();
494 0 : if ( pStyle->GetFamily() == eFam )
495 : {
496 0 : String aUpName = ScGlobal::pCharClass->uppercase(pStyle->GetName());
497 0 : if (aUpName == aUpSearch)
498 0 : return (ScStyleSheet*)pStyle;
499 : }
500 : }
501 :
502 0 : return NULL;
503 : }
504 :
505 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|