xref: /trunk/main/sw/source/core/inc/cntfrm.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _CNTFRM_HXX
28 #define _CNTFRM_HXX
29 #include "frame.hxx"
30 #include "flowfrm.hxx"
31 #include "cshtyp.hxx"
32 
33 class SwLayoutFrm;
34 class SwCntntNode;
35 class SwBorderAttrs;
36 class SwAttrSetChg;
37 class SwTxtFrm;
38 
39 //Implementiert in cntfrm.cxx, wird von cntfrm.cxx und crsrsh.cxx angezogen
40 extern sal_Bool GetFrmInPage( const SwCntntFrm*, SwWhichPage, SwPosPage, SwPaM* );
41 
42 class SwCntntFrm: public SwFrm, public SwFlowFrm
43 {
44     friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt );    //ruft MakePrtArea
45 
46     // --> OD 2007-11-26 #b6614158#
47     // parameter <bObjsInNewUpper>, indicating that objects are existing in
48     // remaining area of new upper
49     sal_Bool _WouldFit( SwTwips nSpace,
50                     SwLayoutFrm *pNewUpper,
51                     sal_Bool bTstMove,
52                     const bool bObjsInNewUpper );
53     // <--
54     virtual void MakeAll();
55 
56     void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
57                       SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
58 
59     virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool& );
60 
61     const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const;
62 
63 protected:
64 
65     sal_Bool MakePrtArea( const SwBorderAttrs & );
66 
67     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
68     virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
69     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
70 
71     SwCntntFrm( SwCntntNode * const, SwFrm* );
72 
73 public:
74     virtual ~SwCntntFrm();
75     TYPEINFO(); //bereits in Basisklassen drin
76 
77     virtual void Cut();
78     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
79 
80     inline       SwCntntNode *GetNode();
81     inline const SwCntntNode *GetNode() const;
82                  sal_uInt16       GetSectionLevel();
83 
84     inline const SwCntntFrm *GetFollow() const;
85     inline       SwCntntFrm *GetFollow();
86     SwTxtFrm* FindMaster() const;
87 
88         //Layoutabhaengiges Cursortravelling
89     virtual sal_Bool    LeftMargin( SwPaM * ) const;
90     virtual sal_Bool    RightMargin( SwPaM *, sal_Bool bAPI = sal_False ) const;
91     virtual sal_Bool    UnitUp( SwPaM *, const SwTwips nOffset = 0,
92                             sal_Bool bSetInReadOnly = sal_False ) const;
93     virtual sal_Bool    UnitDown( SwPaM *, const SwTwips nOffset = 0,
94                             sal_Bool bSetInReadOnly = sal_False ) const;
95     inline  sal_Bool    StartNextPage( SwPaM * ) const;
96     inline  sal_Bool    StartPrevPage( SwPaM * ) const;
97     inline  sal_Bool    StartCurrPage( SwPaM * ) const;
98     inline  sal_Bool    EndCurrPage( SwPaM * ) const;
99     inline  sal_Bool    EndNextPage( SwPaM * ) const;
100     inline  sal_Bool    EndPrevPage( SwPaM * ) const;
101 
102     // nMaxHeight is the required height
103     // bSplit indicates, that the paragraph has to be split
104     // bTst indicates, that we are currently doing a test formatting
105     virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst );
106 
107     sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* );//von MoveFwd gerufen bei Ftn-Inhalt
108 
109     inline  SwCntntFrm* GetNextCntntFrm() const;
110     inline  SwCntntFrm* GetPrevCntntFrm() const;
111     static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells );
112     void RegisterToNode( SwCntntNode& );
113     static void DelFrms( const SwCntntNode& );
114 };
115 
116 inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
117 {
118     if ( GetNext() && GetNext()->IsCntntFrm() )
119         return (SwCntntFrm*)GetNext();
120     else
121         return (SwCntntFrm*)ImplGetNextCntntFrm( true );
122 }
123 
124 inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
125 {
126     if ( GetPrev() && GetPrev()->IsCntntFrm() )
127         return (SwCntntFrm*)GetPrev();
128     else
129         return (SwCntntFrm*)ImplGetNextCntntFrm( false );
130 }
131 
132 inline SwCntntNode *SwCntntFrm::GetNode()
133 {
134     return (SwCntntNode*)GetDep();
135 }
136 inline const SwCntntNode *SwCntntFrm::GetNode() const
137 {
138     return (SwCntntNode*)GetDep();
139 }
140 
141 inline const SwCntntFrm *SwCntntFrm::GetFollow() const
142 {
143     return (const SwCntntFrm*)SwFlowFrm::GetFollow();
144 }
145 inline SwCntntFrm *SwCntntFrm::GetFollow()
146 {
147     return (SwCntntFrm*)SwFlowFrm::GetFollow();
148 }
149 
150 #endif
151