summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/txtnum.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/shells/txtnum.cxx')
-rw-r--r--sw/source/uibase/shells/txtnum.cxx52
1 files changed, 29 insertions, 23 deletions
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index b75cc1c7dcbd..bdad7870afbf 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -66,7 +66,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
}
bool bNewResult = GetShell().SelectionHasNumber();
if (bNewResult!=bMode) {
- SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
+ SfxBindings& rBindings = GetView().GetViewFrame().GetBindings();
SfxBoolItem aItem(FN_NUM_NUMBERING_ON,!bNewResult);
rBindings.SetState(aItem);
SfxBoolItem aNewItem(FN_NUM_NUMBERING_ON,bNewResult);
@@ -95,7 +95,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
}
bool bNewResult = GetShell().SelectionHasBullet();
if (bNewResult!=bMode) {
- SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
+ SfxBindings& rBindings = GetView().GetViewFrame().GetBindings();
SfxBoolItem aItem(FN_NUM_BULLET_ON,!bNewResult);
rBindings.SetState(aItem);
SfxBoolItem aNewItem(FN_NUM_BULLET_ON,bNewResult);
@@ -111,7 +111,6 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
SfxRequest aReq(GetView().GetViewFrame(), FN_NUM_BULLET_ON);
aReq.AppendItem(SfxBoolItem(FN_PARAM_1, false));
aReq.Done();
- GetShell().NumOrBulletOff();
GetShell().DelNumRules();
GetShell().EndAllAction();
}
@@ -120,9 +119,8 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
case FN_NUMBER_BULLETS:
case SID_OUTLINE_BULLET:
{
- SfxItemSet aSet( GetPool(),
- svl::Items<SID_HTML_MODE, SID_HTML_MODE,
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL>{} );
+ SfxItemSetFixed<SID_HTML_MODE, SID_HTML_MODE,
+ SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL> aSet( GetPool() );
SwDocShell* pDocSh = GetView().GetDocShell();
const bool bHtml = dynamic_cast<SwWebDocShell*>( pDocSh ) != nullptr;
const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
@@ -183,7 +181,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
}
aSvxRule.SetFeatureFlag(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP, false);
}
- aSet.Put( SvxNumBulletItem( aSvxRule ) );
+ aSet.Put( SvxNumBulletItem( std::move(aSvxRule) ) );
}
aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,false ));
@@ -193,29 +191,29 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
weld::Window *pParent = rReq.GetFrameWeld();
- VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxNumBulletTabDialog(pParent, &aSet, GetShell()));
+ VclPtr<AbstractNumBulletDialog> pDlg(pFact->CreateSvxNumBulletTabDialog(pParent, aSet, GetShell()));
const SfxStringItem* pPageItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
if ( pPageItem )
- pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
+ pDlg->SetCurPageId( pPageItem->GetValue() );
- auto pRequest = std::make_shared<SfxRequest>(rReq);
+ auto xRequest = std::make_shared<SfxRequest>(rReq);
rReq.Ignore(); // the 'old' request is not relevant any more
- pDlg->StartExecuteAsync([aSet, pDlg, pNumRuleAtCurrentSelection, pRequest, this](sal_Int32 nResult){
+ pDlg->StartExecuteAsync([pDlg, pNumRuleAtCurrentSelection, xRequest=std::move(xRequest), this](sal_Int32 nResult){
if (RET_OK == nResult)
{
- const SfxPoolItem* pItem;
- if (SfxItemState::SET == pDlg->GetOutputItemSet()->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem))
+ const SvxNumBulletItem* pBulletItem = pDlg->GetOutputItemSet()->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
+ if (pBulletItem)
{
- pRequest->AppendItem(*pItem);
- pRequest->Done();
- SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
- pSetRule->UnLinkGraphics();
+ xRequest->AppendItem(*pBulletItem);
+ xRequest->Done();
+ SvxNumRule& rSetRule = const_cast<SvxNumRule&>(pBulletItem->GetNumRule());
+ rSetRule.UnLinkGraphics();
SwNumRule aSetRule(pNumRuleAtCurrentSelection != nullptr
? pNumRuleAtCurrentSelection->GetName()
: GetShell().GetUniqueNumRuleName(),
numfunc::GetDefaultPositionAndSpaceMode());
- aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
+ aSetRule.SetSvxRule(rSetRule, GetShell().GetDoc());
aSetRule.SetAutoRule(true);
// No start of new list, if an existing list style is edited.
// Otherwise start a new list.
@@ -225,15 +223,15 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
// If the Dialog was leaved with OK but nothing was chosen then the
// numbering must be at least activated, if it is not already.
else if (pNumRuleAtCurrentSelection == nullptr
- && SfxItemState::SET == aSet.GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem))
+ && (pBulletItem = pDlg->GetInputItemSet()->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false)))
{
- pRequest->AppendItem(*pItem);
- pRequest->Done();
- SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
+ xRequest->AppendItem(*pBulletItem);
+ xRequest->Done();
+ const SvxNumRule& rSetRule = pBulletItem->GetNumRule();
SwNumRule aSetRule(
GetShell().GetUniqueNumRuleName(),
numfunc::GetDefaultPositionAndSpaceMode());
- aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
+ aSetRule.SetSvxRule(rSetRule, GetShell().GetDoc());
aSetRule.SetAutoRule(true);
// start new list
GetShell().SetCurNumRule(aSetRule, true);
@@ -311,6 +309,14 @@ void SwTextShell::ExecSetNumber(SfxRequest const &rReq)
GetShell().SetCurNumRule( aNewNumRule, bCreateNewList );
}
}
+ else if (nSlot == FN_SVX_SET_OUTLINE)
+ {
+ // no outline provided: launch dialog to request a specific outline
+ SfxBindings& rBindings = GetView().GetViewFrame().GetBindings();
+ const SfxStringItem aPage(FN_PARAM_1, "outlinenum");
+ const SfxPoolItem* aItems[] = { &aPage, nullptr };
+ rBindings.Execute(SID_OUTLINE_BULLET, aItems);
+ }
}
break;