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 SwContentNode;
30 : class SwBorderAttrs;
31 : class SwAttrSetChg;
32 : class SwTextFrm;
33 :
34 : // implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
35 : extern bool GetFrmInPage( const SwContentFrm*, SwWhichPage, SwPosPage, SwPaM* );
36 :
37 : class SwContentFrm: 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 SwContentFrm* ImplGetNextContentFrm( 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 : SwContentFrm( SwContentNode * const, SwFrm* );
65 :
66 : virtual void DestroyImpl() SAL_OVERRIDE;
67 : virtual ~SwContentFrm();
68 :
69 : public:
70 : TYPEINFO_OVERRIDE(); // already in base class
71 :
72 : virtual void Cut() SAL_OVERRIDE;
73 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
74 :
75 : inline const SwContentNode *GetNode() const;
76 : inline SwContentNode *GetNode();
77 : sal_uInt16 GetSectionLevel();
78 :
79 : inline const SwContentFrm *GetFollow() const;
80 : inline SwContentFrm *GetFollow();
81 : inline const SwContentFrm *GetPrecede() const;
82 : inline SwContentFrm *GetPrecede();
83 : SwTextFrm* FindMaster() const;
84 :
85 : // layout dependent cursor travelling
86 : virtual bool LeftMargin( SwPaM * ) const;
87 : virtual bool RightMargin( SwPaM *, bool bAPI = false ) const;
88 : virtual bool UnitUp( SwPaM *, const SwTwips nOffset = 0,
89 : bool bSetInReadOnly = false ) const;
90 : virtual bool UnitDown( SwPaM *, const SwTwips nOffset = 0,
91 : bool bSetInReadOnly = false ) const;
92 : inline bool StartNextPage( SwPaM * ) const;
93 : inline bool StartPrevPage( SwPaM * ) const;
94 : inline bool StartCurrPage( SwPaM * ) const;
95 : inline bool EndCurrPage( SwPaM * ) const;
96 : inline bool EndNextPage( SwPaM * ) const;
97 : inline bool EndPrevPage( SwPaM * ) const;
98 :
99 : // nMaxHeight is the required height
100 : // bSplit indicates that the paragraph has to be split
101 : // bTst indicates that we are currently doing a test formatting
102 : virtual bool WouldFit( SwTwips &nMaxHeight, bool &bSplit, bool bTst );
103 :
104 : bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrm* ); // called by MoveFwd if content
105 :
106 : inline SwContentFrm* GetNextContentFrm() const;
107 : inline SwContentFrm* GetPrevContentFrm() const;
108 : static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells );
109 : void RegisterToNode( SwContentNode& );
110 : };
111 :
112 267636669 : inline SwContentFrm* SwContentFrm::GetNextContentFrm() const
113 : {
114 267636669 : if ( GetNext() && GetNext()->IsContentFrm() )
115 140975881 : return const_cast<SwContentFrm*>(static_cast<const SwContentFrm*>(GetNext()));
116 : else
117 126660788 : return const_cast<SwContentFrm*>(ImplGetNextContentFrm( true ));
118 : }
119 :
120 870901 : inline SwContentFrm* SwContentFrm::GetPrevContentFrm() const
121 : {
122 870901 : if ( GetPrev() && GetPrev()->IsContentFrm() )
123 373698 : return const_cast<SwContentFrm*>(static_cast<const SwContentFrm*>(GetPrev()));
124 : else
125 497203 : return const_cast<SwContentFrm*>(ImplGetNextContentFrm( false ));
126 : }
127 :
128 52174962 : inline SwContentNode *SwContentFrm::GetNode()
129 : {
130 52174962 : return static_cast< SwContentNode* >( GetDep() );
131 : }
132 276513504 : inline const SwContentNode *SwContentFrm::GetNode() const
133 : {
134 276513504 : return static_cast< const SwContentNode* >( GetDep() );
135 : }
136 :
137 156324 : inline const SwContentFrm *SwContentFrm::GetFollow() const
138 : {
139 156324 : return static_cast<const SwContentFrm*>(SwFlowFrm::GetFollow());
140 : }
141 960858 : inline SwContentFrm *SwContentFrm::GetFollow()
142 : {
143 960858 : return static_cast<SwContentFrm*>(SwFlowFrm::GetFollow());
144 : }
145 :
146 41014 : inline const SwContentFrm *SwContentFrm::GetPrecede() const
147 : {
148 41014 : return static_cast<const SwContentFrm*>(SwFlowFrm::GetPrecede());
149 : }
150 : inline SwContentFrm *SwContentFrm::GetPrecede()
151 : {
152 : return static_cast<SwContentFrm*>(SwFlowFrm::GetPrecede());
153 : }
154 :
155 : #endif
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|