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