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 INCLUDED_SW_SOURCE_CORE_INC_CNTFRM_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_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 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 : bool _WouldFit( SwTwips nSpace,
44 : SwLayoutFrm *pNewUpper,
45 : bool bTstMove,
46 : const bool bObjsInNewUpper );
47 :
48 : virtual void MakeAll() SAL_OVERRIDE;
49 :
50 : void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
51 : SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
52 :
53 : virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool, bool& ) SAL_OVERRIDE;
54 :
55 : const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const;
56 :
57 : protected:
58 : bool MakePrtArea( const SwBorderAttrs & );
59 :
60 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
61 : virtual SwTwips ShrinkFrm( SwTwips, bool bTst = false, bool bInfo = false ) SAL_OVERRIDE;
62 : virtual SwTwips GrowFrm ( SwTwips, bool bTst = false, bool bInfo = false ) SAL_OVERRIDE;
63 :
64 : SwCntntFrm( SwCntntNode * const, SwFrm* );
65 :
66 : public:
67 : virtual ~SwCntntFrm();
68 : TYPEINFO_OVERRIDE(); // already in base class
69 :
70 : virtual void Cut() SAL_OVERRIDE;
71 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
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 bool LeftMargin( SwPaM * ) const;
85 : virtual bool RightMargin( SwPaM *, bool bAPI = false ) const;
86 : virtual bool UnitUp( SwPaM *, const SwTwips nOffset = 0,
87 : bool bSetInReadOnly = false ) const;
88 : virtual bool UnitDown( SwPaM *, const SwTwips nOffset = 0,
89 : bool bSetInReadOnly = false ) const;
90 : inline bool StartNextPage( SwPaM * ) const;
91 : inline bool StartPrevPage( SwPaM * ) const;
92 : inline bool StartCurrPage( SwPaM * ) const;
93 : inline bool EndCurrPage( SwPaM * ) const;
94 : inline bool EndNextPage( SwPaM * ) const;
95 : inline 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 bool WouldFit( SwTwips &nMaxHeight, bool &bSplit, bool bTst );
101 :
102 : bool MoveFtnCntFwd( 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 : };
109 :
110 1040483 : inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
111 : {
112 1040483 : if ( GetNext() && GetNext()->IsCntntFrm() )
113 425556 : return (SwCntntFrm*)GetNext();
114 : else
115 614927 : return (SwCntntFrm*)ImplGetNextCntntFrm( true );
116 : }
117 :
118 1667947 : inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
119 : {
120 1667947 : if ( GetPrev() && GetPrev()->IsCntntFrm() )
121 720677 : return (SwCntntFrm*)GetPrev();
122 : else
123 947270 : return (SwCntntFrm*)ImplGetNextCntntFrm( false );
124 : }
125 :
126 8683027 : inline SwCntntNode *SwCntntFrm::GetNode()
127 : {
128 8683027 : return static_cast< SwCntntNode* >( GetDep() );
129 : }
130 5630609 : inline const SwCntntNode *SwCntntFrm::GetNode() const
131 : {
132 5630609 : return static_cast< const SwCntntNode* >( GetDep() );
133 : }
134 :
135 278437 : inline const SwCntntFrm *SwCntntFrm::GetFollow() const
136 : {
137 278437 : return (const SwCntntFrm*)SwFlowFrm::GetFollow();
138 : }
139 1694973 : inline SwCntntFrm *SwCntntFrm::GetFollow()
140 : {
141 1694973 : return (SwCntntFrm*)SwFlowFrm::GetFollow();
142 : }
143 :
144 71218 : inline const SwCntntFrm *SwCntntFrm::GetPrecede() const
145 : {
146 71218 : return (const SwCntntFrm*)SwFlowFrm::GetPrecede();
147 : }
148 : inline SwCntntFrm *SwCntntFrm::GetPrecede()
149 : {
150 : return (SwCntntFrm*)SwFlowFrm::GetPrecede();
151 : }
152 :
153 : #endif
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|