sw/source/core/doc/textboxhelper.cxx                        |    8 ++++
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |   24 +++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit a4dee94afed9ade6ac50237c8d99a6e49d3bebc1
Author: László Németh <laszlo.nem...@collabora.com>
Date:   Wed May 13 17:47:36 2015 +0200

    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

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index eb9ed84..f09e2e9 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 c7b916a..54bf5e0 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;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to