LibreOffice Module sw (master) 1
porglue.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
20#pragma once
21
22#include "porlin.hxx"
23
24class SwRect;
25class SwLineLayout;
26
28{
29private:
30 sal_uInt16 m_nFixWidth;
31public:
32 explicit SwGluePortion( const sal_uInt16 nInitFixWidth );
33
34 void Join( SwGluePortion *pVictim );
35
36 inline tools::Long GetPrtGlue() const;
37 sal_uInt16 GetFixWidth() const { return m_nFixWidth; }
38 void SetFixWidth( const sal_uInt16 nNew ) { m_nFixWidth = nNew; }
39 void MoveGlue( SwGluePortion *pTarget, const tools::Long nPrtGlue );
40 inline void MoveAllGlue( SwGluePortion *pTarget );
41 inline void MoveHalfGlue( SwGluePortion *pTarget );
42 inline void AdjFixWidth();
43 virtual void Paint( const SwTextPaintInfo &rInf ) const override;
44 virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override;
45 virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override;
46 virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override;
47
48 void dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, TextFrameIndex& nOffset) const override;
49};
50
52{
53 sal_uInt16 m_nFix; // The width offset in the line
54public:
55 explicit SwFixPortion( const SwRect &rFlyRect );
57 void SetFix( const sal_uInt16 nNewFix ) { m_nFix = nNewFix; }
58 sal_uInt16 GetFix() const { return m_nFix; }
59
60 void dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, TextFrameIndex& nOffset) const override;
61};
62
64{
65public:
66 explicit SwMarginPortion();
67 void AdjustRight( const SwLineLayout* pCurr );
68};
69
71{ return Width() - m_nFixWidth; }
72
73// The FixWidth MUST NEVER be larger than the accumulated width!
75{
76 if( m_nFixWidth > PrtWidth() )
78}
79
81{
82 MoveGlue( pTarget, GetPrtGlue() );
83}
84
86{
87 MoveGlue( pTarget, GetPrtGlue() / 2 );
88}
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
Definition: porglue.cxx:160
sal_uInt16 GetFix() const
Definition: porglue.hxx:58
void SetFix(const sal_uInt16 nNewFix)
Definition: porglue.hxx:57
sal_uInt16 m_nFix
Definition: porglue.hxx:53
void MoveHalfGlue(SwGluePortion *pTarget)
Definition: porglue.hxx:85
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porglue.cxx:65
tools::Long GetPrtGlue() const
Definition: porglue.hxx:70
void SetFixWidth(const sal_uInt16 nNew)
Definition: porglue.hxx:38
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
Definition: porglue.cxx:132
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
Definition: porglue.cxx:35
void MoveAllGlue(SwGluePortion *pTarget)
Definition: porglue.hxx:80
void Join(SwGluePortion *pVictim)
Definition: porglue.cxx:119
sal_uInt16 GetFixWidth() const
Definition: porglue.hxx:37
void MoveGlue(SwGluePortion *pTarget, const tools::Long nPrtGlue)
Definition: porglue.cxx:109
void AdjFixWidth()
Definition: porglue.hxx:74
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: porglue.cxx:44
sal_uInt16 m_nFixWidth
Definition: porglue.hxx:30
SwGluePortion(const sal_uInt16 nInitFixWidth)
Definition: porglue.cxx:28
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: porglue.cxx:52
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:79
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:52
SwTwips PrtWidth() const
Definition: porlin.hxx:84
void AdjustRight(const SwLineLayout *pCurr)
In the outer loop all portions are inspected - the GluePortions at the end are processed first.
Definition: porglue.cxx:188
SwTwips Width() const
Definition: possiz.hxx:51
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
long Long