xref: /aoo4110/main/sw/inc/tgrditem.hxx (revision b1cdbd2c)
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 
GetColor() const67     const Color& GetColor() const { return aColor; }
SetColor(const Color & rCol)68 	void SetColor( const Color& rCol ) 	{ aColor = rCol; }
69 
GetLines() const70     sal_uInt16 GetLines() const { return nLines; }
SetLines(sal_uInt16 nNew)71     void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
72 
GetBaseHeight() const73     sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
SetBaseHeight(sal_uInt16 nNew)74     void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
75 
GetRubyHeight() const76     sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
SetRubyHeight(sal_uInt16 nNew)77     void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
78 
GetGridType() const79     SwTextGrid GetGridType() const { return eGridType; }
SetGridType(SwTextGrid eNew)80     void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
81 
IsRubyTextBelow() const82     sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
GetRubyTextBelow() const83     sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
SetRubyTextBelow(sal_Bool bNew)84     void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
85 
IsPrintGrid() const86     sal_Bool IsPrintGrid() const { return bPrintGrid; }
GetPrintGrid() const87     sal_Bool GetPrintGrid() const { return bPrintGrid; }
SetPrintGrid(sal_Bool bNew)88     void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
89 
IsDisplayGrid() const90     sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
GetDisplayGrid() const91     sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
SetDisplayGrid(sal_Bool bNew)92     void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
93 
94     //for textgrid enhancement
GetBaseWidth() const95     sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
SetBaseWidth(sal_uInt16 nNew)96     void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
97 
IsSnapToChars() const98     sal_Bool IsSnapToChars() const { return bSnapToChars; }
GetSnapToChars() const99     sal_Bool GetSnapToChars() const { return bSnapToChars; }
SetSnapToChars(sal_Bool bNew)100     void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
101 
IsSquaredMode() const102     sal_Bool IsSquaredMode() const { return bSquaredMode; }
GetSquaredMode() const103     sal_Bool GetSquaredMode() const { return bSquaredMode; }
SetSquaredMode(sal_Bool bNew)104     void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; }
105 	void SwitchPaperMode(sal_Bool bNew );
106 
107 	void Init();
108 };
109 
GetTextGrid(sal_Bool bInP) const110 inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
111     {   return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
GetTextGrid(sal_Bool bInP) const112 inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
113     {   return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
114 
115 #endif
116 
117