xref: /trunk/main/sw/inc/tgrditem.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew 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 
67cdf0e10cSrcweir     const Color& GetColor() const { return aColor; }
68cdf0e10cSrcweir     void SetColor( const Color& rCol )  { aColor = rCol; }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     sal_uInt16 GetLines() const { return nLines; }
71cdf0e10cSrcweir     void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
74cdf0e10cSrcweir     void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
77cdf0e10cSrcweir     void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     SwTextGrid GetGridType() const { return eGridType; }
80cdf0e10cSrcweir     void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
83cdf0e10cSrcweir     sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
84cdf0e10cSrcweir     void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     sal_Bool IsPrintGrid() const { return bPrintGrid; }
87cdf0e10cSrcweir     sal_Bool GetPrintGrid() const { return bPrintGrid; }
88cdf0e10cSrcweir     void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
91cdf0e10cSrcweir     sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
92cdf0e10cSrcweir     void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     //for textgrid enhancement
95cdf0e10cSrcweir     sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
96cdf0e10cSrcweir     void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     sal_Bool IsSnapToChars() const { return bSnapToChars; }
99cdf0e10cSrcweir     sal_Bool GetSnapToChars() const { return bSnapToChars; }
100cdf0e10cSrcweir     void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     sal_Bool IsSquaredMode() const { return bSquaredMode; }
103cdf0e10cSrcweir     sal_Bool GetSquaredMode() const { return bSquaredMode; }
104cdf0e10cSrcweir     void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; }
105cdf0e10cSrcweir     void SwitchPaperMode(sal_Bool bNew );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     void Init();
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
110cdf0e10cSrcweir inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
111cdf0e10cSrcweir     {   return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
112cdf0e10cSrcweir inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
113cdf0e10cSrcweir     {   return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir #endif
116cdf0e10cSrcweir 
117