Kaydet (Commit) b9f27c05 authored tarafından Matteo Casalin's avatar Matteo Casalin

sal_uInt16: avoid temporaries, simplify, constify, use USHRT_MAX

Change-Id: Ibfa44aa10d08ac1b19b7d34790f76effc9de0c9c
üst 62391d51
...@@ -143,7 +143,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) ...@@ -143,7 +143,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
const SfxItemSet *pArgs = rReq.GetArgs(); const SfxItemSet *pArgs = rReq.GetArgs();
const SfxPoolItem* pItem = 0; const SfxPoolItem* pItem = 0;
sal_uInt16 nSlot = rReq.GetSlot(); const sal_uInt16 nSlot = rReq.GetSlot();
if(pArgs) if(pArgs)
pArgs->GetItemState(nSlot, false, &pItem ); pArgs->GetItemState(nSlot, false, &pItem );
...@@ -529,8 +529,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) ...@@ -529,8 +529,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
if( 0!= dynamic_cast< SwWebDocShell*>( GetView().GetDocShell()) ) if( 0!= dynamic_cast< SwWebDocShell*>( GetView().GetDocShell()) )
{ {
SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
sal_uInt16 nExport = rHtmlOpt.GetExportMode(); if( HTML_CFG_MSIE == rHtmlOpt.GetExportMode() )
if( HTML_CFG_MSIE == nExport )
{ {
bSingleCol = true; bSingleCol = true;
} }
...@@ -552,7 +551,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) ...@@ -552,7 +551,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
aSize = ((SvxSizeItem *)pItem)->GetSize(); aSize = ((SvxSizeItem *)pItem)->GetSize();
if(pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SFX_ITEM_SET) if(pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SFX_ITEM_SET)
{ {
sal_uInt16 nCols = ((SfxUInt16Item *)pItem)->GetValue(); const sal_uInt16 nCols = ((SfxUInt16Item *)pItem)->GetValue();
if( !bSingleCol && 1 < nCols ) if( !bSingleCol && 1 < nCols )
{ {
SwFmtCol aFmtCol; SwFmtCol aFmtCol;
...@@ -684,7 +683,7 @@ static bool lcl_IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect ...@@ -684,7 +683,7 @@ static bool lcl_IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect
void SwTextShell::StateInsert( SfxItemSet &rSet ) void SwTextShell::StateInsert( SfxItemSet &rSet )
{ {
sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); const bool bHtmlModeOn = ::GetHtmlMode(GetView().GetDocShell()) & HTMLMODE_ON;
SfxWhichIter aIter( rSet ); SfxWhichIter aIter( rSet );
SwWrtShell &rSh = GetShell(); SwWrtShell &rSh = GetShell();
sal_uInt16 nWhich = aIter.FirstWhich(); sal_uInt16 nWhich = aIter.FirstWhich();
...@@ -745,10 +744,10 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) ...@@ -745,10 +744,10 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
{ {
rSet.DisableItem( nWhich ); rSet.DisableItem( nWhich );
} }
else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON) else if(SID_INSERT_FLOATINGFRAME == nWhich && bHtmlModeOn)
{ {
SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
sal_uInt16 nExport = rHtmlOpt.GetExportMode(); const sal_uInt16 nExport = rHtmlOpt.GetExportMode();
if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport ) if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
rSet.DisableItem(nWhich); rSet.DisableItem(nWhich);
} }
...@@ -808,7 +807,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) ...@@ -808,7 +807,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
} }
aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0))); (bHtmlModeOn ? HLINK_HTMLMODE : 0)));
aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT| aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT|
HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT ); HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
...@@ -838,7 +837,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) ...@@ -838,7 +837,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
if( bDisable ) if( bDisable )
{ {
const SwSection* pCurrSection = rSh.GetCurrSection(); const SwSection* pCurrSection = rSh.GetCurrSection();
sal_uInt16 nFullSectCnt = rSh.GetFullSelectedSectionCount(); const sal_uInt16 nFullSectCnt = rSh.GetFullSelectedSectionCount();
if( pCurrSection && ( !rSh.HasSelection() || 0 != nFullSectCnt )) if( pCurrSection && ( !rSh.HasSelection() || 0 != nFullSectCnt ))
bDisable = false; bDisable = false;
else if( else if(
......
...@@ -257,7 +257,7 @@ static short lcl_AskRedlineMode(Window *pWin) ...@@ -257,7 +257,7 @@ static short lcl_AskRedlineMode(Window *pWin)
OUString( SW_RES( STR_REDLINE_TITLE ) ), OUString( SW_RES( STR_REDLINE_TITLE ) ),
OUString( SW_RES( STR_REDLINE_MSG ) ) ); OUString( SW_RES( STR_REDLINE_MSG ) ) );
aQBox.SetImage( QueryBox::GetStandardImage() ); aQBox.SetImage( QueryBox::GetStandardImage() );
sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON | const sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON |
BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_OKBUTTON |
BUTTONDIALOG_FOCUSBUTTON; BUTTONDIALOG_FOCUSBUTTON;
...@@ -278,7 +278,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -278,7 +278,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
const SfxItemSet *pArgs = rReq.GetArgs(); const SfxItemSet *pArgs = rReq.GetArgs();
SwWrtShell& rWrtSh = GetShell(); SwWrtShell& rWrtSh = GetShell();
const SfxPoolItem* pItem = 0; const SfxPoolItem* pItem = 0;
sal_uInt16 nSlot = rReq.GetSlot(); const sal_uInt16 nSlot = rReq.GetSlot();
if(pArgs) if(pArgs)
pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem); pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
switch( nSlot ) switch( nSlot )
...@@ -455,7 +455,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -455,7 +455,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand()); pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
{ {
sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE; const sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
SfxRequest aReq( GetView().GetViewFrame(), nId ); SfxRequest aReq( GetView().GetViewFrame(), nId );
if ( !pDlg->GetStr().isEmpty() ) if ( !pDlg->GetStr().isEmpty() )
aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) ); aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
...@@ -500,13 +500,11 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -500,13 +500,11 @@ void SwTextShell::Execute(SfxRequest &rReq)
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0 0
}; };
sal_uInt16 *pUShorts = aResetableSetRange; const sal_uInt16 *pUShorts = aResetableSetRange;
while (*pUShorts) while (*pUShorts)
{ {
sal_uInt16 nL = pUShorts[1] - pUShorts[0] + 1; for (sal_uInt16 i = pUShorts[0]; i <= pUShorts[1]; ++i)
sal_uInt16 nE = pUShorts[0]; aAttribs.insert( aAttribs.end(), i );
for (sal_uInt16 i = 0; i < nL; ++i)
aAttribs.insert( aAttribs.end(), nE++ );
pUShorts += 2; pUShorts += 2;
} }
// we don't want to change writing direction. // we don't want to change writing direction.
...@@ -832,7 +830,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -832,7 +830,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
case FN_TXTATR_INET : case FN_TXTATR_INET :
case FN_INSERT_HYPERLINK: case FN_INSERT_HYPERLINK:
{ {
sal_uInt16 nWhich = GetPool().GetWhich( nSlot ); const sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET ) if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
bUseDialog = false; bUseDialog = false;
// intentionally no break // intentionally no break
...@@ -865,7 +863,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -865,7 +863,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
case FN_DROP_TEXT: case FN_DROP_TEXT:
case SID_ATTR_PARA_LRSPACE: case SID_ATTR_PARA_LRSPACE:
{ {
sal_uInt16 nWhich = GetPool().GetWhich( nSlot ); const sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET ) if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
bUseDialog = false; bUseDialog = false;
// intentionally no break // intentionally no break
...@@ -1061,14 +1059,14 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -1061,14 +1059,14 @@ void SwTextShell::Execute(SfxRequest &rReq)
//SetNumRuleStart(sal_True) restarts the numbering at the value //SetNumRuleStart(sal_True) restarts the numbering at the value
//that is defined at the starting point of the numbering level //that is defined at the starting point of the numbering level
//otherwise the SetNodeNumStart() value determines the start //otherwise the SetNodeNumStart() value determines the start
//if it's set to something different than (sal_uInt16)0xFFFF //if it's set to something different than USHRT_MAX
bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue(); bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
// Default value for restart value has to be (sal_uInt16)0xFFFF // Default value for restart value has to be USHRT_MAX
// in order to indicate that the restart value of the list // in order to indicate that the restart value of the list
// style has to be used on restart. // style has to be used on restart.
sal_uInt16 nNumStart = (sal_uInt16)0xFFFF; sal_uInt16 nNumStart = USHRT_MAX;
if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
{ {
nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
...@@ -1078,8 +1076,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -1078,8 +1076,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
} }
else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
{ {
sal_uInt16 nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); rWrtSh.SetNodeNumStart(((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue());
rWrtSh.SetNodeNumStart(nNumStart);
rWrtSh.SetNumRuleStart(false, pPaM); rWrtSh.SetNumRuleStart(false, pPaM);
} }
// #i56253# // #i56253#
...@@ -1766,7 +1763,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) ...@@ -1766,7 +1763,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case FN_NUM_NUM_RULE_INDEX: case FN_NUM_NUM_RULE_INDEX:
{ {
SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetNumRuleAtCurrCrsrPos()); SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetNumRuleAtCurrCrsrPos());
sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; sal_uInt16 nActNumLvl = USHRT_MAX;
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
if( pCurRule ) if( pCurRule )
...@@ -1779,22 +1776,22 @@ void SwTextShell::GetState( SfxItemSet &rSet ) ...@@ -1779,22 +1776,22 @@ void SwTextShell::GetState( SfxItemSet &rSet )
SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule(); SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
if ( GetShell().HasBullet()) if ( GetShell().HasBullet())
{ {
rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX, USHRT_MAX));
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX, USHRT_MAX));
NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
if ( pBullets ) if ( pBullets )
{ {
sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); const sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
} }
}else if ( GetShell().HasNumber() ) }else if ( GetShell().HasNumber() )
{ {
rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX, USHRT_MAX));
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX, USHRT_MAX));
NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
if ( pNumbering ) if ( pNumbering )
{ {
sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); const sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
} }
} }
......
...@@ -87,7 +87,6 @@ void SwTextShell::ExecDB(SfxRequest &rReq) ...@@ -87,7 +87,6 @@ void SwTextShell::ExecDB(SfxRequest &rReq)
{ {
const SfxItemSet *pArgs = rReq.GetArgs(); const SfxItemSet *pArgs = rReq.GetArgs();
SwDBManager* pDBManager = GetShell().GetDBManager(); SwDBManager* pDBManager = GetShell().GetDBManager();
sal_uInt16 nSlot = rReq.GetSlot();
OUString sSourceArg, sCommandArg; OUString sSourceArg, sCommandArg;
sal_Int32 nCommandTypeArg = 0; sal_Int32 nCommandTypeArg = 0;
...@@ -139,7 +138,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq) ...@@ -139,7 +138,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq)
if ( pCursorItem ) if ( pCursorItem )
((const SfxUsrAnyItem*)pCursorItem)->GetValue() >>= xCursor; ((const SfxUsrAnyItem*)pCursorItem)->GetValue() >>= xCursor;
switch (nSlot) switch (rReq.GetSlot())
{ {
case FN_QRY_INSERT: case FN_QRY_INSERT:
{ {
......
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