summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-12-08 10:26:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-12-08 12:35:09 +0000
commita66731982e93cdcc5beaa5b0586a7f12a7fc0ef6 (patch)
tree19064090be4d97781c16aa6e79a4f7a09d561ae9 /editeng
parent20475c78db5c62f2c8711e59753476bd9b4e2f1c (diff)
convert SFX_HINT to scoped enum
Notes (*) In SC, BULK_DATACHANGED was or'ed into the hint id. Replaced with a dynamic_cast check. (*) In SC, removed the hint id field from ScIndexHint, no point in storing the hint id twice (*) Fold the SfxStyleSheetHintId enum into the new SfxHintId enum, no point in storing two different hint ids (*) In some cases, multiple #define's used to map to the same SFX_HINT value (notably the SFX_HINT_USER* values). I made all of those separate values. Change-Id: I990e2fb587335ebc51c9005588c6a44f768d9de5 Reviewed-on: https://gerrit.libreoffice.org/31751 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editeng.cxx2
-rw-r--r--editeng/source/editeng/impedit3.cxx4
-rw-r--r--editeng/source/editeng/impedit5.cxx31
-rw-r--r--editeng/source/uno/unoedhlp.cxx28
4 files changed, 32 insertions, 33 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index e4b0fb0afe4c..8f37954ce5ea 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2475,7 +2475,7 @@ void EditEngine::ParagraphHeightChanged( sal_Int32 nPara )
if ( GetNotifyHdl().IsSet() )
{
- EENotify aNotify( EE_NOTIFY_TEXTHEIGHTCHANGED );
+ EENotify aNotify( EE_NOTIFY_TextHeightChanged );
aNotify.pEditEngine = this;
aNotify.nParagraph = nPara;
pImpEditEngine->CallNotify( aNotify );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 2331fe1c179b..bcfb89e8bddc 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -425,7 +425,7 @@ void ImpEditEngine::FormatDoc()
sal_uInt32 nNewHeight = CalcTextHeight( &nNewHeightNTP );
long nDiff = nNewHeight - nCurTextHeight;
if ( nDiff )
- aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTHEIGHTCHANGED : EditStatusFlags::TEXTWIDTHCHANGED;
+ aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TextHeightChanged : EditStatusFlags::TEXTWIDTHCHANGED;
if ( nNewHeight < nCurTextHeight )
{
aInvalidRect.Bottom() = (long)std::max( nNewHeight, nCurTextHeight );
@@ -516,7 +516,7 @@ void ImpEditEngine::CheckAutoPageSize()
|| ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) )
{
// If ahead is centered / right or tabs ...
- aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTWIDTHCHANGED : EditStatusFlags::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
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 1b3c5b382b0d..100af463f818 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -143,32 +143,31 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if ( !bDowning )
{
- SfxStyleSheet* pStyle = nullptr;
- sal_uInt32 nId = 0;
-
const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
if ( pStyleSheetHint )
{
DBG_ASSERT( dynamic_cast< const SfxStyleSheet* >(pStyleSheetHint->GetStyleSheet()) != nullptr, "No SfxStyleSheet!" );
- pStyle = static_cast<SfxStyleSheet*>( pStyleSheetHint->GetStyleSheet() );
- nId = pStyleSheetHint->GetHint();
+ SfxStyleSheet* pStyle = static_cast<SfxStyleSheet*>( pStyleSheetHint->GetStyleSheet() );
+ SfxHintId nId = pStyleSheetHint->GetId();
+ if ( ( nId == SfxHintId::StyleSheetInDestruction ) ||
+ ( nId == SfxHintId::StyleSheetErased ) )
+ {
+ RemoveStyleFromParagraphs( pStyle );
+ }
+ else if ( nId == SfxHintId::StyleSheetModified )
+ {
+ UpdateParagraphsWithStyleSheet( pStyle );
+ }
}
else if ( dynamic_cast< const SfxStyleSheet* >(&rBC) != nullptr )
{
- pStyle = static_cast<SfxStyleSheet*>(&rBC);
- nId = rHint.GetId();
- }
-
- if ( pStyle )
- {
- if ( ( nId == SFX_HINT_DYING ) ||
- ( nId == SfxStyleSheetHintId::INDESTRUCTION ) ||
- ( nId == SfxStyleSheetHintId::ERASED ) )
+ SfxStyleSheet* pStyle = static_cast<SfxStyleSheet*>(&rBC);
+ SfxHintId nId = rHint.GetId();
+ if ( nId == SfxHintId::Dying )
{
RemoveStyleFromParagraphs( pStyle );
}
- else if ( ( nId == SFX_HINT_DATACHANGED ) ||
- ( nId == SfxStyleSheetHintId::MODIFIED ) )
+ else if ( nId == SfxHintId::DataChanged )
{
UpdateParagraphsWithStyleSheet( pStyle );
}
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 268d18872cd5..646d009d0b20 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -26,14 +26,14 @@
#include <osl/diagnose.h>
-SvxEditSourceHint::SvxEditSourceHint( sal_uInt32 _nId ) :
+SvxEditSourceHint::SvxEditSourceHint( SfxHintId _nId ) :
TextHint( _nId ),
mnStart( 0 ),
mnEnd( 0 )
{
}
-SvxEditSourceHint::SvxEditSourceHint( sal_uInt32 _nId, sal_uLong nValue, sal_Int32 nStart, sal_Int32 nEnd ) :
+SvxEditSourceHint::SvxEditSourceHint( SfxHintId _nId, sal_uLong nValue, sal_Int32 nStart, sal_Int32 nEnd ) :
TextHint( _nId, nValue ),
mnStart( nStart),
mnEnd( nEnd )
@@ -48,37 +48,37 @@ SvxEditSourceHint::SvxEditSourceHint( sal_uInt32 _nId, sal_uLong nValue, sal_Int
switch( aNotify->eNotificationType )
{
case EE_NOTIFY_TEXTMODIFIED:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_MODIFIED, aNotify->nParagraph ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextModified, aNotify->nParagraph ) );
case EE_NOTIFY_PARAGRAPHINSERTED:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAINSERTED, aNotify->nParagraph ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextParaInserted, aNotify->nParagraph ) );
case EE_NOTIFY_PARAGRAPHREMOVED:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAREMOVED, aNotify->nParagraph ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextParaRemoved, aNotify->nParagraph ) );
case EE_NOTIFY_PARAGRAPHSMOVED:
- return ::std::unique_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_PARASMOVED, aNotify->nParagraph, aNotify->nParam1, aNotify->nParam2 ) );
+ return ::std::unique_ptr<SfxHint>( new SvxEditSourceHint( SfxHintId::EditSourceParasMoved, aNotify->nParagraph, aNotify->nParam1, aNotify->nParam2 ) );
- case EE_NOTIFY_TEXTHEIGHTCHANGED:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_TEXTHEIGHTCHANGED, aNotify->nParagraph ) );
+ case EE_NOTIFY_TextHeightChanged:
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextHeightChanged, aNotify->nParagraph ) );
case EE_NOTIFY_TEXTVIEWSCROLLED:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_VIEWSCROLLED ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextViewScrolled ) );
case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED:
- return ::std::unique_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_SELECTIONCHANGED ) );
+ return ::std::unique_ptr<SfxHint>( new SvxEditSourceHint( SfxHintId::EditSourceSelectionChanged ) );
case EE_NOTIFY_BLOCKNOTIFICATION_START:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_START, 0 ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextBlockNotificationStart, 0 ) );
case EE_NOTIFY_BLOCKNOTIFICATION_END:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_END, 0 ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextBlockNotificationEnd, 0 ) );
case EE_NOTIFY_INPUT_START:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_START, 0 ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextInputStart, 0 ) );
case EE_NOTIFY_INPUT_END:
- return ::std::unique_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) );
+ return ::std::unique_ptr<SfxHint>( new TextHint( SfxHintId::TextInputEnd, 0 ) );
case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA:
return ::std::unique_ptr<SfxHint>( new SvxEditSourceHintEndPara );
default: