xref: /trunk/main/sw/inc/tgrditem.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SW_TGRDITEM_HXX
24 #define SW_TGRDITEM_HXX
25 
26 #include <tools/color.hxx>
27 #include <svl/poolitem.hxx>
28 #include "swdllapi.h"
29 #include <hintids.hxx>
30 #include <format.hxx>
31 
32 class IntlWrapper;
33 
34 enum SwTextGrid { GRID_NONE, GRID_LINES_ONLY, GRID_LINES_CHARS };
35 
36 class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem
37 {
38 	Color aColor;
39     sal_uInt16 nLines;
40     sal_uInt16 nBaseHeight, nRubyHeight;
41 	SwTextGrid eGridType;
42 	sal_Bool bRubyTextBelow;
43 	sal_Bool bPrintGrid;
44 	sal_Bool bDisplayGrid;
45 
46 	//for textgrid enhancement
47     sal_uInt16 nBaseWidth;
48     sal_Bool bSnapToChars;
49     sal_Bool bSquaredMode;
50 public:
51 	SwTextGridItem();
52 	virtual ~SwTextGridItem();
53 
54 	// "pure virtual Methoden" vom SfxPoolItem
55 	virtual int             operator==( const SfxPoolItem& ) const;
56 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
57 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
58 									SfxMapUnit eCoreMetric,
59 									SfxMapUnit ePresMetric,
60 									String &rText,
61                                     const IntlWrapper*    pIntl = 0 ) const;
62 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
63 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
64 
65     SwTextGridItem&  operator=( const SwTextGridItem& );
66 
67     const Color& GetColor() const { return aColor; }
68 	void SetColor( const Color& rCol ) 	{ aColor = rCol; }
69 
70     sal_uInt16 GetLines() const { return nLines; }
71     void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
72 
73     sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
74     void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
75 
76     sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
77     void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
78 
79     SwTextGrid GetGridType() const { return eGridType; }
80     void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
81 
82     sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
83     sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
84     void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
85 
86     sal_Bool IsPrintGrid() const { return bPrintGrid; }
87     sal_Bool GetPrintGrid() const { return bPrintGrid; }
88     void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
89 
90     sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
91     sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
92     void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
93 
94     //for textgrid enhancement
95     sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
96     void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
97 
98     sal_Bool IsSnapToChars() const { return bSnapToChars; }
99     sal_Bool GetSnapToChars() const { return bSnapToChars; }
100     void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
101 
102     sal_Bool IsSquaredMode() const { return bSquaredMode; }
103     sal_Bool GetSquaredMode() const { return bSquaredMode; }
104     void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; }
105 	void SwitchPaperMode(sal_Bool bNew );
106 
107 	void Init();
108 };
109 
110 inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
111     {   return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
112 inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
113     {   return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
114 
115 #endif
116 
117