[Libreoffice-commits] core.git: include/svx include/vcl sd/inc sd/qa sd/source sd/uiconfig svx/source vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Thu May 10 19:58:17 UTC 2018


 include/svx/graphctl.hxx          |   53 ++++++++++---
 include/vcl/weld.hxx              |    8 ++
 sd/inc/sdabstdlg.hxx              |    2 
 sd/qa/unit/dialogs-test.cxx       |    3 
 sd/source/ui/dlg/sddlgfact.cxx    |   13 ++-
 sd/source/ui/dlg/sddlgfact.hxx    |   11 ++
 sd/source/ui/dlg/vectdlg.cxx      |  146 ++++++++++++++++----------------------
 sd/source/ui/func/fuvect.cxx      |    2 
 sd/source/ui/inc/vectdlg.hxx      |   54 +++++---------
 sd/uiconfig/sdraw/ui/vectorize.ui |  100 ++++++++++++++++++--------
 svx/source/dialog/graphctl.cxx    |   72 ++++++++++++++++++
 vcl/source/app/salvtables.cxx     |   25 ++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx      |   27 +++++++
 13 files changed, 350 insertions(+), 166 deletions(-)

New commits:
commit a4d35e9ed6b26d329d05bc4f39e21aac34510e0a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 10 16:42:15 2018 +0100

    weld SdVectorizeDlg
    
    Change-Id: I15469be36807bcfca9882d04dd5d55933692abf7
    Reviewed-on: https://gerrit.libreoffice.org/54092
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx
index f32454a56ae4..13d323c48a93 100644
--- a/include/svx/graphctl.hxx
+++ b/include/svx/graphctl.hxx
@@ -21,12 +21,27 @@
 
 #include <vcl/ctrl.hxx>
 #include <vcl/graph.hxx>
+#include <vcl/weld.hxx>
 #include <svx/svxdllapi.h>
 
 #include <svx/svdview.hxx>
 #include <svx/svdobj.hxx>
 
-class GraphCtrlUserCall;
+class GraphCtrl;
+
+class GraphCtrlUserCall : public SdrObjUserCall
+{
+    GraphCtrl& rWin;
+
+public:
+
+    GraphCtrlUserCall(GraphCtrl& rGraphWin)
+        : rWin(rGraphWin)
+    {}
+
+    virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override;
+};
+
 class SvxGraphCtrlAccessibleContext;
 
 class SVX_DLLPUBLIC GraphCtrl : public Control
@@ -71,7 +86,7 @@ protected:
     virtual void        SdrObjChanged( const SdrObject& rObj );
     virtual void        MarkListHasChanged();
 
-    inline SdrObjUserCall* GetSdrUserCall();
+    SdrObjUserCall* GetSdrUserCall() { return pUserCall; }
 
 public:
 
@@ -109,24 +124,34 @@ public:
     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
 };
 
-
-class GraphCtrlUserCall : public SdrObjUserCall
+class SVX_DLLPUBLIC SvxGraphCtrl
 {
-    GraphCtrl& rWin;
+    MapMode             aMap100;
+    Graphic             aGraphic;
+    Size                aGraphSize;
+    Size                maSize;
+
+    std::unique_ptr<weld::DrawingArea> mxDrawingArea;
+
+    DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
+    DECL_LINK(DoResize, const Size& rSize, void);
 
 public:
 
-    GraphCtrlUserCall(GraphCtrl& rGraphWin)
-        : rWin(rGraphWin)
-    {}
+    SvxGraphCtrl(weld::Builder& rBuilder, const OString& rDrawingId);
+    virtual ~SvxGraphCtrl();
 
-    virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override;
-};
+    void                SetGraphic( const Graphic& rGraphic );
+    const Graphic&      GetGraphic() const { return aGraphic; }
+    const Size&         GetGraphicSize() const { return aGraphSize; }
 
-SdrObjUserCall* GraphCtrl::GetSdrUserCall()
-{
-    return pUserCall;
-}
+    const Size&         GetSize() const { return maSize; }
+
+    void set_size_request(int nWidth, int nHeight)
+    {
+        mxDrawingArea->set_size_request(nWidth, nHeight);
+    }
+};
 
 class GraphCtrlView : public SdrView
 {
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index b7f53ab0e057..306dc4fedebf 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -444,6 +444,13 @@ public:
     void connect_value_changed(const Link<Scale&, void>& rLink) { m_aValueChangedHdl = rLink; }
 };
 
+class VCL_DLLPUBLIC ProgressBar : virtual public Widget
+{
+public:
+    //0-100
+    virtual void set_percentage(int value) = 0;
+};
+
 class VCL_DLLPUBLIC Entry : virtual public Widget
 {
 private:
@@ -868,6 +875,7 @@ public:
     virtual Expander* weld_expander(const OString& id, bool bTakeOwnership = false) = 0;
     virtual Entry* weld_entry(const OString& id, bool bTakeOwnership = false) = 0;
     virtual Scale* weld_scale(const OString& id, bool bTakeOwnership = false) = 0;
+    virtual ProgressBar* weld_progress_bar(const OString& id, bool bTakeOwnership = false) = 0;
     virtual DrawingArea* weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
                                            FactoryFunction pUITestFactoryFunction = nullptr,
                                            void* pUserData = nullptr, bool bTakeOwnership = false)
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>
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 568827f303f5..5f959499f97b 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -771,4 +771,76 @@ css::uno::Reference< css::accessibility::XAccessible > GraphCtrl::CreateAccessib
     return mpAccContext.get();
 }
 
+SvxGraphCtrl::SvxGraphCtrl(weld::Builder& rBuilder, const OString& rDrawingId)
+    : aMap100(MapUnit::Map100thMM)
+    , mxDrawingArea(rBuilder.weld_drawing_area(rDrawingId))
+{
+    mxDrawingArea->connect_size_allocate(LINK(this, SvxGraphCtrl, DoResize));
+    mxDrawingArea->connect_draw(LINK(this, SvxGraphCtrl, DoPaint));
+}
+
+IMPL_LINK(SvxGraphCtrl, DoResize, const Size&, rSize, void)
+{
+    maSize = rSize;
+    mxDrawingArea->queue_draw();
+}
+
+IMPL_LINK(SvxGraphCtrl, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
+{
+    vcl::RenderContext& rRenderContext = aPayload.first;
+    const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
+    // #i73381# in non-SdrMode, paint to local directly
+    if (bGraphicValid && aGraphSize.Width() && aGraphSize.Height())
+    {
+        MapMode         aDisplayMap( aMap100 );
+        Point           aNewPos;
+        Size            aNewSize;
+        const Size      aWinSize = Application::GetDefaultDevice()->PixelToLogic( maSize, aMap100 );
+        const long      nWidth = aWinSize.Width();
+        const long      nHeight = aWinSize.Height();
+        double          fGrfWH = static_cast<double>(aGraphSize.Width()) / aGraphSize.Height();
+        double          fWinWH = static_cast<double>(nWidth) / nHeight;
+
+        // Adapt Bitmap to Thumb size
+        if ( fGrfWH < fWinWH)
+        {
+            aNewSize.setWidth( static_cast<long>( static_cast<double>(nHeight) * fGrfWH ) );
+            aNewSize.setHeight( nHeight );
+        }
+        else
+        {
+            aNewSize.setWidth( nWidth );
+            aNewSize.setHeight( static_cast<long>( static_cast<double>(nWidth) / fGrfWH ) );
+        }
+
+        aNewPos.setX( ( nWidth - aNewSize.Width() )  >> 1 );
+        aNewPos.setY( ( nHeight - aNewSize.Height() ) >> 1 );
+
+        // Implementing MapMode for Engine
+        aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
+        aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
+
+        aDisplayMap.SetOrigin(OutputDevice::LogicToLogic(aNewPos, aMap100, aDisplayMap));
+        rRenderContext.SetMapMode(aDisplayMap);
+
+        aGraphic.Draw(&rRenderContext, Point(), aGraphSize);
+    }
+}
+
+SvxGraphCtrl::~SvxGraphCtrl()
+{
+}
+
+void SvxGraphCtrl::SetGraphic(const Graphic& rGraphic)
+{
+    aGraphic = rGraphic;
+
+    if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
+        aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
+    else
+        aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
+
+    mxDrawingArea->queue_draw();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index d5d613b892f1..4f5c0850418c 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -38,6 +38,7 @@
 #include <vcl/dialog.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/menubtn.hxx>
+#include <vcl/prgsbar.hxx>
 #include <vcl/slider.hxx>
 #include <vcl/sysdata.hxx>
 #include <vcl/tabctrl.hxx>
@@ -1140,6 +1141,24 @@ IMPL_LINK_NOARG(SalInstanceScale, SlideHdl, Slider*, void)
     signal_value_changed();
 }
 
+class SalInstanceProgressBar : public SalInstanceWidget, public virtual weld::ProgressBar
+{
+private:
+    VclPtr<::ProgressBar> m_xProgressBar;
+
+public:
+    SalInstanceProgressBar(::ProgressBar* pProgressBar, bool bTakeOwnership)
+        : SalInstanceWidget(pProgressBar, bTakeOwnership)
+        , m_xProgressBar(pProgressBar)
+    {
+    }
+
+    virtual void set_percentage(int value) override
+    {
+        m_xProgressBar->SetValue(value);
+    }
+};
+
 class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry
 {
 private:
@@ -2175,6 +2194,12 @@ public:
         return pSlider ? new SalInstanceScale(pSlider, bTakeOwnership) : nullptr;
     }
 
+    virtual weld::ProgressBar* weld_progress_bar(const OString &id, bool bTakeOwnership) override
+    {
+        ::ProgressBar* pProgress = m_xBuilder->get<::ProgressBar>(id);
+        return pProgress ? new SalInstanceProgressBar(pProgress, bTakeOwnership) : nullptr;
+    }
+
     virtual weld::Entry* weld_entry(const OString &id, bool bTakeOwnership) override
     {
         Edit* pEntry = m_xBuilder->get<Edit>(id);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7b972cebea00..8ffa151cd4b7 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2747,6 +2747,24 @@ public:
     }
 };
 
+class GtkInstanceProgressBar : public GtkInstanceWidget, public virtual weld::ProgressBar
+{
+private:
+    GtkProgressBar* m_pProgressBar;
+
+public:
+    GtkInstanceProgressBar(GtkProgressBar* pProgressBar, bool bTakeOwnership)
+        : GtkInstanceWidget(GTK_WIDGET(pProgressBar), bTakeOwnership)
+        , m_pProgressBar(pProgressBar)
+    {
+    }
+
+    virtual void set_percentage(int value) override
+    {
+        gtk_progress_bar_set_fraction(m_pProgressBar, value / 100.0);
+    }
+};
+
 class GtkInstanceEntry : public GtkInstanceWidget, public virtual weld::Entry
 {
 private:
@@ -4598,6 +4616,15 @@ public:
         return new GtkInstanceScale(pScale, bTakeOwnership);
     }
 
+    virtual weld::ProgressBar* weld_progress_bar(const OString &id, bool bTakeOwnership) override
+    {
+        GtkProgressBar* pProgressBar = GTK_PROGRESS_BAR(gtk_builder_get_object(m_pBuilder, id.getStr()));
+        if (!pProgressBar)
+            return nullptr;
+        auto_add_parentless_widgets_to_container(GTK_WIDGET(pProgressBar));
+        return new GtkInstanceProgressBar(pProgressBar, bTakeOwnership);
+    }
+
     virtual weld::Entry* weld_entry(const OString &id, bool bTakeOwnership) override
     {
         GtkEntry* pEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilder, id.getStr()));


More information about the Libreoffice-commits mailing list