diff options
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 34 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/text/xmldump.cxx | 15 |
3 files changed, 54 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 4ef1128d3118..eeb16f2d9ef7 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -37,6 +37,8 @@ #include <svl/PasswordHelper.hxx> #include <docufld.hxx> // for SwHiddenTextField::ParseIfFieldDefinition() method call #include <unoprnms.hxx> +#include <sortedobjs.hxx> +#include <flyfrm.hxx> class Test : public SwModelTestBase { @@ -1419,6 +1421,38 @@ DECLARE_ODFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt") auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode"); CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual); + + // Without the accompanying fix in place, this test would have failed, as the fly frame had + // mbVertical==true, but mbVertLRBT==false, even if the writing direction in the doc model was + // btlr. + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc); + + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + CPPUNIT_ASSERT(pLayout); + + SwFrame* pPageFrame = pLayout->GetLower(); + CPPUNIT_ASSERT(pPageFrame); + CPPUNIT_ASSERT(pPageFrame->IsPageFrame()); + + SwFrame* pBodyFrame = pPageFrame->GetLower(); + CPPUNIT_ASSERT(pBodyFrame); + CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame()); + + SwFrame* pBodyTextFrame = pBodyFrame->GetLower(); + CPPUNIT_ASSERT(pBodyTextFrame); + CPPUNIT_ASSERT(pBodyTextFrame->IsTextFrame()); + + CPPUNIT_ASSERT(pBodyTextFrame->GetDrawObjs()); + const SwSortedObjs& rAnchored = *pBodyTextFrame->GetDrawObjs(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rAnchored.size()); + + auto* pFlyFrame = dynamic_cast<SwFlyFrame*>(rAnchored[0]); + CPPUNIT_ASSERT(pFlyFrame); + CPPUNIT_ASSERT(pFlyFrame->IsVertLRBT()); } DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt") diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index d364ccf655b8..c701c9db56b9 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -129,6 +129,11 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch if ( SvxFrameDirection::Vertical_LR_TB == nDir ) mbVertLR = true; + else if (nDir == SvxFrameDirection::Vertical_LR_BT) + { + mbVertLR = true; + mbVertLRBT = true; + } else mbVertLR = false; } diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 5a25baaeb264..b99645bed539 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -467,6 +467,21 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this); const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst(); xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), TMP_FORMAT, pTextNode->GetIndex() ); + + OString aMode = "Horizontal"; + if (IsVertLRBT()) + { + aMode = "VertBTLR"; + } + else if (IsVertLR()) + { + aMode = "VertLR"; + } + else if (IsVertical()) + { + aMode = "Vertical"; + } + xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), BAD_CAST(aMode.getStr())); } if (IsHeaderFrame() || IsFooterFrame()) { |