writerfilter/source/dmapper/DomainMapper.cxx | 4 ++-- writerfilter/source/dmapper/PropertyMap.cxx | 11 +++++------ writerfilter/source/ooxml/model.xml | 10 +++++----- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 +++++++------- 4 files changed, 19 insertions(+), 20 deletions(-)
New commits: commit 34bfe4552d7e2e36805bc3d41982e9d9904a2f01 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Oct 3 09:00:44 2014 +0200 Use constants for ST_SectionMark values Change-Id: I3ac385b8f21409b5083b1224652283fec8bb2fa4 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 14b9971..4ef5e71 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1646,14 +1646,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) // Ignore continuous section break at the end of the document, if the previous section had the same type as well // It makes the importer lose margin settings with no benefit SectionPropertyMap* pLastContext = m_pImpl->GetLastSectionContext(); - int nPrevBreakType = 0; + int nPrevBreakType = NS_ooxml::LN_Value_ST_SectionMark_continuous; bool bHasPrevSection = false; if (pLastContext) { bHasPrevSection = true; nPrevBreakType = pLastContext->GetBreakType(); } - if (m_pImpl->GetParaSectpr() || nIntValue != 0 || (bHasPrevSection && nPrevBreakType != nIntValue)) + if (m_pImpl->GetParaSectpr() || nIntValue != NS_ooxml::LN_Value_ST_SectionMark_continuous || (bHasPrevSection && nPrevBreakType != nIntValue)) pSectionContext->SetBreakType( nIntValue ); } break; diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index adf882e..a91f035 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1071,11 +1071,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) } } - // break type : 0 - No break 1 - New Column 2 - New page 3 - Even page 4 - odd page // depending on the break type no page styles should be created // If the section type is missing, but we have columns, then this should be // handled as a continuous section break. - if(m_nBreakType == 0 || (m_nBreakType == -1 && m_nColumnCount > 0)) + if(m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_continuous || (m_nBreakType == -1 && m_nColumnCount > 0)) { //todo: insert a section or access the already inserted section uno::Reference< beans::XPropertySet > xSection = @@ -1106,7 +1105,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) // 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 // seems to be handled like a page break by MSO. - else if(m_nBreakType == 1 && m_nColumnCount > 0 ) + else if(m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextColumn && m_nColumnCount > 0 ) { uno::Reference< beans::XPropertySet > xRangeProperties; if( m_xStartingRange.is() ) @@ -1253,7 +1252,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) // Handle page breaks with odd/even page numbering. We need to use an extra page style for setting the page style // to left/right, because if we set it to the normal style, we'd set it to "First Page"/"Default Style", which would // break them (all default pages would be only left or right). - if (m_nBreakType == 3 || m_nBreakType == 4) + if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_evenPage || m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_oddPage) { OUString* pageStyle = m_bTitlePage ? &m_sFirstPageStyleName : &m_sFollowPageStyleName; OUString evenOddStyleName = lcl_FindUnusedPageStyleName(rDM_Impl.GetPageStyles()->getElementNames()); @@ -1275,9 +1274,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) evenOddStyle->setPropertyValue("FooterIsOn", uno::makeAny(sal_False)); CopyHeaderFooter( pageProperties, evenOddStyle ); *pageStyle = evenOddStyleName; // And use it instead of the original one (which is set as follow of this one). - if (m_nBreakType == 3) + if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_evenPage) evenOddStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_STYLE_LAYOUT), uno::makeAny(style::PageStyleLayout_LEFT)); - else if (m_nBreakType == 4) + else if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_oddPage) evenOddStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_STYLE_LAYOUT), uno::makeAny(style::PageStyleLayout_RIGHT)); } diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index f6e7e03..ab4156e 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -17566,11 +17566,11 @@ <element name="format" tokenid="ooxml:CT_FFTextInput_format"/> </resource> <resource name="ST_SectionMark" resource="List"> - <value tokenid="0">continuous</value> - <value tokenid="1">nextColumn</value> - <value tokenid="2">nextPage</value> - <value tokenid="3">evenPage</value> - <value tokenid="4">oddPage</value> + <value tokenid="ooxml:Value_ST_SectionMark_continuous">continuous</value> + <value tokenid="ooxml:Value_ST_SectionMark_nextColumn">nextColumn</value> + <value tokenid="ooxml:Value_ST_SectionMark_nextPage">nextPage</value> + <value tokenid="ooxml:Value_ST_SectionMark_evenPage">evenPage</value> + <value tokenid="ooxml:Value_ST_SectionMark_oddPage">oddPage</value> </resource> <resource name="CT_SectType" resource="Value"> <attribute name="val" tokenid="ooxml:CT_SectType_val" action="setValue"/> diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index c31b7fa..9a3e1af 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -585,7 +585,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false) SAL_INFO("writerfilter", OSL_THIS_FUNC << ": final? " << bFinal << ", needed? " << m_bNeedSect); bool bNeedSect = m_bNeedSect; RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type); - bool bContinuous = pBreak.get() && pBreak->getInt() == 0; + bool bContinuous = pBreak.get() && pBreak->getInt() == NS_ooxml::LN_Value_ST_SectionMark_continuous; // If there is no paragraph in this section, then insert a dummy one, as required by Writer, // unless this is the end of the doc, we had nothing since the last section break and this is not a continuous one. if (m_bNeedPar && !(bFinal && !m_bNeedSect && !bContinuous) && !isSubstream()) @@ -2329,7 +2329,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type); // Unless we're on a title page. RTFValue::Pointer_t pTitlePg = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_titlePg); - if (((pBreak.get() && !pBreak->getInt()) + if (((pBreak.get() && pBreak->getInt() == NS_ooxml::LN_Value_ST_SectionMark_continuous) || m_nResetBreakOnSectBreak == RTF_SBKNONE) && !(pTitlePg.get() && pTitlePg->getInt())) { @@ -2634,19 +2634,19 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) switch (nKeyword) { case RTF_SBKNONE: - nParam = 0; + nParam = NS_ooxml::LN_Value_ST_SectionMark_continuous; break; case RTF_SBKCOL: - nParam = 1; + nParam = NS_ooxml::LN_Value_ST_SectionMark_nextColumn; break; case RTF_SBKPAGE: - nParam = 2; + nParam = NS_ooxml::LN_Value_ST_SectionMark_nextPage; break; case RTF_SBKEVEN: - nParam = 3; + nParam = NS_ooxml::LN_Value_ST_SectionMark_evenPage; break; case RTF_SBKODD: - nParam = 4; + nParam = NS_ooxml::LN_Value_ST_SectionMark_oddPage; break; default: break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits