[Libreoffice-commits] core.git: sd/source
Gülşah Köse (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 28 15:17:00 UTC 2019
sd/source/ui/func/fuolbull.cxx | 324 -----------------------------------------
sd/source/ui/inc/fuolbull.hxx | 23 --
sd/source/ui/view/outlnvs2.cxx | 2
3 files changed, 1 insertion(+), 348 deletions(-)
New commits:
commit 5ff162bede44b77cb19e5ff6571b6e34f228d9fb
Author: Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon May 27 23:49:41 2019 +0300
Commit: Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Tue May 28 17:16:05 2019 +0200
tdf#120905 Remove old FuOutlineBullet dialog code.
Change-Id: I4bd0986f23414edc857ca890f6437c6029116e72
Reviewed-on: https://gerrit.libreoffice.org/73070
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 9b9f92209674..7c9b8657f0f2 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -43,330 +43,6 @@
using namespace svx::sidebar;
namespace sd {
-
-FuOutlineBullet::FuOutlineBullet(ViewShell* pViewShell, ::sd::Window* pWindow,
- ::sd::View* pView, SdDrawDocument* pDoc,
- SfxRequest& rReq)
- : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
-{
-}
-
-rtl::Reference<FuPoor> FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
-{
- rtl::Reference<FuPoor> xFunc( new FuOutlineBullet( pViewSh, pWin, pView, pDoc, rReq ) );
- xFunc->DoExecute(rReq);
- return xFunc;
-}
-
-void FuOutlineBullet::DoExecute( SfxRequest& rReq )
-{
- const sal_uInt16 nSId = rReq.GetSlot();
- if ( nSId == FN_SVX_SET_BULLET || nSId == FN_SVX_SET_NUMBER )
- {
- SetCurrentBulletsNumbering(rReq);
- return;
- }
-
- const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxStringItem* pPageItem = SfxItemSet::GetItem<SfxStringItem>(pArgs, FN_PARAM_1, false);
-
- if ( pArgs && !pPageItem )
- {
- /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
- changes to master page and redirect to a template */
- mpView->SetAttributes(*pArgs);
- return;
- }
-
- // fill ItemSet for Dialog
- SfxItemSet aEditAttr( mpDoc->GetPool() );
- mpView->GetAttributes( aEditAttr );
-
- SfxItemSet aNewAttr( mpViewShell->GetPool(),
- svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
- aNewAttr.Put( aEditAttr, false );
-
- // create and execute dialog
- SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
- VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetFrameWeld(), &aNewAttr, mpView) );
- if ( pPageItem )
- pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
-
- std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq));
- rReq.Ignore(); // the 'old' request is not relevant any more
-
- // do not capture this, because this will go way before the dialog finishes executing
- auto pView = mpView;
- auto pViewShell = mpViewShell;
- pDlg->StartExecuteAsync([pView, pViewShell, pDlg, xRequest](sal_Int32 nResult){
-
- if( nResult == RET_OK )
- {
- SfxItemSet aSet( *pDlg->GetOutputItemSet() );
-
- OutlinerView* pOLV = pView->GetTextEditOutlinerView();
-
- std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
-
- if (OutlineView* pOutlineView = dynamic_cast<OutlineView*>(pView))
- {
- pOLV = pOutlineView->GetViewByWindow(pViewShell->GetActiveWindow());
- aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
- }
-
- if( pOLV )
- pOLV->EnableBullets();
-
- xRequest->Done( aSet );
-
- /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch
- changes to master page and redirect to a template */
- pView->SetAttributes(*xRequest->GetArgs());
- }
- pDlg->disposeOnce();
- });
-}
-
-void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
-{
- if (!mpDoc || !mpView)
- return;
-
- const sal_uInt16 nSId = rReq.GetSlot();
- if ( nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER )
- {
- // unexpected SfxRequest
- return;
- }
-
- const SfxUInt16Item* pItem = rReq.GetArg<SfxUInt16Item>(nSId);
- if ( !pItem )
- {
- rReq.Done();
- return;
- }
-
- SfxItemSet aNewAttr( mpViewShell->GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
- {
- SfxItemSet aEditAttr( mpDoc->GetPool() );
- mpView->GetAttributes( aEditAttr );
- aNewAttr.Put( aEditAttr, false );
- }
-
- const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
- //Init bullet level in "Customize" tab page in bullet dialog in master page view
- const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EditMode::MasterPage;
- if ( bInMasterView )
- {
- SdrObject* pObj = mpView->GetTextEditObject();
- if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
- {
- const sal_uInt16 nLevel = mpView->GetSelectionLevel();
- if( nLevel != 0xFFFF )
- {
- //save the itemset value
- SfxItemSet aStoreSet( aNewAttr );
- aNewAttr.ClearItem();
- //extend range
- aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
- aNewAttr.Put( aStoreSet );
- //put current level user selected
- aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
- }
- }
- }
-
- sal_uInt16 nIdx = pItem->GetValue();
- bool bToggle = false;
- if( nIdx == sal_uInt16(0xFFFF) )
- {
- // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
- nIdx = 1;
- bToggle = true;
- }
- nIdx--;
-
- sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
- const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
- std::unique_ptr<SvxNumRule> pNumRule;
- if ( pTmpItem )
- {
- pNumRule.reset(new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pTmpItem)->GetNumRule()));
-
- // get numbering rule corresponding to <nIdx> and apply the needed number formats to <pNumRule>
- NBOTypeMgrBase* pNumRuleMgr =
- NBOutlineTypeMgrFact::CreateInstance(
- nSId == FN_SVX_SET_BULLET ? NBOType::Bullets : NBOType::Numbering );
- if ( pNumRuleMgr )
- {
- sal_uInt16 nActNumLvl = sal_uInt16(0xFFFF);
- const SfxPoolItem* pNumLevelItem = nullptr;
- if(SfxItemState::SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pNumLevelItem))
- nActNumLvl = static_cast<const SfxUInt16Item*>(pNumLevelItem)->GetValue();
-
- pNumRuleMgr->SetItems(&aNewAttr);
- SvxNumRule aTmpRule( *pNumRule );
- if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 )
- {
- // for toggling bullets get default numbering rule
- pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true );
- }
- else
- {
- pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl );
- }
-
- sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
- {
- if(nActNumLvl & nMask)
- {
- const SvxNumberFormat& aFmt(aTmpRule.GetLevel(i));
- pNumRule->SetLevel(i, aFmt);
- }
- nMask <<= 1;
- }
- }
- }
-
- OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
- std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
- if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView))
- {
- pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow());
- aGuard.reset(new OutlineViewModelChangeGuard(*pView));
- }
-
- SdrOutliner* pOwner = bInMasterView ? mpView->GetTextEditOutliner() : nullptr;
- const bool bOutlinerUndoEnabled = pOwner && !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
- SdrModel* pSdrModel = bInMasterView ? mpView->GetModel() : nullptr;
- const bool bModelUndoEnabled = pSdrModel && pSdrModel->IsUndoEnabled();
-
- if ( bOutlinerUndoEnabled )
- {
- pOwner->UndoActionStart( OLUNDO_ATTR );
- }
- else if ( bModelUndoEnabled )
- {
- pSdrModel->BegUndo();
- }
-
- if ( pOLV )
- {
- pOLV->ToggleBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? nullptr : pNumRule.get() );
- }
- else
- {
- mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? nullptr : pNumRule.get() );
- }
-
- if (bInMasterView && pNumRule)
- {
- SfxItemSet aSetAttr( mpViewShell->GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
- aSetAttr.Put(SvxNumBulletItem( *pNumRule, nNumItemId ));
- mpView->SetAttributes(aSetAttr);
- }
-
- if( bOutlinerUndoEnabled )
- {
- pOwner->UndoActionEnd();
- }
- else if ( bModelUndoEnabled )
- {
- pSdrModel->EndUndo();
- }
-
- pNumRule.reset();
- rReq.Done();
-}
-
-const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId)
-{
- //SvxNumBulletItem* pRetItem = NULL;
- const SfxPoolItem* pTmpItem = nullptr;
-
- if(aNewAttr.GetItemState(nNumItemId, false, &pTmpItem) == SfxItemState::SET)
- {
- return pTmpItem;
- }
- else
- {
- nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- SfxItemState eState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
- if (eState == SfxItemState::SET)
- return pTmpItem;
- else
- {
- bool bOutliner = false;
- bool bTitle = false;
-
- if( mpView )
- {
- const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
- const size_t nCount = rMarkList.GetMarkCount();
-
- for(size_t nNum = 0; nNum < nCount; ++nNum)
- {
- SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
- if( pObj->GetObjInventor() == SdrInventor::Default )
- {
- switch(pObj->GetObjIdentifier())
- {
- case OBJ_TITLETEXT:
- bTitle = true;
- break;
- case OBJ_OUTLINETEXT:
- bOutliner = true;
- break;
- }
- }
- }
- }
-
- const SvxNumBulletItem *pItem = nullptr;
- if(bOutliner)
- {
- SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
- SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( STR_LAYOUT_OUTLINE " 1", SfxStyleFamily::Pseudo);
- if( pFirstStyleSheet )
- pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
- }
-
- if( pItem == nullptr )
- pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
-
- //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" );
-
- aNewAttr.Put(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
-
- if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
- {
- const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET);
- SvxNumRule* pLclRule = pBulletItem->GetNumRule();
- if(pLclRule)
- {
- SvxNumRule aNewRule( *pLclRule );
- aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
-
- SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
- aNewAttr.Put(aNewItem);
- }
- }
-
- SfxItemState eItemState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
- if (eItemState == SfxItemState::SET)
- return pTmpItem;
-
- }
- //DBG_ASSERT(eState == SfxItemState::SET, "No item found");
- }
- return pTmpItem;
-}
-
-
-// New merged dialog
-
-
FuBulletAndPosition::FuBulletAndPosition(ViewShell* pViewShell, ::sd::Window* pWindow,
::sd::View* pView, SdDrawDocument* pDoc,
SfxRequest& rReq)
diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx
index 7a5ff9bac2e3..905e3690a4a9 100644
--- a/sd/source/ui/inc/fuolbull.hxx
+++ b/sd/source/ui/inc/fuolbull.hxx
@@ -35,30 +35,7 @@ class ViewShell;
/**
* bullet functions in outline mode
*/
-class FuOutlineBullet
- : public FuPoor
-{
-public:
-
- static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
- virtual void DoExecute( SfxRequest& rReq ) override;
-
-private:
- FuOutlineBullet (
- ViewShell* pViewShell,
- ::sd::Window* pWin,
- ::sd::View* pView,
- SdDrawDocument* pDoc,
- SfxRequest& rReq);
-
- void SetCurrentBulletsNumbering(SfxRequest& rReq);
- const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
-};
-
-/**
- * New merged bullet and position functions in outline mode
- */
class FuBulletAndPosition
: public FuPoor
{
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index 4fd762de736a..9935e2eecd5d 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -400,7 +400,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
case FN_SVX_SET_BULLET:
case FN_SVX_SET_NUMBER:
{
- SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
+ SetCurrentFunction( FuBulletAndPosition::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
Cancel();
}
break;
More information about the Libreoffice-commits
mailing list