1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef SW_TGRDITEM_HXX 28 #define SW_TGRDITEM_HXX 29 30 #include <tools/color.hxx> 31 #include <svl/poolitem.hxx> 32 #include "swdllapi.h" 33 #include <hintids.hxx> 34 #include <format.hxx> 35 36 class IntlWrapper; 37 38 enum SwTextGrid { GRID_NONE, GRID_LINES_ONLY, GRID_LINES_CHARS }; 39 40 class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem 41 { 42 Color aColor; 43 sal_uInt16 nLines; 44 sal_uInt16 nBaseHeight, nRubyHeight; 45 SwTextGrid eGridType; 46 sal_Bool bRubyTextBelow; 47 sal_Bool bPrintGrid; 48 sal_Bool bDisplayGrid; 49 50 //for textgrid enhancement 51 sal_uInt16 nBaseWidth; 52 sal_Bool bSnapToChars; 53 sal_Bool bSquaredMode; 54 public: 55 SwTextGridItem(); 56 virtual ~SwTextGridItem(); 57 58 // "pure virtual Methoden" vom SfxPoolItem 59 virtual int operator==( const SfxPoolItem& ) const; 60 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; 61 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 62 SfxMapUnit eCoreMetric, 63 SfxMapUnit ePresMetric, 64 String &rText, 65 const IntlWrapper* pIntl = 0 ) const; 66 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 67 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 68 69 SwTextGridItem& operator=( const SwTextGridItem& ); 70 71 const Color& GetColor() const { return aColor; } 72 void SetColor( const Color& rCol ) { aColor = rCol; } 73 74 sal_uInt16 GetLines() const { return nLines; } 75 void SetLines( sal_uInt16 nNew ) { nLines = nNew; } 76 77 sal_uInt16 GetBaseHeight() const { return nBaseHeight; } 78 void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; } 79 80 sal_uInt16 GetRubyHeight() const { return nRubyHeight; } 81 void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; } 82 83 SwTextGrid GetGridType() const { return eGridType; } 84 void SetGridType( SwTextGrid eNew ) { eGridType = eNew; } 85 86 sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; } 87 sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; } 88 void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; } 89 90 sal_Bool IsPrintGrid() const { return bPrintGrid; } 91 sal_Bool GetPrintGrid() const { return bPrintGrid; } 92 void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; } 93 94 sal_Bool IsDisplayGrid() const { return bDisplayGrid; } 95 sal_Bool GetDisplayGrid() const { return bDisplayGrid; } 96 void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; } 97 98 //for textgrid enhancement 99 sal_uInt16 GetBaseWidth() const { return nBaseWidth;} 100 void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; } 101 102 sal_Bool IsSnapToChars() const { return bSnapToChars; } 103 sal_Bool GetSnapToChars() const { return bSnapToChars; } 104 void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; } 105 106 sal_Bool IsSquaredMode() const { return bSquaredMode; } 107 sal_Bool GetSquaredMode() const { return bSquaredMode; } 108 void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; } 109 void SwitchPaperMode(sal_Bool bNew ); 110 111 void Init(); 112 }; 113 114 inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const 115 { return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); } 116 inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const 117 { return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); } 118 119 #endif 120 121