LibreOffice Module sw (master)  1
portab.hxx
Go to the documentation of this file.
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_SOURCE_CORE_TEXT_PORTAB_HXX
20 #define INCLUDED_SW_SOURCE_CORE_TEXT_PORTAB_HXX
21 
22 #include "porglue.hxx"
23 
24 class SwTabPortion : public SwFixPortion
25 {
26  const sal_uInt16 nTabPos;
28  const bool bAutoTabStop;
29 
30  // Format() branches either into PreFormat() or PostFormat()
31  bool PreFormat( SwTextFormatInfo &rInf );
32 public:
33  SwTabPortion( const sal_uInt16 nTabPos, const sal_Unicode cFill, const bool bAutoTab = true );
34  virtual void Paint( const SwTextPaintInfo &rInf ) const override;
35  virtual bool Format( SwTextFormatInfo &rInf ) override;
36  virtual void FormatEOL( SwTextFormatInfo &rInf ) override;
37  bool PostFormat( SwTextFormatInfo &rInf );
38  bool IsFilled() const { return 0 != cFill; }
39  sal_uInt16 GetTabPos() const { return nTabPos; }
40 
41  // Accessibility: pass information about this portion to the PortionHandler
42  virtual void HandlePortion( SwPortionHandler& rPH ) const override;
43 };
44 
46 {
47 public:
48  SwTabLeftPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar, bool bAutoTab )
49  : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
51 };
52 
54 {
55 public:
56  SwTabRightPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar )
57  : SwTabPortion( nTabPosVal, cFillChar )
59 };
60 
62 {
63 public:
64  SwTabCenterPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar )
65  : SwTabPortion( nTabPosVal, cFillChar )
67 };
68 
70 {
72 
73  /*
74  * During text formatting, we already store the width of the portions
75  * following the tab stop up to the decimal position. This value is
76  * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#.
77  */
79 
80 public:
81  SwTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
82  const sal_Unicode cFillChar )
83  : SwTabPortion( nTabPosVal, cFillChar ),
84  mcTab(cTab),
85  mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
87 
88  sal_Unicode GetTabDecimal() const { return mcTab; }
89 
90  void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
91  {
92  mnWidthOfPortionsUpTpDecimalPosition = nNew;
93  }
95  {
97  }
98 };
99 
101 {
102 public:
103  SwAutoTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
104  const sal_Unicode cFillChar )
105  : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar )
106  {
108  }
109  virtual void Paint( const SwTextPaintInfo &rInf ) const override;
110 };
111 
112 #endif
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Unicode GetTabDecimal() const
Definition: portab.hxx:88
SwTabDecimalPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cTab, const sal_Unicode cFillChar)
Definition: portab.hxx:81
bool PreFormat(SwTextFormatInfo &rInf)
Definition: txttab.cxx:319
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
SwTabRightPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar)
Definition: portab.hxx:56
virtual void Paint(const SwTextPaintInfo &rInf) const override
Ex: LineIter::DrawTab()
Definition: txttab.cxx:515
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:74
bool PostFormat(SwTextFormatInfo &rInf)
Definition: txttab.cxx:440
const sal_uInt16 nTabPos
Definition: portab.hxx:26
const sal_Unicode mcTab
Definition: portab.hxx:71
bool IsFilled() const
Definition: portab.hxx:38
sal_uInt16 sal_Unicode
sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
Definition: portab.hxx:94
SwTabCenterPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar)
Definition: portab.hxx:64
const bool bAutoTabStop
Definition: portab.hxx:28
SwTabPortion(const sal_uInt16 nTabPos, const sal_Unicode cFill, const bool bAutoTab=true)
The base class is initialized without setting anything.
Definition: txttab.cxx:295
SwAutoTabDecimalPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cTab, const sal_Unicode cFillChar)
Definition: portab.hxx:103
void SetWidthOfPortionsUpToDecimalPosition(sal_uInt16 nNew)
Definition: portab.hxx:90
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:93
sal_uInt16 GetTabPos() const
Definition: portab.hxx:39
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:303
virtual void Paint(const SwTextPaintInfo &rInf) const override
Ex: LineIter::DrawTab()
Definition: txttab.cxx:594
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition
Definition: portab.hxx:78
const sal_Unicode cFill
Definition: portab.hxx:27
SwTabLeftPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar, bool bAutoTab)
Definition: portab.hxx:48
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
virtual void FormatEOL(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:313
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txttab.cxx:598