Kaydet (Commit) bf84823f authored tarafından Noel Grandin's avatar Noel Grandin

convert SFX_CFG* constants to scoped enum

Change-Id: I7b4769d0616b5685792630bcb82fd0d944505a24
üst 7d6d18e7
...@@ -294,13 +294,13 @@ void SfxConfigFunctionListBox::ClearAll() ...@@ -294,13 +294,13 @@ void SfxConfigFunctionListBox::ClearAll()
{ {
SfxGroupInfo_Impl *pData = &aArr[i]; SfxGroupInfo_Impl *pData = &aArr[i];
if ( pData->nKind == SFX_CFGFUNCTION_SCRIPT ) if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
{ {
OUString* pScriptURI = static_cast<OUString*>(pData->pObject); OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
delete pScriptURI; delete pScriptURI;
} }
if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER ) if ( pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER )
{ {
XInterface* xi = static_cast<XInterface *>(pData->pObject); XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL) if (xi != NULL)
...@@ -320,7 +320,7 @@ OUString SfxConfigFunctionListBox::GetSelectedScriptURI() ...@@ -320,7 +320,7 @@ OUString SfxConfigFunctionListBox::GetSelectedScriptURI()
if ( pEntry ) if ( pEntry )
{ {
SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData()); SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
if ( pData && ( pData->nKind == SFX_CFGFUNCTION_SCRIPT ) ) if ( pData && ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT ) )
return *static_cast<OUString*>(pData->pObject); return *static_cast<OUString*>(pData->pObject);
} }
return OUString(); return OUString();
...@@ -428,7 +428,7 @@ void SfxConfigGroupListBox::ClearAll() ...@@ -428,7 +428,7 @@ void SfxConfigGroupListBox::ClearAll()
for ( sal_uInt16 i=0; i<nCount; ++i ) for ( sal_uInt16 i=0; i<nCount; ++i )
{ {
SfxGroupInfo_Impl *pData = &aArr[i]; SfxGroupInfo_Impl *pData = &aArr[i];
if (pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER) if (pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER)
{ {
XInterface* xi = static_cast<XInterface *>(pData->pObject); XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL) if (xi != NULL)
...@@ -473,7 +473,7 @@ void SfxConfigGroupListBox::InitModule() ...@@ -473,7 +473,7 @@ void SfxConfigGroupListBox::InitModule()
{ continue; } { continue; }
SvTreeListEntry* pEntry = InsertEntry(sGroupName, NULL); SvTreeListEntry* pEntry = InsertEntry(sGroupName, NULL);
SfxGroupInfo_Impl* pInfo = new SfxGroupInfo_Impl(SFX_CFGGROUP_FUNCTION, rGroupID); SfxGroupInfo_Impl* pInfo = new SfxGroupInfo_Impl(SfxCfgKind::GROUP_FUNCTION, rGroupID);
pEntry->SetUserData(pInfo); pEntry->SetUserData(pInfo);
} }
} }
...@@ -584,7 +584,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent ...@@ -584,7 +584,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
rootNode->acquire(); rootNode->acquire();
SfxGroupInfo_Impl *pInfo = SfxGroupInfo_Impl *pInfo =
new SfxGroupInfo_Impl( SFX_CFGGROUP_SCRIPTCONTAINER, 0, new SfxGroupInfo_Impl( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
static_cast<void *>(rootNode.get())); static_cast<void *>(rootNode.get()));
OUString aTitle(pImp->m_sDlgMacros); OUString aTitle(pImp->m_sDlgMacros);
...@@ -655,7 +655,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent ...@@ -655,7 +655,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
theChild->acquire(); theChild->acquire();
SfxGroupInfo_Impl* pInfo = SfxGroupInfo_Impl* pInfo =
new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, new SfxGroupInfo_Impl(SfxCfgKind::GROUP_SCRIPTCONTAINER,
0, static_cast<void *>( theChild.get())); 0, static_cast<void *>( theChild.get()));
Image aImage = GetImage( theChild, xCtx, bIsRootNode ); Image aImage = GetImage( theChild, xCtx, bIsRootNode );
...@@ -696,7 +696,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent ...@@ -696,7 +696,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
{ {
OUString sStyle( pImp->m_aStrGroupStyles ); OUString sStyle( pImp->m_aStrGroupStyles );
SvTreeListEntry *pEntry = InsertEntry( sStyle, 0 ); SvTreeListEntry *pEntry = InsertEntry( sStyle, 0 );
SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, 0 ); // TODO last parameter should contain user data SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SfxCfgKind::GROUP_STYLES, 0, 0 ); // TODO last parameter should contain user data
aArr.push_back( pInfo ); aArr.push_back( pInfo );
pEntry->SetUserData( pInfo ); pEntry->SetUserData( pInfo );
pEntry->EnableChildrenOnDemand( true ); pEntry->EnableChildrenOnDemand( true );
...@@ -837,9 +837,9 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -837,9 +837,9 @@ void SfxConfigGroupListBox::GroupSelected()
SfxGroupInfo_Impl *pInfo = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData()); SfxGroupInfo_Impl *pInfo = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
pFunctionListBox->SetUpdateMode(false); pFunctionListBox->SetUpdateMode(false);
pFunctionListBox->ClearAll(); pFunctionListBox->ClearAll();
if ( pInfo->nKind != SFX_CFGGROUP_FUNCTION && if ( pInfo->nKind != SfxCfgKind::GROUP_FUNCTION &&
pInfo->nKind != SFX_CFGGROUP_SCRIPTCONTAINER && pInfo->nKind != SfxCfgKind::GROUP_SCRIPTCONTAINER &&
pInfo->nKind != SFX_CFGGROUP_STYLES ) pInfo->nKind != SfxCfgKind::GROUP_STYLES )
{ {
pFunctionListBox->SetUpdateMode(true); pFunctionListBox->SetUpdateMode(true);
return; return;
...@@ -847,7 +847,7 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -847,7 +847,7 @@ void SfxConfigGroupListBox::GroupSelected()
switch ( pInfo->nKind ) switch ( pInfo->nKind )
{ {
case SFX_CFGGROUP_FUNCTION : case SfxCfgKind::GROUP_FUNCTION :
{ {
sal_uInt16 nGroup = pInfo->nUniqueID; sal_uInt16 nGroup = pInfo->nUniqueID;
css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW); css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
...@@ -860,7 +860,7 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -860,7 +860,7 @@ void SfxConfigGroupListBox::GroupSelected()
const css::frame::DispatchInformation& rInfo = lCommands[i]; const css::frame::DispatchInformation& rInfo = lCommands[i];
OUString sUIName = MapCommand2UIName(rInfo.Command); OUString sUIName = MapCommand2UIName(rInfo.Command);
SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName, NULL); SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName, NULL);
SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl(SFX_CFGFUNCTION_SLOT, 0); SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl(SfxCfgKind::FUNCTION_SLOT, 0);
pGrpInfo->sCommand = rInfo.Command; pGrpInfo->sCommand = rInfo.Command;
pGrpInfo->sLabel = sUIName; pGrpInfo->sLabel = sUIName;
pFuncEntry->SetUserData(pGrpInfo); pFuncEntry->SetUserData(pGrpInfo);
...@@ -869,7 +869,7 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -869,7 +869,7 @@ void SfxConfigGroupListBox::GroupSelected()
break; break;
} }
case SFX_CFGGROUP_SCRIPTCONTAINER: case SfxCfgKind::GROUP_SCRIPTCONTAINER:
{ {
if ( !GetChildCount( pEntry ) ) if ( !GetChildCount( pEntry ) )
{ {
...@@ -899,7 +899,7 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -899,7 +899,7 @@ void SfxConfigGroupListBox::GroupSelected()
value >>= uri; value >>= uri;
OUString* pScriptURI = new OUString( uri ); OUString* pScriptURI = new OUString( uri );
SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGFUNCTION_SCRIPT, 0, pScriptURI ); SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI );
Image aImage = GetImage( children[n], Reference< XComponentContext >(), false ); Image aImage = GetImage( children[n], Reference< XComponentContext >(), false );
SvTreeListEntry* pNewEntry = SvTreeListEntry* pNewEntry =
...@@ -924,7 +924,7 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -924,7 +924,7 @@ void SfxConfigGroupListBox::GroupSelected()
break; break;
} }
case SFX_CFGGROUP_STYLES : case SfxCfgKind::GROUP_STYLES :
{ {
SfxStyleInfo_Impl* pFamily = static_cast<SfxStyleInfo_Impl*>(pInfo->pObject); SfxStyleInfo_Impl* pFamily = static_cast<SfxStyleInfo_Impl*>(pInfo->pObject);
if (pFamily) if (pFamily)
...@@ -937,7 +937,7 @@ void SfxConfigGroupListBox::GroupSelected() ...@@ -937,7 +937,7 @@ void SfxConfigGroupListBox::GroupSelected()
{ {
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt); SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt);
SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel, NULL ); SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel, NULL );
SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pStyle ); SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SfxCfgKind::GROUP_STYLES, 0, pStyle );
pFunctionListBox->aArr.push_back( pGrpInfo ); pFunctionListBox->aArr.push_back( pGrpInfo );
pGrpInfo->sCommand = pStyle->sCommand; pGrpInfo->sCommand = pStyle->sCommand;
pGrpInfo->sLabel = pStyle->sLabel; pGrpInfo->sLabel = pStyle->sLabel;
...@@ -997,7 +997,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry ) ...@@ -997,7 +997,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
pInfo->bWasOpened = true; pInfo->bWasOpened = true;
switch ( pInfo->nKind ) switch ( pInfo->nKind )
{ {
case SFX_CFGGROUP_SCRIPTCONTAINER: case SfxCfgKind::GROUP_SCRIPTCONTAINER:
{ {
if ( !GetChildCount( pEntry ) ) if ( !GetChildCount( pEntry ) )
{ {
...@@ -1052,7 +1052,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry ) ...@@ -1052,7 +1052,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
theChild->acquire(); theChild->acquire();
SfxGroupInfo_Impl* pGrpInfo = SfxGroupInfo_Impl* pGrpInfo =
new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, new SfxGroupInfo_Impl(SfxCfgKind::GROUP_SCRIPTCONTAINER,
0, static_cast<void *>( theChild.get())); 0, static_cast<void *>( theChild.get()));
Image aImage = GetImage( theChild, Reference< XComponentContext >(), false ); Image aImage = GetImage( theChild, Reference< XComponentContext >(), false );
...@@ -1089,7 +1089,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry ) ...@@ -1089,7 +1089,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
break; break;
} }
case SFX_CFGGROUP_STYLES: case SfxCfgKind::GROUP_STYLES:
{ {
if ( !GetChildCount( pEntry ) ) if ( !GetChildCount( pEntry ) )
{ {
...@@ -1101,7 +1101,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry ) ...@@ -1101,7 +1101,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
{ {
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt); SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt);
SvTreeListEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry ); SvTreeListEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry );
SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pFamily ); SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SfxCfgKind::GROUP_STYLES, 0, pFamily );
aArr.push_back( pGrpInfo ); aArr.push_back( pGrpInfo );
pStyleEntry->SetUserData( pGrpInfo ); pStyleEntry->SetUserData( pGrpInfo );
pStyleEntry->EnableChildrenOnDemand( false ); pStyleEntry->EnableChildrenOnDemand( false );
......
...@@ -74,22 +74,25 @@ struct SfxStylesInfo_Impl ...@@ -74,22 +74,25 @@ struct SfxStylesInfo_Impl
static OUString generateCommand(const OUString& sFamily, const OUString& sStyle); static OUString generateCommand(const OUString& sFamily, const OUString& sStyle);
}; };
#define SFX_CFGGROUP_FUNCTION 1 enum class SfxCfgKind
#define SFX_CFGFUNCTION_SLOT 2 {
#define SFX_CFGGROUP_SCRIPTCONTAINER 3 GROUP_FUNCTION = 1,
#define SFX_CFGFUNCTION_SCRIPT 4 FUNCTION_SLOT = 2,
#define SFX_CFGGROUP_STYLES 5 GROUP_SCRIPTCONTAINER = 3,
FUNCTION_SCRIPT = 4,
GROUP_STYLES = 5,
};
struct SfxGroupInfo_Impl struct SfxGroupInfo_Impl
{ {
sal_uInt16 nKind; SfxCfgKind nKind;
sal_uInt16 nUniqueID; sal_uInt16 nUniqueID;
void* pObject; void* pObject;
bool bWasOpened; bool bWasOpened;
OUString sCommand; OUString sCommand;
OUString sLabel; OUString sLabel;
SfxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, void* pObj = 0 ) : SfxGroupInfo_Impl( SfxCfgKind n, sal_uInt16 nr, void* pObj = 0 ) :
nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(false) {} nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(false) {}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment