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

Generated by: LCOV version 1.10