2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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 .
|
|
|
|
*/
|
2006-09-16 20:17:47 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "pam.hxx"
|
|
|
|
#include "swtable.hxx"
|
|
|
|
#include "frame.hxx"
|
2010-06-13 15:22:56 +02:00
|
|
|
#include "rootfrm.hxx"
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "pagefrm.hxx"
|
|
|
|
#include "flyfrm.hxx"
|
|
|
|
#include "viewsh.hxx"
|
|
|
|
#include "doc.hxx"
|
|
|
|
#include "viewimp.hxx"
|
2010-06-13 15:22:56 +02:00
|
|
|
#include "viewopt.hxx"
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "dflyobj.hxx"
|
|
|
|
#include "frmtool.hxx"
|
|
|
|
#include "dcontact.hxx"
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/formatbreakitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/keepitem.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <fmtsrnd.hxx>
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
#include <fmtpdsc.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/ulspitem.hxx>
|
2002-02-05 14:00:23 +00:00
|
|
|
#include <tgrditem.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <txtftn.hxx>
|
|
|
|
#include <fmtftn.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/pgrditem.hxx>
|
2002-02-08 13:49:20 +00:00
|
|
|
#include <paratr.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "ftnfrm.hxx"
|
|
|
|
#include "txtfrm.hxx"
|
|
|
|
#include "tabfrm.hxx"
|
|
|
|
#include "pagedesc.hxx"
|
|
|
|
#include "layact.hxx"
|
|
|
|
#include "fmtornt.hxx"
|
|
|
|
#include "flyfrms.hxx"
|
|
|
|
#include "sectfrm.hxx"
|
|
|
|
#include "section.hxx"
|
|
|
|
#include "dbg_lay.hxx"
|
|
|
|
#include "lineinfo.hxx"
|
2004-03-23 10:25:05 +00:00
|
|
|
#include <fmtclbl.hxx>
|
2004-08-02 13:08:38 +00:00
|
|
|
#include <sortedobjs.hxx>
|
|
|
|
#include <layouter.hxx>
|
2004-11-16 14:44:46 +00:00
|
|
|
#include <fmtfollowtextflow.hxx>
|
2010-12-17 09:02:23 +01:00
|
|
|
#include <switerator.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::bMoveBwdJump = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::SwFlowFrm()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
|
|
|
|
rThis( rFrm ),
|
2012-02-12 22:02:55 +01:00
|
|
|
m_pFollow( 0 ),
|
|
|
|
m_pPrecede( 0 ),
|
2011-09-08 11:07:51 +02:00
|
|
|
bLockJoin( false ),
|
|
|
|
bUndersized( false ),
|
|
|
|
bFlyLock( false )
|
|
|
|
{}
|
2002-09-13 11:13:06 +00:00
|
|
|
|
2012-02-12 22:11:37 +01:00
|
|
|
SwFlowFrm::~SwFlowFrm()
|
|
|
|
{
|
|
|
|
if (m_pFollow)
|
|
|
|
{
|
|
|
|
m_pFollow->m_pPrecede = 0;
|
|
|
|
}
|
|
|
|
if (m_pPrecede)
|
|
|
|
{
|
|
|
|
m_pPrecede->m_pFollow = 0;
|
|
|
|
}
|
|
|
|
}
|
2002-09-13 11:13:06 +00:00
|
|
|
|
2012-02-12 22:02:55 +01:00
|
|
|
void SwFlowFrm::SetFollow(SwFlowFrm *const pFollow)
|
|
|
|
{
|
2012-02-12 22:11:37 +01:00
|
|
|
if (m_pFollow)
|
|
|
|
{
|
|
|
|
assert(this == m_pFollow->m_pPrecede);
|
|
|
|
m_pFollow->m_pPrecede = 0;
|
|
|
|
}
|
2012-02-12 22:02:55 +01:00
|
|
|
m_pFollow = pFollow;
|
|
|
|
if (m_pFollow != NULL)
|
|
|
|
{
|
2012-02-12 22:11:37 +01:00
|
|
|
if (m_pFollow->m_pPrecede) // re-chaining pFollow?
|
|
|
|
{
|
|
|
|
assert(m_pFollow == m_pFollow->m_pPrecede->m_pFollow);
|
|
|
|
m_pFollow->m_pPrecede->m_pFollow = 0;
|
|
|
|
}
|
2012-02-12 22:02:55 +01:00
|
|
|
m_pFollow->m_pPrecede = this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-13 11:13:06 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::IsFollowLocked()
|
2011-01-17 15:06:54 +01:00
|
|
|
|* return sal_True if any follow has the JoinLocked flag
|
2002-09-13 11:13:06 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
sal_Bool SwFlowFrm::HasLockedFollow() const
|
|
|
|
{
|
|
|
|
const SwFlowFrm* pFrm = GetFollow();
|
|
|
|
while( pFrm )
|
|
|
|
{
|
|
|
|
if( pFrm->IsJoinLocked() )
|
|
|
|
return sal_True;
|
|
|
|
pFrm = pFrm->GetFollow();
|
|
|
|
}
|
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::IsKeepFwdMoveAllowed()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::IsKeepFwdMoveAllowed()
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// If all the predecessors up to the first of the chain have
|
|
|
|
// the 'keep' attribute set, and the first of the chain's
|
|
|
|
// IsFwdMoveAllowed returns sal_False, then we're not allowed to move.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFrm *pFrm = &rThis;
|
|
|
|
if ( !pFrm->IsInFtn() )
|
|
|
|
do
|
|
|
|
{ if ( pFrm->GetAttrSet()->GetKeep().GetValue() )
|
|
|
|
pFrm = pFrm->GetIndPrev();
|
|
|
|
else
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
} while ( pFrm );
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
//See IsFwdMoveAllowed()
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bRet = sal_False;
|
2007-09-27 08:01:58 +00:00
|
|
|
if ( pFrm && pFrm->GetIndPrev() )
|
2011-01-17 15:06:54 +01:00
|
|
|
bRet = sal_True;
|
2007-09-27 08:01:58 +00:00
|
|
|
return bRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::CheckKeep()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void SwFlowFrm::CheckKeep()
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// Kick off the "last" predecessor with a 'keep' attribute, because
|
|
|
|
// it's possible for the whole troop to move back.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFrm *pPre = rThis.GetIndPrev();
|
|
|
|
if( pPre->IsSctFrm() )
|
|
|
|
{
|
|
|
|
SwFrm *pLast = ((SwSectionFrm*)pPre)->FindLastCntnt();
|
|
|
|
if( pLast && pLast->FindSctFrm() == pPre )
|
|
|
|
pPre = pLast;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SwFrm* pTmp;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bKeep;
|
|
|
|
while ( sal_True == (bKeep = pPre->GetAttrSet()->GetKeep().GetValue()) &&
|
2000-09-18 23:08:29 +00:00
|
|
|
0 != ( pTmp = pPre->GetIndPrev() ) )
|
|
|
|
{
|
|
|
|
if( pTmp->IsSctFrm() )
|
|
|
|
{
|
|
|
|
SwFrm *pLast = ((SwSectionFrm*)pTmp)->FindLastCntnt();
|
|
|
|
if( pLast && pLast->FindSctFrm() == pTmp )
|
|
|
|
pTmp = pLast;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pPre = pTmp;
|
|
|
|
}
|
|
|
|
if ( bKeep )
|
|
|
|
pPre->InvalidatePos();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::IsKeep()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::IsKeep( const SwAttrSet& rAttrs, bool bCheckIfLastRowShouldKeep ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-01-13 12:13:45 +00:00
|
|
|
// 1. The keep attribute is ignored inside footnotes
|
|
|
|
// 2. For compatibility reasons, the keep attribute is
|
|
|
|
// ignored for frames inside table cells
|
2006-03-09 13:07:10 +00:00
|
|
|
// 3. If bBreakCheck is set to true, this function only checks
|
|
|
|
// if there are any break after attributes set at rAttrs
|
|
|
|
// or break before attributes set for the next content (or next table)
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bKeep = bCheckIfLastRowShouldKeep ||
|
2006-03-09 13:07:10 +00:00
|
|
|
( !rThis.IsInFtn() &&
|
|
|
|
( !rThis.IsInTab() || rThis.IsTabFrm() ) &&
|
|
|
|
rAttrs.GetKeep().GetValue() );
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !bCheckIfLastRowShouldKeep || rThis.IsTabFrm(),
|
|
|
|
"IsKeep with bCheckIfLastRowShouldKeep should only be used for tabfrms" );
|
2006-05-16 15:08:29 +00:00
|
|
|
|
2004-01-13 12:13:45 +00:00
|
|
|
// Ignore keep attribute if there are break situations:
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( bKeep )
|
|
|
|
{
|
2006-03-09 13:07:10 +00:00
|
|
|
switch ( rAttrs.GetBreak().GetBreak() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
case SVX_BREAK_COLUMN_AFTER:
|
|
|
|
case SVX_BREAK_COLUMN_BOTH:
|
|
|
|
case SVX_BREAK_PAGE_AFTER:
|
|
|
|
case SVX_BREAK_PAGE_BOTH:
|
2006-03-09 13:07:10 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
bKeep = sal_False;
|
2006-03-09 13:07:10 +00:00
|
|
|
}
|
2007-09-27 08:01:58 +00:00
|
|
|
default: break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if ( bKeep )
|
|
|
|
{
|
|
|
|
SwFrm *pNxt;
|
|
|
|
if( 0 != (pNxt = rThis.FindNextCnt()) &&
|
2012-02-12 22:02:55 +01:00
|
|
|
(!m_pFollow || pNxt != m_pFollow->GetFrm()))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-04-18 12:37:38 -03:00
|
|
|
// #135914#
|
2006-05-16 15:08:29 +00:00
|
|
|
// The last row of a table only keeps with the next content
|
|
|
|
// it they are in the same section:
|
|
|
|
if ( bCheckIfLastRowShouldKeep )
|
2002-11-13 08:40:43 +00:00
|
|
|
{
|
2006-05-16 15:08:29 +00:00
|
|
|
const SwSection* pThisSection = 0;
|
|
|
|
const SwSection* pNextSection = 0;
|
|
|
|
const SwSectionFrm* pThisSectionFrm = rThis.FindSctFrm();
|
|
|
|
const SwSectionFrm* pNextSectionFrm = pNxt->FindSctFrm();
|
2002-11-13 08:40:43 +00:00
|
|
|
|
2006-05-16 15:08:29 +00:00
|
|
|
if ( pThisSectionFrm )
|
|
|
|
pThisSection = pThisSectionFrm->GetSection();
|
2002-11-13 08:40:43 +00:00
|
|
|
|
2006-05-16 15:08:29 +00:00
|
|
|
if ( pNextSectionFrm )
|
|
|
|
pNextSection = pNextSectionFrm->GetSection();
|
|
|
|
|
|
|
|
if ( pThisSection != pNextSection )
|
2011-01-17 15:06:54 +01:00
|
|
|
bKeep = sal_False;
|
2006-05-16 15:08:29 +00:00
|
|
|
}
|
2002-11-13 08:40:43 +00:00
|
|
|
|
2006-05-16 15:08:29 +00:00
|
|
|
if ( bKeep )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2006-05-16 15:08:29 +00:00
|
|
|
const SwAttrSet* pSet = NULL;
|
|
|
|
|
|
|
|
if ( pNxt->IsInTab() )
|
|
|
|
{
|
|
|
|
SwTabFrm* pTab = pNxt->FindTabFrm();
|
|
|
|
if ( ! rThis.IsInTab() || rThis.FindTabFrm() != pTab )
|
|
|
|
pSet = &pTab->GetFmt()->GetAttrSet();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! pSet )
|
|
|
|
pSet = pNxt->GetAttrSet();
|
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pSet, "No AttrSet to check keep attribute" );
|
2006-05-16 15:08:29 +00:00
|
|
|
|
|
|
|
if ( pSet->GetPageDesc().GetPageDesc() )
|
2011-01-17 15:06:54 +01:00
|
|
|
bKeep = sal_False;
|
2006-05-16 15:08:29 +00:00
|
|
|
else switch ( pSet->GetBreak().GetBreak() )
|
|
|
|
{
|
|
|
|
case SVX_BREAK_COLUMN_BEFORE:
|
|
|
|
case SVX_BREAK_COLUMN_BOTH:
|
|
|
|
case SVX_BREAK_PAGE_BEFORE:
|
|
|
|
case SVX_BREAK_PAGE_BOTH:
|
2011-01-17 15:06:54 +01:00
|
|
|
bKeep = sal_False;
|
2007-09-27 08:01:58 +00:00
|
|
|
default: break;
|
2006-05-16 15:08:29 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bKeep;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::BwdMoveNecessary()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// The return value helps deciding whether we need to flow back (3),
|
|
|
|
// or whether we can use the good old WouldFit (0, 1), or if
|
|
|
|
// it's reasonable to relocate and test-format (2).
|
|
|
|
//
|
|
|
|
// Bit 1 in this case means that there are objects anchored to myself,
|
2012-04-04 14:46:35 +02:00
|
|
|
// bit 2 means that I have to evade other objects.
|
2012-04-04 09:42:32 +02:00
|
|
|
|
2012-04-04 14:46:35 +02:00
|
|
|
// If a SurroundObj that desires to be wrapped around overlaps with the
|
|
|
|
// Rect, it's required to flow (because we can't guess the relationships).
|
2012-04-04 09:42:32 +02:00
|
|
|
// However it's possible for a test formatting to happen.
|
2012-04-04 14:46:35 +02:00
|
|
|
// If the SurroundObj is a Fly and I'm a Lower, or the Fly is a Lower of
|
2012-04-04 09:42:32 +02:00
|
|
|
// mine, then it doesn't matter.
|
|
|
|
// If the SurroundObj is anchored in a character bound Fly, and I'm not
|
|
|
|
// a Lower of that character bound Fly myself, then the Fly doesn't matter.
|
|
|
|
|
2012-04-04 14:46:35 +02:00
|
|
|
// #32639# If the object is anchored with me, i can ignore it, because
|
|
|
|
// it's likely that it will follow me with the flow. A test formatting is
|
|
|
|
// not allowed in that case, however!
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nRet = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFlowFrm *pTmp = this;
|
|
|
|
do
|
2012-04-04 09:42:32 +02:00
|
|
|
{ // If there are objects hanging either on me or on a follow, we can't
|
|
|
|
// do a test formatting, because paragraph bound objects wouldn't
|
|
|
|
// be properly considered, and character bound objects shouldn't
|
2012-04-04 14:46:35 +02:00
|
|
|
// be test formatted at all.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pTmp->GetFrm()->GetDrawObjs() )
|
|
|
|
nRet = 1;
|
|
|
|
pTmp = pTmp->GetFollow();
|
|
|
|
} while ( !nRet && pTmp );
|
|
|
|
if ( pPage->GetSortedObjs() )
|
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i28701# - new type <SwSortedObjs>
|
2004-08-02 13:08:38 +00:00
|
|
|
const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nIndex = ULONG_MAX;
|
|
|
|
for ( sal_uInt16 i = 0; nRet < 3 && i < rObjs.Count(); ++i )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i28701# - consider changed type of
|
2004-08-02 13:08:38 +00:00
|
|
|
// <SwSortedObjs> entries.
|
|
|
|
SwAnchoredObject* pObj = rObjs[i];
|
|
|
|
const SwFrmFmt& rFmt = pObj->GetFrmFmt();
|
|
|
|
const SwRect aRect( pObj->GetObjRect() );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( aRect.IsOver( rRect ) &&
|
2004-08-02 13:08:38 +00:00
|
|
|
rFmt.GetSurround().GetSurround() != SURROUND_THROUGHT )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
if( rThis.IsLayoutFrm() && //Fly Lower of This?
|
2004-08-02 13:08:38 +00:00
|
|
|
Is_Lower_Of( &rThis, pObj->GetDrawObj() ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
continue;
|
2004-08-02 13:08:38 +00:00
|
|
|
if( pObj->ISA(SwFlyFrm) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-08-02 13:08:38 +00:00
|
|
|
const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pObj);
|
2012-04-04 09:42:32 +02:00
|
|
|
if ( pFly->IsAnLower( &rThis ) )//This Lower of Fly?
|
2000-09-18 23:08:29 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:08:38 +00:00
|
|
|
const SwFrm* pAnchor = pObj->GetAnchorFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pAnchor == &rThis )
|
|
|
|
{
|
|
|
|
nRet |= 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// Don't do this if the object is anchored behind me in the text
|
2012-04-04 14:46:35 +02:00
|
|
|
// flow, because then I wouldn't evade it.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( ::IsFrmInSameKontext( pAnchor, &rThis ) )
|
|
|
|
{
|
2010-01-05 16:37:41 +01:00
|
|
|
if ( rFmt.GetAnchor().GetAnchorId() == FLY_AT_PARA )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// The index of the other one can be retrieved using the anchor attribute.
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nTmpIndex = rFmt.GetAnchor().GetCntntAnchor()->nNode.GetIndex();
|
2012-04-04 09:42:32 +02:00
|
|
|
// Now we're going to check whether the current paragraph before
|
|
|
|
// the anchor of the displacing object sits in the text. If this
|
2012-04-04 14:46:35 +02:00
|
|
|
// is the case, we don't try to evade it.
|
2012-04-04 09:42:32 +02:00
|
|
|
// The index is being determined via SwFmtAnchor, because it's
|
|
|
|
// getting quite expensive otherwise.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( ULONG_MAX == nIndex )
|
|
|
|
{
|
|
|
|
const SwNode *pNode;
|
|
|
|
if ( rThis.IsCntntFrm() )
|
|
|
|
pNode = ((SwCntntFrm&)rThis).GetNode();
|
|
|
|
else if( rThis.IsSctFrm() )
|
|
|
|
pNode = ((SwSectionFmt*)((SwSectionFrm&)rThis).
|
|
|
|
GetFmt())->GetSectionNode();
|
|
|
|
else
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( rThis.IsTabFrm(), "new FowFrm?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
pNode = ((SwTabFrm&)rThis).GetTable()->
|
|
|
|
GetTabSortBoxes()[0]->GetSttNd()->FindTableNode();
|
|
|
|
}
|
|
|
|
nIndex = pNode->GetIndex();
|
|
|
|
}
|
|
|
|
if( nIndex < nTmpIndex )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
|
|
|
|
nRet |= 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::CutTree(), PasteTree(), MoveSubTree()
|
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description A specialized form of Cut() and Paste(), which
|
|
|
|
|* relocates a whole chain (this and the following, in particular).
|
|
|
|
|* During this process, only the minimum operations and notifications
|
|
|
|
|* are done.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// Cut the Start and all the neighbours; they are chained together and
|
|
|
|
// a handle to the first one is returned. Residuals are invalidated
|
|
|
|
// as appropriate.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwLayoutFrm *pLay = pStart->GetUpper();
|
|
|
|
if ( pLay->IsInFtn() )
|
|
|
|
pLay = pLay->FindFtnFrm();
|
2006-05-24 12:54:43 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i58846#
|
2006-05-24 12:54:43 +00:00
|
|
|
// <pPrepare( PREP_QUOVADIS )> only for frames in footnotes
|
|
|
|
if( pStart->IsInFtn() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SwFrm* pTmp = pStart->GetIndPrev();
|
|
|
|
if( pTmp )
|
|
|
|
pTmp->Prepare( PREP_QUOVADIS );
|
|
|
|
}
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// Just cut quickly and take care that we don't cause problems with the
|
|
|
|
// left-behinds. The pointers of the chain being cut can point who-knows where.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pStart == pStart->GetUpper()->Lower() )
|
|
|
|
pStart->GetUpper()->pLower = 0;
|
|
|
|
if ( pStart->GetPrev() )
|
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
pStart->GetPrev()->mpNext = 0;
|
|
|
|
pStart->mpPrev = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pLay->IsFtnFrm() )
|
2009-04-27 15:45:01 +00:00
|
|
|
{
|
|
|
|
if ( !pLay->Lower() && !pLay->IsColLocked() &&
|
2001-08-17 11:22:48 +00:00
|
|
|
!((SwFtnFrm*)pLay)->IsBackMoveLocked() )
|
2009-04-27 15:45:01 +00:00
|
|
|
{
|
|
|
|
pLay->Cut();
|
2000-09-18 23:08:29 +00:00
|
|
|
delete pLay;
|
|
|
|
}
|
|
|
|
else
|
2009-04-27 15:45:01 +00:00
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked();
|
2001-08-17 11:22:48 +00:00
|
|
|
((SwFtnFrm*)pLay)->LockBackMove();
|
2000-09-18 23:08:29 +00:00
|
|
|
pLay->InvalidateSize();
|
|
|
|
pLay->Calc();
|
|
|
|
SwCntntFrm *pCnt = pLay->ContainsCntnt();
|
|
|
|
while ( pCnt && pLay->IsAnLower( pCnt ) )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// It's possible for the CntFrm to be locked, and we don't want
|
2012-04-04 14:46:35 +02:00
|
|
|
// to end up in an endless page migration, so we're not even
|
2012-04-04 09:42:32 +02:00
|
|
|
// going to call Calc!
|
|
|
|
OSL_ENSURE( pCnt->IsTxtFrm(), "The Graphic has landed." );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( ((SwTxtFrm*)pCnt)->IsLocked() ||
|
|
|
|
((SwTxtFrm*)pCnt)->GetFollow() == pStart )
|
|
|
|
break;
|
|
|
|
pCnt->Calc();
|
|
|
|
pCnt = pCnt->GetNextCntntFrm();
|
|
|
|
}
|
2001-08-17 11:22:48 +00:00
|
|
|
if( bUnlock )
|
|
|
|
((SwFtnFrm*)pLay)->UnlockBackMove();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
pLay = 0;
|
|
|
|
}
|
|
|
|
return pLay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling,
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFrm *pOldParent )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
//returns sal_True if there's a LayoutFrm in the chain.
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bRet = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 14:46:35 +02:00
|
|
|
// The chain beginning with pStart is inserted before pSibling
|
2012-04-04 09:42:32 +02:00
|
|
|
// under the parent. We take care to invalidate as required.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// I'm receiving a finished chain. We need to update the pointers for
|
|
|
|
// the beginning of the chain, then all the uppers and finally the end.
|
|
|
|
// On the way there, we invalidate as required.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pSibling )
|
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
if ( 0 != (pStart->mpPrev = pSibling->GetPrev()) )
|
|
|
|
pStart->GetPrev()->mpNext = pStart;
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
pParent->pLower = pStart;
|
|
|
|
pSibling->_InvalidatePos();
|
|
|
|
pSibling->_InvalidatePrt();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
if ( 0 == (pStart->mpPrev = pParent->Lower()) )
|
2000-09-18 23:08:29 +00:00
|
|
|
pParent->pLower = pStart;
|
|
|
|
else
|
2009-04-27 15:45:01 +00:00
|
|
|
//Modified for #i100782#,04/03/2009
|
2009-12-31 10:59:35 +01:00
|
|
|
//If the pParent has more than 1 child nodes, former design will
|
|
|
|
//ignore them directly without any collection work. It will make some
|
|
|
|
//dangling pointers. This lead the crash...
|
|
|
|
//The new design will find the last child of pParent in loop way, and
|
2009-04-27 15:45:01 +00:00
|
|
|
//add the pStart after the last child.
|
|
|
|
// pParent->Lower()->pNext = pStart;
|
|
|
|
{
|
|
|
|
SwFrm* pTemp = pParent->pLower;
|
|
|
|
while (pTemp)
|
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
if (pTemp->mpNext)
|
|
|
|
pTemp = pTemp->mpNext;
|
2009-04-27 15:45:01 +00:00
|
|
|
else
|
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
pStart->mpPrev = pTemp;
|
|
|
|
pTemp->mpNext = pStart;
|
2009-04-27 15:45:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//End modification for #i100782#,04/03/2009
|
2004-06-04 07:44:36 +00:00
|
|
|
|
|
|
|
// #i27145#
|
|
|
|
if ( pParent->IsSctFrm() )
|
|
|
|
{
|
|
|
|
// We have no sibling because pParent is a section frame and
|
|
|
|
// has just been created to contain some content. The printing
|
|
|
|
// area of the frame behind pParent has to be invalidated, so
|
|
|
|
// that the correct distance between pParent and the next frame
|
|
|
|
// can be calculated.
|
|
|
|
pParent->InvalidateNextPrtArea();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
SwFrm *pFloat = pStart;
|
2007-09-27 08:01:58 +00:00
|
|
|
SwFrm *pLst = 0;
|
2001-10-05 11:36:10 +00:00
|
|
|
SWRECTFN( pParent )
|
2000-09-18 23:08:29 +00:00
|
|
|
SwTwips nGrowVal = 0;
|
|
|
|
do
|
2013-02-09 11:35:20 +01:00
|
|
|
{ pFloat->mpUpper = pParent;
|
2000-09-18 23:08:29 +00:00
|
|
|
pFloat->_InvalidateAll();
|
2001-11-14 15:08:34 +00:00
|
|
|
pFloat->CheckDirChange();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// I'm a friend of the TxtFrm and thus am allowed to do many things.
|
|
|
|
// The CacheIdx idea seems to be a bit risky!
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pFloat->IsTxtFrm() )
|
|
|
|
{
|
|
|
|
if ( ((SwTxtFrm*)pFloat)->GetCacheIdx() != USHRT_MAX )
|
2012-04-04 09:42:32 +02:00
|
|
|
((SwTxtFrm*)pFloat)->Init(); // I'm his friend.
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
2011-01-17 15:06:54 +01:00
|
|
|
bRet = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-10-05 11:36:10 +00:00
|
|
|
nGrowVal += (pFloat->Frm().*fnRect->fnGetHeight)();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pFloat->GetNext() )
|
|
|
|
pFloat = pFloat->GetNext();
|
|
|
|
else
|
2004-06-04 07:44:36 +00:00
|
|
|
{
|
|
|
|
pLst = pFloat;
|
2000-09-18 23:08:29 +00:00
|
|
|
pFloat = 0;
|
|
|
|
}
|
|
|
|
} while ( pFloat );
|
|
|
|
|
|
|
|
if ( pSibling )
|
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
pLst->mpNext = pSibling;
|
|
|
|
pSibling->mpPrev = pLst;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSibling->IsInFtn() )
|
|
|
|
{
|
|
|
|
if( pSibling->IsSctFrm() )
|
|
|
|
pSibling = ((SwSectionFrm*)pSibling)->ContainsAny();
|
|
|
|
if( pSibling )
|
|
|
|
pSibling->Prepare( PREP_ERGOSUM );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( nGrowVal )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
if ( pOldParent && pOldParent->IsBodyFrm() ) // For variable page height while browsing
|
2007-02-28 14:47:32 +00:00
|
|
|
pOldParent->Shrink( nGrowVal );
|
|
|
|
pParent->Grow( nGrowVal );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pParent->IsFtnFrm() )
|
|
|
|
((SwFtnFrm*)pParent)->InvalidateNxtFtnCnts( pParent->FindPageFrm() );
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
OSL_ENSURE( pParent, "No parent given." );
|
|
|
|
OSL_ENSURE( rThis.GetUpper(), "Where are we coming from?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// Be economical with notifications if an action is running.
|
2010-06-13 15:22:56 +02:00
|
|
|
ViewShell *pSh = rThis.getRootFrm()->GetCurrShell();
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwViewImp *pImp = pSh ? pSh->Imp() : 0;
|
2012-11-25 21:47:12 +09:00
|
|
|
const bool bComplete = pImp && pImp->IsAction() && pImp->GetLayAction().IsComplete();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( !bComplete )
|
|
|
|
{
|
|
|
|
SwFrm *pPre = rThis.GetIndPrev();
|
|
|
|
if ( pPre )
|
|
|
|
{
|
|
|
|
pPre->SetRetouche();
|
2011-04-16 22:42:13 -03:00
|
|
|
// #115759# - follow-up of #i26250#
|
2004-12-23 09:07:01 +00:00
|
|
|
// invalidate printing area of previous frame, if it's in a table
|
2006-03-09 13:07:10 +00:00
|
|
|
if ( pPre->GetUpper()->IsInTab() )
|
2004-12-23 09:07:01 +00:00
|
|
|
{
|
|
|
|
pPre->_InvalidatePrt();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
pPre->InvalidatePage();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ rThis.GetUpper()->SetCompletePaint();
|
|
|
|
rThis.GetUpper()->InvalidatePage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwPageFrm *pOldPage = rThis.FindPageFrm();
|
|
|
|
|
|
|
|
SwLayoutFrm *pOldParent = CutTree( &rThis );
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_Bool bInvaLay = PasteTree( &rThis, pParent, pSibling, pOldParent );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// If, by cutting & pasting, an empty SectionFrm came into existence, it should
|
|
|
|
// disappear automatically.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwSectionFrm *pSct;
|
2011-04-18 12:37:38 -03:00
|
|
|
// #126020# - adjust check for empty section
|
|
|
|
// #130797# - correct fix #126020#
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pOldParent && !pOldParent->Lower() &&
|
2006-02-06 15:30:31 +00:00
|
|
|
( pOldParent->IsInSct() &&
|
|
|
|
!(pSct = pOldParent->FindSctFrm())->ContainsCntnt() &&
|
|
|
|
!pSct->ContainsAny( true ) ) )
|
2006-01-27 13:35:52 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
pSct->DelEmpty( sal_False );
|
2006-01-27 13:35:52 +00:00
|
|
|
}
|
2004-06-01 06:44:04 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// If we're in a column section, we'd rather not call Calc "from below"
|
2004-06-01 06:44:04 +00:00
|
|
|
if( !rThis.IsInSct() &&
|
|
|
|
( !rThis.IsInTab() || ( rThis.IsTabFrm() && !rThis.GetUpper()->IsInTab() ) ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
rThis.GetUpper()->Calc();
|
|
|
|
else if( rThis.GetUpper()->IsSctFrm() )
|
|
|
|
{
|
2007-09-27 08:01:58 +00:00
|
|
|
SwSectionFrm* pTmpSct = (SwSectionFrm*)rThis.GetUpper();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bOld = pTmpSct->IsCntntLocked();
|
|
|
|
pTmpSct->SetCntntLock( sal_True );
|
2007-09-27 08:01:58 +00:00
|
|
|
pTmpSct->Calc();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !bOld )
|
2011-01-17 15:06:54 +01:00
|
|
|
pTmpSct->SetCntntLock( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
SwPageFrm *pPage = rThis.FindPageFrm();
|
|
|
|
|
|
|
|
if ( pOldPage != pPage )
|
|
|
|
{
|
|
|
|
rThis.InvalidatePage( pPage );
|
|
|
|
if ( rThis.IsLayoutFrm() )
|
|
|
|
{
|
|
|
|
SwCntntFrm *pCnt = ((SwLayoutFrm*)&rThis)->ContainsCntnt();
|
|
|
|
if ( pCnt )
|
|
|
|
pCnt->InvalidatePage( pPage );
|
|
|
|
}
|
2000-10-30 15:22:11 +00:00
|
|
|
else if ( pSh && pSh->GetDoc()->GetLineNumberInfo().IsRestartEachPage()
|
|
|
|
&& pPage->FindFirstBodyCntnt() == &rThis )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
rThis._InvalidateLineNum();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( bInvaLay || (pSibling && pSibling->IsLayoutFrm()) )
|
|
|
|
rThis.GetUpper()->InvalidatePage( pPage );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::IsAnFollow()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::IsAnFollow( const SwFlowFrm *pAssumed ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwFlowFrm *pFoll = this;
|
|
|
|
do
|
|
|
|
{ if ( pAssumed == pFoll )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
pFoll = pFoll->GetFollow();
|
|
|
|
} while ( pFoll );
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::FindMaster()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2004-01-13 12:13:45 +00:00
|
|
|
SwTxtFrm* SwCntntFrm::FindMaster() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( IsFollow(), "SwCntntFrm::FindMaster(): !IsFollow" );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-04-07 12:23:51 +02:00
|
|
|
const SwCntntFrm* pPrec = GetPrecede();
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2011-04-07 12:23:51 +02:00
|
|
|
if ( pPrec && pPrec->HasFollow() && pPrec->GetFollow() == this )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-04-07 12:23:51 +02:00
|
|
|
OSL_ENSURE( pPrec->IsTxtFrm(), "NoTxtFrm with follow found" );
|
|
|
|
return ( SwTxtFrm* )pPrec;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2002-08-07 14:52:50 +00:00
|
|
|
|
2011-03-19 14:13:18 +01:00
|
|
|
OSL_FAIL( "Follow ist lost in Space." );
|
2004-01-13 12:13:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-08-07 14:52:50 +00:00
|
|
|
|
2004-01-13 12:13:45 +00:00
|
|
|
SwSectionFrm* SwSectionFrm::FindMaster() const
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( IsFollow(), "SwSectionFrm::FindMaster(): !IsFollow" );
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
SwIterator<SwSectionFrm,SwFmt> aIter( *pSection->GetFmt() );
|
|
|
|
SwSectionFrm* pSect = aIter.First();
|
|
|
|
while ( pSect )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-01-13 12:13:45 +00:00
|
|
|
if( pSect->GetFollow() == this )
|
|
|
|
return pSect;
|
2010-12-17 09:02:23 +01:00
|
|
|
pSect = aIter.Next();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-03-19 14:13:18 +01:00
|
|
|
OSL_FAIL( "Follow ist lost in Space." );
|
2004-01-13 12:13:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( IsFollow(), "SwTabFrm::FindMaster(): !IsFollow" );
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
SwIterator<SwTabFrm,SwFmt> aIter( *GetTable()->GetFrmFmt() );
|
|
|
|
SwTabFrm* pTab = aIter.First();
|
|
|
|
while ( pTab )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-01-13 12:13:45 +00:00
|
|
|
if ( bFirstMaster )
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Optimization. This makes code like this obsolete:
|
|
|
|
// while ( pTab->IsFollow() )
|
|
|
|
// pTab = pTab->FindMaster();
|
|
|
|
//
|
|
|
|
if ( !pTab->IsFollow() )
|
|
|
|
{
|
|
|
|
SwTabFrm* pNxt = pTab;
|
|
|
|
while ( pNxt )
|
|
|
|
{
|
|
|
|
if ( pNxt->GetFollow() == this )
|
|
|
|
return pTab;
|
|
|
|
pNxt = pNxt->GetFollow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pTab->GetFollow() == this )
|
|
|
|
return pTab;
|
|
|
|
}
|
2010-12-17 09:02:23 +01:00
|
|
|
|
|
|
|
pTab = aIter.Next();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2011-03-19 14:13:18 +01:00
|
|
|
OSL_FAIL( "Follow ist lost in Space." );
|
2000-09-18 23:08:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFrm::GetLeaf()
|
|
|
|
|*
|
2012-04-04 14:46:35 +02:00
|
|
|
|* Description Returns the next/previous Layout leaf that's NOT below
|
|
|
|
|* this (or even is this itself). Also, that leaf must be in the same
|
2012-04-04 09:42:32 +02:00
|
|
|
|* text flow as the pAnch origin frm (Body, Ftn)
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, sal_Bool bFwd,
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm *pAnch ) const
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// No flow, no joy...
|
2004-01-13 12:13:45 +00:00
|
|
|
if ( !(IsInDocBody() || IsInFtn() || IsInFly()) )
|
2000-09-18 23:08:29 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
const SwFrm *pLeaf = this;
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bFound = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{ pLeaf = ((SwFrm*)pLeaf)->GetLeaf( eMakePage, bFwd );
|
|
|
|
|
|
|
|
if ( pLeaf &&
|
|
|
|
(!IsLayoutFrm() || !((SwLayoutFrm*)this)->IsAnLower( pLeaf )))
|
|
|
|
{
|
|
|
|
if ( pAnch->IsInDocBody() == pLeaf->IsInDocBody() &&
|
|
|
|
pAnch->IsInFtn() == pLeaf->IsInFtn() )
|
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bFound = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} while ( !bFound && pLeaf );
|
|
|
|
|
|
|
|
return (const SwLayoutFrm*)pLeaf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFrm::GetLeaf()
|
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description calls Get[Next|Prev]Leaf
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, sal_Bool bFwd )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if ( IsInFtn() )
|
|
|
|
return bFwd ? GetNextFtnLeaf( eMakePage ) : GetPrevFtnLeaf( eMakePage );
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i53323#
|
2005-09-28 10:11:17 +00:00
|
|
|
// A frame could be inside a table AND inside a section.
|
|
|
|
// Thus, it has to be determined, which is the first parent.
|
|
|
|
bool bInTab( IsInTab() );
|
|
|
|
bool bInSct( IsInSct() );
|
|
|
|
if ( bInTab && bInSct )
|
|
|
|
{
|
|
|
|
const SwFrm* pUpperFrm( GetUpper() );
|
|
|
|
while ( pUpperFrm )
|
|
|
|
{
|
|
|
|
if ( pUpperFrm->IsTabFrm() )
|
|
|
|
{
|
|
|
|
// the table is the first.
|
|
|
|
bInSct = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if ( pUpperFrm->IsSctFrm() )
|
|
|
|
{
|
|
|
|
// the section is the first.
|
|
|
|
bInTab = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pUpperFrm = pUpperFrm->GetUpper();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bInTab && ( !IsTabFrm() || GetUpper()->IsCellFrm() ) ) // TABLE IN TABLE
|
2004-01-13 12:13:45 +00:00
|
|
|
return bFwd ? GetNextCellLeaf( eMakePage ) : GetPrevCellLeaf( eMakePage );
|
|
|
|
|
2005-09-28 10:11:17 +00:00
|
|
|
if ( bInSct )
|
2000-09-18 23:08:29 +00:00
|
|
|
return bFwd ? GetNextSctLeaf( eMakePage ) : GetPrevSctLeaf( eMakePage );
|
2004-01-13 12:13:45 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
return bFwd ? GetNextLeaf( eMakePage ) : GetPrevLeaf( eMakePage );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFrm::WrongPageDesc( SwPageFrm* pNew )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// Now it's getting a bit complicated:
|
|
|
|
//
|
|
|
|
// Maybe i'm bringing a Pagedesc myself; in that case,
|
|
|
|
// the pagedesc of the next page needs to correspond.
|
|
|
|
// Otherwise, I'll have to dig a bit deeper to see where
|
|
|
|
// the following Pagedesc is coming from.
|
|
|
|
// If the following page itself tells me that it's pagedesc
|
|
|
|
// is wrong, I can happily exchange it.
|
|
|
|
// If the page however thinks that it's pagedesc is correct,
|
|
|
|
// this doesn't mean it's useful to me:
|
|
|
|
// If the first BodyCntnt asks for a PageDesc or a PageBreak,
|
|
|
|
// I'll have to insert a new page - except the desired page is
|
|
|
|
// the correct one.
|
|
|
|
// If I inserted a new page, the problems only get started:
|
|
|
|
// because then it's likely for the next page to have been
|
|
|
|
// wrong and having been swapped because of that.
|
|
|
|
// This in turn means that I have a new (and correct) page,
|
2012-04-04 14:46:35 +02:00
|
|
|
// but the conditions to swap still apply.
|
2012-04-04 09:42:32 +02:00
|
|
|
// Way out of the situation: Try to preliminarily insert a
|
|
|
|
// new page once (empty pages are already inserted by InsertPage()
|
|
|
|
// if required)
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFmtPageDesc &rFmtDesc = GetAttrSet()->GetPageDesc();
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
//My Pagedesc doesn't count if I'm a follow!
|
2000-09-18 23:08:29 +00:00
|
|
|
SwPageDesc *pDesc = 0;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nTmp = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( this );
|
|
|
|
if ( !pFlow || !pFlow->IsFollow() )
|
2001-03-02 09:47:13 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
pDesc = (SwPageDesc*)rFmtDesc.GetPageDesc();
|
2001-03-02 09:47:13 +00:00
|
|
|
if( pDesc )
|
|
|
|
{
|
|
|
|
if( !pDesc->GetRightFmt() )
|
|
|
|
nTmp = 2;
|
|
|
|
else if( !pDesc->GetLeftFmt() )
|
|
|
|
nTmp = 1;
|
|
|
|
else if( rFmtDesc.GetNumOffset() )
|
|
|
|
nTmp = rFmtDesc.GetNumOffset();
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// Does the Cntnt bring a Pagedesc or do we need the
|
|
|
|
// virtual page number of the new layout leaf?
|
|
|
|
// PageDesc isn't allowed with Follows
|
2012-10-07 12:32:00 +02:00
|
|
|
const sal_Bool bOdd = nTmp ? ( (nTmp % 2) ? sal_True : sal_False )
|
2001-03-02 09:47:13 +00:00
|
|
|
: pNew->OnRightPage();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !pDesc )
|
|
|
|
pDesc = pNew->FindPageDesc();
|
2012-07-09 13:12:10 +02:00
|
|
|
|
2012-07-09 14:46:40 +02:00
|
|
|
bool bFirst = pNew->OnFirstPage();
|
2012-07-09 13:12:10 +02:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFlowFrm *pNewFlow = pNew->FindFirstBodyCntnt();
|
2012-04-04 09:42:32 +02:00
|
|
|
// Did we find ourselves?
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pNewFlow == pFlow )
|
|
|
|
pNewFlow = NULL;
|
|
|
|
if ( pNewFlow && pNewFlow->GetFrm()->IsInTab() )
|
|
|
|
pNewFlow = pNewFlow->GetFrm()->FindTabFrm();
|
|
|
|
const SwPageDesc *pNewDesc= ( pNewFlow && !pNewFlow->IsFollow() )
|
2012-10-07 12:32:00 +02:00
|
|
|
? pNewFlow->GetFrm()->GetAttrSet()->GetPageDesc().GetPageDesc() : 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
return ( pNew->GetPageDesc() != pDesc || // own desc ?
|
2012-07-09 13:12:10 +02:00
|
|
|
pNew->GetFmt() != (bFirst ? pDesc->GetFirstFmt() : (bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt())) ||
|
2000-09-18 23:08:29 +00:00
|
|
|
( pNewDesc && pNewDesc == pDesc ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFrm::GetNextLeaf()
|
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description Returns the next layout leaf in which we can move
|
|
|
|
|* the frame.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !IsInFtn(), "GetNextLeaf(), don't call me for Ftn." );
|
|
|
|
OSL_ENSURE( !IsInSct(), "GetNextLeaf(), don't call me for Sections." );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-11-17 19:04:02 +09:00
|
|
|
const bool bBody = IsInDocBody(); // If I'm coming from the DocBody,
|
2012-04-04 09:42:32 +02:00
|
|
|
// I want to end up in the body.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// It doesn't make sense to insert pages, as we only want to search the
|
|
|
|
// chain.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( IsInFly() )
|
|
|
|
eMakePage = MAKEPAGE_NONE;
|
2004-01-07 15:33:16 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// For tables, we just take the big leap. A simple GetNext would
|
|
|
|
// iterate through the first cells and, in turn, all other cells.
|
2004-01-07 15:33:16 +00:00
|
|
|
SwLayoutFrm *pLayLeaf = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( IsTabFrm() )
|
2004-01-07 15:33:16 +00:00
|
|
|
{
|
|
|
|
SwCntntFrm* pTmp = ((SwTabFrm*)this)->FindLastCntnt();
|
|
|
|
if ( pTmp )
|
|
|
|
pLayLeaf = pTmp->GetUpper();
|
|
|
|
}
|
2004-01-13 12:13:45 +00:00
|
|
|
if ( !pLayLeaf )
|
2000-09-18 23:08:29 +00:00
|
|
|
pLayLeaf = GetNextLayoutLeaf();
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
SwLayoutFrm *pOldLayLeaf = 0; // Make sure that we don't have to
|
|
|
|
// start searching from top when we
|
|
|
|
// have a freshly created page.
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bNewPg = false; // Only insert a new page once.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-11-25 21:47:12 +09:00
|
|
|
while ( true )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if ( pLayLeaf )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// There's yet another LayoutFrm. Let's see if it's ready to host
|
|
|
|
// me as well.
|
|
|
|
// It only needs to be of the same kind like my starting point
|
|
|
|
// (DocBody or Footnote respectively)
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pLayLeaf->FindPageFrm()->IsFtnPage() )
|
2012-04-04 09:42:32 +02:00
|
|
|
{ // If I ended up at the end note pages, we're done.
|
2000-09-18 23:08:29 +00:00
|
|
|
pLayLeaf = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ( (bBody && !pLayLeaf->IsInDocBody()) || pLayLeaf->IsInTab()
|
|
|
|
|| pLayLeaf->IsInSct() )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// They don't want me! Try again
|
2000-09-18 23:08:29 +00:00
|
|
|
pOldLayLeaf = pLayLeaf;
|
|
|
|
pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
|
|
|
|
continue;
|
|
|
|
}
|
2012-04-04 09:42:32 +02:00
|
|
|
|
|
|
|
// I'm wanted, therefore I'm done. However, it may still be that,
|
|
|
|
// during a page break, the page type isn't the desired one. In that
|
|
|
|
// case we have to insert a page of the correct type.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-03-14 13:16:02 +00:00
|
|
|
if( !IsFlowFrm() && ( eMakePage == MAKEPAGE_NONE ||
|
|
|
|
eMakePage==MAKEPAGE_APPEND || eMakePage==MAKEPAGE_NOSECTION ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
return pLayLeaf;
|
|
|
|
|
|
|
|
SwPageFrm *pNew = pLayLeaf->FindPageFrm();
|
2010-06-13 15:22:56 +02:00
|
|
|
const ViewShell *pSh = getRootFrm()->GetCurrShell();
|
2003-10-30 09:18:32 +00:00
|
|
|
// #111704# The pagedesc check does not make sense for frames in fly frames
|
2005-09-28 10:11:17 +00:00
|
|
|
if ( pNew != FindPageFrm() && !bNewPg && !IsInFly() &&
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i46683#
|
2005-09-28 10:11:17 +00:00
|
|
|
// Do not consider page descriptions in browse mode (since
|
|
|
|
// MoveBwd ignored them)
|
2010-06-13 15:22:56 +02:00
|
|
|
!(pSh && pSh->GetViewOptions()->getBrowseMode() ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( WrongPageDesc( pNew ) )
|
|
|
|
{
|
|
|
|
SwFtnContFrm *pCont = pNew->FindFtnCont();
|
|
|
|
if( pCont )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// If the reference of the first footnote of this page
|
|
|
|
// lies before the page, we'd rather not insert a new page.
|
|
|
|
// (Bug #55620#)
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower();
|
|
|
|
if( pFtn && pFtn->GetRef() )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_uInt16 nRefNum = pNew->GetPhyPageNum();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pFtn->GetRef()->GetPhyPageNum() < nRefNum )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-04-04 09:42:32 +02:00
|
|
|
//Gotcha! The following page is wrong, therefore we need to
|
|
|
|
//insert a new one.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( eMakePage == MAKEPAGE_INSERT )
|
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bNewPg = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwPageFrm *pPg = pOldLayLeaf ?
|
|
|
|
pOldLayLeaf->FindPageFrm() : 0;
|
|
|
|
if ( pPg && pPg->IsEmptyPage() )
|
2012-04-04 09:42:32 +02:00
|
|
|
// Don't insert behind. Insert before the EmptyPage.
|
2000-09-18 23:08:29 +00:00
|
|
|
pPg = (SwPageFrm*)pPg->GetPrev();
|
|
|
|
|
|
|
|
if ( !pPg || pPg == pNew )
|
|
|
|
pPg = FindPageFrm();
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
InsertPage( pPg, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
pLayLeaf = GetNextLayoutLeaf();
|
|
|
|
pOldLayLeaf = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pLayLeaf = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// There's no other matching LayoutFrm, so we have to insert
|
|
|
|
// a new page.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( eMakePage == MAKEPAGE_APPEND || eMakePage == MAKEPAGE_INSERT )
|
|
|
|
{
|
|
|
|
InsertPage(
|
|
|
|
pOldLayLeaf ? pOldLayLeaf->FindPageFrm() : FindPageFrm(),
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// And again from the start.
|
2000-09-18 23:08:29 +00:00
|
|
|
pLayLeaf = pOldLayLeaf ? pOldLayLeaf : GetNextLayoutLeaf();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pLayLeaf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFrm::GetPrevLeaf()
|
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Beschreibung Returns the previous layout leaf where we can move
|
|
|
|
|* the frame.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2007-09-27 08:01:58 +00:00
|
|
|
SwLayoutFrm *SwFrm::GetPrevLeaf( MakePageType )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !IsInFtn(), "GetPrevLeaf(), don't call me for Ftn." );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-11-17 19:04:02 +09:00
|
|
|
const bool bBody = IsInDocBody(); // If I'm coming from the DocBody,
|
2012-04-04 09:42:32 +02:00
|
|
|
// I want to end up in the body.
|
2011-01-17 15:06:54 +01:00
|
|
|
const sal_Bool bFly = IsInFly();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwLayoutFrm *pLayLeaf = GetPrevLayoutLeaf();
|
|
|
|
SwLayoutFrm *pPrevLeaf = 0;
|
|
|
|
|
|
|
|
while ( pLayLeaf )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
if ( pLayLeaf->IsInTab() || // Never go into tables.
|
|
|
|
pLayLeaf->IsInSct() ) // Same goes for sections!
|
2000-09-18 23:08:29 +00:00
|
|
|
pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
|
|
|
|
else if ( bBody && pLayLeaf->IsInDocBody() )
|
|
|
|
{
|
|
|
|
if ( pLayLeaf->Lower() )
|
|
|
|
break;
|
|
|
|
pPrevLeaf = pLayLeaf;
|
|
|
|
pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
|
|
|
|
if ( pLayLeaf )
|
2011-01-17 15:06:54 +01:00
|
|
|
SwFlowFrm::SetMoveBwdJump( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if ( bFly )
|
2012-04-04 09:42:32 +02:00
|
|
|
break; //Cntnts in Flys should accept any layout leaf.
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
|
|
|
|
}
|
|
|
|
return pLayLeaf ? pLayLeaf : pPrevLeaf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::IsPrevObjMove()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::IsPrevObjMove() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
//sal_True The FlowFrm must respect the a border of the predecessor, also needs
|
|
|
|
// to insert a break if required.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
//!!!!!!!!!!!Hack!!!!!!!!!!!
|
2010-06-13 15:22:56 +02:00
|
|
|
const ViewShell *pSh = rThis.getRootFrm()->GetCurrShell();
|
|
|
|
if( pSh && pSh->GetViewOptions()->getBrowseMode() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwFrm *pPre = rThis.FindPrev();
|
|
|
|
|
|
|
|
if ( pPre && pPre->GetDrawObjs() )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( SwFlowFrm::CastFlowFrm( pPre ), "new flowfrm?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( SwFlowFrm::CastFlowFrm( pPre )->IsAnFollow( this ) )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2004-11-16 14:44:46 +00:00
|
|
|
SwLayoutFrm* pPreUp = pPre->GetUpper();
|
2012-04-04 14:46:35 +02:00
|
|
|
// If the upper is a SectionFrm, or a column of a SectionFrm, we're
|
|
|
|
// allowed to protrude out of it. However, we need to respect the
|
|
|
|
// Upper of the SectionFrm.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pPreUp->IsInSct() )
|
|
|
|
{
|
|
|
|
if( pPreUp->IsSctFrm() )
|
|
|
|
pPreUp = pPreUp->GetUpper();
|
|
|
|
else if( pPreUp->IsColBodyFrm() &&
|
|
|
|
pPreUp->GetUpper()->GetUpper()->IsSctFrm() )
|
2003-03-27 14:45:43 +00:00
|
|
|
pPreUp = pPreUp->GetUpper()->GetUpper()->GetUpper();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i26945# - re-factoring
|
2004-11-16 14:44:46 +00:00
|
|
|
// use <GetVertPosOrientFrm()> to determine, if object has followed the
|
|
|
|
// text flow to the next layout frame
|
2011-01-17 15:06:54 +01:00
|
|
|
for ( sal_uInt16 i = 0; i < pPre->GetDrawObjs()->Count(); ++i )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i28701# - consider changed type of
|
2004-08-02 13:08:38 +00:00
|
|
|
// <SwSortedObjs> entries.
|
|
|
|
const SwAnchoredObject* pObj = (*pPre->GetDrawObjs())[i];
|
2004-11-16 14:44:46 +00:00
|
|
|
// OD 2004-01-20 #110582# - do not consider hidden objects
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i26945# - do not consider object, which
|
2004-11-16 14:44:46 +00:00
|
|
|
// doesn't follow the text flow.
|
|
|
|
if ( pObj->GetFrmFmt().GetDoc()->IsVisibleLayerId(
|
|
|
|
pObj->GetDrawObj()->GetLayer() ) &&
|
|
|
|
pObj->GetFrmFmt().GetFollowTextFlow().GetValue() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-11-16 14:44:46 +00:00
|
|
|
const SwLayoutFrm* pVertPosOrientFrm = pObj->GetVertPosOrientFrm();
|
|
|
|
if ( pVertPosOrientFrm &&
|
|
|
|
pPreUp != pVertPosOrientFrm &&
|
|
|
|
!pPreUp->IsAnLower( pVertPosOrientFrm ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2011-01-17 15:06:54 +01:00
|
|
|
|* sal_Bool SwFlowFrm::IsPageBreak()
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description If there's a hard page break before the Frm AND there's a
|
|
|
|
|* predecessor on the same page, sal_True is returned (we need to create a
|
|
|
|
|* new PageBreak). Otherwise, returns sal_False.
|
|
|
|
|* If bAct is set to sal_True, this function returns sal_True if
|
|
|
|
|* there's a PageBreak.
|
|
|
|
|* Of course, we don't evaluate the hard page break for follows.
|
|
|
|
|* The page break is in it's own FrmFmt (BEFORE) or in the FrmFmt of the
|
|
|
|
|* predecessor (AFTER). If there's no predecessor on the page, we don't
|
|
|
|
|* need to think further.
|
|
|
|
|* Also, a page break (or the need for one) is also present if
|
2012-04-04 14:46:35 +02:00
|
|
|
|* the FrmFmt contains a PageDesc.
|
2012-04-04 09:42:32 +02:00
|
|
|
|* The implementation works only on CntntFrms! - the definition
|
|
|
|
|* of the predecessor is not clear for LayoutFrms.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::IsPageBreak( sal_Bool bAct ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if ( !IsFollow() && rThis.IsInDocBody() &&
|
2010-06-13 15:22:56 +02:00
|
|
|
( !rThis.IsInTab() || ( rThis.IsTabFrm() && !rThis.GetUpper()->IsInTab() ) ) ) // i66968
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-06-13 15:22:56 +02:00
|
|
|
const ViewShell *pSh = rThis.getRootFrm()->GetCurrShell();
|
|
|
|
if( pSh && pSh->GetViewOptions()->getBrowseMode() )
|
2011-02-09 19:07:37 +01:00
|
|
|
return sal_False;
|
2006-08-14 15:25:22 +00:00
|
|
|
const SwAttrSet *pSet = rThis.GetAttrSet();
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// Determine predecessor
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm *pPrev = rThis.FindPrev();
|
|
|
|
while ( pPrev && ( !pPrev->IsInDocBody() ||
|
|
|
|
( pPrev->IsTxtFrm() && ((SwTxtFrm*)pPrev)->IsHiddenNow() ) ) )
|
|
|
|
pPrev = pPrev->FindPrev();
|
|
|
|
|
|
|
|
if ( pPrev )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pPrev->IsInDocBody(), "IsPageBreak: Not in DocBody?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( bAct )
|
|
|
|
{ if ( rThis.FindPageFrm() == pPrev->FindPageFrm() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ if ( rThis.FindPageFrm() != pPrev->FindPageFrm() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2006-03-09 13:07:10 +00:00
|
|
|
const SvxBreak eBreak = pSet->GetBreak().GetBreak();
|
|
|
|
if ( eBreak == SVX_BREAK_PAGE_BEFORE || eBreak == SVX_BREAK_PAGE_BOTH )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2006-03-09 13:07:10 +00:00
|
|
|
else
|
2006-02-03 16:17:24 +00:00
|
|
|
{
|
2006-03-09 13:07:10 +00:00
|
|
|
const SvxBreak &ePrB = pPrev->GetAttrSet()->GetBreak().GetBreak();
|
|
|
|
if ( ePrB == SVX_BREAK_PAGE_AFTER ||
|
|
|
|
ePrB == SVX_BREAK_PAGE_BOTH ||
|
|
|
|
pSet->GetPageDesc().GetPageDesc() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2006-02-03 16:17:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2006-02-03 16:17:24 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2011-01-17 15:06:54 +01:00
|
|
|
|* sal_Bool SwFlowFrm::IsColBreak()
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
2012-04-04 14:46:35 +02:00
|
|
|
|* If there's a hard column break before the Frm AND there is
|
2012-04-04 09:42:32 +02:00
|
|
|
|* a predecessor in the same column, we return sal_True (we need to create
|
2012-04-04 14:46:35 +02:00
|
|
|
|* a ColBreak). Otherwise, we return sal_False.
|
2012-04-04 09:42:32 +02:00
|
|
|
|* If bAct is set to sal_True, we return sal_True if there's a ColBreak.
|
2012-04-04 14:46:35 +02:00
|
|
|
|* Of course, we don't evaluate the hard column break for follows.
|
2012-04-04 09:42:32 +02:00
|
|
|
|*
|
|
|
|
|* The column break is in it's own FrmFmt (BEFORE) or in the FrmFmt of the
|
|
|
|
|* predecessor (AFTER). If there's no predecessor in the column, we don't
|
|
|
|
|* need to think further.
|
|
|
|
|* The implementation works only on CntntFrms! - the definition
|
|
|
|
|* of the predecessor is not clear for LayoutFrms.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::IsColBreak( sal_Bool bAct ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if ( !IsFollow() && (rThis.IsMoveable() || bAct) )
|
|
|
|
{
|
|
|
|
const SwFrm *pCol = rThis.FindColFrm();
|
|
|
|
if ( pCol )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// Determine predecessor
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm *pPrev = rThis.FindPrev();
|
|
|
|
while( pPrev && ( ( !pPrev->IsInDocBody() && !rThis.IsInFly() ) ||
|
|
|
|
( pPrev->IsTxtFrm() && ((SwTxtFrm*)pPrev)->IsHiddenNow() ) ) )
|
|
|
|
pPrev = pPrev->FindPrev();
|
|
|
|
|
|
|
|
if ( pPrev )
|
|
|
|
{
|
|
|
|
if ( bAct )
|
|
|
|
{ if ( pCol == pPrev->FindColFrm() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ if ( pCol != pPrev->FindColFrm() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2006-03-09 13:07:10 +00:00
|
|
|
const SvxBreak eBreak = rThis.GetAttrSet()->GetBreak().GetBreak();
|
|
|
|
if ( eBreak == SVX_BREAK_COLUMN_BEFORE ||
|
|
|
|
eBreak == SVX_BREAK_COLUMN_BOTH )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2006-03-09 13:07:10 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const SvxBreak &ePrB = pPrev->GetAttrSet()->GetBreak().GetBreak();
|
|
|
|
if ( ePrB == SVX_BREAK_COLUMN_AFTER ||
|
|
|
|
ePrB == SVX_BREAK_COLUMN_BOTH )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::HasParaSpaceAtPages( sal_Bool bSct ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( rThis.IsInSct() )
|
|
|
|
{
|
|
|
|
const SwFrm* pTmp = rThis.GetUpper();
|
|
|
|
while( pTmp )
|
|
|
|
{
|
|
|
|
if( pTmp->IsCellFrm() || pTmp->IsFlyFrm() ||
|
|
|
|
pTmp->IsFooterFrm() || pTmp->IsHeaderFrm() ||
|
|
|
|
( pTmp->IsFtnFrm() && !((SwFtnFrm*)pTmp)->GetMaster() ) )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pTmp->IsPageFrm() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return ( pTmp->GetPrev() && !IsPageBreak(sal_True) ) ? sal_False : sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pTmp->IsColumnFrm() && pTmp->GetPrev() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return IsColBreak( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pTmp->IsSctFrm() && ( !bSct || pTmp->GetPrev() ) )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
pTmp = pTmp->GetUpper();
|
|
|
|
}
|
2011-03-19 14:13:18 +01:00
|
|
|
OSL_FAIL( "HasParaSpaceAtPages: Where's my page?" );
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if( !rThis.IsInDocBody() || ( rThis.IsInTab() && !rThis.IsTabFrm()) ||
|
2011-01-17 15:06:54 +01:00
|
|
|
IsPageBreak( sal_True ) || ( rThis.FindColFrm() && IsColBreak( sal_True ) ) )
|
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm* pTmp = rThis.FindColFrm();
|
|
|
|
if( pTmp )
|
|
|
|
{
|
|
|
|
if( pTmp->GetPrev() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pTmp = &rThis;
|
|
|
|
pTmp = pTmp->FindPageFrm();
|
|
|
|
return pTmp && !pTmp->GetPrev();
|
|
|
|
}
|
|
|
|
|
2004-03-31 14:08:26 +00:00
|
|
|
/** helper method to determine previous frame for calculation of the
|
|
|
|
upper space
|
|
|
|
|
|
|
|
OD 2004-03-10 #i11860#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
const SwFrm* SwFlowFrm::_GetPrevFrmForUpperSpaceCalc( const SwFrm* _pProposedPrevFrm ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
const SwFrm* pPrevFrm = _pProposedPrevFrm
|
|
|
|
? _pProposedPrevFrm
|
|
|
|
: rThis.GetPrev();
|
|
|
|
|
|
|
|
// Skip hidden paragraphs and empty sections
|
|
|
|
while ( pPrevFrm &&
|
|
|
|
( ( pPrevFrm->IsTxtFrm() &&
|
|
|
|
static_cast<const SwTxtFrm*>(pPrevFrm)->IsHiddenNow() ) ||
|
|
|
|
( pPrevFrm->IsSctFrm() &&
|
|
|
|
!static_cast<const SwSectionFrm*>(pPrevFrm)->GetSection() ) ) )
|
|
|
|
{
|
|
|
|
pPrevFrm = pPrevFrm->GetPrev();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Special case: no direct previous frame is found but frame is in footnote
|
|
|
|
// Search for a previous frame in previous footnote,
|
|
|
|
// if frame isn't in a section, which is also in the footnote
|
|
|
|
if ( !pPrevFrm && rThis.IsInFtn() &&
|
|
|
|
( rThis.IsSctFrm() ||
|
|
|
|
!rThis.IsInSct() || !rThis.FindSctFrm()->IsInFtn() ) )
|
|
|
|
{
|
|
|
|
const SwFtnFrm* pPrevFtnFrm =
|
|
|
|
static_cast<const SwFtnFrm*>(rThis.FindFtnFrm()->GetPrev());
|
|
|
|
if ( pPrevFtnFrm )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2006-03-09 13:07:10 +00:00
|
|
|
pPrevFrm = pPrevFtnFrm->GetLastLower();
|
|
|
|
|
2004-03-31 14:08:26 +00:00
|
|
|
// Skip hidden paragraphs and empty sections
|
|
|
|
while ( pPrevFrm &&
|
|
|
|
( ( pPrevFrm->IsTxtFrm() &&
|
|
|
|
static_cast<const SwTxtFrm*>(pPrevFrm)->IsHiddenNow() ) ||
|
|
|
|
( pPrevFrm->IsSctFrm() &&
|
|
|
|
!static_cast<const SwSectionFrm*>(pPrevFrm)->GetSection() ) ) )
|
2004-03-23 10:25:05 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
pPrevFrm = pPrevFrm->GetPrev();
|
2004-03-23 10:25:05 +00:00
|
|
|
}
|
2004-03-31 14:08:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Special case: found previous frame is a section
|
|
|
|
// Search for the last content in the section
|
|
|
|
if( pPrevFrm && pPrevFrm->IsSctFrm() )
|
|
|
|
{
|
|
|
|
const SwSectionFrm* pPrevSectFrm =
|
|
|
|
static_cast<const SwSectionFrm*>(pPrevFrm);
|
|
|
|
pPrevFrm = pPrevSectFrm->FindLastCntnt();
|
|
|
|
// If the last content is in a table _inside_ the section,
|
|
|
|
// take the table herself.
|
|
|
|
// OD 2004-02-18 #106629# - correction:
|
|
|
|
// Check directly, if table is inside table, instead of indirectly
|
|
|
|
// by checking, if section isn't inside a table
|
|
|
|
if ( pPrevFrm && pPrevFrm->IsInTab() )
|
|
|
|
{
|
|
|
|
const SwTabFrm* pTableFrm = pPrevFrm->FindTabFrm();
|
|
|
|
if ( pPrevSectFrm->IsAnLower( pTableFrm ) )
|
2004-03-23 10:25:05 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
pPrevFrm = pTableFrm;
|
2004-03-23 10:25:05 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-03-31 14:08:26 +00:00
|
|
|
// OD 2004-02-18 #106629# correction: skip hidden text frames
|
|
|
|
while ( pPrevFrm &&
|
|
|
|
pPrevFrm->IsTxtFrm() &&
|
|
|
|
static_cast<const SwTxtFrm*>(pPrevFrm)->IsHiddenNow() )
|
|
|
|
{
|
|
|
|
pPrevFrm = pPrevFrm->GetPrev();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pPrevFrm;
|
|
|
|
}
|
|
|
|
|
2012-03-09 13:03:29 +01:00
|
|
|
/// Compare styles attached to these text frames.
|
2012-10-12 16:49:40 +02:00
|
|
|
static bool lcl_IdenticalStyles(const SwFrm* pPrevFrm, const SwFrm* pFrm)
|
2012-03-09 13:03:29 +01:00
|
|
|
{
|
|
|
|
SwTxtFmtColl *pPrevFmtColl = 0;
|
|
|
|
if (pPrevFrm && pPrevFrm->IsTxtFrm())
|
|
|
|
{
|
|
|
|
SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) pPrevFrm;
|
|
|
|
pPrevFmtColl = dynamic_cast<SwTxtFmtColl*>(pTxtFrm->GetTxtNode()->GetFmtColl());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool bIdenticalStyles = false;
|
|
|
|
if (pFrm && pFrm->IsTxtFrm())
|
|
|
|
{
|
|
|
|
SwTxtFrm *pTxtFrm = ( SwTxtFrm * ) pFrm;
|
|
|
|
SwTxtFmtColl *pFmtColl = dynamic_cast<SwTxtFmtColl*>(pTxtFrm->GetTxtNode()->GetFmtColl());
|
|
|
|
bIdenticalStyles = pPrevFmtColl == pFmtColl;
|
|
|
|
}
|
|
|
|
return bIdenticalStyles;
|
|
|
|
}
|
|
|
|
|
2012-10-12 16:49:40 +02:00
|
|
|
static bool lcl_getContextualSpacing(const SwFrm* pPrevFrm)
|
2012-03-09 13:03:29 +01:00
|
|
|
{
|
|
|
|
bool bRet;
|
|
|
|
SwBorderAttrAccess *pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), pPrevFrm );
|
|
|
|
const SwBorderAttrs *pAttrs = pAccess->Get();
|
|
|
|
|
|
|
|
bRet = pAttrs->GetULSpace().GetContext();
|
|
|
|
|
|
|
|
delete pAccess;
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2004-03-31 14:08:26 +00:00
|
|
|
// OD 2004-03-12 #i11860# - add 3rd parameter <_bConsiderGrid>
|
|
|
|
SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
|
|
|
|
const SwFrm* pPr,
|
|
|
|
const bool _bConsiderGrid ) const
|
|
|
|
{
|
|
|
|
// OD 2004-03-10 #i11860# - use new method <GetPrevFrmForUpperSpaceCalc(..)>
|
|
|
|
const SwFrm* pPrevFrm = _GetPrevFrmForUpperSpaceCalc( pPr );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
SwBorderAttrAccess *pAccess;
|
|
|
|
SwFrm* pOwn;
|
|
|
|
if( !pAttrs )
|
|
|
|
{
|
|
|
|
if( rThis.IsSctFrm() )
|
|
|
|
{
|
|
|
|
SwSectionFrm* pFoll = &((SwSectionFrm&)rThis);
|
|
|
|
do
|
|
|
|
pOwn = pFoll->ContainsAny();
|
|
|
|
while( !pOwn && 0 != ( pFoll = pFoll->GetFollow() ) );
|
|
|
|
if( !pOwn )
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pOwn = &rThis;
|
|
|
|
pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), pOwn );
|
|
|
|
pAttrs = pAccess->Get();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pAccess = NULL;
|
|
|
|
pOwn = &rThis;
|
|
|
|
}
|
|
|
|
SwTwips nUpper = 0;
|
2004-02-26 16:00:05 +00:00
|
|
|
// OD 06.01.2004 #i11859#
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2006-08-14 15:25:22 +00:00
|
|
|
const IDocumentSettingAccess* pIDSA = rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess();
|
|
|
|
const bool bUseFormerLineSpacing = pIDSA->get(IDocumentSettingAccess::OLD_LINE_SPACING);
|
2004-03-31 14:08:26 +00:00
|
|
|
if( pPrevFrm )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
// OD 2004-03-10 #i11860# - use new method to determine needed spacing
|
|
|
|
// values of found previous frame and use these values.
|
|
|
|
SwTwips nPrevLowerSpace = 0;
|
|
|
|
SwTwips nPrevLineSpacing = 0;
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i102458#
|
2009-09-08 13:44:38 +00:00
|
|
|
bool bPrevLineSpacingPorportional = false;
|
|
|
|
GetSpacingValuesOfFrm( (*pPrevFrm),
|
|
|
|
nPrevLowerSpace, nPrevLineSpacing,
|
|
|
|
bPrevLineSpacingPorportional );
|
2006-08-14 15:25:22 +00:00
|
|
|
if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) )
|
2004-02-26 16:00:05 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
nUpper = nPrevLowerSpace + pAttrs->GetULSpace().GetUpper();
|
|
|
|
SwTwips nAdd = nPrevLineSpacing;
|
2004-02-26 16:00:05 +00:00
|
|
|
// OD 07.01.2004 #i11859# - consideration of the line spacing
|
|
|
|
// for the upper spacing of a text frame
|
|
|
|
if ( bUseFormerLineSpacing )
|
|
|
|
{
|
|
|
|
// former consideration
|
|
|
|
if ( pOwn->IsTxtFrm() )
|
2004-03-31 14:08:26 +00:00
|
|
|
{
|
2004-02-26 16:00:05 +00:00
|
|
|
nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace() );
|
2004-03-31 14:08:26 +00:00
|
|
|
}
|
2004-02-26 16:00:05 +00:00
|
|
|
nUpper += nAdd;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// new consideration:
|
|
|
|
// Only the proportional line spacing of the previous
|
|
|
|
// text frame is considered for the upper spacing and
|
|
|
|
// the line spacing values are add up instead of
|
|
|
|
// building its maximum.
|
|
|
|
if ( pOwn->IsTxtFrm() )
|
2004-03-31 14:08:26 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i102458#
|
2009-09-08 13:44:38 +00:00
|
|
|
// Correction:
|
|
|
|
// A proportional line spacing of the previous text frame
|
|
|
|
// is added up to a own leading line spacing.
|
|
|
|
// Otherwise, the maximum of the leading line spacing
|
|
|
|
// of the previous text frame and the own leading line
|
|
|
|
// spacing is built.
|
|
|
|
if ( bPrevLineSpacingPorportional )
|
|
|
|
{
|
|
|
|
nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ) );
|
|
|
|
}
|
2004-03-31 14:08:26 +00:00
|
|
|
}
|
2004-02-26 16:00:05 +00:00
|
|
|
nUpper += nAdd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
nUpper = Max( static_cast<long>(nPrevLowerSpace),
|
|
|
|
static_cast<long>(pAttrs->GetULSpace().GetUpper()) );
|
2004-02-26 16:00:05 +00:00
|
|
|
// OD 07.01.2004 #i11859# - consideration of the line spacing
|
|
|
|
// for the upper spacing of a text frame
|
|
|
|
if ( bUseFormerLineSpacing )
|
|
|
|
{
|
|
|
|
// former consideration
|
|
|
|
if ( pOwn->IsTxtFrm() )
|
|
|
|
nUpper = Max( nUpper, ((SwTxtFrm*)pOwn)->GetLineSpace() );
|
2004-03-31 14:08:26 +00:00
|
|
|
if ( nPrevLineSpacing != 0 )
|
|
|
|
{
|
|
|
|
nUpper = Max( nUpper, nPrevLineSpacing );
|
|
|
|
}
|
2004-02-26 16:00:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// new consideration:
|
|
|
|
// Only the proportional line spacing of the previous
|
|
|
|
// text frame is considered for the upper spacing and
|
|
|
|
// the line spacing values are add up and added to
|
|
|
|
// the paragraph spacing instead of building the
|
|
|
|
// maximum of the line spacings and the paragraph spacing.
|
2004-03-31 14:08:26 +00:00
|
|
|
SwTwips nAdd = nPrevLineSpacing;
|
2004-02-26 16:00:05 +00:00
|
|
|
if ( pOwn->IsTxtFrm() )
|
2004-03-31 14:08:26 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i102458#
|
2009-09-08 13:44:38 +00:00
|
|
|
// Correction:
|
|
|
|
// A proportional line spacing of the previous text frame
|
|
|
|
// is added up to a own leading line spacing.
|
|
|
|
// Otherwise, the maximum of the leading line spacing
|
|
|
|
// of the previous text frame and the own leading line
|
|
|
|
// spacing is built.
|
|
|
|
if ( bPrevLineSpacingPorportional )
|
|
|
|
{
|
|
|
|
nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ) );
|
|
|
|
}
|
2004-03-31 14:08:26 +00:00
|
|
|
}
|
2004-02-26 16:00:05 +00:00
|
|
|
nUpper += nAdd;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2006-08-14 15:25:22 +00:00
|
|
|
else if ( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) &&
|
2004-02-26 16:00:05 +00:00
|
|
|
CastFlowFrm( pOwn )->HasParaSpaceAtPages( rThis.IsSctFrm() ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-02-26 16:00:05 +00:00
|
|
|
nUpper = pAttrs->GetULSpace().GetUpper();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-31 14:08:26 +00:00
|
|
|
// OD 2004-02-26 #i25029# - pass previous frame <pPrevFrm>
|
|
|
|
// to method <GetTopLine(..)>, if parameter <pPr> is set.
|
2004-03-09 08:30:35 +00:00
|
|
|
// Note: parameter <pPr> is set, if method is called from <SwTxtFrm::WouldFit(..)>
|
2004-03-31 14:08:26 +00:00
|
|
|
nUpper += pAttrs->GetTopLine( rThis, (pPr ? pPrevFrm : 0L) );
|
|
|
|
|
|
|
|
// OD 2004-03-12 #i11860# - consider value of new parameter <_bConsiderGrid>
|
|
|
|
// and use new method <GetUpperSpaceAmountConsideredForPageGrid(..)>
|
2008-03-07 15:26:19 +00:00
|
|
|
|
|
|
|
//consider grid in square page mode
|
|
|
|
if ( _bConsiderGrid && rThis.GetUpper()->GetFmt()->GetDoc()->IsSquaredPageMode() )
|
2004-03-31 14:08:26 +00:00
|
|
|
{
|
|
|
|
nUpper += _GetUpperSpaceAmountConsideredForPageGrid( nUpper );
|
|
|
|
}
|
|
|
|
|
2012-03-09 13:03:29 +01:00
|
|
|
bool bContextualSpacing = pAttrs->GetULSpace().GetContext();
|
2004-03-31 14:08:26 +00:00
|
|
|
delete pAccess;
|
2012-03-09 13:03:29 +01:00
|
|
|
|
2012-03-12 22:42:15 +01:00
|
|
|
if (bContextualSpacing && pPrevFrm && lcl_getContextualSpacing(pPrevFrm)
|
|
|
|
&& lcl_IdenticalStyles(pPrevFrm, &rThis))
|
|
|
|
{
|
2012-03-09 13:03:29 +01:00
|
|
|
return 0;
|
2012-03-12 22:42:15 +01:00
|
|
|
}
|
2012-03-09 13:03:29 +01:00
|
|
|
else
|
|
|
|
return nUpper;
|
2004-03-31 14:08:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** method to detemine the upper space amount, which is considered for
|
|
|
|
the page grid
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-03-31 14:08:26 +00:00
|
|
|
OD 2004-03-12 #i11860#
|
|
|
|
Precondition: Position of frame is valid.
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPageGrid(
|
|
|
|
const SwTwips _nUpperSpaceWithoutGrid ) const
|
|
|
|
{
|
|
|
|
SwTwips nUpperSpaceAmountConsideredForPageGrid = 0;
|
|
|
|
|
|
|
|
if ( rThis.IsInDocBody() && rThis.GetAttrSet()->GetParaGrid().GetValue() )
|
2002-01-24 15:21:17 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
const SwPageFrm* pPageFrm = rThis.FindPageFrm();
|
|
|
|
GETGRID( pPageFrm )
|
2002-02-05 14:00:23 +00:00
|
|
|
if( pGrid )
|
2002-01-24 15:21:17 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
const SwFrm* pBodyFrm = pPageFrm->FindBodyCont();
|
|
|
|
if ( pBodyFrm )
|
2002-01-24 15:21:17 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
const long nGridLineHeight =
|
|
|
|
pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
|
|
|
|
|
2002-01-31 13:23:16 +00:00
|
|
|
SWRECTFN( (&rThis) )
|
2004-03-31 14:08:26 +00:00
|
|
|
const SwTwips nBodyPrtTop = (pBodyFrm->*fnRect->fnGetPrtTop)();
|
|
|
|
const SwTwips nProposedPrtTop =
|
|
|
|
(*fnRect->fnYInc)( (rThis.Frm().*fnRect->fnGetTop)(),
|
|
|
|
_nUpperSpaceWithoutGrid );
|
|
|
|
|
|
|
|
const SwTwips nSpaceAbovePrtTop =
|
|
|
|
(*fnRect->fnYDiff)( nProposedPrtTop, nBodyPrtTop );
|
|
|
|
const SwTwips nSpaceOfCompleteLinesAbove =
|
|
|
|
nGridLineHeight * ( nSpaceAbovePrtTop / nGridLineHeight );
|
|
|
|
SwTwips nNewPrtTop =
|
|
|
|
(*fnRect->fnYInc)( nBodyPrtTop, nSpaceOfCompleteLinesAbove );
|
|
|
|
if ( (*fnRect->fnYDiff)( nProposedPrtTop, nNewPrtTop ) > 0 )
|
2002-01-24 15:21:17 +00:00
|
|
|
{
|
2004-03-31 14:08:26 +00:00
|
|
|
nNewPrtTop = (*fnRect->fnYInc)( nNewPrtTop, nGridLineHeight );
|
2002-01-24 15:21:17 +00:00
|
|
|
}
|
2004-03-31 14:08:26 +00:00
|
|
|
|
|
|
|
const SwTwips nNewUpperSpace =
|
|
|
|
(*fnRect->fnYDiff)( nNewPrtTop,
|
|
|
|
(rThis.Frm().*fnRect->fnGetTop)() );
|
|
|
|
|
|
|
|
nUpperSpaceAmountConsideredForPageGrid =
|
|
|
|
nNewUpperSpace - _nUpperSpaceWithoutGrid;
|
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( nUpperSpaceAmountConsideredForPageGrid >= 0,
|
2004-03-31 14:08:26 +00:00
|
|
|
"<SwFlowFrm::GetUpperSpaceAmountConsideredForPageGrid(..)> - negative space considered for page grid!" );
|
2002-01-24 15:21:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-03-31 14:08:26 +00:00
|
|
|
return nUpperSpaceAmountConsideredForPageGrid;
|
|
|
|
}
|
2002-01-24 15:21:17 +00:00
|
|
|
|
2004-03-31 14:08:26 +00:00
|
|
|
/** method to determent the upper space amount, which is considered for
|
|
|
|
the previous frame
|
|
|
|
|
|
|
|
OD 2004-03-11 #i11860#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPrevFrm() const
|
|
|
|
{
|
|
|
|
SwTwips nUpperSpaceAmountOfPrevFrm = 0;
|
|
|
|
|
|
|
|
const SwFrm* pPrevFrm = _GetPrevFrmForUpperSpaceCalc();
|
|
|
|
if ( pPrevFrm )
|
|
|
|
{
|
|
|
|
SwTwips nPrevLowerSpace = 0;
|
|
|
|
SwTwips nPrevLineSpacing = 0;
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i102458#
|
2009-09-08 13:44:38 +00:00
|
|
|
bool bDummy = false;
|
|
|
|
GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bDummy );
|
2004-03-31 14:08:26 +00:00
|
|
|
if ( nPrevLowerSpace > 0 || nPrevLineSpacing > 0 )
|
|
|
|
{
|
2006-08-14 15:25:22 +00:00
|
|
|
const IDocumentSettingAccess* pIDSA = rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess();
|
|
|
|
if ( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) ||
|
|
|
|
!pIDSA->get(IDocumentSettingAccess::OLD_LINE_SPACING) )
|
2004-03-31 14:08:26 +00:00
|
|
|
{
|
|
|
|
nUpperSpaceAmountOfPrevFrm = nPrevLowerSpace + nPrevLineSpacing;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nUpperSpaceAmountOfPrevFrm = Max( nPrevLowerSpace, nPrevLineSpacing );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nUpperSpaceAmountOfPrevFrm;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** method to determine the upper space amount, which is considered for
|
|
|
|
the previous frame and the page grid, if option 'Use former object
|
|
|
|
positioning' is OFF
|
|
|
|
|
|
|
|
OD 2004-03-18 #i11860#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
SwTwips SwFlowFrm::GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid() const
|
|
|
|
{
|
|
|
|
SwTwips nUpperSpaceAmountConsideredForPrevFrmAndPageGrid = 0;
|
|
|
|
|
2006-08-14 15:25:22 +00:00
|
|
|
if ( !rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) )
|
2004-03-31 14:08:26 +00:00
|
|
|
{
|
|
|
|
nUpperSpaceAmountConsideredForPrevFrmAndPageGrid =
|
|
|
|
_GetUpperSpaceAmountConsideredForPrevFrm() +
|
|
|
|
_GetUpperSpaceAmountConsideredForPageGrid( CalcUpperSpace( 0L, 0L, false ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return nUpperSpaceAmountConsideredForPrevFrmAndPageGrid;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-03-23 10:25:05 +00:00
|
|
|
/** calculation of lower space
|
|
|
|
|
|
|
|
OD 2004-03-02 #106629#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
SwTwips SwFlowFrm::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const
|
|
|
|
{
|
|
|
|
SwTwips nLowerSpace = 0;
|
|
|
|
|
|
|
|
SwBorderAttrAccess* pAttrAccess = 0L;
|
|
|
|
if ( !_pAttrs )
|
|
|
|
{
|
|
|
|
pAttrAccess = new SwBorderAttrAccess( SwFrm::GetCache(), &rThis );
|
|
|
|
_pAttrs = pAttrAccess->Get();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool bCommonBorder = sal_True;
|
|
|
|
if ( rThis.IsInSct() && rThis.GetUpper()->IsColBodyFrm() )
|
|
|
|
{
|
|
|
|
const SwSectionFrm* pSectFrm = rThis.FindSctFrm();
|
|
|
|
bCommonBorder = pSectFrm->GetFmt()->GetBalancedColumns().GetValue();
|
|
|
|
}
|
|
|
|
nLowerSpace = bCommonBorder ?
|
2004-03-24 11:27:17 +00:00
|
|
|
_pAttrs->GetBottomLine( rThis ) :
|
2004-03-23 10:25:05 +00:00
|
|
|
_pAttrs->CalcBottomLine();
|
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i26250#
|
2004-08-02 12:07:25 +00:00
|
|
|
// - correct consideration of table frames
|
|
|
|
// - use new method <CalcAddLowerSpaceAsLastInTableCell(..)>
|
|
|
|
if ( ( ( rThis.IsTabFrm() && rThis.GetUpper()->IsInTab() ) ||
|
2011-04-18 12:37:38 -03:00
|
|
|
// #115759# - no lower spacing, if frame has a follow
|
2004-12-23 09:07:01 +00:00
|
|
|
( rThis.IsInTab() && !GetFollow() ) ) &&
|
2004-08-02 12:07:25 +00:00
|
|
|
!rThis.GetIndNext() )
|
2004-03-23 10:25:05 +00:00
|
|
|
{
|
2004-08-02 12:07:25 +00:00
|
|
|
nLowerSpace += CalcAddLowerSpaceAsLastInTableCell( _pAttrs );
|
2004-03-23 10:25:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delete pAttrAccess;
|
|
|
|
|
|
|
|
return nLowerSpace;
|
|
|
|
}
|
|
|
|
|
2004-08-02 12:07:25 +00:00
|
|
|
/** calculation of the additional space to be considered, if flow frame
|
|
|
|
is the last inside a table cell
|
|
|
|
|
|
|
|
OD 2004-07-16 #i26250#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
SwTwips SwFlowFrm::CalcAddLowerSpaceAsLastInTableCell(
|
|
|
|
const SwBorderAttrs* _pAttrs ) const
|
|
|
|
{
|
|
|
|
SwTwips nAdditionalLowerSpace = 0;
|
|
|
|
|
2006-08-14 15:25:22 +00:00
|
|
|
if ( rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) )
|
2004-08-02 12:07:25 +00:00
|
|
|
{
|
|
|
|
const SwFrm* pFrm = &rThis;
|
|
|
|
if ( pFrm->IsSctFrm() )
|
|
|
|
{
|
|
|
|
const SwSectionFrm* pSectFrm = static_cast<const SwSectionFrm*>(pFrm);
|
|
|
|
pFrm = pSectFrm->FindLastCntnt();
|
|
|
|
if ( pFrm && pFrm->IsInTab() )
|
|
|
|
{
|
|
|
|
const SwTabFrm* pTableFrm = pFrm->FindTabFrm();
|
|
|
|
if ( pSectFrm->IsAnLower( pTableFrm ) )
|
|
|
|
{
|
|
|
|
pFrm = pTableFrm;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwBorderAttrAccess* pAttrAccess = 0L;
|
|
|
|
if ( !_pAttrs || pFrm != &rThis )
|
|
|
|
{
|
|
|
|
pAttrAccess = new SwBorderAttrAccess( SwFrm::GetCache(), pFrm );
|
|
|
|
_pAttrs = pAttrAccess->Get();
|
|
|
|
}
|
|
|
|
|
|
|
|
nAdditionalLowerSpace += _pAttrs->GetULSpace().GetLower();
|
|
|
|
|
|
|
|
delete pAttrAccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nAdditionalLowerSpace;
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2011-01-17 15:06:54 +01:00
|
|
|
|* sal_Bool SwFlowFrm::CheckMoveFwd()
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description Moves the Frm forward if it seems necessary regarding
|
|
|
|
|* the current conditions and attributes.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-12-22 18:22:03 +01:00
|
|
|
sal_Bool SwFlowFrm::CheckMoveFwd( bool& rbMakePage, sal_Bool bKeep, sal_Bool )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwFrm* pNxt = rThis.GetIndNext();
|
|
|
|
|
|
|
|
if ( bKeep && //!bMovedBwd &&
|
|
|
|
( !pNxt || ( pNxt->IsTxtFrm() && ((SwTxtFrm*)pNxt)->IsEmptyMaster() ) ) &&
|
|
|
|
( 0 != (pNxt = rThis.FindNext()) ) && IsKeepFwdMoveAllowed() )
|
|
|
|
{
|
|
|
|
if( pNxt->IsSctFrm() )
|
2012-04-04 09:42:32 +02:00
|
|
|
{ // Don't get fooled by empty SectionFrms
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm* pTmp = NULL;
|
|
|
|
while( pNxt && pNxt->IsSctFrm() &&
|
|
|
|
( !((SwSectionFrm*)pNxt)->GetSection() ||
|
2007-09-27 08:01:58 +00:00
|
|
|
0 == ( pTmp = ((SwSectionFrm*)pNxt)->ContainsAny() ) ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
pNxt = pNxt->FindNext();
|
|
|
|
pTmp = NULL;
|
|
|
|
}
|
|
|
|
if( pTmp )
|
|
|
|
pNxt = pTmp; // the content of the next notempty sectionfrm
|
|
|
|
}
|
|
|
|
if( pNxt && pNxt->GetValidPosFlag() )
|
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bMove = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwSectionFrm *pSct = rThis.FindSctFrm();
|
|
|
|
if( pSct && !pSct->GetValidSizeFlag() )
|
|
|
|
{
|
|
|
|
const SwSectionFrm* pNxtSct = pNxt->FindSctFrm();
|
|
|
|
if( pNxtSct && pSct->IsAnFollow( pNxtSct ) )
|
2012-11-25 21:47:12 +09:00
|
|
|
bMove = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
2012-11-25 21:47:12 +09:00
|
|
|
bMove = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bMove )
|
|
|
|
{
|
|
|
|
//Keep together with the following frame
|
2011-01-17 15:06:54 +01:00
|
|
|
MoveFwd( rbMakePage, sal_False );
|
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bMovedFwd = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( rThis.GetIndPrev() )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
if ( IsPrevObjMove() ) // Should we care about objects of the Prev?
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
bMovedFwd = sal_True;
|
|
|
|
if ( !MoveFwd( rbMakePage, sal_False ) )
|
2011-12-22 18:22:03 +01:00
|
|
|
rbMakePage = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
if ( IsPageBreak( sal_False ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
while ( MoveFwd( rbMakePage, sal_True ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
/* do nothing */;
|
2011-12-22 18:22:03 +01:00
|
|
|
rbMakePage = false;
|
2011-01-17 15:06:54 +01:00
|
|
|
bMovedFwd = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
else if ( IsColBreak ( sal_False ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwPageFrm *pPage = rThis.FindPageFrm();
|
|
|
|
SwFrm *pCol = rThis.FindColFrm();
|
|
|
|
do
|
2011-01-17 15:06:54 +01:00
|
|
|
{ MoveFwd( rbMakePage, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFrm *pTmp = rThis.FindColFrm();
|
|
|
|
if( pTmp != pCol )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
bMovedFwd = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
pCol = pTmp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2011-01-17 15:06:54 +01:00
|
|
|
} while ( IsColBreak( sal_False ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pPage != rThis.FindPageFrm() )
|
2011-12-22 18:22:03 +01:00
|
|
|
rbMakePage = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bMovedFwd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2011-01-17 15:06:54 +01:00
|
|
|
|* sal_Bool SwFlowFrm::MoveFwd()
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description Return value tells us whether the Frm has changed
|
|
|
|
|* the page.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::MoveFwd( sal_Bool bMakePage, sal_Bool bPageBreak, sal_Bool bMoveAlways )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
//!!!!MoveFtnCntFwd might need to be updated as well.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFtnBossFrm *pOldBoss = rThis.FindFtnBossFrm();
|
|
|
|
if ( rThis.IsInFtn() )
|
|
|
|
return ((SwCntntFrm&)rThis).MoveFtnCntFwd( bMakePage, pOldBoss );
|
|
|
|
|
|
|
|
if( !IsFwdMoveAllowed() && !bMoveAlways )
|
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bNoFwd = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( rThis.IsInSct() )
|
|
|
|
{
|
|
|
|
SwFtnBossFrm* pBoss = rThis.FindFtnBossFrm();
|
|
|
|
bNoFwd = !pBoss->IsInSct() || ( !pBoss->Lower()->GetNext() &&
|
|
|
|
!pBoss->GetPrev() );
|
|
|
|
}
|
2007-02-28 14:47:32 +00:00
|
|
|
|
2004-06-01 06:44:04 +00:00
|
|
|
// Allow the MoveFwd even if we do not have an IndPrev in these cases:
|
|
|
|
if ( rThis.IsInTab() &&
|
|
|
|
( !rThis.IsTabFrm() ||
|
|
|
|
( rThis.GetUpper()->IsInTab() &&
|
|
|
|
rThis.GetUpper()->FindTabFrm()->IsFwdMoveAllowed() ) ) &&
|
2007-02-28 14:47:32 +00:00
|
|
|
0 != const_cast<SwFrm&>(rThis).GetNextCellLeaf( MAKEPAGE_NONE ) )
|
2004-01-13 12:13:45 +00:00
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bNoFwd = false;
|
2004-01-13 12:13:45 +00:00
|
|
|
}
|
2007-02-28 14:47:32 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bNoFwd )
|
|
|
|
{
|
2012-04-04 14:46:35 +02:00
|
|
|
// It's allowed to move PageBreaks if the Frm isn't the first
|
2012-04-04 09:42:32 +02:00
|
|
|
// one on the page.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !bPageBreak )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
const SwFrm *pCol = rThis.FindColFrm();
|
|
|
|
if ( !pCol || !pCol->GetPrev() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bSamePage = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayoutFrm *pNewUpper =
|
2011-01-17 15:06:54 +01:00
|
|
|
rThis.GetLeaf( bMakePage ? MAKEPAGE_INSERT : MAKEPAGE_NONE, sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( pNewUpper )
|
|
|
|
{
|
|
|
|
PROTOCOL_ENTER( &rThis, PROT_MOVE_FWD, 0, 0 );
|
|
|
|
SwPageFrm *pOldPage = pOldBoss->FindPageFrm();
|
2012-04-04 09:42:32 +02:00
|
|
|
// We move ourself and all the direct successors before the
|
|
|
|
// first CntntFrm below the new Upper.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// If our NewUpper lies in a SectionFrm, we need to make sure
|
|
|
|
// that it won't destroy itself in Calc.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwSectionFrm* pSect = pNewUpper->FindSctFrm();
|
|
|
|
if( pSect )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// If we only switch column within our SectionFrm, we better don't
|
|
|
|
// call Calc, as this would format the SectionFrm, which in turn would
|
|
|
|
// call us again, etc.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSect != rThis.FindSctFrm() )
|
|
|
|
{
|
2012-12-20 00:25:25 +01:00
|
|
|
bool bUnlock = !pSect->IsColLocked();
|
2000-09-18 23:08:29 +00:00
|
|
|
pSect->ColLock();
|
|
|
|
pNewUpper->Calc();
|
|
|
|
if( bUnlock )
|
|
|
|
pSect->ColUnlock();
|
|
|
|
}
|
|
|
|
}
|
2004-01-13 12:13:45 +00:00
|
|
|
// Do not calculate split cell frames.
|
|
|
|
else if ( !pNewUpper->IsCellFrm() || ((SwLayoutFrm*)pNewUpper)->Lower() )
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewUpper->Calc();
|
|
|
|
|
|
|
|
SwFtnBossFrm *pNewBoss = pNewUpper->FindFtnBossFrm();
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bBossChg = pNewBoss != pOldBoss;
|
2011-01-17 15:06:54 +01:00
|
|
|
pNewBoss = pNewBoss->FindFtnBossFrm( sal_True );
|
|
|
|
pOldBoss = pOldBoss->FindFtnBossFrm( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwPageFrm* pNewPage = pOldPage;
|
|
|
|
|
2004-06-04 07:44:36 +00:00
|
|
|
// First, we move the footnotes.
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bFtnMoved = sal_False;
|
2004-08-02 12:07:25 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i26831#
|
2004-08-02 12:07:25 +00:00
|
|
|
// If pSect has just been created, the printing area of pSect has
|
|
|
|
// been calculated based on the first content of its follow.
|
|
|
|
// In this case we prefer to call a SimpleFormat for this new
|
|
|
|
// section after we inserted the contents. Otherwise the section
|
|
|
|
// frame will invalidate its lowers, if its printing area changes
|
|
|
|
// in SwSectionFrm::Format, which can cause loops.
|
|
|
|
const bool bForceSimpleFormat = pSect && pSect->HasFollow() &&
|
|
|
|
!pSect->ContainsAny();
|
2004-06-04 07:44:36 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pNewBoss != pOldBoss )
|
|
|
|
{
|
|
|
|
pNewPage = pNewBoss->FindPageFrm();
|
|
|
|
bSamePage = pNewPage == pOldPage;
|
2012-04-04 09:42:32 +02:00
|
|
|
// Set deadline, so the footnotes don't think up
|
|
|
|
// silly things...
|
2001-10-05 11:36:10 +00:00
|
|
|
SWRECTFN( pOldBoss )
|
|
|
|
SwSaveFtnHeight aHeight( pOldBoss,
|
|
|
|
(pOldBoss->Frm().*fnRect->fnGetBottom)() );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwCntntFrm* pStart = rThis.IsCntntFrm() ?
|
|
|
|
(SwCntntFrm*)&rThis : ((SwLayoutFrm&)rThis).ContainsCntnt();
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pStart || ( rThis.IsTabFrm() && !((SwTabFrm&)rThis).Lower() ),
|
2004-01-13 12:13:45 +00:00
|
|
|
"MoveFwd: Missing Content" );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayoutFrm* pBody = pStart ? ( pStart->IsTxtFrm() ?
|
|
|
|
(SwLayoutFrm*)((SwTxtFrm*)pStart)->FindBodyFrm() : 0 ) : 0;
|
|
|
|
if( pBody )
|
|
|
|
bFtnMoved = pBody->MoveLowerFtns( pStart, pOldBoss, pNewBoss,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_False);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2012-04-04 09:42:32 +02:00
|
|
|
// It's possible when dealing with SectionFrms that we have been moved
|
|
|
|
// by pNewUpper->Calc(), for instance into the pNewUpper.
|
|
|
|
// MoveSubTree or PasteTree respectively is not prepared to handle such a
|
|
|
|
// situation.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pNewUpper != rThis.GetUpper() )
|
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i27145#
|
2004-06-04 07:44:36 +00:00
|
|
|
SwSectionFrm* pOldSct = 0;
|
2004-08-02 12:07:25 +00:00
|
|
|
if ( rThis.GetUpper()->IsSctFrm() )
|
2004-06-28 12:08:52 +00:00
|
|
|
{
|
2004-08-02 12:07:25 +00:00
|
|
|
pOldSct = static_cast<SwSectionFrm*>(rThis.GetUpper());
|
2004-06-28 12:08:52 +00:00
|
|
|
}
|
2004-06-04 07:44:36 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
MoveSubTree( pNewUpper, pNewUpper->Lower() );
|
2002-11-13 08:40:43 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i27145#
|
2004-08-02 12:07:25 +00:00
|
|
|
if ( pOldSct && pOldSct->GetSection() )
|
2004-06-04 07:44:36 +00:00
|
|
|
{
|
2004-08-02 12:07:25 +00:00
|
|
|
// Prevent loops by setting the new height at
|
2004-06-04 07:44:36 +00:00
|
|
|
// the section frame if footnotes have been moved.
|
|
|
|
// Otherwise the call of SwLayNotify::~SwLayNotify() for
|
|
|
|
// the (invalid) section frame will invalidate the first
|
|
|
|
// lower of its follow, because it grows due to the removed
|
|
|
|
// footnotes.
|
2004-08-02 12:07:25 +00:00
|
|
|
// Note: If pOldSct has become empty during MoveSubTree, it
|
|
|
|
// has already been scheduled for removal. No SimpleFormat
|
|
|
|
// for these.
|
2004-06-04 07:44:36 +00:00
|
|
|
pOldSct->SimpleFormat();
|
|
|
|
}
|
2004-08-02 12:07:25 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i26831#
|
2004-08-02 12:07:25 +00:00
|
|
|
if ( bForceSimpleFormat )
|
|
|
|
{
|
|
|
|
pSect->SimpleFormat();
|
|
|
|
}
|
2004-06-04 07:44:36 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( bFtnMoved && !bSamePage )
|
|
|
|
{
|
|
|
|
pOldPage->UpdateFtnNum();
|
|
|
|
pNewPage->UpdateFtnNum();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bBossChg )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
rThis.Prepare( PREP_BOSS_CHGD, 0, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !bSamePage )
|
|
|
|
{
|
2010-06-13 15:22:56 +02:00
|
|
|
ViewShell *pSh = rThis.getRootFrm()->GetCurrShell();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pSh && !pSh->Imp()->IsUpdateExpFlds() )
|
2012-04-04 09:42:32 +02:00
|
|
|
pSh->GetDoc()->SetNewFldLst(true); // Will be done by CalcLayout() later on!
|
2006-07-10 14:29:29 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewPage->InvalidateSpelling();
|
2007-01-02 15:48:46 +00:00
|
|
|
pNewPage->InvalidateSmartTags(); // SMARTTAGS
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewPage->InvalidateAutoCompleteWords();
|
2006-07-10 14:29:29 +00:00
|
|
|
pNewPage->InvalidateWordCount();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-11-01 10:43:00 +00:00
|
|
|
// OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout
|
2010-06-13 15:22:56 +02:00
|
|
|
const ViewShell *pSh = rThis.getRootFrm()->GetCurrShell();
|
|
|
|
|
|
|
|
if ( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) )
|
2002-11-01 10:43:00 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i106452#
|
2009-12-31 10:59:35 +01:00
|
|
|
// check page description not only in situation with sections.
|
|
|
|
if ( !bSamePage &&
|
2002-11-01 10:43:00 +00:00
|
|
|
( rThis.GetAttrSet()->GetPageDesc().GetPageDesc() ||
|
|
|
|
pOldPage->GetPageDesc()->GetFollow() != pNewPage->GetPageDesc() ) )
|
2009-12-31 10:59:35 +01:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwFrm::CheckPageDescs( pNewPage, sal_False );
|
2009-12-31 10:59:35 +01:00
|
|
|
}
|
2002-11-01 10:43:00 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
return bSamePage;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2011-01-17 15:06:54 +01:00
|
|
|
|* sal_Bool SwFlowFrm::MoveBwd()
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
2012-04-04 09:42:32 +02:00
|
|
|
|* Description Return value tells whether the Frm should change the page.
|
|
|
|
|* This should be called by derived classes.
|
|
|
|
|* The actual moving must be implemented in the subclasses.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwFlowFrm::MoveBwd( sal_Bool &rbReformat )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwFlowFrm::SetMoveBwdJump( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwFtnFrm* pFtn = rThis.FindFtnFrm();
|
|
|
|
if ( pFtn && pFtn->IsBackMoveLocked() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-04-18 12:37:38 -03:00
|
|
|
// #115759# - text frames, which are directly inside
|
2004-12-23 09:07:01 +00:00
|
|
|
// tables aren't allowed to move backward.
|
|
|
|
if ( rThis.IsTxtFrm() && rThis.IsInTab() )
|
|
|
|
{
|
|
|
|
const SwLayoutFrm* pUpperFrm = rThis.GetUpper();
|
|
|
|
while ( pUpperFrm )
|
|
|
|
{
|
|
|
|
if ( pUpperFrm->IsTabFrm() )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2004-12-23 09:07:01 +00:00
|
|
|
}
|
|
|
|
else if ( pUpperFrm->IsColumnFrm() && pUpperFrm->IsInSct() )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pUpperFrm = pUpperFrm->GetUpper();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFtnBossFrm * pOldBoss = rThis.FindFtnBossFrm();
|
|
|
|
SwPageFrm * const pOldPage = pOldBoss->FindPageFrm();
|
|
|
|
SwLayoutFrm *pNewUpper = 0;
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bCheckPageDescs = false;
|
2004-02-16 10:58:00 +00:00
|
|
|
bool bCheckPageDescOfNextPage = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( pFtn )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// If the footnote already sits on the same page/column as the reference,
|
|
|
|
// we can't flow back. The breaks don't need to be checked for footnotes.
|
2004-12-23 09:07:01 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i37084# FindLastCntnt does not necessarily
|
2004-12-23 09:07:01 +00:00
|
|
|
// have to have a result != 0
|
|
|
|
SwFrm* pRef = 0;
|
CWS-TOOLING: integrate CWS odfmetadata2
2009-06-22 11:48:36 +0200 mst r273206 : - connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx:
+ add "include ustrbuf.hxx" to work around warning caused by
solaris <sys/kstat.h> declaring a global "long l ;"
2009-06-19 14:25:25 +0200 mst r273159 : - scp2/source/ooo/file_library_ooo.scp:
+ fix MinGW build
2009-06-08 12:52:33 +0200 mst r272727 : - redland/raptor-1.4.18.patch.mingw, redland/raptor/makefile.mk:
+ disable parsers that do not build on MinGW (thanks for patch by tono)
2009-05-15 17:31:07 +0200 mst r271957 : fix typos
2009-05-15 17:28:57 +0200 mst r271956 : #i101965#
- offapi/com/sun/star/text/TextPortion:
+ add missing properties:
SoftPageBreak, DocumentIndexMark, ReferenceMark, Footnote, TextField
+ fix read-only status of properties: Bookmark, IsStart, IsCollapsed
- offapi/type_reference/{typelibrary_history.txt,types.rdb}:
+ update reference types.rdb
2009-05-07 14:41:38 +0200 mst r271669 : - sw/inc/{fmtftn.hxx,unocoll.hxx,doc.hxx,editsh.hxx,ftninfo.hxx},
sw/source/core/layout/{flowfrm.cxx,ftnfrm.cxx},
sw/source/core/doc/docftn.cxx, sw/source/core/edit/edattr.cxx,
sw/source/core/txtnode/atrftn.cxx, sw/source/core/unocore/unocoll.cxx,
sw/source/ui/fldui/fldref.cxx:
+ fix warning ... the hard way
+ also fix signature of SwDoc::SetCurFtn
2009-05-05 19:52:55 +0200 mst r271556 : - sw/inc/undobj.hxx:
+ make some members const
2009-05-05 19:34:40 +0200 mst r271555 : - sw/inc/rolbck.hxx, sw/source/core/undo/rolbck.cxx:
+ make some members const
2009-05-05 19:13:14 +0200 mst r271553 : - sw/inc/{undobj.hxx,rolbck.hxx},
sw/source/core/undo/{unbkmk.cxx,rolbck.cxx}:
+ fix rebase merge error
+ rename SwHstryBookmark to SwHistoryBookmark
+ clean up SwUndoBookmark
2009-05-05 19:05:53 +0200 mst r271552 : - sw/source/core/unocore/unoportenum.cxx:
+ fix annoying assertion
2009-05-05 15:34:48 +0200 mst r271522 : CWS-TOOLING: rebase CWS odfmetadata2 to trunk@271427 (milestone: DEV300:m47)
2009-05-04 12:37:01 +0200 mst r271444 : trivial
2009-04-22 13:30:37 +0200 mst r271102 : - sfx2/inc/sfx2/dinfdlg.hxx:
+ trivial change
2009-04-21 16:46:58 +0200 mst r271043 : - sw/inc/hintids.hxx:
+ introduce some predicates for the various hints, and use them
2009-04-21 16:19:03 +0200 mst r271041 : - sw/inc/undobj.hxx,
sw/source/core/doc/{docfly.cxx,docfmt.cxx,docftn.cxx,doctxm.cxx},
sw/source/core/undo/{unattr.cxx,unins.cxx}:
+ clean up unattr.cxx:
remove/fix casts, prefix members, use auto_ptr, etc.
2009-04-21 15:34:23 +0200 mst r271039 : - sw/inc/{rolbck.hxx,undobj.hxx},
sw/source/core/doc/docfmt.cxx,
sw/source/core/txtnode/{thints.cxx,txtedt.cxx},
sw/source/core/undo/{rolbck.cxx,undel.cxx,undobj.cxx,unins.cxx,unmove.cxx,
unovwr.cxx,unsect.cxx,unspnd.cxx,untbl.cxx,untblk.cxx,unattr.cxx}:
+ clean up SwHistory, SwRegHistory and SwHistoryHint etc.:
remove/fix casts, prefix members, remove wrong const annotations,
use auto_ptr, remove unused members, etc.
2009-04-20 19:17:36 +0200 mst r271013 : - sw/inc/ndhints.hxx,
sw/source/core/text/{itrtxt.cxx,txtftn.cxx,itratr.cxx,porfly.cxx,
txtfrm.cxx,txtdrop.cxx,frmform.cxx},
sw/source/core/txtnode/{ndtxt.cxx,ndhints.cxx,thints.cxx,txtedt.cxx},
sw/source/core/edit/acorrect.cxx,
sw/source/core/doc/{docedt.cxx,docfmt.cxx},
sw/source/filter/html/swhtml.cxx:
+ clean up SwHintsArray and its subclasses: remove/fix casts, prefix members
2009-04-20 18:42:07 +0200 mst r271007 : - sw/source/core/text/txtio.cxx, sw/source/core/edit/edattr.cxx,
sw/source/core/undo/rolbck.cxx:
+ remove JP_NEWCORE dead code
2009-04-20 18:38:09 +0200 mst r271006 : - sw/source/core/unocore/unochart.cxx:
+ silence unxlngi warning (debug=t)
2009-04-20 16:36:13 +0200 mst r270991 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx,
sfx2/source/doc/objserv.cxx, sw/source/ui/fldui/flddinf.hxx:
+ trivial cleanups
2009-04-20 15:28:52 +0200 mst r270990 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx,
sfx2/source/doc/objserv.cxx:
+ fix bug: replaying a macro with a DocumentInfoItem removes all
user-defined properties
2009-03-10 15:08:20 +0100 mst r269273 : - sfx2/source/doc/Metadatable.cxx:
+ add missing SolarMutex guards
2009-03-10 14:46:29 +0100 mst r269272 : - unoxml/source/rdf/librdf_repository.cxx:
+ never free rdf_world because that would call libxm2 xmlCleanupParser
(and, to add insult to injury, other libxml2 functions later...)
2009-03-06 19:02:44 +0100 mst r269041 : argh! undo...
2009-03-06 19:00:58 +0100 mst r269040 : fix #i99931#
- sw/source/ui/uno/unomod.cxx:
+ SwXViewSettings::_getSingleValue returns uninitialized memory
for the ZoomType property if the value is PAGE_WIDTH_EXACT
2009-03-06 18:59:28 +0100 mst r269039 : - sw/inc/ndtxt.hxx, sw/source/core/txtnode/ndtxt.cxx,
sw/source/core/unocore/unoportenum.cxx:
+ fix some more wntmsci12 warnings...
2009-03-06 18:56:46 +0100 mst r269038 : - sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx:
+ work around spurious warning on unxsoli4 debug=t
2009-03-05 14:02:01 +0100 mst r268902 : - sw/inc/txatbase.hxx:
+ back to c-style casts, they also compile on wntmsci12...
2009-03-05 10:23:25 +0100 mst r268882 : - comphelper/inc/comphelper/processfactory.hxx,
comphelper/source/processfactory/processfactory.cxx:
+ revert change of return type of comphelper_getProcessComponentContext
to Reference: does not build on wntmsci12
2009-03-04 19:08:09 +0100 mst r268861 : - sw/source/core/txtnode/{atrtox.cxx,ndtxt.cxx}:
+ fix initialization
2009-03-04 14:37:30 +0100 mst r268831 : - solenv/inc/target.mk:
+ fix CLASSPATH so complex tests run (fix by sb)
2009-03-04 14:36:30 +0100 mst r268830 : - sw/inc/unoobj.hxx,
sw/source/core/unocore/{unoparagraph.cxx,unoobj.cxx,unoobj2.cxx}:
+ SwXParaFrameEnumeration constructor now takes SwPaM, not SwUnoCrsr
+ move SwParaSelection into unoparagraph.cxx, as it is only used there
+ bugfix: replace SwUnoCrsrs on stack with SwCursors
2009-03-04 14:34:46 +0100 mst r268829 : - sw/inc/pam.hxx, sw/source/core/crsr/pam.cxx,
sw/source/core/edit/eddel.cxx, sw/source/core/doc/docredln.cxx,
sw/source/core/undo/{untbl.cxx,undel.cxx}, sw/source/filter/rtf/swparrtf.cxx:
+ clean up SwPaM: prefix members
+ new constructor SwPosition(SwCntntNode&, xub_StrLen)
+ fix several broken SwPosition and SwPaM constructors
+ SwPam::DeleteMark now actually resets the unused position to default
2009-03-02 12:07:09 +0100 mst r268646 : - sw/inc/fmtcol.hxx:
+ fix annoying warning (gcc 4)
2009-03-02 12:06:27 +0100 mst r268645 : - odk/util/check.pl, odk/examples/DevelopersGuide/Text/TextDocuments.java:
+ rename module from FieldMaster to fieldmaster
2009-02-27 19:49:56 +0100 mst r268614 : - sfx2/inc/sfx2/Metadatable.hxx, sfx2/prj/d.lst,
sfx2/source/doc/{Metadatable.cxx,makefile.mk},
sw/inc/{SwMetadatable.hxx,unoobj.hxx,undobj.hxx,ndtxt.hxx},
sw/source/core/doc/{SwMetadatable.cxx,makefile.mk,docnew.cxx},
sw/source/core/undo/{untbl.cxx,unins.cxx},
sw/source/core/unocore/unoparagraph.cxx, sw/source/ui/app/docsh.cxx:
+ move Metadatable implementation from sw to sfx2
2009-02-27 17:58:55 +0100 mst r268608 : - sw/inc/{SwMetadatable.hxx,undobj.hxx}, sw/source/core/doc/SwMetadatable.cxx,
sw/source/core/undo/{untbl.cxx,unins.cxx,undel.cxx}:
+ CreateUndo now returns an opaque MetadatableUndo object
2009-02-27 13:15:44 +0100 mst r268587 : - sw/inc/ndtxt.hxx, sw/source/core/doc/docfmt.cxx,
sw/source/core/text/{itratr.cxx,porlay.cxx},
sw/source/core/txtnode/{txtedt.cxx,ndtxt.cxx,thints.cxx}:
+ clean up SwTxtNode: fix casts, prefix members
+ factor out inline function SwTxtNode::TryDeleteSwpHints()
2009-02-27 13:14:30 +0100 mst r268586 : - svx/inc/svx/emphitem.hxx:
+ fix borken header guard
2009-02-27 13:13:56 +0100 mst r268585 : - sfx2/source/bastyp/progress.cxx:
+ fix use of compiler specific macro
2009-02-27 11:00:32 +0100 mst r268564 : - sw/inc/{txatbase.hxx,txtatr.hxx,txtinet.hxx,txtfld.hxx,txtftn.hxx,
txtflcnt.hxx,txttxmrk.hxx,txtrfmrk.hxx},
sw/source/core/txtnode/{atrtox.cxx,atrref.cxx,atrflyin.cxx,atrftn.cxx,
txtatr2.cxx,txatbase.cxx,atrfld.cxx,txtedt.cxx},
sw/source/core/text/atrstck.cxx, sw/source/core/access/acchyperlink.cxx,
sw/source/core/doc/visiturl.cxx, sw/source/ui/wrtsh/wrtsh2.cxx:
+ clean up SwTxtAttr and its subclasses: remove/fix casts, prefix members
+ SwTxtINetFmt: remove unused member bColor
- sw/source/core/text/txtfld.cxx:
+ move SwTxtFld methods to atrfld.cxx
2009-02-27 10:58:44 +0100 mst r268563 : - sfx2/inc/sfx2/sfxbasemodel.hxx:
+ don't privately inherit BaseMutex, ScModelObj wants to access it
2009-02-27 10:58:02 +0100 mst r268562 : - xmloff/source/core/{RDFaExportHelper.cxx,RDFaImportHelper.cxx}:
+ arrrgh!!! someone thought it would be a good idea to have 2 different
versions of boost in external! and they're NOT compatible!!!
insert an ugly fragile hack that maybe works with both...
2009-02-26 17:42:26 +0100 mst r268544 : - comphelper/inc/comphelper/storagehelper.hxx.
sfx2/source/doc/DocumentMetadataAccess.cxx:
+ someone made IsValidZipEntryFileName a static method and didn't tell me
2009-02-26 15:52:56 +0100 mst r268529 : redland: split up patches
2009-02-26 13:17:56 +0100 mst r268509 : migration of cws odfmetadata2 from CVS (resync to m42): module sw
#i95863#
- sw/inc/segdefs{,_}.hxx:
+ remove obsolete files
- sw/source/ui/inc/itemdef.hxx:
+ remove itemdef.hxx
- sw/source/ui/app/[apphdl.cxx,docsh.cxx}, sw/source/ui/misc/glshell.cxx,
sw/source/ui/shells/*.cxx, sw/source/ui/uiview/*.cxx, sw/source/ui/web/*.cxx:
+ use sfx2/msg.hxx instead of itemdef.hxx
- sw/source/core/edit/eddel.cxx:
+ @ JP: SwEditShell::Replace:
you're right, deleting the text to be replaced first, and then inserting
a space, and then replacing that space is unnecessary.
whew, i'm so happy that we finally answered that question after 11 years.
- sw/inc/edimp.hxx:
+ remove FOREACHCURSOR_START, FOREACHCURSOR_END
- sw/inc/{swcrsr.hxx,unocrsr.hxx,viscrs.hxx},
sw/source/core/crsr/{crsrsh.cxx,swcrsr.cxx,trvlreg.cxx,trvltbl.cxx,
unocrsr.cxx,viscrs.cxx},
sw/source/core/doc/{docbm.cxx,doccorr.cxx},
sw/source/core/docnode/{ndtbl.cxx,ndtbl1.cxx},
sw/source/core/edit/editsh.cxx,
sw/source/core/frmedt/{fefly1.cxx,fetab.cxx,tblsel.cxx},
sw/source/core/layout/trvlfrm.cxx,
sw/source/core/unocore/{unochart.cxx,unoobj2.cxx,unoparagraph.cxx,
unoportenum.cxx,unotbl.cxx},
sw/source/core/view/vprint.cxx:
+ remove the hideous virtual operator SwFooCursor*
+ make SwCursor::IsReadOnlyAvailable() virtual
+ make SwUnoCrsr::Clone() virtual
+ refactor SwCursor methods IsSelOver(), LeftRight(), UpDown(), GotoTable():
replace dynamic_cast<...>(this) with new virtual methods
2009-02-26 13:14:58 +0100 mst r268508 : migration of cws odfmetadata2 from CVS (resync to m42): module sw
- sw/source/filter/xml/swxml.cxx:
+ XMLReader::Read: load RDF metadata of the ODF document
- sw/source/filter/xml/wrtxml.cxx:
+ SwXMLWriter::_Write: write RDF metadata of the ODF document if ODF >= 1.2
#i90620#: import xml:id in text tables (does not actually work yet)
- sw/source/filter/xml/xmltbli{.hxx,.cxx}:
+ SwXMLTableCellAttrTokens,aTableCellAttrTokenMap: add XML_TOK_TABLE_XMLID
+ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl: attribute xml:id
+ SwXMLTableCellContext_Impl::CreateChildContext: attribute xml:id
+ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl: attribute xml:id
+ SwXMLTableContext::SwXMLTableContext: attribute xml:id
fix #i98530#
- sw/inc/unoport.hxx, sw/source/core/unocore/unoport.cxx:
+ SwXTextPortion: make constructor params const&
- sw/source/core/unocore/unoportenum.cxx:
+ refactor to remove some code duplication
+ fix bug: paragraph w/out hints: bookmark before frame gets lost
#i97274# handle invalid tables
- sw/source/core/layout/tabfrm.cxx, sw/source/filter/xml/xmltbli.cxx:
+ SwXMLTableContext::MakeTable():
check that the table actually contains cells,
and abort (removing the inserted table nodes) if not
2009-02-26 13:11:48 +0100 mst r268507 : migration of cws odfmetadata2 from CVS (resync to m42): module sw
refactor SwXTextRange and SwXParagraph
- sw/inc/unoobj.hxx, sw/source/core/unocore/unoobj2.cxx:
+ remove 3 constructors of SwXTextRange
+ new method SwXTextRange::CreateParentXText
+ refactor SwXTextRange::CreateTextRangeFromPosition and
SwXTextRange::getText
- sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx:
+ SwXParagraph no longer uses a cursor; it registers directly at SwTxtNode
+ replace SwXParagraph::GetCrsr with SwXParagraph::GetTxtNode
- sw/source/core/unocore/unotext.cxx, sw/source/ui/uno/unotxvw.cxx:
+ adapt to new SwXParagraph
#i90620#
- sw/inc/SwMetadatable.hxx,
sw/source/core/doc/SwMetadatable.cxx:
+ new files: base classes sw::Metadatable and sw::MetadatableMixin;
also, 2 implementations of IXmlIdRegistry:
sw::XmlIdRegistryDocument and sw::XmlIdRegistryClipboard
+ setMetadataReference: handle empty stream name as auto-detect
- sw/source/core/doc/makefile.mk:
+ add SwMetadatable
add a XmlIdRegistry to SwDoc
- sw/inc/doc.hxx:
+ SwDoc: add member m_pXmlIdRegistry, method GetXmlIdRegistry()
- sw/source/core/doc/docnew.cxx:
+ initialize XmlIdRegistry in SwDoc::GetXmlIdRegistry, not in constructor,
because the constructor is not told whether the SwDoc is a clipboard
- sw/inc/docsh.hxx, sw/source/ui/app/docsh.cxx:
+ SwDocShell: override GetXmlIdRegistry()
#i91563#: make the SwTxtNode metadatable
- sw/inc/ndtxt.hxx
+ SwTxtNode inherits sw::Metadatable
- sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx:
+ SwXParagraph inherits sw::MetadatableMixin
#i91563#: handle SwTxtNode's metadata for delete
- sw/source/core/txtnode/ndtxt.cxx:
+ SwTxtNode::SplitCntntNode: handle XmlId
+ SwTxtNode::JoinNext: merge XmlIds
- sw/source/core/doc/docedt.cxx:
+ lcl_GetJoinFlags: document postcondition
+ SwDoc::Delete: remove XmlId only if SwTxtNode _becomes_ empty
#i91563#: handle SwTxtNode's metadata for delete with undo
- sw/inc/undobj.hxx
+ SwUndoDelete: new members m_pMetadataUndoStart, m_pMetadataUndoEnd
- sw/source/core/undo/undel.cxx:
+ SwUndoDelete::SaveCntnt: save XmlIds for start and end SwTxtNode
+ SwUndoDelete::SaveCntnt: remove XmlId only if SwTxtNode _becomes_ empty
+ SwUndoDelete::Undo: restore saved XmlIds for start and end SwTxtNode
- sw/source/core/docnode/ndcopy.cxx:
+ SwTxtNode::MakeCopy: register copy at XmlIdRegistry
#i91563#: handle SwTxtNode's metadata for find/replace with undo
- sw/source/core/undo/unins.cxx:
+ _UnReplaceData: rename members: add prefix m_
+ _UnReplaceData: new members m_pMetadataUndoStart, m_pMetadataUndoEnd
+ _UnReplaceData::_UnReplaceData: save XmlIds for start and end SwTxtNode
+ _UnReplaceData::Undo: restore saved XmlIds for start and end SwTxtNode
#i91563#: handle SwTxtNode's metadata for table-to-text with undo
- sw/source/core/undo/untbl.cxx:
+ SwTblToTxtSave: rename members: add prefix m_
+ SwTblToTxtSave: new members m_pMetadataUndoStart, m_pMetadataUndoEnd
+ SwTblToTxtSave::SwTblToTxtSave: save XmlIds for start and end SwTxtNode
+ SwTblToTxtSave::SwTblToTxtSave, SwNodes::UndoTableToText:
always store the index of the first SwTxtNode in the cell, instead of
the index of the first SwTxtNode in case of the first cell in a row,
and the cell start node in other cases
+ SwNodes::UndoTableToText: restore saved XmlIds for start and end SwTxtNode
- sw/source/core/docnode/ndtbl.cxx:
+ lcl_DelBox: simplify for refactored start index handling in SwTblToTxtSave
2009-02-26 13:02:28 +0100 mst r268505 : migration of cws odfmetadata2 from CVS (resync to m42): module sd
- sd/source/ui/table/tableobjectbar.cxx,sd/source/ui/view/*.cxx:
+ remove invocations of SFX_DECL_TYPE
- sd/source/ui/slideshow/SlideShowRestarter.cxx,
sd/source/ui/toolpanel/LayoutMenu.cxx,
sd/source/ui/unoidl/DrawController.cxx,
sd/source/ui/view/{ViewShellBase.cxx,ViewTabBar.cxx,frmview.cxx}:
+ fix abuses of comphelper_getProcessComponentContext (missing release)
2009-02-26 13:01:24 +0100 mst r268504 : migration of cws odfmetadata2 from CVS (resync to m42): module starmath
- starmath/source/document.cxx:
+ don't touch SfxObjectShell's privates
2009-02-26 13:00:37 +0100 mst r268503 : migration of cws odfmetadata2 from CVS (resync to m42): module sfx2
#i90620#
- sfx2/inc/sfx2/XmlIdRegistry.hxx:
+ new file: interfaces sfx2::IXmlIdRegistry and sfx2::IXmlIdRegistrySupplier
and a couple of utility functions
- sfx2/inc/sfx2/DocumentMetadataAccess.hxx,
sfx2/source/doc/DocumentMetadataAccess.cxx:
+ new class sfx2::DocumentMetadataAccess, implements XDocumentMetadataAccess
+ the URI of the DocumentMetadataAccess is now the URI from which the
document was loaded; for a new document, use a vnd.sun.star.tdoc URI
+ add new function sfx2::createBaseURI()
+ prevent using reserved file names
+ try not to recurse into embedded subdocuments
- sfx2/source/doc/makefile.mk:
+ add DocumentMetadataAccess
- sfx2/util/makefile.mk:
+ link libsfx2 against libxml2 (needed for xmlValidateNCName)
- sfx2/source/doc/makefile.mk:
+ add LIBXML_CFLAGS to CFLAGS
- sfx2/prj/build.lst:
+ add dependence on libxml2
- sfx2/prj/d.lst:
+ add XmlIdRegistry.hxx, DocumentMetadataAccess.hxx
- sfx2/inc/sfx2/objsh.hxx, sfx2/source/doc/objxtor.cxx:
+ make SfxObjectShell's members private
+ new method SfxObjectShell::GetAutoStyleFilterIndex
+ SfxObjectShell inherits sfx2::IXmlIdRegistrySupplier
- sfx2/source/dialog/templdlg.cxx, sfx2/source/doc/sfxbasemodel.cxx:
+ don't touch SfxObjectShell's privates
- sfx2/inc/sfx2/sfxbasemodel.hxx, sfx2/source/doc/sfxbasemodel.cxx:
+ SfxBaseModel inherits BaseMutex instead of IMPL_SfxBaseModel_MutexContainer
+ SfxBaseModel implements additional interface XDocumentMetadataAccess
+ IMPL_SfxBaseModel_DataContainer has new member:
a sfx2::DocumentMetadataAccess
+ implementation of XDocumentMetadataAccess forwards to
the sfx2::DocumentMetadataAccess member
- sfx2/qa/complex/DocumentMetadataAccessTest.java,
sfx2/qa/complex/{tests.sce,makefile.mk},
sfx2/qa/complex/testdocuments/TESTRDFA.odt:
+ add complex test: DocumentMetadataAccessTest
+ add RDFa test document
#i95863#
- sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx:
+ refactor SfxDocumentItem so it no longer requires a XDocumentInfo
+ move struct CustomProperty to implementation file
+ remove class SfxDocumentUserPage
+ QueryValue,PutValue: remove MID_DOCINFO_FIELD*
- sfx2/source/doc/objserv.cxx:
+ adapt to SfxDocumentItem change
- sfx2/inc/sfx2/sfx.hrc, sfx2/sdi/sfxslots.sdi, sfx2/inc/sfx2/msg.hxx:
+ remove MID_DOCINFO_FIELD*
+ put all invocations of SFX_DECL_TYPE in msg.hxx, and undef SFX_DECL_TYPE
- sfx2/source/doc/objxtor.cxx:
+ fix abuses of comphelper_getProcessComponentContext (missing release)
- sfx2/source/doc/docfile.cxx:
+ SfxMedium::SfxMedium: don't dereference NULL, throw exception instead
- sfx2/source/doc/objstor.cxx:
+ SfxObjectShell::DoLoad: fix bug: DocumentBaseURI is not initialized
2009-02-26 12:58:07 +0100 mst r268502 : migration of cws odfmetadata2 from CVS (resync to m42): module xmloff
#i90620#: implement RDFa import (interface change)
- xmloff/inc/xmloff/xmlimp.hxx. xmloff/source/core/xmlimp.cxx:
+ make SvXMLImport::GetAbsoluteReference() const
+ add SvXMLImport::GetComponentContext()
+ SvXMLImport::_InitCtor(): add RDFa namespace
+ add SvXMLImport::AddRDFa()
+ SvXMLImport::endDocument() inserts RDFa into document repository
- xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/xmltoken.cxx:
+ new tokens for RDFa: XML_ABOUT, XML_DATATYPE
- xmloff/inc/RDFaImportHelper.hxx, xmloff/source/core/RDFaImportHelper.cxx:
+ new class RDFaImportHelper
+ adapt the code to the bleak reality of broken C++ implementations
+ handle empty xhtml:about attributes properly, which are actually
valid relative URIs
+ work around broken SvXMLImport::GetAbsoluteReference
- xmloff/source/core/makefile.mk:
+ add RDFaImportHelper.cxx
#i90620#: implement RDFa export
- xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx:
+ add SvXMLExport::EnsureNamespace(), and a stack of namespace maps
+ add SvXMLExport::GetComponentContext()
+ add SvXMLExport::AddAttributesRDFa()
- xmloff/inc/RDFaExportHelper.hxx, xmloff/source/core/RDFaExportHelper.cxx:
+ new class RDFaExportHelper
+ don't use std::map::data_type, which is actually called
std::map::mapped_type by libstdc++
- xmloff/source/core/makefile.mk:
+ add RDFaExportHelper.cxx
#i91563#
- xmloff/inc/xmloff/txtimp.hxx, xmloff/source/text/txtimp.cxx:
+ XMLTextPAttrTokens: add RDFa tokens
- xmloff/source/text/txtparai{.hxx,.cxx}:
+ import RDFa for text:p
- xmloff/source/text/txtparae.cxx:
+ export RDFa for text:p
interface change: use XHTML namespace instead of RDFA
- xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx,
xmloff/source/core/{xmltoken.cxx,xmlimp.cxx,xmlexp.cxx,RDFaExportHelper.cxx},
xmloff/source/text/txtimp.cxx:
+ use XHTML namespace instead of RDFA
#i91565#, #i91566#: (preliminary) import for text:meta, text:meta-field
- xmloff/source/text/txtparai.cxx:
+ new class XMLMetaImportContextBase with subclasses to import
text:meta and text:meta-field
- xmloff/source/text/XMLTextMarkImportContext.cxx:
+ change XMLTextMarkImportContext::CreateAndInsertMark to handle marks
with no name (text:meta)
#i91565#, #i91566#: (preliminary) export for text:meta, text:meta-field
- xmloff/inc/txtflde.hxx, xmloff/source/text/txtflde.cxx:
+ add FIELD_ID_META to FieldIdEnum
+ new method XMLTextFieldExport::ExportMetaField()
+ change XMLTextFieldExport::ExportField{,AutoStyle,Helper}
to take additional parameter for progress bar
- xmloff/inc/xmloff/txtparae.hxx, xmloff/source/text/txtparae.cxx:
+ make XMLTextParagraphExport::exportTextRangeEnumeration() public
+ new method XMLTextParagraphExport::exportMeta()
#i90620#
- xmloff/inc/xmloff/xmlimp.hxx, xmloff/source/core/xmlimp.cxx,
xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx:
+ rename SvXML{Im,Ex}port::GetStreamPath() to GetStreamName()
+ fix xml:id {im,ex}port for embedded documents and non-packages
+ adapt to API change: XMetadatable
#i90620# GRDDL
- xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx,
xmloff/source/core/{xmltoken.cxx,xmlexp.cxx}:
+ add GRDDL namespace
+ add token XML_TRANSFORMATION
+ add grddl:transformation attribute to root elements for meta.xml,
content.xml and styles.xml
2009-02-26 12:54:40 +0100 mst r268501 : migration of cws odfmetadata2 from CVS (resync to m42): module unoxml
#i90620#
- unoxml/source/rdf/librdf_repository.cxx:
+ librdf_Repository::importGraph: allocate buffer sized length of stream
+ switch from one librdf_world per repository to a single static world
because redland has global variables with a brain-damaged life-cycle...
+ exportGraph: use new raptor 1.4.18 feature to disable writing
an xml:base attribute in RDF/XML files
- unoxml/source/rdf/librdf_repository.cxx:
unoxml/qa/complex/RDFRepositoryTest.java:
+ adapt to predicate is URI change
+ adapt to RDFa API change
+ adapt to API change: RDFa has multiple predicates...
+ adapt to API change: XMetadatable derives from XURI
+ allow xhtml:datatype without xhtml:content
+ adapt to API change: attribute MetadataReference is StringPair
- unoxml/source/rdf/CURI.cxx:
+ add some more URI constants
2009-02-26 12:53:32 +0100 mst r268500 : migration of cws odfmetadata2 from CVS (resync to m42): module package
- package/inc/ImplValidCharacters.hxx:
+ remove (moved to comphelper)
2009-02-26 12:52:49 +0100 mst r268499 : migration of cws odfmetadata2 from CVS (resync to m42): module comphelper
- comphelper/inc/comphelper/processfactory.hxx,
comphelper/source/processfactory/processfactory.cxx:
+ add getProcessComponentContext()
+ change return type of comphelper_getProcessComponentContext to Reference
- comphelper/inc/comphelper/stl_types.hxx:
+ add OUStringBufferAppender
+ add algorithm intersperse
- comphelper/source/misc/string.cxx:
+ rewrite convertCommaSeparated with intersperse and OUStringBufferAppender
- comphelper/inc/comphelper/stlunosequence.hxx:
+ fix bug: begin() on empty sequence != end()
2009-02-26 12:50:47 +0100 mst r268498 : migration of cws odfmetadata2 from CVS (resync to m42): module offapi
#i96209#
- offapi/com/sun/star/text/fieldmaster/*.idl:
+ rename module from FieldMaster to fieldmaster
- offapi/type_reference/{typelibrary_history.txt,types.rdb}:
+ update reference types.rdb
#i90620#
- offapi/com/sun/star/rdf/{XMetadatable.idl,XDocumentMetadataAccess.idl}:
+ API change: XMetadatable derives from XURI
+ API change: replace XmlId (string) with MetadataReference (StringPair)
- offapi/com/sun/star/rdf/{Statement.idl,XDocumentRepository.idl,
XNamedGraph.idl,XRepository.idl}:
+ the predicate of a statement is a URI, not a Resource
- offapi/com/sun/star/rdf/XDocumentMetadataAccess.idl:
+ rename: s/Package/Document/
+ remove uuid
+ remove everything related to mapping
+ graph names are now generated from base URI and file names
+ load methods: improve error handling with XInteractionHandler
- offapi/com/sun/star/rdf/XDocumentRepository.idl:
+ change: RDFa permits using multiple predicates in one attribute
+ setStatementRDFa: subject is now XResource, object is now XMetadatable
- offapi/com/sun/star/rdf/URIs.idl:
+ add some more URI constants
- offapi/com/sun/star/rdf:
+ fix @since tags and replace <method> with <member>
2009-02-26 12:47:24 +0100 mst r268497 : migration of cws odfmetadata2 from CVS (resync to m42): module redland
fix #i93768#
- redland/raptor-1.4.17.patch, redland/raptor/makefile.mk:
+ disable GRDDL parser to prevent call to libxslt
xsltSetDefaultSecurityPrefs, which breaks xmlhelp
- redland/raptor/makefile.mk, redland/raptor-1.4.17.patch,
redland/raptor-1.4.18.patch:
+ upgrade raptor to 1.4.18
+ deactivate serializer for RSS/Atom (does not build)
- redland/rasqal/makefile.mk, redland/rasqal-0.9.15.patch,
redland/rasqal-0.9.16.patch,
+ upgrade rasqal to 0.9.16
- redland/redland/makefile.mk, redland/redland-1.0.7.patch,
redland/redland-1.0.8.patch:
+ upgrade redland to 1.0.8
- redland/redlandversion.mk:
+ the librasqal SONAME has changed
2009-07-02 09:05:03 +00:00
|
|
|
const bool bEndnote = pFtn->GetAttr()->GetFtn().IsEndNote();
|
2004-12-23 09:07:01 +00:00
|
|
|
if( bEndnote && pFtn->IsInSct() )
|
|
|
|
{
|
|
|
|
SwSectionFrm* pSect = pFtn->FindSctFrm();
|
|
|
|
if( pSect->IsEndnAtEnd() )
|
|
|
|
pRef = pSect->FindLastCntnt( FINDMODE_LASTCNT );
|
|
|
|
}
|
|
|
|
if( !pRef )
|
|
|
|
pRef = pFtn->GetRef();
|
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pRef, "MoveBwd: Endnote for an empty section?" );
|
2004-12-23 09:07:01 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !bEndnote )
|
2011-01-17 15:06:54 +01:00
|
|
|
pOldBoss = pOldBoss->FindFtnBossFrm( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFtnBossFrm *pRefBoss = pRef->FindFtnBossFrm( !bEndnote );
|
2002-11-11 08:46:51 +00:00
|
|
|
if ( pOldBoss != pRefBoss &&
|
|
|
|
// OD 08.11.2002 #104840# - use <SwLayoutFrm::IsBefore(..)>
|
|
|
|
( !bEndnote ||
|
|
|
|
pRefBoss->IsBefore( pOldBoss ) )
|
|
|
|
)
|
2011-01-17 15:06:54 +01:00
|
|
|
pNewUpper = rThis.GetLeaf( MAKEPAGE_FTN, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2012-04-04 09:42:32 +02:00
|
|
|
else if ( IsPageBreak( sal_True ) ) // Do we have to respect a PageBreak?
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// If the previous page doesn't have an Frm in the body,
|
|
|
|
// flowing back makes sense despite the PageBreak (otherwise,
|
|
|
|
// we'd get an empty page).
|
|
|
|
// Of course we need to overlook empty pages!
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm *pFlow = &rThis;
|
|
|
|
do
|
2006-05-24 12:54:43 +00:00
|
|
|
{
|
|
|
|
pFlow = pFlow->FindPrev();
|
|
|
|
} while ( pFlow &&
|
|
|
|
( pFlow->FindPageFrm() == pOldPage ||
|
|
|
|
!pFlow->IsInDocBody() ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pFlow )
|
|
|
|
{
|
|
|
|
long nDiff = pOldPage->GetPhyPageNum() - pFlow->GetPhyPageNum();
|
|
|
|
if ( nDiff > 1 )
|
|
|
|
{
|
|
|
|
if ( ((SwPageFrm*)pOldPage->GetPrev())->IsEmptyPage() )
|
|
|
|
nDiff -= 1;
|
|
|
|
if ( nDiff > 1 )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, sal_False );
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i53139#
|
2006-05-24 12:54:43 +00:00
|
|
|
// Now <pNewUpper> is a previous layout frame, which contains
|
|
|
|
// content. But the new upper layout frame has to be the next one.
|
|
|
|
// Thus, hack for issue i14206 no longer needed, but fix for issue 114442
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136024# - correct fix for i53139
|
2006-05-24 12:54:43 +00:00
|
|
|
// Check for wrong page description before using next new upper.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i66051# - further correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Check for correct type of new next upper layout frame
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136538# - another correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Assumption, that in all cases <pNewUpper> is a previous
|
|
|
|
// layout frame, which contains content, is wrong.
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136538# - another correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Beside type check, check also, if proposed new next upper
|
|
|
|
// frame is inside the same frame types.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i73194# - and yet another correction
|
2007-01-22 10:53:11 +00:00
|
|
|
// of fix for i53139:
|
|
|
|
// Assure that the new next upper layout frame doesn't
|
|
|
|
// equal the current one.
|
|
|
|
// E.g.: content is on page 3, on page 2 is only a 'ghost'
|
|
|
|
// section and on page 1 is normal content. Method <FindPrev(..)>
|
|
|
|
// will find the last content of page 1, but <GetLeaf(..)>
|
|
|
|
// returns new upper on page 2.
|
2006-07-13 10:31:19 +00:00
|
|
|
if ( pNewUpper->Lower() )
|
2003-07-01 14:11:27 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwLayoutFrm* pNewNextUpper = pNewUpper->GetLeaf( MAKEPAGE_NONE, sal_True );
|
2006-07-13 10:31:19 +00:00
|
|
|
if ( pNewNextUpper &&
|
2007-01-22 10:53:11 +00:00
|
|
|
pNewNextUpper != rThis.GetUpper() &&
|
2006-07-13 10:31:19 +00:00
|
|
|
pNewNextUpper->GetType() == pNewUpper->GetType() &&
|
|
|
|
pNewNextUpper->IsInDocBody() == pNewUpper->IsInDocBody() &&
|
|
|
|
pNewNextUpper->IsInFtn() == pNewUpper->IsInFtn() &&
|
|
|
|
pNewNextUpper->IsInTab() == pNewUpper->IsInTab() &&
|
|
|
|
pNewNextUpper->IsInSct() == pNewUpper->IsInSct() &&
|
|
|
|
!rThis.WrongPageDesc( pNewNextUpper->FindPageFrm() ) )
|
|
|
|
{
|
|
|
|
pNewUpper = pNewNextUpper;
|
|
|
|
bCheckPageDescOfNextPage = true;
|
|
|
|
}
|
2003-07-01 14:11:27 +00:00
|
|
|
}
|
|
|
|
|
2012-11-25 21:47:12 +09:00
|
|
|
bCheckPageDescs = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
else if ( IsColBreak( sal_True ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// If the previous column doesn't contain a CntntFrm, flowing back
|
|
|
|
// makes sense despite the ColumnBreak, as otherwise we'd get
|
|
|
|
// an empty column.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( rThis.IsInSct() )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pNewUpper && !SwFlowFrm::IsMoveBwdJump() &&
|
|
|
|
( pNewUpper->ContainsCntnt() ||
|
|
|
|
( ( !pNewUpper->IsColBodyFrm() ||
|
|
|
|
!pNewUpper->GetUpper()->GetPrev() ) &&
|
|
|
|
!pNewUpper->FindSctFrm()->GetPrev() ) ) )
|
2006-05-24 12:54:43 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewUpper = 0;
|
2006-05-24 12:54:43 +00:00
|
|
|
}
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i53139#
|
|
|
|
// #i69409# - check <pNewUpper>
|
|
|
|
// #i71065# - check <SwFlowFrm::IsMoveBwdJump()>
|
2006-12-01 13:25:31 +00:00
|
|
|
else if ( pNewUpper && !SwFlowFrm::IsMoveBwdJump() )
|
2006-05-24 12:54:43 +00:00
|
|
|
{
|
|
|
|
// Now <pNewUpper> is a previous layout frame, which
|
|
|
|
// contains content. But the new upper layout frame
|
|
|
|
// has to be the next one.
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136024# - correct fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Check for wrong page description before using next new upper.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i66051# - further correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Check for correct type of new next upper layout frame
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136538# - another correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Beside type check, check also, if proposed new next upper
|
|
|
|
// frame is inside the same frame types.
|
2011-01-17 15:06:54 +01:00
|
|
|
SwLayoutFrm* pNewNextUpper = pNewUpper->GetLeaf( MAKEPAGE_NOSECTION, sal_True );
|
2006-05-24 12:54:43 +00:00
|
|
|
if ( pNewNextUpper &&
|
2006-07-13 10:31:19 +00:00
|
|
|
pNewNextUpper->GetType() == pNewUpper->GetType() &&
|
|
|
|
pNewNextUpper->IsInDocBody() == pNewUpper->IsInDocBody() &&
|
|
|
|
pNewNextUpper->IsInFtn() == pNewUpper->IsInFtn() &&
|
|
|
|
pNewNextUpper->IsInTab() == pNewUpper->IsInTab() &&
|
|
|
|
pNewNextUpper->IsInSct() == pNewUpper->IsInSct() &&
|
2006-05-24 12:54:43 +00:00
|
|
|
!rThis.WrongPageDesc( pNewNextUpper->FindPageFrm() ) )
|
|
|
|
{
|
|
|
|
pNewUpper = pNewNextUpper;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SwFrm *pCol = rThis.FindColFrm();
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bGoOn = true;
|
|
|
|
bool bJump = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( pCol->GetPrev() )
|
|
|
|
pCol = pCol->GetPrev();
|
|
|
|
else
|
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bGoOn = false;
|
2011-01-17 15:06:54 +01:00
|
|
|
pCol = rThis.GetLeaf( MAKEPAGE_NONE, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if ( pCol )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// ColumnFrms now with BodyFrm
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayoutFrm* pColBody = pCol->IsColumnFrm() ?
|
|
|
|
(SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower() :
|
|
|
|
(SwLayoutFrm*)pCol;
|
|
|
|
if ( pColBody->ContainsCntnt() )
|
|
|
|
{
|
2012-11-25 21:47:12 +09:00
|
|
|
bGoOn = false; // We have content here! we accept this
|
2012-04-04 09:42:32 +02:00
|
|
|
// only if GetLeaf() has set the MoveBwdJump.
|
2000-09-18 23:08:29 +00:00
|
|
|
if( SwFlowFrm::IsMoveBwdJump() )
|
2006-05-24 12:54:43 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewUpper = pColBody;
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i53139#
|
2006-05-24 12:54:43 +00:00
|
|
|
// Now <pNewUpper> is a previous layout frame, which
|
|
|
|
// contains content. But the new upper layout frame
|
|
|
|
// has to be the next one.
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136024# - correct fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Check for wrong page description before using next new upper.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i66051# - further correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Check for correct type of new next upper layout frame
|
2011-04-18 12:37:38 -03:00
|
|
|
// #136538# - another correction of fix for i53139
|
2006-07-13 10:31:19 +00:00
|
|
|
// Beside type check, check also, if proposed new next upper
|
|
|
|
// frame is inside the same frame types.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i71065#
|
2006-12-01 13:25:31 +00:00
|
|
|
// Check that the proposed new next upper layout
|
|
|
|
// frame isn't the current one.
|
2011-01-17 15:06:54 +01:00
|
|
|
SwLayoutFrm* pNewNextUpper = pNewUpper->GetLeaf( MAKEPAGE_NONE, sal_True );
|
2006-05-24 12:54:43 +00:00
|
|
|
if ( pNewNextUpper &&
|
2006-12-01 13:25:31 +00:00
|
|
|
pNewNextUpper != rThis.GetUpper() &&
|
2006-07-13 10:31:19 +00:00
|
|
|
pNewNextUpper->GetType() == pNewUpper->GetType() &&
|
|
|
|
pNewNextUpper->IsInDocBody() == pNewUpper->IsInDocBody() &&
|
|
|
|
pNewNextUpper->IsInFtn() == pNewUpper->IsInFtn() &&
|
|
|
|
pNewNextUpper->IsInTab() == pNewUpper->IsInTab() &&
|
|
|
|
pNewNextUpper->IsInSct() == pNewUpper->IsInSct() &&
|
2006-05-24 12:54:43 +00:00
|
|
|
!rThis.WrongPageDesc( pNewNextUpper->FindPageFrm() ) )
|
|
|
|
{
|
|
|
|
pNewUpper = pNewNextUpper;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
if( pNewUpper ) // We already had an empty column, in other
|
2012-11-25 21:47:12 +09:00
|
|
|
bJump = true; // words we skipped one.
|
2012-04-04 09:42:32 +02:00
|
|
|
pNewUpper = pColBody; // this empty column could be considered,
|
|
|
|
// but we continue searching nevertheless.
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} while( bGoOn );
|
|
|
|
if( bJump )
|
2011-01-17 15:06:54 +01:00
|
|
|
SwFlowFrm::SetMoveBwdJump( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2012-04-04 14:46:35 +02:00
|
|
|
else // No breaks - we can flow back.
|
2011-01-17 15:06:54 +01:00
|
|
|
pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i27801# - no move backward of 'master' text frame,
|
2004-08-02 13:08:38 +00:00
|
|
|
// if - due to its object positioning - it isn't allowed to be on the new page frame
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i44049# - add another condition for not moving backward
|
2005-03-23 11:59:05 +00:00
|
|
|
// If one of its objects has restarted the layout process, moving backward
|
|
|
|
// isn't sensible either.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i47697# - refine condition made for issue i44049
|
2005-04-20 11:22:40 +00:00
|
|
|
// - allow move backward as long as the anchored object is only temporarily
|
|
|
|
// positions considering its wrapping style.
|
2004-08-02 13:08:38 +00:00
|
|
|
if ( pNewUpper &&
|
|
|
|
rThis.IsTxtFrm() && !IsFollow() )
|
|
|
|
{
|
|
|
|
sal_uInt32 nToPageNum( 0L );
|
|
|
|
const bool bMoveFwdByObjPos = SwLayouter::FrmMovedFwdByObjPos(
|
|
|
|
*(pOldPage->GetFmt()->GetDoc()),
|
|
|
|
static_cast<SwTxtFrm&>(rThis),
|
|
|
|
nToPageNum );
|
|
|
|
if ( bMoveFwdByObjPos &&
|
|
|
|
pNewUpper->FindPageFrm()->GetPhyPageNum() < nToPageNum )
|
|
|
|
{
|
|
|
|
pNewUpper = 0;
|
|
|
|
}
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i44049# - check, if one of its anchored objects
|
2005-03-23 11:59:05 +00:00
|
|
|
// has restarted the layout process.
|
|
|
|
else if ( rThis.GetDrawObjs() )
|
|
|
|
{
|
|
|
|
sal_uInt32 i = 0;
|
|
|
|
for ( ; i < rThis.GetDrawObjs()->Count(); ++i )
|
|
|
|
{
|
|
|
|
SwAnchoredObject* pAnchoredObj = (*rThis.GetDrawObjs())[i];
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i47697# - refine condition - see above
|
2005-04-20 11:22:40 +00:00
|
|
|
if ( pAnchoredObj->RestartLayoutProcess() &&
|
|
|
|
!pAnchoredObj->IsTmpConsiderWrapInfluence() )
|
2005-03-23 11:59:05 +00:00
|
|
|
{
|
|
|
|
pNewUpper = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-08-02 13:08:38 +00:00
|
|
|
}
|
|
|
|
|
2012-04-04 09:42:32 +02:00
|
|
|
// With Follows, it's only allowed to flow back if there's no neighbor
|
|
|
|
// in the new environment (because that would be the Master).
|
|
|
|
// (6677) If however we skipped empty pages, we still have to move.
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pNewUpper && IsFollow() && pNewUpper->Lower() )
|
|
|
|
{
|
2011-04-16 16:19:09 -03:00
|
|
|
// #i79774#
|
2007-10-16 10:38:16 +00:00
|
|
|
// neglect empty sections in proposed new upper frame
|
|
|
|
bool bProposedNewUpperContainsOnlyEmptySections( true );
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-10-16 10:38:16 +00:00
|
|
|
const SwFrm* pLower( pNewUpper->Lower() );
|
|
|
|
while ( pLower )
|
|
|
|
{
|
|
|
|
if ( pLower->IsSctFrm() &&
|
|
|
|
!dynamic_cast<const SwSectionFrm*>(pLower)->GetSection() )
|
|
|
|
{
|
|
|
|
pLower = pLower->GetNext();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bProposedNewUpperContainsOnlyEmptySections = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2007-10-16 10:38:16 +00:00
|
|
|
if ( !bProposedNewUpperContainsOnlyEmptySections )
|
|
|
|
{
|
|
|
|
if ( SwFlowFrm::IsMoveBwdJump() )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// Don't move after the Master, but into the next empty page.
|
2007-10-16 10:38:16 +00:00
|
|
|
SwFrm *pFrm = pNewUpper->Lower();
|
|
|
|
while ( pFrm->GetNext() )
|
|
|
|
pFrm = pFrm->GetNext();
|
2011-01-17 15:06:54 +01:00
|
|
|
pNewUpper = pFrm->GetLeaf( MAKEPAGE_INSERT, sal_True );
|
2012-04-04 09:42:32 +02:00
|
|
|
if( pNewUpper == rThis.GetUpper() ) // Did we end up in the same place?
|
|
|
|
pNewUpper = NULL; // If so, moving is not needed.
|
2007-10-16 10:38:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pNewUpper = 0;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
if ( pNewUpper && !ShouldBwdMoved( pNewUpper, sal_True, rbReformat ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( !pNewUpper->Lower() )
|
|
|
|
{
|
|
|
|
if( pNewUpper->IsFtnContFrm() )
|
|
|
|
{
|
|
|
|
pNewUpper->Cut();
|
|
|
|
delete pNewUpper;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwSectionFrm* pSectFrm = pNewUpper->FindSctFrm();
|
2011-04-18 12:37:38 -03:00
|
|
|
// #126020# - adjust check for empty section
|
|
|
|
// #130797# - correct fix #126020#
|
2006-02-06 15:30:31 +00:00
|
|
|
if ( pSectFrm && !pSectFrm->IsColLocked() &&
|
|
|
|
!pSectFrm->ContainsCntnt() && !pSectFrm->ContainsAny( true ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
pSectFrm->DelEmpty( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
delete pSectFrm;
|
2013-02-09 11:35:20 +01:00
|
|
|
rThis.mbValidPos = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pNewUpper = 0;
|
|
|
|
}
|
2004-06-28 12:08:52 +00:00
|
|
|
|
|
|
|
// OD 2004-05-26 #i21478# - don't move backward, if flow frame wants to
|
|
|
|
// keep with next frame and next frame is locked.
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i38232# - If next frame is a table, do *not* check,
|
2005-01-05 13:30:18 +00:00
|
|
|
// if it's locked.
|
2004-06-28 12:08:52 +00:00
|
|
|
if ( pNewUpper && !IsFollow() &&
|
|
|
|
rThis.GetAttrSet()->GetKeep().GetValue() && rThis.GetIndNext() )
|
|
|
|
{
|
|
|
|
SwFrm* pIndNext = rThis.GetIndNext();
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i38232#
|
2005-01-05 13:30:18 +00:00
|
|
|
if ( !pIndNext->IsTabFrm() )
|
2004-06-28 12:08:52 +00:00
|
|
|
{
|
2005-01-05 13:30:18 +00:00
|
|
|
// get first content of section, while empty sections are skipped
|
|
|
|
while ( pIndNext && pIndNext->IsSctFrm() )
|
2004-06-28 12:08:52 +00:00
|
|
|
{
|
2005-01-05 13:30:18 +00:00
|
|
|
if( static_cast<SwSectionFrm*>(pIndNext)->GetSection() )
|
2004-06-28 12:08:52 +00:00
|
|
|
{
|
2005-01-05 13:30:18 +00:00
|
|
|
SwFrm* pTmp = static_cast<SwSectionFrm*>(pIndNext)->ContainsAny();
|
|
|
|
if ( pTmp )
|
|
|
|
{
|
|
|
|
pIndNext = pTmp;
|
|
|
|
break;
|
|
|
|
}
|
2004-06-28 12:08:52 +00:00
|
|
|
}
|
2005-01-05 13:30:18 +00:00
|
|
|
pIndNext = pIndNext->GetIndNext();
|
|
|
|
}
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !pIndNext || pIndNext->ISA(SwTxtFrm),
|
2005-01-05 13:30:18 +00:00
|
|
|
"<SwFlowFrm::MovedBwd(..)> - incorrect next found." );
|
|
|
|
if ( pIndNext && pIndNext->IsFlowFrm() &&
|
|
|
|
SwFlowFrm::CastFlowFrm(pIndNext)->IsJoinLocked() )
|
|
|
|
{
|
|
|
|
pNewUpper = 0L;
|
2004-06-28 12:08:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i65250#
|
2006-06-02 11:11:54 +00:00
|
|
|
// layout loop control for flowing content again and again moving
|
|
|
|
// backward under the same layout condition.
|
|
|
|
if ( pNewUpper && !IsFollow() &&
|
2007-01-22 10:53:11 +00:00
|
|
|
pNewUpper != rThis.GetUpper() &&
|
2006-06-02 11:11:54 +00:00
|
|
|
SwLayouter::MoveBwdSuppressed( *(pOldPage->GetFmt()->GetDoc()),
|
|
|
|
*this, *pNewUpper ) )
|
|
|
|
{
|
|
|
|
SwLayoutFrm* pNextNewUpper = pNewUpper->GetLeaf(
|
|
|
|
( !rThis.IsSctFrm() && rThis.IsInSct() )
|
|
|
|
? MAKEPAGE_NOSECTION
|
|
|
|
: MAKEPAGE_NONE,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_True );
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i73194# - make code robust
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pNextNewUpper, "<SwFlowFrm::MoveBwd(..)> - missing next new upper" );
|
2007-01-22 10:53:11 +00:00
|
|
|
if ( pNextNewUpper &&
|
|
|
|
( pNextNewUpper == rThis.GetUpper() ||
|
|
|
|
pNextNewUpper->GetType() != rThis.GetUpper()->GetType() ) )
|
2006-06-02 11:11:54 +00:00
|
|
|
{
|
|
|
|
pNewUpper = 0L;
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwFlowFrm::MoveBwd(..)> - layout loop control for layout action <Move Backward> applied!" );
|
2006-06-02 11:11:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( pNewUpper != rThis.GetUpper(),
|
2007-01-22 10:53:11 +00:00
|
|
|
"<SwFlowFrm::MoveBwd(..)> - moving backward to the current upper frame!? -> Please inform OD." );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pNewUpper )
|
|
|
|
{
|
|
|
|
PROTOCOL_ENTER( &rThis, PROT_MOVE_BWD, 0, 0 );
|
|
|
|
if ( pNewUpper->IsFtnContFrm() )
|
|
|
|
{
|
|
|
|
//Kann sein, dass ich einen Container bekam.
|
|
|
|
SwFtnFrm *pOld = rThis.FindFtnFrm();
|
2010-06-13 15:22:56 +02:00
|
|
|
SwFtnFrm *pNew = new SwFtnFrm( pOld->GetFmt(), pOld,
|
2000-09-18 23:08:29 +00:00
|
|
|
pOld->GetRef(), pOld->GetAttr() );
|
|
|
|
if ( pOld->GetMaster() )
|
|
|
|
{
|
|
|
|
pNew->SetMaster( pOld->GetMaster() );
|
|
|
|
pOld->GetMaster()->SetFollow( pNew );
|
|
|
|
}
|
|
|
|
pNew->SetFollow( pOld );
|
|
|
|
pOld->SetMaster( pNew );
|
|
|
|
pNew->Paste( pNewUpper );
|
|
|
|
pNewUpper = pNew;
|
|
|
|
}
|
|
|
|
if( pNewUpper->IsFtnFrm() && rThis.IsInSct() )
|
|
|
|
{
|
|
|
|
SwSectionFrm* pSct = rThis.FindSctFrm();
|
2012-04-04 09:42:32 +02:00
|
|
|
// If we're in a section of a footnote, we may need to create
|
|
|
|
// a SwSectionFrm in the new upper
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSct->IsInFtn() )
|
|
|
|
{
|
|
|
|
SwFrm* pTmp = pNewUpper->Lower();
|
|
|
|
if( pTmp )
|
|
|
|
{
|
|
|
|
while( pTmp->GetNext() )
|
|
|
|
pTmp = pTmp->GetNext();
|
|
|
|
if( !pTmp->IsSctFrm() ||
|
|
|
|
((SwSectionFrm*)pTmp)->GetFollow() != pSct )
|
|
|
|
pTmp = NULL;
|
|
|
|
}
|
|
|
|
if( pTmp )
|
|
|
|
pNewUpper = (SwSectionFrm*)pTmp;
|
|
|
|
else
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
pSct = new SwSectionFrm( *pSct, sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
pSct->Paste( pNewUpper );
|
2001-11-13 14:21:55 +00:00
|
|
|
pSct->Init();
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewUpper = pSct;
|
|
|
|
pSct->SimpleFormat();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-25 21:47:12 +09:00
|
|
|
bool bUnlock = false;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bFollow = sal_False;
|
2012-04-04 09:42:32 +02:00
|
|
|
// Lock section. Otherwise, it could get destroyed if the only Cntnt
|
|
|
|
// moves e.g. from the second into the first column.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwSectionFrm* pSect = pNewUpper->FindSctFrm();
|
|
|
|
if( pSect )
|
|
|
|
{
|
|
|
|
bUnlock = !pSect->IsColLocked();
|
|
|
|
pSect->ColLock();
|
|
|
|
bFollow = pSect->HasFollow();
|
|
|
|
}
|
|
|
|
pNewUpper->Calc();
|
|
|
|
rThis.Cut();
|
2011-04-16 16:19:09 -03:00
|
|
|
//
|
2005-03-23 10:52:56 +00:00
|
|
|
// optimization: format section, if its size is invalidated and if it's
|
|
|
|
// the new parent of moved backward frame.
|
|
|
|
bool bFormatSect( false );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bUnlock )
|
|
|
|
{
|
2005-03-23 10:52:56 +00:00
|
|
|
pSect->ColUnlock();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSect->HasFollow() != bFollow )
|
2005-03-23 10:52:56 +00:00
|
|
|
{
|
2004-03-17 11:48:53 +00:00
|
|
|
pSect->InvalidateSize();
|
2011-04-16 16:19:09 -03:00
|
|
|
// - optimization
|
2005-03-23 10:52:56 +00:00
|
|
|
if ( pSect == pNewUpper )
|
|
|
|
bFormatSect = true;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rThis.Paste( pNewUpper );
|
2011-04-16 16:19:09 -03:00
|
|
|
// - optimization
|
2005-03-23 10:52:56 +00:00
|
|
|
if ( bFormatSect )
|
|
|
|
pSect->Calc();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-07-16 12:03:07 +00:00
|
|
|
SwPageFrm *pNewPage = rThis.FindPageFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pNewPage != pOldPage )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
rThis.Prepare( PREP_BOSS_CHGD, (const void*)pOldPage, sal_False );
|
2011-02-09 15:55:27 +01:00
|
|
|
ViewShell *pSh = rThis.getRootFrm()->GetCurrShell();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pSh && !pSh->Imp()->IsUpdateExpFlds() )
|
2012-04-04 09:42:32 +02:00
|
|
|
pSh->GetDoc()->SetNewFldLst(true); // Will be done by CalcLayout() later on
|
2006-07-10 14:29:29 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewPage->InvalidateSpelling();
|
2007-01-02 15:48:46 +00:00
|
|
|
pNewPage->InvalidateSmartTags(); // SMARTTAGS
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewPage->InvalidateAutoCompleteWords();
|
2006-07-10 14:29:29 +00:00
|
|
|
pNewPage->InvalidateWordCount();
|
|
|
|
|
2002-11-01 10:43:00 +00:00
|
|
|
// OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout
|
2010-06-13 15:22:56 +02:00
|
|
|
if ( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2002-11-01 10:43:00 +00:00
|
|
|
if ( bCheckPageDescs && pNewPage->GetNext() )
|
2004-02-16 10:58:00 +00:00
|
|
|
{
|
|
|
|
SwPageFrm* pStartPage = bCheckPageDescOfNextPage ?
|
|
|
|
pNewPage :
|
|
|
|
(SwPageFrm*)pNewPage->GetNext();
|
2011-01-17 15:06:54 +01:00
|
|
|
SwFrm::CheckPageDescs( pStartPage, sal_False);
|
2004-02-16 10:58:00 +00:00
|
|
|
}
|
2002-11-01 10:43:00 +00:00
|
|
|
else if ( rThis.GetAttrSet()->GetPageDesc().GetPageDesc() )
|
|
|
|
{
|
2012-04-04 09:42:32 +02:00
|
|
|
// First page could get empty for example by disabling
|
|
|
|
// a section
|
2011-01-17 15:06:54 +01:00
|
|
|
SwFrm::CheckPageDescs( (SwPageFrm*)pNewPage, sal_False);
|
2002-11-01 10:43:00 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pNewUpper != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlowFrm::CastFlowFrm
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
SwFlowFrm *SwFlowFrm::CastFlowFrm( SwFrm *pFrm )
|
|
|
|
{
|
|
|
|
if ( pFrm->IsCntntFrm() )
|
|
|
|
return (SwCntntFrm*)pFrm;
|
|
|
|
if ( pFrm->IsTabFrm() )
|
|
|
|
return (SwTabFrm*)pFrm;
|
|
|
|
if ( pFrm->IsSctFrm() )
|
|
|
|
return (SwSectionFrm*)pFrm;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwFlowFrm *SwFlowFrm::CastFlowFrm( const SwFrm *pFrm )
|
|
|
|
{
|
|
|
|
if ( pFrm->IsCntntFrm() )
|
|
|
|
return (SwCntntFrm*)pFrm;
|
|
|
|
if ( pFrm->IsTabFrm() )
|
|
|
|
return (SwTabFrm*)pFrm;
|
|
|
|
if ( pFrm->IsSctFrm() )
|
|
|
|
return (SwSectionFrm*)pFrm;
|
|
|
|
return 0;
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|