[Libreoffice-commits] core.git: sw/qa writerfilter/source
Justin Luth
justin_luth at sil.org
Mon Jul 25 06:15:56 UTC 2016
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 ++++++++++++++--
writerfilter/source/dmapper/DomainMapper.cxx | 13 +++++++------
2 files changed, 21 insertions(+), 8 deletions(-)
New commits:
commit 9920a0bf9d783978cd6f7b97f7528d8aa2571143
Author: Justin Luth <justin_luth at sil.org>
Date: Sat Jul 23 07:54:57 2016 +0300
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 at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d953c4f..82ca994 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 ba1069a..9a39149 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:
More information about the Libreoffice-commits
mailing list