diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-10 11:20:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-11 06:57:26 +0100 |
commit | f26621d468eb19197d76f10779d5edc7dff6022f (patch) | |
tree | fcca1e3eb1aace22ebe547d559621da7c1dbc8d2 | |
parent | 412ca1ff72d2031d327df658a94e63bdcb8583b0 (diff) |
convert SectionType to scoped enum
Change-Id: Ib05b88b05c90b835107128f42c70170660788d00
Reviewed-on: https://gerrit.libreoffice.org/84851
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
39 files changed, 169 insertions, 169 deletions
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 0776afda4cf9..6cb83b9962db 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -43,11 +43,11 @@ class SwServerObject; typedef std::vector<SwSection*> SwSections; -enum SectionType { CONTENT_SECTION, - TOX_HEADER_SECTION, - TOX_CONTENT_SECTION, - DDE_LINK_SECTION = OBJECT_CLIENT_DDE, - FILE_LINK_SECTION = OBJECT_CLIENT_FILE +enum class SectionType { Content, + ToxHeader, + ToxContent, + DdeLink = OBJECT_CLIENT_DDE, + FileLink = OBJECT_CLIENT_FILE }; enum LinkCreateType @@ -128,7 +128,7 @@ public: void SetPassword(css::uno::Sequence<sal_Int8> const& rNew) { m_Password = rNew; } bool IsLinkType() const - { return (DDE_LINK_SECTION == m_eType) || (FILE_LINK_SECTION == m_eType); } + { return (SectionType::DdeLink == m_eType) || (SectionType::FileLink == m_eType); } bool IsConnectFlag() const { return m_bConnectFlag; } void SetConnectFlag(bool const bFlag){ m_bConnectFlag = bFlag; } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f4ceaeb25839..6932e6992e81 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1329,7 +1329,7 @@ void SwUiWriterTest::testCp1000071() // Change the document layout to be 2 columns, and then undo. pWrtShell->SelAll(); - SwSectionData section(CONTENT_SECTION, pWrtShell->GetUniqueSectionName()); + SwSectionData section(SectionType::Content, pWrtShell->GetUniqueSectionName()); SfxItemSet set( pDoc->GetDocShell()->GetPool(), svl::Items<RES_COL, RES_COL>{} ); SwFormatCol col; col.Init( 2, 0, 10000 ); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index fefd9f3f8df7..e351da8e14f7 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -232,7 +232,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->EndOfSection(true); - SwSectionData section(CONTENT_SECTION, pWrtShell->GetUniqueSectionName()); + SwSectionData section(SectionType::Content, pWrtShell->GetUniqueSectionName()); section.SetHidden(true); SwSection const* pSection = pWrtShell->InsertSection(section, nullptr); diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx index bca511eb0cfa..a3ece547a8a9 100644 --- a/sw/source/core/access/accframe.cxx +++ b/sw/source/core/access/accframe.cxx @@ -389,8 +389,8 @@ bool SwAccessibleFrame::IsOpaque( SwViewShell const *pVSh ) const if( pFrame->IsSctFrame() ) { const SwSection* pSection = static_cast<const SwSectionFrame*>(pFrame)->GetSection(); - if( pSection && ( TOX_HEADER_SECTION == pSection->GetType() || - TOX_CONTENT_SECTION == pSection->GetType() ) && + if( pSection && ( SectionType::ToxHeader == pSection->GetType() || + SectionType::ToxContent == pSection->GetType() ) && !pVOpt->IsReadonly() && SwViewOption::IsIndexShadings() ) return true; diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 9153b8b34e85..ebc9ab4306bd 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -269,7 +269,7 @@ bool SwCursorShell::GotoNextTOXBase( const OUString* pName ) for( SwSectionFormats::size_type n = rFormats.size(); n; ) { const SwSection* pSect = rFormats[ --n ]->GetSection(); - if (TOX_CONTENT_SECTION == pSect->GetType()) + if (SectionType::ToxContent == pSect->GetType()) { SwSectionNode const*const pSectNd( pSect->GetFormat()->GetSectionNode()); @@ -320,7 +320,7 @@ bool SwCursorShell::GotoPrevTOXBase( const OUString* pName ) for( SwSectionFormats::size_type n = rFormats.size(); n; ) { const SwSection* pSect = rFormats[ --n ]->GetSection(); - if (TOX_CONTENT_SECTION == pSect->GetType()) + if (SectionType::ToxContent == pSect->GetType()) { SwSectionNode const*const pSectNd( pSect->GetFormat()->GetSectionNode()); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 1075f2fa0fb6..12b71b08d530 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -315,7 +315,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) { // if it is no linked section then we cannot select it const SwSection& rSect = *pFormat->GetSection(); - if( CONTENT_SECTION == rSect.GetType() ) + if( SectionType::Content == rSect.GetType() ) { RestoreSavePos(); return true; diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index e3562414907d..165b3a20298f 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1054,7 +1054,7 @@ const SwNode& SwCompareLine::GetEndNode() const { const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(rNode); const SwSection& rSect = rSNd.GetSection(); - if( CONTENT_SECTION != rSect.GetType() || rSect.IsProtect() ) + if( SectionType::Content != rSect.GetType() || rSect.IsProtect() ) pNd = rNode.EndOfSectionNode(); } break; @@ -1131,8 +1131,8 @@ bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) eDstSectType = rDstSect.GetType(); switch( eSrcSectType ) { - case CONTENT_SECTION: - bRet = CONTENT_SECTION == eDstSectType && + case SectionType::Content: + bRet = SectionType::Content == eDstSectType && rSrcSect.IsProtect() == rDstSect.IsProtect(); if( bRet && rSrcSect.IsProtect() ) { @@ -1142,10 +1142,10 @@ bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) } break; - case TOX_HEADER_SECTION: - case TOX_CONTENT_SECTION: - if( TOX_HEADER_SECTION == eDstSectType || - TOX_CONTENT_SECTION == eDstSectType ) + case SectionType::ToxHeader: + case SectionType::ToxContent: + if( SectionType::ToxHeader == eDstSectType || + SectionType::ToxContent == eDstSectType ) { // the same type of TOX? const SwTOXBase* pSrcTOX = rSrcSect.GetTOXBase(); @@ -1158,8 +1158,8 @@ bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) } break; - case DDE_LINK_SECTION: - case FILE_LINK_SECTION: + case SectionType::DdeLink: + case SectionType::FileLink: bRet = eSrcSectType == eDstSectType && rSrcSect.GetLinkFileName() == rDstSect.GetLinkFileName(); @@ -1209,14 +1209,14 @@ OUString SwCompareLine::GetText() const const SwSection& rSect = rSNd.GetSection(); switch( rSect.GetType() ) { - case CONTENT_SECTION: + case SectionType::Content: if( rSect.IsProtect() ) sRet += OUString::number( rSNd.EndOfSectionIndex() - rSNd.GetIndex() ); break; - case TOX_HEADER_SECTION: - case TOX_CONTENT_SECTION: + case SectionType::ToxHeader: + case SectionType::ToxContent: { const SwTOXBase* pTOX = rSect.GetTOXBase(); if( pTOX ) @@ -1225,8 +1225,8 @@ OUString SwCompareLine::GetText() const } break; - case DDE_LINK_SECTION: - case FILE_LINK_SECTION: + case SectionType::DdeLink: + case SectionType::FileLink: sRet += rSect.GetLinkFileName(); break; } @@ -1409,7 +1409,7 @@ sal_uLong CompareData::NextIdx( const SwNode* pNd ) const SwSectionNode* pSNd; if( pNd->IsTableNode() || ( nullptr != (pSNd = pNd->GetSectionNode() ) && - ( CONTENT_SECTION != pSNd->GetSection().GetType() || + ( SectionType::Content != pSNd->GetSection().GetType() || pSNd->GetSection().IsProtect() ) ) ) pNd = pNd->EndOfSectionNode(); } @@ -1423,7 +1423,7 @@ sal_uLong CompareData::PrevIdx( const SwNode* pNd ) const SwSectionNode* pSNd; if( pNd->StartOfSectionNode()->IsTableNode() || ( nullptr != (pSNd = pNd->StartOfSectionNode()->GetSectionNode() ) && - ( CONTENT_SECTION != pSNd->GetSection().GetType() || + ( SectionType::Content != pSNd->GetSection().GetType() || pSNd->GetSection().IsProtect() ) ) ) pNd = pNd->StartOfSectionNode(); } diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 3a226356bb7b..48d3854d1598 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -409,7 +409,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, default: { const OUString sNm(INetURLObject(sFileName).GetLastName()); - SwSectionData aSectData( FILE_LINK_SECTION, + SwSectionData aSectData( SectionType::FileLink, GetUniqueSectionName( &sNm )); SwSectionFormat* pFormat = MakeSectionFormat(); aSectData.SetLinkFileName(sFileName); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index c5e9aa42cf8c..01fa812c4a1d 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -361,7 +361,7 @@ SwTOXBaseSection* SwDoc::InsertTableOf( const SwPaM& aPam, GetIDocumentUndoRedo().StartUndo( SwUndoId::INSTOX, nullptr ); OUString sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), rTOX.GetTOXName() ); - SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm ); + SwSectionData aSectionData( SectionType::ToxContent, sSectNm ); std::pair<SwTOXBase const*, sw::RedlineMode> const tmp(&rTOX, pLayout && pLayout->IsHideRedlines() @@ -390,7 +390,7 @@ SwTOXBaseSection* SwDoc::InsertTableOf( const SwPaM& aPam, SwTextNode* pHeadNd = GetNodes().MakeTextNode( aIdx, getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ) ); - SwSectionData headerData( TOX_HEADER_SECTION, pNewSection->GetTOXName()+"_Head" ); + SwSectionData headerData( SectionType::ToxHeader, pNewSection->GetTOXName()+"_Head" ); SwNodeIndex aStt( *pHeadNd ); --aIdx; SwSectionFormat* pSectFormat = MakeSectionFormat(); @@ -414,14 +414,14 @@ void SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd, while( pSectNd ) { SectionType eT = pSectNd->GetSection().GetType(); - if( TOX_HEADER_SECTION == eT || TOX_CONTENT_SECTION == eT ) + if( SectionType::ToxHeader == eT || SectionType::ToxContent == eT ) return; pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode(); } const OUString sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), rTOX.GetTOXName()); - SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm ); + SwSectionData aSectionData( SectionType::ToxContent, sSectNm ); SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd ); SwSectionFormat* pFormat = MakeSectionFormat(); @@ -450,7 +450,7 @@ SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) while( pSectNd ) { SectionType eT = pSectNd->GetSection().GetType(); - if( TOX_CONTENT_SECTION == eT ) + if( SectionType::ToxContent == eT ) { OSL_ENSURE( dynamic_cast< const SwTOXBaseSection *>( &pSectNd->GetSection()) != nullptr, "no TOXBaseSection!" ); @@ -589,7 +589,7 @@ bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) pFormat->GetChildSections( aArr, SectionSort::Not, false ); for( const auto pSect : aArr ) { - if( TOX_HEADER_SECTION == pSect->GetType() ) + if( SectionType::ToxHeader == pSect->GetType() ) { DelSectionFormat( pSect->GetFormat(), bDelNodes ); } @@ -660,7 +660,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, continue; const SwSection& rSect = pSectNd->GetSection(); - if (rSect.GetType()==TOX_CONTENT_SECTION) + if (rSect.GetType()==SectionType::ToxContent) { const OUString& rNm = rSect.GetSectionName(); if ( rNm.startsWith(aName) ) @@ -740,7 +740,7 @@ static const SwTextNode* lcl_FindChapterNode( const SwNode& rNd, // Table of contents class SwTOXBaseSection::SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFormat & rFormat) : SwTOXBase( rBase ) - , SwSection( TOX_CONTENT_SECTION, OUString(), rFormat ) + , SwSection( SectionType::ToxContent, OUString(), rFormat ) { SetProtect( rBase.IsProtected() ); SetSectionName( GetTOXName() ); @@ -970,7 +970,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, GetTextFormatColl( FORM_TITLE ) ); pHeadNd->InsertText( GetTitle(), SwIndex( pHeadNd ) ); - SwSectionData headerData( TOX_HEADER_SECTION, GetTOXName()+"_Head" ); + SwSectionData headerData( SectionType::ToxHeader, GetTOXName()+"_Head" ); SwNodeIndex aStt( *pHeadNd ); --aIdx; SwSectionFormat* pSectFormat = pDoc->MakeSectionFormat(); diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 8655874fe858..bcf91b3f1e03 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -772,8 +772,8 @@ void sw_DeleteFootnote( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ) static bool lcl_IsTOXSection(SwSectionData const& rSectionData) { - return (TOX_CONTENT_SECTION == rSectionData.GetType()) - || (TOX_HEADER_SECTION == rSectionData.GetType()); + return (SectionType::ToxContent == rSectionData.GetType()) + || (SectionType::ToxHeader == rSectionData.GetType()); } SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, @@ -983,7 +983,7 @@ SwSectionNode::SwSectionNode(SwNodeIndex const& rIdx, : SwStartNode( rIdx, SwNodeType::Section ) , m_pSection( pTOXBase ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFormat)) - : new SwSection( CONTENT_SECTION, rFormat.GetName(), + : new SwSection( SectionType::Content, rFormat.GetName(), lcl_initParent(*this, rFormat) ) ) { // Set the connection from Format to Node @@ -1198,7 +1198,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c pSectFormat->CopyAttrs( *GetSection().GetFormat() ); std::unique_ptr<SwTOXBase> pTOXBase; - if (TOX_CONTENT_SECTION == GetSection().GetType()) + if (SectionType::ToxContent == GetSection().GetType()) { OSL_ENSURE( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) != nullptr , "no TOXBaseSection!" ); SwTOXBaseSection const& rTBS( @@ -1214,7 +1214,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c // Take over values SwSection *const pNewSect = pSectNd->m_pSection.get(); - if (TOX_CONTENT_SECTION != GetSection().GetType()) + if (SectionType::ToxContent != GetSection().GetType()) { // Keep the Name for Move if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() ) @@ -1337,7 +1337,7 @@ void SwSectionNode::NodesArrChgd() } else { - if (CONTENT_SECTION != m_pSection->GetType() + if (SectionType::Content != m_pSection->GetType() && m_pSection->IsConnected()) { pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() ); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 5ee2c0cda4c1..56b1ee08cab5 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -241,7 +241,7 @@ SwSection::~SwSection() { pFormat->Remove( this ); // remove - if (CONTENT_SECTION != m_Data.GetType()) + if (SectionType::Content != m_Data.GetType()) { pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink.get() ); } @@ -548,11 +548,11 @@ OUString const & SwSection::GetLinkFileName() const OUString sTmp; switch (m_Data.GetType()) { - case DDE_LINK_SECTION: + case SectionType::DdeLink: sTmp = m_RefLink->GetLinkSourceName(); break; - case FILE_LINK_SECTION: + case SectionType::FileLink: { OUString sRange; OUString sFilter; @@ -602,7 +602,7 @@ void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd ) pNd = pNd->StartOfSectionNode(); // If it's a SectionNode const SwSectionNode* pParent; while( nullptr != ( pParent = pNd->FindSectionNode() ) && - ( CONTENT_SECTION == pParent->GetSection().GetType() + ( SectionType::Content == pParent->GetSection().GetType() || pNd == &rSectNd )) pNd = pParent->StartOfSectionNode(); @@ -616,7 +616,7 @@ void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd ) const SwTOXBase* SwSection::GetTOXBase() const { const SwTOXBase* pRet = nullptr; - if( TOX_CONTENT_SECTION == GetType() ) + if( SectionType::ToxContent == GetType() ) pRet = dynamic_cast<const SwTOXBaseSection*>(this); return pRet; } @@ -1013,8 +1013,8 @@ const SwSection* SwSectionFormat::GetGlobalDocSection() const { const SwSectionNode* pNd = GetSectionNode(); if( pNd && - ( FILE_LINK_SECTION == pNd->GetSection().GetType() || - TOX_CONTENT_SECTION == pNd->GetSection().GetType() ) && + ( SectionType::FileLink == pNd->GetSection().GetType() || + SectionType::ToxContent == pNd->GetSection().GetType() ) && pNd->GetIndex() > pNd->GetNodes().GetEndOfExtras().GetIndex() && !pNd->StartOfSectionNode()->IsSectionNode() && !pNd->StartOfSectionNode()->FindSectionNode() ) @@ -1058,7 +1058,7 @@ SwSectionFormat::MakeUnoObject() if (pSection) { xMeta.set( SwXTextSection::CreateXTextSection(this, - TOX_HEADER_SECTION == pSection->GetType()), + SectionType::ToxHeader == pSection->GetType()), uno::UNO_QUERY ); } return xMeta; @@ -1461,7 +1461,7 @@ void SwIntrnlSectRefLink::Closed() pSh->StartAction(); SwSectionData aSectionData(*rSectFormat.GetSection()); - aSectionData.SetType( CONTENT_SECTION ); + aSectionData.SetType( SectionType::Content ); aSectionData.SetLinkFileName( OUString() ); aSectionData.SetProtectFlag( false ); // edit in readonly sections @@ -1490,7 +1490,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) { SwSectionFormat* pFormat = GetFormat(); OSL_ENSURE(pFormat, "SwSection::CreateLink: no format?"); - if (!pFormat || (CONTENT_SECTION == m_Data.GetType())) + if (!pFormat || (SectionType::Content == m_Data.GetType())) return ; SfxLinkUpdateMode nUpdateType = SfxLinkUpdateMode::ALWAYS; @@ -1514,11 +1514,11 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) switch (m_Data.GetType()) { - case DDE_LINK_SECTION: + case SectionType::DdeLink: pLnk->SetLinkSourceName( sCmd ); pFormat->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().InsertDDELink( pLnk ); break; - case FILE_LINK_SECTION: + case SectionType::FileLink: { pLnk->SetContentType( SotClipboardFormatId::SIMPLE_FILE ); sal_Int32 nIndex = 0; @@ -1552,9 +1552,9 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) void SwSection::BreakLink() { const SectionType eCurrentType( GetType() ); - if ( eCurrentType == CONTENT_SECTION || - eCurrentType == TOX_HEADER_SECTION || - eCurrentType == TOX_CONTENT_SECTION ) + if ( eCurrentType == SectionType::Content || + eCurrentType == SectionType::ToxHeader || + eCurrentType == SectionType::ToxContent ) { // nothing to do return; @@ -1572,7 +1572,7 @@ void SwSection::BreakLink() m_RefLink.clear(); } // change type - SetType( CONTENT_SECTION ); + SetType( SectionType::Content ); // reset linked file data SetLinkFileName( OUString() ); SetLinkFilePassword( OUString() ); diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index bbc10e095f80..add383a8c6dd 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -70,9 +70,9 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const std::unique_ptr<SwGlblDocContent> pNew; switch( pSect->GetType() ) { - case TOX_HEADER_SECTION: + case SectionType::ToxHeader: break; // ignore - case TOX_CONTENT_SECTION: + case SectionType::ToxContent: OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( pSect) != nullptr, "no TOXBaseSection!" ); pNew.reset(new SwGlblDocContent( static_cast<const SwTOXBaseSection*>(pSect) )); break; diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index 7c26915befe9..662737d2fe2a 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -123,8 +123,8 @@ bool SwEditShell::IsAnySectionInDoc() const { SectionType eTmpType; if( pFormat->IsInNodesArr() && - ( (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) ) + ( (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) ) { return true; } diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 98ae87d85906..e652551d160b 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -100,7 +100,7 @@ void SwEditShell::SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly) OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOXBase) != nullptr, "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = static_cast<const SwTOXBaseSection&>(rTOXBase); const_cast<SwTOXBase&>(rTOXBase).SetProtected(bReadonly); - OSL_ENSURE( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" ); + OSL_ENSURE( rTOXSect.SwSection::GetType() == SectionType::ToxContent, "not a TOXContentSection" ); SwSectionData aSectionData(rTOXSect); aSectionData.SetProtectFlag(bReadonly); @@ -215,7 +215,7 @@ sal_uInt16 SwEditShell::GetTOXCount() const for( auto n = rFormats.size(); n; ) { const SwSection* pSect = rFormats[ --n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode() ) ++nRet; } @@ -229,7 +229,7 @@ const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const for( const SwSectionFormat *pFormat : rFormats ) { const SwSection* pSect = pFormat->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode() && nCnt++ == nPos ) { diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 13d0fe04afb4..8c3fe341def1 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7272,8 +7272,8 @@ bool SwFrame::GetBackgroundBrush( // option "index shadings" is set and // the output is not the printer // then set <rpCol> to the color of the index shading - if( pSection && ( TOX_HEADER_SECTION == pSection->GetType() || - TOX_CONTENT_SECTION == pSection->GetType() ) && + if( pSection && ( SectionType::ToxHeader == pSection->GetType() || + SectionType::ToxContent == pSection->GetType() ) && (rBack.GetColor() == COL_TRANSPARENT) && rBack.GetGraphicPos() == GPOS_NONE && !pOpt->IsPagePreview() && diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 7c374297b747..135586eb6493 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -493,7 +493,7 @@ bool SwOLENode::IsInGlobalDocSection() const // pAnchorNd contains the most recently found Section Node, which // now must fulfill the prerequisites for the GlobalDoc pSectNd = static_cast<const SwSectionNode*>(pAnchorNd); - return FILE_LINK_SECTION == pSectNd->GetSection().GetType() && + return SectionType::FileLink == pSectNd->GetSection().GetType() && pSectNd->GetIndex() > nEndExtraIdx; } diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index f47ee6c0ec71..5069edccac17 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1011,7 +1011,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() { const SwSection* pSection = static_cast<const SwSectionFrame*>(pFrame)->GetSection(); - if ( TOX_CONTENT_SECTION == pSection->GetType() ) + if ( SectionType::ToxContent == pSection->GetType() ) { const SwTOXBase* pTOXBase = pSection->GetTOXBase(); if ( pTOXBase ) @@ -1028,7 +1028,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } } } - else if ( CONTENT_SECTION == pSection->GetType() ) + else if ( SectionType::Content == pSection->GetType() ) { nPDFType = vcl::PDFWriter::Section; aPDFType = aSectString; @@ -1133,7 +1133,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() const SwSectionFrame* pSctFrame = pFrame->FindSctFrame(); const SwSection* pSection = pSctFrame->GetSection(); - if ( TOX_CONTENT_SECTION == pSection->GetType() ) + if ( SectionType::ToxContent == pSection->GetType() ) { const SwTOXBase* pTOXBase = pSection->GetTOXBase(); if ( pTOXBase && TOX_INDEX != pTOXBase->GetType() ) diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 7e05ae0e9fd7..d3c83a217975 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -501,7 +501,7 @@ void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext) if( bUpdate ) rNdSect.CreateLink( CREATE_UPDATE ); - else if( CONTENT_SECTION == rNdSect.GetType() && rNdSect.IsConnected() ) + else if( SectionType::Content == rNdSect.GetType() && rNdSect.IsConnected() ) { rNdSect.Disconnect(); rDoc.getIDocumentLinksAdministration().GetLinkManager().Remove( &rNdSect.GetBaseLink() ); diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 26cc13a113b9..fbb5373f0235 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -915,7 +915,7 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) SectionSort::Not, false); for(SwSection* pSect : aSectArr) { - if(pSect->GetType() == TOX_HEADER_SECTION) + if(pSect->GetType() == SectionType::ToxHeader) { const uno::Reference <text::XTextSection> xHeader = SwXTextSection::CreateXTextSection( @@ -2361,7 +2361,7 @@ SwXDocumentIndexes::getCount() for( size_t n = 0; n < rFormats.size(); ++n ) { const SwSection* pSect = rFormats[ n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode() ) { ++nRet; @@ -2384,7 +2384,7 @@ SwXDocumentIndexes::getByIndex(sal_Int32 nIndex) for( size_t n = 0; n < rFormats.size(); ++n ) { SwSection* pSect = rFormats[ n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode() && nIdx++ == nIndex ) { @@ -2412,7 +2412,7 @@ SwXDocumentIndexes::getByName(const OUString& rName) for( size_t n = 0; n < rFormats.size(); ++n ) { SwSection* pSect = rFormats[ n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode() && (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName() == rName)) @@ -2441,7 +2441,7 @@ SwXDocumentIndexes::getElementNames() for( size_t n = 0; n < rFormats.size(); ++n ) { SwSection const*const pSect = rFormats[ n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode() ) { ++nCount; @@ -2454,7 +2454,7 @@ SwXDocumentIndexes::getElementNames() for( size_t n = 0; n < rFormats.size(); ++n ) { SwSection const*const pSect = rFormats[ n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode()) { pArray[nCnt++] = static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName(); @@ -2475,7 +2475,7 @@ SwXDocumentIndexes::hasByName(const OUString& rName) for( size_t n = 0; n < rFormats.size(); ++n ) { SwSection const*const pSect = rFormats[ n ]->GetSection(); - if( TOX_CONTENT_SECTION == pSect->GetType() && + if( SectionType::ToxContent == pSect->GetType() && pSect->GetFormat()->GetSectionNode()) { if (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName() diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index f39a038a0dd7..b19ee1462715 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -312,11 +312,11 @@ SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange) { m_pImpl->m_sName = "TextSection"; } - SectionType eType(FILE_LINK_SECTION); + SectionType eType(SectionType::FileLink); if( m_pImpl->m_pProps->m_bDDE ) - eType = DDE_LINK_SECTION; + eType = SectionType::DdeLink; else if( m_pImpl->m_pProps->m_sLinkFileName.isEmpty() && m_pImpl->m_pProps->m_sSectionRegion.isEmpty() ) - eType = CONTENT_SECTION; + eType = SectionType::Content; // index header section? if (m_pImpl->m_bIndexHeader) { @@ -338,12 +338,12 @@ SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange) bool bHeaderPresent = false; for(size_t i = 0; i < nCount; ++i) { - if (aSectionsArr[i]->GetType() == TOX_HEADER_SECTION) + if (aSectionsArr[i]->GetType() == SectionType::ToxHeader) bHeaderPresent = true; } if (! bHeaderPresent) { - eType = TOX_HEADER_SECTION; + eType = SectionType::ToxHeader; } } } @@ -505,7 +505,7 @@ SwXTextSection::getPropertySetInfo() static void lcl_UpdateLinkType(SwSection & rSection, bool const bLinkUpdateAlways) { - if (rSection.GetType() == DDE_LINK_SECTION) + if (rSection.GetType() == SectionType::DdeLink) { // set update type; needs an established link if (!rSection.IsConnected()) @@ -630,10 +630,10 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( else { OUString sLinkFileName(pSectionData->GetLinkFileName()); - if (pSectionData->GetType() != DDE_LINK_SECTION) + if (pSectionData->GetType() != SectionType::DdeLink) { sLinkFileName = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator); - pSectionData->SetType(DDE_LINK_SECTION); + pSectionData->SetType(SectionType::DdeLink); } sLinkFileName = comphelper::string::setToken(sLinkFileName, pEntry->nWID - WID_SECT_DDE_TYPE, @@ -675,10 +675,10 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( } else { - if (pSectionData->GetType() != FILE_LINK_SECTION && + if (pSectionData->GetType() != SectionType::FileLink && !aLink.FileURL.isEmpty()) { - pSectionData->SetType(FILE_LINK_SECTION); + pSectionData->SetType(SectionType::FileLink); } const OUString sTmp(!aLink.FileURL.isEmpty() ? URIHelper::SmartRel2Abs( @@ -692,7 +692,7 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( pSectionData->SetLinkFileName(sFileName); if (sFileName.getLength() < 3) { - pSectionData->SetType(CONTENT_SECTION); + pSectionData->SetType(SectionType::Content); } } } @@ -708,10 +708,10 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( } else { - if (pSectionData->GetType() != FILE_LINK_SECTION && + if (pSectionData->GetType() != SectionType::FileLink && !sLink.isEmpty()) { - pSectionData->SetType(FILE_LINK_SECTION); + pSectionData->SetType(SectionType::FileLink); } OUString sSectLink(pSectionData->GetLinkFileName()); for (sal_Int32 i = comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeparator); @@ -723,7 +723,7 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( pSectionData->SetLinkFileName(sSectLink); if (sSectLink.getLength() < 3) { - pSectionData->SetType(CONTENT_SECTION); + pSectionData->SetType(SectionType::Content); } } } @@ -992,7 +992,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl( sRet = m_pProps->m_sLinkFileName; } } - else if (DDE_LINK_SECTION == pSect->GetType()) + else if (SectionType::DdeLink == pSect->GetType()) { sRet = pSect->GetLinkFileName(); } @@ -1022,7 +1022,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl( aLink.FilterName = m_pProps->m_sSectionFilter; } } - else if (FILE_LINK_SECTION == pSect->GetType()) + else if (SectionType::FileLink == pSect->GetType()) { const OUString& sRet( pSect->GetLinkFileName() ); sal_Int32 nIndex(0); @@ -1041,7 +1041,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl( { sRet = m_pProps->m_sSectionRegion; } - else if (FILE_LINK_SECTION == pSect->GetType()) + else if (SectionType::FileLink == pSect->GetType()) { sRet = pSect->GetLinkFileName().getToken(2, sfx2::cTokenSeparator); @@ -1090,7 +1090,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl( // search enclosing index SwSection* pEnclosingSection = pSect; while ((pEnclosingSection != nullptr) && - (TOX_CONTENT_SECTION != pEnclosingSection->GetType())) + (SectionType::ToxContent != pEnclosingSection->GetType())) { pEnclosingSection = pEnclosingSection->GetParent(); } @@ -1489,7 +1489,7 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName) } else { - pSectionData->SetType(CONTENT_SECTION); + pSectionData->SetType(SectionType::Content); } break; case WID_SECT_DDE_AUTOUPDATE: diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 54bab22c49f4..4370f81bc152 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -307,8 +307,8 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken ) aHRef = aURL; } - SwSectionData aSection( (!aHRef.isEmpty()) ? FILE_LINK_SECTION - : CONTENT_SECTION, aName ); + SwSectionData aSection( (!aHRef.isEmpty()) ? SectionType::FileLink + : SectionType::Content, aName ); if( !aHRef.isEmpty() ) { aSection.SetLinkFileName( aHRef ); @@ -688,7 +688,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) // Make section name unique. OUString aName( m_xDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : nullptr ) ); - SwSectionData aSection( CONTENT_SECTION, aName ); + SwSectionData aSection( SectionType::Content, aName ); SfxItemSet aFrameItemSet( m_xDoc->GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1>{} ); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 76ce6fb781a6..d1e213f5ad71 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -401,7 +401,7 @@ ErrCode SwHTMLWriter::WriteStream() } else { - OSL_ENSURE( FILE_LINK_SECTION != pSNd->GetSection().GetType(), + OSL_ENSURE( SectionType::FileLink != pSNd->GetSection().GetType(), "Export linked areas at document beginning is not implemented" ); // save only the tag of section @@ -552,7 +552,7 @@ static const SwFormatCol *lcl_html_GetFormatCol( const SwSection& rSection, const SwFormatCol *pCol = nullptr; const SfxPoolItem* pItem; - if( FILE_LINK_SECTION != rSection.GetType() && + if( SectionType::FileLink != rSection.GetType() && SfxItemState::SET == rFormat.GetAttrSet().GetItemState(RES_COL,false,&pItem) && static_cast<const SwFormatCol *>(pItem)->GetNumCols() > 1 ) { @@ -616,7 +616,7 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() ); rHTMLWrt.OutDirection( nDir ); - if( FILE_LINK_SECTION == rSection.GetType() ) + if( SectionType::FileLink == rSection.GetType() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_href "=\""); rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() ); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 40121e26721d..d71d16c00fc6 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -562,7 +562,7 @@ void DocxExport::OutputEndNode( const SwEndNode& rEndNode ) // could have some code common with SectionNode()... const SwSection& rSect = rEndNode.StartOfSectionNode()->GetSectionNode()->GetSection(); - if ( m_bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() ) + if ( m_bStartTOX && SectionType::ToxContent == rSect.GetType() ) m_bStartTOX = false; SwNodeIndex aIdx( rEndNode, 1 ); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 13732268af52..83563e42aa0f 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2151,7 +2151,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { // ignore TOX header section const SwSectionNode* pSectNd = rNode.FindSectionNode(); - if ( pSectNd && TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() ) + if ( pSectNd && SectionType::ToxContent == pSectNd->GetSection().GetType() ) { AttrOutput().StartTOX( pSectNd->GetSection() ); m_aCurrentCharPropStarts.push( 0 ); @@ -3117,7 +3117,7 @@ void MSWordExportBase::OutputSectionNode( const SwSectionNode& rSectionNode ) else AttrOutput().SectionBreaks( rSectionNode ); - const bool bInTOX = rSection.GetType() == TOX_CONTENT_SECTION || rSection.GetType() == TOX_HEADER_SECTION; + const bool bInTOX = rSection.GetType() == SectionType::ToxContent || rSection.GetType() == SectionType::ToxHeader; if ( !pSet && !bInTOX ) { // new Section with no own PageDesc/-Break @@ -3133,7 +3133,7 @@ void MSWordExportBase::OutputSectionNode( const SwSectionNode& rSectionNode ) AppendSection( pCurrent, pFormat, nRstLnNum ); } } - if ( TOX_CONTENT_SECTION == rSection.GetType() ) + if ( SectionType::ToxContent == rSection.GetType() ) { m_bStartTOX = true; UpdateTocSectionNodeProperties(rSectionNode); @@ -3149,7 +3149,7 @@ void MSWordExportBase::UpdateTocSectionNodeProperties(const SwSectionNode& rSect // check section type { const SwSection& rSection = rSectionNode.GetSection(); - if (TOX_CONTENT_SECTION != rSection.GetType()) + if (SectionType::ToxContent != rSection.GetType()) return; const SwTOXBase* pTOX = rSection.GetTOXBase(); @@ -3170,7 +3170,7 @@ void MSWordExportBase::UpdateTocSectionNodeProperties(const SwSectionNode& rSect if (rNdNext.IsSectionNode()) { const SwSectionNode* pSectNdNext = static_cast<const SwSectionNode*>(&rNdNext); - if (TOX_HEADER_SECTION == pSectNdNext->GetSection().GetType() && + if (SectionType::ToxHeader == pSectNdNext->GetSection().GetType() && pSectNdNext->StartOfSectionNode()->IsSectionNode()) { pSectNd = pSectNdNext; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 62262700e885..8373b5c2f40d 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1000,26 +1000,26 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport ) } else if (pNd && nullptr != ( pSectNd = pNd->FindSectionNode() )) { - if ( TOX_HEADER_SECTION == pSectNd->GetSection().GetType() && + if ( SectionType::ToxHeader == pSectNd->GetSection().GetType() && pSectNd->StartOfSectionNode()->IsSectionNode() ) { pSectNd = pSectNd->StartOfSectionNode()->GetSectionNode(); } - if ( TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() ) + if ( SectionType::ToxContent == pSectNd->GetSection().GetType() ) { pNd = pSectNd; rExport.m_pCurPam->GetPoint()->nNode = *pNd; } - if ( CONTENT_SECTION == pSectNd->GetSection().GetType() ) + if ( SectionType::Content == pSectNd->GetSection().GetType() ) pFormat = pSectNd->GetSection().GetFormat(); } // tdf#118393: FILESAVE: DOCX Export loses header/footer rExport.m_bFirstTOCNodeWithSection = pSectNd && - ( TOX_HEADER_SECTION == pSectNd->GetSection().GetType() || - TOX_CONTENT_SECTION == pSectNd->GetSection().GetType() ); + ( SectionType::ToxHeader == pSectNd->GetSection().GetType() || + SectionType::ToxContent == pSectNd->GetSection().GetType() ); // Try to get page descriptor of the first node if ( pSet && diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 18698337808b..06d347d30fe8 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2752,7 +2752,7 @@ void MSWordExportBase::WriteText() { const SwSection& rSect = rNd.StartOfSectionNode()->GetSectionNode() ->GetSection(); - if ( m_bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() ) + if ( m_bStartTOX && SectionType::ToxContent == rSect.GetType() ) m_bStartTOX = false; SwNodeIndex aIdx( rNd, 1 ); @@ -2764,7 +2764,7 @@ void MSWordExportBase::WriteText() { //#120140# Do not need to insert a page/section break after a section end. Check this case first bool bNeedExportBreakHere = true; - if ( rSect.GetType() == TOX_CONTENT_SECTION || rSect.GetType() == TOX_HEADER_SECTION ) + if ( rSect.GetType() == SectionType::ToxContent || rSect.GetType() == SectionType::ToxHeader ) bNeedExportBreakHere = false; else if ( aIdx.GetNode().IsTextNode() ) { diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d7d30eb99773..8f4e051d2c5d 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -628,7 +628,7 @@ const SwSectionFormat* MSWordExportBase::GetSectionFormat( const SwNode& rNd ) const SwSectionFormat* pFormat = nullptr; const SwSectionNode* pSect = rNd.FindSectionNode(); if ( pSect && - CONTENT_SECTION == pSect->GetSection().GetType() ) + SectionType::Content == pSect->GetSection().GetType() ) { pFormat = pSect->GetSection().GetFormat(); } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index ea0a435371a3..a7fa401c393b 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2524,7 +2524,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, OUString& rSt */ SwPosition aTmpPos(*m_pPaM->GetPoint()); - SwSectionData aSection(FILE_LINK_SECTION, + SwSectionData aSection(SectionType::FileLink, m_aSectionNameGenerator.UniqueName()); aSection.SetLinkFileName( aPara ); aSection.SetProtectFlag(true); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 912b099ed233..a27b27749c0a 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -702,7 +702,7 @@ void wwSectionManager::SetPageULSpaceItems(SwFrameFormat &rFormat, SwSectionFormat *wwSectionManager::InsertSection( SwPaM const & rMyPaM, wwSection &rSection) { - SwSectionData aSection( CONTENT_SECTION, + SwSectionData aSection( SectionType::Content, mrReader.m_rDoc.GetUniqueSectionName() ); SfxItemSet aSet( mrReader.m_rDoc.GetAttrPool(), aFrameFormatSetRange ); @@ -878,7 +878,7 @@ void wwSectionManager::CreateSep(const long nTextPos) return; OUString sSectionName = mrReader.m_aLinkStringMap[SVBT16ToUInt16( static_cast<WW8_WKB*>(pData)->nLinkId) ]; sSectionName = mrReader.ConvertFFileName(sSectionName); - SwSectionData aSection(FILE_LINK_SECTION, sSectionName); + SwSectionData aSection(SectionType::FileLink, sSectionName); aSection.SetLinkFileName( sSectionName ); aSection.SetProtectFlag(true); // #i19922# - improvement: return value of method <Insert> not used. diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index a95e184de1a1..840cdf7c7904 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -92,8 +92,8 @@ static void lcl_FillList( SwWrtShell& rSh, weld::ComboBox& rSubRegions, weld::Co const SwSectionFormat* pFormat = &rSh.GetSectionFormat(i); if( !pFormat->GetParent() && pFormat->IsInNodesArr() && - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) + (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) { const OUString sString(pFormat->GetSection()->GetSectionName()); if (pAvailNames) @@ -114,8 +114,8 @@ static void lcl_FillList( SwWrtShell& rSh, weld::ComboBox& rSubRegions, weld::Co { const SwSectionFormat* pFormat = pSect->GetFormat(); if( pFormat->IsInNodesArr()&& - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) + (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) { const OUString sString(pFormat->GetSection()->GetSectionName()); if (pAvailNames) @@ -234,11 +234,11 @@ void SectRepr::SetFile( const OUString& rFile ) if( !rFile.isEmpty() || !sSub.isEmpty() ) { - m_SectionData.SetType( FILE_LINK_SECTION ); + m_SectionData.SetType( SectionType::FileLink ); } else { - m_SectionData.SetType( CONTENT_SECTION ); + m_SectionData.SetType( SectionType::Content ); } } @@ -260,7 +260,7 @@ void SectRepr::SetFilter( const OUString& rFilter ) if( !sNewFile.isEmpty() ) { - m_SectionData.SetType( FILE_LINK_SECTION ); + m_SectionData.SetType( SectionType::FileLink ); } } @@ -280,11 +280,11 @@ void SectRepr::SetSubRegion(const OUString& rSubRegion) if( !rSubRegion.isEmpty() || !sOldFileName.isEmpty() ) { - m_SectionData.SetType( FILE_LINK_SECTION ); + m_SectionData.SetType( SectionType::FileLink ); } else { - m_SectionData.SetType( CONTENT_SECTION ); + m_SectionData.SetType( SectionType::Content ); } } @@ -296,7 +296,7 @@ OUString SectRepr::GetFile() const { return sLinkFile; } - if (DDE_LINK_SECTION == m_SectionData.GetType()) + if (SectionType::DdeLink == m_SectionData.GetType()) { sal_Int32 n = 0; return sLinkFile.replaceFirst( OUStringChar(sfx2::cTokenSeparator), " ", &n ) @@ -460,8 +460,8 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, const weld::Tr SectionType eTmpType; if( !( pFormat = &rSh.GetSectionFormat(n))->GetParent() && pFormat->IsInNodesArr() && - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) + (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) { SwSection *pSect = pFormat->GetSection(); SectRepr* pSectRepr = new SectRepr( n, *pSect ); @@ -492,8 +492,8 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, const weld::Tr SectionType eTmpType; pFormat = pSect->GetFormat(); if( pFormat->IsInNodesArr() && - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) + (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) { SectRepr* pSectRepr=new SectRepr( FindArrPos( pSect->GetFormat() ), *pSect ); @@ -608,7 +608,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void) // edit in readonly sections bEditInReadonly = rData.IsEditInReadonlyFlag(); - bFile = (rData.GetType() != CONTENT_SECTION); + bFile = (rData.GetType() != SectionType::Content); aCurPasswd = rData.GetPassword(); } else @@ -622,7 +622,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void) (bEditInReadonly == rData.IsEditInReadonlyFlag()); bFileValid = (bFile == - (rData.GetType() != CONTENT_SECTION)); + (rData.GetType() != SectionType::Content)); bPasswdValid = (aCurPasswd == rData.GetPassword()); } bFirst = false; @@ -695,7 +695,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void) m_xFileCB->set_active(true); m_xFileNameED->set_text(aFile); m_xSubRegionED->set_entry_text(sSub); - m_xDDECB->set_active(rData.GetType() == DDE_LINK_SECTION); + m_xDDECB->set_active(rData.GetType() == SectionType::DdeLink); } else { @@ -1140,7 +1140,7 @@ IMPL_LINK(SwEditRegionDlg, FileNameEntryHdl, weld::Entry&, rEdit, void) } pSectRepr->GetSectionData().SetLinkFileName( sLink ); - pSectRepr->GetSectionData().SetType( DDE_LINK_SECTION ); + pSectRepr->GetSectionData().SetType( SectionType::DdeLink ); } else { @@ -1176,13 +1176,13 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::ToggleButton&, rButton, void) m_xDDECommandFT->show(); m_xSubRegionFT->hide(); m_xSubRegionED->hide(); - if (FILE_LINK_SECTION == rData.GetType()) + if (SectionType::FileLink == rData.GetType()) { pSectRepr->SetFile(OUString()); m_xFileNameED->set_text(OUString()); rData.SetLinkFilePassword(OUString()); } - rData.SetType(DDE_LINK_SECTION); + rData.SetType(SectionType::DdeLink); } else { @@ -1194,9 +1194,9 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::ToggleButton&, rButton, void) m_xSubRegionED->set_sensitive(bFile); m_xSubRegionFT->set_sensitive(bFile); m_xSubRegionED->set_sensitive(bFile); - if (DDE_LINK_SECTION == rData.GetType()) + if (SectionType::DdeLink == rData.GetType()) { - rData.SetType(FILE_LINK_SECTION); + rData.SetType(SectionType::FileLink); pSectRepr->SetFile(OUString()); rData.SetLinkFilePassword(OUString()); m_xFileNameED->set_text(OUString()); @@ -1554,7 +1554,7 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) bool SwInsertSectionTabPage::FillItemSet( SfxItemSet* ) { - SwSectionData aSection(CONTENT_SECTION, m_xCurName->get_active_text()); + SwSectionData aSection(SectionType::Content, m_xCurName->get_active_text()); aSection.SetCondition(m_xConditionED->get_text()); bool bProtected = m_xProtectCB->get_active(); aSection.SetProtectFlag(bProtected); @@ -1603,8 +1603,8 @@ bool SwInsertSectionTabPage::FillItemSet( SfxItemSet* ) if (!aLinkFile.isEmpty()) { aSection.SetType( m_xDDECB->get_active() ? - DDE_LINK_SECTION : - FILE_LINK_SECTION); + SectionType::DdeLink : + SectionType::FileLink); } } static_cast<SwInsertSectionTabDialog*>(GetDialogController())->SetSectionData(aSection); diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index a72d7a591cba..d8bae1facda4 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -331,13 +331,13 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) else pSh->SetMark(); // set only the mark - SwSectionData aSect(CONTENT_SECTION, MASTER_LABEL); + SwSectionData aSect(SectionType::Content, MASTER_LABEL); pSh->InsertSection(aSect); } } else if (rItem.m_bSynchron) { - SwSectionData aSect(FILE_LINK_SECTION, + SwSectionData aSect(SectionType::FileLink, pSh->GetUniqueSectionName()); OUString sLinkName = OUStringChar(sfx2::cTokenSeparator) + diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 32eaa13fb153..c3b4ef6e7297 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -843,9 +843,9 @@ static void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell ) for (size_t nSection = 0; nSection < nSections; ++nSection) { SwSectionData aSectionData( *rWorkShell.GetSectionFormat( nSection ).GetSection() ); - if( aSectionData.GetType() == FILE_LINK_SECTION ) + if( aSectionData.GetType() == SectionType::FileLink ) { - aSectionData.SetType( CONTENT_SECTION ); + aSectionData.SetType( SectionType::Content ); aSectionData.SetLinkFileName( OUString() ); rWorkShell.UpdateSection( nSection, aSectionData ); } diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx index 2aa3c5a93b22..32d9e6e5f3c1 100644 --- a/sw/source/uibase/dialog/regionsw.cxx +++ b/sw/source/uibase/dialog/regionsw.cxx @@ -101,7 +101,7 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) else aTmpStr = rSh.GetUniqueSectionName(); - SwSectionData aSection(CONTENT_SECTION, aTmpStr); + SwSectionData aSection(SectionType::Content, aTmpStr); rReq.SetReturnValue(SfxStringItem(FN_INSERT_REGION, aTmpStr)); aSet.Put( *pSet ); @@ -165,7 +165,7 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) } sLinkFileName += aSub; - aSection.SetType( FILE_LINK_SECTION ); + aSection.SetType( SectionType::FileLink ); aSection.SetLinkFileName(sLinkFileName); } rSh.InsertSection(aSection, aSet.Count() ? &aSet : nullptr); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index ffdbd98b4538..bb140e9742af 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2562,7 +2562,7 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, if( rWrtShell.HasSelection() ) rWrtShell.DelRight(); - SwSectionData aSect( DDE_LINK_SECTION, aName ); + SwSectionData aSect( SectionType::DdeLink, aName ); aSect.SetLinkFileName( aCmd ); aSect.SetProtectFlag(true); rWrtShell.InsertSection( aSect ); @@ -2974,7 +2974,7 @@ bool SwTransferable::PasteFileName( TransferableDataHelper& rData, { // and then pull up the insert-region-dialog SwSectionData aSect( - FILE_LINK_SECTION, + SectionType::FileLink, rSh.GetDoc()->GetUniqueSectionName() ); aSect.SetLinkFileName( sFileURL ); aSect.SetProtectFlag( true ); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index e65149b15995..e346600c0549 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1437,8 +1437,8 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) case FN_EDIT_CURRENT_REGION: //tdf#112808 if cursor is in an index, don't show the edit section. if( !rSh.GetCurrSection() || - (rSh.GetCurrSection()->GetType() != CONTENT_SECTION && - rSh.GetCurrSection()->GetType() != FILE_LINK_SECTION )) + (rSh.GetCurrSection()->GetType() != SectionType::Content && + rSh.GetCurrSection()->GetType() != SectionType::FileLink )) { rSet.DisableItem(nWhich); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 117d90931dd9..54b96e4b5e36 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1586,8 +1586,8 @@ void SwView::StateStatusLine(SfxItemSet &rSet) { switch( pCurrSect->GetType() ) { - case TOX_HEADER_SECTION: - case TOX_CONTENT_SECTION: + case SectionType::ToxHeader: + case SectionType::ToxContent: { const SwTOXBase* pTOX = m_pWrtShell->GetCurTOX(); if( pTOX ) diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 95091161e3fd..eaaf40f8963a 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -366,8 +366,8 @@ void SwContentType::Init(bool* pbInvalidateWindow) const SwSectionFormat* pFormat; SectionType eTmpType; if( (pFormat = &m_pWrtShell->GetSectionFormat(i))->IsInNodesArr() && - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) + (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) { const OUString& rSectionName = pFormat->GetSection()->GetSectionName(); @@ -671,8 +671,8 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) const SwSectionFormat* pFormat; SectionType eTmpType; if( (pFormat = &m_pWrtShell->GetSectionFormat(i))->IsInNodesArr() && - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) + (eTmpType = pFormat->GetSection()->GetType()) != SectionType::ToxContent + && SectionType::ToxHeader != eTmpType ) { OUString sSectionName = pFormat->GetSection()->GetSectionName(); diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 788d999f21f6..507725e2b24e 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -1339,12 +1339,12 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen if ( nAddNumber ) sSectionName = sTempSectionName; - SwSectionData aSectionData(CONTENT_SECTION, sSectionName); + SwSectionData aSectionData(SectionType::Content, sSectionName); aSectionData.SetProtectFlag(true); aSectionData.SetHidden(false); aSectionData.SetLinkFileName(sFileName); - aSectionData.SetType(FILE_LINK_SECTION); + aSectionData.SetType(SectionType::FileLink); aSectionData.SetLinkFilePassword( OUString() ); rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData ); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index a3e4d08b3e03..92169d03d0eb 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -586,7 +586,7 @@ void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk, } else { - SwSectionData aSection( FILE_LINK_SECTION, GetUniqueSectionName() ); + SwSectionData aSection( SectionType::FileLink, GetUniqueSectionName() ); OUString aLinkFile = rBkmk.GetURL().getToken(0, '#') + OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator) @@ -598,7 +598,7 @@ void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk, { aSection = SwSectionData(*pIns); aSection.SetLinkFileName( OUString() ); - aSection.SetType( CONTENT_SECTION ); + aSection.SetType( SectionType::Content ); aSection.SetProtectFlag( false ); // the update of content from linked section at time delete |