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