diff options
-rw-r--r-- | editeng/source/editeng/editstt2.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 8 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 2 | ||||
-rw-r--r-- | forms/source/richtext/richtextimplcontrol.cxx | 14 | ||||
-rw-r--r-- | include/editeng/editstat.hxx | 40 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 6 | ||||
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 6 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 2 |
12 files changed, 54 insertions, 46 deletions
diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx index 84993a155d5e..44f1ed739c5c 100644 --- a/editeng/source/editeng/editstt2.hxx +++ b/editeng/source/editeng/editstt2.hxx @@ -34,10 +34,10 @@ public: void TurnOffFlags( EEControlBits nFlags ) { nControlBits &= ~nFlags; } - void TurnOnStatusBits( sal_uLong nBits ) + void TurnOnStatusBits( EditStatusFlags nBits ) { nStatusBits |= nBits; } - void TurnOffStatusBits( sal_uLong nBits ) + void TurnOffStatusBits( EditStatusFlags nBits ) { nStatusBits &= ~nBits; } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 0344f54c1ff4..7ac0acc0721f 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -860,9 +860,9 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 } if ( nDiffX ) - pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EE_STAT_HSCROLL; + pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EditStatusFlags::HSCROLL; if ( nDiffY ) - pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EE_STAT_VSCROLL; + pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EditStatusFlags::VSCROLL; Scroll( -nDiffX, -nDiffY ); pEditEngine->pImpEditEngine->DelayedCallStatusHdl(); } @@ -956,7 +956,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 } else { - pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() = pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() | EE_STAT_CURSOROUT; + pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() = pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() | EditStatusFlags::CURSOROUT; GetCursor()->Hide(); GetCursor()->SetPos( Point( -1, -1 ) ); GetCursor()->SetSize( Size( 0, 0 ) ); @@ -1123,7 +1123,7 @@ bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent ) { if ( pEditEngine->GetInternalEditStatus().GetPrevParagraph() != pEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ) ) { - pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EE_STAT_CRSRLEFTPARA; + pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EditStatusFlags::CRSRLEFTPARA; pEditEngine->pImpEditEngine->CallStatusHdl(); } } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 131b09cbd01b..fa62ca2d7ba9 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -886,12 +886,12 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE CursorMoved( aOldPaM.GetNode() ); if ( aStatus.NotifyCursorMovements() && ( aOldPaM.GetNode() != aPaM.GetNode() ) ) { - aStatus.GetStatusWord() = aStatus.GetStatusWord() | EE_STAT_CRSRLEFTPARA; + aStatus.GetStatusWord() = aStatus.GetStatusWord() | EditStatusFlags::CRSRLEFTPARA; aStatus.GetPrevParagraph() = aEditDoc.GetPos( aOldPaM.GetNode() ); } } else - aStatus.GetStatusWord() = aStatus.GetStatusWord() | EE_STAT_CRSRMOVEFAIL; + aStatus.GetStatusWord() = aStatus.GetStatusWord() | EditStatusFlags::CRSRMOVEFAIL; // May cause, an CreateAnchor or deselection all aSelEngine.SetCurView( pEditView ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index c273180e802b..caba43f74ed9 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -428,7 +428,7 @@ void ImpEditEngine::FormatDoc() sal_uInt32 nNewHeight = CalcTextHeight( &nNewHeightNTP ); long nDiff = nNewHeight - nCurTextHeight; if ( nDiff ) - aStatus.GetStatusWord() |= !IsVertical() ? EE_STAT_TEXTHEIGHTCHANGED : EE_STAT_TEXTWIDTHCHANGED; + aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTHEIGHTCHANGED : EditStatusFlags::TEXTWIDTHCHANGED; if ( nNewHeight < nCurTextHeight ) { aInvalidRect.Bottom() = (long)std::max( nNewHeight, nCurTextHeight ); @@ -520,7 +520,7 @@ void ImpEditEngine::CheckAutoPageSize() || ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) ) { // If ahead is centered / right or tabs ... - aStatus.GetStatusWord() |= !IsVertical() ? EE_STAT_TEXTWIDTHCHANGED : EE_STAT_TEXTHEIGHTCHANGED; + aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTWIDTHCHANGED : EditStatusFlags::TEXTHEIGHTCHANGED; for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ ) { // Only paragraphs which are not aligned to the left need to be @@ -4026,7 +4026,7 @@ IMPL_LINK_NOARG_INLINE_END(ImpEditEngine, StatusTimerHdl) void ImpEditEngine::CallStatusHdl() { - if ( aStatusHdlLink.IsSet() && aStatus.GetStatusWord() ) + if ( aStatusHdlLink.IsSet() && bool(aStatus.GetStatusWord()) ) { // The Status has to be reset before the Call, // since other Flags might be set in the handler... diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 5c1a50628364..6bcd3a9088a1 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2378,7 +2378,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC // Invalidate? if ( nPaintFrom>=0 ) { - aStatus.GetStatusWord() |= EE_STAT_WRONGWORDCHANGED; + aStatus.GetStatusWord() |= EditStatusFlags::WRONGWORDCHANGED; CallStatusHdl(); if (!aEditViews.empty()) diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index bb8385455c10..1d1efb297cea 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -274,22 +274,22 @@ namespace frm void RichTextControlImpl::EditEngineStatusChanged( const EditStatus& _rStatus ) { - sal_uLong nStatusWord( _rStatus.GetStatusWord() ); - if ( ( nStatusWord & EE_STAT_TEXTWIDTHCHANGED ) - || ( nStatusWord & EE_STAT_TEXTHEIGHTCHANGED ) + EditStatusFlags nStatusWord( _rStatus.GetStatusWord() ); + if ( ( nStatusWord & EditStatusFlags::TEXTWIDTHCHANGED ) + || ( nStatusWord & EditStatusFlags::TEXTHEIGHTCHANGED ) ) { - if ( ( nStatusWord & EE_STAT_TEXTHEIGHTCHANGED ) && windowHasAutomaticLineBreak() ) + if ( ( nStatusWord & EditStatusFlags::TEXTHEIGHTCHANGED ) && windowHasAutomaticLineBreak() ) m_pEngine->SetPaperSize( Size( m_pEngine->GetPaperSize().Width(), m_pEngine->GetTextHeight() ) ); updateScrollbars(); } - bool bHScroll = 0 != ( nStatusWord & EE_STAT_HSCROLL ); - bool bVScroll = 0 != ( nStatusWord & EE_STAT_VSCROLL ); + bool bHScroll = bool( nStatusWord & EditStatusFlags::HSCROLL ); + bool bVScroll = bool( nStatusWord & EditStatusFlags::VSCROLL ); // In case of *no* automatic line breaks, we also need to check for the *range* here. - // Normally, we would do this only after a EE_STAT_TEXTWIDTHCHANGED. However, due to a bug + // Normally, we would do this only after a EditStatusFlags::TEXTWIDTHCHANGED. However, due to a bug // in the EditEngine (I believe so) this is not fired when the engine does not have // the AutoPaperSize bits set. // So in order to be properly notified, we would need the AutoPaperSize. But, with diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx index 59461a0c2cfe..2c2f5f8570df 100644 --- a/include/editeng/editstat.hxx +++ b/include/editeng/editstat.hxx @@ -77,17 +77,25 @@ namespace o3tl template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xff> {}; } -#define EE_STAT_HSCROLL 0x00000001 -#define EE_STAT_VSCROLL 0x00000002 -#define EE_STAT_CURSOROUT 0x00000004 -#define EE_STAT_CRSRMOVEFAIL 0x00000008 -#define EE_STAT_CRSRLEFTPARA 0x00000010 -#define EE_STAT_TEXTWIDTHCHANGED 0x00000020 -#define EE_STAT_TEXTHEIGHTCHANGED 0x00000040 -#define EE_STAT_WRONGWORDCHANGED 0x00000080 +enum class EditStatusFlags +{ + NONE = 0x0000, + HSCROLL = 0x0001, + VSCROLL = 0x0002, + CURSOROUT = 0x0004, + CRSRMOVEFAIL = 0x0008, + CRSRLEFTPARA = 0x0010, + TEXTWIDTHCHANGED = 0x0020, + TEXTHEIGHTCHANGED = 0x0040, + WRONGWORDCHANGED = 0x0080 +}; +namespace o3tl +{ + template<> struct typed_flags<EditStatusFlags> : is_typed_flags<EditStatusFlags, 0xff> {}; +} /* - EE_STAT_CRSRLEFTPARA at the time cursor movement and the enter. + EditStatusFlags::CRSRLEFTPARA at the time cursor movement and the enter. */ inline void SetFlags( EEControlBits& rBits, EEControlBits nMask, bool bOn ) @@ -109,19 +117,19 @@ inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn ) class EditStatus { protected: - sal_uLong nStatusBits; - EEControlBits nControlBits; - sal_Int32 nPrevPara; // for EE_STAT_CRSRLEFTPARA + EditStatusFlags nStatusBits; + EEControlBits nControlBits; + sal_Int32 nPrevPara; // for EditStatusFlags::CRSRLEFTPARA public: - EditStatus() { nStatusBits = 0; nControlBits = EEControlBits::NONE; nPrevPara = -1; } + EditStatus() { nStatusBits = EditStatusFlags::NONE; nControlBits = EEControlBits::NONE; nPrevPara = -1; } - void Clear() { nStatusBits = 0; } + void Clear() { nStatusBits = EditStatusFlags::NONE; } void SetControlBits( EEControlBits nMask, bool bOn ) { SetFlags( nControlBits, nMask, bOn ); } - sal_uLong GetStatusWord() const { return nStatusBits; } - sal_uLong& GetStatusWord() { return nStatusBits; } + EditStatusFlags GetStatusWord() const { return nStatusBits; } + EditStatusFlags& GetStatusWord() { return nStatusBits; } EEControlBits GetControlWord() const { return nControlBits; } EEControlBits& GetControlWord() { return nControlBits; } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 9881145b3a71..12fb75fb138c 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5463,8 +5463,8 @@ struct SpellCheckStatus IMPL_LINK(SpellCheckStatus, EventHdl, EditStatus*, pStatus) { - sal_uLong nStatus = pStatus->GetStatusWord(); - if (nStatus & EE_STAT_WRONGWORDCHANGED) + EditStatusFlags nStatus = pStatus->GetStatusWord(); + if (nStatus & EditStatusFlags::WRONGWORDCHANGED) mbModified = true; return 0; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 5d7a93b9a355..3d2f772f54c7 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1108,13 +1108,13 @@ IMPL_LINK_NOARG_INLINE_END(ScViewData, EmptyEditHdl) IMPL_LINK( ScViewData, EditEngineHdl, EditStatus *, pStatus ) { - sal_uLong nStatus = pStatus->GetStatusWord(); - if (nStatus & (EE_STAT_HSCROLL | EE_STAT_TEXTHEIGHTCHANGED | EE_STAT_TEXTWIDTHCHANGED | EE_STAT_CURSOROUT)) + EditStatusFlags nStatus = pStatus->GetStatusWord(); + if (nStatus & (EditStatusFlags::HSCROLL | EditStatusFlags::TEXTHEIGHTCHANGED | EditStatusFlags::TEXTWIDTHCHANGED | EditStatusFlags::CURSOROUT)) { EditGrowY(); EditGrowX(); - if (nStatus & EE_STAT_CURSOROUT) + if (nStatus & EditStatusFlags::CURSOROUT) { ScSplitPos eWhich = GetActivePart(); if (pEditView[eWhich]) diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 7543c77243d1..48ac39eb684d 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -959,8 +959,8 @@ void SdDrawDocument::RemoveObject(SdrObject* pObj, SdPage* /*pPage*/) // Callback for ExecuteSpellPopup() IMPL_LINK(SdDrawDocument, OnlineSpellEventHdl, EditStatus*, pEditStat) { - sal_uLong nStat = pEditStat->GetStatusWord(); - mbHasOnlineSpellErrors = (nStat & EE_STAT_WRONGWORDCHANGED) != 0; + EditStatusFlags nStat = pEditStat->GetStatusWord(); + mbHasOnlineSpellErrors = bool(nStat & EditStatusFlags::WRONGWORDCHANGED); return 0; } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 56d3ee61ee9d..597777dcfa8a 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1918,9 +1918,9 @@ void SdrTextObj::SetTextAnimationAllowed(bool bNew) /** called from the SdrObjEditView during text edit when the status of the edit outliner changes */ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus ) { - const sal_uInt32 nStat = pEditStatus->GetStatusWord(); - const bool bGrowX=(nStat & EE_STAT_TEXTWIDTHCHANGED) !=0; - const bool bGrowY=(nStat & EE_STAT_TEXTHEIGHTCHANGED) !=0; + const EditStatusFlags nStat = pEditStatus->GetStatusWord(); + const bool bGrowX = bool(nStat & EditStatusFlags::TEXTWIDTHCHANGED); + const bool bGrowY = bool(nStat & EditStatusFlags::TEXTHEIGHTCHANGED); if(bTextFrame && (bGrowX || bGrowY)) { if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight())) diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 15016d4595e2..f2b4692a327a 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1338,7 +1338,7 @@ bool SdrTableObj::IsTextEditActive( const CellPos& rPos ) void SdrTableObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus ) { - if( (pEditStatus->GetStatusWord() & EE_STAT_TEXTHEIGHTCHANGED) && mpImpl && mpImpl->mpLayouter ) + if( (pEditStatus->GetStatusWord() & EditStatusFlags::TEXTHEIGHTCHANGED) && mpImpl && mpImpl->mpLayouter ) { Rectangle aRect0( maRect ); maRect = maLogicRect; |