mirror of
https://github.com/LibreOffice/core.git
synced 2025-07-26 15:45:26 +00:00
tdf#165521 svx layout: clear Outliner FixedCellHeight after use
This specifically avoids a PPTX custom shape's editEngine flag from bleeding into the remainder of the document and affecting another shape's sizing calculations. This bleeding was noticably affecting PPTX table sizes, triggering the investigation that lead to this patch. FALSE REGRESSION NOTE: It appears that perhaps PPT/X tables SHOULD ALWAYS be sized according to SDRATTR_TEXT_USEFIXEDCELLHEIGHT = TRUE. In other words, tables currently match MS Powerpoint's table size only when they accidentally have this setting bleed through. With this patch, we are effectively always setting it to FALSE, and thus tables will never be accidentally correct anymore. ... and the same possibly is true for all kinds of other shapes. The problem with having a correct table size is that the text inside the table needs to also be in sync with this sizing calculation. Otherwise it will either be too small (commonly), or it could spill out of the table (in cases where the font is designed with a large leading). This patch's effect on tables is to allow the table to only be defined by its own content. Now when other actions cause a table recalculation (like selecting text, drag and drop, editing) the table size won't fluctuate (since in this re-draw context there wasn't any FixedCellHeight bleeding into the calculation). make CppunitTest_svx_unit \ CPPUNIT_TEST_NAME=testTdf165521_fixedCellHeight Change-Id: I5239c78cf8f1e8fffd65b6aa285a840428e92e5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183172 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
This commit is contained in:
BIN
svx/qa/unit/data/tdf165521_fixedCellHeight.pptx
Normal file
BIN
svx/qa/unit/data/tdf165521_fixedCellHeight.pptx
Normal file
Binary file not shown.
@ -102,6 +102,59 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur)
|
||||
u"80");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf165521_fixedCellHeight)
|
||||
{
|
||||
// Given a document containing a table whose size/text should match the textbox:
|
||||
// (In this Liberation Sans unit test, the text is too small and doesn't fill the table,
|
||||
// while in the bug report's Marianne font example, the text is too large, spilling out of it.)
|
||||
|
||||
loadFromFile(u"tdf165521_fixedCellHeight.pptx");
|
||||
|
||||
// When rendering the table:
|
||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
|
||||
uno::UNO_QUERY);
|
||||
drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
|
||||
= renderPageToPrimitives(xDrawPage);
|
||||
|
||||
// TODO: Then make sure the text in both table and textbox are the same line height
|
||||
svx::ExtendedPrimitive2dXmlDump aDumper;
|
||||
xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
|
||||
// const char sTextboxPath6[] = "/primitive2D/objectinfo[1]/unhandled/group/sdrblocktext/"
|
||||
// "texthierarchyblock/texthierarchyparagraph/texthierarchyline[6]/"
|
||||
// "textsimpleportion";
|
||||
const char sTextboxPath7[] = "/primitive2D/objectinfo[1]/unhandled/group/sdrblocktext/"
|
||||
"texthierarchyblock/texthierarchyparagraph/texthierarchyline[7]/"
|
||||
"textsimpleportion";
|
||||
CPPUNIT_ASSERT(
|
||||
getXPath(pDocument, sTextboxPath7, "text")
|
||||
.startsWith("Autofit Custom Shape forces Fixed Cell Height even in the table."));
|
||||
// const sal_Int32 nTextBoxFontLineHeight = getXPath(pDocument, sTextboxPath7, "y").toInt32()
|
||||
// - getXPath(pDocument, sTextboxPath6, "y").toInt32();
|
||||
|
||||
const char sTablePath6[] = "/primitive2D/objectinfo[2]/sdrCell[2]/group/sdrblocktext/"
|
||||
"texthierarchyblock/texthierarchyparagraph/texthierarchyline[6]/"
|
||||
"textsimpleportion";
|
||||
const char sTablePath7[] = "/primitive2D/objectinfo[2]/sdrCell[2]/group/sdrblocktext/"
|
||||
"texthierarchyblock/texthierarchyparagraph/texthierarchyline[7]/"
|
||||
"textsimpleportion";
|
||||
CPPUNIT_ASSERT(getXPath(pDocument, sTablePath7, "text").startsWith("Qualcomm Snapdragon"));
|
||||
const sal_Int32 nTableFontLineHeight = getXPath(pDocument, sTablePath7, "y").toInt32()
|
||||
- getXPath(pDocument, sTablePath6, "y").toInt32();
|
||||
// Expected: 593.
|
||||
// Actual (without the acompanying patch) 553
|
||||
// CPPUNIT_ASSERT_EQUAL(nTextBoxFontLineHeight, nTableFontLineHeight);
|
||||
|
||||
// All of the text must fit inside the table,
|
||||
// and the table must be approximately the same size as the lines of text.
|
||||
sal_Int32 nTableHeight
|
||||
= getXPath(pDocument,
|
||||
"/primitive2D/objectinfo[2]/sdrCell[2]/group/polypolygoncolor/polypolygon",
|
||||
"height")
|
||||
.toInt32();
|
||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(7 * nTableFontLineHeight, nTableHeight, 1);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape)
|
||||
{
|
||||
// Given a document with a table shape, editing cell text:
|
||||
|
@ -2374,7 +2374,9 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool
|
||||
nHgt = rR.getOpenHeight();
|
||||
}
|
||||
}
|
||||
// cleanup outliner
|
||||
rOutliner.Clear();
|
||||
rOutliner.SetFixedCellHeight(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user