LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - fmtcol.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 31 39 79.5 %
Date: 2013-07-09 Functions: 18 24 75.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             : #ifndef _FMTCOL_HXX
      20             : #define _FMTCOL_HXX
      21             : 
      22             : #include "swdllapi.h"
      23             : #include <frmatr.hxx>
      24             : #include <swtypes.hxx> // For MAXLEVEL.
      25             : #include <boost/ptr_container/ptr_vector.hpp>
      26             : 
      27             : class SwDoc; // For friend.
      28             : 
      29        8141 : class SwFmtColl : public SwFmt
      30             : {
      31             : protected:
      32        1796 :     SwFmtColl( SwAttrPool& rPool, const sal_Char* pFmtName,
      33             :                 const sal_uInt16* pWhichRanges, SwFmtColl* pDerFrom,
      34             :                 sal_uInt16 nFmtWhich )
      35        1796 :           : SwFmt( rPool, pFmtName, pWhichRanges, pDerFrom, nFmtWhich )
      36        1796 :     { SetAuto( sal_False ); }
      37             : 
      38        6366 :     SwFmtColl( SwAttrPool& rPool, const String &rFmtName,
      39             :                 const sal_uInt16* pWhichRanges, SwFmtColl* pDerFrom,
      40             :                 sal_uInt16 nFmtWhich )
      41        6366 :           : SwFmt( rPool, rFmtName, pWhichRanges, pDerFrom, nFmtWhich )
      42        6366 :     { SetAuto( sal_False ); }
      43             : 
      44             : private:
      45             : 
      46             :     /// For now don't copy and don't assign.
      47             :     SwFmtColl(const SwFmtColl & );
      48             :     const SwFmtColl &operator=(const SwFmtColl &);
      49             : };
      50             : 
      51             : /// Represents the style of a paragraph.
      52       13596 : class SW_DLLPUBLIC SwTxtFmtColl: public SwFmtColl
      53             : {
      54             :     friend class SwDoc;
      55             : 
      56             :     SwTxtFmtColl(const SwTxtFmtColl & rRef);
      57             : 
      58             :     bool mbStayAssignedToListLevelOfOutlineStyle;
      59             : 
      60             : protected:
      61             : 
      62             :     bool mbAssignedToOutlineStyle;
      63             : 
      64             :     SwTxtFmtColl *pNextTxtFmtColl;
      65             : 
      66         898 :     SwTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
      67             :                     SwTxtFmtColl* pDerFrom = 0,
      68             :                     sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
      69             :         : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange,
      70             :                         pDerFrom, nFmtWh ),
      71             :           mbStayAssignedToListLevelOfOutlineStyle( false ),
      72             : 
      73         898 :           mbAssignedToOutlineStyle(false)
      74         898 :     { pNextTxtFmtColl = this; }
      75             : 
      76        6366 :     SwTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
      77             :                     SwTxtFmtColl* pDerFrom = 0,
      78             :                     sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
      79             :         : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange,
      80             :                         pDerFrom, nFmtWh ),
      81             : 
      82             :           mbStayAssignedToListLevelOfOutlineStyle( false ),
      83             : 
      84        6366 :           mbAssignedToOutlineStyle(false)
      85        6366 :     { pNextTxtFmtColl = this; }
      86             : 
      87             :     /// To get UL- / LR- / FontHeight-changes.
      88             :    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
      89             : 
      90             : public:
      91             : 
      92             :     TYPEINFO(); ///< Already in base class Client.
      93             : 
      94             :     inline void SetNextTxtFmtColl(SwTxtFmtColl& rNext);
      95       41313 :     SwTxtFmtColl& GetNextTxtFmtColl() const { return *pNextTxtFmtColl; }
      96             : 
      97             :     bool IsAtDocNodeSet() const;
      98             : 
      99             :     void SetAttrOutlineLevel( int );
     100             :     int  GetAttrOutlineLevel() const;
     101             :     int  GetAssignedOutlineStyleLevel() const;
     102      189447 :     inline bool IsAssignedToListLevelOfOutlineStyle() const
     103             :     {
     104      189447 :         return mbAssignedToOutlineStyle;
     105             :     }
     106             :     void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
     107             :     void DeleteAssignmentToListLevelOfOutlineStyle();
     108             : 
     109             :     /** Override to recognize changes on the <SwNumRuleItem> and register/unregister
     110             :      the paragragh style at the corresponding <SwNumRule> instance. */
     111             :     virtual bool SetFmtAttr( const SfxPoolItem& rAttr );
     112             :     virtual bool SetFmtAttr( const SfxItemSet& rSet );
     113             :     virtual bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
     114             : 
     115             :     /// Override <ResetAllFmtAttr()> to stay assigned to list level of outline style.
     116             :     virtual sal_uInt16 ResetAllFmtAttr();
     117             : 
     118        6465 :     inline bool StayAssignedToListLevelOfOutlineStyle() const
     119             :     {
     120        6465 :         return mbStayAssignedToListLevelOfOutlineStyle;
     121             :     }
     122             : 
     123             :     bool AreListLevelIndentsApplicable() const;
     124             : 
     125             : /*
     126             :  Is the functionality of character styles at paragraph styles needed?
     127             :  If so, a second Attset for char-attributes has to be created
     128             :  in TextNode and here in TxtCollection in order to make both
     129             :  the inheritance of and the access to set attributes function correctly!
     130             : 
     131             :     virtual sal_Bool SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
     132             : 
     133             :     inline SwCharFmt* GetCharFmt() const;
     134             :     inline sal_Bool IsCharFmtSet() const;
     135             :     void SetCharFmt(SwCharFmt *);
     136             :     void ResetCharFmt();
     137             :     inline sal_Bool SwTxtFmtColl::IsCharFmtSet() const
     138             :     {
     139             :         return aCharDepend.GetRegisteredIn() ? sal_True : sal_False;
     140             :     }
     141             :     inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
     142             :     {
     143             :         return (SwCharFmt*)aCharDepend.GetRegisteredIn();
     144             :     }
     145             : */
     146             : };
     147             : 
     148        1790 : class SwGrfFmtColl: public SwFmtColl
     149             : {
     150             :     friend class SwDoc;
     151             : protected:
     152         898 :     SwGrfFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
     153             :                     SwGrfFmtColl* pDerFrom = 0 )
     154             :         : SwFmtColl( rPool, pFmtCollName, aGrfFmtCollSetRange,
     155         898 :                     pDerFrom, RES_GRFFMTCOLL )
     156         898 :     {}
     157             : 
     158           0 :     SwGrfFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
     159             :                     SwGrfFmtColl* pDerFrom = 0 )
     160             :         : SwFmtColl( rPool, rFmtCollName, aGrfFmtCollSetRange,
     161           0 :                     pDerFrom, RES_GRFFMTCOLL )
     162           0 :     {}
     163             : 
     164             : public:
     165             :     TYPEINFO(); ///< Already in base class Client.
     166             : };
     167             : 
     168             : // FEATURE::CONDCOLL
     169             : /// Conditional styles.
     170             : enum Master_CollConditions
     171             : {
     172             :     PARA_IN_LIST        = 0x0001,
     173             :     PARA_IN_OUTLINE     = 0x0002,
     174             :     PARA_IN_FRAME       = 0x0004,
     175             :     PARA_IN_TABLEHEAD   = 0x0008,
     176             :     PARA_IN_TABLEBODY   = 0x0010,
     177             :     PARA_IN_SECTION     = 0x0020,
     178             :     PARA_IN_FOOTENOTE   = 0x0040,
     179             :     PARA_IN_FOOTER      = 0x0080,
     180             :     PARA_IN_HEADER      = 0x0100,
     181             :     PARA_IN_ENDNOTE     = 0x0200,
     182             :     // ...
     183             :     USRFLD_EXPRESSION   = (int)0x8000
     184             : };
     185             : 
     186             : class SW_DLLPUBLIC SwCollCondition : public SwClient
     187             : {
     188             :     sal_uLong nCondition;
     189             :     union
     190             :     {
     191             :         sal_uLong nSubCondition;
     192             :         String* pFldExpression;
     193             :     } aSubCondition;
     194             : 
     195             : public:
     196             :     TYPEINFO(); ///< Already in base class Client.
     197             : 
     198             :     SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
     199             :                     sal_uLong nSubCond = 0 );
     200             :     SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
     201             :                     const String& rSubExp );
     202             :     virtual ~SwCollCondition();
     203             : 
     204             :     /// @@@ public copy ctor, but no copy assignment?
     205             :     SwCollCondition( const SwCollCondition& rCpy );
     206             : private:
     207             :     /// @@@ public copy ctor, but no copy assignment?
     208             :     SwCollCondition & operator= (const SwCollCondition &);
     209             : public:
     210             : 
     211             :     int operator==( const SwCollCondition& rCmp ) const;
     212             :     int operator!=( const SwCollCondition& rCmp ) const
     213             :                             { return ! (*this == rCmp); }
     214             : 
     215           0 :     sal_uLong GetCondition() const      { return nCondition; }
     216           0 :     sal_uLong GetSubCondition() const   { return aSubCondition.nSubCondition; }
     217           0 :     const String* GetFldExpression() const
     218           0 :                                     { return aSubCondition.pFldExpression; }
     219             : 
     220             :     void SetCondition( sal_uLong nCond, sal_uLong nSubCond );
     221           0 :     SwTxtFmtColl* GetTxtFmtColl() const     { return (SwTxtFmtColl*)GetRegisteredIn(); }
     222             :     void RegisterToFormat( SwFmt& );
     223             : };
     224             : 
     225        1794 : class SwFmtCollConditions : public boost::ptr_vector<SwCollCondition> {};
     226             : 
     227             : class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl
     228             : {
     229             :     friend class SwDoc;
     230             : protected:
     231             :     SwFmtCollConditions aCondColls;
     232             : 
     233             :     SwConditionTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
     234             :                             SwTxtFmtColl* pDerFrom = 0 )
     235             :         : SwTxtFmtColl( rPool, pFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
     236             :     {}
     237         898 :     SwConditionTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
     238             :                             SwTxtFmtColl* pDerFrom = 0 )
     239         898 :         : SwTxtFmtColl( rPool, rFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
     240         898 :     {}
     241             : 
     242             : public:
     243             :     TYPEINFO(); ///< Already in base class Client.
     244             : 
     245             :     virtual ~SwConditionTxtFmtColl();
     246             : 
     247             :     const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
     248          68 :     const SwFmtCollConditions& GetCondColls() const     { return aCondColls; }
     249             :     void InsertCondition( const SwCollCondition& rCond );
     250             :     bool RemoveCondition( const SwCollCondition& rCond );
     251             : 
     252             :     void SetConditions( const SwFmtCollConditions& );
     253             : };
     254             : 
     255             : // FEATURE::CONDCOLL
     256             : /// Inline implementations.
     257        1111 : inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl& rNext )
     258             : {
     259        1111 :     pNextTxtFmtColl = &rNext;
     260        1111 : }
     261             : #endif
     262             : 
     263             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10