Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef SW_TGRDITEM_HXX
20 : #define SW_TGRDITEM_HXX
21 :
22 : #include <tools/color.hxx>
23 : #include <svl/poolitem.hxx>
24 : #include "swdllapi.h"
25 : #include <hintids.hxx>
26 : #include <format.hxx>
27 :
28 : class IntlWrapper;
29 :
30 : enum SwTextGrid { GRID_NONE, GRID_LINES_ONLY, GRID_LINES_CHARS };
31 :
32 7271 : class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem
33 : {
34 : Color aColor;
35 : sal_uInt16 nLines;
36 : sal_uInt16 nBaseHeight, nRubyHeight;
37 : SwTextGrid eGridType;
38 : sal_Bool bRubyTextBelow;
39 : sal_Bool bPrintGrid;
40 : sal_Bool bDisplayGrid;
41 :
42 : //for textgrid enhancement
43 : sal_uInt16 nBaseWidth;
44 : sal_Bool bSnapToChars;
45 : sal_Bool bSquaredMode;
46 : public:
47 : SwTextGridItem();
48 : virtual ~SwTextGridItem();
49 :
50 : // "pure virtual methods" of SfxPoolItem
51 : virtual int operator==( const SfxPoolItem& ) const;
52 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
53 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
54 : SfxMapUnit eCoreMetric,
55 : SfxMapUnit ePresMetric,
56 : OUString &rText,
57 : const IntlWrapper* pIntl = 0 ) const;
58 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
59 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
60 :
61 : SwTextGridItem& operator=( const SwTextGridItem& );
62 :
63 3097 : const Color& GetColor() const { return aColor; }
64 15 : void SetColor( const Color& rCol ) { aColor = rCol; }
65 :
66 11014 : sal_uInt16 GetLines() const { return nLines; }
67 437 : void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
68 :
69 6002 : sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
70 437 : void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
71 :
72 4982 : sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
73 438 : void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
74 :
75 12021 : SwTextGrid GetGridType() const { return eGridType; }
76 438 : void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
77 :
78 0 : sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
79 4636 : sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
80 15 : void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
81 :
82 0 : sal_Bool IsPrintGrid() const { return bPrintGrid; }
83 3859 : sal_Bool GetPrintGrid() const { return bPrintGrid; }
84 438 : void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
85 :
86 0 : sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
87 4617 : sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
88 438 : void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
89 :
90 : //for textgrid enhancement
91 3138 : sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
92 62 : void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
93 :
94 0 : sal_Bool IsSnapToChars() const { return bSnapToChars; }
95 3080 : sal_Bool GetSnapToChars() const { return bSnapToChars; }
96 8 : void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
97 :
98 13929 : sal_Bool IsSquaredMode() const { return bSquaredMode; }
99 3080 : sal_Bool GetSquaredMode() const { return bSquaredMode; }
100 814 : void SetSquaredMode( sal_Bool bNew ) { bSquaredMode = bNew; }
101 : void SwitchPaperMode(sal_Bool bNew );
102 :
103 : void Init();
104 : };
105 :
106 : inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
107 : { return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
108 : inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
109 : { return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
110 :
111 : #endif
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|