/src/libreoffice/sw/inc/tgrditem.hxx
Line | Count | Source |
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 | | enum class SwTextGrid { NONE, LinesOnly, LinesAndChars }; |
29 | | |
30 | | class SW_DLLPUBLIC SwTextGridItem final : public SfxPoolItem |
31 | | { |
32 | | private: |
33 | | Color m_aColor; |
34 | | sal_Int16 m_nLines; |
35 | | sal_uInt16 m_nBaseHeight; |
36 | | sal_uInt16 m_nRubyHeight; |
37 | | SwTextGrid m_eGridType; |
38 | | bool m_bRubyTextBelow; |
39 | | bool m_bPrintGrid; |
40 | | bool m_bDisplayGrid; |
41 | | |
42 | | //for textgrid enhancement |
43 | | sal_uInt16 m_nBaseWidth; |
44 | | bool m_bSnapToChars; |
45 | | bool m_bSquaredMode; |
46 | | |
47 | | public: |
48 | | DECLARE_ITEM_TYPE_FUNCTION(SwTextGridItem) |
49 | | SwTextGridItem(); |
50 | | virtual ~SwTextGridItem() override; |
51 | | |
52 | 444k | SwTextGridItem(SwTextGridItem const &) = default; |
53 | | SwTextGridItem(SwTextGridItem &&) = default; |
54 | | SwTextGridItem & operator =(SwTextGridItem const &) = delete; // due to SfxPoolItem |
55 | | SwTextGridItem & operator =(SwTextGridItem &&) = delete; // due to SfxPoolItem |
56 | | |
57 | | // "pure virtual methods" of SfxPoolItem |
58 | | virtual bool operator==( const SfxPoolItem& ) const override; |
59 | | virtual SwTextGridItem* Clone( SfxItemPool* pPool = nullptr ) const override; |
60 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
61 | | MapUnit eCoreMetric, |
62 | | MapUnit ePresMetric, |
63 | | OUString &rText, |
64 | | const IntlWrapper& rIntl ) const override; |
65 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
66 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
67 | | |
68 | 76.7k | const Color& GetColor() const { return m_aColor; } |
69 | 175 | void SetColor( const Color& rCol ) { m_aColor = rCol; } |
70 | | |
71 | 306k | sal_Int16 GetLines() const { return m_nLines; } |
72 | 23.6k | void SetLines( sal_Int16 nNew ) { m_nLines = nNew; } |
73 | | |
74 | 260k | sal_uInt16 GetBaseHeight() const { return m_nBaseHeight; } |
75 | 23.6k | void SetBaseHeight( sal_uInt16 nNew ) { m_nBaseHeight = nNew; } |
76 | | |
77 | 256k | sal_uInt16 GetRubyHeight() const { return m_nRubyHeight; } |
78 | 23.9k | void SetRubyHeight( sal_uInt16 nNew ) { m_nRubyHeight = nNew; } |
79 | | |
80 | 392k | SwTextGrid GetGridType() const { return m_eGridType; } |
81 | 24.0k | void SetGridType( SwTextGrid eNew ) { m_eGridType = eNew; } |
82 | | |
83 | 0 | bool IsRubyTextBelow() const { return m_bRubyTextBelow; } |
84 | 256k | bool GetRubyTextBelow() const { return m_bRubyTextBelow; } |
85 | 175 | void SetRubyTextBelow( bool bNew ) { m_bRubyTextBelow = bNew; } |
86 | | |
87 | 0 | bool IsPrintGrid() const { return m_bPrintGrid; } |
88 | 252k | bool GetPrintGrid() const { return m_bPrintGrid; } |
89 | 43.0k | void SetPrintGrid( bool bNew ) { m_bPrintGrid = bNew; } |
90 | | |
91 | 0 | bool IsDisplayGrid() const { return m_bDisplayGrid; } |
92 | 256k | bool GetDisplayGrid() const { return m_bDisplayGrid; } |
93 | 43.0k | void SetDisplayGrid( bool bNew ) { m_bDisplayGrid = bNew; } |
94 | | |
95 | | //for textgrid enhancement |
96 | 76.7k | sal_uInt16 GetBaseWidth() const { return m_nBaseWidth;} |
97 | 23.9k | void SetBaseWidth( sal_uInt16 nNew ) { m_nBaseWidth = nNew; } |
98 | | |
99 | 0 | bool IsSnapToChars() const { return m_bSnapToChars; } |
100 | 72.1k | bool GetSnapToChars() const { return m_bSnapToChars; } |
101 | 218 | void SetSnapToChars( bool bNew ) { m_bSnapToChars = bNew; } |
102 | | |
103 | 320k | bool IsSquaredMode() const { return m_bSquaredMode; } |
104 | 72.1k | bool GetSquaredMode() const { return m_bSquaredMode; } |
105 | 99.2k | void SetSquaredMode( bool bNew ) { m_bSquaredMode = bNew; } |
106 | | void SwitchPaperMode(bool bNew ); |
107 | | |
108 | | void Init(); |
109 | | }; |
110 | | |
111 | | inline const SwTextGridItem &SwFormat::GetTextGrid(bool bInP) const |
112 | 85.7k | { return m_aSet.Get( RES_TEXTGRID, bInP ); } |
113 | | |
114 | | #endif |
115 | | |
116 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |