LCOV - code coverage report
Current view: top level - sw/inc - docstyle.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 11 90.9 %
Date: 2012-08-25 Functions: 10 11 90.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _DOCSTYLE_HXX
      29                 :            : #define _DOCSTYLE_HXX
      30                 :            : 
      31                 :            : #include <rtl/ref.hxx>
      32                 :            : 
      33                 :            : #include <svl/style.hxx>
      34                 :            : #include <svl/itemset.hxx>
      35                 :            : #include "swdllapi.h"
      36                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      37                 :            : 
      38                 :            : class SwDoc;
      39                 :            : class SwDocStyleSheetPool;
      40                 :            : class SwPageDesc;
      41                 :            : class SwCharFmt;
      42                 :            : class SwTxtFmtColl;
      43                 :            : class SwFrmFmt;
      44                 :            : class SwNumRule;
      45                 :            : 
      46                 :            : /*--------------------------------------------------------------------
      47                 :            :     Local helper class.
      48                 :            :  --------------------------------------------------------------------*/
      49                 :       2686 : class SwPoolFmtList : public std::vector<String>
      50                 :            : {
      51                 :            : public:
      52                 :       2686 :     SwPoolFmtList() {}
      53                 :            :     void Append( char cChar, const String& rStr );
      54                 :            :     void Erase();
      55                 :            : };
      56                 :            : 
      57                 :            : /*--------------------------------------------------------------------
      58                 :            :     Temporary StyleSheet.
      59                 :            :  --------------------------------------------------------------------*/
      60                 :            : class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
      61                 :            : {
      62                 :            :     friend class SwDocStyleSheetPool;
      63                 :            :     friend class SwStyleSheetIterator;
      64                 :            : 
      65                 :            :     SwCharFmt*          pCharFmt;
      66                 :            :     SwTxtFmtColl*       pColl;
      67                 :            :     SwFrmFmt*           pFrmFmt;
      68                 :            :     const SwPageDesc*   pDesc;
      69                 :            :     const SwNumRule*    pNumRule;
      70                 :            : 
      71                 :            :     SwDoc&              rDoc;
      72                 :            :     SfxItemSet          aCoreSet;
      73                 :            : 
      74                 :            :     sal_Bool                bPhysical;
      75                 :            : 
      76                 :            : 
      77                 :            :     // Make empty shell a real StyleSheet (Core).
      78                 :            :     SW_DLLPRIVATE void              Create();
      79                 :            : 
      80                 :            :     // Fill StyleSheet with data.
      81                 :            :     enum FillStyleType {
      82                 :            :         FillOnlyName,
      83                 :            :         FillAllInfo,
      84                 :            :         FillPhysical
      85                 :            :     };
      86                 :            : 
      87                 :            :     SW_DLLPRIVATE sal_Bool FillStyleSheet( FillStyleType eFType );
      88                 :            : 
      89                 :            : protected:
      90                 :            :     virtual ~SwDocStyleSheet();
      91                 :            : 
      92                 :            : public:
      93                 :            :     SwDocStyleSheet( SwDoc&                 rDoc,
      94                 :            :                      const String&          rName,
      95                 :            :                      SwDocStyleSheetPool*   pPool,
      96                 :            :                      SfxStyleFamily         eFam,
      97                 :            :                      sal_uInt16                 nMask);
      98                 :            : 
      99                 :            :     SwDocStyleSheet( const SwDocStyleSheet& );
     100                 :            : 
     101                 :            :     void                    Reset();
     102                 :            : 
     103                 :      96769 :     void                    SetMask(sal_uInt16 nMsk)            { nMask = nMsk;     }
     104                 :      61990 :     void                    SetFamily(SfxStyleFamily eFam)  { nFamily = eFam;   }
     105                 :            : 
     106                 :      65944 :     sal_Bool                    IsPhysical() const              { return bPhysical; }
     107                 :            :     void                    SetPhysical(sal_Bool bPhys);
     108                 :            : 
     109                 :            :     // add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False,
     110                 :            :     // which indicates that the indent attributes at a paragraph style should
     111                 :            :     // be reset in case that a list style is applied to the paragraph style and
     112                 :            :     // no indent attributes are applied.
     113                 :            :     void                    SetItemSet( const SfxItemSet& rSet,
     114                 :            :                                         const bool bResetIndentAttrsAtParagraphStyle = false );
     115                 :            : 
     116                 :            :     virtual SfxItemSet&     GetItemSet();
     117                 :            :     // new method for paragraph styles to merge indent attributes of applied list
     118                 :            :     // style into the given item set, if the list style indent attributes are applicable.
     119                 :            :     void MergeIndentAttrsOfListStyle( SfxItemSet& rSet );
     120                 :            :     virtual const String&   GetParent() const;
     121                 :            :     virtual const String&   GetFollow() const;
     122                 :            : 
     123                 :            :     virtual sal_uLong GetHelpId( String& rFile );
     124                 :            :     virtual void SetHelpId( const String& r, sal_uLong nId );
     125                 :            : 
     126                 :            :     // Preset the members without physical access.
     127                 :            :     // Used by StyleSheetPool.
     128                 :      62173 :     void                    PresetName(const String& rName)  { aName   = rName; }
     129                 :            :     void                    PresetNameAndFamily(const String& rName);
     130                 :      31423 :     void                    PresetParent(const String& rName){ aParent = rName; }
     131                 :      59740 :     void                    PresetFollow(const String& rName){ aFollow = rName; }
     132                 :            : 
     133                 :            :     virtual sal_Bool            SetName( const String& rStr);
     134                 :            :     virtual sal_Bool            SetParent( const String& rStr);
     135                 :            :     virtual sal_Bool            SetFollow( const String& rStr);
     136                 :            : 
     137                 :            :     virtual sal_Bool            HasFollowSupport() const;
     138                 :            :     virtual sal_Bool            HasParentSupport() const;
     139                 :            :     virtual sal_Bool            HasClearParentSupport() const;
     140                 :            :     virtual String          GetDescription();
     141                 :            :     virtual String          GetDescription(SfxMapUnit eUnit);
     142                 :            : 
     143                 :            :     SwCharFmt*              GetCharFmt();
     144                 :            :     SwTxtFmtColl*           GetCollection();
     145                 :            :     SwFrmFmt*               GetFrmFmt();
     146                 :            :     const SwPageDesc*       GetPageDesc();
     147                 :            :     const SwNumRule*        GetNumRule();
     148                 :            :     void                    SetNumRule(const SwNumRule& rRule);
     149                 :            : 
     150                 :            :     virtual sal_Bool            IsUsed() const;
     151                 :            : };
     152                 :            : 
     153                 :            : /*--------------------------------------------------------------------
     154                 :            :    Iterator for Pool.
     155                 :            :  --------------------------------------------------------------------*/
     156                 :            : 
     157                 :            : class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
     158                 :            : {
     159                 :            :     rtl::Reference< SwDocStyleSheet > mxIterSheet;
     160                 :            :     rtl::Reference< SwDocStyleSheet > mxStyleSheet;
     161                 :            :     SwPoolFmtList       aLst;
     162                 :            :     sal_uInt16              nLastPos;
     163                 :            :     sal_Bool                bFirstCalled;
     164                 :            : 
     165                 :            :     void                AppendStyleList(const boost::ptr_vector<String>& rLst,
     166                 :            :                                         sal_Bool    bUsed,
     167                 :            :                                         sal_uInt16  nSection,
     168                 :            :                                         char    cType);
     169                 :            : 
     170                 :            : public:
     171                 :            :     SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
     172                 :            :                           SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
     173                 :            :     virtual ~SwStyleSheetIterator();
     174                 :            : 
     175                 :            :     virtual sal_uInt16 Count();
     176                 :            :     virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx);
     177                 :            :     virtual SfxStyleSheetBase* First();
     178                 :            :     virtual SfxStyleSheetBase* Next();
     179                 :            :     virtual SfxStyleSheetBase* Find(const rtl::OUString& rStr);
     180                 :            : 
     181                 :            :     virtual void Notify( SfxBroadcaster&, const SfxHint& );
     182                 :            : };
     183                 :            : 
     184                 :            : 
     185                 :            : class SwDocStyleSheetPool : public SfxStyleSheetBasePool
     186                 :            : {
     187                 :            :     rtl::Reference< SwDocStyleSheet > mxStyleSheet;
     188                 :            :     SwDoc&              rDoc;
     189                 :            :     sal_Bool                bOrganizer : 1;     // Organizer
     190                 :            : 
     191                 :            : 
     192                 :            :     virtual SfxStyleSheetBase* Create( const String&, SfxStyleFamily, sal_uInt16 nMask);
     193                 :            :     virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& );
     194                 :            : 
     195                 :            :     using SfxStyleSheetBasePool::Find;
     196                 :            : 
     197                 :            : public:
     198                 :            :     SwDocStyleSheetPool( SwDoc&, sal_Bool bOrganizer = sal_False );
     199                 :            : 
     200                 :            :     virtual void Replace( SfxStyleSheetBase& rSource,
     201                 :            :                           SfxStyleSheetBase& rTarget );
     202                 :            :     virtual SfxStyleSheetBase& Make(const String&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
     203                 :            : 
     204                 :            :     virtual SfxStyleSheetBase* Find( const String&, SfxStyleFamily eFam,
     205                 :            :                                     sal_uInt16 n=0xFFFF );
     206                 :            : 
     207                 :            :     virtual sal_Bool SetParent( SfxStyleFamily eFam, const String &rStyle,
     208                 :            :                             const String &rParent );
     209                 :            : 
     210                 :            :     virtual void Remove( SfxStyleSheetBase* pStyle);
     211                 :            : 
     212                 :          0 :     void    SetOrganizerMode( sal_Bool bMode )  { bOrganizer = bMode; }
     213                 :      21526 :     sal_Bool    IsOrganizerMode() const         { return bOrganizer; }
     214                 :            : 
     215                 :            :     virtual SfxStyleSheetIterator* CreateIterator( SfxStyleFamily,
     216                 :            :                                                     sal_uInt16 nMask );
     217                 :            : 
     218                 :      26990 :     SwDoc& GetDoc() const { return rDoc; }
     219                 :            : 
     220                 :            :     void dispose();
     221                 :            : 
     222                 :            :     virtual void SAL_CALL acquire(  ) throw ();
     223                 :            :     virtual void SAL_CALL release(  ) throw ();
     224                 :            : 
     225                 :            : protected:
     226                 :            :     virtual ~SwDocStyleSheetPool();
     227                 :            : 
     228                 :            :     //For not-so-clever compilers.
     229                 :            : private:
     230                 :            :     SwDocStyleSheetPool( const SwDocStyleSheetPool& );
     231                 :            : };
     232                 :            : 
     233                 :            : 
     234                 :            : #endif
     235                 :            : 
     236                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10