LCOV - code coverage report
Current view: top level - sw/inc - swatrset.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 7 7 100.0 %
Date: 2014-04-11 Functions: 9 9 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             : #ifndef INCLUDED_SW_INC_SWATRSET_HXX
      20             : #define INCLUDED_SW_INC_SWATRSET_HXX
      21             : #include <tools/solar.h>
      22             : #include <tools/mempool.hxx>
      23             : #include <svl/itemset.hxx>
      24             : #include <svl/itempool.hxx>
      25             : #include <swdllapi.h>
      26             : 
      27             : class SwModify;
      28             : class SwDoc;
      29             : class OutputDevice;
      30             : class IDocumentSettingAccess;
      31             : class SfxBoolItem;
      32             : class SvxPostureItem;
      33             : class SvxWeightItem;
      34             : class SvxShadowedItem;
      35             : class SvxAutoKernItem;
      36             : class SvxWordLineModeItem;
      37             : class SvxContourItem;
      38             : class SvxKerningItem;
      39             : class SvxUnderlineItem;
      40             : class SvxOverlineItem;
      41             : class SvxCrossedOutItem;
      42             : class SvxFontHeightItem;
      43             : class SvxPropSizeItem;
      44             : class SvxFontItem;
      45             : class SvxColorItem;
      46             : class SvxCharSetColorItem;
      47             : class SvxLanguageItem;
      48             : class SvxEscapementItem;
      49             : class SvxCaseMapItem;
      50             : class SvxNoHyphenItem;
      51             : class SvxBlinkItem;
      52             : class SvxEmphasisMarkItem;
      53             : class SvxTwoLinesItem;
      54             : class SvxCharScaleWidthItem;
      55             : class SvxCharRotateItem;
      56             : class SvxCharReliefItem;
      57             : class SvxCharHiddenItem;
      58             : 
      59             : // Frame attributes
      60             : class SwFmtFillOrder;
      61             : class SwFmtFrmSize;
      62             : class SvxPaperBinItem;
      63             : class SvxLRSpaceItem;
      64             : class SvxULSpaceItem;
      65             : class SwFmtCntnt;
      66             : class SwFmtHeader;
      67             : class SwFmtFooter;
      68             : class SvxPrintItem;
      69             : class SvxOpaqueItem;
      70             : class SvxProtectItem;
      71             : class SwFmtSurround;
      72             : class SwFmtVertOrient;
      73             : class SwFmtHoriOrient;
      74             : class SwFmtAnchor;
      75             : class SvxBoxItem;
      76             : class SvxBrushItem;
      77             : class XFillStyleItem;
      78             : class XFillGradientItem;
      79             : class SvxShadowItem;
      80             : class SwFmtPageDesc;
      81             : class SvxFmtBreakItem;
      82             : class SwFmtCol;
      83             : class SvxMacroItem;
      84             : class SvxFmtKeepItem;
      85             : class SwFmtURL;
      86             : class SwFmtLineNumber;
      87             : class SwFmtEditInReadonly;
      88             : class SwFmtLayoutSplit;
      89             : class SwFmtRowSplit;
      90             : class SwFmtChain;
      91             : class SwFmtFtnAtTxtEnd;
      92             : class SwFmtEndAtTxtEnd;
      93             : class SwFmtNoBalancedColumns;
      94             : class SvxFrameDirectionItem;
      95             : class SwTextGridItem;
      96             : class SwHeaderAndFooterEatSpacingItem;
      97             : class SwFmtFollowTextFlow;
      98             : class SwFmtWrapInfluenceOnObjPos;
      99             : class SdrTextVertAdjustItem;
     100             : 
     101             : // Graphic attributes
     102             : class SwMirrorGrf;
     103             : class SwCropGrf;
     104             : class SwRotationGrf;
     105             : class SwLuminanceGrf;
     106             : class SwContrastGrf;
     107             : class SwChannelRGrf;
     108             : class SwChannelGGrf;
     109             : class SwChannelBGrf;
     110             : class SwGammaGrf;
     111             : class SwInvertGrf;
     112             : class SwTransparencyGrf;
     113             : class SwDrawModeGrf;
     114             : 
     115             : // Paragraph attributes
     116             : class SvxLineSpacingItem;
     117             : class SvxAdjustItem;
     118             : class SvxFmtSplitItem;
     119             : class SwRegisterItem;
     120             : class SwNumRuleItem;
     121             : class SvxWidowsItem;
     122             : class SvxOrphansItem;
     123             : class SvxTabStopItem;
     124             : class SvxHyphenZoneItem;
     125             : class SwFmtDrop;
     126             : class SvxScriptSpaceItem;
     127             : class SvxHangingPunctuationItem;
     128             : class SvxForbiddenRuleItem;
     129             : class SvxParaVertAlignItem;
     130             : class SvxParaGridItem;
     131             : class SwParaConnectBorderItem;
     132             : 
     133             : // TableBox attributes
     134             : class SwTblBoxNumFormat;
     135             : class SwTblBoxFormula;
     136             : class SwTblBoxValue;
     137             : 
     138             : class SwAttrPool : public SfxItemPool
     139             : {
     140             : private:
     141             :     ///UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor
     142             :     /// and destructor; still isolated to evtl. allow other use later
     143             :     void createAndAddSecondaryPools();
     144             :     void removeAndDeleteSecondaryPools();
     145             : 
     146             :     friend void _InitCore();            // For creating/deleting of version maps.
     147             :     friend void _FinitCore();
     148             :     static sal_uInt16* pVersionMap1;
     149             :     static sal_uInt16* pVersionMap2;
     150             :     static sal_uInt16* pVersionMap3;
     151             :     static sal_uInt16* pVersionMap4;
     152             :     // due to extension of attribute set a new version
     153             :     // map for binary filter is necessary (version map 5).
     154             :     static sal_uInt16* pVersionMap5;
     155             :     static sal_uInt16* pVersionMap6;
     156             :     static sal_uInt16* pVersionMap7;
     157             : 
     158             :     SwDoc* pDoc;
     159             : 
     160             : public:
     161             :     SwAttrPool( SwDoc* pDoc );
     162             : protected:
     163             :     virtual ~SwAttrPool();
     164             : public:
     165             : 
     166     1458311 :           SwDoc* GetDoc()           { return pDoc; }
     167             :     const SwDoc* GetDoc() const     { return pDoc; }
     168             : 
     169             : };
     170             : 
     171     2786225 : class SW_DLLPUBLIC SwAttrSet : public SfxItemSet
     172             : {
     173             :     // Pointer for Modify-System
     174             :     SwAttrSet *pOldSet, *pNewSet;
     175             : 
     176             :     // Notification-Callback
     177             :     virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ) SAL_OVERRIDE;
     178             : 
     179      862956 :     void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
     180             : public:
     181             :     SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
     182             :     SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
     183             :     SwAttrSet( const SwAttrSet& );
     184             : 
     185             :     virtual SfxItemSet* Clone(bool bItems = true, SfxItemPool *pToPool = 0) const SAL_OVERRIDE;
     186             : 
     187             :     bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
     188             :     bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
     189             : 
     190             :     // Delete an item or a range.
     191             :     sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
     192             :     sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
     193             :                         SwAttrSet* pOld = 0, SwAttrSet* pNew = 0 );
     194             : 
     195             :     int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
     196             : 
     197             :     void GetPresentation( SfxItemPresentation ePres,
     198             :         SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, OUString &rText ) const;
     199             : 
     200     2808601 :     SwAttrPool* GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); }
     201             : 
     202             :     // Copy attributes, if necessary across documents.
     203             :     void CopyToModify( SwModify& rMod ) const;
     204             : 
     205             :     // Special treatment for some attributes.
     206             :     // Set Modify-pointer (the old pDefinedIn) at the following attributes:
     207             :     //  - SwFmtDropCaps
     208             :     //  - SwFmtPageDesc
     209             :     // (Is called at insert in formats/nodes.)
     210             :     // Second version is for the SwAttrSet handles of SwCntntNode.
     211             :     bool SetModifyAtAttr( const SwModify* pModify );
     212             : 
     213             :     // Document is set at SwAttrPool. Therefore it is always accessible.
     214      663092 :     const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
     215      734039 :           SwDoc *GetDoc()       { return GetPool()->GetDoc(); }
     216             : 
     217             :     // Get methods: bool indicates whether to search only in Set (sal_False)
     218             :     // or also in parents. If nothing is found then default attribute is returned.
     219             :     // Character attributes. Implementation in charatr.hxx.
     220             :     inline const SvxPostureItem           &GetPosture( sal_Bool = sal_True ) const;
     221             :     inline const SvxWeightItem          &GetWeight( sal_Bool = sal_True ) const;
     222             :     inline const SvxShadowedItem        &GetShadowed( sal_Bool = sal_True ) const;
     223             :     inline const SvxAutoKernItem        &GetAutoKern( sal_Bool = sal_True ) const;
     224             :     inline const SvxWordLineModeItem    &GetWordLineMode( sal_Bool = sal_True ) const;
     225             :     inline const SvxContourItem         &GetContour( sal_Bool = sal_True ) const;
     226             :     inline const SvxKerningItem         &GetKerning( sal_Bool = sal_True ) const;
     227             :     inline const SvxUnderlineItem       &GetUnderline( sal_Bool = sal_True ) const;
     228             :     inline const SvxOverlineItem        &GetOverline( sal_Bool = sal_True ) const;
     229             :     inline const SvxCrossedOutItem      &GetCrossedOut( sal_Bool = sal_True ) const;
     230             :     inline const SvxFontHeightItem        &GetSize( sal_Bool = sal_True ) const;
     231             :     inline const SvxPropSizeItem        &GetPropSize( sal_Bool = sal_True ) const;
     232             :     inline const SvxFontItem            &GetFont( sal_Bool = sal_True ) const;
     233             :     inline const SvxColorItem           &GetColor( sal_Bool = sal_True ) const;
     234             :     inline const SvxCharSetColorItem    &GetCharSetColor( sal_Bool = sal_True ) const;
     235             :     inline const SvxLanguageItem        &GetLanguage( sal_Bool = sal_True ) const;
     236             :     inline const SvxEscapementItem      &GetEscapement( sal_Bool = sal_True ) const;
     237             :     inline const SvxCaseMapItem         &GetCaseMap( sal_Bool = sal_True ) const;
     238             :     inline const SvxNoHyphenItem      &GetNoHyphenHere( sal_Bool = sal_True ) const;
     239             :     inline const SvxBlinkItem         &GetBlink( sal_Bool = sal_True ) const;
     240             :     inline const SvxBrushItem         &GetChrBackground( sal_Bool = sal_True ) const;
     241             :     inline const SvxBrushItem         &GetChrHighlight( sal_Bool = sal_True ) const;
     242             :     inline const SvxFontItem          &GetCJKFont( sal_Bool = sal_True ) const;
     243             :     inline const SvxFontHeightItem    &GetCJKSize( sal_Bool = sal_True ) const;
     244             :     inline const SvxLanguageItem      &GetCJKLanguage( sal_Bool = sal_True ) const;
     245             :     inline const SvxPostureItem       &GetCJKPosture( sal_Bool = sal_True ) const;
     246             :     inline const SvxWeightItem        &GetCJKWeight( sal_Bool = sal_True ) const;
     247             :     inline const SvxFontItem          &GetCTLFont( sal_Bool = sal_True ) const;
     248             :     inline const SvxFontHeightItem    &GetCTLSize( sal_Bool = sal_True ) const;
     249             :     inline const SvxLanguageItem      &GetCTLLanguage( sal_Bool = sal_True ) const;
     250             :     inline const SvxPostureItem       &GetCTLPosture( sal_Bool = sal_True ) const;
     251             :     inline const SvxWeightItem        &GetCTLWeight( sal_Bool = sal_True ) const;
     252             :     inline const SfxBoolItem              &GetWritingDirection( sal_Bool = sal_True ) const;
     253             :     inline const SvxEmphasisMarkItem  &GetEmphasisMark( sal_Bool = sal_True ) const;
     254             :     inline const SvxTwoLinesItem      &Get2Lines( sal_Bool = sal_True ) const;
     255             :     inline const SvxCharScaleWidthItem    &GetCharScaleW( sal_Bool = sal_True ) const;
     256             :     inline const SvxCharRotateItem        &GetCharRotate( sal_Bool = sal_True ) const;
     257             :     inline const SvxCharReliefItem        &GetCharRelief( sal_Bool = sal_True ) const;
     258             :     inline const SvxCharHiddenItem      &GetCharHidden( sal_Bool = sal_True ) const;
     259             :     inline const SvxBoxItem      &GetCharBorder( sal_Bool = sal_True ) const;
     260             :     inline const SvxShadowItem      &GetCharShadow( sal_Bool = sal_True ) const;
     261             : 
     262             :     // Frame attributes. Implementation in frmatr.hxx.
     263             :     inline const SwFmtFillOrder       &GetFillOrder( sal_Bool = sal_True ) const;
     264             :     inline const SwFmtFrmSize             &GetFrmSize( sal_Bool = sal_True ) const;
     265             :     inline const SvxPaperBinItem      &GetPaperBin( sal_Bool = sal_True ) const;
     266             :     inline const SvxLRSpaceItem           &GetLRSpace( sal_Bool = sal_True ) const;
     267             :     inline const SvxULSpaceItem           &GetULSpace( sal_Bool = sal_True ) const;
     268             :     inline const SwFmtCntnt           &GetCntnt( sal_Bool = sal_True ) const;
     269             :     inline const SwFmtHeader          &GetHeader( sal_Bool = sal_True ) const;
     270             :     inline const SwFmtFooter          &GetFooter( sal_Bool = sal_True ) const;
     271             :     inline const SvxPrintItem             &GetPrint( sal_Bool = sal_True ) const;
     272             :     inline const SvxOpaqueItem            &GetOpaque( sal_Bool = sal_True ) const;
     273             :     inline const SvxProtectItem           &GetProtect( sal_Bool = sal_True ) const;
     274             :     inline const SwFmtSurround            &GetSurround( sal_Bool = sal_True ) const;
     275             :     inline const SwFmtVertOrient      &GetVertOrient( sal_Bool = sal_True ) const;
     276             :     inline const SwFmtHoriOrient      &GetHoriOrient( sal_Bool = sal_True ) const;
     277             :     inline const SwFmtAnchor          &GetAnchor( sal_Bool = sal_True ) const;
     278             :     inline const SvxBoxItem               &GetBox( sal_Bool = sal_True ) const;
     279             :     inline const SvxFmtKeepItem         &GetKeep( sal_Bool = sal_True ) const;
     280             :     inline const SvxBrushItem           &GetBackground( sal_Bool = sal_True ) const;
     281             :     inline const SvxShadowItem            &GetShadow( sal_Bool = sal_True ) const;
     282             :     inline const SwFmtPageDesc            &GetPageDesc( sal_Bool = sal_True ) const;
     283             :     inline const SvxFmtBreakItem      &GetBreak( sal_Bool = sal_True ) const;
     284             :     inline const SwFmtCol                 &GetCol( sal_Bool = sal_True ) const;
     285             :     inline const SvxMacroItem             &GetMacro( sal_Bool = sal_True ) const;
     286             :     inline const SwFmtURL             &GetURL( sal_Bool = sal_True ) const;
     287             :     inline const SwFmtEditInReadonly  &GetEditInReadonly( sal_Bool = sal_True ) const;
     288             :     inline const SwFmtLayoutSplit     &GetLayoutSplit( sal_Bool = sal_True ) const;
     289             :     inline const SwFmtRowSplit          &GetRowSplit( sal_Bool = sal_True ) const;
     290             :     inline const SwFmtChain             &GetChain( sal_Bool = sal_True ) const;
     291             :     inline const SwFmtLineNumber      &GetLineNumber( sal_Bool = sal_True ) const;
     292             :     inline const SwFmtFtnAtTxtEnd     &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
     293             :     inline const SwFmtEndAtTxtEnd     &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
     294             :     inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
     295             :     inline const SvxFrameDirectionItem    &GetFrmDir( sal_Bool = sal_True ) const;
     296             :     inline const SwTextGridItem         &GetTextGrid( sal_Bool = sal_True ) const;
     297             :     inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
     298             :     inline const SwFmtFollowTextFlow    &GetFollowTextFlow(sal_Bool = sal_True) const;
     299             :     inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
     300             :     inline const SdrTextVertAdjustItem& GetTextVertAdjust(sal_Bool = sal_True) const;
     301             : 
     302             :     // Graphic attributes   - implementation in grfatr.hxx
     303             :     inline const SwMirrorGrf            &GetMirrorGrf( sal_Bool = sal_True ) const;
     304             :     inline const SwCropGrf            &GetCropGrf( sal_Bool = sal_True ) const;
     305             :     inline const SwRotationGrf            &GetRotationGrf(sal_Bool = sal_True ) const;
     306             :     inline const SwLuminanceGrf       &GetLuminanceGrf(sal_Bool = sal_True ) const;
     307             :     inline const SwContrastGrf            &GetContrastGrf(sal_Bool = sal_True ) const;
     308             :     inline const SwChannelRGrf            &GetChannelRGrf(sal_Bool = sal_True ) const;
     309             :     inline const SwChannelGGrf            &GetChannelGGrf(sal_Bool = sal_True ) const;
     310             :     inline const SwChannelBGrf            &GetChannelBGrf(sal_Bool = sal_True ) const;
     311             :     inline const SwGammaGrf           &GetGammaGrf(sal_Bool = sal_True ) const;
     312             :     inline const SwInvertGrf          &GetInvertGrf(sal_Bool = sal_True ) const;
     313             :     inline const SwTransparencyGrf        &GetTransparencyGrf(sal_Bool = sal_True ) const;
     314             :     inline const SwDrawModeGrf            &GetDrawModeGrf(sal_Bool = sal_True ) const;
     315             : 
     316             :     // Paragraph attributes - implementation in paratr.hxx
     317             :     inline const SvxLineSpacingItem       &GetLineSpacing( sal_Bool = sal_True ) const;
     318             :     inline const SvxAdjustItem            &GetAdjust( sal_Bool = sal_True ) const;
     319             :     inline const SvxFmtSplitItem      &GetSplit( sal_Bool = sal_True ) const;
     320             :     inline const SwRegisterItem           &GetRegister( sal_Bool = sal_True ) const;
     321             :     inline const SwNumRuleItem            &GetNumRule( sal_Bool = sal_True ) const;
     322             :     inline const SvxWidowsItem            &GetWidows( sal_Bool = sal_True ) const;
     323             :     inline const SvxOrphansItem           &GetOrphans( sal_Bool = sal_True ) const;
     324             :     inline const SvxTabStopItem           &GetTabStops( sal_Bool = sal_True ) const;
     325             :     inline const SvxHyphenZoneItem        &GetHyphenZone( sal_Bool = sal_True ) const;
     326             :     inline const SwFmtDrop                &GetDrop( sal_Bool = sal_True ) const;
     327             :     inline const SvxScriptSpaceItem       &GetScriptSpace(sal_Bool = sal_True) const;
     328             :     inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
     329             :     inline const SvxForbiddenRuleItem     &GetForbiddenRule(sal_Bool = sal_True) const;
     330             :     inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
     331             :     inline const SvxParaGridItem        &GetParaGrid(sal_Bool = sal_True) const;
     332             :     inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
     333             : 
     334             :     // Tablebox attributes  - implementation in cellatr.hxx
     335             :     inline  const SwTblBoxNumFormat       &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
     336             :     inline  const SwTblBoxFormula     &GetTblBoxFormula( sal_Bool = sal_True ) const;
     337             :     inline  const SwTblBoxValue           &GetTblBoxValue( sal_Bool = sal_True ) const;
     338             : 
     339     1094516 :     DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet)
     340             : };
     341             : 
     342             : //Helper for filters to find true lineheight of a font
     343             : SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
     344             :                           const SwAttrSet &rSet,
     345             :                           const OutputDevice &rOut, sal_Int16 nScript);
     346             : #endif
     347             : 
     348             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10