diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-07-04 08:51:53 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-07-04 13:30:08 +0200 |
commit | 10019608fd49c9d96b7015f982f40b1c09bc8b14 (patch) | |
tree | fcde61f06bf866aa15cdd788174cbe452fbba664 /writerfilter | |
parent | db85aebb7119181f9d96385006e52384c5457600 (diff) |
tdf#105095 DOCX import: conditionally ignore leading tab in footnotes
Commit b38629ae210b204a6d24d6e9c5c62eaaf563d494 (cp#1000017 DOCX/RTF
import: avoid fake tab char in footnotes, 2013-12-05) added code to
strip leading tabs from footnote text to improve odt->docx->odt rountrip
experience.
Turns out that this is correct only in case the gap between the footnote
number and the content is provided by a paragraph margin. In case there
is no such margin, then the tab is wanted; so only conditionally ignore
such leading tab characters.
(cherry picked from commit abc440a691efb872afac385ce5ed28cd5db56c8c)
Change-Id: I9d419bf2fd3b4899208489210cbe9809a2ab0736
Reviewed-on: https://gerrit.libreoffice.org/39494
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b52587a94e4d..e7ac74eb9fe9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1732,10 +1732,20 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) // Redlines for the footnote anchor CheckRedline( xFootnote->getAnchor( ) ); - // Word has a leading tab on footnotes, but we don't implement space - // between the footnote number and text using a tab, so just ignore - // that for now. - m_bIgnoreNextTab = true; + // Word has a leading tab on footnotes, but we may implement space + // between the footnote number and text using a paragraph margin, not a + // tab (Writer default). So ignore that in case there is a margin set. + uno::Reference<style::XStyleFamiliesSupplier> xStylesSupplier( GetTextDocument(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStylesSupplier->getStyleFamilies(); + uno::Reference<container::XNameContainer> xStyles; + xStyleFamilies->getByName("ParagraphStyles") >>= xStyles; + uno::Reference<beans::XPropertySet> xStyle(xStyles->getByName("Footnote"), uno::UNO_QUERY); + if (xStyle.is()) + { + sal_Int32 nMargin = 0; + xStyle->getPropertyValue("ParaLeftMargin") >>= nMargin; + m_bIgnoreNextTab = nMargin > 0; + } } catch( const uno::Exception& e ) { |