xref: /aoo4110/main/sw/source/core/inc/cntfrm.hxx (revision b1cdbd2c)
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 _CNTFRM_HXX
24 #define _CNTFRM_HXX
25 #include "frame.hxx"
26 #include "flowfrm.hxx"
27 #include "cshtyp.hxx"
28 
29 class SwLayoutFrm;
30 class SwCntntNode;
31 class SwBorderAttrs;
32 class SwAttrSetChg;
33 class SwTxtFrm;
34 
35 //Implementiert in cntfrm.cxx, wird von cntfrm.cxx und crsrsh.cxx angezogen
36 extern sal_Bool GetFrmInPage( const SwCntntFrm*, SwWhichPage, SwPosPage, SwPaM* );
37 
38 class SwCntntFrm: public SwFrm, public SwFlowFrm
39 {
40 	friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt );	//ruft MakePrtArea
41 
42     // --> OD 2007-11-26 #b6614158#
43     // parameter <bObjsInNewUpper>, indicating that objects are existing in
44     // remaining area of new upper
45     sal_Bool _WouldFit( SwTwips nSpace,
46                     SwLayoutFrm *pNewUpper,
47                     sal_Bool bTstMove,
48                     const bool bObjsInNewUpper );
49     // <--
50 	virtual void MakeAll();
51 
52 	void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
53 					  SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
54 
55 	virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool& );
56 
57     const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const;
58 
59 protected:
60 
61 	sal_Bool MakePrtArea( const SwBorderAttrs & );
62 
63 	virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
64     virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
65     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
66 
67 	SwCntntFrm( SwCntntNode * const, SwFrm* );
68 
69 public:
70 	virtual ~SwCntntFrm();
71 	TYPEINFO();	//bereits in Basisklassen drin
72 
73 	virtual void Cut();
74 	virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
75 
76 	inline 		 SwCntntNode *GetNode();
77 	inline const SwCntntNode *GetNode() const;
78 				 sal_uInt16 	  GetSectionLevel();
79 
80 	inline const SwCntntFrm *GetFollow() const;
81 	inline		 SwCntntFrm *GetFollow();
82     SwTxtFrm* FindMaster() const;
83 
84 		//Layoutabhaengiges Cursortravelling
85 	virtual sal_Bool	LeftMargin( SwPaM * ) const;
86 	virtual sal_Bool	RightMargin( SwPaM *, sal_Bool bAPI = sal_False ) const;
87 	virtual sal_Bool	UnitUp( SwPaM *, const SwTwips nOffset = 0,
88 							sal_Bool bSetInReadOnly = sal_False ) const;
89 	virtual sal_Bool	UnitDown( SwPaM *, const SwTwips nOffset = 0,
90 							sal_Bool bSetInReadOnly = sal_False ) const;
91 	inline	sal_Bool	StartNextPage( SwPaM * ) const;
92 	inline	sal_Bool	StartPrevPage( SwPaM * ) const;
93 	inline	sal_Bool	StartCurrPage( SwPaM * ) const;
94 	inline	sal_Bool	EndCurrPage( SwPaM * ) const;
95 	inline	sal_Bool	EndNextPage( SwPaM * ) const;
96 	inline	sal_Bool	EndPrevPage( SwPaM * ) const;
97 
98     // nMaxHeight is the required height
99     // bSplit indicates, that the paragraph has to be split
100     // bTst indicates, that we are currently doing a test formatting
101     virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst );
102 
103 	sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* );//von MoveFwd gerufen bei Ftn-Inhalt
104 
105     inline  SwCntntFrm* GetNextCntntFrm() const;
106     inline  SwCntntFrm* GetNextCntntFrm( bool ) const;
107     inline  SwCntntFrm* GetPrevCntntFrm() const;
108     static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells );
109     void RegisterToNode( SwCntntNode& );
110     static void DelFrms( const SwCntntNode& );
111 };
112 
GetNextCntntFrm() const113 inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
114 {
115     if ( GetNext() && GetNext()->IsCntntFrm() )
116         return (SwCntntFrm*)GetNext();
117     else
118         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
119 }
120 
GetNextCntntFrm(bool bPrune) const121 inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm( bool bPrune ) const
122 {
123     if ( bPrune && !GetPrev() )
124         return NULL;
125     else if ( bPrune || !(GetNext() && GetNext()->IsCntntFrm()))
126         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
127     else
128         return (SwCntntFrm*)GetNext();
129 }
130 
GetPrevCntntFrm() const131 inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
132 {
133     if ( GetPrev() && GetPrev()->IsCntntFrm() )
134         return (SwCntntFrm*)GetPrev();
135     else
136         return (SwCntntFrm*)ImplGetNextCntntFrm( false );
137 }
138 
GetNode()139 inline SwCntntNode *SwCntntFrm::GetNode()
140 {
141 	return (SwCntntNode*)GetDep();
142 }
GetNode() const143 inline const SwCntntNode *SwCntntFrm::GetNode() const
144 {
145 	return (SwCntntNode*)GetDep();
146 }
147 
GetFollow() const148 inline const SwCntntFrm *SwCntntFrm::GetFollow() const
149 {
150 	return (const SwCntntFrm*)SwFlowFrm::GetFollow();
151 }
GetFollow()152 inline SwCntntFrm *SwCntntFrm::GetFollow()
153 {
154 	return (SwCntntFrm*)SwFlowFrm::GetFollow();
155 }
156 
157 #endif
158