1 diff --git sw/inc/IDocumentSettingAccess.hxx sw/inc/IDocumentSettingAccess.hxx
2 index b8db22d..3b90c41 100644
3 --- sw/inc/IDocumentSettingAccess.hxx
4 +++ sw/inc/IDocumentSettingAccess.hxx
5 @@ -85,6 +85,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd
6 TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
9 + COLLAPSE_EMPTY_CELL_PARA,
10 // COMPATIBILITY FLAGS END
13 diff --git sw/inc/doc.hxx sw/inc/doc.hxx
14 index 8507a8c..0d54d84 100644
17 @@ -611,6 +611,7 @@ private:
18 bool mbTabRelativeToIndent : 1; // #i24363# tab stops relative to indent
19 bool mbProtectForm : 1;
20 bool mbInvertBorderSpacing : 1;
21 + bool mbCollapseEmptyCellPara : 1;
22 bool mbTabAtLeftIndentForParagraphsInList; // OD 2008-06-05 #i89181# - see above
25 diff --git sw/inc/ndtxt.hxx sw/inc/ndtxt.hxx
26 index cf282c3..da1b8fa 100644
29 @@ -808,6 +808,8 @@ public:
31 USHORT GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const;
33 + bool IsCollapse() const;
35 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
38 diff --git sw/source/core/crsr/callnk.cxx sw/source/core/crsr/callnk.cxx
39 index 8aaa93c..410b70e 100644
40 --- sw/source/core/crsr/callnk.cxx
41 +++ sw/source/core/crsr/callnk.cxx
46 +#include <tabfrm.hxx>
47 +#include <rowfrm.hxx>
48 +#include <fmtfsize.hxx>
51 #include <breakit.hxx>
53 +#include<vcl/window.hxx>
56 SwCallLink::SwCallLink( SwCrsrShell & rSh, ULONG nAktNode, xub_StrLen nAktCntnt,
57 BYTE nAktNdTyp, long nLRPos, bool bAktSelection )
58 @@ -100,6 +105,47 @@ SwCallLink::~SwCallLink()
62 + bool bUpdatedTable = false;
63 + SwFrm *myFrm=pCNd->GetFrm();
66 + // We need to emulated a change of the row height in order
67 + // to have the complete row redrawn
68 + SwRowFrm* pRow = myFrm->FindRowFrm( );
71 + const SwTableLine* pLine = pRow->GetTabLine( );
72 + SwFmtFrmSize pSize = pLine->GetFrmFmt( )->GetFrmSize( );
73 + pRow->Modify( NULL, &pSize );
75 + bUpdatedTable = true;
79 + const SwDoc *pDoc=rShell.GetDoc();
80 + const SwCntntNode *pNode=(pDoc!=NULL?pDoc->GetNodes()[nNode]->GetCntntNode():NULL);
81 + if ( pNode != NULL )
83 + SwFrm *myFrm2=pNode->GetFrm();
86 + // We need to emulated a change of the row height in order
87 + // to have the complete row redrawn
88 + SwRowFrm* pRow = myFrm2->FindRowFrm();
91 + const SwTableLine* pLine = pRow->GetTabLine( );
92 + SwFmtFrmSize pSize = pLine->GetFrmFmt( )->GetFrmSize( );
93 + pRow->Modify( NULL, &pSize );
95 + bUpdatedTable = true;
100 + if ( bUpdatedTable )
101 + rShell.GetWin( )->Invalidate( 0 );
103 xub_StrLen nCmp, nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
104 USHORT nNdWhich = pCNd->GetNodeType();
105 ULONG nAktNode = pCurCrsr->GetPoint()->nNode.GetIndex();
106 diff --git sw/source/core/doc/doc.cxx sw/source/core/doc/doc.cxx
107 index f5ec3e5..bc44a5a 100644
108 --- sw/source/core/doc/doc.cxx
109 +++ sw/source/core/doc/doc.cxx
110 @@ -185,6 +185,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
111 case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
113 case INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
114 + case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara;
115 // COMPATIBILITY FLAGS END
117 case BROWSE_MODE: return mbBrowseMode;
118 @@ -311,6 +312,9 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
119 case INVERT_BORDER_SPACING:
120 mbInvertBorderSpacing = value;
122 + case COLLAPSE_EMPTY_CELL_PARA:
123 + mbCollapseEmptyCellPara = value;
125 // COMPATIBILITY FLAGS END
128 diff --git sw/source/core/doc/docnew.cxx sw/source/core/doc/docnew.cxx
129 index 966255b..2e8e1f8 100644
130 --- sw/source/core/doc/docnew.cxx
131 +++ sw/source/core/doc/docnew.cxx
132 @@ -380,6 +380,7 @@ SwDoc::SwDoc() :
133 mbTabAtLeftIndentForParagraphsInList = false; // hidden
135 mbInvertBorderSpacing = false; // hidden
136 + mbCollapseEmptyCellPara = true; // hidden
139 // COMPATIBILITY FLAGS END
140 diff --git sw/source/core/inc/frame.hxx sw/source/core/inc/frame.hxx
141 index 9a35030..420d970 100644
142 --- sw/source/core/inc/frame.hxx
143 +++ sw/source/core/inc/frame.hxx
144 @@ -630,6 +630,7 @@ public:
145 SwRootFrm *FindRootFrm();
146 SwPageFrm *FindPageFrm();
148 + SwRowFrm *FindRowFrm();
149 SwFtnBossFrm *FindFtnBossFrm( BOOL bFootnotes = FALSE );
150 SwTabFrm *ImplFindTabFrm();
151 SwFtnFrm *ImplFindFtnFrm();
152 @@ -916,6 +917,9 @@ public:
154 // FME 2007-08-30 #i81146# new loop control
155 void ValidateThisAndAllLowers( const USHORT nStage );
158 + bool IsCollapse() const;
161 inline BOOL SwFrm::IsInDocBody() const
162 diff --git sw/source/core/layout/calcmove.cxx sw/source/core/layout/calcmove.cxx
163 index bb73a85..4c5df37 100644
164 --- sw/source/core/layout/calcmove.cxx
165 +++ sw/source/core/layout/calcmove.cxx
167 #include <flyfrms.hxx>
170 +#include <ndtxt.hxx>
172 //------------------------------------------------------------------------
174 //------------------------------------------------------------------------
175 @@ -957,6 +959,42 @@ void SwLayoutFrm::MakeAll()
176 |* Letzte Aenderung MA 03. Mar. 96
178 |*************************************************************************/
179 +bool SwTxtNode::IsCollapse() const
181 + if ( GetDoc()->get( IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA ) && GetTxt().Len()==0 ) {
182 + ULONG nIdx=GetIndex();
183 + const SwEndNode *pNdBefore=GetNodes()[nIdx-1]->GetEndNode();
184 + const SwEndNode *pNdAfter=GetNodes()[nIdx+1]->GetEndNode();
186 + // The paragraph is collapsed only if the NdAfter is the end of a cell
187 + bool bInTable = this->FindTableNode( ) != NULL;
189 + SwSortedObjs* pObjs = this->GetFrm()->GetDrawObjs( );
190 + sal_uInt32 nObjs = ( pObjs != NULL ) ? pObjs->Count( ) : 0;
192 + if ( pNdBefore!=NULL && pNdAfter!=NULL && nObjs == 0 && bInTable ) {
201 +bool SwFrm::IsCollapse() const
204 + const SwTxtFrm *pTxtFrm=(SwTxtFrm*)this;
205 + const SwTxtNode *pTxtNode=pTxtFrm->GetTxtNode();
206 + if (pTxtNode && pTxtNode->IsCollapse()) {
216 BOOL SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
218 @@ -1057,6 +1095,11 @@ BOOL SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
220 // OD 2004-03-02 #106629# - use new method <CalcLowerSpace(..)>
221 SwTwips nLower = CalcLowerSpace( &rAttrs );
222 + if (IsCollapse()) {
223 + ViewShell *pSh = GetShell();
227 // // in balanced columned section frames we do not want the
229 // sal_Bool bCommonBorder = sal_True;
230 diff --git sw/source/core/layout/findfrm.cxx sw/source/core/layout/findfrm.cxx
231 index e192364..d641056 100644
232 --- sw/source/core/layout/findfrm.cxx
233 +++ sw/source/core/layout/findfrm.cxx
234 @@ -599,6 +599,15 @@ SwFrm *SwFrm::FindColFrm()
238 +SwRowFrm *SwFrm::FindRowFrm()
240 + SwFrm *pFrm = this;
242 + { pFrm = pFrm->GetUpper();
243 + } while ( pFrm && !pFrm->IsRowFrm() );
244 + return dynamic_cast< SwRowFrm* >( pFrm );
247 SwFrm* SwFrm::FindFooterOrHeader()
250 diff --git sw/source/core/text/frmpaint.cxx sw/source/core/text/frmpaint.cxx
251 index d1f2416..f93ba6f 100644
252 --- sw/source/core/text/frmpaint.cxx
253 +++ sw/source/core/text/frmpaint.cxx
254 @@ -570,21 +570,25 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
258 - const XubString aTmp( CH_PAR );
259 - SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, 1 );
260 - aDrawInf.SetLeft( rRect.Left() );
261 - aDrawInf.SetRight( rRect.Right() );
262 - aDrawInf.SetPos( aPos );
263 - aDrawInf.SetSpace( 0 );
264 - aDrawInf.SetKanaComp( 0 );
265 - aDrawInf.SetWrong( NULL );
266 - aDrawInf.SetGrammarCheck( NULL );
267 - aDrawInf.SetSmartTags( NULL ); // SMARTTAGS
268 - aDrawInf.SetFrm( this );
269 - aDrawInf.SetFont( pFnt );
270 - aDrawInf.SetSnapToGrid( sal_False );
272 - pFnt->_DrawText( aDrawInf );
273 + // Don't show the paragraph mark for collapsed paragraphs, when they are hidden
274 + if ( EmptyHeight( ) > 1 )
276 + const XubString aTmp( CH_PAR );
277 + SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, 1 );
278 + aDrawInf.SetLeft( rRect.Left() );
279 + aDrawInf.SetRight( rRect.Right() );
280 + aDrawInf.SetPos( aPos );
281 + aDrawInf.SetSpace( 0 );
282 + aDrawInf.SetKanaComp( 0 );
283 + aDrawInf.SetWrong( NULL );
284 + aDrawInf.SetGrammarCheck( NULL );
285 + aDrawInf.SetSmartTags( NULL ); // SMARTTAGS
286 + aDrawInf.SetFrm( this );
287 + aDrawInf.SetFont( pFnt );
288 + aDrawInf.SetSnapToGrid( sal_False );
290 + pFnt->_DrawText( aDrawInf );
295 diff --git sw/source/core/text/porrst.cxx sw/source/core/text/porrst.cxx
296 index 99aeaa4..2c74caf 100644
297 --- sw/source/core/text/porrst.cxx
298 +++ sw/source/core/text/porrst.cxx
300 #include <IDocumentSettingAccess.hxx>
301 #include <IDocumentDeviceAccess.hxx>
303 +#include <crsrsh.hxx>
305 /*************************************************************************
306 * class SwTmpEndPortion
307 *************************************************************************/
308 @@ -230,6 +232,20 @@ SwLinePortion *SwArrowPortion::Compress() { return this; }
310 SwTwips SwTxtFrm::EmptyHeight() const
312 + if (IsCollapse()) {
313 + ViewShell *pSh = GetShell();
314 + if ( pSh->IsA( TYPE(SwCrsrShell) ) ) {
315 + SwCrsrShell *pCrSh=(SwCrsrShell*)pSh;
316 + SwCntntFrm *pCurrFrm=pCrSh->GetCurrFrm();
317 + if (pCurrFrm==(SwCntntFrm*)this) {
326 ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::EmptyHeight with swapped frame" );
329 diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
330 index 2426ced..f9cd78e 100644
331 --- sw/source/filter/ww8/ww8par.cxx
332 +++ sw/source/filter/ww8/ww8par.cxx
333 @@ -1538,6 +1538,7 @@ void SwWW8ImplReader::ImportDop()
336 rDoc.set(IDocumentSettingAccess::INVERT_BORDER_SPACING, true);
337 + rDoc.set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, true);
340 // COMPATIBILITY FLAGS END
341 # FIXME: 2009-09-07: The below does not apply to dev300-m57.
342 # Whether the corresponding snippet should still be removed
343 # from the upstream code, or the additional code now in upstream
344 # means that this hunk is now unneeded, I don't know. --tml
345 # --- sw/source/filter/ww8/ww8par2.cxx
346 # +++ sw/source/filter/ww8/ww8par2.cxx
347 # @@ -3578,18 +3578,6 @@ void SwWW8ImplReader::TabCellEnd()
348 # if (nInTable && pTableDesc)
350 # pTableDesc->TableCellEnd();
353 # - && pWFlyPara == NULL
354 # - && mpTableEndPaM.get() != NULL
355 # - && (! SwPaM::Overlap(*pPaM, *mpTableEndPaM))
356 # - && SwPaM::LessThan(*mpTableEndPaM, *pPaM))
358 # - if (mpTableEndPaM->GetPoint()->nNode.GetNode().IsTxtNode())
360 # - rDoc.DelFullPara(*mpTableEndPaM);
365 # bFirstPara = true; // We have come to the end of a cell so FirstPara flag
366 diff --git sw/source/ui/uno/SwXDocumentSettings.cxx sw/source/ui/uno/SwXDocumentSettings.cxx
367 index a65d367..039cfb4 100644
368 --- sw/source/ui/uno/SwXDocumentSettings.cxx
369 +++ sw/source/ui/uno/SwXDocumentSettings.cxx
370 @@ -132,6 +132,7 @@ enum SwDocumentSettingsPropertyHandles
371 HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
373 ,HANDLE_INVERT_BORDER_SPACING
374 + ,HANDLE_COLLAPSE_EMPTY_CELL_PARA
377 MasterPropertySetInfo * lcl_createSettingsInfo()
378 @@ -186,6 +187,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo()
379 // --> OD 2008-06-05 #i89181#
380 { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0},
381 { RTL_CONSTASCII_STRINGPARAM("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
382 + { RTL_CONSTASCII_STRINGPARAM("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, CPPUTYPE_BOOLEAN, 0, 0},
384 * As OS said, we don't have a view when we need to set this, so I have to
385 * find another solution before adding them to this property set - MTG
386 @@ -685,6 +687,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
387 mpDoc->set(IDocumentSettingAccess::INVERT_BORDER_SPACING, bTmp);
390 + case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
392 + sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
393 + mpDoc->set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, bTmp);
397 throw UnknownPropertyException();
399 @@ -1018,6 +1026,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
400 rValue.setValue( &bTmp, ::getBooleanCppuType() );
403 + case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
405 + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA );
406 + rValue.setValue( &bTmp, ::getBooleanCppuType() );
410 throw UnknownPropertyException();