xref: /AOO41X/main/sw/source/core/text/porfly.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _PORFLY_HXX
24 #define _PORFLY_HXX
25 // OD 28.10.2003 #113049#
26 #include <ascharanchoredobjectposition.hxx>
27 
28 #include "porglue.hxx"
29 
30 class SwDrawContact;
31 class SwFlyInCntFrm;
32 class SwTxtFrm;
33 struct SwCrsrMoveState;
34 
35 /*************************************************************************
36  *                class SwFlyPortion
37  *************************************************************************/
38 
39 class SwFlyPortion : public SwFixPortion
40 {
41     KSHORT nBlankWidth;
42 public:
SwFlyPortion(const SwRect & rFlyRect)43     inline  SwFlyPortion( const SwRect &rFlyRect )
44         : SwFixPortion(rFlyRect), nBlankWidth( 0 ) { SetWhichPor( POR_FLY ); }
GetBlankWidth() const45     inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
SetBlankWidth(const KSHORT nNew)46     inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
47     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
48     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
49     OUTPUT_OPERATOR
50 };
51 
52 /*************************************************************************
53  *                class SwFlyCntPortion
54  *************************************************************************/
55 
56 class SwFlyCntPortion : public SwLinePortion
57 {
58     void *pContact; // bDraw ? DrawContact : FlyInCntFrm
59     Point aRef;     // Relativ zu diesem Point wird die AbsPos berechnet.
60     sal_Bool bDraw : 1;  // DrawContact?
61     sal_Bool bMax : 1;   // Zeilenausrichtung und Hoehe == Zeilenhoehe
62     sal_uInt8 nAlign : 3; // Zeilenausrichtung? Nein, oben, mitte, unten
63     virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
64 
65 public:
66     // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
67     SwFlyCntPortion( const SwTxtFrm& rFrm, SwFlyInCntFrm *pFly,
68                      const Point &rBase,
69                      long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
70                      objectpositioning::AsCharFlags nFlags );
71     // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
72     SwFlyCntPortion( const SwTxtFrm& rFrm, SwDrawContact *pDrawContact,
73                      const Point &rBase,
74                      long nAscent, long nDescent, long nFlyAsc, long nFlyDesc,
75                      objectpositioning::AsCharFlags nFlags );
GetRefPoint() const76     inline const Point& GetRefPoint() const { return aRef; }
GetFlyFrm()77     inline SwFlyInCntFrm *GetFlyFrm() { return (SwFlyInCntFrm*)pContact; }
GetFlyFrm() const78     inline const SwFlyInCntFrm *GetFlyFrm() const
79         { return (SwFlyInCntFrm*)pContact; }
GetDrawContact()80     inline SwDrawContact *GetDrawContact() { return (SwDrawContact*)pContact; }
GetDrawContact() const81     inline const SwDrawContact* GetDrawContact() const
82         { return (SwDrawContact*)pContact; }
IsDraw() const83     inline sal_Bool IsDraw() const { return bDraw; }
IsMax() const84     inline sal_Bool IsMax() const { return bMax; }
GetAlign() const85     inline sal_uInt8 GetAlign() const { return nAlign; }
SetAlign(sal_uInt8 nNew)86     inline void SetAlign( sal_uInt8 nNew ) { nAlign = nNew; }
SetMax(sal_Bool bNew)87     inline void SetMax( sal_Bool bNew ) { bMax = bNew; }
88     // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
89     void SetBase( const SwTxtFrm& rFrm, const Point &rBase,
90                   long nLnAscent, long nLnDescent,
91                   long nFlyAscent, long nFlyDescent,
92                   objectpositioning::AsCharFlags nFlags );
93     xub_StrLen GetFlyCrsrOfst( const KSHORT nOfst, const Point &rPoint,
94                         SwPosition *pPos, SwCrsrMoveState* pCMS ) const;
95     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
96     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
97     OUTPUT_OPERATOR
98 };
99 
100 CLASSIO( SwFlyPortion )
101 CLASSIO( SwFlyCntPortion )
102 
103 
104 #endif
105