diff options
Diffstat (limited to 'sw')
30 files changed, 114 insertions, 124 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index d58121da8acb..ac1f881cbcfd 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -42,28 +42,37 @@ class SwFmtFld; namespace utl { class TransliterationWrapper; } namespace svt { class EmbeddedObjectRef; } +enum class SwMoveFlags +{ + DEFAULT = 0x00, + ALLFLYS = 0x01, + CREATEUNDOOBJ = 0x02, + REDLINES = 0x04, + NO_DELFRMS = 0x08 +}; +namespace o3tl +{ + template<> struct typed_flags<SwMoveFlags> : is_typed_flags<SwMoveFlags, 0x0f> {}; +} + +// constants for inserting text +enum class SwInsertFlags +{ + DEFAULT = 0x00, // no extras + EMPTYEXPAND = 0x01, // expand empty hints at insert position + NOHINTEXPAND = 0x02, // do not expand any hints at insert pos + FORCEHINTEXPAND = 0x04 // expand all hints at insert position +}; +namespace o3tl +{ + template<> struct typed_flags<SwInsertFlags> : is_typed_flags<SwInsertFlags, 0x07> {}; +} + /** Text operation/manipulation interface */ class IDocumentContentOperations { public: - enum SwMoveFlags - { - DOC_MOVEDEFAULT = 0x00, - DOC_MOVEALLFLYS = 0x01, - DOC_CREATEUNDOOBJ = 0x02, - DOC_MOVEREDLINES = 0x04, - DOC_NO_DELFRMS = 0x08 - }; - - // constants for inserting text - enum InsertFlags - { INS_DEFAULT = 0x00 // no extras - , INS_EMPTYEXPAND = 0x01 // expand empty hints at insert position - , INS_NOHINTEXPAND = 0x02 // do not expand any hints at insert pos - , INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position - }; - public: /** Copy a selected content range to a position @@ -129,7 +138,7 @@ public: /** Insert string into existing text node at position rRg.Point(). */ virtual bool InsertString(const SwPaM &rRg, const OUString&, - const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) = 0; + const enum SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) = 0; /** change text to Upper/Lower/Hiragana/Katagana/... */ diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 3e8d5cac01bb..e5bf4b81a87c 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -246,16 +246,15 @@ public: /// of the node, the longest prefix that fits is inserted /// @return the prefix of rStr that was actually inserted OUString InsertText( const OUString & rStr, const SwIndex & rIdx, - const enum IDocumentContentOperations::InsertFlags nMode - = IDocumentContentOperations::INS_DEFAULT ); + const enum SwInsertFlags nMode + = SwInsertFlags::DEFAULT ); /** delete text content ATTENTION: must not be called with a range that overlaps the start of an attribute with both extent and dummy char */ void EraseText ( const SwIndex &rIdx, const sal_Int32 nCount = SAL_MAX_INT32, - const enum IDocumentContentOperations::InsertFlags nMode - = IDocumentContentOperations::INS_DEFAULT ); + const enum SwInsertFlags nMode = SwInsertFlags::DEFAULT ); /** delete all attributes. If neither pSet nor nWhich is given, delete all attributes (except diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index f1a4793c626d..6bdc043be340 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1093,14 +1093,13 @@ void SwDocTest::randomTest() } break; case 4: { // movement - IDocumentContentOperations::SwMoveFlags nFlags = - (IDocumentContentOperations::SwMoveFlags) - (getRand(1) ? // FIXME: puterb this more ? - IDocumentContentOperations::DOC_MOVEDEFAULT : - IDocumentContentOperations::DOC_MOVEALLFLYS | - IDocumentContentOperations::DOC_CREATEUNDOOBJ | - IDocumentContentOperations::DOC_MOVEREDLINES | - IDocumentContentOperations::DOC_NO_DELFRMS); + SwMoveFlags nFlags = + getRand(1) // FIXME: puterb this more ? + ? SwMoveFlags::DEFAULT + : SwMoveFlags::ALLFLYS | + SwMoveFlags::CREATEUNDOOBJ | + SwMoveFlags::REDLINES | + SwMoveFlags::NO_DELFRMS; SwPosition aTo(getRandomPosition(m_pDoc, i/10)); m_pDoc->getIDocumentContentOperations().MoveRange(aCrs, aTo, nFlags); break; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 94a2e77cf501..d1920463f198 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1669,7 +1669,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode ); pNode->MakeStartIndex( &aPam.GetPoint()->nContent ); // move to desired position - pDoc->getIDocumentContentOperations().MoveRange( aPam, rPos, DOC_MOVEDEFAULT ); + pDoc->getIDocumentContentOperations().MoveRange( aPam, rPos, SwMoveFlags::DEFAULT ); pNode = aPam.GetCntntNode(); *aPam.GetPoint() = rPos; // Move the cursor for Undo @@ -1900,11 +1900,11 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, // Save the paragraph anchored Flys, so that they can be moved. _SaveFlyArr aSaveFlyArr; - _SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, 0 != ( DOC_MOVEALLFLYS & eMvFlags ) ); + _SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, bool( SwMoveFlags::ALLFLYS & eMvFlags ) ); // save redlines (if DOC_MOVEREDLINES is used) _SaveRedlines aSaveRedl; - if( DOC_MOVEREDLINES & eMvFlags && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ) + if( SwMoveFlags::REDLINES & eMvFlags && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ) { lcl_SaveRedlines( rPaM, aSaveRedl ); @@ -1929,7 +1929,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, { m_rDoc.GetIDocumentUndoRedo().ClearRedo(); pUndoMove = new SwUndoMove( rPaM, rPos ); - pUndoMove->SetMoveRedlines( eMvFlags == DOC_MOVEREDLINES ); + pUndoMove->SetMoveRedlines( eMvFlags == SwMoveFlags::REDLINES ); } else { @@ -2143,7 +2143,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod SwFtnIdxs aTmpFntIdx; SwUndoMove* pUndo = 0; - if ((DOC_CREATEUNDOOBJ & eMvFlags ) && m_rDoc.GetIDocumentUndoRedo().DoesUndo()) + if ((SwMoveFlags::CREATEUNDOOBJ & eMvFlags ) && m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { pUndo = new SwUndoMove( &m_rDoc, rRange, rPos ); } @@ -2155,7 +2155,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod _SaveRedlines aSaveRedl; std::vector<SwRangeRedline*> aSavRedlInsPosArr; - if( DOC_MOVEREDLINES & eMvFlags && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ) + if( SwMoveFlags::REDLINES & eMvFlags && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ) { lcl_SaveRedlines( rRange, aSaveRedl ); @@ -2196,7 +2196,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod pSaveInsPos = new SwNodeIndex( rRange.aStart, -1 ); // move the Nodes - bool bNoDelFrms = 0 != (DOC_NO_DELFRMS & eMvFlags); + bool bNoDelFrms = bool(SwMoveFlags::NO_DELFRMS & eMvFlags); if( m_rDoc.GetNodes()._MoveNodes( rRange, m_rDoc.GetNodes(), rPos, !bNoDelFrms ) ) { ++aIdx; // again back to old position @@ -2351,7 +2351,7 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri // start behind the characters (to fix the attributes!) if (nStart < pNode->GetTxt().getLength()) ++rIdx; - pNode->InsertText( OUString(c), rIdx, INS_EMPTYEXPAND ); + pNode->InsertText( OUString(c), rIdx, SwInsertFlags::EMPTYEXPAND ); if( nStart+1 < rIdx.GetIndex() ) { rIdx = nStart; @@ -2393,7 +2393,7 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri } bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUString &rStr, - const enum InsertFlags nInsertMode ) + const SwInsertFlags nInsertMode ) { // fetching DoesUndo is surprisingly expensive bool bDoesUndo = m_rDoc.GetIDocumentUndoRedo().DoesUndo(); @@ -2432,7 +2432,7 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS SwUndoInsert * pUndo = NULL; // don't group the start if hints at the start should be expanded - if (!(nInsertMode & IDocumentContentOperations::INS_FORCEHINTEXPAND)) + if (!(nInsertMode & SwInsertFlags::FORCEHINTEXPAND)) { SwUndo *const pLastUndo = m_rDoc.GetUndoManager().GetLastUndo(); SwUndoInsert *const pUndoInsert( diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 4071f9684b10..a5ab069038ed 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -404,7 +404,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, GetNodes().MakeTxtNode( aRg.aStart, (SwTxtFmtColl*)GetDfltTxtFmtColl() ); - getIDocumentContentOperations().MoveNodeRange( aRg, aPos.nNode, IDocumentContentOperations::DOC_MOVEDEFAULT ); + getIDocumentContentOperations().MoveNodeRange( aRg, aPos.nNode, SwMoveFlags::DEFAULT ); } else { diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 8f6c0d91baf8..4e7812a7cdd2 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1999,7 +1999,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1; } - getIDocumentContentOperations().MoveNodeRange( aMvRg, aIdx, IDocumentContentOperations::DOC_MOVEREDLINES ); + getIDocumentContentOperations().MoveNodeRange( aMvRg, aIdx, SwMoveFlags::REDLINES ); if( pUndo ) { diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 4c49adf91943..0f3d4aa20a3d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1159,13 +1159,13 @@ void SwRangeRedline::MoveToSection() SwNodeIndex aNdIdx( *pTxtNd ); SwPosition aPos( aNdIdx, SwIndex( pTxtNd )); if( pCSttNd && pCEndNd ) - pDoc->getIDocumentContentOperations().MoveAndJoin( aPam, aPos, IDocumentContentOperations::DOC_MOVEDEFAULT ); + pDoc->getIDocumentContentOperations().MoveAndJoin( aPam, aPos, SwMoveFlags::DEFAULT ); else { if( pCSttNd && !pCEndNd ) bDelLastPara = true; pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); } } else @@ -1175,7 +1175,7 @@ void SwRangeRedline::MoveToSection() SwPosition aPos( *pSttNd->EndOfSectionNode() ); pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); } pCntntSect = new SwNodeIndex( *pSttNd ); @@ -1426,7 +1426,7 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) else { pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, - IDocumentContentOperations::DOC_MOVEALLFLYS ); + SwMoveFlags::ALLFLYS ); } SetMark(); diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 01cc39d880b4..73dfa7704519 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -406,7 +406,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) // Move Nodes getIDocumentContentOperations().MoveNodeRange( aRg, aStart, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); // Insert Move in Undo if(pUndoSort) @@ -733,7 +733,7 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, // Insert the Source SwNodeIndex aIns( *pTar->GetSttNd()->EndOfSectionNode() ); pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aIns, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); // If first Node is empty -> delete it if(bDelFirst) diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 3f3d3573c3c0..d0e08947b516 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1797,10 +1797,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, aNumStr += SvxNumberType( rDescs[i-1]->GetNumType() ).GetNumStr( nBeg+nCount ); } } - pNd->InsertText( aNumStr, aPos, - static_cast<IDocumentContentOperations::InsertFlags>( - IDocumentContentOperations::INS_EMPTYEXPAND | - IDocumentContentOperations::INS_FORCEHINTEXPAND) ); + pNd->InsertText( aNumStr, aPos, SwInsertFlags::EMPTYEXPAND | SwInsertFlags::FORCEHINTEXPAND ); if(pPageNoCharFmt) { SwFmtCharFmt aCharFmt( pPageNoCharFmt ); diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index ce348ef58442..13fe599ba3f7 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -186,7 +186,7 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData ) } pTNd->InsertText( rNewStr, aIdx, - IDocumentContentOperations::INS_EMPTYEXPAND ); + SwInsertFlags::EMPTYEXPAND ); if( !HasMark() ) SetMark(); } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 4ec9266a3459..8f188524ccd9 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1515,7 +1515,7 @@ static void lcl_DelBox( SwTableBox* pBox, _DelTabPara* pDelPara ) SwIndex aCntIdx( pDelPara->pLastNd, pDelPara->pLastNd->GetTxt().getLength()); pDelPara->pLastNd->InsertText( OUString(pDelPara->cCh), aCntIdx, - IDocumentContentOperations::INS_EMPTYEXPAND ); + SwInsertFlags::EMPTYEXPAND ); if( pDelPara->pUndo ) pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex(), aCntIdx.GetIndex() ); diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 3ddb6f687f14..cb31d27169d7 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -335,9 +335,7 @@ bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr , aInsPos = pMyDoc->GetNodes().GetEndOfContent(); bool bRet = pMyDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aInsPos, - static_cast<IDocumentContentOperations::SwMoveFlags>( - IDocumentContentOperations::DOC_MOVEALLFLYS - | IDocumentContentOperations::DOC_CREATEUNDOOBJ )); + SwMoveFlags::ALLFLYS | SwMoveFlags::CREATEUNDOOBJ ); EndAllAction(); return bRet; diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 96110ba9829d..39d6d81e2d27 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -87,12 +87,10 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) { StartAllAction(); { - const enum IDocumentContentOperations::InsertFlags nInsertFlags = + const enum SwInsertFlags nInsertFlags = (bForceExpandHints) - ? static_cast<IDocumentContentOperations::InsertFlags>( - IDocumentContentOperations::INS_FORCEHINTEXPAND | - IDocumentContentOperations::INS_EMPTYEXPAND) - : IDocumentContentOperations::INS_EMPTYEXPAND; + ? (SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) + : SwInsertFlags::EMPTYEXPAND; for(SwPaM& rCurrentCrsr : getShellCrsr( true )->GetRingContainer()) { diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 27f90459ddb2..22851d577b11 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1357,7 +1357,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, else { pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, rInsPosNd, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); } // where is now aInsPos ?? diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index 5adeaa9f5297..c60f47bf5afc 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -61,7 +61,7 @@ public: bool Overwrite(const SwPaM &rRg, const OUString& rStr) SAL_OVERRIDE; bool InsertString(const SwPaM &rRg, const OUString&, - const enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) SAL_OVERRIDE; + const enum SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) SAL_OVERRIDE; void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) SAL_OVERRIDE; diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx index 1add17e1abfc..3c6eb85fb547 100644 --- a/sw/source/core/inc/UndoInsert.hxx +++ b/sw/source/core/inc/UndoInsert.hxx @@ -44,7 +44,7 @@ class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt bool bIsAppend : 1; bool m_bWithRsid : 1; - const IDocumentContentOperations::InsertFlags m_nInsertFlags; + const SwInsertFlags m_nInsertFlags; friend class ::sw::DocumentContentOperationsManager; // actually only DocumentContentOperationsManager::InsertString, because it uses CanGrouping bool CanGrouping( sal_Unicode cIns ); @@ -57,7 +57,7 @@ class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt public: SwUndoInsert( const SwNodeIndex& rNode, sal_Int32 nCntnt, sal_Int32 nLen, - const IDocumentContentOperations::InsertFlags nInsertFlags, + const SwInsertFlags nInsertFlags, bool bWDelim = true ); SwUndoInsert( const SwNodeIndex& rNode ); virtual ~SwUndoInsert(); diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index a184f98eecb1..8a10f5d62f1a 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -906,7 +906,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, else { pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, rInsPosNd, - IDocumentContentOperations::DOC_NO_DELFRMS ); + SwMoveFlags::NO_DELFRMS ); } } } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index d74817ae8b24..e4d61da0ca3e 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2054,10 +2054,8 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rTxt, const Color* pCol, pDoc->getIDocumentRedlineAccess().DeleteRedline(aTemp, true, USHRT_MAX); } - pTNd->EraseText( aIdx, n, - IDocumentContentOperations::INS_EMPTYEXPAND ); - pTNd->InsertText( rTxt, aIdx, - IDocumentContentOperations::INS_EMPTYEXPAND ); + pTNd->EraseText( aIdx, n, SwInsertFlags::EMPTYEXPAND ); + pTNd->InsertText( rTxt, aIdx, SwInsertFlags::EMPTYEXPAND ); if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) { @@ -2101,10 +2099,8 @@ void ChgNumToText( SwTableBox& rBox, sal_uLong nFmt ) // Reset DontExpand-Flags before exchange, to retrigger expansion pTNd->DontExpandFmt( aIdx, false, false ); aIdx = 0; - pTNd->EraseText( aIdx, SAL_MAX_INT32, - IDocumentContentOperations::INS_EMPTYEXPAND ); - pTNd->InsertText( sTmp, aIdx, - IDocumentContentOperations::INS_EMPTYEXPAND ); + pTNd->EraseText( aIdx, SAL_MAX_INT32, SwInsertFlags::EMPTYEXPAND ); + pTNd->InsertText( sTmp, aIdx, SwInsertFlags::EMPTYEXPAND ); } } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 0fbd0a573f08..00614b582d89 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1698,7 +1698,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, // ueber die InsertMethode den Text einfuegen und nicht // selbst direkt pDest->InsertText( m_Text.copy(nTxtStartIdx, nLen), rDestStart, - IDocumentContentOperations::INS_EMPTYEXPAND ); + SwInsertFlags::EMPTYEXPAND ); // um reale Groesse Updaten ! nLen = pDest->m_Text.getLength() - oldLen; @@ -1903,7 +1903,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, } OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, - const IDocumentContentOperations::InsertFlags nMode ) + const SwInsertFlags nMode ) { assert(rIdx <= m_Text.getLength()); // invalid index @@ -1924,14 +1924,14 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, assert(nLen != 0); bool bOldExpFlg = IsIgnoreDontExpand(); - if (nMode & IDocumentContentOperations::INS_FORCEHINTEXPAND) + if (nMode & SwInsertFlags::FORCEHINTEXPAND) { SetIgnoreDontExpand( true ); } Update( rIdx, nLen ); // text content changed! - if (nMode & IDocumentContentOperations::INS_FORCEHINTEXPAND) + if (nMode & SwInsertFlags::FORCEHINTEXPAND) { SetIgnoreDontExpand( bOldExpFlg ); } @@ -1953,8 +1953,8 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, if( rIdx == *pEndIdx ) { - if ( (nMode & IDocumentContentOperations::INS_NOHINTEXPAND) || - (!(nMode & IDocumentContentOperations::INS_FORCEHINTEXPAND) + if ( (nMode & SwInsertFlags::NOHINTEXPAND) || + (!(nMode & SwInsertFlags::FORCEHINTEXPAND) && pHt->DontExpand()) ) { // bei leeren Attributen auch Start veraendern @@ -1973,7 +1973,7 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, InsertHint( pHt, SetAttrMode::NOHINTADJUST ); } // empty hints at insert position? - else if ( (nMode & IDocumentContentOperations::INS_EMPTYEXPAND) + else if ( (nMode & SwInsertFlags::EMPTYEXPAND) && (*pEndIdx == pHt->GetStart()) ) { pHt->GetStart() = pHt->GetStart() - nLen; @@ -1991,7 +1991,7 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, continue; } } - if ( !(nMode & IDocumentContentOperations::INS_NOHINTEXPAND) && + if ( !(nMode & SwInsertFlags::NOHINTEXPAND) && rIdx == nLen && pHt->GetStart() == rIdx.GetIndex() && !pHt->IsDontExpandStartAttr() ) { @@ -2388,7 +2388,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, } void SwTxtNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount, - const IDocumentContentOperations::InsertFlags nMode ) + const SwInsertFlags nMode ) { assert(rIdx <= m_Text.getLength()); // invalid index @@ -2447,7 +2447,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount, // char deletes the hint if ( (*pHtEndIdx < nEndIdx) || ( (*pHtEndIdx == nEndIdx) && - !(IDocumentContentOperations::INS_EMPTYEXPAND & nMode) && + !(SwInsertFlags::EMPTYEXPAND & nMode) && ( (RES_TXTATR_TOXMARK == nWhich) || (RES_TXTATR_REFMARK == nWhich) || (RES_TXTATR_CJK_RUBY == nWhich) || @@ -3289,7 +3289,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, aItem, aDestIdx.GetIndex(), aDestIdx.GetIndex() ); - OUString const ins( rDestNd.InsertText(sExpand, aDestIdx, IDocumentContentOperations::INS_EMPTYEXPAND)); + OUString const ins( rDestNd.InsertText(sExpand, aDestIdx, SwInsertFlags::EMPTYEXPAND)); SAL_INFO_IF(ins.getLength() != sExpand.getLength(), "sw.core", "GetExpandTxt lossage"); aDestIdx = nInsPos + nAttrStartIdx; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 4ece3d2d4016..90dad083c583 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1259,12 +1259,10 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) "EndIdx out of bounds!" ); // translate from SetAttrMode to InsertMode (for hints with CH_TXTATR) - const enum IDocumentContentOperations::InsertFlags nInsertFlags = + const enum SwInsertFlags nInsertFlags = (nMode & SetAttrMode::FORCEHINTEXPAND) - ? static_cast<IDocumentContentOperations::InsertFlags>( - IDocumentContentOperations::INS_FORCEHINTEXPAND | - IDocumentContentOperations::INS_EMPTYEXPAND) - : IDocumentContentOperations::INS_EMPTYEXPAND; + ? (SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) + : SwInsertFlags::EMPTYEXPAND; // need this after TryInsertHint, when pAttr may be deleted const sal_Int32 nStart( pAttr->GetStart() ); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 24771474b310..15fe59b90af4 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -803,7 +803,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( pTxtNd ) { OUString const ins( pTxtNd->InsertText(*pEndStr, aPos.nContent, - IDocumentContentOperations::INS_NOHINTEXPAND) ); + SwInsertFlags::NOHINTEXPAND) ); assert(ins.getLength() == pEndStr->getLength()); // must succeed (void) ins; // METADATA: restore @@ -898,7 +898,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) // -> in StartNode is still the rest of the Join => delete aPos.nContent.Assign( pTxtNd, nSttCntnt ); OUString const ins( pTxtNd->InsertText(*pSttStr, aPos.nContent, - IDocumentContentOperations::INS_NOHINTEXPAND) ); + SwInsertFlags::NOHINTEXPAND) ); assert(ins.getLength() == pSttStr->getLength()); // must succeed (void) ins; // METADATA: restore diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index 1a68e2a78624..8889225dda5c 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -108,7 +108,7 @@ void SwUndoInsert::Init(const SwNodeIndex & rNd) // #111827# SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, sal_Int32 nCnt, sal_Int32 nL, - const IDocumentContentOperations::InsertFlags nInsertFlags, + const SwInsertFlags nInsertFlags, bool bWDelim ) : SwUndo(UNDO_TYPING), pTxt( 0 ), pRedlData( 0 ), nNode( rNd.GetIndex() ), nCntnt(nCnt), nLen(nL), @@ -125,7 +125,7 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd ) pRedlData( 0 ), nNode( rNd.GetIndex() ), nCntnt(0), nLen(1), bIsWordDelim( false ), bIsAppend( true ) , m_bWithRsid(false) - , m_nInsertFlags(IDocumentContentOperations::INS_EMPTYEXPAND) + , m_nInsertFlags(SwInsertFlags::EMPTYEXPAND) { Init(rNd); } diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 898c97de3b4a..9ab2aaa6dd7b 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -199,7 +199,7 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext) aRg.aEnd = nDestEndNode; aIdx = nInsPosNode; bool bSuccess = pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aIdx, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); if (!bSuccess) break; } @@ -225,8 +225,8 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext) // first delete all attributes at InsertPos const bool bSuccess = pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, (bMoveRedlines) - ? IDocumentContentOperations::DOC_MOVEREDLINES - : IDocumentContentOperations::DOC_MOVEDEFAULT ); + ? SwMoveFlags::REDLINES + : SwMoveFlags::DEFAULT ); if (!bSuccess) break; @@ -289,8 +289,8 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext) // only a move with SwRange SwNodeRange aRg( rNds, nSttNode, rNds, nEndNode ); rDoc.getIDocumentContentOperations().MoveNodeRange( aRg, aIdx, (bMoveRedlines) - ? IDocumentContentOperations::DOC_MOVEREDLINES - : IDocumentContentOperations::DOC_MOVEDEFAULT ); + ? SwMoveFlags::REDLINES + : SwMoveFlags::DEFAULT ); } else { @@ -307,7 +307,7 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext) aIdx--; rDoc.getIDocumentContentOperations().MoveRange( aPam, aMvPos, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); if( nSttNode != nEndNode && bJoinTxt ) { diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index abc29667f548..a851f45fb58e 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -78,7 +78,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos, pTxtNd->SetIgnoreDontExpand( true ); pTxtNd->InsertText( OUString(cIns), rPos.nContent, - IDocumentContentOperations::INS_EMPTYEXPAND ); + SwInsertFlags::EMPTYEXPAND ); aInsStr += OUString( cIns ); if( !bInsChar ) @@ -155,7 +155,7 @@ bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos, pDelTxtNd->SetIgnoreDontExpand( true ); OUString const ins( pDelTxtNd->InsertText(OUString(cIns), rPos.nContent, - IDocumentContentOperations::INS_EMPTYEXPAND) ); + SwInsertFlags::EMPTYEXPAND) ); assert(ins.getLength() == 1); // check in SwDoc::Overwrite => cannot fail (void) ins; aInsStr += OUString( cIns ); @@ -282,7 +282,7 @@ void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext) // do it individually, to keep the attributes! OUString const ins( pTxtNd->InsertText( OUString(aInsStr[n]), rIdx, - IDocumentContentOperations::INS_EMPTYEXPAND) ); + SwInsertFlags::EMPTYEXPAND) ); assert(ins.getLength() == 1); // cannot fail (void) ins; if( n < aDelStr.getLength() ) diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx index b317a126d9d0..c771744bab2a 100644 --- a/sw/source/core/undo/unsort.cxx +++ b/sw/source/core/undo/unsort.cxx @@ -140,7 +140,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext) SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode + i ); SwNodeRange aRg( *aIdxList[i], 0, *aIdxList[i], 1 ); rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx, - IDocumentContentOperations::DOC_MOVEDEFAULT); + SwMoveFlags::DEFAULT); } // delete indices for(SwUndoSortList::const_iterator it = aIdxList.begin(); it != aIdxList.end(); ++it) @@ -215,7 +215,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext) SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode + i); SwNodeRange aRg( *aIdxList[i], 0, *aIdxList[i], 1 ); rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx, - IDocumentContentOperations::DOC_MOVEDEFAULT); + SwMoveFlags::DEFAULT); } // delete indices for(SwUndoSortList::const_iterator it = aIdxList.begin(); it != aIdxList.end(); ++it) diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index ea7466319a2d..990418e5db05 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -2094,9 +2094,9 @@ void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& r SwNodeIndex aTmp( rRg.aStart, -1 ), aTmp2( rPos, -1 ); SwUndoMove* pUndo = new SwUndoMove( pDoc, rRg, rPos ); ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); - pDoc->getIDocumentContentOperations().MoveNodeRange( rRg, rPos, (pSaveTbl->IsNewModel()) ? - IDocumentContentOperations::DOC_NO_DELFRMS : - IDocumentContentOperations::DOC_MOVEDEFAULT ); + pDoc->getIDocumentContentOperations().MoveNodeRange( rRg, rPos, pSaveTbl->IsNewModel() ? + SwMoveFlags::NO_DELFRMS : + SwMoveFlags::DEFAULT ); ++aTmp; ++aTmp2; pUndo->SetDestRange( aTmp2, rPos, aTmp ); @@ -2249,7 +2249,7 @@ void SwUndoTblNumFmt::UndoImpl(::sw::UndoRedoContext & rContext) { pTxtNd->EraseText( aIdx ); pTxtNd->InsertText( aStr, aIdx, - IDocumentContentOperations::INS_NOHINTEXPAND ); + SwInsertFlags::NOHINTEXPAND ); } } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 6f6538384443..3ecac1c0d75e 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1105,12 +1105,10 @@ bool DocInsertStringSplitCR( { bool bOK = true; - const enum IDocumentContentOperations::InsertFlags nInsertFlags = - (bForceExpandHints) - ? static_cast<IDocumentContentOperations::InsertFlags>( - IDocumentContentOperations::INS_FORCEHINTEXPAND | - IDocumentContentOperations::INS_EMPTYEXPAND) - : IDocumentContentOperations::INS_EMPTYEXPAND; + const enum SwInsertFlags nInsertFlags = + bForceExpandHints + ? ( SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) + : SwInsertFlags::EMPTYEXPAND; // grouping done in InsertString is intended for typing, not API calls ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index a095d9cdfe94..25eb61f2b6fe 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -408,12 +408,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) } const bool bForceExpandHints(CheckForOwnMemberMeta(aPam, bAbsorb)); - const enum IDocumentContentOperations::InsertFlags nInsertFlags = - (bForceExpandHints) - ? static_cast<IDocumentContentOperations::InsertFlags>( - IDocumentContentOperations::INS_FORCEHINTEXPAND | - IDocumentContentOperations::INS_EMPTYEXPAND) - : IDocumentContentOperations::INS_EMPTYEXPAND; + const enum SwInsertFlags nInsertFlags = + bForceExpandHints + ? ( SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) + : SwInsertFlags::EMPTYEXPAND; SwPaM aTmp(*aPam.Start()); if (bAbsorb && aPam.HasMark()) diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 56a63344b5b8..24ff36d57e6e 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -5350,7 +5350,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 ); pDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx, - IDocumentContentOperations::DOC_MOVEDEFAULT ); + SwMoveFlags::DEFAULT ); // Wenn die Caption vor der Tabelle eingefuegt wurde muss // eine an der Tabelle gestzte Seitenvorlage noch in den diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 5aba71dc0015..555413ab983b 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1052,7 +1052,7 @@ void SwWW8ImplReader::InsertTagField( const sal_uInt16 nId, const OUString& rTag { aName += rTagText; // als Txt taggen rDoc.getIDocumentContentOperations().InsertString(*pPaM, aName, - IDocumentContentOperations::INS_NOHINTEXPAND); + SwInsertFlags::NOHINTEXPAND); } else { // normal tagggen |