diff options
author | Mark Hung <marklh9@gmail.com> | 2015-05-14 23:02:21 +0800 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-05-19 11:41:46 +0000 |
commit | b7c8c337d4ffad55fe111c9634c4c04afce78bad (patch) | |
tree | 090833e16261007525577686269e5ea14fcd6148 /writerfilter/source/dmapper/DomainMapper.cxx | |
parent | 3128dbdebef081cc865a6239543c5a8ab705fdcc (diff) |
tdf#91261: DOCX import: snapGrid property of paragraphs are ignored
Fix the situation for OOXML import filter:
a) While handling DocGrid type, SnapToChars was treated as
None. Now it is implemented as described in the article:
http://linpeifeng.blogspot.tw/2007/02/text-grid-enhancement.html
Both LinesAndChars and SnapToChars will be translated to
Writer grid type "lines and characters", and set SnapToGrid
property to false or true accordingly.
b) All the imported paragraphs snap to grid because SnapToGrid was
appended to grabbag, now it allows SnapToGrid property in
paragraph and paragraph styles to be imported properly.
Change-Id: I446b4c64c0ed86960896bcd61a1006c9173a757a
Reviewed-on: https://gerrit.libreoffice.org/15732
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index abe1069c8885..5542cca364e3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -934,14 +934,18 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) switch( nIntValue ) { case NS_ooxml::LN_Value_doc_ST_DocGrid_default: - case NS_ooxml::LN_Value_doc_ST_DocGrid_snapToChars: - pSectionContext->SetGridType( 0 ); + pSectionContext->SetGridType(text::TextGridMode::NONE); break; case NS_ooxml::LN_Value_doc_ST_DocGrid_lines: - pSectionContext->SetGridType( 1 ); + pSectionContext->SetGridType(text::TextGridMode::LINES); break; case NS_ooxml::LN_Value_doc_ST_DocGrid_linesAndChars: - pSectionContext->SetGridType( 2 ); + pSectionContext->SetGridType(text::TextGridMode::LINES_AND_CHARS); + pSectionContext->SetGridSnapToChars( false ); + break; + case NS_ooxml::LN_Value_doc_ST_DocGrid_snapToChars: + pSectionContext->SetGridType(text::TextGridMode::LINES_AND_CHARS); + pSectionContext->SetGridSnapToChars( true ); break; default : OSL_FAIL("unknown SwTextGrid value"); @@ -2005,7 +2009,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) break; case NS_ooxml::LN_CT_PPrBase_snapToGrid: - m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "snapToGrid", OUString::number(nIntValue)); + if (!IsStyleSheetImport()||!m_pImpl->isInteropGrabBagEnabled()) + { + rContext->Insert( PROP_SNAP_TO_GRID, uno::makeAny(bool(nIntValue))); + } + else + { + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "snapToGrid", OUString::number(nIntValue)); + } break; case NS_ooxml::LN_CT_PPrBase_pStyle: { |