sw: fix setting mbIsTextBox on shapes' text boxes
SetTextBoxes(true) is never called because it checks the shape's SdrObject, while previously this code was in SwFrameFormat::SetOtherTextBoxFormat() where it would be called a second time for the text box SwFrameFormat which has the SwFlyDrawObj. SwTextBoxHelper::getCount() can't ignore the text boxes if the flag is never set; this ends up confusing ShapeGroupContext::popGroupAndPostProcess() (and causes tests like testTdf84695 to fail with the fixes in the next commit). Because shapes with text boxes are sorted again with this, testTdf146272 and testTextBoxLoss need adapting. (regression from commit504d78acb8) Change-Id: I80c375d900a10f1956cd112d60c3f25332c485ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197594 Reviewed-by: Michael Stahl <michael.stahl@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 327e92c78603e011e7ddf8b57749dfd9e690addf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197729 Tested-by: Jenkins (cherry picked from commit9e0d4c693c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197772 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
committed by
Xisco Fauli
parent
c0b5b3d210
commit
de070c8e59
@@ -66,21 +66,43 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf146272)
|
||||
{
|
||||
createSwDoc("tdf146272.odt");
|
||||
|
||||
uno::Reference<beans::XPropertySet> xPicture(getShape(2), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xDrawing(getShape(1), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xFrame(xDrawing->getPropertyValue(u"TextBoxContent"_ustr),
|
||||
uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xPicture1(getShapeByName(u"graphics1"), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xDrawing1(getShapeByName(u"Shape2"), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xFrame1(xDrawing1->getPropertyValue(u"TextBoxContent"_ustr),
|
||||
uno::UNO_QUERY);
|
||||
|
||||
CPPUNIT_ASSERT(xPicture);
|
||||
CPPUNIT_ASSERT(xDrawing);
|
||||
CPPUNIT_ASSERT(xFrame);
|
||||
CPPUNIT_ASSERT(xPicture1);
|
||||
CPPUNIT_ASSERT(xDrawing1);
|
||||
CPPUNIT_ASSERT(xFrame1);
|
||||
|
||||
const sal_uInt64 nPitureZorder = xPicture->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nDrawingZorder = xDrawing->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nFrameZorder = xFrame->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nPicture1Zorder
|
||||
= xPicture1->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nDrawing1Zorder
|
||||
= xDrawing1->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nFrame1Zorder = xFrame1->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nDrawingZorder < nFrameZorder);
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nFrameZorder < nPitureZorder);
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nDrawing1Zorder < nFrame1Zorder);
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nFrame1Zorder < nPicture1Zorder);
|
||||
|
||||
uno::Reference<beans::XPropertySet> xPicture2(getShapeByName(u"Image423"), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xDrawing2(getShapeByName(u"Shape3"), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xFrame2(xDrawing2->getPropertyValue(u"TextBoxContent"_ustr),
|
||||
uno::UNO_QUERY);
|
||||
|
||||
CPPUNIT_ASSERT(xPicture2);
|
||||
CPPUNIT_ASSERT(xDrawing2);
|
||||
CPPUNIT_ASSERT(xFrame2);
|
||||
|
||||
const sal_uInt64 nPicture2Zorder
|
||||
= xPicture2->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nDrawing2Zorder
|
||||
= xDrawing2->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
const sal_uInt64 nFrame2Zorder = xFrame2->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
|
||||
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nDrawing2Zorder < nFrame2Zorder);
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nFrame2Zorder < nPicture2Zorder);
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nDrawing1Zorder < nDrawing2Zorder);
|
||||
CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nDrawing2Zorder < nPicture1Zorder);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf138773)
|
||||
|
||||
@@ -1803,11 +1803,9 @@ void SwTextBoxNode::AddTextBox(SdrObject* pDrawObject, SwFrameFormat* pNewTextBo
|
||||
}
|
||||
}
|
||||
|
||||
auto pSwFlyDraw = dynamic_cast<SwFlyDrawObj*>(pDrawObject);
|
||||
if (pSwFlyDraw)
|
||||
{
|
||||
pSwFlyDraw->SetTextBox(true);
|
||||
}
|
||||
SdrObject* const pFlyObject{ pNewTextBox->FindSdrObject() };
|
||||
assert(dynamic_cast<SwFlyDrawObj*>(pFlyObject));
|
||||
static_cast<SwFlyDrawObj*>(pFlyObject)->SetTextBox(true);
|
||||
m_pTextBoxes.push_back(aElem);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
|
||||
// Make sure that the shape is still a textbox.
|
||||
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
|
||||
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
|
||||
bool bTextBox = false;
|
||||
xShape->getPropertyValue(u"TextBox"_ustr) >>= bTextBox;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user