xref: /aoo41x/main/sw/source/core/inc/cntfrm.hxx (revision 7b20d707)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CNTFRM_HXX
24cdf0e10cSrcweir #define _CNTFRM_HXX
25cdf0e10cSrcweir #include "frame.hxx"
26cdf0e10cSrcweir #include "flowfrm.hxx"
27cdf0e10cSrcweir #include "cshtyp.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir class SwLayoutFrm;
30cdf0e10cSrcweir class SwCntntNode;
31cdf0e10cSrcweir class SwBorderAttrs;
32cdf0e10cSrcweir class SwAttrSetChg;
33cdf0e10cSrcweir class SwTxtFrm;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //Implementiert in cntfrm.cxx, wird von cntfrm.cxx und crsrsh.cxx angezogen
36cdf0e10cSrcweir extern sal_Bool GetFrmInPage( const SwCntntFrm*, SwWhichPage, SwPosPage, SwPaM* );
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class SwCntntFrm: public SwFrm, public SwFlowFrm
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt );	//ruft MakePrtArea
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     // --> OD 2007-11-26 #b6614158#
43cdf0e10cSrcweir     // parameter <bObjsInNewUpper>, indicating that objects are existing in
44cdf0e10cSrcweir     // remaining area of new upper
45cdf0e10cSrcweir     sal_Bool _WouldFit( SwTwips nSpace,
46cdf0e10cSrcweir                     SwLayoutFrm *pNewUpper,
47cdf0e10cSrcweir                     sal_Bool bTstMove,
48cdf0e10cSrcweir                     const bool bObjsInNewUpper );
49cdf0e10cSrcweir     // <--
50cdf0e10cSrcweir 	virtual void MakeAll();
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
53cdf0e10cSrcweir 					  SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool& );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir protected:
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	sal_Bool MakePrtArea( const SwBorderAttrs & );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
64cdf0e10cSrcweir     virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
65cdf0e10cSrcweir     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	SwCntntFrm( SwCntntNode * const, SwFrm* );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir 	virtual ~SwCntntFrm();
71cdf0e10cSrcweir 	TYPEINFO();	//bereits in Basisklassen drin
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	virtual void Cut();
74cdf0e10cSrcweir 	virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	inline 		 SwCntntNode *GetNode();
77cdf0e10cSrcweir 	inline const SwCntntNode *GetNode() const;
78cdf0e10cSrcweir 				 sal_uInt16 	  GetSectionLevel();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	inline const SwCntntFrm *GetFollow() const;
81cdf0e10cSrcweir 	inline		 SwCntntFrm *GetFollow();
82cdf0e10cSrcweir     SwTxtFrm* FindMaster() const;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 		//Layoutabhaengiges Cursortravelling
85cdf0e10cSrcweir 	virtual sal_Bool	LeftMargin( SwPaM * ) const;
86cdf0e10cSrcweir 	virtual sal_Bool	RightMargin( SwPaM *, sal_Bool bAPI = sal_False ) const;
87cdf0e10cSrcweir 	virtual sal_Bool	UnitUp( SwPaM *, const SwTwips nOffset = 0,
88cdf0e10cSrcweir 							sal_Bool bSetInReadOnly = sal_False ) const;
89cdf0e10cSrcweir 	virtual sal_Bool	UnitDown( SwPaM *, const SwTwips nOffset = 0,
90cdf0e10cSrcweir 							sal_Bool bSetInReadOnly = sal_False ) const;
91cdf0e10cSrcweir 	inline	sal_Bool	StartNextPage( SwPaM * ) const;
92cdf0e10cSrcweir 	inline	sal_Bool	StartPrevPage( SwPaM * ) const;
93cdf0e10cSrcweir 	inline	sal_Bool	StartCurrPage( SwPaM * ) const;
94cdf0e10cSrcweir 	inline	sal_Bool	EndCurrPage( SwPaM * ) const;
95cdf0e10cSrcweir 	inline	sal_Bool	EndNextPage( SwPaM * ) const;
96cdf0e10cSrcweir 	inline	sal_Bool	EndPrevPage( SwPaM * ) const;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     // nMaxHeight is the required height
99cdf0e10cSrcweir     // bSplit indicates, that the paragraph has to be split
100cdf0e10cSrcweir     // bTst indicates, that we are currently doing a test formatting
101cdf0e10cSrcweir     virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* );//von MoveFwd gerufen bei Ftn-Inhalt
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     inline  SwCntntFrm* GetNextCntntFrm() const;
106*7b20d707SMatthias Seidel     inline  SwCntntFrm* GetNextCntntFrm( bool ) const;
107cdf0e10cSrcweir     inline  SwCntntFrm* GetPrevCntntFrm() const;
108cdf0e10cSrcweir     static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells );
109cdf0e10cSrcweir     void RegisterToNode( SwCntntNode& );
110cdf0e10cSrcweir     static void DelFrms( const SwCntntNode& );
111cdf0e10cSrcweir };
112cdf0e10cSrcweir 
GetNextCntntFrm() const113cdf0e10cSrcweir inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
114cdf0e10cSrcweir {
115cdf0e10cSrcweir     if ( GetNext() && GetNext()->IsCntntFrm() )
116cdf0e10cSrcweir         return (SwCntntFrm*)GetNext();
117cdf0e10cSrcweir     else
118cdf0e10cSrcweir         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
GetNextCntntFrm(bool bPrune) const121*7b20d707SMatthias Seidel inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm( bool bPrune ) const
122*7b20d707SMatthias Seidel {
123*7b20d707SMatthias Seidel     if ( bPrune && !GetPrev() )
124*7b20d707SMatthias Seidel         return NULL;
125*7b20d707SMatthias Seidel     else if ( bPrune || !(GetNext() && GetNext()->IsCntntFrm()))
126*7b20d707SMatthias Seidel         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
127*7b20d707SMatthias Seidel     else
128*7b20d707SMatthias Seidel         return (SwCntntFrm*)GetNext();
129*7b20d707SMatthias Seidel }
130*7b20d707SMatthias Seidel 
GetPrevCntntFrm() const131cdf0e10cSrcweir inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
132cdf0e10cSrcweir {
133cdf0e10cSrcweir     if ( GetPrev() && GetPrev()->IsCntntFrm() )
134cdf0e10cSrcweir         return (SwCntntFrm*)GetPrev();
135cdf0e10cSrcweir     else
136cdf0e10cSrcweir         return (SwCntntFrm*)ImplGetNextCntntFrm( false );
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
GetNode()139cdf0e10cSrcweir inline SwCntntNode *SwCntntFrm::GetNode()
140cdf0e10cSrcweir {
141cdf0e10cSrcweir 	return (SwCntntNode*)GetDep();
142cdf0e10cSrcweir }
GetNode() const143cdf0e10cSrcweir inline const SwCntntNode *SwCntntFrm::GetNode() const
144cdf0e10cSrcweir {
145cdf0e10cSrcweir 	return (SwCntntNode*)GetDep();
146cdf0e10cSrcweir }
147cdf0e10cSrcweir 
GetFollow() const148cdf0e10cSrcweir inline const SwCntntFrm *SwCntntFrm::GetFollow() const
149cdf0e10cSrcweir {
150cdf0e10cSrcweir 	return (const SwCntntFrm*)SwFlowFrm::GetFollow();
151cdf0e10cSrcweir }
GetFollow()152cdf0e10cSrcweir inline SwCntntFrm *SwCntntFrm::GetFollow()
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	return (SwCntntFrm*)SwFlowFrm::GetFollow();
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir #endif
158