writerfilter/source/dmapper/PropertyMap.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit 3f13a8255be93cd3b697f42d691b35418eb87114 Author: Miklos Vajna <vmik...@suse.cz> Date: Fri Nov 30 13:18:07 2012 +0100 dmapper: couple of null pointer checks for the unit test Change-Id: Ie0b12f416da2dda95fdb4e46482a50fee0245ffe diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 5a90e50..c2fe9ef 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -788,13 +788,13 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection, DomainMapper_Impl& rDM_Impl, uno::Reference<text::XTextRange> xStartingRange) { uno::Reference< beans::XPropertySet > xRangeProperties; - if (bIsFirstSection) + if (bIsFirstSection && rDM_Impl.GetBodyText().is()) { uno::Reference<container::XEnumerationAccess> xEnumAccess(rDM_Impl.GetBodyText(), uno::UNO_QUERY_THROW); uno::Reference<container::XEnumeration> xEnum = xEnumAccess->createEnumeration(); xRangeProperties = uno::Reference<beans::XPropertySet>(xEnum->nextElement(), uno::UNO_QUERY_THROW); } - else + else if (xStartingRange.is()) xRangeProperties = uno::Reference<beans::XPropertySet>(xStartingRange, uno::UNO_QUERY_THROW); return xRangeProperties; } @@ -839,7 +839,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) if( m_nColumnCount > 0 && xSection.is()) ApplyColumnProperties( xSection ); uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange)); - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName)); + if (xRangeProperties.is()) + xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName)); } // If the section is of type "New column" (0x01), then simply insert a column break. // But only if there actually are columns on the page, otherwise a column break @@ -999,8 +1000,11 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) /* break type 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */ if ((m_bTitlePage && m_bIsFirstSection) || !m_bTitlePage) - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), - uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName )); + { + if (xRangeProperties.is()) + 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. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits