LibreOffice Module sw (master)  1
porfly.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_PORFLY_HXX
20 #define INCLUDED_SW_SOURCE_CORE_TEXT_PORFLY_HXX
21 
23 
24 #include "porglue.hxx"
25 #include <flyfrms.hxx>
26 
27 class SwDrawContact;
28 class SwTextFrame;
29 struct SwCursorMoveState;
30 
31 class SwFlyPortion : public SwFixPortion
32 {
33  sal_uInt16 nBlankWidth;
34 public:
35  explicit SwFlyPortion( const SwRect &rFlyRect )
36  : SwFixPortion(rFlyRect), nBlankWidth( 0 ) { SetWhichPor( PortionType::Fly ); }
37  sal_uInt16 GetBlankWidth( ) const { return nBlankWidth; }
38  void SetBlankWidth( const sal_uInt16 nNew ) { nBlankWidth = nNew; }
39  virtual void Paint( const SwTextPaintInfo &rInf ) const override;
40  virtual bool Format( SwTextFormatInfo &rInf ) override;
41 };
42 
45 {
46  Point m_aRef; // Relatively to this point we calculate the AbsPos
47  bool m_bMax; // Line adjustment and height == line height
49 
50  virtual SdrObject* GetSdrObj(const SwTextFrame&) =0;
51 
52 public:
54  const Point& GetRefPoint() const { return m_aRef; }
55  bool IsMax() const { return m_bMax; }
56  sw::LineAlign GetAlign() const { return m_eAlign; }
57  void SetAlign(sw::LineAlign eAlign) { m_eAlign = eAlign; }
58  void SetMax(bool bMax) { m_bMax = bMax; }
59  void SetBase(const SwTextFrame& rFrame, const Point& rBase, long nLnAscent, long nLnDescent, long nFlyAscent, long nFlyDescent, AsCharFlags nFlags);
60  virtual bool Format(SwTextFormatInfo& rInf) override;
61 };
62 
63 namespace sw
64 {
65  class FlyContentPortion final : public SwFlyCntPortion
66  {
68  virtual SdrObject* GetSdrObj(const SwTextFrame&) override;
69  public:
71  static FlyContentPortion* Create(const SwTextFrame& rFrame, SwFlyInContentFrame* pFly, const Point& rBase, long nAscent, long nDescent, long nFlyAsc, long nFlyDesc, AsCharFlags nFlags);
73  void GetFlyCursorOfst(Point& rPoint, SwPosition& rPos, SwCursorMoveState* pCMS) const { m_pFly->GetCursorOfst(&rPos, rPoint, pCMS); };
74  virtual void Paint(const SwTextPaintInfo& rInf) const override;
75  virtual ~FlyContentPortion() override;
76  };
77  class DrawFlyCntPortion final : public SwFlyCntPortion
78  {
80  virtual SdrObject* GetSdrObj(const SwTextFrame&) override;
81  public:
82  DrawFlyCntPortion(SwFrameFormat const & rFormat);
83  static DrawFlyCntPortion* Create(const SwTextFrame& rFrame, SwFrameFormat const & rFormat, const Point& rBase, long nAsc, long nDescent, long nFlyAsc, long nFlyDesc, AsCharFlags nFlags);
84  virtual void Paint(const SwTextPaintInfo& rInf) const override;
85  virtual ~DrawFlyCntPortion() override;
86  };
87 }
88 
89 #endif
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw::LineAlign m_eAlign
Definition: porfly.hxx:48
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porfly.cxx:204
Marks a position in the document model.
Definition: pam.hxx:35
static FlyContentPortion * Create(const SwTextFrame &rFrame, SwFlyInContentFrame *pFly, const Point &rBase, long nAscent, long nDescent, long nFlyAsc, long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:275
void SetBlankWidth(const sal_uInt16 nNew)
Definition: porfly.hxx:38
const Point & GetRefPoint() const
Definition: porfly.hxx:54
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porfly.cxx:54
Dialog to specify the properties of date form field.
void SetMax(bool bMax)
Definition: porfly.hxx:58
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porfly.cxx:101
SwFlyInContentFrame * GetFlyFrame()
Definition: porfly.hxx:72
void GetFlyCursorOfst(Point &rPoint, SwPosition &rPos, SwCursorMoveState *pCMS) const
Definition: porfly.hxx:73
virtual SdrObject * GetSdrObj(const SwTextFrame &) override
Definition: porfly.cxx:297
virtual ~FlyContentPortion() override
Definition: porfly.cxx:290
SwDrawContact * m_pContact
Definition: porfly.hxx:79
This portion represents an as-character anchored fly (shape, frame, etc.)
Definition: porfly.hxx:44
Style of a layout element.
Definition: frmfmt.hxx:57
virtual ~DrawFlyCntPortion() override
Definition: porfly.cxx:289
sal_uInt16 nAscent
Definition: porlin.hxx:57
void SetBase(const SwTextFrame &rFrame, const Point &rBase, long nLnAscent, long nLnDescent, long nFlyAscent, long nFlyDescent, AsCharFlags nFlags)
After setting the RefPoints, the ascent needs to be recalculated because it is dependent on RelPos...
Definition: porfly.cxx:322
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:94
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porfly.cxx:242
sal_uInt16 GetBlankWidth() const
Definition: porfly.hxx:37
Point m_aRef
Definition: porfly.hxx:46
void SetAlign(sw::LineAlign eAlign)
Definition: porfly.hxx:57
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:50
virtual void Paint(const SwTextPaintInfo &rInf) const override
class SwFlyPortion => we expect a frame-locale SwRect!
Definition: porfly.cxx:50
sw::LineAlign GetAlign() const
Definition: porfly.hxx:56
virtual SdrObject * GetSdrObj(const SwTextFrame &)=0
SwFlyCntPortion()
Use the dimensions of pFly->OutRect()
Definition: porfly.cxx:254
SwFlyPortion(const SwRect &rFlyRect)
Definition: porfly.hxx:35
static DrawFlyCntPortion * Create(const SwTextFrame &rFrame, SwFrameFormat const &rFormat, const Point &rBase, long nAsc, long nDescent, long nFlyAsc, long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:282
virtual bool GetCursorOfst(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the ContentFrame owning the PrtArea containing the point.
Definition: trvlfrm.cxx:535
FlyContentPortion(SwFlyInContentFrame *pFly)
Definition: porfly.cxx:262
virtual SdrObject * GetSdrObj(const SwTextFrame &) override
Definition: porfly.cxx:292
SwFlyInContentFrame * m_pFly
Definition: porfly.hxx:67
DrawFlyCntPortion(SwFrameFormat const &rFormat)
Definition: porfly.cxx:268
sal_uInt16 nBlankWidth
Definition: porfly.hxx:33
bool IsMax() const
Definition: porfly.hxx:55