summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-10 16:42:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-10 21:57:53 +0200
commita4d35e9ed6b26d329d05bc4f39e21aac34510e0a (patch)
tree37907984b564d1818841fc0161c81885474faaf2 /sd
parent8154d17893afff1b910dfe51cb6a6f9c78c301bb (diff)
weld SdVectorizeDlg
Change-Id: I15469be36807bcfca9882d04dd5d55933692abf7 Reviewed-on: https://gerrit.libreoffice.org/54092 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/sdabstdlg.hxx2
-rw-r--r--sd/qa/unit/dialogs-test.cxx3
-rw-r--r--sd/source/ui/dlg/sddlgfact.cxx13
-rw-r--r--sd/source/ui/dlg/sddlgfact.hxx11
-rw-r--r--sd/source/ui/dlg/vectdlg.cxx146
-rw-r--r--sd/source/ui/func/fuvect.cxx2
-rw-r--r--sd/source/ui/inc/vectdlg.hxx54
-rw-r--r--sd/uiconfig/sdraw/ui/vectorize.ui100
8 files changed, 179 insertions, 152 deletions
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index 1cd4f51d11e7..8595a6044252 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -197,7 +197,7 @@ public:
virtual VclPtr<AbstractSdPresLayoutDlg> CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, const SfxItemSet& rInAttrs) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSdTabTemplateDlg(vcl::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView) = 0;
virtual VclPtr<SfxAbstractDialog> CreatSdActionDialog(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0;
- virtual VclPtr<AbstractSdVectorizeDlg> CreateSdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) = 0;
+ virtual VclPtr<AbstractSdVectorizeDlg> CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell) = 0;
virtual VclPtr<AbstractSdPublishingDlg> CreateSdPublishingDlg( vcl::Window* pWindow, DocumentType eDocType) = 0;
virtual VclPtr<VclAbstractDialog> CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) = 0;
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index a4a0a049bd7a..a4c9c067aa86 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -545,8 +545,9 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
// CreateSdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell) override;
// works well with empty Bitmap, but my be nicer with setting one
Bitmap aEmptyBitmap;
+ auto const parent = Application::GetDefDialogParent();
pRetval = getSdAbstractDialogFactory()->CreateSdVectorizeDlg(
- Application::GetDefDialogParent(),
+ parent == nullptr ? nullptr : parent->GetFrameWeld(),
aEmptyBitmap,
getDocShell());
break;
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 180d63d95441..c0b8d950d158 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -82,7 +82,12 @@ short AbstractSdStartPresDlg_Impl::Execute()
IMPL_ABSTDLG_BASE(AbstractSdPresLayoutDlg_Impl);
IMPL_ABSTDLG_BASE(SdAbstractSfxDialog_Impl);
-IMPL_ABSTDLG_BASE(AbstractSdVectorizeDlg_Impl);
+
+short AbstractSdVectorizeDlg_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
IMPL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractBulletDialog_Impl);
@@ -300,7 +305,7 @@ void SdAbstractSfxDialog_Impl::SetText( const OUString& rStr )
const GDIMetaFile& AbstractSdVectorizeDlg_Impl::GetGDIMetaFile() const
{
- return pDlg->GetGDIMetaFile();
+ return m_xDlg->GetGDIMetaFile();
}
void AbstractSdPublishingDlg_Impl::GetParameterSequence( css::uno::Sequence< css::beans::PropertyValue >& rParams )
@@ -408,9 +413,9 @@ VclPtr<SfxAbstractDialog> SdAbstractDialogFactory_Impl::CreatSdActionDialog(vcl:
return VclPtr<SdAbstractSfxDialog_Impl>::Create( VclPtr<SdActionDlg>::Create( pParent, pAttr, pView ) );
}
-VclPtr<AbstractSdVectorizeDlg> SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell )
+VclPtr<AbstractSdVectorizeDlg> SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell)
{
- return VclPtr<AbstractSdVectorizeDlg_Impl>::Create( VclPtr<SdVectorizeDlg>::Create( pParent, rBmp, pDocShell ) );
+ return VclPtr<AbstractSdVectorizeDlg_Impl>::Create(new SdVectorizeDlg(pParent, rBmp, pDocShell));
}
VclPtr<AbstractSdPublishingDlg> SdAbstractDialogFactory_Impl::CreateSdPublishingDlg( vcl::Window* pParent, DocumentType eDocType)
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 8008f4c7b5d2..55765fb23861 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -237,7 +237,14 @@ class SdAbstractSfxDialog_Impl : public SfxAbstractDialog
class SdVectorizeDlg;
class AbstractSdVectorizeDlg_Impl :public AbstractSdVectorizeDlg
{
- DECL_ABSTDLG_BASE(AbstractSdVectorizeDlg_Impl,SdVectorizeDlg)
+private:
+ std::unique_ptr<SdVectorizeDlg> m_xDlg;
+public:
+ AbstractSdVectorizeDlg_Impl(SdVectorizeDlg* pDlg)
+ : m_xDlg(pDlg)
+ {
+ }
+ virtual short Execute() override;
virtual const GDIMetaFile& GetGDIMetaFile() const override ;
};
@@ -279,7 +286,7 @@ public:
virtual VclPtr<AbstractSdPresLayoutDlg> CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, const SfxItemSet& rInAttrs) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSdTabTemplateDlg(vcl::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ) override;
virtual VclPtr<SfxAbstractDialog> CreatSdActionDialog(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override;
- virtual VclPtr<AbstractSdVectorizeDlg> CreateSdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell) override;
+ virtual VclPtr<AbstractSdVectorizeDlg> CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell) override;
virtual VclPtr<AbstractSdPublishingDlg> CreateSdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType) override;
virtual VclPtr<VclAbstractDialog> CreateSdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pDoc) override;
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index 44ed925dc767..145bc94fd3f5 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -30,39 +30,32 @@
#define VECTORIZE_MAX_EXTENT 512
-SdVectorizeDlg::SdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell)
- : ModalDialog(pParent, "VectorizeDialog", "modules/sdraw/ui/vectorize.ui")
- , mpDocSh(pDocShell)
+SdVectorizeDlg::SdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell)
+ : GenericDialogController(pParent, "modules/sdraw/ui/vectorize.ui", "VectorizeDialog")
+ , m_pDocSh(pDocShell)
, aBmp(rBmp)
+ , m_xNmLayers(m_xBuilder->weld_spin_button("colors"))
+ , m_xMtReduce(m_xBuilder->weld_metric_spin_button("points", FUNIT_PIXEL))
+ , m_xFtFillHoles(m_xBuilder->weld_label("tilesft"))
+ , m_xMtFillHoles(m_xBuilder->weld_metric_spin_button("tiles", FUNIT_PIXEL))
+ , m_xCbFillHoles(m_xBuilder->weld_check_button("fillholes"))
+ , m_xBmpWin(new SvxGraphCtrl(*m_xBuilder, "source"))
+ , m_xMtfWin(new SvxGraphCtrl(*m_xBuilder, "vectorized"))
+ , m_xPrgs(m_xBuilder->weld_progress_bar("progressbar"))
+ , m_xBtnOK(m_xBuilder->weld_button("ok"))
+ , m_xBtnPreview(m_xBuilder->weld_button("preview"))
{
- get(m_pNmLayers, "colors");
- get(m_pMtReduce, "points");
- get(m_pCbFillHoles, "fillholes");
- get(m_pFtFillHoles, "tilesft");
- get(m_pMtFillHoles, "tiles");
- get(m_pBmpWin, "source");
- get(m_pMtfWin, "vectorized");
-
- Size aSize(LogicToPixel(Size(92, 100), MapMode(MapUnit::MapAppFont)));
- m_pBmpWin->set_width_request(aSize.Width());
- m_pMtfWin->set_width_request(aSize.Width());
- m_pBmpWin->set_height_request(aSize.Height());
- m_pMtfWin->set_height_request(aSize.Height());
-
- get(m_pPrgs, "progressbar");
- get(m_pBtnPreview, "preview");
- get(m_pBtnOK, "ok");
-
- m_pBtnPreview->SetClickHdl( LINK( this, SdVectorizeDlg, ClickPreviewHdl ) );
- m_pBtnOK->SetClickHdl( LINK( this, SdVectorizeDlg, ClickOKHdl ) );
- m_pNmLayers->SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
- m_pMtReduce->SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
- m_pMtFillHoles->SetModifyHdl( LINK( this, SdVectorizeDlg, ModifyHdl ) );
- m_pCbFillHoles->SetToggleHdl( LINK( this, SdVectorizeDlg, ToggleHdl ) );
-
- // disable 3D border
- m_pBmpWin->SetBorderStyle(WindowBorderStyle::MONO);
- m_pMtfWin->SetBorderStyle(WindowBorderStyle::MONO);
+ const int nWidth = m_xFtFillHoles->get_approximate_digit_width() * 32;
+ const int nHeight = m_xFtFillHoles->get_text_height() * 16;
+ m_xBmpWin->set_size_request(nWidth, nHeight);
+ m_xMtfWin->set_size_request(nWidth, nHeight);
+
+ m_xBtnPreview->connect_clicked( LINK( this, SdVectorizeDlg, ClickPreviewHdl ) );
+ m_xBtnOK->connect_clicked( LINK( this, SdVectorizeDlg, ClickOKHdl ) );
+ m_xNmLayers->connect_value_changed( LINK( this, SdVectorizeDlg, ModifyHdl ) );
+ m_xMtReduce->connect_value_changed( LINK( this, SdVectorizeDlg, MetricModifyHdl ) );
+ m_xMtFillHoles->connect_value_changed( LINK( this, SdVectorizeDlg, MetricModifyHdl ) );
+ m_xCbFillHoles->connect_toggled( LINK( this, SdVectorizeDlg, ToggleHdl ) );
LoadSettings();
InitPreviewBmp();
@@ -70,22 +63,6 @@ SdVectorizeDlg::SdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::D
SdVectorizeDlg::~SdVectorizeDlg()
{
- disposeOnce();
-}
-
-void SdVectorizeDlg::dispose()
-{
- m_pNmLayers.clear();
- m_pMtReduce.clear();
- m_pFtFillHoles.clear();
- m_pMtFillHoles.clear();
- m_pCbFillHoles.clear();
- m_pBmpWin.clear();
- m_pMtfWin.clear();
- m_pPrgs.clear();
- m_pBtnOK.clear();
- m_pBtnPreview.clear();
- ModalDialog::dispose();
}
::tools::Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize )
@@ -120,11 +97,11 @@ void SdVectorizeDlg::dispose()
void SdVectorizeDlg::InitPreviewBmp()
{
- const ::tools::Rectangle aRect( GetRect( m_pBmpWin->GetSizePixel(), aBmp.GetSizePixel() ) );
+ const ::tools::Rectangle aRect( GetRect( m_xBmpWin->GetSize(), aBmp.GetSizePixel() ) );
aPreviewBmp = aBmp;
aPreviewBmp.Scale( aRect.GetSize() );
- m_pBmpWin->SetGraphic( aPreviewBmp );
+ m_xBmpWin->SetGraphic( aPreviewBmp );
}
Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap const & rBmp, Fraction& rScale )
@@ -142,7 +119,7 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap const & rBmp, Fraction& rScale
rScale = Fraction( 1, 1 );
BitmapEx aNewBmpEx(aNew);
- BitmapFilter::Filter(aNewBmpEx, BitmapSimpleColorQuantizationFilter(static_cast<sal_uInt16>(m_pNmLayers->GetValue())));
+ BitmapFilter::Filter(aNewBmpEx, BitmapSimpleColorQuantizationFilter(m_xNmLayers->get_value()));
aNew = aNewBmpEx.GetBitmap();
return aNew;
@@ -150,8 +127,8 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap const & rBmp, Fraction& rScale
void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf )
{
- mpDocSh->SetWaitCursor( true );
- m_pPrgs->SetValue( 0 );
+ m_pDocSh->SetWaitCursor( true );
+ m_xPrgs->set_percentage(0);
Fraction aScale;
Bitmap aTmp( GetPreparedBitmap( rBmp, aScale ) );
@@ -159,9 +136,9 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf )
if( !!aTmp )
{
const Link<long,void> aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) );
- aTmp.Vectorize( rMtf, static_cast<sal_uInt8>(m_pMtReduce->GetValue()), &aPrgsHdl );
+ aTmp.Vectorize( rMtf, static_cast<sal_uInt8>(m_xMtReduce->get_value(FUNIT_NONE)), &aPrgsHdl );
- if( m_pCbFillHoles->IsChecked() )
+ if (m_xCbFillHoles->get_active())
{
GDIMetaFile aNewMtf;
Bitmap::ScopedReadAccess pRAcc(aTmp);
@@ -170,8 +147,8 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf )
{
const long nWidth = pRAcc->Width();
const long nHeight = pRAcc->Height();
- const long nTileX = static_cast<long>(m_pMtFillHoles->GetValue());
- const long nTileY = static_cast<long>(m_pMtFillHoles->GetValue());
+ const long nTileX = m_xMtFillHoles->get_value(FUNIT_NONE);
+ const long nTileY = m_xMtFillHoles->get_value(FUNIT_NONE);
assert(nTileX && "div-by-zero");
const long nCountX = nWidth / nTileX;
assert(nTileY && "div-by-zero");
@@ -218,8 +195,8 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf )
}
}
- m_pPrgs->SetValue( 0 );
- mpDocSh->SetWaitCursor( false );
+ m_xPrgs->set_percentage(0);
+ m_pDocSh->SetWaitCursor( false );
}
void SdVectorizeDlg::AddTile( BitmapReadAccess const * pRAcc, GDIMetaFile& rMtf,
@@ -249,7 +226,7 @@ void SdVectorizeDlg::AddTile( BitmapReadAccess const * pRAcc, GDIMetaFile& rMtf,
::tools::Rectangle aRect( Point( nPosX, nPosY ), Size( nWidth + 1, nHeight + 1 ) );
const Size& rMaxSize = rMtf.GetPrefSize();
- aRect = PixelToLogic( aRect, rMtf.GetPrefMapMode() );
+ aRect = Application::GetDefaultDevice()->PixelToLogic(aRect, rMtf.GetPrefMapMode());
if( aRect.Right() > ( rMaxSize.Width() - 1 ) )
aRect.SetRight( rMaxSize.Width() - 1 );
@@ -264,44 +241,49 @@ void SdVectorizeDlg::AddTile( BitmapReadAccess const * pRAcc, GDIMetaFile& rMtf,
IMPL_LINK( SdVectorizeDlg, ProgressHdl, long, nData, void )
{
- m_pPrgs->SetValue( static_cast<sal_uInt16>(nData) );
+ m_xPrgs->set_percentage(nData);
}
-IMPL_LINK_NOARG(SdVectorizeDlg, ClickPreviewHdl, Button*, void)
+IMPL_LINK_NOARG(SdVectorizeDlg, ClickPreviewHdl, weld::Button&, void)
{
Calculate( aBmp, aMtf );
- m_pMtfWin->SetGraphic( aMtf );
- m_pBtnPreview->Disable();
+ m_xMtfWin->SetGraphic( aMtf );
+ m_xBtnPreview->set_sensitive(false);
}
-IMPL_LINK_NOARG(SdVectorizeDlg, ClickOKHdl, Button*, void)
+IMPL_LINK_NOARG(SdVectorizeDlg, ClickOKHdl, weld::Button&, void)
{
- if( m_pBtnPreview->IsEnabled() )
+ if (m_xBtnPreview->get_sensitive())
Calculate( aBmp, aMtf );
SaveSettings();
- EndDialog( RET_OK );
+ m_xDialog->response(RET_OK);
}
-IMPL_LINK( SdVectorizeDlg, ToggleHdl, CheckBox&, rCb, void )
+IMPL_LINK( SdVectorizeDlg, ToggleHdl, weld::ToggleButton&, rCb, void )
{
- if( rCb.IsChecked() )
+ if (rCb.get_active())
{
- m_pFtFillHoles->Enable();
- m_pMtFillHoles->Enable();
+ m_xFtFillHoles->set_sensitive(true);
+ m_xMtFillHoles->set_sensitive(true);
}
else
{
- m_pFtFillHoles->Disable();
- m_pMtFillHoles->Disable();
+ m_xFtFillHoles->set_sensitive(false);
+ m_xMtFillHoles->set_sensitive(false);
}
- m_pBtnPreview->Enable();
+ m_xBtnPreview->set_sensitive(true);
+}
+
+IMPL_LINK_NOARG(SdVectorizeDlg, ModifyHdl, weld::SpinButton&, void)
+{
+ m_xBtnPreview->set_sensitive(true);
}
-IMPL_LINK_NOARG(SdVectorizeDlg, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SdVectorizeDlg, MetricModifyHdl, weld::MetricSpinButton&, void)
{
- m_pBtnPreview->Enable();
+ m_xBtnPreview->set_sensitive(true);
}
void SdVectorizeDlg::LoadSettings()
@@ -327,12 +309,12 @@ void SdVectorizeDlg::LoadSettings()
bFillHoles = false;
}
- m_pNmLayers->SetValue( nLayers );
- m_pMtReduce->SetValue( nReduce );
- m_pMtFillHoles->SetValue( nFillHoles );
- m_pCbFillHoles->Check( bFillHoles );
+ m_xNmLayers->set_value(nLayers);
+ m_xMtReduce->set_value(nReduce, FUNIT_NONE);
+ m_xMtFillHoles->set_value(nFillHoles, FUNIT_NONE);
+ m_xCbFillHoles->set_active(bFillHoles);
- ToggleHdl(*m_pCbFillHoles);
+ ToggleHdl(*m_xCbFillHoles);
}
void SdVectorizeDlg::SaveSettings() const
@@ -344,8 +326,8 @@ void SdVectorizeDlg::SaveSettings() const
if( xOStm.is() )
{
SdIOCompat aCompat( *xOStm, StreamMode::WRITE, 1 );
- xOStm->WriteUInt16( m_pNmLayers->GetValue() ).WriteUInt16( m_pMtReduce->GetValue() );
- xOStm->WriteUInt16( m_pMtFillHoles->GetValue() ).WriteBool( m_pCbFillHoles->IsChecked() );
+ xOStm->WriteUInt16( m_xNmLayers->get_value() ).WriteUInt16(m_xMtReduce->get_value(FUNIT_NONE));
+ xOStm->WriteUInt16( m_xMtFillHoles->get_value(FUNIT_NONE) ).WriteBool(m_xCbFillHoles->get_active());
}
}
diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx
index 8a547243d6d8..7d51a805be5e 100644
--- a/sd/source/ui/func/fuvect.cxx
+++ b/sd/source/ui/func/fuvect.cxx
@@ -62,7 +62,7 @@ void FuVectorize::DoExecute( SfxRequest& )
if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr )
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSdVectorizeDlg> pDlg(pFact ? pFact->CreateSdVectorizeDlg( mpWindow, static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmap(), mpDocSh ) : nullptr);
+ ScopedVclPtr<AbstractSdVectorizeDlg> pDlg(pFact ? pFact->CreateSdVectorizeDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmap(), mpDocSh ) : nullptr);
if( pDlg && pDlg->Execute() == RET_OK )
{
const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx
index 9a6ddd2304b3..370508f90852 100644
--- a/sd/source/ui/inc/vectdlg.hxx
+++ b/sd/source/ui/inc/vectdlg.hxx
@@ -20,13 +20,7 @@
#ifndef INCLUDED_SD_SOURCE_UI_INC_VECTDLG_HXX
#define INCLUDED_SD_SOURCE_UI_INC_VECTDLG_HXX
-#include <vcl/button.hxx>
-#include <vcl/group.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/prgsbar.hxx>
+#include <vcl/weld.hxx>
#include <svx/graphctl.hxx>
namespace sd {
@@ -39,28 +33,24 @@ class DrawDocShell;
|*
\******************************************************************************/
-class SdVectorizeDlg : public ModalDialog
+class SdVectorizeDlg : public weld::GenericDialogController
{
- ::sd::DrawDocShell * mpDocSh;
- VclPtr<NumericField> m_pNmLayers;
- VclPtr<MetricField> m_pMtReduce;
- VclPtr<FixedText> m_pFtFillHoles;
- VclPtr<MetricField> m_pMtFillHoles;
- VclPtr<CheckBox> m_pCbFillHoles;
-
- VclPtr<GraphCtrl> m_pBmpWin;
-
- VclPtr<GraphCtrl> m_pMtfWin;
-
- VclPtr<ProgressBar> m_pPrgs;
-
- VclPtr<OKButton> m_pBtnOK;
- VclPtr<PushButton> m_pBtnPreview;
-
+ ::sd::DrawDocShell* m_pDocSh;
Bitmap aBmp;
Bitmap aPreviewBmp;
GDIMetaFile aMtf;
+ std::unique_ptr<weld::SpinButton> m_xNmLayers;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtReduce;
+ std::unique_ptr<weld::Label> m_xFtFillHoles;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtFillHoles;
+ std::unique_ptr<weld::CheckButton> m_xCbFillHoles;
+ std::unique_ptr<SvxGraphCtrl> m_xBmpWin;
+ std::unique_ptr<SvxGraphCtrl> m_xMtfWin;
+ std::unique_ptr<weld::ProgressBar> m_xPrgs;
+ std::unique_ptr<weld::Button> m_xBtnOK;
+ std::unique_ptr<weld::Button> m_xBtnPreview;
+
void LoadSettings();
void SaveSettings() const;
void InitPreviewBmp();
@@ -71,17 +61,17 @@ class SdVectorizeDlg : public ModalDialog
void AddTile( BitmapReadAccess const * pRAcc, GDIMetaFile& rMtf,
long nPosX, long nPosY, long nWidth, long nHeight );
- DECL_LINK( ProgressHdl, long, void );
- DECL_LINK( ClickPreviewHdl, Button*, void );
- DECL_LINK( ClickOKHdl, Button*, void );
- DECL_LINK( ToggleHdl, CheckBox&, void );
- DECL_LINK( ModifyHdl, Edit&, void );
+ DECL_LINK( ProgressHdl, long, void );
+ DECL_LINK( ClickPreviewHdl, weld::Button&, void );
+ DECL_LINK( ClickOKHdl, weld::Button&, void );
+ DECL_LINK( ToggleHdl, weld::ToggleButton&, void );
+ DECL_LINK( ModifyHdl, weld::SpinButton&, void );
+ DECL_LINK( MetricModifyHdl, weld::MetricSpinButton&, void );
public:
- SdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell );
- virtual ~SdVectorizeDlg() override;
- virtual void dispose() override;
+ SdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell);
+ virtual ~SdVectorizeDlg() override;
const GDIMetaFile& GetGDIMetaFile() const { return aMtf; }
};
diff --git a/sd/uiconfig/sdraw/ui/vectorize.ui b/sd/uiconfig/sdraw/ui/vectorize.ui
index 0d7ccad1f96c..4bc9fecd61a9 100644
--- a/sd/uiconfig/sdraw/ui/vectorize.ui
+++ b/sd/uiconfig/sdraw/ui/vectorize.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="sd">
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1">
@@ -26,7 +26,10 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="vectorize|VectorizeDialog">Convert to Polygon</property>
<property name="resizable">False</property>
+ <property name="modal">True</property>
<property name="window_position">mouse</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">
@@ -38,14 +41,12 @@
<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="preview">
+ <property name="label" translatable="yes" context="vectorize|preview">Preview</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>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -54,10 +55,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>
@@ -68,12 +71,12 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="preview">
- <property name="label" translatable="yes" context="vectorize|preview">Preview</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>
- <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -114,10 +117,10 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="vectorize|label2">Number of colors:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">colors</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -128,6 +131,7 @@
<object class="GtkSpinButton" id="colors">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
@@ -139,10 +143,10 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="vectorize|label3">Point reduction:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">points:0px</property>
+ <property name="mnemonic_widget">points</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -150,9 +154,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="points:0px">
+ <object class="GtkSpinButton" id="points">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
@@ -165,11 +170,11 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
- <property name="xalign">0</property>
<property name="xpad">12</property>
<property name="label" translatable="yes" context="vectorize|tilesft">Tile size:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">tiles:0px</property>
+ <property name="mnemonic_widget">tiles</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -177,9 +182,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="tiles:0px">
+ <object class="GtkSpinButton" id="tiles">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustment3</property>
</object>
<packing>
@@ -222,10 +228,10 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="vectorize|label5">Source image:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">tiles:0px</property>
+ <property name="mnemonic_widget">source</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -236,10 +242,10 @@
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="vectorize|label6">Vectorized image:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">tiles:0px</property>
+ <property name="mnemonic_widget">vectorized</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -247,11 +253,28 @@
</packing>
</child>
<child>
- <object class="svxlo-GraphCtrl" id="source:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkDrawingArea" id="source">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -259,11 +282,28 @@
</packing>
</child>
<child>
- <object class="svxlo-GraphCtrl" id="vectorized:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkDrawingArea" id="vectorized">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -294,8 +334,10 @@
<action-widgets>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
- <action-widget response="0">preview</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>