Kaydet (Commit) a4dee94a authored tarafından László Németh's avatar László Németh

tdf#91260: allow textboxes extending beyond the page bottom

This commit fixes layout problems of DOCX import, but also
now it's possible to move a textbox beyond the page bottom
using the arrow keys (this worked only for page-anchored
shapes in Writer).

Change-Id: Ie83d3202a2248d948348656aa26df20982f9675b
üst 02cc648d
......@@ -636,6 +636,14 @@ void SwTextBoxHelper::syncFlyFrmAttr(SwFrmFmt& rShape, SfxItemSet& rSet)
aOrient.SetPos(aOrient.GetPos() + aRect.getY());
aTextBoxSet.Put(aOrient);
// restore height (shrinked for extending beyond the page bottom - tdf#91260)
SwFmtFrmSize aSize(pFmt->GetFrmSize());
if (!aRect.IsEmpty())
{
aSize.SetHeight(aRect.getHeight());
aTextBoxSet.Put(aSize);
}
}
break;
case RES_HORI_ORIENT:
......
......@@ -19,6 +19,7 @@
#include <anchoredobjectposition.hxx>
#include <environmentofanchoredobject.hxx>
#include <doc.hxx>
#include <flyfrm.hxx>
#include <flyfrms.hxx>
#include <txtfrm.hxx>
......@@ -29,6 +30,7 @@
#include <dcontact.hxx>
#include <frmfmt.hxx>
#include <fmtornt.hxx>
#include <fmtfsize.hxx>
#include <fmtfollowtextflow.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
......@@ -471,8 +473,28 @@ SwTwips SwAnchoredObjectPosition::_ImplAdjustVertRelPos( const SwTwips nTopOfAnc
{
nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch;
}
}
// tdf#91260 - allow textboxes extending beyond the page bottom
if ( nAdjustedRelPosY < nProposedRelPosY )
{
const SwFrmFmt* pFmt = &(GetFrmFmt());
if ( SwTextBoxHelper::isTextBox(&GetObject()) )
{
// shrink textboxes to extend beyond the page bottom
SwFrmFmt* pFrmFmt = ::FindFrmFmt(&GetObject());
SfxItemSet aTextBoxSet(pFrmFmt->GetDoc()->GetAttrPool(), aFrmFmtSetRange);
SwFmtFrmSize aSize(pFmt->GetFrmSize());
SwTwips nShrinked = aSize.GetHeight() - (nProposedRelPosY - nAdjustedRelPosY);
aSize.SetHeight( nShrinked > 0 ? nShrinked : 0 );
aTextBoxSet.Put(aSize);
if (aTextBoxSet.Count())
pFrmFmt->GetDoc()->SetFlyFrmAttr(*pFrmFmt, aTextBoxSet);
nAdjustedRelPosY = nProposedRelPosY;
} else if ( SwTextBoxHelper::findTextBox(pFmt) )
// when the shape has a textbox, use only the proposed vertical position
nAdjustedRelPosY = nProposedRelPosY;
}
}
return nAdjustedRelPosY;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment