Kaydet (Commit) 42e53193 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld OutlineBulletDlg

Change-Id: Icfbe456a71e0febf5b7d7b6cb625217c730bb367
Reviewed-on: https://gerrit.libreoffice.org/61291
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 60de083e
......@@ -177,7 +177,7 @@ public:
virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& rStr) = 0;
virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) = 0;
virtual VclPtr<AbstractMorphDlg> CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSdParagraphTabDlg(weld::Window* pWindow, const SfxItemSet* pAttr) = 0;
virtual VclPtr<AbstractSdStartPresDlg> CreateSdStartPresentationDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs,
const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList ) = 0;
......
......@@ -409,8 +409,9 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
case 11:
{
// CreateSdOutlineBulletTabDlg(const SfxItemSet* pAttr, ::sd::View* pView = nullptr) override;
auto const parent = Application::GetDefDialogParent();
pRetval = getSdAbstractDialogFactory()->CreateSdOutlineBulletTabDlg(
getViewShell()->GetActiveWindow(),
parent == nullptr ? nullptr : parent->GetFrameWeld(),
&getEmptySfxItemSet(),
getDrawView());
break;
......
......@@ -46,26 +46,22 @@ namespace sd {
/**
* Constructor of tab dialog: append pages to the dialog
*/
OutlineBulletDlg::OutlineBulletDlg(
vcl::Window* pParent,
const SfxItemSet* pAttr,
::sd::View* pView )
: SfxTabDialog( pParent, "BulletsAndNumberingDialog",
"modules/sdraw/ui/bulletsandnumbering.ui")
, aInputSet( *pAttr )
, bTitle(false)
, pSdView(pView)
OutlineBulletDlg::OutlineBulletDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView)
: SfxTabDialogController(pParent, "modules/sdraw/ui/bulletsandnumbering.ui", "BulletsAndNumberingDialog")
, m_aInputSet(*pAttr)
, m_bTitle(false)
, m_pSdView(pView)
{
aInputSet.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
aInputSet.Put( *pAttr );
m_aInputSet.MergeRange(SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL);
m_aInputSet.Put(*pAttr);
pOutputSet.reset( new SfxItemSet( *pAttr ) );
pOutputSet->ClearItem();
m_xOutputSet.reset( new SfxItemSet( *pAttr ) );
m_xOutputSet->ClearItem();
bool bOutliner = false;
// special treatment if a title object is selected
if( pView )
if (pView)
{
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
const size_t nCount = rMarkList.GetMarkCount();
......@@ -78,7 +74,7 @@ OutlineBulletDlg::OutlineBulletDlg(
switch(pObj->GetObjIdentifier())
{
case OBJ_TITLETEXT:
bTitle = true;
m_bTitle = true;
break;
case OBJ_OUTLINETEXT:
bOutliner = true;
......@@ -88,7 +84,7 @@ OutlineBulletDlg::OutlineBulletDlg(
}
}
if( SfxItemState::SET != aInputSet.GetItemState(EE_PARA_NUMBULLET))
if( SfxItemState::SET != m_aInputSet.GetItemState(EE_PARA_NUMBULLET))
{
const SvxNumBulletItem *pItem = nullptr;
if(bOutliner)
......@@ -100,17 +96,17 @@ OutlineBulletDlg::OutlineBulletDlg(
}
if( pItem == nullptr )
pItem = aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
pItem = m_aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in Pool! [CL]" );
std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
aInputSet.Put(*pNewItem);
m_aInputSet.Put(*pNewItem);
}
if(bTitle && aInputSet.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
if (m_bTitle && m_aInputSet.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
{
const SvxNumBulletItem* pItem = aInputSet.GetItem<SvxNumBulletItem>(EE_PARA_NUMBULLET);
const SvxNumBulletItem* pItem = m_aInputSet.GetItem<SvxNumBulletItem>(EE_PARA_NUMBULLET);
SvxNumRule* pRule = pItem->GetNumRule();
if(pRule)
{
......@@ -118,80 +114,68 @@ OutlineBulletDlg::OutlineBulletDlg(
aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
aInputSet.Put(aNewItem);
m_aInputSet.Put(aNewItem);
}
}
SetInputSet( &aInputSet );
SetInputSet(&m_aInputSet);
if(!bTitle)
if (!m_bTitle)
AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM);
else
RemoveTabPage("singlenum");
AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
m_nOptionsId = AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS);
m_nPositionId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION);
AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS);
AddTabPage("position", RID_SVXPAGE_NUM_POSITION);
}
OutlineBulletDlg::~OutlineBulletDlg()
{
disposeOnce();
}
void OutlineBulletDlg::dispose()
void OutlineBulletDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
{
pOutputSet.reset();
SfxTabDialog::dispose();
}
void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
{
if (nId == m_nOptionsId)
if (!m_pSdView)
return;
if (rId == "customize")
{
if( pSdView )
{
FieldUnit eMetric = pSdView->GetDoc().GetUIUnit();
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,static_cast<sal_uInt16>(eMetric)));
rPage.PageCreated(aSet);
}
FieldUnit eMetric = m_pSdView->GetDoc().GetUIUnit();
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,static_cast<sal_uInt16>(eMetric)));
rPage.PageCreated(aSet);
}
else if (nId == m_nPositionId)
else if (rId == "position")
{
if( pSdView )
{
FieldUnit eMetric = pSdView->GetDoc().GetUIUnit();
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,static_cast<sal_uInt16>(eMetric)));
rPage.PageCreated(aSet);
}
FieldUnit eMetric = m_pSdView->GetDoc().GetUIUnit();
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,static_cast<sal_uInt16>(eMetric)));
rPage.PageCreated(aSet);
}
}
const SfxItemSet* OutlineBulletDlg::GetOutputItemSet() const
const SfxItemSet* OutlineBulletDlg::GetBulletOutputItemSet() const
{
SfxItemSet aSet( *SfxTabDialog::GetOutputItemSet() );
pOutputSet->Put( aSet );
SfxItemSet aSet(*GetOutputItemSet());
m_xOutputSet->Put(aSet);
const SfxPoolItem *pItem = nullptr;
if( SfxItemState::SET == pOutputSet->GetItemState(pOutputSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE), false, &pItem ))
if( SfxItemState::SET == m_xOutputSet->GetItemState(m_xOutputSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE), false, &pItem ))
{
SdBulletMapper::MapFontsInNumRule( *static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule(), *pOutputSet );
// #i35937 - removed EE_PARA_BULLETSTATE setting
SdBulletMapper::MapFontsInNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule(), *m_xOutputSet);
// #i35937 - removed EE_PARA_BULLETSTATE setting
}
if(bTitle && pOutputSet->GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
if (m_bTitle && m_xOutputSet->GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET)
{
const SvxNumBulletItem* pBulletItem = pOutputSet->GetItem<SvxNumBulletItem>(EE_PARA_NUMBULLET);
const SvxNumBulletItem* pBulletItem = m_xOutputSet->GetItem<SvxNumBulletItem>(EE_PARA_NUMBULLET);
SvxNumRule* pRule = pBulletItem->GetNumRule();
if(pRule)
pRule->SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS, false );
}
return pOutputSet.get();
return m_xOutputSet.get();
}
} // end of namespace sd
......
......@@ -104,7 +104,16 @@ short AbstractSdVectorizeDlg_Impl::Execute()
IMPL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractBulletDialog_Impl);
short AbstractBulletDialog_Impl::Execute()
{
return m_xDlg->execute();
}
bool AbstractBulletDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
{
return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
}
AbstractBreakDlg_Impl::AbstractBreakDlg_Impl(std::unique_ptr<::sd::BreakDlg> pDlg)
: m_xDlg(std::move(pDlg))
......@@ -205,27 +214,27 @@ void SdAbstractTabController_Impl::SetText( const OUString& rStr )
void AbstractBulletDialog_Impl::SetCurPageId( const OString& rName )
{
static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( rName );
m_xDlg->SetCurPageId( rName );
}
const SfxItemSet* AbstractBulletDialog_Impl::GetOutputItemSet() const
{
return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetOutputItemSet();
return static_cast< ::sd::OutlineBulletDlg*>(m_xDlg.get())->GetBulletOutputItemSet();
}
const sal_uInt16* AbstractBulletDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
{
return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetInputRanges( pItem );
return m_xDlg->GetInputRanges(pItem);
}
void AbstractBulletDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
{
static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetInputSet( pInSet );
m_xDlg->SetInputSet(pInSet);
}
void AbstractBulletDialog_Impl::SetText( const OUString& rStr )
{
static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetText( rStr );
m_xDlg->set_title(rStr);
}
void SdPresLayoutTemplateDlg_Impl::SetCurPageId( const OString& rName )
......@@ -422,9 +431,9 @@ VclPtr<AbstractMorphDlg> SdAbstractDialogFactory_Impl::CreateMorphDlg(weld::Wind
return VclPtr<AbstractMorphDlg_Impl>::Create(o3tl::make_unique<::sd::MorphDlg>(pParent, pObj1, pObj2));
}
VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView )
VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView)
{
return VclPtr<AbstractBulletDialog_Impl>::Create( VclPtr<::sd::OutlineBulletDlg>::Create( pParent, pAttr, pView ) );
return VclPtr<AbstractBulletDialog_Impl>::Create(o3tl::make_unique<::sd::OutlineBulletDlg>(pParent, pAttr, pView));
}
VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg(weld::Window* pParent, const SfxItemSet* pAttr )
......
......@@ -154,10 +154,17 @@ public:
virtual void SetText( const OUString& rStr ) override;
};
class AbstractBulletDialog_Impl : public SfxAbstractTabDialog
{
DECL_ABSTDLG_BASE( AbstractBulletDialog_Impl,SfxTabDialog )
protected:
std::shared_ptr<SfxTabDialogController> m_xDlg;
public:
explicit AbstractBulletDialog_Impl(std::unique_ptr<SfxTabDialogController> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
virtual void SetCurPageId( const OString& rName ) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override;
......@@ -324,7 +331,7 @@ public:
virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override;
virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) override;
virtual VclPtr<AbstractMorphDlg> CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSdParagraphTabDlg(weld::Window* pParent, const SfxItemSet* pAttr) override;
virtual VclPtr<AbstractSdStartPresDlg> CreateSdStartPresentationDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs,
const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList ) override;
......
......@@ -82,7 +82,7 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq )
// create and execute dialog
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) );
ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetFrameWeld(), &aNewAttr, mpView) );
if ( pPageItem )
pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
sal_uInt16 nResult = pDlg->Execute();
......
......@@ -29,31 +29,22 @@ class View;
/**
* Bullet-Tab-Dialog
*/
class OutlineBulletDlg
: public SfxTabDialog
class OutlineBulletDlg : public SfxTabDialogController
{
public:
OutlineBulletDlg (
vcl::Window* pParent,
const SfxItemSet* pAttr,
::sd::View* pView );
OutlineBulletDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView);
virtual ~OutlineBulletDlg () override;
virtual void dispose() override;
const SfxItemSet* GetOutputItemSet() const;
const SfxItemSet* GetBulletOutputItemSet() const;
protected:
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override;
virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
private:
using SfxTabDialog::GetOutputItemSet;
SfxItemSet aInputSet;
std::unique_ptr<SfxItemSet> pOutputSet;
sal_uInt16 m_nOptionsId;
sal_uInt16 m_nPositionId;
bool bTitle;
::sd::View *pSdView;
SfxItemSet m_aInputSet;
std::unique_ptr<SfxItemSet> m_xOutputSet;
bool m_bTitle;
::sd::View *m_pSdView;
};
} // end of namespace sd
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="sd">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="BulletsAndNumberingDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="bulletsandnumbering|BulletsAndNumberingDialog">Bullets and Numbering</property>
<property name="modal">True</property>
<property name="window_position">mouse</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -18,14 +22,11 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<object class="GtkButton" id="reset">
<property name="label" translatable="yes" context="bulletsandnumbering|reset">Reset</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -34,10 +35,12 @@
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
......@@ -48,8 +51,8 @@
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -58,21 +61,22 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="reset">
<property name="label" translatable="yes" context="bulletsandnumbering|reset">Reset</property>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
......@@ -98,6 +102,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
......@@ -117,6 +145,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
......@@ -140,6 +192,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">2</property>
......@@ -163,6 +239,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">3</property>
......@@ -186,6 +286,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">4</property>
......@@ -212,10 +336,10 @@
</object>
</child>
<action-widgets>
<action-widget response="0">reset</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
<action-widget response="0">reset</action-widget>
</action-widgets>
</object>
</interface>
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