summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-25 10:03:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-25 12:21:22 +0200
commit31a85a9a13595a9aeae1932ee08c9b09ead384cd (patch)
treed3cf4136e21a3acee1ddbf77aca62f3d73c3ed55 /sw/source/uibase
parent2fffaf6f05d829e345ad8b391646a6e8df9a9a26 (diff)
convert UNO event ids to scoped enum
I'm fairly sure there are more simplifications that could be make here. It seems like we have both an ID and a string name for all of these events, and we could probably get by with just one of those, or alternately, centralise the name<->id mapping somewhere Change-Id: I978073822ddbebce94ac5b560fea675bea905a35 Reviewed-on: https://gerrit.libreoffice.org/40392 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx8
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx30
-rw-r--r--sw/source/uibase/inc/unoatxt.hxx8
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx2
-rw-r--r--sw/source/uibase/shells/textfld.cxx12
-rw-r--r--sw/source/uibase/shells/textsh.cxx6
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx18
-rw-r--r--sw/source/uibase/wrtsh/select.cxx4
-rw-r--r--sw/source/uibase/wrtsh/wrtsh2.cxx8
-rw-r--r--sw/source/uibase/wrtsh/wrtsh3.cxx2
10 files changed, 49 insertions, 49 deletions
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 484cdb31b5f4..d6f5c7f7a369 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -571,9 +571,9 @@ void SwGlossaryHdl::SetMacros(const OUString& rShortName,
: rStatGlossaries.GetGroupDoc( aCurGrp );
SvxMacroTableDtor aMacroTable;
if( pStart )
- aMacroTable.Insert( SW_EVENT_START_INS_GLOSSARY, *pStart);
+ aMacroTable.Insert( SvMacroItemId::SwStartInsGlossary, *pStart);
if( pEnd )
- aMacroTable.Insert( SW_EVENT_END_INS_GLOSSARY, *pEnd);
+ aMacroTable.Insert( SvMacroItemId::SwEndInsGlossary, *pEnd);
sal_uInt16 nIdx = pGlos->GetIndex( rShortName );
if( !pGlos->SetMacroTable( nIdx, aMacroTable ) && pGlos->GetError() )
ErrorHandler::HandleError( pGlos->GetError() );
@@ -596,11 +596,11 @@ void SwGlossaryHdl::GetMacros( const OUString &rShortName,
SvxMacroTableDtor aMacroTable;
if( pGlos->GetMacroTable( nIndex, aMacroTable ) )
{
- SvxMacro *pMacro = aMacroTable.Get( SW_EVENT_START_INS_GLOSSARY );
+ SvxMacro *pMacro = aMacroTable.Get( SvMacroItemId::SwStartInsGlossary );
if( pMacro )
rStart = *pMacro;
- pMacro = aMacroTable.Get( SW_EVENT_END_INS_GLOSSARY );
+ pMacro = aMacroTable.Get( SvMacroItemId::SwEndInsGlossary );
if( pMacro )
rEnd = *pMacro;
}
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d33cb06d4918..707f525eab6f 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1487,13 +1487,13 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
const SwFrameFormat* pFlyFormat = rSh.GetFlyFrameFormat();
if( pFlyFormat )
{
- sal_uInt16 nEvent;
+ SvMacroItemId nEvent;
if( 32 <= aCh &&
0 == (( KEY_MOD1 | KEY_MOD2 ) & rKeyCode.GetModifier() ))
- nEvent = SW_EVENT_FRM_KEYINPUT_ALPHA;
+ nEvent = SvMacroItemId::SwFrmKeyInputAlpha;
else
- nEvent = SW_EVENT_FRM_KEYINPUT_NOALPHA;
+ nEvent = SvMacroItemId::SwFrmKeyInputNoAlpha;
const SvxMacro* pMacro = pFlyFormat->GetMacro().GetMacroTable().Get( nEvent );
if( pMacro )
@@ -1504,7 +1504,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
xArgs->Put( xVar.get(), 1 );
xVar = new SbxVariable;
- if( SW_EVENT_FRM_KEYINPUT_ALPHA == nEvent )
+ if( SvMacroItemId::SwFrmKeyInputAlpha == nEvent )
xVar->PutChar( aCh );
else
xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() );
@@ -4020,9 +4020,9 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat());
const SvxMacro* pMacro = nullptr;
- sal_uInt16 nEvent = SdrHdlKind::Move == g_eSdrMoveHdl
- ? SW_EVENT_FRM_MOVE
- : SW_EVENT_FRM_RESIZE;
+ SvMacroItemId nEvent = SdrHdlKind::Move == g_eSdrMoveHdl
+ ? SvMacroItemId::SwFrmMove
+ : SvMacroItemId::SwFrmResize;
if (nullptr != pFlyFormat)
pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent);
@@ -4037,7 +4037,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
xVar->PutString( pFlyFormat->GetName() );
xArgs->Put( xVar.get(), ++nPos );
- if( SW_EVENT_FRM_RESIZE == nEvent )
+ if( SvMacroItemId::SwFrmResize == nEvent )
{
xVar = new SbxVariable;
xVar->PutUShort( static_cast< sal_uInt16 >(g_eSdrMoveHdl) );
@@ -4211,10 +4211,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
if( m_aSaveCallEvent != aLastCallEvent )
{
if( aLastCallEvent.HasEvent() )
- rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT,
+ rSh.CallEvent( SvMacroItemId::OnMouseOut,
aLastCallEvent, true );
// 0 says that the object doesn't have any table
- if( !rSh.CallEvent( SFX_EVENT_MOUSEOVER_OBJECT,
+ if( !rSh.CallEvent( SvMacroItemId::OnMouseOver,
m_aSaveCallEvent ))
m_aSaveCallEvent.Clear();
}
@@ -4222,7 +4222,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
else if( aLastCallEvent.HasEvent() )
{
// cursor was on an object
- rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT,
+ rSh.CallEvent( SvMacroItemId::OnMouseOut,
aLastCallEvent, true );
}
@@ -4483,9 +4483,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat());
const SvxMacro* pMacro = nullptr;
- sal_uInt16 nEvent = SdrHdlKind::Move == eOldSdrMoveHdl
- ? SW_EVENT_FRM_MOVE
- : SW_EVENT_FRM_RESIZE;
+ SvMacroItemId nEvent = SdrHdlKind::Move == eOldSdrMoveHdl
+ ? SvMacroItemId::SwFrmMove
+ : SvMacroItemId::SwFrmResize;
if (nullptr != pFlyFormat)
pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent);
@@ -4499,7 +4499,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
xVar->PutString( pFlyFormat->GetName() );
xArgs->Put( xVar.get(), ++nPos );
- if( SW_EVENT_FRM_RESIZE == nEvent )
+ if( SvMacroItemId::SwFrmResize == nEvent )
{
xVar = new SbxVariable;
xVar->PutUShort( static_cast< sal_uInt16 >(eOldSdrMoveHdl) );
diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx
index 8011c612885f..1b6f1a7fc14b 100644
--- a/sw/source/uibase/inc/unoatxt.hxx
+++ b/sw/source/uibase/inc/unoatxt.hxx
@@ -261,13 +261,13 @@ public:
protected:
virtual void replaceByName(
- const sal_uInt16 nEvent, /// item ID of event
- const SvxMacro& rMacro) /// event (will be copied)
+ const SvMacroItemId nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
override;
virtual void getByName(
- SvxMacro& rMacro, /// macro to be filled
- const sal_uInt16 nEvent ) /// item ID of event
+ SvxMacro& rMacro, /// macro to be filled
+ const SvMacroItemId nEvent ) /// item ID of event
override;
};
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index dd12bc01e27f..bed54a04205f 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -419,7 +419,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
// Because nobody else is doing it, here is a ExecMacro()
void ExecMacro( const SvxMacro& rMacro, OUString* pRet = nullptr, SbxArray* pArgs = nullptr );
// call into the dark Basic/JavaScript
- sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
+ sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
bool bCheckPtr = false );
// a click at the given field. the cursor is on it.
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 41fead859ada..811db69c5d1c 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -918,15 +918,15 @@ void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem)
aINetFormat.SetName(rHlnkItem.GetIntName());
if(pMacroTable)
{
- const SvxMacro *pMacro = pMacroTable->Get( SFX_EVENT_MOUSEOVER_OBJECT );
+ const SvxMacro *pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOver );
if( pMacro )
- aINetFormat.SetMacro(SFX_EVENT_MOUSEOVER_OBJECT, *pMacro);
- pMacro = pMacroTable->Get( SFX_EVENT_MOUSECLICK_OBJECT );
+ aINetFormat.SetMacro(SvMacroItemId::OnMouseOver, *pMacro);
+ pMacro = pMacroTable->Get( SvMacroItemId::OnClick );
if( pMacro )
- aINetFormat.SetMacro(SFX_EVENT_MOUSECLICK_OBJECT, *pMacro);
- pMacro = pMacroTable->Get( SFX_EVENT_MOUSEOUT_OBJECT );
+ aINetFormat.SetMacro(SvMacroItemId::OnClick, *pMacro);
+ pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOut );
if( pMacro )
- aINetFormat.SetMacro(SFX_EVENT_MOUSEOUT_OBJECT, *pMacro);
+ aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro);
}
rSh.SttSelect();
rSh.InsertURL( aINetFormat, rName, true );
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 06c4b6c48b76..c52ab289189a 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -642,15 +642,15 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
aHLinkItem.SetURL(pINetFormat->GetValue());
aHLinkItem.SetTargetFrame(pINetFormat->GetTargetFrame());
aHLinkItem.SetIntName(pINetFormat->GetName());
- const SvxMacro *pMacro = pINetFormat->GetMacro( SFX_EVENT_MOUSEOVER_OBJECT );
+ const SvxMacro *pMacro = pINetFormat->GetMacro( SvMacroItemId::OnMouseOver );
if( pMacro )
aHLinkItem.SetMacro(HyperDialogEvent::MouseOverObject, *pMacro);
- pMacro = pINetFormat->GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ pMacro = pINetFormat->GetMacro( SvMacroItemId::OnClick );
if( pMacro )
aHLinkItem.SetMacro(HyperDialogEvent::MouseClickObject, *pMacro);
- pMacro = pINetFormat->GetMacro( SFX_EVENT_MOUSEOUT_OBJECT );
+ pMacro = pINetFormat->GetMacro( SvMacroItemId::OnMouseOut );
if( pMacro )
aHLinkItem.SetMacro(HyperDialogEvent::MouseOutObject, *pMacro);
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 4ea2e22fc16d..5d57bb4cdc22 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -957,9 +957,9 @@ uno::Reference< container::XNameReplace > SwXAutoTextEntry::getEvents()
const struct SvEventDescription aAutotextEvents[] =
{
- { SW_EVENT_START_INS_GLOSSARY, "OnInsertStart" },
- { SW_EVENT_END_INS_GLOSSARY, "OnInsertDone" },
- { 0, nullptr }
+ { SvMacroItemId::SwStartInsGlossary, "OnInsertStart" },
+ { SvMacroItemId::SwEndInsGlossary, "OnInsertDone" },
+ { SvMacroItemId::NONE, nullptr }
};
SwAutoTextEventDescriptor::SwAutoTextEventDescriptor(
@@ -981,13 +981,13 @@ OUString SwAutoTextEventDescriptor::getImplementationName()
}
void SwAutoTextEventDescriptor::replaceByName(
- const sal_uInt16 nEvent,
+ const SvMacroItemId nEvent,
const SvxMacro& rMacro)
{
OSL_ENSURE( nullptr != rAutoTextEntry.GetGlossaries(),
"Strangely enough, the AutoText vanished!" );
- OSL_ENSURE( (nEvent == SW_EVENT_END_INS_GLOSSARY) ||
- (nEvent == SW_EVENT_START_INS_GLOSSARY) ,
+ OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) ||
+ (nEvent == SvMacroItemId::SwStartInsGlossary) ,
"Unknown event ID" );
SwGlossaries *const pGlossaries =
@@ -1015,11 +1015,11 @@ void SwAutoTextEventDescriptor::replaceByName(
void SwAutoTextEventDescriptor::getByName(
SvxMacro& rMacro,
- const sal_uInt16 nEvent )
+ const SvMacroItemId nEvent )
{
OSL_ENSURE( nullptr != rAutoTextEntry.GetGlossaries(), "no AutoText" );
- OSL_ENSURE( (nEvent == SW_EVENT_END_INS_GLOSSARY) ||
- (nEvent == SW_EVENT_START_INS_GLOSSARY) ,
+ OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) ||
+ (nEvent == SvMacroItemId::SwStartInsGlossary) ,
"Unknown event ID" );
SwGlossaries *const pGlossaries =
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 29bca71acd2b..231902eeb2b2 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -708,9 +708,9 @@ IMPL_LINK( SwWrtShell, ExecFlyMac, const SwFlyFrameFormat*, pFlyFormat, void )
OSL_ENSURE(pFormat, "no frame format");
const SvxMacroItem &rFormatMac = pFormat->GetMacro();
- if(rFormatMac.HasMacro(SW_EVENT_OBJECT_SELECT))
+ if(rFormatMac.HasMacro(SvMacroItemId::SwObjectSelect))
{
- const SvxMacro &rMac = rFormatMac.GetMacro(SW_EVENT_OBJECT_SELECT);
+ const SvxMacro &rMac = rFormatMac.GetMacro(SvMacroItemId::SwObjectSelect);
if( IsFrameSelected() )
m_bLayoutMode = true;
CallChgLnk();
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index f4ed6cc0afa0..ca25cce2f77b 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -414,12 +414,12 @@ void SwWrtShell::ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags
m_bIsInClickToEdit = true;
// At first run the possibly set ObjectSelect Macro
- const SvxMacro* pMac = rItem.GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ const SvxMacro* pMac = rItem.GetMacro( SvMacroItemId::OnClick );
if( pMac )
{
SwCallMouseEvent aCallEvent;
aCallEvent.Set( &rItem );
- GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent );
+ GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent );
}
// So that the implementation of templates is displayed immediately
@@ -444,12 +444,12 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter )
{
bRet = true;
// At first run the possibly set ObjectSelect Macro
- const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SvMacroItemId::OnClick );
if( pMac )
{
SwCallMouseEvent aCallEvent;
aCallEvent.Set( EVENT_OBJECT_URLITEM, pFnd );
- GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent );
+ GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent );
}
::LoadURL(*this, sURL, nFilter, sTargetFrameName);
diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx
index db7de18d251b..63e15214e217 100644
--- a/sw/source/uibase/wrtsh/wrtsh3.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh3.cxx
@@ -157,7 +157,7 @@ void SwWrtShell::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pA
}
}
-sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
+sal_uInt16 SwWrtShell::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
bool bChkPtr)
{
return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr );