Kaydet (Commit) 8d831cc0 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxCaptionTabDialog

Change-Id: If678c5f4834144f1c710465701dc4d13714a6b44
Reviewed-on: https://gerrit.libreoffice.org/60247
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst f21e8a94
......@@ -362,7 +362,7 @@ void ShapeController::executeDispatch_TransformDialog()
SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr< SfxAbstractTabDialog > pDlg(
pFact->CreateCaptionDialog( pChartWindow, pDrawViewWrapper ) );
pFact->CreateCaptionDialog(pChartWindow->GetFrameWeld(), pDrawViewWrapper));
const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
SfxItemSet aCombAttr( *aAttr.GetPool(), pRange );
aCombAttr.Put( aAttr );
......
......@@ -141,7 +141,16 @@ bool AbstractSvxTransformTabDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
}
IMPL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl);
short AbstractSvxCaptionDialog_Impl::Execute()
{
return m_xDlg->execute();
}
bool AbstractSvxCaptionDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
{
return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
}
IMPL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl);
short AbstractFmInputRecordNoDialog_Impl::Execute()
......@@ -630,31 +639,32 @@ void AbstractSvxTransformTabDialog_Impl::SetValidateFramePosLink( const Link<Svx
// AbstractSvxCaptionDialog implementations just forwards everything to the dialog
void AbstractSvxCaptionDialog_Impl::SetCurPageId( const OString& rName )
{
pDlg->SetCurPageId( rName );
m_xDlg->SetCurPageId(rName);
}
const SfxItemSet* AbstractSvxCaptionDialog_Impl::GetOutputItemSet() const
{
return pDlg->GetOutputItemSet();
return m_xDlg->GetOutputItemSet();
}
const sal_uInt16* AbstractSvxCaptionDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
{
return pDlg->GetInputRanges( pItem );
return m_xDlg->GetInputRanges( pItem );
}
void AbstractSvxCaptionDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
{
pDlg->SetInputSet( pInSet );
m_xDlg->SetInputSet( pInSet );
}
//From class Window.
void AbstractSvxCaptionDialog_Impl::SetText( const OUString& rStr )
{
pDlg->SetText( rStr );
m_xDlg->set_title(rStr);
}
void AbstractSvxCaptionDialog_Impl::SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink )
{
pDlg->SetValidateFramePosLink( rLink );
m_xDlg->SetValidateFramePosLink( rLink );
}
TransliterationFlags AbstractSvxJSearchOptionsDialog_Impl::GetTransliterationFlags() const
......@@ -1008,12 +1018,11 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateTextTabDialog(wel
}
// TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog
VclPtr<AbstractSvxCaptionDialog> AbstractDialogFactory_Impl::CreateCaptionDialog( vcl::Window* pParent,
const SdrView* pView,
SvxAnchorIds nAnchorTypes )
VclPtr<AbstractSvxCaptionDialog> AbstractDialogFactory_Impl::CreateCaptionDialog(weld::Window* pParent,
const SdrView* pView,
SvxAnchorIds nAnchorTypes)
{
VclPtrInstance<SvxCaptionTabDialog> pDlg( pParent, pView, nAnchorTypes );
return VclPtr<AbstractSvxCaptionDialog_Impl>::Create( pDlg );
return VclPtr<AbstractSvxCaptionDialog_Impl>::Create(o3tl::make_unique<SvxCaptionTabDialog>(pParent, pView, nAnchorTypes));
}
VclPtr<AbstractSvxDistributeDialog> AbstractDialogFactory_Impl::CreateSvxDistributeDialog(const SfxItemSet& rAttr)
......
......@@ -323,7 +323,15 @@ public:
class AbstractSvxCaptionDialog_Impl : public AbstractSvxCaptionDialog
{
DECL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl,SvxCaptionTabDialog)
protected:
std::shared_ptr<SvxCaptionTabDialog> m_xDlg;
public:
explicit AbstractSvxCaptionDialog_Impl(std::unique_ptr<SvxCaptionTabDialog> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
virtual void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ) override;
virtual void SetCurPageId( const OString& rName ) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
......@@ -647,9 +655,9 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateTabItemDialog(vcl::Window* pParent,
const SfxItemSet& rSet) override;
virtual VclPtr<AbstractSvxCaptionDialog>
CreateCaptionDialog( vcl::Window* pParent,
CreateCaptionDialog(weld::Window* pParent,
const SdrView* pView,
SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE ) override;
SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) override;
virtual VclPtr<AbstractSvxDistributeDialog>
CreateSvxDistributeDialog(const SfxItemSet& rAttr) override;
virtual VclPtr<SfxAbstractInsertObjectDialog>
......
......@@ -100,21 +100,18 @@ public:
// class SvxCaptionTabDialog ---------------------------------------------
struct SvxSwFrameValidation;
class SvxCaptionTabDialog : public SfxTabDialog
class SvxCaptionTabDialog : public SfxTabDialogController
{
private:
const SdrView* pView;
SvxAnchorIds nAnchorCtrls;
sal_uInt16 m_nSwPosSizePageId;
sal_uInt16 m_nPositionSizePageId;
sal_uInt16 m_nCaptionPageId;
Link<SvxSwFrameValidation&,void> aValidateLink;
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override;
virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
public:
SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pView,
SvxCaptionTabDialog(weld::Window* pParent, const SdrView* pView,
SvxAnchorIds nAnchorTypes);
/// link for the Writer to validate positions
......
......@@ -473,37 +473,34 @@ void SvxCaptionTabPage::FillValueSet()
m_xCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_3, m_aBmpCapTypes[2] );
}
SvxCaptionTabDialog::SvxCaptionTabDialog(vcl::Window* pParent, const SdrView* pSdrView,
SvxCaptionTabDialog::SvxCaptionTabDialog(weld::Window* pParent, const SdrView* pSdrView,
SvxAnchorIds nAnchorTypes)
: SfxTabDialog( pParent, "CalloutDialog", "cui/ui/calloutdialog.ui")
: SfxTabDialogController(pParent, "cui/ui/calloutdialog.ui", "CalloutDialog")
, pView(pSdrView)
, nAnchorCtrls(nAnchorTypes)
, m_nSwPosSizePageId(0)
, m_nPositionSizePageId(0)
, m_nCaptionPageId(0)
{
assert(pView); // No valid View transferred!
//different positioning page in Writer
if (nAnchorCtrls & (SvxAnchorIds::Paragraph | SvxAnchorIds::Character | SvxAnchorIds::Page | SvxAnchorIds::Fly))
{
m_nSwPosSizePageId = AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create,
AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create,
SvxSwPosSizeTabPage::GetRanges );
RemoveTabPage("RID_SVXPAGE_POSITION_SIZE");
}
else
{
m_nPositionSizePageId = AddTabPage("RID_SVXPAGE_POSITION_SIZE", SvxPositionSizeTabPage::Create,
AddTabPage("RID_SVXPAGE_POSITION_SIZE", SvxPositionSizeTabPage::Create,
SvxPositionSizeTabPage::GetRanges );
RemoveTabPage("RID_SVXPAGE_SWPOSSIZE");
}
m_nCaptionPageId = AddTabPage("RID_SVXPAGE_CAPTION", SvxCaptionTabPage::Create,
AddTabPage("RID_SVXPAGE_CAPTION", SvxCaptionTabPage::Create,
SvxCaptionTabPage::GetRanges );
}
void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
void SvxCaptionTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
{
if (nId == m_nPositionSizePageId)
if (rId == "RID_SVXPAGE_POSITION_SIZE")
{
static_cast<SvxPositionSizeTabPage&>( rPage ).SetView( pView );
static_cast<SvxPositionSizeTabPage&>( rPage ).Construct();
......@@ -513,13 +510,13 @@ void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
if( nAnchorCtrls & SvxAnchorIds::NoProtect )
static_cast<SvxPositionSizeTabPage&>( rPage ).DisableProtect();
}
else if (nId == m_nSwPosSizePageId)
else if (rId == "RID_SVXPAGE_SWPOSSIZE")
{
SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
rSwPage.EnableAnchorTypes(nAnchorCtrls);
rSwPage.SetValidateFramePosLink( aValidateLink );
}
else if (nId == m_nCaptionPageId)
else if (rId == "RID_SVXPAGE_CAPTION")
{
static_cast<SvxCaptionTabPage&>( rPage ).SetView( pView );
static_cast<SvxCaptionTabPage&>( rPage ).Construct();
......@@ -531,5 +528,4 @@ void SvxCaptionTabDialog::SetValidateFramePosLink( const Link<SvxSwFrameValidati
aValidateLink = rLink;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="CalloutDialog">
......@@ -8,6 +8,9 @@
<property name="title" translatable="yes" context="calloutdialog|CalloutDialog">Position and Size</property>
<property name="resizable">False</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,12 +21,10 @@
<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">gtk-revert-to-saved</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>
......@@ -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>
......@@ -59,12 +62,11 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="reset">
<property name="label">gtk-revert-to-saved</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>
......@@ -74,6 +76,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
......@@ -97,6 +100,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">
......@@ -116,6 +143,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>
......@@ -139,6 +190,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>
......@@ -165,10 +240,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>
......@@ -338,9 +338,9 @@ public:
const SfxItemSet* pAttrSet,
SdrView* pView ) = 0 ;
virtual VclPtr<AbstractSvxCaptionDialog> CreateCaptionDialog( vcl::Window* pParent,
const SdrView* pView,
SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE ) = 0;
virtual VclPtr<AbstractSvxCaptionDialog> CreateCaptionDialog(weld::Window* pParent,
const SdrView* pView,
SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) = 0;
virtual VclPtr<AbstractSvxDistributeDialog> CreateSvxDistributeDialog(
const SfxItemSet& rAttr)= 0;
......
......@@ -265,7 +265,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog( pWin, pView ));
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog(pWin ? pWin->GetFrameWeld() : nullptr, pView));
const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
......
......@@ -93,7 +93,7 @@ void FuTransform::DoExecute( SfxRequest& rReq )
mpView->GetAttributes( aNewAttr );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
pDlg.reset(pFact->CreateCaptionDialog(mpViewShell->GetActiveWindow(), mpView));
pDlg.reset(pFact->CreateCaptionDialog(mpViewShell->GetFrameWeld(), mpView));
const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
......
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