sw/qa/extras/ooxmlexport/data/first-header-footer.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 + sw/qa/extras/rtfimport/data/fdo82114.rtf | 14 ++ sw/qa/extras/rtfimport/rtfimport.cxx | 9 + sw/source/filter/ww8/rtfattributeoutput.cxx | 7 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 90 +++++------------ writerfilter/source/dmapper/DomainMapper_Impl.hxx | 3 writerfilter/source/dmapper/PropertyMap.cxx | 59 +++-------- 8 files changed, 82 insertions(+), 110 deletions(-)
New commits: commit ded74247a1200b3577ba3854e92f33de190d52a9 Author: Miklos Vajna <[email protected]> Date: Thu Sep 11 12:23:18 2014 +0200 Resolves: fdo#82114 RTF import: fix handling of first page in non-first section Change-Id: If06c6bcdda97447e6014223d997c7ff8abd64b48 (cherry picked from commit 04fe5e6a31c9701177a744bbc8a53b2f664fe71c) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx diff --git a/sw/qa/extras/rtfimport/data/fdo82114.rtf b/sw/qa/extras/rtfimport/data/fdo82114.rtf new file mode 100644 index 0000000..073d281 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo82114.rtf @@ -0,0 +1,14 @@ +{\rtf1 +\paperw11906\paperh16838\margl1134\margr567\margt1418\margb851\gutter0\ltrsect +\viewkind1\viewscale110\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nojkernpunct\rsidroot13516616\utinl \fet0 +\titlepg +{\headerr Right page header, section 1\par +} +{\headerf First page header, section 1\par +} +\pard\plain First page, section 1.\par\sect +\sectd\titlepg +{\headerf First page header, section 2\par +} +\pard\plain First page, section 2.\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index b3349f1..07a82cb 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1695,6 +1695,15 @@ DECLARE_RTFIMPORT_TEST(testFdo79959, "fdo79959.rtf") CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(getStyles("ParagraphStyles")->hasByName("Test"))); } +DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") +{ + uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); + OUString aActual = xHeaderText->getString(); + OUString aExpected("First page header, section 2"); + // This was 'Right page header, section 1'. + CPPUNIT_ASSERT_EQUAL(aExpected, aActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 4434bdc..cde69b1 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -396,14 +396,18 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( m_aFirstPageStyle = uno::Reference< beans::XPropertySet > ( xTextFactory->createInstance("com.sun.star.style.PageStyle"), uno::UNO_QUERY); + + // Call insertByName() before GetPageStyle(), otherwise the + // first and the follow page style will have the same name, and + // insertByName() will fail. + if (xPageStyles.is()) + xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) ); + // Ensure that m_aFollowPageStyle has been created GetPageStyle( xPageStyles, xTextFactory, false ); // Chain m_aFollowPageStyle to be after m_aFirstPageStyle m_aFirstPageStyle->setPropertyValue("FollowStyle", uno::makeAny(m_sFollowPageStyleName)); - - if (xPageStyles.is()) - xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) ); } else if( !m_aFirstPageStyle.is() && xPageStyles.is() ) { @@ -430,8 +434,9 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( } } - catch( const uno::Exception& ) + catch( const uno::Exception& rException ) { + SAL_WARN("writerfilter", "SectionPropertyMap::GetPageStyle() failed: " << rException.Message); } return xRet; commit 79bd799f0571a7213faa9b81709d0b4084a21c57 Author: Luke Deller <[email protected]> Date: Sat Jul 12 21:49:50 2014 +1000 Related: fdo#82114 Copy first-header-footer test from ww8 to ooxml The test document was converted from doc to docx using MS Word 2010. Several fixes were required to make this test pass: - Do not clear the "FirstIsShared" property on page styles, as the code instead uses the old fashioned method of translating a Word section with "different first page header/footer": two page styles linked together, the first page style and the follow page style. (Also remove a wrong test case which checks the FirstIsShared property) - Do not clear the "HeaderIsShared"/"FooterIsShared" properties on the first page style, only on the follow page style. - Actually set the "FollowStyle" property on the first page style to link it to the follow page style. This didn't matter for the very first Word section because it was mapped to the default page styles "First Page" and "Standard" which are already linked, but it does matter for subsequent Word sections. - For some reason setting a new page style at a section break was excluded in the case where the following section had a title page. Remove this exclusion. - The exclusion mentioned in the last point was masking that bnc#751077 was not entirely fixed. To resolve that issue: When checking if the last paragraph of the section is empty, consider not just text content but also shapes. - Remove a workaround for bnc#780843 involving copying of headers and footers from the "Standard" (first section) page style in the case where the following section had a title page. This workaround is no longer needed as the test case passes without it. (cherry picked from commit b4ccde72b8e2e45e7276d5b08b182495a1b1a617) Change-Id: Iacc9bba0720c11414da3e852892cff301ebbc4fe diff --git a/sw/qa/extras/ooxmlexport/data/first-header-footer.docx b/sw/qa/extras/ooxmlexport/data/first-header-footer.docx new file mode 100755 index 0000000..d18eea5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/first-header-footer.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index fb00ef3..ffb0832 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -959,8 +959,14 @@ DECLARE_OOXMLEXPORT_TEST(testPageBorderSpacingExportCase2, "page-borders-export- DECLARE_OOXMLEXPORT_TEST(testFdo66145, "fdo66145.docx") { // The Writer ignored the 'First Is Shared' flag - uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(xPropertySet, "FirstIsShared"))); + CPPUNIT_ASSERT_EQUAL(OUString("This is the FIRST page header."), + parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL( + OUString("This is the header for the REST OF THE FILE."), + parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL( + OUString("This is the header for the REST OF THE FILE."), + parseDump("/root/page[3]/header/txt/text()")); } DECLARE_OOXMLEXPORT_TEST(testGrabBag, "grabbag.docx") diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b4e7e42..37152f6 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1532,6 +1532,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, SectionPropertyMap::P try { bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; + bool bFirst = eType == SectionPropertyMap::PAGE_FIRST; if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || (GetSettingsTable()->GetEvenAndOddHeaders())) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); @@ -1543,7 +1544,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, SectionPropertyMap::P // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it // Even if the 'Even' header/footer is blank - the flag should be imported (so it would look in LO like in Word) - if (GetSettingsTable()->GetEvenAndOddHeaders()) + if (!bFirst && GetSettingsTable()->GetEvenAndOddHeaders()) xPageStyle->setPropertyValue(rPropNameSupplier.GetName(ePropShared), uno::makeAny(false)); //set the interface @@ -1930,6 +1931,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape xProps->setPropertyValue( rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), (*pos).second.getValue() ); } } + m_bParaChanged = true; } catch ( const uno::Exception& e ) { diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 055916b..4434bdc 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -396,6 +396,12 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( m_aFirstPageStyle = uno::Reference< beans::XPropertySet > ( xTextFactory->createInstance("com.sun.star.style.PageStyle"), uno::UNO_QUERY); + // Ensure that m_aFollowPageStyle has been created + GetPageStyle( xPageStyles, xTextFactory, false ); + // Chain m_aFollowPageStyle to be after m_aFirstPageStyle + m_aFirstPageStyle->setPropertyValue("FollowStyle", + uno::makeAny(m_sFollowPageStyleName)); + if (xPageStyles.is()) xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) ); } @@ -1083,11 +1089,6 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) if( xColumns.is() ) xFirstPageStyle->setPropertyValue( rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns )); - - // If the 'Different First Page' flag is turned on - do not ignore it - // If the 'Diffferent First Page' is non-checked, it must be checked - the flag should be imported (so it would look in LO like in Word) - xFirstPageStyle->setPropertyValue(rPropNameSupplier.GetName( PROP_FIRST_IS_SHARED ), uno::makeAny( false )); - xFollowPageStyle->setPropertyValue(rPropNameSupplier.GetName( PROP_FIRST_IS_SHARED ), uno::makeAny( false )); } ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams ); @@ -1099,41 +1100,12 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange)); /* break type 0 - No break 1 - New Column 2 - New page 3 - Even page 4 - odd page */ - if ((m_bTitlePage && m_bIsFirstSection) || !m_bTitlePage) - { - if (xRangeProperties.is() && rDM_Impl.IsNewDoc()) - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), - uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName )); - } - else - { - // In this miserable situation (second or later section on a title page), make sure that the header / footer is not lost. - uno::Reference< container::XNameAccess > xPageStyles(rDM_Impl.GetPageStyles(), uno::UNO_QUERY); - if (xPageStyles->hasByName(m_sFollowPageStyleName)) - { - uno::Reference<beans::XPropertySet> xCurrent(xPageStyles->getByName(rPropNameSupplier.GetName(PROP_STANDARD)), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xFollow(xPageStyles->getByName(m_sFollowPageStyleName), uno::UNO_QUERY); - - if (xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_ON)).get<sal_Bool>()) - { - xCurrent->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_ON), uno::makeAny(sal_True)); - uno::Reference<text::XTextRange> xCurrentRange(xCurrent->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_TEXT)), uno::UNO_QUERY_THROW); - xCurrentRange->setString(""); - uno::Reference<text::XTextCopy> xCurrentTxt(xCurrentRange, uno::UNO_QUERY_THROW); - uno::Reference<text::XTextCopy> xFollowTxt(xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_TEXT)), uno::UNO_QUERY_THROW); - xCurrentTxt->copyText(xFollowTxt); - } - if (xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_ON)).get<sal_Bool>()) - { - xCurrent->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_ON), uno::makeAny(sal_True)); - uno::Reference<text::XTextRange> xCurrentRange(xCurrent->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_TEXT)), uno::UNO_QUERY_THROW); - xCurrentRange->setString(""); - uno::Reference<text::XTextCopy> xCurrentTxt(xCurrentRange, uno::UNO_QUERY_THROW); - uno::Reference<text::XTextCopy> xFollowTxt(xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_TEXT)), uno::UNO_QUERY_THROW); - xCurrentTxt->copyText(xFollowTxt); - } - } - } + if (xRangeProperties.is() && rDM_Impl.IsNewDoc()) + xRangeProperties->setPropertyValue( + rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), + uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName + : m_sFollowPageStyleName )); + // handle page breaks with odd/even page numbering style::PageStyleLayout nPageStyleLayout(style::PageStyleLayout_ALL); if (m_nBreakType == 3) commit 416546ee8ef21d8ea33c1aa2c17dd6a9a0ac6189 Author: Jan Holesovsky <[email protected]> Date: Fri Feb 21 13:56:18 2014 +0100 Related: fdo#82114 Kill copy'n'paste. (cherry picked from commit 07338e20663f9a52f819d0d0c93e8599406d1ff2) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.hxx Change-Id: I3d457efc89873ca92a4458b1ac0a125848c942a8 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b70c3af..b4e7e42 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1507,14 +1507,18 @@ uno::Reference< beans::XPropertySet > DomainMapper_Impl::appendTextSectionAfter( return xRet; } - -void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) +void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType) { + const PropertyIds ePropIsOn = bHeader? PROP_HEADER_IS_ON: PROP_FOOTER_IS_ON; + const PropertyIds ePropShared = bHeader? PROP_HEADER_IS_SHARED: PROP_FOOTER_IS_SHARED; + const PropertyIds ePropTextLeft = bHeader? PROP_HEADER_TEXT_LEFT: PROP_FOOTER_TEXT_LEFT; + const PropertyIds ePropText = bHeader? PROP_HEADER_TEXT: PROP_FOOTER_TEXT; + m_bInHeaderFooterImport = true; //get the section context PropertyMapPtr pContext = DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION); - //ask for the header name of the given type + //ask for the header/footer name of the given type SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() ); if(pSectionContext) { @@ -1532,21 +1536,22 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); - //switch on header use + //switch on header/footer use xPageStyle->setPropertyValue( - rPropNameSupplier.GetName(PROP_HEADER_IS_ON), - uno::makeAny(sal_True) ); + rPropNameSupplier.GetName(ePropIsOn), + uno::makeAny(sal_True)); // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it - // Even if the 'Even' header is blank - the flag should be imported (so it would look in LO like in Word) + // Even if the 'Even' header/footer is blank - the flag should be imported (so it would look in LO like in Word) if (GetSettingsTable()->GetEvenAndOddHeaders()) - xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false )); + xPageStyle->setPropertyValue(rPropNameSupplier.GetName(ePropShared), uno::makeAny(false)); //set the interface - uno::Reference< text::XText > xHeaderText; - xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_HEADER_TEXT_LEFT : PROP_HEADER_TEXT) ) >>= xHeaderText; - m_aTextAppendStack.push( TextAppendContext(uno::Reference< text::XTextAppend >( xHeaderText, uno::UNO_QUERY_THROW), - m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xHeaderText->getStart()))); + uno::Reference< text::XText > xText; + xPageStyle->getPropertyValue(rPropNameSupplier.GetName(bLeft? ePropTextLeft: ePropText)) >>= xText; + + m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >(xText, uno::UNO_QUERY_THROW), + m_bIsNewDoc? uno::Reference<text::XTextCursor>(): m_xBodyText->createTextCursorByRange(xText->getStart()))); } else { @@ -1559,59 +1564,16 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) } } +void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) +{ + PushPageHeaderFooter(/* bHeader = */ true, eType); +} void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) { - m_bInHeaderFooterImport = true; - - //get the section context - PropertyMapPtr pContext = DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION); - //ask for the footer name of the given type - SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() ); - if(pSectionContext) - { - uno::Reference< beans::XPropertySet > xPageStyle = - pSectionContext->GetPageStyle( - GetPageStyles(), - m_xTextFactory, - eType == SectionPropertyMap::PAGE_FIRST ); - if (!xPageStyle.is()) - return; - try - { - bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; - if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || (GetSettingsTable()->GetEvenAndOddHeaders())) - { - PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); - - //switch on footer use - xPageStyle->setPropertyValue( - rPropNameSupplier.GetName(PROP_FOOTER_IS_ON), - uno::makeAny(sal_True) ); - - // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it - // Even if the 'Even' footer is blank - the flag should be imported (so it would look in LO like in Word) - if (GetSettingsTable()->GetEvenAndOddHeaders()) - xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false )); - - //set the interface - uno::Reference< text::XText > xFooterText; - xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_FOOTER_TEXT_LEFT : PROP_FOOTER_TEXT) ) >>= xFooterText; - m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xFooterText, uno::UNO_QUERY_THROW ), - m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xFooterText->getStart()))); - } - else - { - m_bDiscardHeaderFooter = true; - } - } - catch( const uno::Exception& ) - { - } - } + PushPageHeaderFooter(/* bHeader = */ false, eType); } - void DomainMapper_Impl::PopPageHeaderFooter() { //header and footer always have an empty paragraph at the end diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index ca61079..8c2d095 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -774,6 +774,9 @@ public: /// A sub-grabbag of m_aInteropGrabBag, like 'spacing'. std::vector<beans::PropertyValue> m_aSubInteropGrabBag; + +private: + void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType); }; } //namespace dmapper } //namespace writerfilter commit 93caffa2c9c0745f00fbf21c554ba56f01d30da5 Author: Jan Holesovsky <[email protected]> Date: Fri Feb 21 13:29:42 2014 +0100 Related fdo#38054 fdo#82114: Don't crash when opening this document. The document itself is (I think) corrupted, but we shouldn't crash anyway. (cherry picked from commit fd859ee5802d6fa353526e632b49a8208444769e) Change-Id: I7ecfaed7003de2976e47992c89bb695a5cdffda4 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 47f3a41..b70c3af 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1528,7 +1528,7 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) try { bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; - if ((!bLeft && !m_pSettingsTable->GetEvenAndOddHeaders()) || (m_pSettingsTable->GetEvenAndOddHeaders())) + if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || (GetSettingsTable()->GetEvenAndOddHeaders())) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); @@ -1539,7 +1539,7 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it // Even if the 'Even' header is blank - the flag should be imported (so it would look in LO like in Word) - if( m_pSettingsTable->GetEvenAndOddHeaders() ) + if (GetSettingsTable()->GetEvenAndOddHeaders()) xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false )); //set the interface @@ -1580,7 +1580,7 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) try { bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; - if ((!bLeft && !m_pSettingsTable->GetEvenAndOddHeaders()) || (m_pSettingsTable->GetEvenAndOddHeaders())) + if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || (GetSettingsTable()->GetEvenAndOddHeaders())) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); @@ -1591,7 +1591,7 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it // Even if the 'Even' footer is blank - the flag should be imported (so it would look in LO like in Word) - if( m_pSettingsTable->GetEvenAndOddHeaders() ) + if (GetSettingsTable()->GetEvenAndOddHeaders()) xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false )); //set the interface @@ -4275,7 +4275,7 @@ void DomainMapper_Impl::ResetParaRedline( ) void DomainMapper_Impl::ApplySettingsTable() { - if( m_pSettingsTable && m_xTextFactory.is() ) + if (m_pSettingsTable && m_xTextFactory.is()) { try { commit 3ec421b08432822708fc8541f342bcb7851d3888 Author: Miklos Vajna <[email protected]> Date: Tue Sep 9 17:15:56 2014 +0200 abi#10076 RTF export: handle frames without a valid anchor point Ideally all frames have an anchor point in the maFrames vector, as provided by MSWordExportBase. If that's not the case, then we have no idea what would be a valid anchor point: just export those as inline, as we did before. (cherry picked from commit 2f33111510c87ca310fde346e223bd6e750b2248) Change-Id: I81134d9fb8dc4ca166084964d277ac02ceccde7b diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index ec3c748..5ace8b1 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3715,7 +3715,6 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S break; } } - assert(pFrame); /* If the graphic is not of type WMF then we will have to store two @@ -3724,7 +3723,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S a wmf already then we don't need any such wrapping */ bool bIsWMF = pBLIPType && std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0; - if (pFrame->IsInline()) + if (!pFrame || pFrame->IsInline()) { if (!bIsWMF) m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT; @@ -3756,7 +3755,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SP "{" OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " "; } - bool bWritePicProp = pFrame->IsInline(); + bool bWritePicProp = !pFrame || pFrame->IsInline(); if (pBLIPType) ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp); else @@ -3771,7 +3770,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp); } - if (pFrame->IsInline()) + if (!pFrame || pFrame->IsInline()) { if (!bIsWMF) { _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
