summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-11-13 14:50:16 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-11-14 14:35:41 +0100
commitad53d723715b2ca3ab0d3415c532295ef17ced29 (patch)
treed9b05033b9535463b2b6558eb4ccda40c3d71e37 /sw
parent96f5152486a28d77050dc114e293431afddf5142 (diff)
Revert "tdf#137881 sw: fix text box size regression"
This reverts commit f2eef84ff03660cbb46a76c317e640e054ed0a56. Reason for revert: https://bugs.documentfoundation.org/show_bug.cgi?id=135198#c9 This also reverts part of 768cfcee178b284be6d96d384364e59e40ecb375 without breaking tdf#137960 nor tdf#137964 Change-Id: Ifa418e66b8a45c6204babfae6513ca67aed93289 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105545 Reviewed-by: Dániel Arató <arato.daniel@nisz.hu> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/layout/data/bottom-textbox-size.docxbin14919 -> 0 bytes
-rw-r--r--sw/qa/core/layout/layout.cxx15
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx3
-rw-r--r--sw/source/core/layout/objectformattertxtfrm.cxx51
4 files changed, 19 insertions, 50 deletions
diff --git a/sw/qa/core/layout/data/bottom-textbox-size.docx b/sw/qa/core/layout/data/bottom-textbox-size.docx
deleted file mode 100644
index a1c700f28ae9..000000000000
--- a/sw/qa/core/layout/data/bottom-textbox-size.docx
+++ /dev/null
Binary files differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index ff339322fe70..a992a32ae7d4 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -196,21 +196,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape)
nTextBoxTopAfter < nTextBoxTopBefore);
}
-CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxSizeAtBottomOfPage)
-{
- // tdf#137881: check whether text box at the bottom of the page stays the right size
- load(DATA_DIRECTORY, "bottom-textbox-size.docx");
- SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
- SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
- SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
- SdrObject* pTextBoxObj = pPage->GetObj(0);
-
- uno::Reference<drawing::XShape> xShape(pTextBoxObj->getUnoShape(), uno::UNO_QUERY_THROW);
- const sal_Int32 nHeight = xShape->getSize().Height;
- CPPUNIT_ASSERT_EQUAL_MESSAGE("text box was not supposed to be resized on fileopen",
- static_cast<sal_Int32>(2200), nHeight);
-}
-
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 5919d1a6f76d..ec680a69a6ad 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1065,7 +1065,8 @@ DECLARE_OOXMLIMPORT_TEST(textboxWpsOnly, "textbox-wps-only.docx")
if ( nsScreen.frame.size.width * scaleFactor > 4000 )
return;
#endif
- CPPUNIT_ASSERT_EQUAL(sal_Int32(2805), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
+ // Vertically oriented to page due to tdf#135198
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5304), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
}
DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx")
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx
index e3a9b4eb6711..85313839f889 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -355,41 +355,24 @@ bool SwObjectFormatterTextFrame::DoFormatObjs()
SwFrameFormat& rFormat = pObj->GetFrameFormat();
if (SwTextBoxHelper::isTextBox(&rFormat, RES_DRAWFRMFMT))
{
- const SwFrameFormat* pOtherFormat = SwTextBoxHelper::getOtherTextBoxFormat(&rFormat, RES_DRAWFRMFMT);
- if (rFormat.GetVertOrient().GetPos() != pOtherFormat->GetVertOrient().GetPos() ||
- rFormat.GetAnchor().GetAnchorId() != pOtherFormat->GetAnchor().GetAnchorId())
+ if (const SwPageFrame* pPageFrame = pObj->GetPageFrame())
{
- if (const SwPageFrame* pPageFrame = pObj->GetPageFrame())
- {
- SwDoc* pDoc = rFormat.GetDoc();
-
- // avoid Undo creation,
- ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
-
- SfxItemSet aSet(pDoc->GetAttrPool(),
- svl::Items<RES_VERT_ORIENT, RES_ANCHOR>{});
-
- const SwRect& rPageFrameArea = pPageFrame->getFrameArea();
- if (rFormat.GetVertOrient().GetPos() != pOtherFormat->GetVertOrient().GetPos())
- {
- aSet.Put(SwFormatVertOrient(pObj->GetObjRect().Top() - rPageFrameArea.Top(),
- text::VertOrientation::NONE,
- text::RelOrientation::PAGE_FRAME));
- }
- if (rFormat.GetHoriOrient().GetPos() != pOtherFormat->GetHoriOrient().GetPos())
- {
- aSet.Put(rFormat.GetHoriOrient());
- }
- if (rFormat.GetAnchor().GetAnchorId() != pOtherFormat->GetAnchor().GetAnchorId())
- {
- aSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_PAGE, pObj->GetPageFrame()->GetPhyPageNum()));
- }
-
- if (aSet.Count())
- {
- SwTextBoxHelper::syncFlyFrameAttr(rFormat, aSet);
- }
- }
+ SwDoc* pDoc = rFormat.GetDoc();
+
+ // avoid Undo creation,
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ svl::Items<RES_VERT_ORIENT, RES_ANCHOR>{});
+
+ const SwRect& rPageFrameArea = pPageFrame->getFrameArea();
+ aSet.Put(SwFormatVertOrient(pObj->GetObjRect().Top() - rPageFrameArea.Top(),
+ text::VertOrientation::NONE,
+ text::RelOrientation::PAGE_FRAME));
+
+ aSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_PAGE, pObj->GetPageFrame()->GetPhyPageNum()));
+
+ SwTextBoxHelper::syncFlyFrameAttr(rFormat, aSet);
}
}
}