Kaydet (Commit) e0f9bb79 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#99074 DOCX import: handle <w:view w:val="web"/>

Instead of always using the Normal view, use the Web view when the DOCX
file contains Web Layout.

For this to work, expose sw's DocumentSettingId::BROWSE_MODE via
css.document.Settings.

Change-Id: I7787ca058d8cb8a346b2001a2bd70c3df86d8673
Reviewed-on: https://gerrit.libreoffice.org/23806Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst ac8c392d
......@@ -3216,6 +3216,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx")
CPPUNIT_ASSERT_EQUAL(nFlyHeight, nContentHeight);
}
DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx")
{
uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
uno::Reference<uno::XInterface> xSettings = xFactory->createInstance("com.sun.star.document.Settings");
// This was false, Web Layout was ignored on import.
CPPUNIT_ASSERT(getProperty<bool>(xSettings, "InBrowseMode"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -131,6 +131,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
HANDLE_SUBTRACT_FLYS,
HANDLE_BROWSE_MODE,
};
static MasterPropertySetInfo * lcl_createSettingsInfo()
......@@ -205,6 +206,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
{ OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
{ OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
{ OUString("InBrowseMode"), HANDLE_BROWSE_MODE, cppu::UnoType<bool>::get(), 0},
/*
* As OS said, we don't have a view when we need to set this, so I have to
* find another solution before adding them to this property set - MTG
......@@ -844,6 +846,15 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
}
}
break;
case HANDLE_BROWSE_MODE:
{
bool bTmp;
if (rValue >>= bTmp)
{
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bTmp);
}
}
break;
default:
throw UnknownPropertyException();
}
......@@ -1248,6 +1259,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS);
}
break;
case HANDLE_BROWSE_MODE:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE);
}
break;
default:
throw UnknownPropertyException();
}
......
......@@ -5028,6 +5028,10 @@ void DomainMapper_Impl::ApplySettingsTable()
if( m_pSettingsTable->GetEmbedSystemFonts())
xSettings->setPropertyValue( getPropertyName( PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) );
xSettings->setPropertyValue("AddParaTableSpacing", uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
// Web Layout.
if (m_pSettingsTable->GetView() == NS_ooxml::LN_Value_doc_ST_View_web)
xSettings->setPropertyValue("InBrowseMode", uno::makeAny(true));
}
catch(const uno::Exception&)
{
......
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