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 #pragma once
20 
21 #include "porglue.hxx"
22 
23 class SwTabPortion : public SwFixPortion
24 {
25  const sal_uInt16 m_nTabPos;
27  const bool m_bAutoTabStop;
28 
29  // Format() branches either into PreFormat() or PostFormat()
30  bool PreFormat( SwTextFormatInfo &rInf );
31 public:
32  SwTabPortion( const sal_uInt16 nTabPos, const sal_Unicode cFill, const bool bAutoTab = true );
33  virtual void Paint( const SwTextPaintInfo &rInf ) const override;
34  virtual bool Format( SwTextFormatInfo &rInf ) override;
35  virtual void FormatEOL( SwTextFormatInfo &rInf ) override;
36  bool PostFormat( SwTextFormatInfo &rInf );
37  bool IsFilled() const { return 0 != m_cFill; }
38  sal_uInt16 GetTabPos() const { return m_nTabPos; }
39 
40  // Accessibility: pass information about this portion to the PortionHandler
41  virtual void HandlePortion( SwPortionHandler& rPH ) const override;
42 };
43 
45 {
46 public:
47  SwTabLeftPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar, bool bAutoTab )
48  : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
50 };
51 
53 {
54 public:
55  SwTabRightPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar )
56  : SwTabPortion( nTabPosVal, cFillChar )
58 };
59 
61 {
62 public:
63  SwTabCenterPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar )
64  : SwTabPortion( nTabPosVal, cFillChar )
66 };
67 
69 {
71 
72  /*
73  * During text formatting, we already store the width of the portions
74  * following the tab stop up to the decimal position. This value is
75  * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#.
76  */
78 
79 public:
80  SwTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
81  const sal_Unicode cFillChar )
82  : SwTabPortion( nTabPosVal, cFillChar ),
83  mcTab(cTab),
84  mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
86 
87  sal_Unicode GetTabDecimal() const { return mcTab; }
88 
89  void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
90  {
91  mnWidthOfPortionsUpTpDecimalPosition = nNew;
92  }
94  {
96  }
97 };
98 
100 {
101 public:
102  SwAutoTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
103  const sal_Unicode cFillChar )
104  : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar )
105  {
107  }
108  virtual void Paint( const SwTextPaintInfo &rInf ) const override;
109 };
110 
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Unicode GetTabDecimal() const
Definition: portab.hxx:87
SwTabDecimalPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cTab, const sal_Unicode cFillChar)
Definition: portab.hxx:80
bool PreFormat(SwTextFormatInfo &rInf)
Definition: txttab.cxx:321
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:55
virtual void Paint(const SwTextPaintInfo &rInf) const override
Ex: LineIter::DrawTab()
Definition: txttab.cxx:522
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:74
bool PostFormat(SwTextFormatInfo &rInf)
Definition: txttab.cxx:442
const sal_Unicode mcTab
Definition: portab.hxx:70
bool IsFilled() const
Definition: portab.hxx:37
sal_uInt16 sal_Unicode
sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
Definition: portab.hxx:93
SwTabCenterPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar)
Definition: portab.hxx:63
const bool m_bAutoTabStop
Definition: portab.hxx:27
SwTabPortion(const sal_uInt16 nTabPos, const sal_Unicode cFill, const bool bAutoTab=true)
The base class is initialized without setting anything.
Definition: txttab.cxx:297
SwAutoTabDecimalPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cTab, const sal_Unicode cFillChar)
Definition: portab.hxx:102
void SetWidthOfPortionsUpToDecimalPosition(sal_uInt16 nNew)
Definition: portab.hxx:89
const sal_Unicode m_cFill
Definition: portab.hxx:26
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:93
sal_uInt16 GetTabPos() const
Definition: portab.hxx:38
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:305
virtual void Paint(const SwTextPaintInfo &rInf) const override
Ex: LineIter::DrawTab()
Definition: txttab.cxx:601
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition
Definition: portab.hxx:77
const sal_uInt16 m_nTabPos
Definition: portab.hxx:25
SwTabLeftPortion(const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar, bool bAutoTab)
Definition: portab.hxx:47
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:315
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txttab.cxx:605