Kaydet (Commit) 5fa87d26 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld MasterLayoutDialog

Change-Id: Iab0a2c1565f109886596a1c15179fdf497633752
Reviewed-on: https://gerrit.libreoffice.org/53650Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 337b9e63
......@@ -200,9 +200,7 @@ public:
virtual VclPtr<AbstractSdVectorizeDlg> CreateSdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) = 0;
virtual VclPtr<AbstractSdPublishingDlg> CreateSdPublishingDlg( vcl::Window* pWindow, DocumentType eDocType) = 0;
virtual VclPtr<VclAbstractDialog> CreateMasterLayoutDialog( vcl::Window* pParent,
SdDrawDocument* pDoc,
SdPage* ) = 0;
virtual VclPtr<VclAbstractDialog> CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) = 0;
virtual VclPtr<AbstractHeaderFooterDialog> CreateHeaderFooterDialog( sd::ViewShell* pViewShell,
vcl::Window* pParent,
......
......@@ -563,8 +563,9 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
CPPUNIT_ASSERT(pDrawDoc);
SdPage* pSdPage = pDrawDoc->GetSdPage(0, PageKind::Standard);
CPPUNIT_ASSERT(pSdPage);
auto const parent = Application::GetDefDialogParent();
pRetval = getSdAbstractDialogFactory()->CreateMasterLayoutDialog(
Application::GetDefDialogParent(),
parent == nullptr ? nullptr : parent->GetFrameWeld(),
pDrawDoc,
pSdPage);
break;
......
......@@ -24,17 +24,16 @@
using namespace ::sd;
MasterLayoutDialog::MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage )
: ModalDialog(pParent, "MasterLayoutDialog", "modules/simpress/ui/masterlayoutdlg.ui")
MasterLayoutDialog::MasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage)
: GenericDialogController(pParent, "modules/simpress/ui/masterlayoutdlg.ui", "MasterLayoutDialog")
, mpDoc(pDoc)
, mpCurrentPage(pCurrentPage)
, mxCBDate(m_xBuilder->weld_check_button("datetime"))
, mxCBPageNumber(m_xBuilder->weld_check_button("pagenumber"))
, mxCBSlideNumber(m_xBuilder->weld_check_button("slidenumber"))
, mxCBHeader(m_xBuilder->weld_check_button("header"))
, mxCBFooter(m_xBuilder->weld_check_button("footer"))
{
get(mpCBDate, "datetime");
get(mpCBPageNumber, "pagenumber");
get(mpCBSlideNumber, "slidenumber");
get(mpCBHeader, "header");
get(mpCBFooter, "footer");
if( mpCurrentPage && !mpCurrentPage->IsMasterPage() )
{
mpCurrentPage = static_cast<SdPage*>(&(mpCurrentPage->TRG_GetMasterPage()));
......@@ -50,8 +49,8 @@ MasterLayoutDialog::MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pD
{
case PageKind::Standard:
{
mpCBHeader->Enable(false);
mpCBPageNumber->SetText(mpCBSlideNumber->GetText());
mxCBHeader->set_sensitive(false);
mxCBPageNumber->set_label(mxCBSlideNumber->get_label());
break;
}
case PageKind::Notes:
......@@ -65,39 +64,28 @@ MasterLayoutDialog::MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pD
mbOldFooter = mpCurrentPage->GetPresObj( PRESOBJ_FOOTER ) != nullptr;
mbOldPageNumber = mpCurrentPage->GetPresObj( PRESOBJ_SLIDENUMBER ) != nullptr;
mpCBHeader->Check( mbOldHeader );
mpCBDate->Check( mbOldDate );
mpCBFooter->Check( mbOldFooter );
mpCBPageNumber->Check( mbOldPageNumber );
mxCBHeader->set_active( mbOldHeader );
mxCBDate->set_active( mbOldDate );
mxCBFooter->set_active( mbOldFooter );
mxCBPageNumber->set_active( mbOldPageNumber );
}
MasterLayoutDialog::~MasterLayoutDialog()
{
disposeOnce();
}
void MasterLayoutDialog::dispose()
{
mpCBDate.clear();
mpCBPageNumber.clear();
mpCBSlideNumber.clear();
mpCBHeader.clear();
mpCBFooter.clear();
ModalDialog::dispose();
}
short MasterLayoutDialog::Execute()
short MasterLayoutDialog::execute()
{
if ( ModalDialog::Execute() )
if (m_xDialog->run() == RET_OK)
applyChanges();
return 1;
return RET_OK;
}
void MasterLayoutDialog::applyChanges()
{
mpDoc->BegUndo(GetText());
mpDoc->BegUndo(m_xDialog->get_title());
if( (mpCurrentPage->GetPageKind() != PageKind::Standard) && (mbOldHeader != mpCBHeader->IsChecked() ) )
if( (mpCurrentPage->GetPageKind() != PageKind::Standard) && (mbOldHeader != mxCBHeader->get_active() ) )
{
if( mbOldHeader )
remove( PRESOBJ_HEADER );
......@@ -105,7 +93,7 @@ void MasterLayoutDialog::applyChanges()
create( PRESOBJ_HEADER );
}
if( mbOldFooter != mpCBFooter->IsChecked() )
if( mbOldFooter != mxCBFooter->get_active() )
{
if( mbOldFooter )
remove( PRESOBJ_FOOTER );
......@@ -113,7 +101,7 @@ void MasterLayoutDialog::applyChanges()
create( PRESOBJ_FOOTER );
}
if( mbOldDate != mpCBDate->IsChecked() )
if( mbOldDate != mxCBDate->get_active() )
{
if( mbOldDate )
remove( PRESOBJ_DATETIME );
......@@ -121,7 +109,7 @@ void MasterLayoutDialog::applyChanges()
create( PRESOBJ_DATETIME );
}
if( mbOldPageNumber != mpCBPageNumber->IsChecked() )
if( mbOldPageNumber != mxCBPageNumber->get_active() )
{
if( mbOldPageNumber )
remove( PRESOBJ_SLIDENUMBER );
......
......@@ -74,6 +74,16 @@ short AbstractBreakDlg_Impl::Execute()
return m_xDlg->execute();
}
AbstractMasterLayoutDialog_Impl::AbstractMasterLayoutDialog_Impl(::sd::MasterLayoutDialog* pDlg)
: m_xDlg(pDlg)
{
}
short AbstractMasterLayoutDialog_Impl::Execute()
{
return m_xDlg->execute();
}
void AbstractCopyDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
{
pDlg->GetAttr( rOutAttrs );
......@@ -406,10 +416,9 @@ CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsSnapTabPageCreatorFunc()
return SdTpOptionsSnap::Create;
}
VclPtr<VclAbstractDialog> SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog( vcl::Window* pParent,
SdDrawDocument* pDoc, SdPage* pCurrentPage )
VclPtr<VclAbstractDialog> SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage)
{
return VclPtr<SdVclAbstractDialog_Impl>::Create( VclPtr<::sd::MasterLayoutDialog>::Create( pParent, pDoc, pCurrentPage ));
return VclPtr<AbstractMasterLayoutDialog_Impl>::Create(new ::sd::MasterLayoutDialog(pParent, pDoc, pCurrentPage));
}
VclPtr<AbstractHeaderFooterDialog> SdAbstractDialogFactory_Impl::CreateHeaderFooterDialog( sd::ViewShell* pViewShell,
......
......@@ -53,8 +53,9 @@ namespace sd {
class MorphDlg;
class CopyDlg;
class BreakDlg;
class HeaderFooterDialog;
class MasterLayoutDialog;
class OutlineBulletDlg;
class HeaderFooterDialog;
}
class Dialog;
......@@ -63,6 +64,15 @@ class SdVclAbstractDialog_Impl : public VclAbstractDialog
DECL_ABSTDLG_BASE(SdVclAbstractDialog_Impl,Dialog)
};
class AbstractMasterLayoutDialog_Impl : public VclAbstractDialog
{
private:
std::unique_ptr<sd::MasterLayoutDialog> m_xDlg;
public:
AbstractMasterLayoutDialog_Impl(::sd::MasterLayoutDialog* pDlg);
virtual short Execute() override;
};
class AbstractBreakDlg_Impl : public VclAbstractDialog
{
private:
......@@ -239,9 +249,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateSdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pDoc) override;
virtual VclPtr<VclAbstractDialog> CreateMasterLayoutDialog( vcl::Window* pParent,
SdDrawDocument* pDoc,
SdPage* ) override;
virtual VclPtr<VclAbstractDialog> CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) override;
virtual VclPtr<AbstractHeaderFooterDialog> CreateHeaderFooterDialog( sd::ViewShell* pViewShell,
vcl::Window* pParent,
......
......@@ -19,10 +19,7 @@
#ifndef INCLUDED_SD_SOURCE_UI_INC_MASTERLAYOUTDLG_HXX
#define INCLUDED_SD_SOURCE_UI_INC_MASTERLAYOUTDLG_HXX
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/weld.hxx>
#include <sdpage.hxx>
......@@ -31,17 +28,17 @@ class SdDrawDocument;
namespace sd
{
class MasterLayoutDialog : public ModalDialog
class MasterLayoutDialog : public weld::GenericDialogController
{
private:
SdDrawDocument* mpDoc;
SdPage* mpCurrentPage;
VclPtr<CheckBox> mpCBDate;
VclPtr<CheckBox> mpCBPageNumber;
VclPtr<CheckBox> mpCBSlideNumber;
VclPtr<CheckBox> mpCBHeader;
VclPtr<CheckBox> mpCBFooter;
std::unique_ptr<weld::CheckButton> mxCBDate;
std::unique_ptr<weld::CheckButton> mxCBPageNumber;
std::unique_ptr<weld::CheckButton> mxCBSlideNumber;
std::unique_ptr<weld::CheckButton> mxCBHeader;
std::unique_ptr<weld::CheckButton> mxCBFooter;
bool mbOldHeader;
bool mbOldFooter;
......@@ -53,11 +50,10 @@ private:
void create( PresObjKind eKind );
public:
MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage );
MasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage);
virtual ~MasterLayoutDialog() override;
virtual void dispose() override;
virtual short Execute() override;
short execute();
};
}
......
......@@ -315,7 +315,8 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
if (pFact)
{
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ));
vcl::Window* pWin = GetActiveWindow();
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), pPage));
pDlg->Execute();
Invalidate();
}
......
......@@ -7,6 +7,9 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="masterlayoutdlg|MasterLayoutDialog">Master Elements</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
......
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