Kaydet (Commit) 465503f5 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: clean up leftover TextBox TODOs

Change-Id: I12782690368789849ea2ce2ed08ad4838a0a55db
üst 12a4b812
...@@ -696,16 +696,7 @@ void Chart2ExportTest::testShapeFollowedByChart() ...@@ -696,16 +696,7 @@ void Chart2ExportTest::testShapeFollowedByChart()
OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id"); OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id");
OUString aValueOfSecondDocPR; OUString aValueOfSecondDocPR;
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id");
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
if (xIndexAccess->getCount())
{
// TODO TextBox: remove this when TextBox is enabled by default
// This second run is a bug, should be the first ideally
aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id");
}
else
aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id");
CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR ); CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR );
} }
......
...@@ -622,23 +622,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo48557, "fdo48557.odt") ...@@ -622,23 +622,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo48557, "fdo48557.odt")
// Inner margins of the textframe wasn't exported. // Inner margins of the textframe wasn't exported.
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
if (xIndexAccess->getCount() > 0) uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
{ CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextLeftDistance"));
// TODO TextBox: remove this when TextBox is enabled by default CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextRightDistance"));
uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextUpperDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "LeftBorderDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextLowerDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "RightBorderDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TopBorderDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "BottomBorderDistance"));
}
else
{
uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextLeftDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextRightDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextUpperDistance"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty<sal_Int32>(xFrame, "TextLowerDistance"));
}
} }
DECLARE_OOXMLEXPORT_TEST(testI120928, "i120928.docx") DECLARE_OOXMLEXPORT_TEST(testI120928, "i120928.docx")
...@@ -984,17 +972,9 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66781, "fdo66781.docx") ...@@ -984,17 +972,9 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66781, "fdo66781.docx")
DECLARE_OOXMLEXPORT_TEST(testFdo60990, "fdo60990.odt") DECLARE_OOXMLEXPORT_TEST(testFdo60990, "fdo60990.odt")
{ {
// TODO TextBox: remove this when TextBox is enabled by default
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
bool bTextBox = xIndexAccess->getCount() == 0;
// The shape had no background, no paragraph adjust and no font color. // The shape had no background, no paragraph adjust and no font color.
uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
if (bTextBox) CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00CFE7F5), getProperty<sal_Int32>(xShape, "FillColor"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00CFE7F5), getProperty<sal_Int32>(xShape, "FillColor"));
else
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00CFE7F5), getProperty<sal_Int32>(xShape, "BackColor"));
uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText); uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust"))); CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust")));
...@@ -2166,19 +2146,8 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx") ...@@ -2166,19 +2146,8 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx")
DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx") DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx")
{ {
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "TextAutoGrowHeight")));
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "TextAutoGrowHeight")));
if (xIndexAccess->getCount())
{
// TODO TextBox: remove this when TextBox is enabled by default
CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "FrameIsAutomaticHeight")));
CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "FrameIsAutomaticHeight")));
}
else
{
CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "TextAutoGrowHeight")));
CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "TextAutoGrowHeight")));
}
} }
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx") DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
...@@ -2373,33 +2342,15 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73550, "fdo73550.docx") ...@@ -2373,33 +2342,15 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73550, "fdo73550.docx")
DECLARE_OOXMLEXPORT_TEST(testPageRelSize, "pagerelsize.docx") DECLARE_OOXMLEXPORT_TEST(testPageRelSize, "pagerelsize.docx")
{ {
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); // First shape: width is relative from page, but not height.
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape = getShape(1);
if (xIndexAccess->getCount()) CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
{ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
// TODO TextBox: remove this when TextBox is enabled by default
// First textframe: width is relative from page, but not height. // Second shape: height is relative from page, but not height.
uno::Reference<drawing::XShape> xTextFrame = getTextFrameByName("Frame1"); xShape = getShape(2);
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation")); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation")); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
// Second textframe: height is relative from page, but not height.
xTextFrame = getTextFrameByName("Text Box 2");
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
}
else
{
// First shape: width is relative from page, but not height.
uno::Reference<drawing::XShape> xShape = getShape(1);
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
// Second shape: height is relative from page, but not height.
xShape = getShape(2);
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
}
} }
DECLARE_OOXMLEXPORT_TEST(testRelSizeRound, "rel-size-round.docx") DECLARE_OOXMLEXPORT_TEST(testRelSizeRound, "rel-size-round.docx")
...@@ -2658,26 +2609,12 @@ DECLARE_OOXMLEXPORT_TEST(testNestedTextFrames, "nested-text-frames.odt") ...@@ -2658,26 +2609,12 @@ DECLARE_OOXMLEXPORT_TEST(testNestedTextFrames, "nested-text-frames.odt")
DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.docx") DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.docx")
{ {
// Position of text frame was wrong, because some conversion was missing. // Position of shape was wrong, because some conversion was missing.
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); // This was 3295.
if (xIndexAccess->getCount()) CPPUNIT_ASSERT_EQUAL(sal_Int32(5964), getProperty<sal_Int32>(xShape, "HoriOrientPosition"));
{ // This was 4611.
// TODO TextBox: remove this when TextBox is enabled by default CPPUNIT_ASSERT_EQUAL(sal_Int32(8133), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
// This was 3295.
CPPUNIT_ASSERT_EQUAL(sal_Int32(5964), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
// This was 4611.
CPPUNIT_ASSERT_EQUAL(sal_Int32(8133), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
}
else
{
uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
// This was 3295.
CPPUNIT_ASSERT_EQUAL(sal_Int32(5964), getProperty<sal_Int32>(xShape, "HoriOrientPosition"));
// This was 4611.
CPPUNIT_ASSERT_EQUAL(sal_Int32(8133), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
}
} }
DECLARE_OOXMLEXPORT_TEST(testAbi11739, "abi11739.docx") DECLARE_OOXMLEXPORT_TEST(testAbi11739, "abi11739.docx")
......
...@@ -1494,20 +1494,9 @@ DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx ...@@ -1494,20 +1494,9 @@ DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx
DECLARE_OOXMLIMPORT_TEST(testFdo69636, "fdo69636.docx") DECLARE_OOXMLIMPORT_TEST(testFdo69636, "fdo69636.docx")
{ {
// The problem was that the mso-layout-flow-alt:bottom-to-top VML shape property wasn't handled for sw text frames. // The problem was that the mso-layout-flow-alt:bottom-to-top VML shape property wasn't handled for sw text frames.
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
if (xIndexAccess->getCount()) CPPUNIT_ASSERT_EQUAL(sal_Int32(-270), aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>());
{
// TODO TextBox: remove this when TextBox is enabled by default
uno::Reference<text::XTextRange> xFrame(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(900), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFrame->getText()), 1), "CharRotation"));
}
else
{
uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(-270), aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>());
}
} }
DECLARE_OOXMLIMPORT_TEST(testChartProp, "chart-prop.docx") DECLARE_OOXMLIMPORT_TEST(testChartProp, "chart-prop.docx")
...@@ -1716,26 +1705,12 @@ DECLARE_OOXMLIMPORT_TEST(testMceWpg, "mce-wpg.docx") ...@@ -1716,26 +1705,12 @@ DECLARE_OOXMLIMPORT_TEST(testMceWpg, "mce-wpg.docx")
DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx") DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx")
{ {
// Vertical position of the textbox was incorrect due to incorrect nested mce handling. // Vertical position of the shape was incorrect due to incorrect nested mce handling.
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); // positionV's posOffset from the bugdoc, was 0.
if (xIndexAccess->getCount()) CPPUNIT_ASSERT_EQUAL(sal_Int32(6987), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
{ // This was -1 (default), make sure the background color is set.
// TODO TextBox: remove this when TextBox is enabled by default CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape, "FillColor"));
uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
// positionV's posOffset from the bugdoc, was 0.
CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(2514600)), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
// This was -1 (default), make sure the background color is set.
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xFrame, "BackColor"));
}
else
{
uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
// positionV's posOffset from the bugdoc, was 0.
CPPUNIT_ASSERT_EQUAL(sal_Int32(6987), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
// This was -1 (default), make sure the background color is set.
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape, "FillColor"));
}
uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(getShape(2), uno::UNO_QUERY); uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(getShape(2), uno::UNO_QUERY);
// This was a com.sun.star.drawing.CustomShape, due to incorrect handling of wpg elements after a wps textbox. // This was a com.sun.star.drawing.CustomShape, due to incorrect handling of wpg elements after a wps textbox.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment