summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <laszlo.nemeth@collabora.com>2015-05-13 17:47:36 +0200
committerLászló Németh <laszlo.nemeth@collabora.com>2015-05-13 18:10:45 +0200
commita4dee94afed9ade6ac50237c8d99a6e49d3bebc1 (patch)
tree78257765b16ace021ad12223144ce8811332d360
parent02cc648dc068080d65b44ebd10d0940f6a097b8a (diff)
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
-rw-r--r--sw/source/core/doc/textboxhelper.cxx8
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx24
2 files changed, 31 insertions, 1 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index eb9ed84688ac..f09e2e92e7cb 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -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:
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index c7b916abace4..54bf5e037d77 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -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;
}