LCOV - code coverage report
Current view: top level - sc/source/core/data - stlpool.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 238 0.0 %
Date: 2014-04-14 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10