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 
20 #pragma once
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 m_nBlankWidth;
34 public:
35  explicit SwFlyPortion( const SwRect &rFlyRect )
36  : SwFixPortion(rFlyRect), m_nBlankWidth( 0 ) { SetWhichPor( PortionType::Fly ); }
37  sal_uInt16 GetBlankWidth( ) const { return m_nBlankWidth; }
38  void SetBlankWidth( const sal_uInt16 nNew ) { m_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
48  bool m_bDeleted; // Part of tracked deletion: it needs strikethrough
49  size_t m_nAuthor; // Redline author for color of the strikethrough
51 
52  virtual SdrObject* GetSdrObj(const SwTextFrame&) =0;
53 
54 public:
56  const Point& GetRefPoint() const { return m_aRef; }
57  bool IsMax() const { return m_bMax; }
58  bool IsDeleted() const { return m_bDeleted; }
59  void SetAuthor(size_t nAuthor) { m_nAuthor = nAuthor; }
60  size_t GetAuthor() const { return m_nAuthor; }
61  sw::LineAlign GetAlign() const { return m_eAlign; }
62  void SetAlign(sw::LineAlign eAlign) { m_eAlign = eAlign; }
63  void SetMax(bool bMax) { m_bMax = bMax; }
64  void SetDeleted(bool bDeleted) { m_bDeleted = bDeleted; }
65  void SetBase(const SwTextFrame& rFrame, const Point& rBase, tools::Long nLnAscent, tools::Long nLnDescent, tools::Long nFlyAscent, tools::Long nFlyDescent, AsCharFlags nFlags);
66  virtual bool Format(SwTextFormatInfo& rInf) override;
67 };
68 
69 namespace sw
70 {
71  class FlyContentPortion final : public SwFlyCntPortion
72  {
74  virtual SdrObject* GetSdrObj(const SwTextFrame&) override;
75  public:
77  static FlyContentPortion* Create(const SwTextFrame& rFrame, SwFlyInContentFrame* pFly, const Point& rBase, tools::Long nAscent, tools::Long nDescent, tools::Long nFlyAsc, tools::Long nFlyDesc, AsCharFlags nFlags);
79  void GetFlyCursorOfst(Point& rPoint, SwPosition& rPos, SwCursorMoveState* pCMS) const { m_pFly->GetModelPositionForViewPoint(&rPos, rPoint, pCMS); };
80  virtual void Paint(const SwTextPaintInfo& rInf) const override;
81  virtual ~FlyContentPortion() override;
82  };
83  class DrawFlyCntPortion final : public SwFlyCntPortion
84  {
86  virtual SdrObject* GetSdrObj(const SwTextFrame&) override;
87  public:
88  DrawFlyCntPortion(SwFrameFormat const & rFormat);
89  static DrawFlyCntPortion* Create(const SwTextFrame& rFrame, SwFrameFormat const & rFormat, const Point& rBase, tools::Long nAsc, tools::Long nDescent, tools::Long nFlyAsc, tools::Long nFlyDesc, AsCharFlags nFlags);
90  virtual void Paint(const SwTextPaintInfo& rInf) const override;
91  virtual ~DrawFlyCntPortion() override;
92  };
93 }
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw::LineAlign m_eAlign
Definition: porfly.hxx:50
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porfly.cxx:203
Marks a position in the document model.
Definition: pam.hxx:35
size_t GetAuthor() const
Definition: porfly.hxx:60
void SetBlankWidth(const sal_uInt16 nNew)
Definition: porfly.hxx:38
const Point & GetRefPoint() const
Definition: porfly.hxx:56
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porfly.cxx:53
long Long
bool m_bDeleted
Definition: porfly.hxx:48
Dialog to specify the properties of date form field.
void SetMax(bool bMax)
Definition: porfly.hxx:63
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void SetBase(const SwTextFrame &rFrame, const Point &rBase, tools::Long nLnAscent, tools::Long nLnDescent, tools::Long nFlyAscent, tools::Long nFlyDescent, AsCharFlags nFlags)
After setting the RefPoints, the ascent needs to be recalculated because it is dependent on RelPos...
Definition: porfly.cxx:343
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: porfly.cxx:100
SwFlyInContentFrame * GetFlyFrame()
Definition: porfly.hxx:78
void GetFlyCursorOfst(Point &rPoint, SwPosition &rPos, SwCursorMoveState *pCMS) const
Definition: porfly.hxx:79
virtual SdrObject * GetSdrObj(const SwTextFrame &) override
Definition: porfly.cxx:318
virtual ~FlyContentPortion() override
Definition: porfly.cxx:311
SwDrawContact * m_pContact
Definition: porfly.hxx:85
static DrawFlyCntPortion * Create(const SwTextFrame &rFrame, SwFrameFormat const &rFormat, const Point &rBase, tools::Long nAsc, tools::Long nDescent, tools::Long nFlyAsc, tools::Long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:303
This portion represents an as-character anchored fly (shape, frame, etc.)
Definition: porfly.hxx:44
static FlyContentPortion * Create(const SwTextFrame &rFrame, SwFlyInContentFrame *pFly, const Point &rBase, tools::Long nAscent, tools::Long nDescent, tools::Long nFlyAsc, tools::Long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:296
Style of a layout element.
Definition: frmfmt.hxx:59
virtual ~DrawFlyCntPortion() override
Definition: porfly.cxx:310
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the ContentFrame owning the PrtArea containing the point.
Definition: trvlfrm.cxx:540
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:95
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porfly.cxx:261
bool IsDeleted() const
Definition: porfly.hxx:58
sal_uInt16 GetBlankWidth() const
Definition: porfly.hxx:37
size_t m_nAuthor
Definition: porfly.hxx:49
void SetDeleted(bool bDeleted)
Definition: porfly.hxx:64
Point m_aRef
Definition: porfly.hxx:46
void SetAlign(sw::LineAlign eAlign)
Definition: porfly.hxx:62
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:51
virtual void Paint(const SwTextPaintInfo &rInf) const override
class SwFlyPortion => we expect a frame-locale SwRect!
Definition: porfly.cxx:49
sw::LineAlign GetAlign() const
Definition: porfly.hxx:61
void SetAuthor(size_t nAuthor)
Definition: porfly.hxx:59
virtual SdrObject * GetSdrObj(const SwTextFrame &)=0
SwFlyCntPortion()
Use the dimensions of pFly->OutRect()
Definition: porfly.cxx:273
SwFlyPortion(const SwRect &rFlyRect)
Definition: porfly.hxx:35
FlyContentPortion(SwFlyInContentFrame *pFly)
Definition: porfly.cxx:283
virtual SdrObject * GetSdrObj(const SwTextFrame &) override
Definition: porfly.cxx:313
SwFlyInContentFrame * m_pFly
Definition: porfly.hxx:73
DrawFlyCntPortion(SwFrameFormat const &rFormat)
Definition: porfly.cxx:289
bool IsMax() const
Definition: porfly.hxx:57
sal_uInt16 m_nBlankWidth
Definition: porfly.hxx:33