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 INCLUDED_SW_INC_TGRDITEM_HXX
20 : #define INCLUDED_SW_INC_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 0 : class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem
33 : {
34 : private:
35 : Color m_aColor;
36 : sal_uInt16 m_nLines;
37 : sal_uInt16 m_nBaseHeight;
38 : sal_uInt16 m_nRubyHeight;
39 : SwTextGrid m_eGridType;
40 : sal_Bool m_bRubyTextBelow;
41 : sal_Bool m_bPrintGrid;
42 : sal_Bool m_bDisplayGrid;
43 :
44 : //for textgrid enhancement
45 : sal_uInt16 m_nBaseWidth;
46 : sal_Bool m_bSnapToChars;
47 : sal_Bool m_bSquaredMode;
48 :
49 : public:
50 : SwTextGridItem();
51 : virtual ~SwTextGridItem();
52 :
53 : // "pure virtual methods" of SfxPoolItem
54 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
55 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
56 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
57 : SfxMapUnit eCoreMetric,
58 : SfxMapUnit ePresMetric,
59 : OUString &rText,
60 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
61 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
62 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
63 :
64 : SwTextGridItem& operator=( const SwTextGridItem& );
65 :
66 0 : const Color& GetColor() const { return m_aColor; }
67 0 : void SetColor( const Color& rCol ) { m_aColor = rCol; }
68 :
69 0 : sal_uInt16 GetLines() const { return m_nLines; }
70 0 : void SetLines( sal_uInt16 nNew ) { m_nLines = nNew; }
71 :
72 0 : sal_uInt16 GetBaseHeight() const { return m_nBaseHeight; }
73 0 : void SetBaseHeight( sal_uInt16 nNew ) { m_nBaseHeight = nNew; }
74 :
75 0 : sal_uInt16 GetRubyHeight() const { return m_nRubyHeight; }
76 0 : void SetRubyHeight( sal_uInt16 nNew ) { m_nRubyHeight = nNew; }
77 :
78 0 : SwTextGrid GetGridType() const { return m_eGridType; }
79 0 : void SetGridType( SwTextGrid eNew ) { m_eGridType = eNew; }
80 :
81 0 : sal_Bool IsRubyTextBelow() const { return m_bRubyTextBelow; }
82 0 : sal_Bool GetRubyTextBelow() const { return m_bRubyTextBelow; }
83 0 : void SetRubyTextBelow( sal_Bool bNew ) { m_bRubyTextBelow = bNew; }
84 :
85 0 : sal_Bool IsPrintGrid() const { return m_bPrintGrid; }
86 0 : sal_Bool GetPrintGrid() const { return m_bPrintGrid; }
87 0 : void SetPrintGrid( sal_Bool bNew ) { m_bPrintGrid = bNew; }
88 :
89 0 : sal_Bool IsDisplayGrid() const { return m_bDisplayGrid; }
90 0 : sal_Bool GetDisplayGrid() const { return m_bDisplayGrid; }
91 0 : void SetDisplayGrid( sal_Bool bNew ) { m_bDisplayGrid = bNew; }
92 :
93 : //for textgrid enhancement
94 0 : sal_uInt16 GetBaseWidth() const { return m_nBaseWidth;}
95 0 : void SetBaseWidth( sal_uInt16 nNew ) { m_nBaseWidth = nNew; }
96 :
97 0 : sal_Bool IsSnapToChars() const { return m_bSnapToChars; }
98 0 : sal_Bool GetSnapToChars() const { return m_bSnapToChars; }
99 0 : void SetSnapToChars( sal_Bool bNew ) { m_bSnapToChars = bNew; }
100 :
101 0 : sal_Bool IsSquaredMode() const { return m_bSquaredMode; }
102 0 : sal_Bool GetSquaredMode() const { return m_bSquaredMode; }
103 0 : void SetSquaredMode( sal_Bool bNew ) { m_bSquaredMode = bNew; }
104 : void SwitchPaperMode(sal_Bool bNew );
105 :
106 : void Init();
107 : };
108 :
109 : inline const SwTextGridItem &SwAttrSet::GetTextGrid(sal_Bool bInP) const
110 : { return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); }
111 0 : inline const SwTextGridItem &SwFmt::GetTextGrid(sal_Bool bInP) const
112 0 : { return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); }
113 :
114 : #endif
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|