include/editeng/frmdiritem.hxx | 2 - include/svx/strings.hrc | 1 oox/source/vml/vmlshape.cxx | 25 +++--------- sw/ooxmlexport_setup.mk | 1 sw/qa/extras/odfexport/odfexport.cxx | 44 ++++++++++++++++++++++ sw/qa/extras/ooxmlexport/data/btlr-textbox.docx |binary sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 43 +++++++++++++++++++++ sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 12 ++++++ sw/source/core/doc/textboxhelper.cxx | 26 +------------ sw/source/core/layout/fly.cxx | 5 ++ sw/source/core/layout/wsfrm.cxx | 7 +++ sw/source/core/text/xmldump.cxx | 15 +++++++ sw/source/filter/ww8/docxsdrexport.cxx | 6 ++- sw/source/ui/frmdlg/frmpage.cxx | 1 writerfilter/source/dmapper/DomainMapper.cxx | 3 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 12 ------ writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1 19 files changed, 145 insertions(+), 59 deletions(-)
New commits: commit c10ff1b46e0ccd9d02aae32f46aa7f4c8ef11cb7 Author: Miklos Vajna <[email protected]> AuthorDate: Thu Jul 4 21:37:14 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 10:12:03 2019 +0200 sw btlr writing mode: handle import from VML Instead of the character-level rotation added in commit 8738ded7bb1bb6262fe1038e310b5110407f4cfa (fdo#69636 VML import: handle mso-layout-flow-alt shape prop for sw frames, 2013-09-26) which does not work for multiple paragraphs. (cherry picked from commit bffe6a496fb1c69499770d96fefd7a3609712676) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: Ibe9a85d7f880846edfd1f4594c03b0617d83a965 diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index a6df38fe3c98..d72809a6a895 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -726,33 +726,14 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet( xShape ).setAnyProperty( PROP_BottomBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceBottom ))); } - if (getTextBox()->maLayoutFlow == "vertical" && maTypeModel.maLayoutFlowAlt.isEmpty()) + if (getTextBox()->maLayoutFlow == "vertical") { - PropertySet(xShape).setAnyProperty(PROP_WritingMode, - uno::makeAny(text::WritingMode2::TB_RL)); - } - - if (!maTypeModel.maLayoutFlowAlt.isEmpty()) - { - // Can't handle this property here, as the frame is not attached yet: pass it to writerfilter. - uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aGrabBag; - xPropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag; - beans::PropertyValue aPair; - aPair.Name = "mso-layout-flow-alt"; - aPair.Value <<= maTypeModel.maLayoutFlowAlt; - if (aGrabBag.hasElements()) - { - sal_Int32 nLength = aGrabBag.getLength(); - aGrabBag.realloc(nLength + 1); - aGrabBag[nLength] = aPair; - } - else + sal_Int16 nWritingMode = text::WritingMode2::TB_RL; + if (maTypeModel.maLayoutFlowAlt == "bottom-to-top") { - aGrabBag.realloc(1); - aGrabBag[0] = aPair; + nWritingMode = text::WritingMode2::BT_LR; } - xPropertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(aGrabBag)); + PropertySet(xShape).setAnyProperty(PROP_WritingMode, uno::makeAny(nWritingMode)); } } else diff --git a/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx b/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx new file mode 100644 index 000000000000..a93703c75526 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index bc2568f01338..ccd819b07120 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -236,6 +236,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") // and as result only one page should be generated. DECLARE_OOXMLIMPORT_TEST(testTdf113182, "tdf113182.docx") { CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_OOXMLIMPORT_TEST(testBtlrFrameVml, "btlr-frame-vml.docx") +{ + uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextFrame.is()); + + auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode"); + // Without the accompanying fix in place, this test would have failed with 'Expected: 5; Actual: + // 4', i.e. writing direction was inherited from page, instead of explicit btlr. + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual); +} + DECLARE_OOXMLIMPORT_TEST(testTdf124398, "tdf124398.docx") { uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 9d2cbd7bfe81..6d0384f7cae6 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3023,9 +3023,6 @@ void DomainMapper::PopListProperties() void DomainMapper::lcl_startCharacterGroup() { m_pImpl->PushProperties(CONTEXT_CHARACTER); - if (m_pImpl->m_bFrameBtLr) - // No support for this in core, work around by char rotation, as we do so for table cells already. - m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION, uno::makeAny(sal_Int16(900))); if (m_pImpl->isSdtEndDeferred()) { // Fields have an empty character group before the real one, so don't diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 11bc5de450fd..b0114eac21e0 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -250,7 +250,6 @@ DomainMapper_Impl::DomainMapper_Impl( m_bIgnoreNextPara(false), m_bCheckFirstFootnoteTab(false), m_bIgnoreNextTab(false), - m_bFrameBtLr(false), m_bIsSplitPara(false), m_vTextFramesForChaining(), m_bParaHadField(false), @@ -2353,15 +2352,9 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aGrabBag; xShapePropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag; - bool checkBtLrStatus = false; for (int i = 0; i < aGrabBag.getLength(); ++i) { - if (aGrabBag[i].Name == "mso-layout-flow-alt") - { - m_bFrameBtLr = aGrabBag[i].Value.get<OUString>() == "bottom-to-top"; - checkBtLrStatus = true; - } if (aGrabBag[i].Name == "VML-Z-ORDER") { GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper(); @@ -2372,10 +2365,8 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape xShapePropertySet->setPropertyValue(getPropertyName( PROP_OPAQUE ), uno::makeAny( zOrder >= 0 ) ); checkZOrderStatus = true; } - if(checkBtLrStatus && checkZOrderStatus) - break; - if ( aGrabBag[i].Name == "TxbxHasLink" ) + else if ( aGrabBag[i].Name == "TxbxHasLink" ) { //Chaining of textboxes will happen in ~DomainMapper_Impl //i.e when all the textboxes are read and all its attributes @@ -2533,7 +2524,6 @@ void DomainMapper_Impl::PopShapeContext() m_aAnchoredStack.pop(); } - m_bFrameBtLr = false; } bool DomainMapper_Impl::IsSdtEndBefore() diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 52aeb82ab378..ad73aa03e6dd 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -953,7 +953,6 @@ public: /// If the next tab should be ignored, used for footnotes. bool m_bCheckFirstFootnoteTab; bool m_bIgnoreNextTab; - bool m_bFrameBtLr; ///< Bottom to top, left to right text frame direction is requested for the current text frame. /// Pending floating tables: they may be converted to text frames at the section end. std::vector<FloatingTableInfo> m_aPendingFloatingTables; commit f5d96d82761c249924c8f753ccb301d2cc2c0247 Author: Miklos Vajna <[email protected]> AuthorDate: Thu Jun 20 21:08:01 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 10:08:27 2019 +0200 sw btlr writing mode: implement TextFrame tbrl export to drawingML Also remove the checkFrameBtlr() call in DocxSdrExport::writeOnlyTextOfFrame(), which was added in commit 1c876f5616522ab695de8c0316cdb0c601081815 (fdo#78590: Fix for Corruption of para with framePr & drawing object into para, 2014-06-13), but that looks like a copy&paste error, given that the old-style DOCX frames can't have a custom writing direction, it seems. (cherry picked from commit fa827a8beb7e590baf8eb39d3568bb81bcc925f3) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport13.cxx sw/source/filter/ww8/docxsdrexport.cxx Change-Id: I0940bbbf3adadd1fc480f3d754b4c8854a9c56b4 diff --git a/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx b/sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx similarity index 100% rename from sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx rename to sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 636e698b4705..04437018d78f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -147,6 +147,31 @@ DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx") assertXPath(pXmlDoc, "/root/page/body/txt[2]/anchored/fly/tab/infos/bounds", "top", "4193"); } +DECLARE_OOXMLEXPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx") +{ + uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextFrame.is()); + + if (mbExported) + { + // DML import: creates a TextBox. + + comphelper::SequenceAsHashMap aGeometry(xTextFrame->getPropertyValue("CustomShapeGeometry")); + // Without the accompanying fix in place, this test would have failed with 'Expected: -90; + // Actual: 0', i.e. the tblr writing mode was lost during DML export of a TextFrame. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-90), aGeometry["TextPreRotateAngle"].get<sal_Int32>()); + } + else + { + // VML import: creates a TextFrame. + + auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode"); + // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual: + // 4', i.e. writing direction was inherited from page, instead of explicit tbrl. + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual); + } +} + DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt") { // Make sure the rotation is exported correctly, and size not distorted diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 10916ffaed0b..bc2568f01338 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -259,17 +259,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop); } -DECLARE_OOXMLIMPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx") -{ - uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY); - CPPUNIT_ASSERT(xTextFrame.is()); - - auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode"); - // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual: - // 4', i.e. writing direction was inherited from page, instead of explicit tbrl. - CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual); -} - DECLARE_OOXMLIMPORT_TEST(testTdf121804, "tdf121804.docx") { uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 50a1500c31b9..d40e2a786c70 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1085,8 +1085,6 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame) ExportDataSaveRestore aDataGuard(m_pImpl->m_rExport, nStt, nEnd, pParentFrame); m_pImpl->m_pBodyPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); - m_pImpl->m_bFrameBtLr - = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true); m_pImpl->m_bFlyFrameGraphic = true; m_pImpl->m_rExport.WriteText(); m_pImpl->m_bFlyFrameGraphic = false; @@ -1352,6 +1350,10 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho pFS->startElementNS(XML_w, XML_txbxContent, FSEND); + const SvxFrameDirectionItem& rDirection = rFrameFormat.GetFrameDir(); + if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB) + m_pImpl->m_pBodyPrAttrList->add(XML_vert, "vert"); + m_pImpl->m_bFrameBtLr = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true); m_pImpl->m_bFlyFrameGraphic = true; commit 13f45ca57a3c78e6d7840991597c664a3557c4a4 Author: Miklos Vajna <[email protected]> AuthorDate: Thu Jun 13 23:17:34 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 10:01:58 2019 +0200 sw btlr writing mode: fix tbrl import from VML Wanted to do btlr, but even tbrl (e.g. Japanese text) is not working, so let's do that first. Change-Id: I62cb95754ce473ecf1de2d34460e50db94e64806 Reviewed-on: https://gerrit.libreoffice.org/73991 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 31b44f010557c43d8b02cc3be590ed1629bf1ca5) diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index b70edfc9102b..a6df38fe3c98 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/text/GraphicCrop.hpp> #include <com/sun/star/security/DocumentDigitalSignatures.hpp> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> @@ -724,6 +725,13 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet( xShape ).setAnyProperty( PROP_RightBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceRight ))); PropertySet( xShape ).setAnyProperty( PROP_BottomBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceBottom ))); } + + if (getTextBox()->maLayoutFlow == "vertical" && maTypeModel.maLayoutFlowAlt.isEmpty()) + { + PropertySet(xShape).setAnyProperty(PROP_WritingMode, + uno::makeAny(text::WritingMode2::TB_RL)); + } + if (!maTypeModel.maLayoutFlowAlt.isEmpty()) { // Can't handle this property here, as the frame is not attached yet: pass it to writerfilter. diff --git a/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx b/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx new file mode 100644 index 000000000000..c697e5846ce6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index b5e2841d5344..10916ffaed0b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp> #include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/text/WritingMode2.hpp> class Test : public SwModelTestBase { @@ -258,6 +259,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop); } +DECLARE_OOXMLIMPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx") +{ + uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextFrame.is()); + + auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode"); + // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual: + // 4', i.e. writing direction was inherited from page, instead of explicit tbrl. + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual); +} + DECLARE_OOXMLIMPORT_TEST(testTdf121804, "tdf121804.docx") { uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); commit 87e6ade8573171f7c861abb78d847f9e52ab47d8 Author: Miklos Vajna <[email protected]> AuthorDate: Thu Jun 6 21:32:07 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 10:00:15 2019 +0200 sw btlr writing mode: DOCX drawingML import for fly frames By using the now working btlr direction of the underlying fly frame, instead of the character-level workaround. (cherry picked from commit 9c945cdbe170104cbacafa2c37babec5210b9ca2) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport13.cxx Change-Id: I3024e3348a30c72f461032b03b88c210f25eb75a diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk index 11fa454fae93..cc1699a40c45 100644 --- a/sw/ooxmlexport_setup.mk +++ b/sw/ooxmlexport_setup.mk @@ -16,6 +16,7 @@ define sw_ooxmlexport_libraries editeng \ sal \ sfx \ + svl \ sw \ test \ tl \ diff --git a/sw/qa/extras/ooxmlexport/data/btlr-textbox.docx b/sw/qa/extras/ooxmlexport/data/btlr-textbox.docx new file mode 100644 index 000000000000..181d305eac95 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/btlr-textbox.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 3e3af3560797..636e698b4705 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -17,8 +17,10 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <svx/xfillit0.hxx> +#include <editeng/frmdiritem.hxx> #include <editsh.hxx> +#include <frmatr.hxx> class Test : public SwModelTestBase { @@ -71,6 +73,22 @@ DECLARE_OOXMLEXPORT_TEST(testTbrlTextbox, "tbrl-textbox.docx") aGeometry["TextPreRotateAngle"].get<sal_Int32>()); } +DECLARE_OOXMLEXPORT_TEST(testBtlrShape, "btlr-textbox.docx") +{ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFormats.size()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_DRAWFRMFMT), rFormats[0]->Which()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_FLYFRMFMT), rFormats[1]->Which()); + // Without the accompanying fix in place, this test would have failed with 'Expected: 5, Actual: + // 4', i.e. the textbox inherited its writing direction instead of having an explicit btlr + // value. + CPPUNIT_ASSERT_EQUAL(SvxFrameDirection::Vertical_LR_BT, + rFormats[1]->GetAttrSet().GetFrameDir().GetValue()); +} + DECLARE_OOXMLEXPORT_TEST(testFrameSizeExport, "floating-tables-anchor.docx") { // Make sure the table width is 4000 diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 70c0c887e6a3..fedb6dfb7e2a 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -352,35 +352,15 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope if (it != aCustomShapeGeometry.end()) { auto nTextPreRotateAngle = it->second.get<sal_Int32>(); - if (nTextPreRotateAngle == -270) - { - // That would be the btLr text direction which we don't support at a frame level, so - // do it at a character level. - const SwNodeIndex* pNodeIndex = pFormat->GetContent().GetContentIdx(); - if (!pNodeIndex) - return; - - SwPaM aPaM(*pFormat->GetDoc()->GetNodes()[pNodeIndex->GetIndex() + 1], 0); - aPaM.SetMark(); - if (SwTextNode* pMark - = pFormat->GetDoc() - ->GetNodes()[pNodeIndex->GetNode().EndOfSectionIndex() - 1] - ->GetTextNode()) - { - aPaM.GetMark()->nNode = *pMark; - aPaM.GetMark()->nContent.Assign(pMark, pMark->GetText().getLength()); - SvxCharRotateItem aItem(900, false, RES_CHRATR_ROTATE); - pFormat->GetDoc()->getIDocumentContentOperations().InsertPoolItem(aPaM, aItem); - } - return; - } - sal_Int16 nDirection = 0; switch (nTextPreRotateAngle) { case -90: nDirection = text::WritingMode2::TB_RL; break; + case -270: + nDirection = text::WritingMode2::BT_LR; + break; } if (nDirection) commit cc8d438dd81b1212388cf877a8374e0b55879835 Author: Miklos Vajna <[email protected]> AuthorDate: Tue Jun 4 21:33:02 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 09:34:47 2019 +0200 editeng: consider btlr in SvxFrameDirectionItem::GetValueCount() Change-Id: Ib5e24d096075a0dde7c718930ea12fb1fd046ffe Reviewed-on: https://gerrit.libreoffice.org/73467 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit f9c6f40ef0dc42af810466ff8cad59fe69daa6bb) diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx index 1ec32483077d..4b502fea2d21 100644 --- a/include/editeng/frmdiritem.hxx +++ b/include/editeng/frmdiritem.hxx @@ -49,7 +49,7 @@ public: virtual sal_uInt16 GetValueCount() const override { - return sal_uInt16(SvxFrameDirection::Environment) + 1; + return sal_uInt16(SvxFrameDirection::Vertical_LR_BT) + 1; } SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem ) { commit 635b6f1e7fb9313dd7ff656afedad4f5b5211a38 Author: Miklos Vajna <[email protected]> AuthorDate: Thu May 23 21:44:20 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 09:34:06 2019 +0200 sw btlr writing mode: fix btlr <-> tbrl switch for fly frames The "BT" flag was not clear, so if the fly frame was first tbrl, then switched to btlr, then this was changed back, the result was not tbrl but tblr. Change-Id: I9a258e64e7a6e5849edd5a6a21a6182f642e44ab Reviewed-on: https://gerrit.libreoffice.org/72881 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit ad96f6f378a9fce11c2f7d9ad39a8203189444e3) diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 7f516f55c4da..43a52110ee51 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1455,6 +1455,16 @@ DECLARE_ODFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt") auto* pFlyFrame = dynamic_cast<SwFlyFrame*>(rAnchored[0]); CPPUNIT_ASSERT(pFlyFrame); CPPUNIT_ASSERT(pFlyFrame->IsVertLRBT()); + + if (!mbExported) + // Not yet exported, don't modify the doc model for test purposes. + return; + + // Make sure that btlr -> tbrl transition clears the "BT" flag. + xTextFrame->setPropertyValue("WritingMode", uno::makeAny(static_cast<sal_Int16>(text::WritingMode2::TB_LR))); + 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/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index c2d1bf5d62ae..d68fc1b9fd4e 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -350,14 +350,21 @@ void SwFrame::CheckDir( SvxFrameDirection nDir, bool bVert, bool bOnlyBiDi, bool { mbVertical = false; mbVertLR = false; + mbVertLRBT = false; } else { mbVertical = true; if(SvxFrameDirection::Vertical_RL_TB == nDir) + { mbVertLR = false; + mbVertLRBT = false; + } else if(SvxFrameDirection::Vertical_LR_TB==nDir) + { mbVertLR = true; + mbVertLRBT = false; + } else if (nDir == SvxFrameDirection::Vertical_LR_BT) { mbVertLR = true; commit 989b3585f36445f4c0c017e476927c737fa8c51c Author: Miklos Vajna <[email protected]> AuthorDate: Thu May 16 22:07:03 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 09:26:16 2019 +0200 sw btlr writing mode: implement UI for fly frames Change-Id: Id183dccb5802a1be0180471140266f3dd7a8123d Reviewed-on: https://gerrit.libreoffice.org/72428 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 52e47276694575f119192f6ddafa69ec7a7eb6b4) diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index 2d722447bdc4..4baea656911c 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -1665,6 +1665,7 @@ #define RID_SVXSTR_PAGEDIR_RTL_HORI NC_("RID_SVXSTR_PAGEDIR_RTL_HORI", "Right-to-left (horizontal)") #define RID_SVXSTR_PAGEDIR_RTL_VERT NC_("RID_SVXSTR_PAGEDIR_RTL_VERT", "Right-to-left (vertical)") #define RID_SVXSTR_PAGEDIR_LTR_VERT NC_("RID_SVXSTR_PAGEDIR_LTR_VERT", "Left-to-right (vertical)") +#define RID_SVXSTR_PAGEDIR_LTR_BTT_VERT NC_("RID_SVXSTR_PAGEDIR_LTR_BTT_VERT", "Bottom-to-top, left-to-right (vertical)") #endif diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 0c24cc563f7e..163c8a80b582 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2806,6 +2806,7 @@ SwFrameAddPage::SwFrameAddPage(TabPageParent pParent, const SfxItemSet &rSet) m_xTextFlowLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL)); m_xTextFlowLB->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT)); m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT)); + m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_BT, SvxResId(RID_SVXSTR_PAGEDIR_LTR_BTT_VERT)); m_xTextFlowLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER)); m_xDescriptionED->set_size_request(-1, m_xDescriptionED->get_preferred_size().Height()); } commit 4ae1eacbca9f5148ea99b40a4df3f5f219cde685 Author: Miklos Vajna <[email protected]> AuthorDate: Thu May 9 21:13:50 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jul 5 09:21:59 2019 +0200 sw btlr writing mode: implement layout for fly frames The case when a fly frame was first constructed with one direction then switched to btlr was already working. The case when the direction is already set before the SwFlyFrame is constructed was not, as SvxFrameDirection::Vertical_LR_BT was unhandled. (cherry picked from commit 8a26e4b26f0153fb8ca5da880ee4aa44748ee4df) Conflicts: sw/qa/extras/odfexport/odfexport.cxx Change-Id: I97d15b3fc15ee116181718144dc9bccf8f31529f diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index d132ea24544e..7f516f55c4da 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -39,6 +39,8 @@ #include <unotools/streamwrap.hxx> #include <svl/PasswordHelper.hxx> #include <docufld.hxx> // for SwHiddenTextField::ParseIfFieldDefinition() method call +#include <sortedobjs.hxx> +#include <flyfrm.hxx> class Test : public SwModelTestBase { @@ -1421,6 +1423,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 e5d00474f446..a96532f5da55 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -127,6 +127,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 b17078e195d7..84edcdc0d5c2 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -461,6 +461,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()) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
