diff options
author | Mark Hung <marklh9@gmail.com> | 2018-02-25 00:38:49 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-03-01 13:01:35 +0100 |
commit | 18b4c1d0b8e030e4fa081995eccf68f01049892e (patch) | |
tree | 24cf9f028066067b43033c8a1ef996fced25a323 | |
parent | 3d400321910ff0fe89ab8c70c59432e676cb1340 (diff) |
tdf#45999 doc: make RTL text in comments show correctly in MSWord.
Both sprmPFBiDi and sprmCFBiDi need to be written to doc to make
the word order correct. The patch output sprmCFBiDi when the
paragraph is a RTL paragraph.
Change-Id: I429d4e9cf60cf0c65831a24a7f3fa151a9dc3b9f
Reviewed-on: https://gerrit.libreoffice.org/50294
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Hung <marklh9@gmail.com>
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 0260e6c74beb..4e5c1a2838fa 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1341,6 +1341,16 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTyp OUString aStr( rEditObj.GetText( n )); sal_Int32 nAktPos = 0; const sal_Int32 nEnd = aStr.getLength(); + + const SfxItemSet aSet(rEditObj.GetParaAttribs(n)); + bool bIsRTLPara = false; + const SfxPoolItem *pItem; + if(SfxItemState::SET == aSet.GetItemState(EE_PARA_WRITINGDIR, true, &pItem)) + { + SvxFrameDirection nDir = static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue(); + bIsRTLPara = SvxFrameDirection::Horizontal_RL_TB == nDir; + } + do { const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd); @@ -1355,6 +1365,17 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTyp // output of character attributes aAttrIter.OutAttr( nAktPos ); // nAktPos - 1 ?? + + if (bIsRTLPara) + { + // This is necessary to make word order correct in MS Word. + // In theory we should do this for complex-script runs only, + // but Outliner does not split runs like Writer core did. + // Fortunately, both MS Word and Writer seems to tolerate + // that we turn it on for non complex-script runs. + AttrOutput().OutputItem(SfxInt16Item(RES_CHRATR_BIDIRTL, 1)); + } + m_pChpPlc->AppendFkpEntry( Strm().Tell(), pO->size(), pO->data() ); pO->clear(); |