summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf127825.docxbin0 -> 13297 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx26
-rw-r--r--sw/source/core/layout/fly.cxx2
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx20
4 files changed, 46 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf127825.docx b/sw/qa/extras/ooxmlimport/data/tdf127825.docx
new file mode 100644
index 000000000000..2caf612fd811
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf127825.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 42bbd3308f00..04e583a435f0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -23,6 +23,8 @@
#include <xmloff/odffields.hxx>
#include <IDocumentMarkAccess.hxx>
#include <IMark.hxx>
+#include <sortedobjs.hxx>
+#include <anchoredobject.hxx>
class Test : public SwModelTestBase
{
@@ -449,6 +451,30 @@ DECLARE_OOXMLIMPORT_TEST(testTdf126114, "tdf126114.docx")
CPPUNIT_ASSERT_EQUAL(7, getLength());
}
+DECLARE_OOXMLIMPORT_TEST(testTdf127825, "tdf127825.docx")
+{
+ // The document has a shape with Japanese-style text in it. The shape has relative size and also
+ // has automatic height.
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+ SwRootFrame* pLayout = pWrtShell->GetLayout();
+ CPPUNIT_ASSERT(pLayout);
+ SwFrame* pPage = pLayout->GetLower();
+ CPPUNIT_ASSERT(pPage);
+ SwFrame* pBody = pPage->GetLower();
+ CPPUNIT_ASSERT(pBody);
+ SwFrame* pText = pBody->GetLower();
+ CPPUNIT_ASSERT(pText);
+ CPPUNIT_ASSERT(pText->GetDrawObjs());
+ const SwSortedObjs& rDrawObjs = *pText->GetDrawObjs();
+ CPPUNIT_ASSERT(rDrawObjs.size());
+
+ // Without the accompanying fix in place, this overlapped the footer area, not the body area.
+ CPPUNIT_ASSERT(rDrawObjs[0]->GetObjRect().IsOver(pBody->getFrameArea()));
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf103345, "numbering-circle.docx")
{
uno::Reference<beans::XPropertySet> xPropertySet(
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 33b5e194e160..e4939dfb16c1 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1271,7 +1271,7 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>( pShape) )
{
// The shape is a customshape: then inform it about the calculated fly size.
- Size aSize(aRectFnSet.GetWidth(getFrameArea()), aRectFnSet.GetHeight(getFrameArea()));
+ Size aSize(getFrameArea().Width(), getFrameArea().Height());
pCustomShape->SuggestTextFrameSize(aSize);
// Do the calculations normally done after touching editeng text of the shape.
pCustomShape->NbcSetOutlinerParaObjectForText(nullptr, nullptr);
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 2f7ef092a018..131ff53d60a3 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1116,7 +1116,25 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
{
uno::Reference<beans::XPropertySet> xPropertySet(m_xShape, uno::UNO_QUERY);
OUString aProperty = nSprmId == NS_ooxml::LN_CT_SizeRelH_pctWidth ? OUString("RelativeWidth") : OUString("RelativeHeight");
- xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage));
+
+ sal_Int32 nTextPreRotateAngle = 0;
+ uno::Any aAny;
+ if (xPropertySet->getPropertySetInfo()->hasPropertyByName(
+ "CustomShapeGeometry"))
+ {
+ aAny = xPropertySet->getPropertyValue("CustomShapeGeometry");
+ }
+ comphelper::SequenceAsHashMap aCustomShapeGeometry(aAny);
+ auto it = aCustomShapeGeometry.find("TextPreRotateAngle");
+ if (it != aCustomShapeGeometry.end())
+ {
+ nTextPreRotateAngle = it->second.get<sal_Int32>();
+ }
+ if (nTextPreRotateAngle == 0)
+ {
+ xPropertySet->setPropertyValue(aProperty,
+ uno::makeAny(nPositivePercentage));
+ }
}
}