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 SwTxtFrm;
29 : struct SwCrsrMoveState;
30 :
31 4732 : class SwFlyPortion : public SwFixPortion
32 : {
33 : sal_uInt16 nBlankWidth;
34 : public:
35 2366 : inline SwFlyPortion( const SwRect &rFlyRect )
36 2366 : : 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 SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
40 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
41 : OUTPUT_OPERATOR_OVERRIDE
42 : };
43 :
44 : /// This portion represents an as-character anchored fly (shape, frame, etc.)
45 8224 : 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 : // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
56 : SwFlyCntPortion( const SwTxtFrm& rFrm, SwFlyInCntFrm *pFly,
57 : const Point &rBase,
58 : long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
59 : objectpositioning::AsCharFlags nFlags );
60 : // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
61 : SwFlyCntPortion( const SwTxtFrm& rFrm, SwDrawContact *pDrawContact,
62 : const Point &rBase,
63 : long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
64 : objectpositioning::AsCharFlags nFlags );
65 3864 : inline const Point& GetRefPoint() const { return aRef; }
66 8701 : inline SwFlyInCntFrm *GetFlyFrm() { return (SwFlyInCntFrm*)pContact; }
67 1586 : inline const SwFlyInCntFrm *GetFlyFrm() const
68 1586 : { return (SwFlyInCntFrm*)pContact; }
69 9320 : inline SwDrawContact *GetDrawContact() { return (SwDrawContact*)pContact; }
70 : inline const SwDrawContact* GetDrawContact() const
71 : { return (SwDrawContact*)pContact; }
72 58 : inline bool IsDraw() const { return bDraw; }
73 15890 : inline bool IsMax() const { return bMax; }
74 8058 : inline sal_uInt8 GetAlign() const { return nAlign; }
75 13361 : inline void SetAlign( sal_uInt8 nNew ) { nAlign = nNew; }
76 378 : inline void SetMax( bool bNew ) { bMax = bNew; }
77 : // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
78 : void SetBase( const SwTxtFrm& 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( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
85 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
86 : OUTPUT_OPERATOR_OVERRIDE
87 : };
88 :
89 : #endif
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|