basctl/source/basicide/baside2.cxx | 10 basctl/source/basicide/basides1.cxx | 2 basic/source/classes/image.cxx | 10 basic/source/classes/sbxmod.cxx | 2 basic/source/comp/codegen.cxx | 6 basic/source/inc/image.hxx | 25 - basic/source/inc/runtime.hxx | 3 basic/source/runtime/methods.cxx | 8 basic/source/runtime/runtime.cxx | 12 connectivity/source/drivers/macab/MacabHeader.cxx | 8 connectivity/source/drivers/postgresql/pq_databasemetadata.cxx | 11 editeng/source/editeng/impedit4.cxx | 8 editeng/source/outliner/outleeng.cxx | 4 editeng/source/outliner/outliner.cxx | 20 editeng/source/outliner/outlundo.cxx | 4 editeng/source/outliner/outlundo.hxx | 8 editeng/source/outliner/outlvw.cxx | 12 editeng/source/outliner/paralist.cxx | 4 filter/source/msfilter/escherex.cxx | 18 include/editeng/outliner.hxx | 33 - include/svl/srchitem.hxx | 35 - include/tools/inetmsg.hxx | 106 ++-- include/tools/resmgr.hxx | 23 - include/vcl/graphicfilter.hxx | 68 +- sc/qa/unit/ucalc.cxx | 2 sc/source/core/data/documen3.cxx | 12 sc/source/core/data/global.cxx | 4 sc/source/core/data/table6.cxx | 52 +- sc/source/filter/excel/xihelper.cxx | 2 sc/source/ui/undo/undoblk3.cxx | 6 sc/source/ui/unoobj/cellsuno.cxx | 6 sc/source/ui/view/tabvwshe.cxx | 8 sc/source/ui/view/viewfun2.cxx | 26 - sd/source/ui/app/sdmod.cxx | 2 sd/source/ui/app/sdmod2.cxx | 2 sd/source/ui/func/fuinsfil.cxx | 8 sd/source/ui/func/fuprobjs.cxx | 4 sd/source/ui/view/Outliner.cxx | 16 sd/source/ui/view/drtxtob.cxx | 8 sd/source/ui/view/outlnvsh.cxx | 12 sd/source/ui/view/outlview.cxx | 40 - starmath/source/mathtype.cxx | 10 svl/source/items/srchitem.cxx | 22 svtools/source/graphic/descriptor.cxx | 54 +- svx/source/dialog/srchdlg.cxx | 18 svx/source/tbxctrls/tbunosearchcontrollers.cxx | 2 sw/inc/doc.hxx | 4 sw/inc/fesh.hxx | 6 sw/inc/flyenum.hxx | 19 sw/source/core/doc/docfly.cxx | 26 - sw/source/core/frmedt/fefly1.cxx | 4 sw/source/core/frmedt/feshview.cxx | 14 sw/source/uibase/docvw/edtwin.cxx | 8 sw/source/uibase/uiview/srcview.cxx | 8 sw/source/uibase/uiview/viewsrch.cxx | 26 - tools/source/inet/inetmsg.cxx | 228 +++++----- tools/source/rc/resmgr.cxx | 38 - vcl/generic/glyphs/gcach_ftyp.cxx | 10 vcl/source/filter/graphicfilter2.cxx | 111 ++-- vcl/source/filter/jpeg/JpegReader.cxx | 2 60 files changed, 650 insertions(+), 610 deletions(-)
New commits: commit 4a87597e424dea17ac60f17af937961440295757 Author: Noel Grandin <[email protected]> Date: Mon Mar 2 08:58:14 2015 +0200 remove unused struct Change-Id: Icabf74fde82e917826f20ffdc8fcd71a26538bbe diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index 8d7695e..d334dca1 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -2214,17 +2214,6 @@ static sal_Int32 getMaxScale( sal_Int32 dataType ) } -struct RawType -{ - const char * typeName; - const char * createParam; - sal_Int32 sdbcType; - sal_Int32 precision; - sal_Int32 nullable; - bool caseSensitive; - sal_Int32 searchable; -}; - static void pgTypeInfo2ResultSet( SequenceAnyVector &vec, const Reference< XResultSet > &rs ) commit 08a9452b677bc68f56fbac3638cfaeff9f90b1eb Author: Noel Grandin <[email protected]> Date: Mon Mar 2 08:06:45 2015 +0200 -Werror,-Wsign-compare Change-Id: I18e4249d574f0d48e2c2027a89a37125d09e6702 diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 16f123f..fd09cf4 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -1211,17 +1211,19 @@ bool ServerFont::GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) unsigned char* pDest = rRawBitmap.mpBits.get(); if( !bEmbedded ) { - for( int y = rRawBitmap.mnHeight, x; --y >= 0 ; ) + unsigned int x; + for( int y = rRawBitmap.mnHeight; --y >= 0 ; ) { for( x = 0; x < rBitmapFT.width; ++x ) *(pDest++) = *(pSrc++); - for(; x < int(rRawBitmap.mnScanlineSize); ++x ) + for(; x < rRawBitmap.mnScanlineSize; ++x ) *(pDest++) = 0; } } else { - for( int y = rRawBitmap.mnHeight, x; --y >= 0 ; ) + unsigned int x; + for( int y = rRawBitmap.mnHeight; --y >= 0 ; ) { unsigned char nSrc = 0; for( x = 0; x < rBitmapFT.width; ++x, nSrc+=nSrc ) @@ -1230,7 +1232,7 @@ bool ServerFont::GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) nSrc = *(pSrc++); *(pDest++) = (0x7F - nSrc) >> 8; } - for(; x < int(rRawBitmap.mnScanlineSize); ++x ) + for(; x < rRawBitmap.mnScanlineSize; ++x ) *(pDest++) = 0; } } commit d8bb694c831d37cb4344e3352fe08e2919a7cdc1 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 11:49:51 2015 +0200 convert PARAFLAG_ constants to enum class Change-Id: I71f5ea8e91fe0f50a471e33e4e2c02840a76b707 diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index 5525754..3b1c160 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -94,9 +94,9 @@ void OutlinerEditEng::ParagraphConnected( sal_Int32 /*nLeftParagraph*/, sal_Int3 if( pOwner && pOwner->IsUndoEnabled() && !const_cast<EditEngine&>(pOwner->GetEditEngine()).IsInUndo() ) { Paragraph* pPara = pOwner->GetParagraph( nRightParagraph ); - if( pPara && pOwner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + if( pPara && pOwner->HasParaFlag( pPara, ParaFlag::ISPAGE ) ) { - pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nRightParagraph, PARAFLAG_ISPAGE, 0 ) ); + pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nRightParagraph, ParaFlag::ISPAGE, ParaFlag::NONE ) ); } } } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index ba1a901..fe6e6ca 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -92,7 +92,7 @@ Paragraph* Outliner::Insert(const OUString& rText, sal_Int32 nAbsPos, sal_Int16 pHdlParagraph = pPara; DepthChangedHdl(); } - pPara->nFlags |= PARAFLAG_HOLDDEPTH; + pPara->nFlags |= ParaFlag::HOLDDEPTH; SetText( rText, pPara ); } else @@ -107,7 +107,7 @@ Paragraph* Outliner::Insert(const OUString& rText, sal_Int32 nAbsPos, sal_Int16 ImplInitDepth( nAbsPos, nDepth, false ); pHdlParagraph = pPara; ParagraphInsertedHdl(); - pPara->nFlags |= PARAFLAG_HOLDDEPTH; + pPara->nFlags |= ParaFlag::HOLDDEPTH; SetText( rText, pPara ); ImplBlockInsertionCallbacks( false ); pEditEngine->SetUpdateMode( bUpdate ); @@ -130,7 +130,7 @@ void Outliner::ParagraphInserted( sal_Int32 nPara ) pParaList->Insert( pPara, nPara ); if( pEditEngine->IsInUndo() ) { - pPara->nFlags = PARAFLAG_SETBULLETTEXT; + pPara->nFlags = ParaFlag::SETBULLETTEXT; pPara->bVisible = true; const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ) ); pPara->SetDepth( rLevel.GetValue() ); @@ -464,12 +464,12 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) aStr = aStr.copy(nTabs); // Keep depth? (see Outliner::Insert) - if( !(pPara->nFlags & PARAFLAG_HOLDDEPTH) ) + if( !(pPara->nFlags & ParaFlag::HOLDDEPTH) ) { nCurDepth = nTabs-1; ImplCheckDepth( nCurDepth ); pPara->SetDepth( nCurDepth ); - pPara->nFlags &= (~PARAFLAG_HOLDDEPTH); + pPara->nFlags &= (~ParaFlag::HOLDDEPTH); } } if( nPos ) // not with the first paragraph @@ -700,7 +700,7 @@ void Outliner::SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle ) if (pPara) { pEditEngine->SetStyleSheet( nPara, pStyle ); - pPara->nFlags |= PARAFLAG_SETBULLETTEXT; + pPara->nFlags |= ParaFlag::SETBULLETTEXT; ImplCheckNumBulletItem( nPara ); } } @@ -1934,7 +1934,7 @@ void Outliner::ImplCalcBulletText( sal_Int32 nPara, bool bRecalcLevel, bool bRec if (!pPara->GetText().equals(aBulletText)) pPara->SetText( aBulletText ); - pPara->nFlags &= (~PARAFLAG_SETBULLETTEXT); + pPara->nFlags &= (~ParaFlag::SETBULLETTEXT); if ( bRecalcLevel ) { @@ -1995,7 +1995,7 @@ OUString Outliner::ImplGetBulletText( sal_Int32 nPara ) if (pPara) { // Enable optimization again ... -// if( pPara->nFlags & PARAFLAG_SETBULLETTEXT ) +// if( pPara->nFlags & ParaFlag::SETBULLETTEXT ) ImplCalcBulletText( nPara, false, false ); aRes = pPara->GetText(); } @@ -2068,7 +2068,7 @@ void Outliner::SetEndPasteOrDropHdl( const Link& rLink ) maEndPasteOrDropHdl = rLink; } -void Outliner::SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag ) +void Outliner::SetParaFlag( Paragraph* pPara, ParaFlag nFlag ) { if( pPara && !pPara->HasFlag( nFlag ) ) { @@ -2079,7 +2079,7 @@ void Outliner::SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag ) } } -bool Outliner::HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const +bool Outliner::HasParaFlag( const Paragraph* pPara, ParaFlag nFlag ) const { return pPara && pPara->HasFlag( nFlag ); } diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx index 1803dd0..e07cae2 100644 --- a/editeng/source/outliner/outlundo.cxx +++ b/editeng/source/outliner/outlundo.cxx @@ -37,7 +37,7 @@ OutlinerUndoBase::OutlinerUndoBase( sal_uInt16 _nId, Outliner* pOutliner ) mpOutliner = pOutliner; } -OutlinerUndoChangeParaFlags::OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_Int32 nPara, sal_uInt16 nOldFlags, sal_uInt16 nNewFlags ) +OutlinerUndoChangeParaFlags::OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_Int32 nPara, ParaFlag nOldFlags, ParaFlag nNewFlags ) : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner ) { mnPara = nPara; @@ -55,7 +55,7 @@ void OutlinerUndoChangeParaFlags::Redo() ImplChangeFlags( mnNewFlags ); } -void OutlinerUndoChangeParaFlags::ImplChangeFlags( sal_uInt16 nFlags ) +void OutlinerUndoChangeParaFlags::ImplChangeFlags( ParaFlag nFlags ) { Outliner* pOutliner = GetOutliner(); Paragraph* pPara = pOutliner->GetParagraph( mnPara ); diff --git a/editeng/source/outliner/outlundo.hxx b/editeng/source/outliner/outlundo.hxx index e3b1af5..77b689f 100644 --- a/editeng/source/outliner/outlundo.hxx +++ b/editeng/source/outliner/outlundo.hxx @@ -39,13 +39,13 @@ class OutlinerUndoChangeParaFlags : public OutlinerUndoBase { private: sal_Int32 mnPara; - sal_uInt16 mnOldFlags; - sal_uInt16 mnNewFlags; + ParaFlag mnOldFlags; + ParaFlag mnNewFlags; - void ImplChangeFlags( sal_uInt16 nFlags ); + void ImplChangeFlags( ParaFlag nFlags ); public: - OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_Int32 nPara, sal_uInt16 nOldDepth, sal_uInt16 nNewDepth ); + OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_Int32 nPara, ParaFlag nOldFlags, ParaFlag nNewFlags ); virtual void Undo() SAL_OVERRIDE; virtual void Redo() SAL_OVERRIDE; diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index e545e9f..9e61056 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -128,7 +128,7 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window* pFrameWin ) if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) ) { Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 ); - if( pNext && pNext->HasFlag(PARAFLAG_ISPAGE) ) + if( pNext && pNext->HasFlag(ParaFlag::ISPAGE) ) { if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) ) return false; @@ -338,7 +338,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) ESelection aSel( pEditView->GetSelection() ); nPara = aSel.nStartPara; Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - if( (pPara && pOwner->pParaList->HasChildren(pPara)) && pPara->HasFlag(PARAFLAG_ISPAGE) ) + if( (pPara && pOwner->pParaList->HasChildren(pPara)) && pPara->HasFlag(ParaFlag::ISPAGE) ) { ImpToggleExpand( pPara ); } @@ -469,7 +469,7 @@ void OutlinerView::Indent( short nDiff ) if( bOutlinerView && nPara ) { - const bool bPage = pPara->HasFlag(PARAFLAG_ISPAGE); + const bool bPage = pPara->HasFlag(ParaFlag::ISPAGE); if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) ) { // Notify App @@ -478,9 +478,9 @@ void OutlinerView::Indent( short nDiff ) pOwner->pHdlParagraph = pPara; if( bPage ) - pPara->RemoveFlag( PARAFLAG_ISPAGE ); + pPara->RemoveFlag( ParaFlag::ISPAGE ); else - pPara->SetFlag( PARAFLAG_ISPAGE ); + pPara->SetFlag( ParaFlag::ISPAGE ); pOwner->DepthChangedHdl(); pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); @@ -806,7 +806,7 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "ImpCalcSelectedPages: invalid Selection? "); - if( pPara->HasFlag(PARAFLAG_ISPAGE) ) + if( pPara->HasFlag(ParaFlag::ISPAGE) ) { nPages++; if( nFirstPage == EE_PARA_MAX_COUNT ) diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx index e9e6407..d4a9e13f 100644 --- a/editeng/source/outliner/paralist.cxx +++ b/editeng/source/outliner/paralist.cxx @@ -62,12 +62,12 @@ Paragraph::Paragraph( sal_Int16 nDDepth ) DBG_ASSERT( ( nDDepth >= -1 ) && ( nDDepth < SVX_MAX_NUM ), "Paragraph-CTOR: nDepth invalid!" ); nDepth = nDDepth; - nFlags = 0; + nFlags = ParaFlag::NONE; bVisible = true; } Paragraph::Paragraph( const ParagraphData& rData ) -: nFlags( 0 ) +: nFlags( ParaFlag::NONE ) , aBulSize( -1, -1) , bVisible( true ) { diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index d63d884..ce25da0 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -79,6 +79,7 @@ namespace svl #include <editeng/svxfont.hxx> #include <editeng/eedata.hxx> #include <editeng/paragraphdata.hxx> +#include <o3tl/typed_flags_set.hxx> class SvxFieldData; @@ -95,9 +96,17 @@ typedef std::vector<SpellPortion> SpellPortions; namespace basegfx { class B2DPolyPolygon; } // internal use only! -#define PARAFLAG_HOLDDEPTH 0x4000 -#define PARAFLAG_SETBULLETTEXT 0x8000 -#define PARAFLAG_ISPAGE 0x0100 +enum class ParaFlag +{ + NONE = 0x0000, + HOLDDEPTH = 0x4000, + SETBULLETTEXT = 0x8000, + ISPAGE = 0x0100, +}; +namespace o3tl +{ + template<> struct typed_flags<ParaFlag> : is_typed_flags<ParaFlag, 0xc100> {}; +} // Undo-Action-Ids #define OLUNDO_DEPTH EDITUNDO_USER @@ -122,8 +131,8 @@ private: Paragraph& operator=(const Paragraph& rPara ) SAL_DELETED_FUNCTION; - sal_uInt16 nFlags; - OUString aBulText; + ParaFlag nFlags; + OUString aBulText; Size aBulSize; bool bVisible; @@ -146,9 +155,9 @@ private: bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; } void SetParaIsNumberingRestart( bool bParaIsNumberingRestart ); - void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; } - void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; } - bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; } + void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; } + void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; } + bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); } }; struct ParaRange @@ -591,7 +600,7 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster Link maEndPasteOrDropHdl; sal_Int32 nDepthChangedHdlPrevDepth; - sal_uInt16 mnDepthChangeHdlPrevFlags; + ParaFlag mnDepthChangeHdlPrevFlags; sal_Int16 nMaxDepth; const sal_Int16 nMinDepth; sal_Int32 nFirstPage; @@ -762,7 +771,7 @@ public: void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;} Link GetDepthChangedHdl() const { return aDepthChangedHdl; } sal_Int16 GetPrevDepth() const { return static_cast<sal_Int16>(nDepthChangedHdlPrevDepth); } - sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; } + ParaFlag GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; } long RemovingPagesHdl( OutlinerView* ); void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;} @@ -874,8 +883,8 @@ public: bool Expand( Paragraph* ); bool Collapse( Paragraph* ); - void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag ); - bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const; + void SetParaFlag( Paragraph* pPara, ParaFlag nFlag ); + bool HasParaFlag( const Paragraph* pPara, ParaFlag nFlag ) const; // Returns an array containing the widths of the Bullet Indentations // Last value must be -1. Is deleted by the outliner. diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 4613aae..d308ee8 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -100,7 +100,7 @@ static SdPage* GetCurrentPage( sd::ViewShell* pViewSh, EditFieldInfo* pInfo, boo for( Paragraph* pPara = rOutl.GetParagraph( 0 ); pPara && nPos >= 0; pPara = rOutl.GetParagraph( ++nParaPos ), nPos-- ) { - if( rOutl.HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + if( rOutl.HasParaFlag( pPara, ParaFlag::ISPAGE ) ) nPgNum++; } diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index f0b172f..e368465 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -557,7 +557,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin()); // what should we insert? - while (pPara && !rDocliner.HasParaFlag(pPara, PARAFLAG_ISPAGE)) + while (pPara && !rDocliner.HasParaFlag(pPara, ParaFlag::ISPAGE)) pPara = rDocliner.GetParent(pPara); sal_Int32 nTargetPos = rDocliner.GetAbsPos(pPara) + 1; @@ -568,7 +568,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) while (pPara) { sal_Int32 nPos = rDocliner.GetAbsPos( pPara ); - if ( rDocliner.HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + if ( rDocliner.HasParaFlag( pPara, ParaFlag::ISPAGE ) ) nPage++; pPara = rDocliner.GetParagraph( nPos - 1 ); } @@ -612,7 +612,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) while (pPara) { sal_Int32 nPos = pOutliner->GetAbsPos( pPara ); - if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + if( pOutliner->HasParaFlag( pPara, ParaFlag::ISPAGE ) ) nNewPages++; pPara = pOutliner->GetParagraph( ++nPos ); } @@ -649,7 +649,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) rDocliner.SetStyleSheet( nTargetPos, pOutlStyle ); } - if( rDocliner.HasParaFlag( pSourcePara, PARAFLAG_ISPAGE ) ) + if( rDocliner.HasParaFlag( pSourcePara, ParaFlag::ISPAGE ) ) { nNewPages++; if( pProgress ) diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx index 3885d21..60cdc25 100644 --- a/sd/source/ui/func/fuprobjs.cxx +++ b/sd/source/ui/func/fuprobjs.cxx @@ -89,7 +89,7 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) Paragraph* pPara = aSelList.empty() ? NULL : *iter; nDepth = pOutl->GetDepth(pOutl->GetAbsPos( pPara ) ); - bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ); + bool bPage = pOutl->HasParaFlag( pPara, ParaFlag::ISPAGE ); while( iter != aSelList.end() ) { @@ -103,7 +103,7 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) break; } - if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) != bPage ) + if( pOutl->HasParaFlag( pPara, ParaFlag::ISPAGE ) != bPage ) { bUnique = false; break; diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index a58efdc..dec6968 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -286,7 +286,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { // allow move up if position is 2 or greater OR it // is a title object (and thus depth==1) - if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) ) + if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,ParaFlag::ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) ) { // not at top bDisableUp = false; @@ -308,14 +308,14 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) sal_Int16 nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) ); - if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) ) + if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, ParaFlag::ISPAGE )) ) { // not minimum depth bDisableLeft = false; } if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) || - (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) ) + (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, ParaFlag::ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) ) { // not maximum depth and not at top bDisableRight = false; @@ -336,7 +336,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) && pPara && 0 == pOutl->GetAbsPos(pPara) && pOutl->GetParagraphCount() > 1 - && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) ) + && !pOutl->HasParaFlag( pOutl->GetParagraph(1), ParaFlag::ISPAGE ) ) { // Needs to be disabled bDisableDown = true; diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 1dbcd7b..98217eb 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -815,7 +815,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) sal_Int16 nDepth; sal_Int16 nTmpDepth = rOutl.GetDepth( rOutl.GetAbsPos( pPara ) ); - bool bPage = rOutl.HasParaFlag( pPara, PARAFLAG_ISPAGE ); + bool bPage = rOutl.HasParaFlag( pPara, ParaFlag::ISPAGE ); while (iter != aSelList.begin()) { @@ -823,7 +823,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) nDepth = rOutl.GetDepth( rOutl.GetAbsPos( pPara ) ); - if( nDepth != nTmpDepth || bPage != rOutl.HasParaFlag( pPara, PARAFLAG_ISPAGE )) + if( nDepth != nTmpDepth || bPage != rOutl.HasParaFlag( pPara, ParaFlag::ISPAGE )) bUnique = false; if (rOutl.HasChildren(pPara)) @@ -1332,10 +1332,10 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) pLastPara = *(aSelList.rbegin()); } - if( !rOutliner.HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) ) + if( !rOutliner.HasParaFlag(pFirstPara,ParaFlag::ISPAGE) ) pFirstPara = pOlView->GetPrevTitle( pFirstPara ); - if( !rOutliner.HasParaFlag(pLastPara, PARAFLAG_ISPAGE) ) + if( !rOutliner.HasParaFlag(pLastPara, ParaFlag::ISPAGE) ) pLastPara = pOlView->GetPrevTitle( pLastPara ); // only one page selected? @@ -1698,7 +1698,7 @@ bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara ) sal_Int32 nPara = nTitlePara + 1; sal_Int32 nParasInLayout = 0L; pPara = rOutliner.GetParagraph( nPara ); - while( pPara && !rOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) ) + while( pPara && !rOutliner.HasParaFlag(pPara, ParaFlag::ISPAGE) ) { nParasInLayout++; pPara = rOutliner.GetParagraph( ++nPara ); @@ -1807,7 +1807,7 @@ sal_uLong OutlineViewShell::Read(SvStream& rInput, const OUString& rBaseURL, sal { Paragraph* pPara = rOutl.GetParagraph( nPara ); rOutl.SetDepth(pPara, -1); - rOutl.SetParaFlag(pPara, PARAFLAG_ISPAGE); + rOutl.SetParaFlag(pPara, ParaFlag::ISPAGE); rOutl.SetStyleSheet( nPara, pTitleSheet ); diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 05b79257..a8bfe47 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -335,7 +335,7 @@ Paragraph* OutlineView::GetPrevTitle(const Paragraph* pPara) while(nPos) { pPara = mrOutliner.GetParagraph(--nPos); - if( mrOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) ) + if( mrOutliner.HasParaFlag(pPara, ParaFlag::ISPAGE) ) { return const_cast< Paragraph* >( pPara ); } @@ -357,7 +357,7 @@ Paragraph* OutlineView::GetNextTitle(const Paragraph* pPara) do { pResult = mrOutliner.GetParagraph(++nPos); - if( pResult && mrOutliner.HasParaFlag(pResult, PARAFLAG_ISPAGE) ) + if( pResult && mrOutliner.HasParaFlag(pResult, ParaFlag::ISPAGE) ) return pResult; } while( pResult ); @@ -382,7 +382,7 @@ IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner ) UpdateParagraph( nAbsPos ); - if( (nAbsPos == 0) || mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) || mrOutliner.HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), PARAFLAG_ISPAGE) ) + if( (nAbsPos == 0) || mrOutliner.HasParaFlag(pPara,ParaFlag::ISPAGE) || mrOutliner.HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), ParaFlag::ISPAGE) ) { InsertSlideForParagraph( pPara ); InvalidateSlideNumberArea(); @@ -399,7 +399,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) OutlineViewPageChangesGuard aGuard(this); - mrOutliner.SetParaFlag( pPara, PARAFLAG_ISPAGE ); + mrOutliner.SetParaFlag( pPara, ParaFlag::ISPAGE ); // how many titles are there before the new title paragraph? sal_uLong nExample = 0L; // position of the "example" page sal_uLong nTarget = 0L; // position of insertion @@ -516,7 +516,7 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner ) OutlineViewPageChangesGuard aGuard(this); Paragraph* pPara = pOutliner->GetHdlParagraph(); - if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + if( pOutliner->HasParaFlag( pPara, ParaFlag::ISPAGE ) ) { // how many titles are in front of the title paragraph in question? sal_uLong nPos = 0L; @@ -577,7 +577,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) OutlineViewPageChangesGuard aGuard(this); Paragraph* pPara = pOutliner->GetHdlParagraph(); - if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) == 0) ) + if( pOutliner->HasParaFlag( pPara, ParaFlag::ISPAGE ) && ((pOutliner->GetPrevFlags() & ParaFlag::ISPAGE) == ParaFlag::NONE) ) { // the current paragraph is transformed into a slide @@ -598,7 +598,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) { pParagraph = *iter; - if( !pOutliner->HasParaFlag( pParagraph, PARAFLAG_ISPAGE ) && + if( !pOutliner->HasParaFlag( pParagraph, ParaFlag::ISPAGE ) && (pOutliner->GetDepth( pOutliner->GetAbsPos( pParagraph ) ) <= 0) ) mnPagesToProcess++; } @@ -647,7 +647,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) } pOutliner->UpdateFields(); } - else if( !pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) != 0) ) + else if( !pOutliner->HasParaFlag( pPara, ParaFlag::ISPAGE ) && ((pOutliner->GetPrevFlags() & ParaFlag::ISPAGE) != ParaFlag::NONE) ) { // the paragraph was a page but now becomes a normal paragraph @@ -742,7 +742,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) sal_Int16 nDepth = pOutliner->GetDepth( nPara ); bool bSubTitle = pPage->GetPresObj(PRESOBJ_TEXT) != NULL; - if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) + if( pOutliner->HasParaFlag(pPara, ParaFlag::ISPAGE) ) { pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ); } @@ -842,7 +842,7 @@ IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner ) for (std::vector<Paragraph*>::iterator it = maSelectedParas.begin(); it != maSelectedParas.end();) { - if (!pOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE)) + if (!pOutliner->HasParaFlag(*it, ParaFlag::ISPAGE)) it = maSelectedParas.erase(it); else ++it; @@ -856,7 +856,7 @@ IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner ) while(pPara) { - if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page? + if( pOutliner->HasParaFlag(pPara, ParaFlag::ISPAGE) ) // one page? { maOldParaOrder.push_back(pPara); SdPage* pPage = mrDoc.GetSdPage(nPos, PK_STANDARD); @@ -892,7 +892,7 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) Paragraph* pPrev = NULL; while (pPara && pPara != pSearchIt) { - if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) + if( pOutliner->HasParaFlag(pPara, ParaFlag::ISPAGE) ) { nPosNewOrder++; pPrev = pPara; @@ -1132,7 +1132,7 @@ void OutlineView::FillOutliner() mrOutliner.SetStyleSheet( mrOutliner.GetAbsPos( pPara ), pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ) ); } - mrOutliner.SetParaFlag( pPara, PARAFLAG_ISPAGE ); + mrOutliner.SetParaFlag( pPara, ParaFlag::ISPAGE ); sal_Int32 nPara = mrOutliner.GetAbsPos( pPara ); @@ -1254,7 +1254,7 @@ SdPage* OutlineView::GetActualPage() SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara ) { - if( !mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) ) + if( !mrOutliner.HasParaFlag(pPara,ParaFlag::ISPAGE) ) pPara = GetPrevTitle(pPara); sal_uInt32 nPageToSelect = 0; @@ -1282,7 +1282,7 @@ Paragraph* OutlineView::GetParagraphForPage( ::Outliner& rOutl, SdPage* pPage ) while( pPara ) { // if this paragraph is a page ... - if( mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) ) + if( mrOutliner.HasParaFlag(pPara,ParaFlag::ISPAGE) ) { // see if we already skipped enough pages if( 0 == nPagesToSkip ) @@ -1333,7 +1333,7 @@ void OutlineView::SetSelectedPages() for (std::vector<Paragraph*>::iterator it = aSelParas.begin(); it != aSelParas.end();) { - if (!mrOutliner.HasParaFlag(*it, PARAFLAG_ISPAGE)) + if (!mrOutliner.HasParaFlag(*it, ParaFlag::ISPAGE)) it = aSelParas.erase(it); else ++it; @@ -1347,7 +1347,7 @@ void OutlineView::SetSelectedPages() while(pPara) { - if( mrOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page + if( mrOutliner.HasParaFlag(pPara, ParaFlag::ISPAGE) ) // one page { SdPage* pPage = mrDoc.GetSdPage(nPos, PK_STANDARD); DBG_ASSERT(pPage!=NULL, @@ -1690,13 +1690,13 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo) Size aOffset( 100, 100 ); // paint slide number - if( pPara && mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) ) + if( pPara && mrOutliner.HasParaFlag(pPara,ParaFlag::ISPAGE) ) { long nPage = 0; // todo, printing?? for ( sal_Int32 n = 0; n <= pInfo->mnPara; n++ ) { Paragraph* p = mrOutliner.GetParagraph( n ); - if ( mrOutliner.HasParaFlag(p,PARAFLAG_ISPAGE) ) + if ( mrOutliner.HasParaFlag(p,ParaFlag::ISPAGE) ) nPage++; } @@ -1791,7 +1791,7 @@ void OutlineView::OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) { Paragraph* pPara = mrOutliner.GetParagraph( nPara ); - bool bPage = mrOutliner.HasParaFlag( pPara, PARAFLAG_ISPAGE ); + bool bPage = mrOutliner.HasParaFlag( pPara, ParaFlag::ISPAGE ); if( !bPage ) { commit e9beb264709a8d4a240bb66f6c1ee95658bab4c2 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 11:22:50 2015 +0200 convert SBI_ constants to enum class Change-Id: I65e706f4e1adfe242808293d9514c9db8d22cc12 diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 71930a3..338ed02 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -33,7 +33,7 @@ SbiImage::SbiImage() pStrings = NULL; pCode = NULL; pLegacyPCode = NULL; - nFlags = 0; + nFlags = SbiImageFlags::NONE; nStrings = 0; nStringSize= 0; nCodeSize = 0; @@ -61,7 +61,7 @@ void SbiImage::Clear() pStringOff = NULL; pStrings = NULL; pCode = NULL; - nFlags = 0; + nFlags = SbiImageFlags::NONE; nStrings = 0; nStringSize= 0; nLegacyCodeSize = 0; @@ -123,8 +123,10 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) bool bBadVer = false; if( nSign == B_MODULE ) { + sal_uInt16 nTmpFlags; r.ReadUInt32( nVersion ).ReadUInt32( nCharSet ).ReadUInt32( lDimBase ) - .ReadUInt16( nFlags ).ReadUInt16( nReserved1 ).ReadUInt32( nReserved2 ).ReadUInt32( nReserved3 ); + .ReadUInt16( nTmpFlags ).ReadUInt16( nReserved1 ).ReadUInt32( nReserved2 ).ReadUInt32( nReserved3 ); + nFlags = static_cast<SbiImageFlags>(nTmpFlags); eCharSet = nCharSet; eCharSet = GetSOLoadTextEncoding( eCharSet ); bBadVer = ( nVersion > B_CURVERSION ); @@ -287,7 +289,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) } r .WriteInt32( eCharSet ) .WriteInt32( nDimBase ) - .WriteInt16( nFlags ) + .WriteInt16( static_cast<sal_uInt16>(nFlags) ) .WriteInt16( 0 ) .WriteInt32( 0 ) .WriteInt32( 0 ); diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 09595a7..cbeac3c 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1280,7 +1280,7 @@ void SbModule::RunInit() { if( pImage && !pImage->bInit - && pImage->GetFlag( SBIMG_INITCODE ) ) + && pImage->IsFlag( SbiImageFlags::INITCODE ) ) { // Set flag, so that RunInit get activ (Testtool) GetSbData()->bRunInit = true; diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index 9d8ac57..785a9e0 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -137,14 +137,14 @@ void SbiCodeGen::Save() p->nDimBase = pParser->nBase; // OPTION take over the EXPLICIT-Flag if( pParser->bExplicit ) - p->SetFlag( SBIMG_EXPLICIT ); + p->SetFlag( SbiImageFlags::EXPLICIT ); int nIfaceCount = 0; if( rMod.mnType == com::sun::star::script::ModuleType::CLASS ) { OSL_TRACE("COdeGen::save() classmodule processing"); rMod.bIsProxyModule = true; - p->SetFlag( SBIMG_CLASSMODULE ); + p->SetFlag( SbiImageFlags::CLASSMODULE ); GetSbData()->pClassFac->AddClassModule( &rMod ); nIfaceCount = pParser->aIfaceVector.size(); @@ -178,7 +178,7 @@ void SbiCodeGen::Save() // GlobalCode-Flag if( pParser->HasGlobalCode() ) { - p->SetFlag( SBIMG_INITCODE ); + p->SetFlag( SbiImageFlags::INITCODE ); } // Die Entrypoints: for( SbiSymDef* pDef = pParser->aPublics.First(); pDef; diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx index 095c715..0061a07 100644 --- a/basic/source/inc/image.hxx +++ b/basic/source/inc/image.hxx @@ -23,10 +23,24 @@ #include "sbintern.hxx" #include <rtl/ustring.hxx> #include <filefmt.hxx> +#include <o3tl/typed_flags_set.hxx> // This class reads in the image that's been produced by the compiler // and manages the access to the single elements. +enum class SbiImageFlags +{ + NONE = 0, + EXPLICIT = 0x0001, // OPTION EXPLICIT is active + COMPARETEXT = 0x0002, // OPTION COMPARE TEXT is active + INITCODE = 0x0004, // Init-Code does exist + CLASSMODULE = 0x0008, // OPTION ClassModule is active +}; +namespace o3tl +{ + template<> struct typed_flags<SbiImageFlags> : is_typed_flags<SbiImageFlags, 0xf> {}; +} + class SbiImage { friend class SbiCodeGen; // compiler classes, that the private- @@ -37,7 +51,7 @@ class SbiImage { char* pCode; // Code-Image char* pLegacyPCode; // Code-Image bool bError; - sal_uInt16 nFlags; + SbiImageFlags nFlags; short nStrings; sal_uInt32 nStringSize; sal_uInt32 nCodeSize; @@ -79,19 +93,14 @@ public: SbxArrayRef GetEnums() { return rEnums; } - void SetFlag( sal_uInt16 n ) { nFlags |= n; } - sal_uInt16 GetFlag( sal_uInt16 n ) const { return nFlags & n; } + void SetFlag( SbiImageFlags n ) { nFlags |= n; } + bool IsFlag( SbiImageFlags n ) const { return bool(nFlags & n); } sal_uInt16 CalcLegacyOffset( sal_Int32 nOffset ); sal_uInt32 CalcNewOffset( sal_Int16 nOffset ); void ReleaseLegacyBuffer(); bool ExceedsLegacyLimits(); }; -#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT is active -#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT is active -#define SBIMG_INITCODE 0x0004 // Init-Code does exist -#define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index b56a340..c7d6ba8 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -45,6 +45,7 @@ class SbiIoSystem; class SbiDdeControl; class SbiDllMgr; class SvNumberFormatter; // time/date functions +enum class SbiImageFlags; enum ForType { @@ -382,7 +383,7 @@ class SbiRuntime void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 ); public: void SetVBAEnabled( bool bEnabled ); - sal_uInt16 GetImageFlag( sal_uInt16 n ) const; + bool IsImageFlag( SbiImageFlags n ) const; sal_uInt16 GetBase(); sal_Int32 nLine,nCol1,nCol2; SbiRuntime* pNext; // Stack-Chain diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 713611c..e8502f4 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -925,7 +925,7 @@ RTLFUNC(InStr) if( bCompatibility ) { SbiRuntime* pRT = pInst->pRun; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; + bTextMode = pRT ? pRT->IsImageFlag( SbiImageFlags::COMPARETEXT ) : sal_False; } else { @@ -1000,7 +1000,7 @@ RTLFUNC(InStrRev) if( bCompatibility ) { SbiRuntime* pRT = pInst->pRun; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; + bTextMode = pRT ? pRT->IsImageFlag( SbiImageFlags::COMPARETEXT ) : sal_False; } else { @@ -1381,7 +1381,7 @@ RTLFUNC(Replace) if( bCompatibility ) { SbiRuntime* pRT = pInst->pRun; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; + bTextMode = pRT ? pRT->IsImageFlag( SbiImageFlags::COMPARETEXT ) : sal_False; } else { @@ -1642,7 +1642,7 @@ RTLFUNC(StrComp) if( bCompatibility ) { SbiRuntime* pRT = pInst->pRun; - nTextCompare = pRT && pRT->GetImageFlag( SBIMG_COMPARETEXT ); + nTextCompare = pRT && pRT->IsImageFlag( SbiImageFlags::COMPARETEXT ); } else { diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 0334521..29c1913 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1320,9 +1320,9 @@ void SbiRuntime::DllCall PushVar( pRes ); } -sal_uInt16 SbiRuntime::GetImageFlag( sal_uInt16 n ) const +bool SbiRuntime::IsImageFlag( SbiImageFlags n ) const { - return pImg->GetFlag( n ); + return pImg->IsFlag( n ); } sal_uInt16 SbiRuntime::GetBase() @@ -1579,7 +1579,7 @@ void SbiRuntime::StepLIKE() bool bCompatibility = ( GetSbData()->pInst && GetSbData()->pInst->IsCompatibility() ); if( bCompatibility ) { - bTextMode = GetImageFlag( SBIMG_COMPARETEXT ); + bTextMode = IsImageFlag( SbiImageFlags::COMPARETEXT ); } if( bTextMode ) { @@ -3501,7 +3501,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt } // else, if there are parameters, use different error code - if( !bLocal || pImg->GetFlag( SBIMG_EXPLICIT ) ) + if( !bLocal || pImg->IsFlag( SbiImageFlags::EXPLICIT ) ) { // #39108 if explicit and as ELEM always a fatal error bFatalError = true; @@ -4594,7 +4594,7 @@ void SbiRuntime::StepPUBLIC_P( sal_uInt32 nOp1, sal_uInt32 nOp2 ) // between invocations ( for VBASupport & document basic only ) if( pMod->pImage->bFirstInit ) { - bool bUsedForClassModule = pImg->GetFlag( SBIMG_CLASSMODULE ); + bool bUsedForClassModule = pImg->IsFlag( SbiImageFlags::CLASSMODULE ); StepPUBLIC_Impl( nOp1, nOp2, bUsedForClassModule ); } } @@ -4603,7 +4603,7 @@ void SbiRuntime::StepPUBLIC_P( sal_uInt32 nOp1, sal_uInt32 nOp2 ) void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { - if( pImg->GetFlag( SBIMG_CLASSMODULE ) ) + if( pImg->IsFlag( SbiImageFlags::CLASSMODULE ) ) { StepPUBLIC_Impl( nOp1, nOp2, true ); } commit c9c1caa4f9ad955ae864aa2681f890c7706daad1 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 11:05:01 2015 +0200 convert SVX_SEARCHAPP_ constants to enum class Change-Id: I2b9d379e56e0af655aa06afb5391140de952b9d6 diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx index 33d101a..531d95e 100644 --- a/include/svl/srchitem.hxx +++ b/include/svl/srchitem.hxx @@ -45,10 +45,14 @@ enum class SvxSearchCmd #define SVX_SEARCHIN_FORMULA ((sal_uInt16)0) #define SVX_SEARCHIN_VALUE ((sal_uInt16)1) #define SVX_SEARCHIN_NOTE ((sal_uInt16)2) -#define SVX_SEARCHAPP_WRITER ((sal_uInt16)0) -#define SVX_SEARCHAPP_CALC ((sal_uInt16)1) -#define SVX_SEARCHAPP_DRAW ((sal_uInt16)2) -#define SVX_SEARCHAPP_BASE ((sal_uInt16)3) + +enum class SvxSearchApp +{ + WRITER = 0, + CALC = 1, + DRAW = 2, + BASE = 3, +}; // class SvxSearchItem --------------------------------------------------- @@ -64,7 +68,7 @@ class SVL_DLLPUBLIC SvxSearchItem : // Calc-specific sal_uInt16 nCellType; // Search in Formulas/Values/Notes - sal_uInt16 nAppFlag; // application which the dialog is for + SvxSearchApp nAppFlag; // application which the dialog is for bool bRowDirection; // search direction: row-wise/column-wise bool bAllTables; // search in all sheets bool bSearchFiltered; // search filtered cells. @@ -146,8 +150,8 @@ public: bool GetNotes() const { return bNotes; } void SetNotes(bool bNew) { bNotes = bNew; } - sal_uInt16 GetAppFlag() const { return nAppFlag; } - void SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; } + SvxSearchApp GetAppFlag() const { return nAppFlag; } + void SetAppFlag(SvxSearchApp nNewAppFlag) { nAppFlag = nNewAppFlag; } inline bool IsLevenshtein() const; void SetLevenshtein( bool bVal ); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index a9a2ae8..6a0aaf0 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -232,7 +232,7 @@ const SvxSearchItem& ScGlobal::GetSearchItem() if (!pSearchItem) { pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM ); - pSearchItem->SetAppFlag( SVX_SEARCHAPP_CALC ); + pSearchItem->SetAppFlag( SvxSearchApp::CALC ); } return *pSearchItem; } @@ -244,7 +244,7 @@ void ScGlobal::SetSearchItem( const SvxSearchItem& rNew ) pSearchItem = static_cast<SvxSearchItem*>(rNew.Clone()); pSearchItem->SetWhich( SID_SEARCH_ITEM ); - pSearchItem->SetAppFlag( SVX_SEARCHAPP_CALC ); + pSearchItem->SetAppFlag( SvxSearchApp::CALC ); } void ScGlobal::ClearAutoFormat() diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 6ab2cc2..f7fb1c2 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -83,7 +83,7 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) { SetName( OUString( "StarDraw" ) ); // Do not translate! pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM); - pSearchItem->SetAppFlag(SVX_SEARCHAPP_DRAW); + pSearchItem->SetAppFlag(SvxSearchApp::DRAW); StartListening( *SfxGetpApp() ); SvxErrorHandler::ensure(); mpErrorHdl = new SfxErrorHandler( RID_SD_ERRHDL, diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 9e9a045..87a55d7 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -114,7 +114,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : eFamily ( SFX_STYLE_FAMILY_PARA ), nCommand ( SvxSearchCmd::FIND ), nCellType ( SVX_SEARCHIN_FORMULA ), - nAppFlag ( SVX_SEARCHAPP_WRITER ), + nAppFlag ( SvxSearchApp::WRITER ), bRowDirection ( true ), bAllTables ( false ), bSearchFiltered ( false ), @@ -377,7 +377,7 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe aSeq[3].Name = SRCH_PARA_CELLTYPE; aSeq[3].Value <<= nCellType; aSeq[4].Name = SRCH_PARA_APPFLAG; - aSeq[4].Value <<= nAppFlag; + aSeq[4].Value <<= static_cast<sal_uInt16>(nAppFlag); aSeq[5].Name = SRCH_PARA_ROWDIR; aSeq[5].Value <<= bRowDirection; aSeq[6].Name = SRCH_PARA_ALLTABLES; @@ -497,8 +497,12 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM } else if ( aSeq[i].Name == SRCH_PARA_APPFLAG ) { - if ( aSeq[i].Value >>= nAppFlag ) + sal_uInt16 nTmp; + if ( aSeq[i].Value >>= nTmp ) + { + nAppFlag = static_cast<SvxSearchApp>(nTmp); ++nConvertedCount; + } } else if ( aSeq[i].Name == SRCH_PARA_ROWDIR ) { diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 943ac9b..a493b6b 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -725,7 +725,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern ) ToggleSaveToModule aNoModuleSave(*this, false); SvtSearchOptions aOpt; - bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER ); + bWriter = ( pSearchItem->GetAppFlag() == SvxSearchApp::WRITER ); if ( ( nModifyFlag & MODIFY_WORD ) == 0 ) m_pWordBtn->Check( pSearchItem->GetWordOnly() ); @@ -755,7 +755,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern ) ShowOptionalControls_Impl(); bool bDraw = false; - if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC ) + if ( pSearchItem->GetAppFlag() == SvxSearchApp::CALC ) { m_pCalcGrid->Show(); Link aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl ); @@ -802,7 +802,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern ) { m_pWordBtn->SetText( aCalcStr.getToken( 1, '#' ) ); - if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_DRAW ) + if ( pSearchItem->GetAppFlag() == SvxSearchApp::DRAW ) { m_pSearchAllBtn->Hide(); @@ -1351,7 +1351,7 @@ IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd ) bSet = false; // Calc allows searching for empty cells. - bool bAllowEmptySearch = (pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC); + bool bAllowEmptySearch = (pSearchItem->GetAppFlag() == SvxSearchApp::CALC); if ( pEd == m_pSearchLB || pEd == m_pReplaceLB ) { commit 10bc10dd20520a72d030be429798d0cc19466fb5 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 10:40:22 2015 +0200 cppcheck: redundantCondition Change-Id: I4fe72c7e6c76954d3b370168ee9664d66c90fe6e diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 01ba6c1..cdf1c17 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -762,7 +762,7 @@ void XclImpUrlHelper::DecodeUrl( bool XclImpUrlHelper::DecodeLink( OUString& rApplic, OUString& rTopic, const OUString& rEncUrl ) { sal_Int32 nPos = rEncUrl.indexOf( EXC_DDE_DELIM ); - if( (nPos != -1) && (0 < nPos) && (nPos + 1 < rEncUrl.getLength()) ) + if( (nPos > 0) && (nPos + 1 < rEncUrl.getLength()) ) { rApplic = rEncUrl.copy( 0, nPos ); rTopic = rEncUrl.copy( nPos + 1 ); commit e2ac5e744e9a4a3776a72bde4778ed1e48c5e895 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 10:36:52 2015 +0200 cppcheck: unsignedLessThanZero Change-Id: I5beba0730f7403eb51f3717401b8d456f645348f diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index 78c2ae8..0450bc6 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -207,7 +207,7 @@ unsigned char * JPEGReader::CreateBitmap( JPEGCreateBitmapParam * pParam ) if (pParam->nWidth > SAL_MAX_INT32 / 8 || pParam->nHeight > SAL_MAX_INT32 / 8) return NULL; // avoid overflows later - if (pParam->nWidth <= 0 || pParam->nHeight <=0) + if (pParam->nWidth == 0 || pParam->nHeight == 0) return NULL; Size aSize( pParam->nWidth, pParam->nHeight ); commit af5b4d295a4df3f1234bbed25d29941a908d340e Author: Noel Grandin <[email protected]> Date: Fri Feb 27 10:31:55 2015 +0200 remove 15-year-old dead code Change-Id: Iec69f7520cd159120bbe62dbadc9793e81d399b9 diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 19c4deb..8750190 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -573,16 +573,6 @@ int MathType::Parse(SotStorage *pStor) if (nVersion > 3) // allow only supported versions of MathType to be parsed return 0; -#ifdef STANDALONE - *pOut << "Format Version is " << int(nVersion) << endl; - *pOut << "Generating Platform is " << (nPlatform ? "Windows" - : "Mac") << endl; - *pOut << "Generating Product is " << (nPlatform ? "Equation Editor" - : "Equation Editor") << endl; - *pOut << "Prod Version is " << int(nProdVersion) << "." << - int(nProdSubVersion) << endl << endl; -#endif - int nRet = HandleRecords(); //little crude hack to close occasionally open expressions //a sophisticated system to determine what expressions are commit 6fe4c54294308cf2c2574e4fbb0bdc61632448e1 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 10:24:38 2015 +0200 cppcheck: fix memory leak Change-Id: If73ed88d665d89f37f6caeb0ef1e9df703f063fe diff --git a/connectivity/source/drivers/macab/MacabHeader.cxx b/connectivity/source/drivers/macab/MacabHeader.cxx index d63c5f9..e4c1d38 100644 --- a/connectivity/source/drivers/macab/MacabHeader.cxx +++ b/connectivity/source/drivers/macab/MacabHeader.cxx @@ -198,11 +198,9 @@ macabfield **MacabHeader::sortRecord(const sal_Int32 _start, const sal_Int32 _le sal_Int32 halfLength = floor(_length/2); sal_Int32 fp = 0, lp = 0; sal_Int32 i; - macabfield **firstHalf = new macabfield *[halfLength]; - macabfield **lastHalf = new macabfield *[_length - halfLength]; + macabfield **firstHalf = sortRecord(_start, halfLength); + macabfield **lastHalf = sortRecord(_start+halfLength, _length-halfLength); - firstHalf = sortRecord(_start, halfLength); - lastHalf = sortRecord(_start+halfLength, _length-halfLength); for(i = 0; i < _length; i++) { if(compareFields(firstHalf[fp],lastHalf[lp]) < 0) @@ -234,6 +232,8 @@ macabfield **MacabHeader::sortRecord(const sal_Int32 _start, const sal_Int32 _le { fields = sorted; } + delete firstHalf; + delete lastHalf; } return sorted; } commit 3c866bb8e42554ac96d3588208e167e7786e2d00 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 10:08:03 2015 +0200 replace SVX_SEARCHCMD_ constants with enum class Change-Id: I675c488742219cc19624a21d1fc8e5033e7cbefa diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index af77aec..d73ecd3 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1273,17 +1273,17 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, bool const bForward = !rSearchItem.GetBackward(); sal_uInt16 nFound = 0; - if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) || - ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) ) + if ( ( rSearchItem.GetCommand() == SvxSearchCmd::FIND ) || + ( rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL ) ) { nFound = pView->Search( rSearchItem.GetSearchOptions() , bForward ) ? 1 : 0; } - else if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) || - ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) ) + else if ( ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE ) || + ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL ) ) { if ( !IsReadOnly() ) { - bool const bAll = rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL; + bool const bAll = rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL; nFound = pView->Replace( rSearchItem.GetSearchOptions() , bAll , bForward ); } } diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 1ec577b..4d1bedb 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -87,7 +87,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) // memorize item because of the adjustments... GetExtraData()->SetSearchItem(rSearchItem); sal_Int32 nFound = 0; - if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) + if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) { sal_uInt16 nActModWindows = 0; for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index b375a58..f843a63 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2516,13 +2516,13 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); // FIND_ALL is not possible without multiple selection. - if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) || - ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) ) + if ( ( rSearchItem.GetCommand() == SvxSearchCmd::FIND ) || + ( rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL ) ) { if ( Search( rSearchItem, pEditView ) ) nFound++; } - else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) + else if ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE ) { // The word is selected if the user not altered the selection // in between: @@ -2535,7 +2535,7 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe if( Search( rSearchItem, pEditView ) ) nFound = 1; } - else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) + else if ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL ) { // The Writer replaces all front beginning to end ... SvxSearchItem aTmpItem( rSearchItem ); diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx index 0b2ef01..33d101a 100644 --- a/include/svl/srchitem.hxx +++ b/include/svl/srchitem.hxx @@ -33,10 +33,13 @@ // defines --------------------------------------------------------------- // commands -#define SVX_SEARCHCMD_FIND ((sal_uInt16)0) -#define SVX_SEARCHCMD_FIND_ALL ((sal_uInt16)1) -#define SVX_SEARCHCMD_REPLACE ((sal_uInt16)2) -#define SVX_SEARCHCMD_REPLACE_ALL ((sal_uInt16)3) +enum class SvxSearchCmd +{ + FIND = 0, + FIND_ALL = 1, + REPLACE = 2, + REPLACE_ALL = 3, +}; // search flags #define SVX_SEARCHIN_FORMULA ((sal_uInt16)0) @@ -57,7 +60,7 @@ class SVL_DLLPUBLIC SvxSearchItem : SfxStyleFamily eFamily; // style family - sal_uInt16 nCommand; // command (Search, Search all, Replace, Replace all) + SvxSearchCmd nCommand; // command (Search, Search all, Replace, Replace all) // Calc-specific sal_uInt16 nCellType; // Search in Formulas/Values/Notes @@ -94,8 +97,8 @@ public: virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames ) SAL_OVERRIDE; virtual void Commit() SAL_OVERRIDE; - sal_uInt16 GetCommand() const { return nCommand; } - void SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; } + SvxSearchCmd GetCommand() const { return nCommand; } + void SetCommand(SvxSearchCmd nNewCommand) { nCommand = nNewCommand; } inline const OUString GetSearchString() const; inline void SetSearchString(const OUString& rNewString); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 535ca0e..330ff68 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4306,7 +4306,7 @@ void Test::testSearchCells() SvxSearchItem aItem(SID_SEARCH_ITEM); aItem.SetSearchString(OUString("A")); - aItem.SetCommand(SVX_SEARCHCMD_FIND_ALL); + aItem.SetCommand(SvxSearchCmd::FIND_ALL); ScMarkData aMarkData; aMarkData.SelectOneTable(0); SCCOL nCol = 0; diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index b98e43d..57a20e1 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1155,9 +1155,9 @@ void ScDocument::GetAutoFormatData(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, void ScDocument::GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow ) { - sal_uInt16 nCommand = rSearchItem.GetCommand(); - bool bReplace = ( nCommand == SVX_SEARCHCMD_REPLACE || - nCommand == SVX_SEARCHCMD_REPLACE_ALL ); + SvxSearchCmd nCommand = rSearchItem.GetCommand(); + bool bReplace = ( nCommand == SvxSearchCmd::REPLACE || + nCommand == SvxSearchCmd::REPLACE_ALL ); if ( rSearchItem.GetBackward() ) { if ( rSearchItem.GetRowDirection() ) @@ -1252,9 +1252,9 @@ bool ScDocument::SearchAndReplace( SCCOL nCol; SCROW nRow; SCTAB nTab; - sal_uInt16 nCommand = rSearchItem.GetCommand(); - if ( nCommand == SVX_SEARCHCMD_FIND_ALL || - nCommand == SVX_SEARCHCMD_REPLACE_ALL ) + SvxSearchCmd nCommand = rSearchItem.GetCommand(); + if ( nCommand == SvxSearchCmd::FIND_ALL || + nCommand == SvxSearchCmd::REPLACE_ALL ) { SCTAB nMax = maTabs.size(); ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index 3375df4..a5b7192 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -132,8 +132,8 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo sal_uInt8 cMatrixFlag = MM_NONE; if ( bFound && - ( (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE) - ||(rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) ) && + ( (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE) + ||(rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) ) && // Don't split the matrix, only replace Matrix formulas !( (eCellType == CELLTYPE_FORMULA && ((cMatrixFlag = aCell.mpFormula->GetMatrixFlag()) == MM_REFERENCE)) @@ -142,7 +142,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo IsBlockEditable(nCol, nRow, nCol, nRow) ) { - if ( cMatrixFlag == MM_NONE && rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) + if ( cMatrixFlag == MM_NONE && rSearchItem.GetCommand() == SvxSearchCmd::REPLACE ) rUndoStr = aString; else if (pUndoDoc) { @@ -189,7 +189,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo // continue search ? if (bRepeat) { - if ( rSearchItem.GetCommand() != SVX_SEARCHCMD_REPLACE_ALL || nStart >= nEnd ) + if ( rSearchItem.GetCommand() != SvxSearchCmd::REPLACE_ALL || nStart >= nEnd ) bRepeat = false; else if (bDoBack) { @@ -289,8 +289,8 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc) { bool bFound = false; - bool bAll = (rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL) - ||(rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL); + bool bAll = (rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL) + ||(rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL); SCCOL nCol = rCol; SCROW nRow = rRow; @@ -695,10 +695,10 @@ bool ScTable::SearchAndReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc) { - sal_uInt16 nCommand = rSearchItem.GetCommand(); + SvxSearchCmd nCommand = rSearchItem.GetCommand(); bool bFound = false; if ( ValidColRow(rCol, rRow) || - ((nCommand == SVX_SEARCHCMD_FIND || nCommand == SVX_SEARCHCMD_REPLACE) && + ((nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE) && (((rCol == MAXCOLCOUNT || rCol == -1) && ValidRow(rRow)) || ((rRow == MAXROWCOUNT || rRow == -1) && ValidCol(rCol)) ) @@ -708,13 +708,13 @@ bool ScTable::SearchAndReplace( bool bStyles = rSearchItem.GetPattern(); if (bStyles) { - if (nCommand == SVX_SEARCHCMD_FIND) + if (nCommand == SvxSearchCmd::FIND) bFound = SearchStyle(rSearchItem, rCol, rRow, rMark); - else if (nCommand == SVX_SEARCHCMD_REPLACE) + else if (nCommand == SvxSearchCmd::REPLACE) bFound = ReplaceStyle(rSearchItem, rCol, rRow, rMark, false); - else if (nCommand == SVX_SEARCHCMD_FIND_ALL) + else if (nCommand == SvxSearchCmd::FIND_ALL) bFound = SearchAllStyle(rSearchItem, rMark, rMatchedRanges); - else if (nCommand == SVX_SEARCHCMD_REPLACE_ALL) + else if (nCommand == SvxSearchCmd::REPLACE_ALL) bFound = ReplaceAllStyle(rSearchItem, rMark, rMatchedRanges, pUndoDoc); } else @@ -739,13 +739,13 @@ bool ScTable::SearchAndReplace( pSearchText = new utl::TextSearch( aSearchOptions ); - if (nCommand == SVX_SEARCHCMD_FIND) + if (nCommand == SvxSearchCmd::FIND) bFound = Search(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc); - else if (nCommand == SVX_SEARCHCMD_FIND_ALL) + else if (nCommand == SvxSearchCmd::FIND_ALL) bFound = SearchAll(rSearchItem, rMark, rMatchedRanges, rUndoStr, pUndoDoc); - else if (nCommand == SVX_SEARCHCMD_REPLACE) + else if (nCommand == SvxSearchCmd::REPLACE) bFound = Replace(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc); - else if (nCommand == SVX_SEARCHCMD_REPLACE_ALL) + else if (nCommand == SvxSearchCmd::REPLACE_ALL) bFound = ReplaceAll(rSearchItem, rMark, rMatchedRanges, rUndoStr, pUndoDoc); delete pSearchText; @@ -799,8 +799,8 @@ bool ScTable::SearchAndReplaceEmptyCells( aRanges = aNewRanges; } - sal_uInt16 nCommand = rSearchItem.GetCommand(); - if (nCommand == SVX_SEARCHCMD_FIND || nCommand == SVX_SEARCHCMD_REPLACE) + SvxSearchCmd nCommand = rSearchItem.GetCommand(); + if (nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE) { if (rSearchItem.GetBackward()) { @@ -821,7 +821,7 @@ bool ScTable::SearchAndReplaceEmptyCells( } } } - else if (nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL) + else if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL) { bool bFound = false; for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i ) @@ -845,7 +845,7 @@ bool lcl_maybeReplaceCellString( // empty cell found. rCol = nCol; rRow = nRow; - if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE && + if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE && !rSearchItem.GetReplaceString().isEmpty()) { rColObj.SetRawString(nRow, rSearchItem.GetReplaceString()); @@ -862,7 +862,7 @@ bool ScTable::SearchRangeForEmptyCell( const ScRange& rRange, const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, OUString& rUndoStr) { - sal_uInt16 nCmd = rSearchItem.GetCommand(); + SvxSearchCmd nCmd = rSearchItem.GetCommand(); bool bSkipFiltered = rSearchItem.IsSearchFiltered(); if (rSearchItem.GetBackward()) { @@ -882,7 +882,7 @@ bool ScTable::SearchRangeForEmptyCell( SCCOL nBeginCol = rRange.aEnd.Col(); if (nRow == rRow && nBeginCol >= rCol) // always start from one cell before the cursor. - nBeginCol = rCol - (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0); + nBeginCol = rCol - (nCmd == SvxSearchCmd::FIND ? 1 : 0); for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol) { @@ -901,7 +901,7 @@ bool ScTable::SearchRangeForEmptyCell( SCROW nBeginRow = rRange.aEnd.Row(); if (nCol == rCol && nBeginRow >= rRow) // always start from one cell before the cursor. - nBeginRow = rRow - (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0); + nBeginRow = rRow - (nCmd == SvxSearchCmd::FIND ? 1 : 0); for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow) { if (bSkipFiltered) @@ -933,7 +933,7 @@ bool ScTable::SearchRangeForEmptyCell( SCCOL nBeginCol = rRange.aStart.Col(); if (nRow == rRow && nBeginCol <= rCol) // always start from one cell past the cursor. - nBeginCol = rCol + (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0); + nBeginCol = rCol + (nCmd == SvxSearchCmd::FIND ? 1 : 0); for (SCCOL nCol = nBeginCol; nCol <= rRange.aEnd.Col(); ++nCol) { if (lcl_maybeReplaceCellString(aCol[nCol], rCol, rRow, rUndoStr, nCol, nRow, rSearchItem)) @@ -951,7 +951,7 @@ bool ScTable::SearchRangeForEmptyCell( SCROW nBeginRow = rRange.aStart.Row(); if (nCol == rCol && nBeginRow <= rRow) // always start from one cell past the cursor. - nBeginRow = rRow + (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0); + nBeginRow = rRow + (nCmd == SvxSearchCmd::FIND ? 1 : 0); for (SCROW nRow = nBeginRow; nRow <= rRange.aEnd.Row(); ++nRow) { if (bSkipFiltered) @@ -973,7 +973,7 @@ bool ScTable::SearchRangeForAllEmptyCells( ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc) { bool bFound = false; - bool bReplace = (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) && + bool bReplace = (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) && !rSearchItem.GetReplaceString().isEmpty(); bool bSkipFiltered = rSearchItem.IsSearchFiltered(); diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 494fd3d..5b76505 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -979,7 +979,7 @@ void ScUndoReplace::Undo() if (pUndoDoc) // only for ReplaceAll !! { - OSL_ENSURE(pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL, + OSL_ENSURE(pSearchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL, "ScUndoReplace:: Wrong Mode"); SetViewMarkData( aMarkData ); @@ -997,7 +997,7 @@ void ScUndoReplace::Undo() pDocShell->PostPaintGridAll(); } else if (pSearchItem->GetPattern() && - pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE) + pSearchItem->GetCommand() == SvxSearchCmd::REPLACE) { OUString aTempStr = pSearchItem->GetSearchString(); // toggle pSearchItem->SetSearchString(pSearchItem->GetReplaceString()); @@ -1066,7 +1066,7 @@ void ScUndoReplace::Redo() } } else if (pSearchItem->GetPattern() && - pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE) + pSearchItem->GetCommand() == SvxSearchCmd::REPLACE) { rDoc.ReplaceStyle( *pSearchItem, aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 752314e..7fa1c76 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -3924,7 +3924,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll( if (pSearchItem) { ScDocument& rDoc = pDocShell->GetDocument(); - pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL ); + pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL ); // immer nur innerhalb dieses Objekts pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) ); @@ -3962,7 +3962,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl( if (pSearchItem) { ScDocument& rDoc = pDocShell->GetDocument(); - pSearchItem->SetCommand( SVX_SEARCHCMD_FIND ); + pSearchItem->SetCommand( SvxSearchCmd::FIND ); // immer nur innerhalb dieses Objekts pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) ); @@ -4049,7 +4049,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea { ScDocument& rDoc = pDocShell->GetDocument(); bool bUndo(rDoc.IsUndoEnabled()); - pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL ); + pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL ); // immer nur innerhalb dieses Objekts pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) ); diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 464f801..d2298c2 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -287,13 +287,13 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) aSearchItem.SetReplaceString(static_cast<const SfxStringItem*>(pItem)->GetValue()); if (nSlot == FID_SEARCH) - aSearchItem.SetCommand(SVX_SEARCHCMD_FIND); + aSearchItem.SetCommand(SvxSearchCmd::FIND); else if(nSlot == FID_REPLACE) - aSearchItem.SetCommand(SVX_SEARCHCMD_REPLACE); + aSearchItem.SetCommand(SvxSearchCmd::REPLACE); else if(nSlot == FID_REPLACE_ALL) - aSearchItem.SetCommand(SVX_SEARCHCMD_REPLACE_ALL); + aSearchItem.SetCommand(SvxSearchCmd::REPLACE_ALL); else - aSearchItem.SetCommand(SVX_SEARCHCMD_FIND_ALL); + aSearchItem.SetCommand(SvxSearchCmd::FIND_ALL); // Request ausfuehren (dabei wird das SearchItem gespeichert) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index dd46c18..9cf4091 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1504,7 +1504,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, nRow = nOldRow = GetViewData().GetCurY(); nTab = nOldTab = GetViewData().GetTabNo(); - sal_uInt16 nCommand = pSearchItem->GetCommand(); + SvxSearchCmd nCommand = pSearchItem->GetCommand(); bool bAllTables = pSearchItem->IsAllTables(); std::set<SCTAB> aOldSelectedTables; SCTAB nLastTab = rDoc.GetTableCount() - 1; @@ -1522,8 +1522,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, nEndTab = rMark.GetLastSelected(); } - if ( nCommand == SVX_SEARCHCMD_FIND - || nCommand == SVX_SEARCHCMD_FIND_ALL) + if ( nCommand == SvxSearchCmd::FIND + || nCommand == SvxSearchCmd::FIND_ALL) bAddUndo = false; //! account for bAttrib during Undo !!! @@ -1534,7 +1534,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, if (bAddUndo) { pUndoMark.reset(new ScMarkData(rMark)); // Mark is being modified - if ( nCommand == SVX_SEARCHCMD_REPLACE_ALL ) + if ( nCommand == SvxSearchCmd::REPLACE_ALL ) { pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab ); @@ -1574,7 +1574,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, aUndoStr, pUndoDoc.release(), pSearchItem ) ); } - if (nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL) + if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL) { SfxViewFrame* pViewFrm = SfxViewFrame::Current(); if (pViewFrm) @@ -1600,8 +1600,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, break; // break 'while (TRUE)' } - else if ( bFirst && (nCommand == SVX_SEARCHCMD_FIND || - nCommand == SVX_SEARCHCMD_REPLACE) ) + else if ( bFirst && (nCommand == SvxSearchCmd::FIND || + nCommand == SvxSearchCmd::REPLACE) ) { bFirst = false; GetFrameWin()->LeaveWait(); @@ -1625,7 +1625,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, } else // nothing found { - if ( nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL ) + if ( nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL ) { pDocSh->PostPaintGridAll(); // Mark } @@ -1673,10 +1673,10 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP ); SetCursor( nCol, nRow, true ); - if ( nCommand == SVX_SEARCHCMD_REPLACE - || nCommand == SVX_SEARCHCMD_REPLACE_ALL ) + if ( nCommand == SvxSearchCmd::REPLACE + || nCommand == SvxSearchCmd::REPLACE_ALL ) { - if ( nCommand == SVX_SEARCHCMD_REPLACE ) + if ( nCommand == SvxSearchCmd::REPLACE ) { pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID ); @@ -1685,7 +1685,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, if ( nCol == nOldCol && nRow == nOldRow && nTab == nOldTab ) { SvxSearchItem aSearchItem = ScGlobal::GetSearchItem(); - aSearchItem.SetCommand(SVX_SEARCHCMD_FIND); + aSearchItem.SetCommand(SvxSearchCmd::FIND); aSearchItem.SetWhich(SID_SEARCH_ITEM); ScRangeList aMatchedRanges; @@ -1702,7 +1702,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, pDocSh->PostPaintGridAll(); pDocSh->SetDocumentModified(); } - else if ( nCommand == SVX_SEARCHCMD_FIND_ALL ) + else if ( nCommand == SvxSearchCmd::FIND_ALL ) pDocSh->PostPaintGridAll(); // mark GetFrameWin()->LeaveWait(); } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 9b1226a..1077a24 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -483,8 +483,8 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) Initialize ( ! mpSearchItem->GetBackward()); - const sal_uInt16 nCommand (mpSearchItem->GetCommand()); - if (nCommand == SVX_SEARCHCMD_REPLACE_ALL) + const SvxSearchCmd nCommand (mpSearchItem->GetCommand()); + if (nCommand == SvxSearchCmd::REPLACE_ALL) bEndOfSearch = SearchAndReplaceAll (); else { @@ -653,19 +653,19 @@ bool Outliner::SearchAndReplaceOnce (void) // following call to StartSearchAndReplace will then search for // the next match. if (meMode == SEARCH - && mpSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE) + && mpSearchItem->GetCommand() == SvxSearchCmd::REPLACE) if (pOutlinerView->GetSelection().HasRange()) pOutlinerView->StartSearchAndReplace(*mpSearchItem); // Search for the next match. sal_uLong nMatchCount = 0; - if (mpSearchItem->GetCommand() != SVX_SEARCHCMD_REPLACE_ALL) + if (mpSearchItem->GetCommand() != SvxSearchCmd::REPLACE_ALL) nMatchCount = pOutlinerView->StartSearchAndReplace(*mpSearchItem); // Go to the next text object when there have been no matches in // the current object or the whole object has already been // processed. - if (nMatchCount==0 || mpSearchItem->GetCommand()==SVX_SEARCHCMD_REPLACE_ALL) + if (nMatchCount==0 || mpSearchItem->GetCommand()==SvxSearchCmd::REPLACE_ALL) { ProvideNextTextObject (); @@ -1084,9 +1084,9 @@ bool Outliner::ShowWrapArroundDialog (void) if (mpSearchItem != NULL) { // When searching display the dialog only for single find&replace. - const sal_uInt16 nCommand (mpSearchItem->GetCommand()); - bShowDialog = (nCommand==SVX_SEARCHCMD_REPLACE) - || (nCommand==SVX_SEARCHCMD_FIND); + const SvxSearchCmd nCommand (mpSearchItem->GetCommand()); + bShowDialog = (nCommand==SvxSearchCmd::REPLACE) + || (nCommand==SvxSearchCmd::FIND); } else // Spell checking needs the dialog, too. diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 0c69751..9e9a045 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -112,7 +112,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : 2, 2, 2, TransliterationModules_IGNORE_CASE ), eFamily ( SFX_STYLE_FAMILY_PARA ), - nCommand ( 0 ), + nCommand ( SvxSearchCmd::FIND ), nCellType ( SVX_SEARCHIN_FORMULA ), nAppFlag ( SVX_SEARCHAPP_WRITER ), bRowDirection ( true ), @@ -373,7 +373,7 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe aSeq[1].Name = SRCH_PARA_FAMILY; aSeq[1].Value <<= sal_Int16( eFamily ); aSeq[2].Name = SRCH_PARA_COMMAND; - aSeq[2].Value <<= nCommand; + aSeq[2].Value <<= static_cast<sal_uInt16>(nCommand); aSeq[3].Name = SRCH_PARA_CELLTYPE; aSeq[3].Value <<= nCellType; aSeq[4].Name = SRCH_PARA_APPFLAG; @@ -483,8 +483,12 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM } else if ( aSeq[i].Name == SRCH_PARA_COMMAND ) { - if ( aSeq[i].Value >>= nCommand ) + sal_uInt16 nTmp; + if ( aSeq[i].Value >>= nTmp ) + { + nCommand = static_cast<SvxSearchCmd>(nTmp); ++nConvertedCount; + } } else if ( aSeq[i].Name == SRCH_PARA_CELLTYPE ) { @@ -538,7 +542,7 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM break; } case MID_SEARCH_COMMAND: - bRet = (rVal >>= nInt); nCommand = (sal_uInt16) nInt; break; + bRet = (rVal >>= nInt); nCommand = static_cast<SvxSearchCmd>(nInt); break; case MID_SEARCH_STYLEFAMILY: bRet = (rVal >>= nInt); eFamily = (SfxStyleFamily) (sal_Int16) nInt; break; case MID_SEARCH_CELLTYPE: diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index d436898..943ac9b 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1241,13 +1241,13 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn ) } if (pBtn == m_pSearchBtn) - pSearchItem->SetCommand( SVX_SEARCHCMD_FIND ); + pSearchItem->SetCommand( SvxSearchCmd::FIND ); else if ( pBtn == m_pSearchAllBtn ) - pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL ); + pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL ); else if ( pBtn == m_pReplaceBtn ) - pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE ); + pSearchItem->SetCommand( SvxSearchCmd::REPLACE ); else if ( pBtn == m_pReplaceAllBtn ) - pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL ); + pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL ); // when looking for templates, delete format lists if ( !bFormat && pSearchItem->GetPattern() ) @@ -2189,7 +2189,7 @@ void SvxSearchDialog::SaveToModule_Impl() pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() ); } - pSearchItem->SetCommand( SVX_SEARCHCMD_FIND ); + pSearchItem->SetCommand( SvxSearchCmd::FIND ); nModifyFlag = 0; const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SfxCallMode::SLOT, ppArgs ); diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index a60f9cc..61846913 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -115,7 +115,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext lArgs[3].Value <<= nFlags; lArgs[4].Name = SEARCHITEM_COMMAND; lArgs[4].Value <<= (sal_Int16)(aFindAll ? - SVX_SEARCHCMD_FIND_ALL : SVX_SEARCHCMD_FIND ); + SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND ); lArgs[5].Name = SEARCHITEM_ALGORITHMTYPE; lArgs[5].Value <<= (sal_Int16)0; // 0 == SearchAlgorithms_ABSOLUTE diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 798b58c..13eebe7 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -594,13 +594,13 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, bool bAll = false; switch( rSearchItem.GetCommand() ) { - case SVX_SEARCHCMD_FIND: - case SVX_SEARCHCMD_FIND_ALL: + case SvxSearchCmd::FIND: + case SvxSearchCmd::FIND_ALL: nFound = pTextView->Search( aSearchOpt, bForward ) ? 1 : 0; break; - case SVX_SEARCHCMD_REPLACE_ALL: bAll = true; - case SVX_SEARCHCMD_REPLACE: + case SvxSearchCmd::REPLACE_ALL: bAll = true; + case SvxSearchCmd::REPLACE: nFound = pTextView->Replace( aSearchOpt, bAll, bForward ); break; diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index c3291935..8ed5c40 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -186,7 +186,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) } switch (m_pSrchItem->GetCommand()) { - case SVX_SEARCHCMD_FIND: + case SvxSearchCmd::FIND: { bool bRet = SearchAndWrap(bApi); if( bRet ) @@ -206,7 +206,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) #endif } break; - case SVX_SEARCHCMD_FIND_ALL: + case SvxSearchCmd::FIND_ALL: { bool bRet = SearchAll(); if( !bRet ) @@ -233,14 +233,14 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) #endif } break; - case SVX_SEARCHCMD_REPLACE: + case SvxSearchCmd::REPLACE: { // 1) Replace selection (Not if only attributes should be replaced) //JP 27.04.95: Why? // what if you only want to assign attributes to the found?? - sal_uInt16 nCmd = SVX_SEARCHCMD_FIND; + SvxSearchCmd nCmd = SvxSearchCmd::FIND; if( !m_pSrchItem->GetReplaceString().isEmpty() || !m_pReplList ) { @@ -267,11 +267,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) } } else if( m_pReplList ) - nCmd = SVX_SEARCHCMD_REPLACE; + nCmd = SvxSearchCmd::REPLACE; // 2) Search further (without replacing!) - sal_uInt16 nOldCmd = m_pSrchItem->GetCommand(); + SvxSearchCmd nOldCmd = m_pSrchItem->GetCommand(); m_pSrchItem->SetCommand( nCmd ); bool bRet = SearchAndWrap(bApi); if( bRet ) @@ -294,7 +294,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) #endif break; - case SVX_SEARCHCMD_REPLACE_ALL: + case SvxSearchCmd::REPLACE_ALL: { SwSearchOptions aOpts( m_pWrtShell, m_pSrchItem->GetBackward() ); m_bExtra = false; @@ -613,10 +613,10 @@ void SwView::Replace() SwPosition aStartPos = (* m_pWrtShell->GetSwCrsr()->Start()); SwPosition aEndPos = (* m_pWrtShell->GetSwCrsr()->End()); bool bHasSelection = m_pSrchItem->GetSelection(); - sal_uInt16 nOldCmd = m_pSrchItem->GetCommand(); + SvxSearchCmd nOldCmd = m_pSrchItem->GetCommand(); //set state for checking if current selection has a match - m_pSrchItem->SetCommand( SVX_SEARCHCMD_FIND ); + m_pSrchItem->SetCommand( SvxSearchCmd::FIND ); m_pSrchItem->SetSelection(true); //check if it matchs @@ -692,13 +692,13 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions ) #if HAVE_FEATURE_DESKTOP SvxSearchDialogWrapper::SetSearchLabel(SL_Empty); #endif - bool bDoReplace = m_pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE || - m_pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL; + bool bDoReplace = m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE || + m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL; int eRanges = m_pSrchItem->GetSelection() ? FND_IN_SEL : m_bExtra ? FND_IN_OTHER : FND_IN_BODY; - if (m_pSrchItem->GetCommand() == SVX_SEARCHCMD_FIND_ALL || - m_pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) + if (m_pSrchItem->GetCommand() == SvxSearchCmd::FIND_ALL || + m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL) eRanges |= FND_IN_SELALL; m_pWrtShell->SttSelect(); commit f9ba16e44b2813dd1fc9b0e06994f67c6350f050 Author: Noel Grandin <[email protected]> Date: Fri Feb 27 09:19:55 2015 +0200 convert SW_CHAIN_ constants to enum class Change-Id: If3cd86cbb0b01f975456b93b05232e18ec742828 diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 7178c0d..b9b5551 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1532,8 +1532,8 @@ public: sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const; void AdjustCellWidth( const SwCursor& rCursor, bool bBalance = false ); - int Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ); - int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ); + SwChainRet Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ); + SwChainRet Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ); void Unchain( SwFrmFmt &rFmt ); // For Copy/Move from FrmShell. diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 55ef44b..dc8edfd 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -447,9 +447,9 @@ public: /** For Chain always connect Fly specified by format with that hit by point. rRect contains rect of Fly (for its highlight). */ - int Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const; - int Chain( SwFrmFmt &rSource, const Point &rPt ); - int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ); + SwChainRet Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const; + SwChainRet Chain( SwFrmFmt &rSource, const Point &rPt ); + SwChainRet Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ); void Unchain( SwFrmFmt &rFmt ); void HideChainMarker(); void SetChainMarker(); diff --git a/sw/inc/flyenum.hxx b/sw/inc/flyenum.hxx index 743adc2..469bb13 100644 --- a/sw/inc/flyenum.hxx +++ b/sw/inc/flyenum.hxx @@ -30,14 +30,17 @@ enum FlyCntType }; // Return values for chainable and chain. -#define SW_CHAIN_OK 0 -#define SW_CHAIN_NOT_EMPTY 1 ///< Only empty frames may be connected. -#define SW_CHAIN_IS_IN_CHAIN 2 ///< Destination already in chain. -#define SW_CHAIN_WRONG_AREA 3 /**< Destination in section where it shouldn't be - (header, footer). */ -#define SW_CHAIN_NOT_FOUND 4 ///< Destination and/or source not found. -#define SW_CHAIN_SOURCE_CHAINED 5 ///< Source already has a follow. -#define SW_CHAIN_SELF 6 ///< Self-chaining is not allowed. +enum class SwChainRet +{ + OK = 0, + NOT_EMPTY = 1, ///< Only empty frames may be connected. + IS_IN_CHAIN = 2, ///< Destination already in chain. + WRONG_AREA = 3, /**< Destination in section where it shouldn't be + (header, footer). */ + NOT_FOUND = 4, ///< Destination and/or source not found. + SOURCE_CHAINED = 5, ///< Source already has a follow. + SELF = 6 ///< Self-chaining is not allowed. +}; #endif diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 0e39cfb..701dea3 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -929,45 +929,45 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, return bUnmark; } -int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) +SwChainRet SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) { // The Source must not yet have a Follow. const SwFmtChain &rOldChain = rSource.GetChain(); if ( rOldChain.GetNext() ) - return SW_CHAIN_SOURCE_CHAINED; + return SwChainRet::SOURCE_CHAINED; // Target must not be equal to Source and we also must not have a closed chain. const SwFrmFmt *pFmt = &rDest; do { if( pFmt == &rSource ) - return SW_CHAIN_SELF; + return SwChainRet::SELF; pFmt = pFmt->GetChain().GetNext(); } while ( pFmt ); // There must not be a chaining from outside to inside or the other way around. if( rDest.IsLowerOf( rSource ) || rSource .IsLowerOf( rDest ) ) - return SW_CHAIN_SELF; + return SwChainRet::SELF; // The Target must not yet have a Master. const SwFmtChain &rChain = rDest.GetChain(); if( rChain.GetPrev() ) - return SW_CHAIN_IS_IN_CHAIN; + return SwChainRet::IS_IN_CHAIN; // Target must be empty. const SwNodeIndex* pCntIdx = rDest.GetCntnt().GetCntntIdx(); if( !pCntIdx ) - return SW_CHAIN_NOT_FOUND; + return SwChainRet::NOT_FOUND; SwNodeIndex aNxtIdx( *pCntIdx, 1 ); const SwTxtNode* pTxtNd = aNxtIdx.GetNode().GetTxtNode(); if( !pTxtNd ) - return SW_CHAIN_NOT_FOUND; + return SwChainRet::NOT_FOUND; const sal_uLong nFlySttNd = pCntIdx->GetIndex(); if( 2 != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) || pTxtNd->GetTxt().getLength() ) { - return SW_CHAIN_NOT_EMPTY; + return SwChainRet::NOT_EMPTY; } for( auto pSpzFrmFm : *GetSpzFrmFmts() ) @@ -982,7 +982,7 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) rAnchor.GetCntntAnchor()->nNode.GetIndex() ) && nTstSttNd < nFlySttNd + 2 ) { - return SW_CHAIN_NOT_EMPTY; + return SwChainRet::NOT_EMPTY; } } @@ -1023,13 +1023,13 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) bAllowed = true; } - return bAllowed ? SW_CHAIN_OK : SW_CHAIN_WRONG_AREA; + return bAllowed ? SwChainRet::OK : SwChainRet::WRONG_AREA; } -int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) +SwChainRet SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) { - int nErr = Chainable( rSource, rDest ); - if ( !nErr ) + SwChainRet nErr = Chainable( rSource, rDest ); + if ( nErr == SwChainRet::OK ) { GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL ); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index ab8f8fd..4e34bb0 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1857,14 +1857,14 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt, after pFmt. */ - int nChainState; + SwChainRet nChainState; if (bSuccessors) nChainState = mpDoc->Chainable(rFmt, rFmt1); else nChainState = mpDoc->Chainable(rFmt1, rFmt); - if (nChainState == SW_CHAIN_OK) + if (nChainState == SwChainRet::OK) { aTmpSpzArray.push_back(&rFmt1); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index f092a6c..501d52e 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2496,7 +2496,7 @@ void SwFEShell::SetCalcFieldValueHdl(Outliner* pOutliner) GetDoc()->SetCalcFieldValueHdl(pOutliner); } -int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource, +SwChainRet SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const { rRect.Clear(); @@ -2504,9 +2504,9 @@ int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource, // The source is not allowed to have a follow. const SwFmtChain &rChain = rSource.GetChain(); if ( rChain.GetNext() ) - return SW_CHAIN_SOURCE_CHAINED; + return SwChainRet::SOURCE_CHAINED; - int nRet = SW_CHAIN_NOT_FOUND; + SwChainRet nRet = SwChainRet::NOT_FOUND; if( Imp()->HasDrawView() ) { SdrObject* pObj; @@ -2530,16 +2530,16 @@ int SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource, return nRet; } -int SwFEShell::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) +SwChainRet SwFEShell::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) { return GetDoc()->Chain(rSource, rDest); } -int SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt ) +SwChainRet SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt ) { SwRect aDummy; - int nErr = Chainable( aDummy, rSource, rPt ); - if ( !nErr ) + SwChainRet nErr = Chainable( aDummy, rSource, rPt ); + if ( nErr == SwChainRet::OK ) { StartAllAction(); SdrObject* pObj; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index abb3cfc..c9cda8a 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -385,10 +385,10 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) if ( IsChainMode() ) { SwRect aRect; - int nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt ); - PointerStyle eStyle = nChainable + SwChainRet nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt ); + PointerStyle eStyle = nChainable != SwChainRet::OK ? POINTER_CHAIN_NOTALLOWED : POINTER_CHAIN; - if ( !nChainable ) + if ( nChainable == SwChainRet::OK ) { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
