LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - docstyle.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 11 90.9 %
Date: 2013-07-09 Functions: 10 11 90.9 %
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 _DOCSTYLE_HXX
      20             : #define _DOCSTYLE_HXX
      21             : 
      22             : #include <rtl/ref.hxx>
      23             : 
      24             : #include <svl/style.hxx>
      25             : #include <svl/itemset.hxx>
      26             : #include "swdllapi.h"
      27             : #include <boost/ptr_container/ptr_vector.hpp>
      28             : 
      29             : class SwDoc;
      30             : class SwDocStyleSheetPool;
      31             : class SwPageDesc;
      32             : class SwCharFmt;
      33             : class SwTxtFmtColl;
      34             : class SwFrmFmt;
      35             : class SwNumRule;
      36             : 
      37             : /*--------------------------------------------------------------------
      38             :     Local helper class.
      39             :  --------------------------------------------------------------------*/
      40        2301 : class SwPoolFmtList : public std::vector<String>
      41             : {
      42             : public:
      43        2302 :     SwPoolFmtList() {}
      44             :     void Append( char cChar, const String& rStr );
      45             :     void Erase();
      46             : };
      47             : 
      48             : /*--------------------------------------------------------------------
      49             :     Temporary StyleSheet.
      50             :  --------------------------------------------------------------------*/
      51             : class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
      52             : {
      53             :     friend class SwDocStyleSheetPool;
      54             :     friend class SwStyleSheetIterator;
      55             : 
      56             :     SwCharFmt*          pCharFmt;
      57             :     SwTxtFmtColl*       pColl;
      58             :     SwFrmFmt*           pFrmFmt;
      59             :     const SwPageDesc*   pDesc;
      60             :     const SwNumRule*    pNumRule;
      61             : 
      62             :     SwDoc&              rDoc;
      63             :     SfxItemSet          aCoreSet;
      64             : 
      65             :     sal_Bool                bPhysical;
      66             : 
      67             : 
      68             :     /// Make empty shell a real StyleSheet (Core).
      69             :     SW_DLLPRIVATE void              Create();
      70             : 
      71             :     /// Fill StyleSheet with data.
      72             :     enum FillStyleType {
      73             :         FillOnlyName,
      74             :         FillAllInfo,
      75             :         FillPhysical
      76             :     };
      77             : 
      78             :     SW_DLLPRIVATE sal_Bool FillStyleSheet( FillStyleType eFType );
      79             : 
      80             : protected:
      81             :     virtual ~SwDocStyleSheet();
      82             : 
      83             : public:
      84             :     SwDocStyleSheet( SwDoc&                 rDoc,
      85             :                      const OUString&        rName,
      86             :                      SwDocStyleSheetPool*   pPool,
      87             :                      SfxStyleFamily         eFam,
      88             :                      sal_uInt16             nMask);
      89             : 
      90             :     SwDocStyleSheet( const SwDocStyleSheet& );
      91             : 
      92             :     void                    Reset();
      93             : 
      94       98806 :     void                    SetMask(sal_uInt16 nMsk)            { nMask = nMsk;     }
      95       51990 :     void                    SetFamily(SfxStyleFamily eFam)  { nFamily = eFam;   }
      96             : 
      97       54640 :     sal_Bool                    IsPhysical() const              { return bPhysical; }
      98             :     void                    SetPhysical(sal_Bool bPhys);
      99             : 
     100             :     virtual void            SetHidden( sal_Bool bHidden );
     101             :     virtual sal_Bool        IsHidden( ) const;
     102             : 
     103             :     /** add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False,
     104             :      which indicates that the indent attributes at a paragraph style should
     105             :      be reset in case that a list style is applied to the paragraph style and
     106             :      no indent attributes are applied. */
     107             :     void                    SetItemSet( const SfxItemSet& rSet,
     108             :                                         const bool bResetIndentAttrsAtParagraphStyle = false );
     109             : 
     110             :     virtual SfxItemSet&     GetItemSet();
     111             :     /** new method for paragraph styles to merge indent attributes of applied list
     112             :      style into the given item set, if the list style indent attributes are applicable. */
     113             :     void MergeIndentAttrsOfListStyle( SfxItemSet& rSet );
     114             :     virtual const OUString& GetParent() const;
     115             :     virtual const OUString& GetFollow() const;
     116             : 
     117             :     virtual sal_uLong GetHelpId( OUString& rFile );
     118             :     virtual void SetHelpId( const OUString& r, sal_uLong nId );
     119             : 
     120             :     /** Preset the members without physical access.
     121             :      Used by StyleSheetPool. */
     122       52414 :     void                    PresetName(const OUString& rName)  { aName   = rName; }
     123             :     void                    PresetNameAndFamily(const OUString& rName);
     124       27107 :     void                    PresetParent(const OUString& rName){ aParent = rName; }
     125       45700 :     void                    PresetFollow(const OUString& rName){ aFollow = rName; }
     126             : 
     127             :     virtual bool            SetName( const OUString& rStr);
     128             :     virtual bool            SetParent( const OUString& rStr);
     129             :     virtual bool            SetFollow( const OUString& rStr);
     130             : 
     131             :     virtual bool            HasFollowSupport() const;
     132             :     virtual bool            HasParentSupport() const;
     133             :     virtual bool            HasClearParentSupport() const;
     134             :     virtual OUString        GetDescription();
     135             :     virtual OUString        GetDescription(SfxMapUnit eUnit);
     136             : 
     137             :     SwCharFmt*              GetCharFmt();
     138             :     SwTxtFmtColl*           GetCollection();
     139             :     SwFrmFmt*               GetFrmFmt();
     140             :     const SwPageDesc*       GetPageDesc();
     141             :     const SwNumRule*        GetNumRule();
     142             :     void                    SetNumRule(const SwNumRule& rRule);
     143             : 
     144             :     virtual bool            IsUsed() const;
     145             : };
     146             : 
     147             : /*--------------------------------------------------------------------
     148             :    Iterator for Pool.
     149             :  --------------------------------------------------------------------*/
     150             : 
     151             : class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
     152             : {
     153             :     rtl::Reference< SwDocStyleSheet > mxIterSheet;
     154             :     rtl::Reference< SwDocStyleSheet > mxStyleSheet;
     155             :     SwPoolFmtList       aLst;
     156             :     sal_uInt16              nLastPos;
     157             :     sal_Bool                bFirstCalled;
     158             : 
     159             :     void                AppendStyleList(const boost::ptr_vector<String>& rLst,
     160             :                                         sal_Bool    bUsed,
     161             :                                         sal_Bool    bTestHidden,
     162             :                                         bool        bOnlyHidden,
     163             :                                         sal_uInt16  nSection,
     164             :                                         char    cType);
     165             : 
     166             : public:
     167             :     SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
     168             :                           SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
     169             :     virtual ~SwStyleSheetIterator();
     170             : 
     171             :     virtual sal_uInt16 Count();
     172             :     virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx);
     173             :     virtual SfxStyleSheetBase* First();
     174             :     virtual SfxStyleSheetBase* Next();
     175             :     virtual SfxStyleSheetBase* Find(const OUString& rStr);
     176             : 
     177             :     virtual void Notify( SfxBroadcaster&, const SfxHint& );
     178             : };
     179             : 
     180             : 
     181             : class SwDocStyleSheetPool : public SfxStyleSheetBasePool
     182             : {
     183             :     rtl::Reference< SwDocStyleSheet > mxStyleSheet;
     184             :     SwDoc&              rDoc;
     185             :     sal_Bool                bOrganizer : 1;     ///< Organizer
     186             : 
     187             : 
     188             :     virtual SfxStyleSheetBase* Create( const OUString&, SfxStyleFamily, sal_uInt16 nMask);
     189             :     virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& );
     190             : 
     191             :     using SfxStyleSheetBasePool::Find;
     192             : 
     193             : public:
     194             :     SwDocStyleSheetPool( SwDoc&, sal_Bool bOrganizer = sal_False );
     195             : 
     196             :     virtual void Replace( SfxStyleSheetBase& rSource,
     197             :                           SfxStyleSheetBase& rTarget );
     198             :     virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
     199             : 
     200             :     virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam,
     201             :                                     sal_uInt16 n=SFXSTYLEBIT_ALL );
     202             : 
     203             :     virtual bool SetParent( SfxStyleFamily eFam, const OUString &rStyle,
     204             :                             const OUString &rParent );
     205             : 
     206             :     virtual void Remove( SfxStyleSheetBase* pStyle);
     207             : 
     208           0 :     void    SetOrganizerMode( sal_Bool bMode )  { bOrganizer = bMode; }
     209       11727 :     sal_Bool    IsOrganizerMode() const         { return bOrganizer; }
     210             : 
     211             :     virtual SfxStyleSheetIteratorPtr CreateIterator( SfxStyleFamily, sal_uInt16 nMask );
     212             : 
     213       26388 :     SwDoc& GetDoc() const { return rDoc; }
     214             : 
     215             :     void dispose();
     216             : 
     217             :     virtual void SAL_CALL acquire(  ) throw ();
     218             :     virtual void SAL_CALL release(  ) throw ();
     219             : 
     220             : protected:
     221             :     virtual ~SwDocStyleSheetPool();
     222             : 
     223             :     /// For not-so-clever compilers.
     224             : private:
     225             :     SwDocStyleSheetPool( const SwDocStyleSheetPool& );
     226             : };
     227             : 
     228             : 
     229             : #endif
     230             : 
     231             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10