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

DOCX import: ignore SDT as well in to-be-discarded header/footer

Change-Id: I53388e8b8ca71a3ad5d0b3e22dd60c642cb1f4b7
üst b9f18705
...@@ -242,6 +242,15 @@ DECLARE_OOXMLEXPORT_TEST(testTableAlignment, "table-alignment.docx") ...@@ -242,6 +242,15 @@ DECLARE_OOXMLEXPORT_TEST(testTableAlignment, "table-alignment.docx")
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::RIGHT, getProperty<sal_Int16>(xTable, "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::RIGHT, getProperty<sal_Int16>(xTable, "HoriOrient"));
} }
DECLARE_OOXMLEXPORT_TEST(testSdtIgnoredFooter, "sdt-ignored-footer.docx")
{
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
{
// This was 1, make sure no w:sdt sneaks into the main document from the footer.
assertXPath(pXmlDoc, "//w:sdt", 0);
}
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -2976,6 +2976,12 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) ...@@ -2976,6 +2976,12 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
{ {
// there are unsupported SDT properties in the document // there are unsupported SDT properties in the document
// save them in the paragraph interop grab bag // save them in the paragraph interop grab bag
if (m_pImpl->IsDiscardHeaderFooter())
{
// Unless we're supposed to ignore this header/footer.
m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear();
return;
}
if((m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_checkbox") || if((m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_checkbox") ||
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_text") || m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_text") ||
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_dataBinding") || m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_dataBinding") ||
......
...@@ -2034,6 +2034,11 @@ bool DomainMapper_Impl::IsSdtEndBefore() ...@@ -2034,6 +2034,11 @@ bool DomainMapper_Impl::IsSdtEndBefore()
return bIsSdtEndBefore; return bIsSdtEndBefore;
} }
bool DomainMapper_Impl::IsDiscardHeaderFooter()
{
return m_bDiscardHeaderFooter;
}
sal_Int16 lcl_ParseNumberingType( const OUString& rCommand ) sal_Int16 lcl_ParseNumberingType( const OUString& rCommand )
{ {
sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR; sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
......
...@@ -827,6 +827,8 @@ public: ...@@ -827,6 +827,8 @@ public:
/// Check if "SdtEndBefore" property is set /// Check if "SdtEndBefore" property is set
bool IsSdtEndBefore(); bool IsSdtEndBefore();
bool IsDiscardHeaderFooter();
private: private:
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType); void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ; std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ;
......
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