summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx82
-rw-r--r--svx/source/accessibility/GraphCtlAccessibleContext.cxx2
-rw-r--r--svx/source/dialog/svxruler.cxx2
-rw-r--r--svx/source/form/fmundo.cxx7
-rw-r--r--svx/source/form/navigatortreemodel.cxx5
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx13
-rw-r--r--svx/source/sdr/properties/customshapeproperties.cxx9
-rw-r--r--svx/source/sdr/properties/textproperties.cxx8
-rw-r--r--svx/source/svdraw/svdoattr.cxx2
-rw-r--r--svx/source/svdraw/svdoedge.cxx10
-rw-r--r--svx/source/svdraw/svdotext.cxx2
-rw-r--r--svx/source/svdraw/svdpage.cxx5
-rw-r--r--svx/source/svdraw/svdpntv.cxx2
-rw-r--r--svx/source/table/svdotable.cxx2
-rw-r--r--svx/source/unodraw/unoshtxt.cxx4
15 files changed, 74 insertions, 81 deletions
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index 39ad4c88b44e..e3b392258ee0 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -991,7 +991,7 @@ namespace accessibility
/** functor processing queue events
- Reacts on TEXT_HINT_PARAINSERTED/REMOVED events and stores
+ Reacts on SfxHintId::TextParaInserted/REMOVED events and stores
their content
*/
class AccessibleTextHelper_QueueFunctor : public ::std::unary_function< const SfxHint*, void >
@@ -1000,7 +1000,7 @@ namespace accessibility
AccessibleTextHelper_QueueFunctor() :
mnParasChanged( 0 ),
mnParaIndex(-1),
- mnHintId(-1)
+ mnHintId(SfxHintId::NONE)
{}
void operator()( const SfxHint* pEvent )
{
@@ -1012,8 +1012,8 @@ namespace accessibility
const SvxEditSourceHint* pEditSourceHint = dynamic_cast<const SvxEditSourceHint*>( pEvent );
if( !pEditSourceHint && pTextHint &&
- (pTextHint->GetId() == TEXT_HINT_PARAINSERTED ||
- pTextHint->GetId() == TEXT_HINT_PARAREMOVED ) )
+ (pTextHint->GetId() == SfxHintId::TextParaInserted ||
+ pTextHint->GetId() == SfxHintId::TextParaRemoved ) )
{
if( pTextHint->GetValue() == EE_PARA_ALL )
{
@@ -1045,7 +1045,7 @@ namespace accessibility
@return hint id of last interesting event (REMOVED/INSERTED).
*/
- int GetHintId() { return mnHintId; }
+ SfxHintId GetHintId() { return mnHintId; }
private:
/** number of paragraphs changed during queue processing. -1 for
@@ -1055,7 +1055,7 @@ namespace accessibility
/// index of paragraph added/removed last
sal_Int32 mnParaIndex;
/// TextHint ID (removed/inserted) of last interesting event
- int mnHintId;
+ SfxHintId mnHintId;
};
void AccessibleTextHelper_Impl::ProcessQueue()
@@ -1083,7 +1083,7 @@ namespace accessibility
// #103483# Exactly one paragraph added/removed. This is
// the normal case, optimize event handling here.
- if( aFunctor.GetHintId() == TEXT_HINT_PARAINSERTED )
+ if( aFunctor.GetHintId() == SfxHintId::TextParaInserted )
{
// update num of paras
maParaManager.SetNum( nNewParas );
@@ -1110,7 +1110,7 @@ namespace accessibility
OSL_FAIL("AccessibleTextHelper_Impl::ProcessQueue: could not create new paragraph");
}
}
- else if( aFunctor.GetHintId() == TEXT_HINT_PARAREMOVED )
+ else if( aFunctor.GetHintId() == SfxHintId::TextParaRemoved )
{
::accessibility::AccessibleParaManager::VectorOfChildren::const_iterator begin = maParaManager.begin();
::std::advance( begin, aFunctor.GetParaIndex() );
@@ -1185,7 +1185,7 @@ namespace accessibility
{
switch( pEditSourceHint->GetId() )
{
- case EDITSOURCE_HINT_PARASMOVED:
+ case SfxHintId::EditSourceParasMoved:
{
DBG_ASSERT( pEditSourceHint->GetStartValue() < GetTextForwarder().GetParagraphCount() &&
pEditSourceHint->GetEndValue() < GetTextForwarder().GetParagraphCount(),
@@ -1203,7 +1203,7 @@ namespace accessibility
break;
}
- case EDITSOURCE_HINT_SELECTIONCHANGED:
+ case SfxHintId::EditSourceSelectionChanged:
// notify listeners
try
{
@@ -1212,13 +1212,14 @@ namespace accessibility
// maybe we're not in edit mode (this is not an error)
catch( const uno::Exception& ) {}
break;
+ default: break;
}
}
else if( pTextHint )
{
switch( pTextHint->GetId() )
{
- case TEXT_HINT_MODIFIED:
+ case SfxHintId::TextModified:
{
// notify listeners
sal_Int32 nPara( pTextHint->GetValue() );
@@ -1242,21 +1243,22 @@ namespace accessibility
break;
}
- case TEXT_HINT_PARAINSERTED:
+ case SfxHintId::TextParaInserted:
// already happened above
break;
- case TEXT_HINT_PARAREMOVED:
+ case SfxHintId::TextParaRemoved:
// already happened above
break;
- case TEXT_HINT_TEXTHEIGHTCHANGED:
+ case SfxHintId::TextHeightChanged:
// visibility changed, done below
break;
- case TEXT_HINT_VIEWSCROLLED:
+ case SfxHintId::TextViewScrolled:
// visibility changed, done below
break;
+ default: break;
}
// in all cases, check visibility afterwards.
@@ -1306,22 +1308,16 @@ namespace accessibility
}
}
// it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above!
- else if( rHint.GetId() )
+ else if( rHint.GetId() == SfxHintId::Dying)
{
- switch( rHint.GetId() )
+ // edit source is dying under us, become defunc then
+ try
{
- case SFX_HINT_DYING:
- // edit source is dying under us, become defunc then
- try
- {
- // make edit source inaccessible
- // Note: cannot destroy it here, since we're called from there!
- ShutdownEditSource();
- }
- catch( const uno::Exception& ) {}
-
- break;
+ // make edit source inaccessible
+ // Note: cannot destroy it here, since we're called from there!
+ ShutdownEditSource();
}
+ catch( const uno::Exception& ) {}
}
}
catch( const uno::Exception& )
@@ -1384,8 +1380,8 @@ namespace accessibility
{
switch( pTextHint->GetId() )
{
- case TEXT_HINT_BLOCKNOTIFICATION_END:
- case TEXT_HINT_INPUT_END:
+ case SfxHintId::TextBlockNotificationEnd:
+ case SfxHintId::TextInputEnd:
--maEventOpenFrames;
if( maEventOpenFrames == 0 )
@@ -1411,8 +1407,8 @@ namespace accessibility
}
break;
- case TEXT_HINT_BLOCKNOTIFICATION_START:
- case TEXT_HINT_INPUT_START:
+ case SfxHintId::TextBlockNotificationStart:
+ case SfxHintId::TextInputStart:
++maEventOpenFrames;
// no FALLTHROUGH reason: event will not be processed,
// thus appending the event isn't necessary. (#i27299#)
@@ -1426,24 +1422,18 @@ namespace accessibility
}
}
// it's VITAL to keep the SfxHint last! It's the base of the classes above!
- else if( rHint.GetId() )
+ else if( rHint.GetId() == SfxHintId::Dying )
{
// handle this event _at once_, because after that, objects are invalid
- switch( rHint.GetId() )
+ // edit source is dying under us, become defunc then
+ maEventQueue.Clear();
+ try
{
- case SFX_HINT_DYING:
- // edit source is dying under us, become defunc then
- maEventQueue.Clear();
- try
- {
- // make edit source inaccessible
- // Note: cannot destroy it here, since we're called from there!
- ShutdownEditSource();
- }
- catch( const uno::Exception& ) {}
-
- break;
+ // make edit source inaccessible
+ // Note: cannot destroy it here, since we're called from there!
+ ShutdownEditSource();
}
+ catch( const uno::Exception& ) {}
}
}
catch( const uno::Exception& )
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 261bb8cc1579..6f7e27cf8a13 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -747,7 +747,7 @@ void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHi
else
{
// Has our SdDrawDocument just died?
- if(rHint.GetId() == SFX_HINT_DYING)
+ if(rHint.GetId() == SfxHintId::Dying)
{
dispose();
}
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 9cd586654e31..e5b256036021 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -3336,7 +3336,7 @@ void SvxRuler::Notify(SfxBroadcaster&, const SfxHint& rHint)
*/
// start update
- if (bActive && rHint.GetId() == SFX_HINT_UPDATEDONE)
+ if (bActive && rHint.GetId() == SfxHintId::UpdateDone)
{
Update();
EndListening(*pBindings);
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index e70361d6d91b..da616c8bf9fe 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -305,17 +305,18 @@ void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
break;
}
}
- else if (rHint.GetId())
+ else if (rHint.GetId() != SfxHintId::NONE)
{
switch (rHint.GetId())
{
- case SFX_HINT_DYING:
+ case SfxHintId::Dying:
dispose();
rModel.SetObjectShell( nullptr );
break;
- case SFX_HINT_MODECHANGED:
+ case SfxHintId::ModeChanged:
ModeChanged();
break;
+ default: break;
}
}
else if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint))
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index db20c2f75650..8775fe5bd32f 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -701,10 +701,9 @@ namespace svxform
}
}
// is shell gone?
- else if (rHint.GetId())
+ else if (rHint.GetId() == SfxHintId::Dying)
{
- if (rHint.GetId() == SFX_HINT_DYING)
- UpdateContent(nullptr);
+ UpdateContent(nullptr);
}
// changed mark of controls?
else if (const FmNavViewMarksChanged* pvmcHint = dynamic_cast<const FmNavViewMarksChanged*>(&rHint))
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 23cb3d0e945c..5dad59138d08 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -525,21 +525,21 @@ namespace sdr
SdrObject& rObj = GetSdrObject();
//SdrPage* pPage = rObj.GetPage();
- switch(pStyleHint->GetHint())
+ switch(pStyleHint->GetId())
{
- case SfxStyleSheetHintId::CREATED :
+ case SfxHintId::StyleSheetCreated :
{
// cannot happen, nothing to do
break;
}
- case SfxStyleSheetHintId::MODIFIED :
- case SfxStyleSheetHintId::CHANGED :
+ case SfxHintId::StyleSheetModified :
+ case SfxHintId::StyleSheetChanged :
{
// notify change
break;
}
- case SfxStyleSheetHintId::ERASED :
- case SfxStyleSheetHintId::INDESTRUCTION :
+ case SfxHintId::StyleSheetErased :
+ case SfxHintId::StyleSheetInDestruction :
{
// Style needs to be exchanged
SfxStyleSheet* pNewStSh = nullptr;
@@ -572,6 +572,7 @@ namespace sdr
break;
}
+ default: break;
}
// Get old BoundRect. Do this after the style change is handled
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
index 6246d5804971..2f7c2fd0f5f2 100644
--- a/svx/source/sdr/properties/customshapeproperties.cxx
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -215,15 +215,16 @@ namespace sdr
if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() )
{
- switch( pStyleHint->GetHint() )
+ switch( pStyleHint->GetId() )
{
- case SfxStyleSheetHintId::MODIFIED :
- case SfxStyleSheetHintId::CHANGED :
+ case SfxHintId::StyleSheetModified :
+ case SfxHintId::StyleSheetChanged :
bRemoveRenderGeometry = true;
break;
+ default: break;
};
}
- else if ( rHint.GetId() == SFX_HINT_DATACHANGED )
+ else if ( rHint.GetId() == SfxHintId::DataChanged )
{
bRemoveRenderGeometry = true;
}
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index e87d52509653..884f9be39bca 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -554,9 +554,9 @@ namespace sdr
const svx::ITextProvider& rTextProvider(getTextProvider());
if(dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr)
{
- sal_uInt32 nId(rHint.GetId());
+ SfxHintId nId(rHint.GetId());
- if(SFX_HINT_DATACHANGED == nId)
+ if(SfxHintId::DataChanged == nId)
{
rObj.SetPortionInfoChecked(false);
@@ -580,7 +580,7 @@ namespace sdr
maVersion++;
}
- if(SFX_HINT_DYING == nId)
+ if(SfxHintId::Dying == nId)
{
rObj.SetPortionInfoChecked(false);
sal_Int32 nText = rTextProvider.getTextCount();
@@ -597,7 +597,7 @@ namespace sdr
const SfxStyleSheetHintExtended* pExtendedHint = dynamic_cast<const SfxStyleSheetHintExtended*>(&rHint);
if(pExtendedHint
- && SfxStyleSheetHintId::MODIFIED == pExtendedHint->GetHint())
+ && SfxHintId::StyleSheetModified == pExtendedHint->GetId())
{
OUString aOldName(pExtendedHint->GetOldName());
OUString aNewName(pExtendedHint->GetStyleSheet()->GetName());
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
index a188e1d2a105..964bf6388d9c 100644
--- a/svx/source/svdraw/svdoattr.cxx
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -121,7 +121,7 @@ void SdrAttrObj::SetModel(SdrModel* pNewModel)
void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
{
- bool bDataChg(SFX_HINT_DATACHANGED == rHint.GetId());
+ bool bDataChg(SfxHintId::DataChanged == rHint.GetId());
if(bDataChg)
{
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 5b7c594e5730..1dca9ab9b943 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1561,9 +1561,9 @@ line (CL). The number of object margins per object varies between 0 and 3:
void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
- const sal_uInt32 nId = rHint.GetId();
- bool bDataChg=nId==SFX_HINT_DATACHANGED;
- bool bDying=nId==SFX_HINT_DYING;
+ const SfxHintId nId = rHint.GetId();
+ bool bDataChg=nId==SfxHintId::DataChanged;
+ bool bDying=nId==SfxHintId::Dying;
bool bObj1=aCon1.pObj!=nullptr && aCon1.pObj->GetBroadcaster()==&rBC;
bool bObj2=aCon2.pObj!=nullptr && aCon2.pObj->GetBroadcaster()==&rBC;
if (bDying && (bObj1 || bObj2)) {
@@ -1609,13 +1609,13 @@ void SdrEdgeObj::Reformat()
{
if( nullptr != aCon1.pObj )
{
- SfxHint aHint( SFX_HINT_DATACHANGED );
+ SfxHint aHint( SfxHintId::DataChanged );
Notify( *const_cast<SfxBroadcaster*>(aCon1.pObj->GetBroadcaster()), aHint );
}
if( nullptr != aCon2.pObj )
{
- SfxHint aHint( SFX_HINT_DATACHANGED );
+ SfxHint aHint( SfxHintId::DataChanged );
Notify( *const_cast<SfxBroadcaster*>(aCon2.pObj->GetBroadcaster()), aHint );
}
}
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index f052d6964c1a..b40fd8bd9176 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1929,7 +1929,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
{
const EditStatusFlags nStat = pEditStatus->GetStatusWord();
const bool bGrowX = bool(nStat & EditStatusFlags::TEXTWIDTHCHANGED);
- const bool bGrowY = bool(nStat & EditStatusFlags::TEXTHEIGHTCHANGED);
+ const bool bGrowY = bool(nStat & EditStatusFlags::TextHeightChanged);
if(bTextFrame && (bGrowX || bGrowY))
{
if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index c24ee3560094..4a7ef86fd10e 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1101,18 +1101,19 @@ void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
{
switch(rHint.GetId())
{
- case SFX_HINT_DATACHANGED :
+ case SfxHintId::DataChanged :
{
// notify change, broadcast
ImpPageChange(*mpSdrPage);
break;
}
- case SFX_HINT_DYING :
+ case SfxHintId::Dying :
{
// Style needs to be forgotten
ImpRemoveStyleSheet();
break;
}
+ default: break;
}
}
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index ba49f814d698..0642d39f5cee 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -231,7 +231,7 @@ void SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
//If the stylesheet has been destroyed
if (&rBC == mpDefaultStyleSheet)
{
- if (rHint.GetId() == SFX_HINT_DYING)
+ if (rHint.GetId() == SfxHintId::Dying)
mpDefaultStyleSheet = nullptr;
return;
}
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 0f448535b777..c951223827f1 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1313,7 +1313,7 @@ bool SdrTableObj::IsTextEditActive( const CellPos& rPos )
void SdrTableObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
{
- if( (pEditStatus->GetStatusWord() & EditStatusFlags::TEXTHEIGHTCHANGED) && mpImpl.is() && mpImpl->mpLayouter )
+ if( (pEditStatus->GetStatusWord() & EditStatusFlags::TextHeightChanged) && mpImpl.is() && mpImpl->mpLayouter )
{
Rectangle aRect0( maRect );
maRect = maLogicRect;
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 3a5705f64508..11b57fa15b5c 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -317,7 +317,7 @@ void SvxTextEditSourceImpl::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
// #i105988 keep reference to this object
rtl::Reference< SvxTextEditSourceImpl > xThis( this );
- if (SFX_HINT_DYING == rHint.GetId())
+ if (SfxHintId::Dying == rHint.GetId())
{
if (&rBC == mpView)
{
@@ -445,7 +445,7 @@ void SvxTextEditSourceImpl::ObjectInDestruction(const SdrObject&)
{
mpObject = nullptr;
dispose();
- Broadcast( SfxHint( SFX_HINT_DYING ) );
+ Broadcast( SfxHint( SfxHintId::Dying ) );
}
/* unregister at all objects and set all references to 0 */