LCOV - code coverage report
Current view: top level - sc/source/core/data - stlpool.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 168 225 74.7 %
Date: 2012-08-25 Functions: 9 13 69.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 230 582 39.5 %

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

Generated by: LCOV version 1.10