LCOV - code coverage report
Current view: top level - sc/inc - patattr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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                 :            : #ifndef SC_SCPATATR_HXX
      30                 :            : #define SC_SCPATATR_HXX
      31                 :            : 
      32                 :            : #include <svl/poolitem.hxx>
      33                 :            : #include <svl/itemset.hxx>
      34                 :            : #include <unotools/fontcvt.hxx>
      35                 :            : #include <editeng/svxenum.hxx>
      36                 :            : #include "scdllapi.h"
      37                 :            : 
      38                 :            : class Font;
      39                 :            : class OutputDevice;
      40                 :            : class Fraction;
      41                 :            : class ScStyleSheet;
      42                 :            : class SvNumberFormatter;
      43                 :            : class ScDocument;
      44                 :            : 
      45                 :            : 
      46                 :            : //  how to treat COL_AUTO in GetFont:
      47                 :            : 
      48                 :            : enum ScAutoFontColorMode
      49                 :            : {
      50                 :            :     SC_AUTOCOL_RAW,         // COL_AUTO is returned
      51                 :            :     SC_AUTOCOL_BLACK,       // always use black
      52                 :            :     SC_AUTOCOL_PRINT,       // black or white, depending on background
      53                 :            :     SC_AUTOCOL_DISPLAY,     // from style settings, or black/white if needed
      54                 :            :     SC_AUTOCOL_IGNOREFONT,  // like DISPLAY, but ignore stored font color (assume COL_AUTO)
      55                 :            :     SC_AUTOCOL_IGNOREBACK,  // like DISPLAY, but ignore stored background color (use configured color)
      56                 :            :     SC_AUTOCOL_IGNOREALL    // like DISPLAY, but ignore stored font and background colors
      57                 :            : };
      58                 :            : 
      59                 :            : 
      60                 :            : class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem
      61                 :            : {
      62                 :            :     String*         pName;
      63                 :            :     ScStyleSheet*   pStyle;
      64                 :            : public:
      65                 :            :     static ScDocument* pDoc;
      66                 :            :                             ScPatternAttr(SfxItemSet* pItemSet, const String& rStyleName);
      67                 :            :                             ScPatternAttr(SfxItemSet* pItemSet, ScStyleSheet* pStyleSheet = NULL);
      68                 :            :                             ScPatternAttr(SfxItemPool* pItemPool);
      69                 :            :                             ScPatternAttr(const ScPatternAttr& rPatternAttr);
      70                 :            : 
      71                 :            :                             ~ScPatternAttr();
      72                 :            : 
      73                 :            :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
      74                 :            :     virtual SfxPoolItem*    Create(SvStream& rStream, sal_uInt16 nVersion) const;
      75                 :            :     virtual SvStream&       Store(SvStream& rStream, sal_uInt16 nItemVersion) const;
      76                 :            : 
      77                 :            :     virtual int             operator==(const SfxPoolItem& rCmp) const;
      78                 :            : 
      79                 :   25744546 :     const SfxPoolItem&      GetItem( sal_uInt16 nWhichP ) const
      80                 :   25744546 :                                         { return GetItemSet().Get(nWhichP); }
      81                 :            : 
      82                 :            :     static const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet );
      83                 :            :     const SfxPoolItem&      GetItem( sal_uInt16 nWhich, const SfxItemSet* pCondSet ) const;
      84                 :            : 
      85                 :            :                             // pWhich are no ranges, but single IDs, 0-terminated
      86                 :            :     bool                    HasItemsSet( const sal_uInt16* pWhich ) const;
      87                 :            :     void                    ClearItems( const sal_uInt16* pWhich );
      88                 :            : 
      89                 :            :     void                    DeleteUnchanged( const ScPatternAttr* pOldAttrs );
      90                 :            : 
      91                 :            :     static SvxCellOrientation GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet = 0 );
      92                 :            :     SvxCellOrientation      GetCellOrientation( const SfxItemSet* pCondSet = 0 ) const;
      93                 :            : 
      94                 :            :     /** Static helper function to fill a font object from the passed item set. */
      95                 :            :     static void             GetFont( Font& rFont, const SfxItemSet& rItemSet,
      96                 :            :                                         ScAutoFontColorMode eAutoMode,
      97                 :            :                                         OutputDevice* pOutDev = NULL,
      98                 :            :                                         const Fraction* pScale = NULL,
      99                 :            :                                         const SfxItemSet* pCondSet = NULL,
     100                 :            :                                         sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
     101                 :            :                                         const Color* pTextConfigColor = NULL );
     102                 :            :     /** Fills a font object from the own item set. */
     103                 :            :     void                    GetFont( Font& rFont, ScAutoFontColorMode eAutoMode,
     104                 :            :                                         OutputDevice* pOutDev = NULL,
     105                 :            :                                         const Fraction* pScale = NULL,
     106                 :            :                                         const SfxItemSet* pCondSet = NULL,
     107                 :            :                                         sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
     108                 :            :                                         const Color* pTextConfigColor = NULL ) const;
     109                 :            : 
     110                 :            :     /** Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet. */
     111                 :            :     static void             FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet = NULL );
     112                 :            :     /** Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSet. */
     113                 :            :     void                    FillEditItemSet( SfxItemSet* pEditSet, const SfxItemSet* pCondSet = NULL ) const;
     114                 :            : 
     115                 :            :     /** Converts all edit engine items contained in rEditSet to Calc items and puts them into rDestSet. */
     116                 :            :     static void             GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet& rEditSet );
     117                 :            :     /** Converts all edit engine items contained in pEditSet to Calc items and puts them into the own item set. */
     118                 :            :     void                    GetFromEditItemSet( const SfxItemSet* pEditSet );
     119                 :            : 
     120                 :            :     void                    FillEditParaItems( SfxItemSet* pSet ) const;
     121                 :            : 
     122                 :            :     ScPatternAttr*          PutInPool( ScDocument* pDestDoc, ScDocument* pSrcDoc ) const;
     123                 :            : 
     124                 :            :     void                    SetStyleSheet(ScStyleSheet* pNewStyle, bool bClearDirectFormat = true);
     125                 :    5352832 :     const ScStyleSheet*     GetStyleSheet() const  { return pStyle; }
     126                 :            :     const String*           GetStyleName() const;
     127                 :            :     void                    UpdateStyleSheet();
     128                 :            :     void                    StyleToName();
     129                 :            : 
     130                 :            :     bool                    IsVisible() const;
     131                 :            :     bool                    IsVisibleEqual( const ScPatternAttr& rOther ) const;
     132                 :            : 
     133                 :            :                             /** If font is an old symbol font StarBats/StarMath
     134                 :            :                                 with text encoding RTL_TEXTENC_SYMBOL */
     135                 :            :     bool                    IsSymbolFont() const;
     136                 :            : 
     137                 :            :     sal_uLong                   GetNumberFormat( SvNumberFormatter* ) const;
     138                 :            :     sal_uLong                   GetNumberFormat( SvNumberFormatter* pFormatter,
     139                 :            :                                                 const SfxItemSet* pCondSet ) const;
     140                 :            : 
     141                 :            :     long                    GetRotateVal( const SfxItemSet* pCondSet ) const;
     142                 :            :     sal_uInt8                   GetRotateDir( const SfxItemSet* pCondSet ) const;
     143                 :            : };
     144                 :            : 
     145                 :            : 
     146                 :            : class ScFontToSubsFontConverter_AutoPtr
     147                 :            : {
     148                 :            :             FontToSubsFontConverter h;
     149                 :            : 
     150                 :            :             void                    release()
     151                 :            :                                     {
     152                 :            :                                         if ( h )
     153                 :            :                                             DestroyFontToSubsFontConverter( h );
     154                 :            :                                     }
     155                 :            : 
     156                 :            :                                 // prevent usage
     157                 :            :                                 ScFontToSubsFontConverter_AutoPtr( const ScFontToSubsFontConverter_AutoPtr& );
     158                 :            :     ScFontToSubsFontConverter_AutoPtr& operator=( const ScFontToSubsFontConverter_AutoPtr& );
     159                 :            : 
     160                 :            : public:
     161                 :            :                                 ScFontToSubsFontConverter_AutoPtr()
     162                 :            :                                     : h(0)
     163                 :            :                                     {}
     164                 :            :                                 ~ScFontToSubsFontConverter_AutoPtr()
     165                 :            :                                     {
     166                 :            :                                         release();
     167                 :            :                                     }
     168                 :            : 
     169                 :            :     ScFontToSubsFontConverter_AutoPtr& operator=( FontToSubsFontConverter hN )
     170                 :            :                                     {
     171                 :            :                                         release();
     172                 :            :                                         h = hN;
     173                 :            :                                         return *this;
     174                 :            :                                     }
     175                 :            : 
     176                 :            :             operator FontToSubsFontConverter() const
     177                 :            :                                     { return h; }
     178                 :            : };
     179                 :            : 
     180                 :            : 
     181                 :            : #endif
     182                 :            : 
     183                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10