xref: /trunk/main/sw/inc/tgrditem.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef SW_TGRDITEM_HXX
24cdf0e10cSrcweir #define SW_TGRDITEM_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <tools/color.hxx>
27cdf0e10cSrcweir #include <svl/poolitem.hxx>
28cdf0e10cSrcweir #include "swdllapi.h"
29cdf0e10cSrcweir #include <hintids.hxx>
30cdf0e10cSrcweir #include <format.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class IntlWrapper;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir enum SwTextGrid { GRID_NONE, GRID_LINES_ONLY, GRID_LINES_CHARS };
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     Color aColor;
39cdf0e10cSrcweir     sal_uInt16 nLines;
40cdf0e10cSrcweir     sal_uInt16 nBaseHeight, nRubyHeight;
41cdf0e10cSrcweir     SwTextGrid eGridType;
42cdf0e10cSrcweir     sal_Bool bRubyTextBelow;
43cdf0e10cSrcweir     sal_Bool bPrintGrid;
44cdf0e10cSrcweir     sal_Bool bDisplayGrid;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     //for textgrid enhancement
47cdf0e10cSrcweir     sal_uInt16 nBaseWidth;
48cdf0e10cSrcweir     sal_Bool bSnapToChars;
49cdf0e10cSrcweir     sal_Bool bSquaredMode;
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir     SwTextGridItem();
52cdf0e10cSrcweir     virtual ~SwTextGridItem();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     // "pure virtual Methoden" vom SfxPoolItem
55cdf0e10cSrcweir     virtual int             operator==( const SfxPoolItem& ) const;
56cdf0e10cSrcweir     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
57cdf0e10cSrcweir     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
58cdf0e10cSrcweir                                     SfxMapUnit eCoreMetric,
59cdf0e10cSrcweir                                     SfxMapUnit ePresMetric,
60cdf0e10cSrcweir                                     String &rText,
61cdf0e10cSrcweir                                     const IntlWrapper*    pIntl = 0 ) const;
62cdf0e10cSrcweir     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
63cdf0e10cSrcweir     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     SwTextGridItem&  operator=( const SwTextGridItem& );
66cdf0e10cSrcweir 
GetColor() const67cdf0e10cSrcweir     const Color& GetColor() const { return aColor; }
SetColor(const Color & rCol)68cdf0e10cSrcweir     void SetColor( const Color& rCol )  { aColor = rCol; }
69cdf0e10cSrcweir 
GetLines() const70cdf0e10cSrcweir     sal_uInt16 GetLines() const { return nLines; }
SetLines(sal_uInt16 nNew)71cdf0e10cSrcweir     void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
72cdf0e10cSrcweir 
GetBaseHeight() const73cdf0e10cSrcweir     sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
SetBaseHeight(sal_uInt16 nNew)74cdf0e10cSrcweir     void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
75cdf0e10cSrcweir 
GetRubyHeight() const76cdf0e10cSrcweir     sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
SetRubyHeight(sal_uInt16 nNew)77cdf0e10cSrcweir     void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
78cdf0e10cSrcweir 
GetGridType() const79cdf0e10cSrcweir     SwTextGrid GetGridType() const { return eGridType; }
SetGridType(SwTextGrid eNew)80cdf0e10cSrcweir     void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
81cdf0e10cSrcweir 
IsRubyTextBelow() const82cdf0e10cSrcweir     sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
GetRubyTextBelow() const83cdf0e10cSrcweir     sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
SetRubyTextBelow(sal_Bool bNew)84cdf0e10cSrcweir     void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
85cdf0e10cSrcweir 
IsPrintGrid() const86cdf0e10cSrcweir     sal_Bool IsPrintGrid() const { return bPrintGrid; }
GetPrintGrid() const87cdf0e10cSrcweir     sal_Bool GetPrintGrid() const { return bPrintGrid; }
SetPrintGrid(sal_Bool bNew)88cdf0e10cSrcweir     void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
89cdf0e10cSrcweir 
IsDisplayGrid() const90cdf0e10cSrcweir     sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
GetDisplayGrid() const91cdf0e10cSrcweir     sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
SetDisplayGrid(sal_Bool bNew)92cdf0e10cSrcweir     void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     //for textgrid enhancement
GetBaseWidth() const95cdf0e10cSrcweir     sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
SetBaseWidth(sal_uInt16 nNew)96*4cd218abSOliver-Rainer Wittmann     void SetBaseWidth( sal_uInt16 nNew )
97*4cd218abSOliver-Rainer Wittmann     {
98*4cd218abSOliver-Rainer Wittmann         // only accept positive values
99*4cd218abSOliver-Rainer Wittmann         if ( nBaseWidth > 0 )
100*4cd218abSOliver-Rainer Wittmann         {
101*4cd218abSOliver-Rainer Wittmann             nBaseWidth = nNew;
102*4cd218abSOliver-Rainer Wittmann         }
103*4cd218abSOliver-Rainer Wittmann     }
104cdf0e10cSrcweir 
IsSnapToChars() const105cdf0e10cSrcweir     sal_Bool IsSnapToChars() const { return bSnapToChars; }
GetSnapToChars() const106cdf0e10cSrcweir     sal_Bool GetSnapToChars() const { return bSnapToChars; }
SetSnapToChars(sal_Bool bNew)107cdf0e10cSrcweir     void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
108cdf0e10cSrcweir 
IsSquaredMode() const109cdf0e10cSrcweir     sal_Bool IsSquaredMode() const { return bSquaredMode; }
GetSquaredMode() const110cdf0e10cSrcweir     sal_Bool GetSquaredMode() const { return bSquaredMode; }
SetSquaredMode(sal_Bool bNew)111cdf0e10cSrcweir     void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; }
112cdf0e10cSrcweir     void SwitchPaperMode(sal_Bool bNew );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     void Init();
115cdf0e10cSrcweir };
116cdf0e10cSrcweir 
GetTextGrid(sal_Bool bInP) const117cdf0e10cSrcweir inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
118cdf0e10cSrcweir     {   return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
GetTextGrid(sal_Bool bInP) const119cdf0e10cSrcweir inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
120cdf0e10cSrcweir     {   return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir #endif
123