Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _CNTFRM_HXX
21 : #define _CNTFRM_HXX
22 :
23 : #include "frame.hxx"
24 : #include "flowfrm.hxx"
25 : #include "cshtyp.hxx"
26 : #include "node.hxx"
27 :
28 : class SwLayoutFrm;
29 : class SwCntntNode;
30 : class SwBorderAttrs;
31 : class SwAttrSetChg;
32 : class SwTxtFrm;
33 :
34 : // implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
35 : extern sal_Bool GetFrmInPage( const SwCntntFrm*, SwWhichPage, SwPosPage, SwPaM* );
36 :
37 : class SwCntntFrm: public SwFrm, public SwFlowFrm
38 : {
39 : friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ); // calls MakePrtArea
40 :
41 : // parameter <bObjsInNewUpper> indicates that objects exist in remaining
42 : // area of new upper
43 : sal_Bool _WouldFit( SwTwips nSpace,
44 : SwLayoutFrm *pNewUpper,
45 : sal_Bool bTstMove,
46 : const bool bObjsInNewUpper );
47 :
48 : virtual void MakeAll();
49 :
50 : void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
51 : SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
52 :
53 : virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool& );
54 :
55 : const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const;
56 :
57 : protected:
58 : sal_Bool MakePrtArea( const SwBorderAttrs & );
59 :
60 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
61 : virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
62 : virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
63 :
64 : SwCntntFrm( SwCntntNode * const, SwFrm* );
65 :
66 : public:
67 : virtual ~SwCntntFrm();
68 : TYPEINFO(); // already in base class
69 :
70 : virtual void Cut();
71 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
72 :
73 : inline const SwCntntNode *GetNode() const;
74 : inline SwCntntNode *GetNode();
75 : sal_uInt16 GetSectionLevel();
76 :
77 : inline const SwCntntFrm *GetFollow() const;
78 : inline SwCntntFrm *GetFollow();
79 : inline const SwCntntFrm *GetPrecede() const;
80 : inline SwCntntFrm *GetPrecede();
81 : SwTxtFrm* FindMaster() const;
82 :
83 : // layout dependent cursor travelling
84 : virtual sal_Bool LeftMargin( SwPaM * ) const;
85 : virtual sal_Bool RightMargin( SwPaM *, sal_Bool bAPI = sal_False ) const;
86 : virtual sal_Bool UnitUp( SwPaM *, const SwTwips nOffset = 0,
87 : sal_Bool bSetInReadOnly = sal_False ) const;
88 : virtual sal_Bool UnitDown( SwPaM *, const SwTwips nOffset = 0,
89 : sal_Bool bSetInReadOnly = sal_False ) const;
90 : inline sal_Bool StartNextPage( SwPaM * ) const;
91 : inline sal_Bool StartPrevPage( SwPaM * ) const;
92 : inline sal_Bool StartCurrPage( SwPaM * ) const;
93 : inline sal_Bool EndCurrPage( SwPaM * ) const;
94 : inline sal_Bool EndNextPage( SwPaM * ) const;
95 : inline sal_Bool EndPrevPage( SwPaM * ) const;
96 :
97 : // nMaxHeight is the required height
98 : // bSplit indicates that the paragraph has to be split
99 : // bTst indicates that we are currently doing a test formatting
100 : virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst );
101 :
102 : sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* ); // called by MoveFwd if content
103 :
104 : inline SwCntntFrm* GetNextCntntFrm() const;
105 : inline SwCntntFrm* GetPrevCntntFrm() const;
106 : static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells );
107 : void RegisterToNode( SwCntntNode& );
108 : static void DelFrms( const SwCntntNode& );
109 : };
110 :
111 10989 : inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
112 : {
113 10989 : if ( GetNext() && GetNext()->IsCntntFrm() )
114 1755 : return (SwCntntFrm*)GetNext();
115 : else
116 9234 : return (SwCntntFrm*)ImplGetNextCntntFrm( true );
117 : }
118 :
119 3510 : inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
120 : {
121 3510 : if ( GetPrev() && GetPrev()->IsCntntFrm() )
122 391 : return (SwCntntFrm*)GetPrev();
123 : else
124 3119 : return (SwCntntFrm*)ImplGetNextCntntFrm( false );
125 : }
126 :
127 79921 : inline SwCntntNode *SwCntntFrm::GetNode()
128 : {
129 79921 : return static_cast< SwCntntNode* >( GetDep() );
130 : }
131 62856 : inline const SwCntntNode *SwCntntFrm::GetNode() const
132 : {
133 62856 : return static_cast< const SwCntntNode* >( GetDep() );
134 : }
135 :
136 1252 : inline const SwCntntFrm *SwCntntFrm::GetFollow() const
137 : {
138 1252 : return (const SwCntntFrm*)SwFlowFrm::GetFollow();
139 : }
140 17907 : inline SwCntntFrm *SwCntntFrm::GetFollow()
141 : {
142 17907 : return (SwCntntFrm*)SwFlowFrm::GetFollow();
143 : }
144 :
145 0 : inline const SwCntntFrm *SwCntntFrm::GetPrecede() const
146 : {
147 0 : return (const SwCntntFrm*)SwFlowFrm::GetPrecede();
148 : }
149 : inline SwCntntFrm *SwCntntFrm::GetPrecede()
150 : {
151 : return (SwCntntFrm*)SwFlowFrm::GetPrecede();
152 : }
153 :
154 : #endif
155 :
156 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|