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

Generated by: LCOV version 1.11