Line data Source code
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 :
22 : #include <ascharanchoredobjectposition.hxx>
23 :
24 : #include "porglue.hxx"
25 :
26 : class SwDrawContact;
27 : class SwFlyInCntFrm;
28 : class SwTextFrm;
29 : struct SwCrsrMoveState;
30 :
31 2246 : class SwFlyPortion : public SwFixPortion
32 : {
33 : sal_uInt16 nBlankWidth;
34 : public:
35 1123 : explicit SwFlyPortion( const SwRect &rFlyRect )
36 1123 : : SwFixPortion(rFlyRect), nBlankWidth( 0 ) { SetWhichPor( POR_FLY ); }
37 0 : inline sal_uInt16 GetBlankWidth( ) const { return nBlankWidth; }
38 0 : inline void SetBlankWidth( const sal_uInt16 nNew ) { nBlankWidth = nNew; }
39 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
40 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
41 : OUTPUT_OPERATOR_OVERRIDE
42 : };
43 :
44 : /// This portion represents an as-character anchored fly (shape, frame, etc.)
45 4400 : class SwFlyCntPortion : public SwLinePortion
46 : {
47 : void *pContact; // bDraw ? DrawContact : FlyInCntFrm
48 : Point aRef; // Relatively to this point we calculate the AbsPos
49 : bool bDraw : 1; // DrawContact?
50 : bool bMax : 1; // Line adjustment and height == line height
51 : sal_uInt8 nAlign : 3; // Line adjustment? No, above, middle, bottom
52 : virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
53 :
54 : public:
55 : // Use new datatype for parameter <nFlags>
56 : SwFlyCntPortion( const SwTextFrm& rFrm, SwFlyInCntFrm *pFly,
57 : const Point &rBase,
58 : long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
59 : objectpositioning::AsCharFlags nFlags );
60 : // Use new datatype for parameter <nFlags>
61 : SwFlyCntPortion( const SwTextFrm& rFrm, SwDrawContact *pDrawContact,
62 : const Point &rBase,
63 : long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
64 : objectpositioning::AsCharFlags nFlags );
65 2033 : inline const Point& GetRefPoint() const { return aRef; }
66 4615 : inline SwFlyInCntFrm *GetFlyFrm() { return static_cast<SwFlyInCntFrm*>(pContact); }
67 819 : inline const SwFlyInCntFrm *GetFlyFrm() const
68 819 : { return static_cast<SwFlyInCntFrm*>(pContact); }
69 5002 : inline SwDrawContact *GetDrawContact() { return static_cast<SwDrawContact*>(pContact); }
70 : inline const SwDrawContact* GetDrawContact() const
71 : { return static_cast<SwDrawContact*>(pContact); }
72 29 : inline bool IsDraw() const { return bDraw; }
73 8246 : inline bool IsMax() const { return bMax; }
74 4264 : inline sal_uInt8 GetAlign() const { return nAlign; }
75 7116 : inline void SetAlign( sal_uInt8 nNew ) { nAlign = nNew; }
76 201 : inline void SetMax( bool bNew ) { bMax = bNew; }
77 : // Use new datatype for parameter <nFlags>
78 : void SetBase( const SwTextFrm& rFrm, const Point &rBase,
79 : long nLnAscent, long nLnDescent,
80 : long nFlyAscent, long nFlyDescent,
81 : objectpositioning::AsCharFlags nFlags );
82 : sal_Int32 GetFlyCrsrOfst( const sal_uInt16 nOfst, const Point &rPoint,
83 : SwPosition *pPos, SwCrsrMoveState* pCMS ) const;
84 : virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
85 : virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
86 : OUTPUT_OPERATOR_OVERRIDE
87 : };
88 :
89 : #endif
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|