Kaydet (Commit) 9920a0bf authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Miklos Vajna

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/27453Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 594dd232
......@@ -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")
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment