diff options
Diffstat (limited to 'sw/source/core/text/porlin.hxx')
-rw-r--r-- | sw/source/core/text/porlin.hxx | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index 3d2b8dad29e4..d2298bdfb03c 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -18,6 +18,8 @@ */ #pragma once +#include <libxml/xmlwriter.h> + #include "possiz.hxx" #include <txttypes.hxx> #include <TextFrameIndex.hxx> @@ -28,38 +30,24 @@ class SwTextPaintInfo; class SwTextFormatInfo; class SwPortionHandler; -/// Portion groups -/// @see enum PortionType in txttypes.hxx -#define PORGRP_TXT 0x8000 -#define PORGRP_EXP 0x4000 -#define PORGRP_FLD 0x2000 -#define PORGRP_HYPH 0x1000 -#define PORGRP_NUMBER 0x0800 -#define PORGRP_GLUE 0x0400 -#define PORGRP_FIX 0x0200 -#define PORGRP_TAB 0x0100 -// Small special groups -#define PORGRP_FIXMARG 0x0040 -//#define PORGRP_? 0x0020 -#define PORGRP_TABNOTLFT 0x0010 -#define PORGRP_TOXREF 0x0008 - /// Base class for anything that can be part of a line in the Writer layout. /// Typically owned by SwLineLayout. -class SwLinePortion: public SwPosSize +class SAL_DLLPUBLIC_RTTI SwLinePortion: public SwPosSize { protected: // Here we have areas with different attributes SwLinePortion *mpNextPortion; // Count of chars and spaces on the line TextFrameIndex mnLineLength; - sal_uInt16 mnAscent; // Maximum ascender + SwTwips mnAscent; // Maximum ascender + SwTwips mnHangingBaseline; SwLinePortion(); private: PortionType mnWhichPor; // Who's who? bool m_bJoinBorderWithPrev; bool m_bJoinBorderWithNext; + SwTwips m_nExtraBlankWidth = 0; // width of spaces after the break void Truncate_(); @@ -73,13 +61,17 @@ public: TextFrameIndex GetLen() const { return mnLineLength; } void SetLen(TextFrameIndex const nLen) { mnLineLength = nLen; } void SetNextPortion( SwLinePortion *pNew ){ mpNextPortion = pNew; } - sal_uInt16 &GetAscent() { return mnAscent; } - sal_uInt16 GetAscent() const { return mnAscent; } - void SetAscent( const sal_uInt16 nNewAsc ) { mnAscent = nNewAsc; } - void PrtWidth( sal_uInt16 nNewWidth ) { Width( nNewWidth ); } - sal_uInt16 PrtWidth() const { return Width(); } - void AddPrtWidth( const sal_uInt16 nNew ) { Width( Width() + nNew ); } - void SubPrtWidth( const sal_uInt16 nNew ) { Width( Width() - nNew ); } + SwTwips &GetAscent() { return mnAscent; } + SwTwips GetAscent() const { return mnAscent; } + void SetAscent( const SwTwips nNewAsc ) { mnAscent = nNewAsc; } + void PrtWidth( SwTwips nNewWidth ) { Width( nNewWidth ); } + SwTwips PrtWidth() const { return Width(); } + void AddPrtWidth( const SwTwips nNew ) { Width( Width() + nNew ); } + void SubPrtWidth( const SwTwips nNew ) { Width( Width() - nNew ); } + SwTwips ExtraBlankWidth() const { return m_nExtraBlankWidth; } + void ExtraBlankWidth(const SwTwips nNew) { m_nExtraBlankWidth = nNew; } + SwTwips GetHangingBaseline() const { return mnHangingBaseline; } + void SetHangingBaseline( const SwTwips nNewBaseline ) { mnHangingBaseline = nNewBaseline; } // Insert methods virtual SwLinePortion *Insert( SwLinePortion *pPortion ); @@ -152,7 +144,7 @@ public: virtual bool Format( SwTextFormatInfo &rInf ); // Is called for the line's last portion virtual void FormatEOL( SwTextFormatInfo &rInf ); - void Move( SwTextPaintInfo &rInf ); + void Move(SwTextPaintInfo & rInf) const; // For SwTextSlot virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const; @@ -161,7 +153,7 @@ public: virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const; // for text- and multi-portions - virtual tools::Long CalcSpacing( tools::Long nSpaceAdd, const SwTextSizeInfo &rInf ) const; + virtual SwTwips CalcSpacing( tools::Long nSpaceAdd, const SwTextSizeInfo &rInf ) const; // Accessibility: pass information about this portion to the PortionHandler virtual void HandlePortion( SwPortionHandler& rPH ) const; @@ -170,6 +162,11 @@ public: bool GetJoinBorderWithNext() const { return m_bJoinBorderWithNext; } void SetJoinBorderWithPrev( const bool bJoinPrev ) { m_bJoinBorderWithPrev = bJoinPrev; } void SetJoinBorderWithNext( const bool bJoinNext ) { m_bJoinBorderWithNext = bJoinNext; } + + virtual void dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, + TextFrameIndex& rOffset) const; + void dumpAsXmlAttributes(xmlTextWriterPtr writer, std::u16string_view rText, + TextFrameIndex nOffset) const; }; inline SwLinePortion &SwLinePortion::operator=(const SwLinePortion &rPortion) @@ -177,9 +174,11 @@ inline SwLinePortion &SwLinePortion::operator=(const SwLinePortion &rPortion) *static_cast<SwPosSize*>(this) = rPortion; mnLineLength = rPortion.mnLineLength; mnAscent = rPortion.mnAscent; + mnHangingBaseline = rPortion.mnHangingBaseline; mnWhichPor = rPortion.mnWhichPor; m_bJoinBorderWithPrev = rPortion.m_bJoinBorderWithPrev; m_bJoinBorderWithNext = rPortion.m_bJoinBorderWithNext; + m_nExtraBlankWidth = rPortion.m_nExtraBlankWidth; return *this; } @@ -188,9 +187,11 @@ inline SwLinePortion::SwLinePortion(const SwLinePortion &rPortion) : mpNextPortion( nullptr ), mnLineLength( rPortion.mnLineLength ), mnAscent( rPortion.mnAscent ), + mnHangingBaseline( rPortion.mnHangingBaseline ), mnWhichPor( rPortion.mnWhichPor ), m_bJoinBorderWithPrev( rPortion.m_bJoinBorderWithPrev ), - m_bJoinBorderWithNext( rPortion.m_bJoinBorderWithNext ) + m_bJoinBorderWithNext( rPortion.m_bJoinBorderWithNext ), + m_nExtraBlankWidth(rPortion.m_nExtraBlankWidth) { } |