LCOV - code coverage report
Current view: top level - sw/inc - paratr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 58 70 82.9 %
Date: 2015-06-13 12:38:46 Functions: 38 46 82.6 %
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 INCLUDED_SW_INC_PARATR_HXX
      20             : #define INCLUDED_SW_INC_PARATR_HXX
      21             : #include <svl/eitem.hxx>
      22             : #include <svl/stritem.hxx>
      23             : #include "swdllapi.h"
      24             : #include <hintids.hxx>
      25             : #include <calbck.hxx>
      26             : #include <swatrset.hxx>
      27             : #include <format.hxx>
      28             : #include <charfmt.hxx>
      29             : #include <swtypes.hxx>
      30             : #include <editeng/adjustitem.hxx>
      31             : #include <editeng/lspcitem.hxx>
      32             : #include <editeng/spltitem.hxx>
      33             : #include <editeng/widwitem.hxx>
      34             : #include <editeng/orphitem.hxx>
      35             : #include <editeng/tstpitem.hxx>
      36             : #include <editeng/hyphenzoneitem.hxx>
      37             : #include <editeng/scriptspaceitem.hxx>
      38             : #include <editeng/hngpnctitem.hxx>
      39             : #include <editeng/forbiddenruleitem.hxx>
      40             : #include <editeng/paravertalignitem.hxx>
      41             : #include <editeng/pgrditem.hxx>
      42             : 
      43             : class SwCharFormat;
      44             : class IntlWrapper;
      45             : 
      46             : #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
      47             : 
      48             : /** If SwFormatDrop is a Client, it is the CharFormat that describes the font for the
      49             :    DropCaps. If it is not a Client, formatting uses the CharFormat of the paragraph.
      50             :    If the CharFormat is modified, this change is propagated to the paragraphs
      51             :    via the Modify of SwFormatDrop. */
      52             : class SW_DLLPUBLIC SwFormatDrop: public SfxPoolItem, public SwClient
      53             : {
      54             :     SwModify* pDefinedIn;       /**< Modify-Object, that contains DropCaps.
      55             :                                   Can only be TextFormatCollection/TextNode. */
      56             :     sal_uInt16 nDistance;       ///< Distance to beginning of text.
      57             :     sal_uInt16 nReadFormat;        ///< For Sw3-Reader: CharFormat-Id (load Pool!).
      58             :     sal_uInt8  nLines;          ///< Line count.
      59             :     sal_uInt8  nChars;          ///< Character count.
      60             :     bool   bWholeWord;      ///< First word with initials.
      61             : public:
      62             :     TYPEINFO_OVERRIDE(); ///< Already in base class SwClient.
      63             : 
      64             :     SwFormatDrop();
      65             :     virtual ~SwFormatDrop();
      66             : 
      67             :     // @@@ public copy ctor, but no copy assignment?
      68             :     SwFormatDrop( const SwFormatDrop & );
      69             : private:
      70             :     // @@@ public copy ctor, but no copy assignment?
      71             :     SwFormatDrop & operator= (const SwFormatDrop &) SAL_DELETED_FUNCTION;
      72             : 
      73             : protected:
      74             :    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
      75             : 
      76             : public:
      77             : 
      78             :     /// "pure virtual methods" of SfxPoolItem
      79             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      80             :     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
      81             :     virtual bool GetPresentation( SfxItemPresentation ePres,
      82             :                                     SfxMapUnit eCoreMetric,
      83             :                                     SfxMapUnit ePresMetric,
      84             :                                     OUString &rText,
      85             :                                     const IntlWrapper*    pIntl = 0) const SAL_OVERRIDE;
      86             :     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      87             :     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      88             : 
      89      147273 :     inline sal_uInt8 GetLines() const { return nLines; }
      90           0 :     inline sal_uInt8 &GetLines() { return nLines; }
      91             : 
      92      132100 :     inline sal_uInt8 GetChars() const { return nChars; }
      93           0 :     inline sal_uInt8 &GetChars() { return nChars; }
      94             : 
      95      132094 :     inline bool GetWholeWord() const { return bWholeWord; }
      96           0 :     inline bool &GetWholeWord() { return bWholeWord; }
      97             : 
      98       91450 :     inline sal_uInt16 GetDistance() const { return nDistance; }
      99           0 :     inline sal_uInt16 &GetDistance() { return nDistance; }
     100             : 
     101         233 :     inline const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); }
     102          32 :     inline SwCharFormat *GetCharFormat()       { return static_cast<SwCharFormat*>(GetRegisteredIn()); }
     103             :     void SetCharFormat( SwCharFormat *pNew );
     104             :     /// Get information from Client.
     105             :     virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
     106             : 
     107             :     /// Get and set Modify pointer.
     108          36 :     inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
     109          32 :     inline void ChgDefinedIn( const SwModify* pNew )
     110          32 :     { pDefinedIn = const_cast<SwModify*>(pNew); }
     111             : };
     112             : 
     113      137807 : class SwRegisterItem : public SfxBoolItem
     114             : {
     115             : public:
     116             :     TYPEINFO_OVERRIDE();
     117             : 
     118             :     inline SwRegisterItem( const bool bRegister = false );
     119             : 
     120             :     /// @@@ public copy assignment, but no copy ctor?
     121             :     inline SwRegisterItem& operator=( const SwRegisterItem& rRegister );
     122             : 
     123             :     /// "pure virtual methods" of SfxPoolItem
     124             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     125             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     126             :                                     SfxMapUnit eCoreMetric,
     127             :                                     SfxMapUnit ePresMetric,
     128             :                                     OUString &rText,
     129             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
     130             : };
     131             : 
     132       19539 : inline SwRegisterItem::SwRegisterItem( const bool bRegister ) :
     133       19539 :     SfxBoolItem( RES_PARATR_REGISTER, bRegister )
     134       19539 : {}
     135             : 
     136             : inline SwRegisterItem& SwRegisterItem::operator=(
     137             :     const SwRegisterItem& rRegister )
     138             : {
     139             :     SetValue( rRegister.GetValue() );
     140             :     return *this;
     141             : }
     142             : 
     143       12002 : class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem
     144             : {
     145             : public:
     146             :     TYPEINFO_OVERRIDE();
     147             : 
     148         580 :     SwNumRuleItem()
     149         580 :         : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {}
     150             : 
     151        5207 :     SwNumRuleItem( const OUString& rRuleName )
     152        5207 :         : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
     153             : 
     154        3079 :     SwNumRuleItem( const SwNumRuleItem& rCpy )
     155        3079 :         : SfxStringItem( RES_PARATR_NUMRULE, rCpy.GetValue() ) {}
     156             : 
     157           0 :     SwNumRuleItem& operator=( const SwNumRuleItem& rCpy )
     158           0 :     { SetValue( rCpy.GetValue() ); return *this; }
     159             : 
     160             :     /// "pure virtual methods" of SfxPoolItem
     161             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     162             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     163             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     164             :                                     SfxMapUnit eCoreMetric,
     165             :                                     SfxMapUnit ePresMetric,
     166             :                                     OUString &rText,
     167             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
     168             : 
     169             :     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const SAL_OVERRIDE;
     170             :     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) SAL_OVERRIDE;
     171             : 
     172             :     void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
     173             : };
     174             : 
     175         154 : class SwParaConnectBorderItem : public SfxBoolItem
     176             : {
     177             : public:
     178             :     TYPEINFO_OVERRIDE();
     179             : 
     180             :     inline SwParaConnectBorderItem( const bool bConnect = true );
     181             : 
     182             :     /// @@@ public copy assignment, but no copy ctor?
     183             :     inline SwParaConnectBorderItem& operator=( const SwParaConnectBorderItem& rConnect );
     184             : 
     185             :     /// "pure virtual methods" of SfxPoolItem
     186             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     187             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     188             :                                     SfxMapUnit eCoreMetric,
     189             :                                     SfxMapUnit ePresMetric,
     190             :                                     OUString &rText,
     191             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
     192             : };
     193             : 
     194          65 : inline SwParaConnectBorderItem::SwParaConnectBorderItem( const bool bConnect ) :
     195          65 :     SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
     196          65 : {}
     197             : 
     198             : inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=(
     199             :     const SwParaConnectBorderItem& rConnect )
     200             : {
     201             :     SetValue( rConnect.GetValue() );
     202             :     return *this;
     203             : }
     204             : 
     205             : //  Implementation of paragraph-attributes methods of SwAttrSet
     206      374025 : inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const
     207      374025 :     {   return static_cast<const SvxLineSpacingItem&>(Get( RES_PARATR_LINESPACING,bInP)); }
     208      292606 : inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const
     209      292606 :     {   return static_cast<const SvxAdjustItem&>(Get( RES_PARATR_ADJUST,bInP)); }
     210       30465 : inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const
     211       30465 :     {   return static_cast<const SvxFormatSplitItem&>(Get( RES_PARATR_SPLIT,bInP)); }
     212      223899 : inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const
     213      223899 :     {   return static_cast<const SwRegisterItem&>(Get( RES_PARATR_REGISTER,bInP)); }
     214        2106 : inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const
     215        2106 :     {   return static_cast<const SvxWidowsItem&>(Get( RES_PARATR_WIDOWS,bInP)); }
     216       28933 : inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const
     217       28933 :     {   return static_cast<const SvxOrphansItem&>(Get( RES_PARATR_ORPHANS,bInP)); }
     218      184833 : inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const
     219      184833 :     {   return static_cast<const SvxTabStopItem&>(Get( RES_PARATR_TABSTOP,bInP)); }
     220      102344 : inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const
     221      102344 :     {   return static_cast<const SvxHyphenZoneItem&>(Get(RES_PARATR_HYPHENZONE,bInP)); }
     222       72773 : inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const
     223       72773 :     {   return static_cast<const SwFormatDrop&>(Get(RES_PARATR_DROP,bInP)); }
     224       15052 : inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const
     225       15052 :     {   return static_cast<const SwNumRuleItem&>(Get(RES_PARATR_NUMRULE,bInP)); }
     226       55817 : inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const
     227       55817 :     {   return static_cast<const SvxScriptSpaceItem&>(Get(RES_PARATR_SCRIPTSPACE,bInP)); }
     228       55817 : inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const
     229       55817 :     {   return static_cast<const SvxHangingPunctuationItem&>(Get(RES_PARATR_HANGINGPUNCTUATION,bInP)); }
     230       55817 : inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const
     231       55817 :     {   return static_cast<const SvxForbiddenRuleItem&>(Get(RES_PARATR_FORBIDDEN_RULES, bInP)); }
     232      184833 : inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const
     233      184833 :     {   return static_cast<const SvxParaVertAlignItem&>(Get( RES_PARATR_VERTALIGN, bInP )); }
     234      223036 : inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const
     235      223036 :     {   return static_cast<const SvxParaGridItem&>(Get( RES_PARATR_SNAPTOGRID, bInP )); }
     236       95030 : inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const
     237       95030 :     {   return static_cast<const SwParaConnectBorderItem&>(Get( RES_PARATR_CONNECT_BORDER, bInP )); }
     238             : 
     239             : // Implementation of paragraph-attributes methods of SwFormat
     240           0 : inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const
     241           0 :     {   return m_aSet.GetLineSpacing(bInP); }
     242             : inline const SvxAdjustItem &SwFormat::GetAdjust(bool bInP) const
     243             :     {   return m_aSet.GetAdjust(bInP); }
     244             : inline const SvxFormatSplitItem &SwFormat::GetSplit(bool bInP) const
     245             :     {   return m_aSet.GetSplit(bInP); }
     246             : inline const SwRegisterItem &SwFormat::GetRegister(bool bInP) const
     247             :     {   return m_aSet.GetRegister(bInP); }
     248             : inline const SvxWidowsItem &SwFormat::GetWidows(bool bInP) const
     249             :     {   return m_aSet.GetWidows(bInP); }
     250             : inline const SvxOrphansItem &SwFormat::GetOrphans(bool bInP) const
     251             :     {   return m_aSet.GetOrphans(bInP); }
     252           0 : inline const SvxTabStopItem &SwFormat::GetTabStops(bool bInP) const
     253           0 :     {   return m_aSet.GetTabStops(bInP); }
     254             : inline const SvxHyphenZoneItem &SwFormat::GetHyphenZone(bool bInP) const
     255             :     {   return m_aSet.GetHyphenZone(bInP); }
     256           0 : inline const SwFormatDrop &SwFormat::GetDrop(bool bInP) const
     257           0 :     {   return m_aSet.GetDrop(bInP); }
     258       15052 : inline const SwNumRuleItem &SwFormat::GetNumRule(bool bInP) const
     259       15052 :     {   return m_aSet.GetNumRule(bInP); }
     260             : inline const SvxScriptSpaceItem& SwFormat::GetScriptSpace(bool bInP) const
     261             :     {   return m_aSet.GetScriptSpace(bInP) ; }
     262             : inline const SvxHangingPunctuationItem &SwFormat::GetHangingPunctuation(bool bInP) const
     263             :     {   return m_aSet.GetHangingPunctuation(bInP) ; }
     264             : inline const SvxForbiddenRuleItem &SwFormat::GetForbiddenRule(bool bInP) const
     265             :     {   return static_cast<const SvxForbiddenRuleItem&>(m_aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP)); }
     266             : inline const SvxParaVertAlignItem &SwFormat::GetParaVertAlign(bool bInP) const
     267             :     {   return static_cast<const SvxParaVertAlignItem&>(m_aSet.Get( RES_PARATR_VERTALIGN, bInP )); }
     268             : inline const SvxParaGridItem &SwFormat::GetParaGrid(bool bInP) const
     269             :     {   return static_cast<const SvxParaGridItem&>(m_aSet.Get( RES_PARATR_SNAPTOGRID, bInP )); }
     270             : inline const SwParaConnectBorderItem &SwFormat::GetParaConnectBorder(bool bInP) const
     271             :     {   return static_cast<const SwParaConnectBorderItem&>(m_aSet.Get( RES_PARATR_CONNECT_BORDER, bInP )); }
     272             : 
     273             : #endif
     274             : 
     275             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11