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
31{
32private:
33 sal_uInt16 m_nFixWidth;
34public:
35 explicit SwGluePortion( const sal_uInt16 nInitFixWidth );
36
37 void Join( SwGluePortion *pVictim );
38
39 inline tools::Long GetPrtGlue() const;
40 sal_uInt16 GetFixWidth() const { return m_nFixWidth; }
41 void SetFixWidth( const sal_uInt16 nNew ) { m_nFixWidth = nNew; }
42 void MoveGlue( SwGluePortion *pTarget, const tools::Long nPrtGlue );
43 inline void MoveAllGlue( SwGluePortion *pTarget );
44 inline void MoveHalfGlue( SwGluePortion *pTarget );
45 inline void AdjFixWidth();
46 virtual void Paint( const SwTextPaintInfo &rInf ) const override;
47 virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override;
48 virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override;
49 virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override;
50
51 void dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, TextFrameIndex& nOffset) const override;
52};
53
55{
56 sal_uInt16 m_nFix; // The width offset in the line
57public:
58 explicit SwFixPortion( const SwRect &rFlyRect );
60 void SetFix( const sal_uInt16 nNewFix ) { m_nFix = nNewFix; }
61 sal_uInt16 GetFix() const { return m_nFix; }
62
63 void dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, TextFrameIndex& nOffset) const override;
64};
65
67{
68public:
69 explicit SwMarginPortion();
70 void AdjustRight( const SwLineLayout* pCurr );
71};
72
74{ return Width() - m_nFixWidth; }
75
76// The FixWidth MUST NEVER be larger than the accumulated width!
78{
79 if( m_nFixWidth > PrtWidth() )
81}
82
84{
85 MoveGlue( pTarget, GetPrtGlue() );
86}
87
89{
90 MoveGlue( pTarget, GetPrtGlue() / 2 );
91}
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
Definition: porglue.cxx:160
sal_uInt16 GetFix() const
Definition: porglue.hxx:61
void SetFix(const sal_uInt16 nNewFix)
Definition: porglue.hxx:60
sal_uInt16 m_nFix
Definition: porglue.hxx:56
A glue portion is either a base class for other portions that want to have a certain width to push te...
Definition: porglue.hxx:31
void MoveHalfGlue(SwGluePortion *pTarget)
Definition: porglue.hxx:88
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porglue.cxx:65
tools::Long GetPrtGlue() const
Definition: porglue.hxx:73
void SetFixWidth(const sal_uInt16 nNew)
Definition: porglue.hxx:41
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:83
void Join(SwGluePortion *pVictim)
Definition: porglue.cxx:119
sal_uInt16 GetFixWidth() const
Definition: porglue.hxx:40
void MoveGlue(SwGluePortion *pTarget, const tools::Long nPrtGlue)
Definition: porglue.cxx:109
void AdjFixWidth()
Definition: porglue.hxx:77
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: porglue.cxx:44
sal_uInt16 m_nFixWidth
Definition: porglue.hxx:33
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
struct _xmlTextWriter * xmlTextWriterPtr
long Long