diff options
author | Justin Luth <justin_luth@sil.org> | 2016-07-23 07:54:57 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-07-25 06:15:21 +0000 |
commit | 9920a0bf9d783978cd6f7b97f7528d8aa2571143 (patch) | |
tree | 743264e817e78d1b08921ddf07a75f79737f0b25 | |
parent | 594dd232c8ff4808d4ad43cc41a9934a9c6d131d (diff) |
tdf#75573 - docx handle frame properties at styles
A frame with only a style defined doesn't create paragraph properties,
so the settings were just being ignored.
If the stylesheet is the top context, then the settings belong to
the style. If this slightly aggressive approach causes a regression,
then just use the style only if the paragraph properties don't exist.
Change-Id: I3b14205dc2bc5305f1eeb4cb72a812e877b532c7
Reviewed-on: https://gerrit.libreoffice.org/27453
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 13 |
2 files changed, 21 insertions, 8 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index d953c4f60e6c..82ca994baf83 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1734,9 +1734,21 @@ DECLARE_OOXMLIMPORT_TEST(testfdo76583, "fdo76583.docx") DECLARE_OOXMLIMPORT_TEST(testTdf75573, "tdf75573_page1frame.docx") { - // the problem was that an odd header was defined but not used, flagged as - // discardable, and then the unrelated frame was also discarded. + // the problem was that the frame was discarded + // when an unrelated, unused, odd-header was flagged as discardable lcl_countTextFrames( mxComponent, 1 ); + + // the frame should be on page 1 +// CPPUNIT_ASSERT_EQUAL( OUString("lorem ipsum"), parseDump("/root/page[1]/body/section/txt/anchored/fly/txt[1]/text()") ); + + // the "Proprietary" style should set the vertical and horizontal anchors to the page + uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); +// CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xPropertySet, "VertOrientRelation")); +// CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xPropertySet, "HoriOrientRelation")); + + // the frame should be located near the bottom[23186]/center[2955] of the page + CPPUNIT_ASSERT(sal_Int32(20000) < getProperty<sal_Int32>(xPropertySet, "VertOrientPosition")); + CPPUNIT_ASSERT(sal_Int32(2500) < getProperty<sal_Int32>(xPropertySet, "HoriOrientPosition")); } DECLARE_OOXMLIMPORT_TEST(testFdo43093, "fdo43093.docx") diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index ba1069ac9c0d..9a391490fb6d 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -693,8 +693,13 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_FramePr_hSpace: case NS_ooxml::LN_CT_FramePr_vSpace: { - ParagraphProperties* pParaProperties = dynamic_cast< ParagraphProperties*>( - m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() ); + ParagraphProperties* pParaProperties = nullptr; + // handle frame properties at styles + if( m_pImpl->GetTopContextType() == CONTEXT_STYLESHEET ) + pParaProperties = dynamic_cast< ParagraphProperties*>( m_pImpl->GetTopContextOfType( CONTEXT_STYLESHEET ).get() ); + else + pParaProperties = dynamic_cast< ParagraphProperties*>( m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() ); + if( pParaProperties ) { switch( nName ) @@ -822,10 +827,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) default:; } } - else - { - //TODO: how to handle frame properties at styles - } } break; case NS_ooxml::LN_CT_TrackChange_author: |