writerfilter/source/dmapper/DomainMapper.cxx | 6 +++--- writerfilter/source/dmapper/PropertyMap.cxx | 10 +++++----- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 5 +---- 3 files changed, 9 insertions(+), 12 deletions(-)
New commits: commit d7c9a269a45ccb7fb8f87ed666a6358eb6712a38 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Jun 3 09:21:56 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Jun 3 10:01:36 2022 +0200 No need to static_cast these const Id (aka sal_uInt32) values Change-Id: I1ae1a4c0e0ca002414db68bf3ad382cb564e17a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135333 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 5d2549f6a9c8..c449296e5e2c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -627,7 +627,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } break; case NS_ooxml::LN_CT_PageSz_orient: - CT_PageSz.orient = (nIntValue != static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_PageOrientation_portrait)); + CT_PageSz.orient = (nIntValue != NS_ooxml::LN_Value_ST_PageOrientation_portrait); break; case NS_ooxml::LN_CT_PageSz_w: { @@ -998,7 +998,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) pSectionContext->SetdxaLnn( nIntValue ); break; case NS_ooxml::LN_CT_LineNumber_restart: - aSettings.bRestartAtEachPage = nIntValue == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_LineNumberRestart_newPage); + aSettings.bRestartAtEachPage = nIntValue == NS_ooxml::LN_Value_ST_LineNumberRestart_newPage; OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); if( pSectionContext ) pSectionContext->SetLnc( nIntValue ); @@ -1995,7 +1995,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { //continuous break only allowed if it is not the only section break SectionPropertyMap* pLastContext = m_pImpl->GetLastSectionContext(); - if ( nIntValue != static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || pLastContext || m_pImpl->GetParaSectpr() ) + if ( nIntValue != NS_ooxml::LN_Value_ST_SectionMark_continuous || pLastContext || m_pImpl->GetParaSectpr() ) pSectionContext->SetBreakType( nIntValue ); } break; diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 4c9b84c3755e..e1814a8ce1d5 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1565,7 +1565,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) } } - if (m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) + if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_continuous && !rDM_Impl.IsInComments()) { //todo: insert a section or access the already inserted section @@ -1671,7 +1671,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 == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_nextColumn) + else if (m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextColumn && m_nColumnCount > 1 && !rDM_Impl.IsInComments()) { try @@ -1845,7 +1845,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 == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_evenPage) || m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_oddPage) ) + 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 = rDM_Impl.GetUnusedPageStyleName(); @@ -1875,9 +1875,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) evenOddStyle->setPropertyValue( "FooterIsOn", uno::Any( false ) ); CopyHeaderFooter(rDM_Impl, pageProperties, evenOddStyle); *pageStyle = evenOddStyleName; // And use it instead of the original one (which is set as follow of this one). - if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_evenPage) ) + if ( m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_evenPage ) evenOddStyle->setPropertyValue( getPropertyName( PROP_PAGE_STYLE_LAYOUT ), uno::Any( style::PageStyleLayout_LEFT ) ); - else if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_oddPage) ) + else if ( m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_oddPage ) evenOddStyle->setPropertyValue( getPropertyName( PROP_PAGE_STYLE_LAYOUT ), uno::Any( style::PageStyleLayout_RIGHT ) ); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index ebd3922de22a..28fe9403955b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -659,10 +659,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal) bool bNeedSect = m_bNeedSect; RTFValue::Pointer_t pBreak = m_aStates.top().getSectionSprms().find(NS_ooxml::LN_EG_SectPrContents_type); - bool bContinuous - = pBreak - && pBreak->getInt() - == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous); + bool bContinuous = pBreak && 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. // Also, when pasting, it's fine to not have any paragraph inside the document at all.