Files
libreoffice/sw/source/core/layout/colfrm.cxx

461 lines
15 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 23:08:29 +00:00
2000-09-18 23:08:29 +00:00
#include <hintids.hxx>
#include "cntfrm.hxx"
#include "doc.hxx"
#include "hintids.hxx"
#include <editeng/ulspitem.hxx>
#include <editeng/lrspitem.hxx>
2000-09-18 23:08:29 +00:00
#include <fmtclds.hxx>
#include <fmtfordr.hxx>
#include <frmfmt.hxx>
#include <node.hxx>
#include "frmtool.hxx"
#include "colfrm.hxx"
#include "pagefrm.hxx"
2012-02-13 11:36:53 +01:00
#include "bodyfrm.hxx" // ColumnFrms now with BodyFrm
2000-09-18 23:08:29 +00:00
#include "rootfrm.hxx" // wg. RemoveFtns
#include "sectfrm.hxx" // wg. FtnAtEnd-Flag
#include "switerator.hxx"
2000-09-18 23:08:29 +00:00
// ftnfrm.cxx:
void sw_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes );
2000-09-18 23:08:29 +00:00
/*************************************************************************
|*
|* SwColumnFrm::SwColumnFrm()
|*
|*************************************************************************/
SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt, SwFrm* pSib ):
SwFtnBossFrm( pFmt, pSib )
2000-09-18 23:08:29 +00:00
{
mnType = FRMC_COLUMN;
SwBodyFrm* pColBody = new SwBodyFrm( pFmt->GetDoc()->GetDfltFrmFmt(), pSib );
2012-02-13 11:36:53 +01:00
pColBody->InsertBehind( this, 0 ); // ColumnFrms now with BodyFrm
2000-09-18 23:08:29 +00:00
SetMaxFtnHeight( LONG_MAX );
}
SwColumnFrm::~SwColumnFrm()
{
SwFrmFmt *pFmt = GetFmt();
SwDoc *pDoc;
if ( !(pDoc = pFmt->GetDoc())->IsInDtor() && pFmt->IsLastDepend() )
{
2012-02-13 11:36:53 +01:00
//I'm the only one, delete the format.
//Get default format before, so the base class can cope with it.
2000-09-18 23:08:29 +00:00
pDoc->GetDfltFrmFmt()->Add( this );
pDoc->DelFrmFmt( pFmt );
}
}
/*************************************************************************
|*
|* SwLayoutFrm::ChgColumns()
|*
|*************************************************************************/
static void lcl_RemoveColumns( SwLayoutFrm *pCont, sal_uInt16 nCnt )
2000-09-18 23:08:29 +00:00
{
OSL_ENSURE( pCont && pCont->Lower() && pCont->Lower()->IsColumnFrm(),
2000-09-18 23:08:29 +00:00
"Keine Spalten zu entfernen." );
SwColumnFrm *pColumn = (SwColumnFrm*)pCont->Lower();
sw_RemoveFtns( pColumn, sal_True, sal_True );
2000-09-18 23:08:29 +00:00
while ( pColumn->GetNext() )
{
OSL_ENSURE( pColumn->GetNext()->IsColumnFrm(),
2000-09-18 23:08:29 +00:00
"Nachbar von ColFrm kein ColFrm." );
pColumn = (SwColumnFrm*)pColumn->GetNext();
}
for ( sal_uInt16 i = 0; i < nCnt; ++i )
2000-09-18 23:08:29 +00:00
{
SwColumnFrm *pTmp = (SwColumnFrm*)pColumn->GetPrev();
pColumn->Cut();
2012-02-13 11:36:53 +01:00
delete pColumn; //format is going to be destroyed in the DTor if needed.
2000-09-18 23:08:29 +00:00
pColumn = pTmp;
}
}
static SwLayoutFrm * lcl_FindColumns( SwLayoutFrm *pLay, sal_uInt16 nCount )
2000-09-18 23:08:29 +00:00
{
SwFrm *pCol = pLay->Lower();
if ( pLay->IsPageFrm() )
pCol = ((SwPageFrm*)pLay)->FindBodyCont()->Lower();
if ( pCol && pCol->IsColumnFrm() )
{
SwFrm *pTmp = pCol;
sal_uInt16 i;
2000-09-18 23:08:29 +00:00
for ( i = 0; pTmp; pTmp = pTmp->GetNext(), ++i )
/* do nothing */;
return i == nCount ? (SwLayoutFrm*)pCol : 0;
}
return 0;
}
static sal_Bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount )
2000-09-18 23:08:29 +00:00
{
SwDoc *pDoc = pCont->GetFmt()->GetDoc();
const sal_Bool bMod = pDoc->IsModified();
2000-09-18 23:08:29 +00:00
2012-02-13 11:36:53 +01:00
//Formats should be shared whenever possible. If a neighbour already has
//the same column settings we can add them to the same format.
//The neighbour can be searched using the format, however the owner of the
//attribute depends on the frame type.
2000-09-18 23:08:29 +00:00
SwLayoutFrm *pAttrOwner = pCont;
if ( pCont->IsBodyFrm() )
pAttrOwner = pCont->FindPageFrm();
SwLayoutFrm *pNeighbourCol = 0;
SwIterator<SwLayoutFrm,SwFmt> aIter( *pAttrOwner->GetFmt() );
SwLayoutFrm *pNeighbour = aIter.First();
2000-09-18 23:08:29 +00:00
sal_uInt16 nAdd = 0;
2000-09-18 23:08:29 +00:00
SwFrm *pCol = pCont->Lower();
if ( pCol && pCol->IsColumnFrm() )
for ( nAdd = 1; pCol; pCol = pCol->GetNext(), ++nAdd )
/* do nothing */;
while ( pNeighbour )
{
if ( 0 != (pNeighbourCol = lcl_FindColumns( pNeighbour, nCount+nAdd )) &&
pNeighbourCol != pCont )
break;
pNeighbourCol = 0;
pNeighbour = aIter.Next();
2000-09-18 23:08:29 +00:00
}
sal_Bool bRet;
2000-09-18 23:08:29 +00:00
SwTwips nMax = pCont->IsPageBodyFrm() ?
pCont->FindPageFrm()->GetMaxFtnHeight() : LONG_MAX;
if ( pNeighbourCol )
{
bRet = sal_False;
2000-09-18 23:08:29 +00:00
SwFrm *pTmp = pCont->Lower();
while ( pTmp )
{
pTmp = pTmp->GetNext();
pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext();
}
for ( sal_uInt16 i = 0; i < nCount; ++i )
2000-09-18 23:08:29 +00:00
{
SwColumnFrm *pTmpCol = new SwColumnFrm( pNeighbourCol->GetFmt(), pCont );
pTmpCol->SetMaxFtnHeight( nMax );
pTmpCol->InsertBefore( pCont, NULL );
2000-09-18 23:08:29 +00:00
pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext();
}
}
else
{
bRet = sal_True;
for ( sal_uInt16 i = 0; i < nCount; ++i )
2000-09-18 23:08:29 +00:00
{
SwFrmFmt *pFmt = pDoc->MakeFrmFmt( aEmptyStr, pDoc->GetDfltFrmFmt());
SwColumnFrm *pTmp = new SwColumnFrm( pFmt, pCont );
2000-09-18 23:08:29 +00:00
pTmp->SetMaxFtnHeight( nMax );
pTmp->Paste( pCont );
}
}
if ( !bMod )
pDoc->ResetModified();
return bRet;
}
/*--------------------------------------------------
2000-09-18 23:08:29 +00:00
* ChgColumns() adds or removes columns from a layoutframe.
* Normally, a layoutframe with a column attribut of 1 or 0 columns contains
* no columnframe. However, a sectionframe with "footnotes at the end" needs
* a columnframe. If the bChgFtn-flag is set, the columnframe will be inserted
* or remove, if necessary.
* --------------------------------------------------*/
void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
const sal_Bool bChgFtn )
2000-09-18 23:08:29 +00:00
{
if ( rOld.GetNumCols() <= 1 && rNew.GetNumCols() <= 1 && !bChgFtn )
return;
// #i97379#
CWS-TOOLING: integrate CWS sw32bf02 2009-08-25 15:52:04 +0200 hde r275366 : reactived testcases hit by issue 102752 2009-08-21 13:52:17 +0200 od r275245 : #i102921# delete files whose deletion has been forgotten in cws impress172 2009-08-21 11:20:47 +0200 od r275225 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@275001 (milestone: DEV300:m55) 2009-08-20 16:21:30 +0200 od r275191 : #i92511# method <lcl_MoveAllLowerObjs(..)> - invalidation of cache for object rectangle inclusive spaces is needed. 2009-08-20 15:50:40 +0200 od r275188 : #i96726# method <SwPagePreView::DocSzChgd(..)> - trigger recalculation of page preview layout even if the count of pages is not changing 2009-08-20 12:37:32 +0200 od r275172 : #i100466# correction for showing and hiding redlines 2009-08-18 13:25:18 +0200 od r275100 : #i103817# method <XMLTextImportHelper::SetStyleAndAttrs(..) - assure that a heading applies the outline style, if no other list style is applied. 2009-08-18 13:21:38 +0200 od r275098 : #i103817# allow the outline style - list style for outline numbering - to be set directly at the paragraph 2009-08-17 14:13:02 +0200 od r275052 : #i103684# add missing documentation for new optional OutlineLevel attribute introduced in OOo 3.1 2009-08-17 14:00:25 +0200 od r275049 : #i100481# method <XMLTextFrameContext_Impl::CreateChildContext(..)># - correct condition for handling embedded documents and embedded math objects 2009-08-12 14:11:34 +0200 od r274891 : #i97379# assure that columns are not applied to fly frames, which represent graphics or embedded objects 2009-08-12 12:51:43 +0200 od r274889 : #i101870# method <SwTxtNode::_MakeNewTxtNode(..)> - perform action on different paragraph styles before applying new paragraph style 2009-08-12 12:24:44 +0200 od r274888 : #i101092# method <ViewShell::Paint(..)> - encapsulate paint of document background and document into pre and post drawing layer paint calls 2009-08-12 11:38:48 +0200 od r274886 : #i98766# minor adjustment in order to be warning free under Mac port builds 2009-08-12 11:33:54 +0200 od r274885 : #i99267# method <SwTabFrm::MakeAll()> - reset <bSplit> after forward move to assure that follows can be joined, if further space is available. 2009-08-12 11:11:49 +0200 od r274882 : #i98766# method <ViewShell::SmoothScroll(..) - disable smooth scroll for Mac port builds 2009-08-10 12:17:58 +0200 od r274801 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@274622 (milestone: DEV300:m54) 2009-07-21 16:56:45 +0200 od r274206 : #i103685# method <SwTxtFormatter::NewTabPortion(..)> - adjust condition to apply automatic tab stop at left margin correctly in case that tab stops are not relative to indent 2009-07-10 11:53:53 +0200 od r273883 : #i102752 method <SwDrawContact::Modify(..)> - assure that a ShapePropertyChangeNotifier exists 2009-07-07 12:01:58 +0200 mst r273788 : #i103304# apply patch by dtardon to fix bogus conditional 2009-07-07 09:01:13 +0200 od r273767 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@273468 (milestone: DEV300:m51)
2009-08-27 14:36:29 +00:00
// If current lower is a no text frame, then columns are not allowed
if ( Lower() && Lower()->IsNoTxtFrm() &&
rNew.GetNumCols() > 1 )
{
return;
}
sal_uInt16 nNewNum, nOldNum = 1;
2000-09-18 23:08:29 +00:00
if( Lower() && Lower()->IsColumnFrm() )
{
SwFrm* pCol = Lower();
while( 0 != (pCol=pCol->GetNext()) )
++nOldNum;
}
nNewNum = rNew.GetNumCols();
if( !nNewNum )
++nNewNum;
sal_Bool bAtEnd;
2000-09-18 23:08:29 +00:00
if( IsSctFrm() )
bAtEnd = ((SwSectionFrm*)this)->IsAnyNoteAtEnd();
else
bAtEnd = sal_False;
2000-09-18 23:08:29 +00:00
2012-02-13 11:36:53 +01:00
//Setting the column width is only needed for new formats.
sal_Bool bAdjustAttributes = nOldNum != rOld.GetNumCols();
2000-09-18 23:08:29 +00:00
2012-02-13 11:36:53 +01:00
//The content is saved and restored if the column count is different.
2000-09-18 23:08:29 +00:00
SwFrm *pSave = 0;
if( nOldNum != nNewNum || bChgFtn )
{
SwDoc *pDoc = GetFmt()->GetDoc();
2012-02-13 11:36:53 +01:00
OSL_ENSURE( pDoc, "FrmFmt doesn't return a document." );
// SaveCntnt would also suck up the content of the footnote container
// and store it within the normal text flow.
2000-09-18 23:08:29 +00:00
if( IsPageBodyFrm() )
pDoc->GetCurrentLayout()->RemoveFtns( (SwPageFrm*)GetUpper(), sal_True, sal_False ); //swmod 080218
2000-09-18 23:08:29 +00:00
pSave = ::SaveCntnt( this );
2012-02-13 11:36:53 +01:00
//If columns exist, they get deleted if a column count of 0 or 1 is requested.
2000-09-18 23:08:29 +00:00
if ( nNewNum == 1 && !bAtEnd )
{
::lcl_RemoveColumns( this, nOldNum );
if ( IsBodyFrm() )
SetFrmFmt( pDoc->GetDfltFrmFmt() );
else
GetFmt()->SetFmtAttr( SwFmtFillOrder() );
2000-09-18 23:08:29 +00:00
if ( pSave )
::RestoreCntnt( pSave, this, 0, true );
2000-09-18 23:08:29 +00:00
return;
}
if ( nOldNum == 1 )
{
if ( IsBodyFrm() )
SetFrmFmt( pDoc->GetColumnContFmt() );
else
GetFmt()->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
2000-09-18 23:08:29 +00:00
if( !Lower() || !Lower()->IsColumnFrm() )
--nOldNum;
}
if ( nOldNum > nNewNum )
{
::lcl_RemoveColumns( this, nOldNum - nNewNum );
bAdjustAttributes = sal_True;
2000-09-18 23:08:29 +00:00
}
else if( nOldNum < nNewNum )
{
sal_uInt16 nAdd = nNewNum - nOldNum;
bAdjustAttributes = lcl_AddColumns( this, nAdd );
2000-09-18 23:08:29 +00:00
}
}
if ( !bAdjustAttributes )
{
if ( rOld.GetLineWidth() != rNew.GetLineWidth() ||
rOld.GetWishWidth() != rNew.GetWishWidth() ||
rOld.IsOrtho() != rNew.IsOrtho() )
bAdjustAttributes = sal_True;
2000-09-18 23:08:29 +00:00
else
{
sal_uInt16 nCount = Min( rNew.GetColumns().size(), rOld.GetColumns().size() );
for ( sal_uInt16 i = 0; i < nCount; ++i )
if ( !(rOld.GetColumns()[i] == rNew.GetColumns()[i]) )
2000-09-18 23:08:29 +00:00
{
bAdjustAttributes = sal_True;
2000-09-18 23:08:29 +00:00
break;
}
}
}
2012-02-13 11:36:53 +01:00
//The columns can now be easily adjusted.
2000-09-18 23:08:29 +00:00
AdjustColumns( &rNew, bAdjustAttributes );
2012-02-13 11:36:53 +01:00
//Don't restore the content before. An earlier restore would trigger useless
//actions during setup.
2000-09-18 23:08:29 +00:00
if ( pSave )
{
OSL_ENSURE( Lower() && Lower()->IsLayoutFrm() &&
2000-09-18 23:08:29 +00:00
((SwLayoutFrm*)Lower())->Lower() &&
((SwLayoutFrm*)Lower())->Lower()->IsLayoutFrm(),
"Gesucht: Spaltenbody (Tod oder Lebend)." ); // ColumnFrms jetzt mit BodyFrm
::RestoreCntnt( pSave, (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower(), 0, true );
2000-09-18 23:08:29 +00:00
}
}
/*************************************************************************
|*
|* SwLayoutFrm::AdjustColumns()
|*
|*************************************************************************/
void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttributes )
2000-09-18 23:08:29 +00:00
{
if( !Lower()->GetNext() )
{
Lower()->ChgSize( Prt().SSize() );
return;
}
const sal_Bool bVert = IsVertical();
2009-03-04 16:19:59 +00:00
//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
2001-08-29 12:23:19 +00:00
2012-02-13 11:36:53 +01:00
//If we have a pointer or we have to configure an attribute, we set the
//column widths in any case. Otherwise we check if a configuration is needed.
2000-09-18 23:08:29 +00:00
if ( !pAttr )
{
pAttr = &GetFmt()->GetCol();
if ( !bAdjustAttributes )
{
2001-09-17 10:20:34 +00:00
long nAvail = (Prt().*fnRect->fnGetWidth)();
for ( SwLayoutFrm *pCol = (SwLayoutFrm*)Lower();
pCol;
pCol = (SwLayoutFrm*)pCol->GetNext() )
nAvail -= (pCol->Frm().*fnRect->fnGetWidth)();
2000-09-18 23:08:29 +00:00
if ( !nAvail )
return;
}
}
2012-02-13 11:36:53 +01:00
//The columns can now be easily adjusted.
//The widths get counted so we can give the reminder to the last one.
2001-09-17 10:20:34 +00:00
SwTwips nAvail = (Prt().*fnRect->fnGetWidth)();
const sal_Bool bLine = pAttr->GetLineAdj() != COLADJ_NONE;
const sal_uInt16 nMin = bLine ? sal_uInt16( 20 + ( pAttr->GetLineWidth() / 2) ) : 0;
const sal_Bool bR2L = IsRightToLeft();
SwFrm *pCol = bR2L ? GetLastLower() : Lower();
// #i27399#
// bOrtho means we have to adjust the column frames manually. Otherwise
// we may use the values returned by CalcColWidth:
const sal_Bool bOrtho = pAttr->IsOrtho() && pAttr->GetNumCols() > 0;
2001-10-19 09:25:19 +00:00
long nGutter = 0;
for ( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; ++i ) //i118878, value returned by GetNumCols() can't be trusted
2000-09-18 23:08:29 +00:00
{
2001-10-19 09:25:19 +00:00
if( !bOrtho )
{
const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ?
nAvail :
pAttr->CalcColWidth( i, sal_uInt16( (Prt().*fnRect->fnGetWidth)() ) );
const Size aColSz = bVert ?
Size( Prt().Width(), nWidth ) :
Size( nWidth, Prt().Height() );
pCol->ChgSize( aColSz );
2000-09-18 23:08:29 +00:00
2012-02-13 11:36:53 +01:00
// With this, the ColumnBodyFrms from page columns gets adjusted and
// their bFixHeight flag is set so they won't shrink/grow.
// Don't use the flag with frame columns because BodyFrms in frame
2012-02-13 11:36:53 +01:00
// columns can grow/shrink.
2001-10-19 09:25:19 +00:00
if( IsBodyFrm() )
((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz );
2000-09-18 23:08:29 +00:00
2001-10-19 09:25:19 +00:00
nAvail -= nWidth;
}
if ( bOrtho || bAdjustAttributes )
2000-09-18 23:08:29 +00:00
{
const SwColumn *pC = &pAttr->GetColumns()[i];
const SwAttrSet* pSet = pCol->GetAttrSet();
2000-09-18 23:08:29 +00:00
SvxLRSpaceItem aLR( pSet->GetLRSpace() );
2012-02-13 11:36:53 +01:00
//In order to have enough space for the separation lines, we have to
//take them into account here. Every time two columns meet we
//calculate a clearance of 20 + half the pen width on the left or
//right side, respectively.
const sal_uInt16 nLeft = pC->GetLeft();
const sal_uInt16 nRight = pC->GetRight();
aLR.SetLeft ( nLeft );
aLR.SetRight( nRight );
if ( bLine )
{
if ( i == 0 )
2002-06-27 10:25:03 +00:00
{
aLR.SetRight( Max( nRight, nMin ) );
2002-06-27 10:25:03 +00:00
}
else if ( i == pAttr->GetNumCols() - 1 )
2001-08-30 07:49:33 +00:00
{
aLR.SetLeft ( Max( nLeft, nMin ) );
2001-08-30 07:49:33 +00:00
}
else
{
aLR.SetLeft ( Max( nLeft, nMin ) );
aLR.SetRight( Max( nRight, nMin ) );
2001-08-30 07:49:33 +00:00
}
2000-09-18 23:08:29 +00:00
}
if ( bAdjustAttributes )
{
SvxULSpaceItem aUL( pSet->GetULSpace() );
aUL.SetUpper( pC->GetUpper());
aUL.SetLower( pC->GetLower());
((SwLayoutFrm*)pCol)->GetFmt()->SetFmtAttr( aLR );
((SwLayoutFrm*)pCol)->GetFmt()->SetFmtAttr( aUL );
}
2001-10-19 09:25:19 +00:00
nGutter += aLR.GetLeft() + aLR.GetRight();
}
pCol = bR2L ? pCol->GetPrev() : pCol->GetNext();
2001-10-19 09:25:19 +00:00
}
2001-10-19 09:25:19 +00:00
if( bOrtho )
{
long nInnerWidth = ( nAvail - nGutter ) / pAttr->GetNumCols();
pCol = Lower();
for( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; pCol = pCol->GetNext(), ++i ) //i118878, value returned by GetNumCols() can't be trusted
2001-10-19 09:25:19 +00:00
{
SwTwips nWidth;
if ( i == pAttr->GetNumCols() - 1 )
2001-10-19 09:25:19 +00:00
nWidth = nAvail;
else
{
SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() );
2001-10-19 09:25:19 +00:00
nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight();
}
if( nWidth < 0 )
nWidth = 0;
const Size aColSz = bVert ?
Size( Prt().Width(), nWidth ) :
Size( nWidth, Prt().Height() );
pCol->ChgSize( aColSz );
2001-10-19 09:25:19 +00:00
if( IsBodyFrm() )
((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz );
2001-10-19 09:25:19 +00:00
nAvail -= nWidth;
2000-09-18 23:08:29 +00:00
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */