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 #ifndef INCLUDED_SW_SOURCE_CORE_TEXT_PORGLUE_HXX
20 #define INCLUDED_SW_SOURCE_CORE_TEXT_PORGLUE_HXX
21 
22 #include "porlin.hxx"
23 
24 class SwRect;
25 class SwLineLayout;
26 
28 {
29 private:
30  sal_uInt16 nFixWidth;
31 public:
32  explicit SwGluePortion( const sal_uInt16 nInitFixWidth );
33 
34  void Join( SwGluePortion *pVictim );
35 
36  inline long GetPrtGlue() const;
37  sal_uInt16 GetFixWidth() const { return nFixWidth; }
38  void SetFixWidth( const sal_uInt16 nNew ) { nFixWidth = nNew; }
39  void MoveGlue( SwGluePortion *pTarget, const 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 GetCursorOfst(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 
50 {
51  sal_uInt16 nFix; // The width offset in the line
52 public:
53  explicit SwFixPortion( const SwRect &rFlyRect );
54  SwFixPortion();
55  void SetFix( const sal_uInt16 nNewFix ) { nFix = nNewFix; }
56  sal_uInt16 GetFix() const { return nFix; }
57 };
58 
60 {
61 public:
62  explicit SwMarginPortion();
63  void AdjustRight( const SwLineLayout* pCurr );
64 };
65 
66 inline long SwGluePortion::GetPrtGlue() const
67 { return Width() - nFixWidth; }
68 
69 // The FixWidth MUST NEVER be larger than the accumulated width!
71 {
72  if( nFixWidth > PrtWidth() )
73  nFixWidth = PrtWidth();
74 }
75 
77 {
78  MoveGlue( pTarget, GetPrtGlue() );
79 }
80 
82 {
83  MoveGlue( pTarget, GetPrtGlue() / 2 );
84 }
85 
86 #endif
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void MoveAllGlue(SwGluePortion *pTarget)
Definition: porglue.hxx:76
void AdjFixWidth()
Definition: porglue.hxx:70
void SetFix(const sal_uInt16 nNewFix)
Definition: porglue.hxx:55
void SetFixWidth(const sal_uInt16 nNew)
Definition: porglue.hxx:38
void MoveGlue(SwGluePortion *pTarget, const long nPrtGlue)
Definition: porglue.cxx:108
sal_uInt16 GetFix() const
Definition: porglue.hxx:56
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
sal_uInt16 nFix
Definition: porglue.hxx:51
void Join(SwGluePortion *pVictim)
Definition: porglue.cxx:118
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:78
SwGluePortion(const sal_uInt16 nInitFixWidth)
Definition: porglue.cxx:28
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porglue.cxx:65
long GetPrtGlue() const
Definition: porglue.hxx:66
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
Definition: porglue.cxx:44
void MoveHalfGlue(SwGluePortion *pTarget)
Definition: porglue.hxx:81
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:50
sal_uInt16 Width() const
Definition: possiz.hxx:46
sal_uInt16 nFixWidth
Definition: porglue.hxx:30
virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
Definition: porglue.cxx:35
void AdjustRight(const SwLineLayout *pCurr)
In the outer loop all portions are inspected - the GluePortions at the end are processed first...
Definition: porglue.cxx:163
sal_uInt16 PrtWidth() const
Definition: porlin.hxx:81
sal_uInt16 GetFixWidth() const
Definition: porglue.hxx:37