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 2859 : 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 : String &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 607 : const Color& GetColor() const { return aColor; }
64 5 : void SetColor( const Color& rCol ) { aColor = rCol; }
65 :
66 2861 : sal_uInt16 GetLines() const { return nLines; }
67 354 : void SetLines( sal_uInt16 nNew ) { nLines = nNew; }
68 :
69 2088 : sal_uInt16 GetBaseHeight() const { return nBaseHeight; }
70 354 : void SetBaseHeight( sal_uInt16 nNew ) { nBaseHeight = nNew; }
71 :
72 2068 : sal_uInt16 GetRubyHeight() const { return nRubyHeight; }
73 357 : void SetRubyHeight( sal_uInt16 nNew ) { nRubyHeight = nNew; }
74 :
75 3154 : SwTextGrid GetGridType() const { return eGridType; }
76 357 : void SetGridType( SwTextGrid eNew ) { eGridType = eNew; }
77 :
78 0 : sal_Bool IsRubyTextBelow() const { return bRubyTextBelow; }
79 1541 : sal_Bool GetRubyTextBelow() const { return bRubyTextBelow; }
80 5 : void SetRubyTextBelow( sal_Bool bNew ) { bRubyTextBelow = bNew; }
81 :
82 0 : sal_Bool IsPrintGrid() const { return bPrintGrid; }
83 1073 : sal_Bool GetPrintGrid() const { return bPrintGrid; }
84 357 : void SetPrintGrid( sal_Bool bNew ) { bPrintGrid = bNew; }
85 :
86 0 : sal_Bool IsDisplayGrid() const { return bDisplayGrid; }
87 1541 : sal_Bool GetDisplayGrid() const { return bDisplayGrid; }
88 357 : void SetDisplayGrid( sal_Bool bNew ) { bDisplayGrid = bNew; }
89 :
90 : //for textgrid enhancement
91 610 : sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
92 123 : void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
93 :
94 0 : sal_Bool IsSnapToChars() const { return bSnapToChars; }
95 605 : sal_Bool GetSnapToChars() const { return bSnapToChars; }
96 0 : void SetSnapToChars( sal_Bool bNew ) { bSnapToChars = bNew; }
97 :
98 2416 : sal_Bool IsSquaredMode() const { return bSquaredMode; }
99 605 : sal_Bool GetSquaredMode() const { return bSquaredMode; }
100 154 : 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: */
|