LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/inc - patattr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2013-07-09 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 SC_SCPATATR_HXX
      21             : #define SC_SCPATATR_HXX
      22             : 
      23             : #include <svl/poolitem.hxx>
      24             : #include <svl/itemset.hxx>
      25             : #include <unotools/fontcvt.hxx>
      26             : #include <editeng/svxenum.hxx>
      27             : #include <tools/string.hxx>
      28             : #include "scdllapi.h"
      29             : 
      30             : class Font;
      31             : class OutputDevice;
      32             : class Fraction;
      33             : class ScStyleSheet;
      34             : class SvNumberFormatter;
      35             : class ScDocument;
      36             : 
      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             : 
      52             : class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem
      53             : {
      54             :     OUString*       pName;
      55             :     ScStyleSheet*   pStyle;
      56             : public:
      57             :     static ScDocument* pDoc;
      58             :                             ScPatternAttr(SfxItemSet* pItemSet, const OUString& rStyleName);
      59             :                             ScPatternAttr(SfxItemSet* pItemSet, ScStyleSheet* pStyleSheet = NULL);
      60             :                             ScPatternAttr(SfxItemPool* pItemPool);
      61             :                             ScPatternAttr(const ScPatternAttr& rPatternAttr);
      62             : 
      63             :                             ~ScPatternAttr();
      64             : 
      65             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
      66             :     virtual SfxPoolItem*    Create(SvStream& rStream, sal_uInt16 nVersion) const;
      67             :     virtual SvStream&       Store(SvStream& rStream, sal_uInt16 nItemVersion) const;
      68             : 
      69             :     virtual int             operator==(const SfxPoolItem& rCmp) const;
      70             : 
      71    21044415 :     const SfxPoolItem&      GetItem( sal_uInt16 nWhichP ) const
      72    21044415 :                                         { return GetItemSet().Get(nWhichP); }
      73             : 
      74             :     static const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet );
      75             :     const SfxPoolItem&      GetItem( sal_uInt16 nWhich, const SfxItemSet* pCondSet ) const;
      76             : 
      77             :                             // pWhich are no ranges, but single IDs, 0-terminated
      78             :     bool                    HasItemsSet( const sal_uInt16* pWhich ) const;
      79             :     void                    ClearItems( const sal_uInt16* pWhich );
      80             : 
      81             :     void                    DeleteUnchanged( const ScPatternAttr* pOldAttrs );
      82             : 
      83             :     static SvxCellOrientation GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet = 0 );
      84             :     SvxCellOrientation      GetCellOrientation( const SfxItemSet* pCondSet = 0 ) const;
      85             : 
      86             :     /** Static helper function to fill a font object from the passed item set. */
      87             :     static void             GetFont( Font& rFont, const SfxItemSet& rItemSet,
      88             :                                         ScAutoFontColorMode eAutoMode,
      89             :                                         OutputDevice* pOutDev = NULL,
      90             :                                         const Fraction* pScale = NULL,
      91             :                                         const SfxItemSet* pCondSet = NULL,
      92             :                                         sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
      93             :                                         const Color* pTextConfigColor = NULL );
      94             :     /** Fills a font object from the own item set. */
      95             :     void                    GetFont( Font& rFont, ScAutoFontColorMode eAutoMode,
      96             :                                         OutputDevice* pOutDev = NULL,
      97             :                                         const Fraction* pScale = NULL,
      98             :                                         const SfxItemSet* pCondSet = NULL,
      99             :                                         sal_uInt8 nScript = 0, 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     3095101 :     const ScStyleSheet*     GetStyleSheet() const  { return pStyle; }
     118             :     const OUString*         GetStyleName() const;
     119             :     void                    UpdateStyleSheet();
     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             : 
     138             : class ScFontToSubsFontConverter_AutoPtr
     139             : {
     140             :             FontToSubsFontConverter h;
     141             : 
     142             :             void                    release()
     143             :                                     {
     144             :                                         if ( h )
     145             :                                             DestroyFontToSubsFontConverter( h );
     146             :                                     }
     147             : 
     148             :                                 // prevent usage
     149             :                                 ScFontToSubsFontConverter_AutoPtr( const ScFontToSubsFontConverter_AutoPtr& );
     150             :     ScFontToSubsFontConverter_AutoPtr& operator=( const ScFontToSubsFontConverter_AutoPtr& );
     151             : 
     152             : public:
     153             :                                 ScFontToSubsFontConverter_AutoPtr()
     154             :                                     : h(0)
     155             :                                     {}
     156             :                                 ~ScFontToSubsFontConverter_AutoPtr()
     157             :                                     {
     158             :                                         release();
     159             :                                     }
     160             : 
     161             :     ScFontToSubsFontConverter_AutoPtr& operator=( FontToSubsFontConverter hN )
     162             :                                     {
     163             :                                         release();
     164             :                                         h = hN;
     165             :                                         return *this;
     166             :                                     }
     167             : 
     168             :             operator FontToSubsFontConverter() const
     169             :                                     { return h; }
     170             : };
     171             : 
     172             : 
     173             : #endif
     174             : 
     175             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10