android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / text / porfly.hxx
bloba519c1109c878c2664bedd56a602e1745185a0c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <ascharanchoredobjectposition.hxx>
24 #include "porglue.hxx"
25 #include <flyfrms.hxx>
27 class SwDrawContact;
28 class SwTextFrame;
29 struct SwCursorMoveState;
31 class SwFlyPortion : public SwFixPortion
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;
43 /// This portion represents an as-character anchored fly (shape, frame, etc.)
44 class SwFlyCntPortion : public SwLinePortion
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
50 sw::LineAlign m_eAlign;
52 virtual SdrObject* GetSdrObj(const SwTextFrame&) =0;
54 public:
55 SwFlyCntPortion();
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;
69 namespace sw
71 class FlyContentPortion final : public SwFlyCntPortion
73 SwFlyInContentFrame* m_pFly;
74 virtual SdrObject* GetSdrObj(const SwTextFrame&) override;
75 public:
76 FlyContentPortion(SwFlyInContentFrame* pFly);
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);
78 SwFlyInContentFrame* GetFlyFrame() { return m_pFly; }
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;
83 class DrawFlyCntPortion final : public SwFlyCntPortion
85 SwDrawContact* m_pContact;
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;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */