[Libreoffice-commits] core.git: writerperfect/CppunitTest_writerperfect_wpftimport.mk writerperfect/inc writerperfect/qa writerperfect/source writerperfect/uiconfig

Caolán McNamara caolanm at redhat.com
Tue May 15 11:05:58 UTC 2018


 writerperfect/CppunitTest_writerperfect_wpftimport.mk               |    3 
 writerperfect/inc/ImportFilter.hxx                                  |   12 +
 writerperfect/inc/WPFTEncodingDialog.hxx                            |   21 +-
 writerperfect/qa/unit/DrawingImportTest.cxx                         |    7 
 writerperfect/qa/unit/PresentationImportTest.cxx                    |    5 
 writerperfect/qa/unit/SpreadsheetImportTest.cxx                     |    5 
 writerperfect/qa/unit/TextImportTest.cxx                            |    7 
 writerperfect/source/calc/MSWorksCalcImportFilter.cxx               |   23 +-
 writerperfect/source/calc/MSWorksCalcImportFilter.hxx               |    4 
 writerperfect/source/calc/MWAWCalcImportFilter.cxx                  |    2 
 writerperfect/source/calc/MWAWCalcImportFilter.hxx                  |    4 
 writerperfect/source/calc/NumbersImportFilter.cxx                   |    2 
 writerperfect/source/calc/NumbersImportFilter.hxx                   |    4 
 writerperfect/source/calc/StarOfficeCalcImportFilter.cxx            |    3 
 writerperfect/source/calc/StarOfficeCalcImportFilter.hxx            |    4 
 writerperfect/source/common/WPFTEncodingDialog.cxx                  |   78 ++--------
 writerperfect/source/draw/CDRImportFilter.cxx                       |    2 
 writerperfect/source/draw/CDRImportFilter.hxx                       |    4 
 writerperfect/source/draw/CMXImportFilter.cxx                       |    2 
 writerperfect/source/draw/CMXImportFilter.hxx                       |    4 
 writerperfect/source/draw/FreehandImportFilter.cxx                  |    2 
 writerperfect/source/draw/FreehandImportFilter.hxx                  |    4 
 writerperfect/source/draw/MSPUBImportFilter.cxx                     |    2 
 writerperfect/source/draw/MSPUBImportFilter.hxx                     |    4 
 writerperfect/source/draw/MWAWDrawImportFilter.cxx                  |    2 
 writerperfect/source/draw/MWAWDrawImportFilter.hxx                  |    4 
 writerperfect/source/draw/PageMakerImportFilter.cxx                 |    2 
 writerperfect/source/draw/PageMakerImportFilter.hxx                 |    4 
 writerperfect/source/draw/QXPImportFilter.cxx                       |    2 
 writerperfect/source/draw/QXPImportFilter.hxx                       |    4 
 writerperfect/source/draw/StarOfficeDrawImportFilter.cxx            |    3 
 writerperfect/source/draw/StarOfficeDrawImportFilter.hxx            |    4 
 writerperfect/source/draw/VisioImportFilter.cxx                     |    2 
 writerperfect/source/draw/VisioImportFilter.hxx                     |    4 
 writerperfect/source/draw/WPGImportFilter.cxx                       |    2 
 writerperfect/source/draw/WPGImportFilter.hxx                       |    4 
 writerperfect/source/draw/ZMFImportFilter.cxx                       |    2 
 writerperfect/source/draw/ZMFImportFilter.hxx                       |    4 
 writerperfect/source/impress/KeynoteImportFilter.cxx                |    2 
 writerperfect/source/impress/KeynoteImportFilter.hxx                |    4 
 writerperfect/source/impress/MWAWPresentationImportFilter.cxx       |    3 
 writerperfect/source/impress/MWAWPresentationImportFilter.hxx       |    4 
 writerperfect/source/impress/StarOfficePresentationImportFilter.cxx |    3 
 writerperfect/source/impress/StarOfficePresentationImportFilter.hxx |    4 
 writerperfect/source/writer/AbiWordImportFilter.cxx                 |    2 
 writerperfect/source/writer/AbiWordImportFilter.hxx                 |    4 
 writerperfect/source/writer/EBookImportFilter.cxx                   |    2 
 writerperfect/source/writer/EBookImportFilter.hxx                   |    3 
 writerperfect/source/writer/MSWorksImportFilter.cxx                 |   13 -
 writerperfect/source/writer/MSWorksImportFilter.hxx                 |    4 
 writerperfect/source/writer/MWAWImportFilter.cxx                    |    2 
 writerperfect/source/writer/MWAWImportFilter.hxx                    |    4 
 writerperfect/source/writer/PagesImportFilter.cxx                   |    2 
 writerperfect/source/writer/PagesImportFilter.hxx                   |    3 
 writerperfect/source/writer/StarOfficeWriterImportFilter.cxx        |    5 
 writerperfect/source/writer/StarOfficeWriterImportFilter.hxx        |    4 
 writerperfect/source/writer/WordPerfectImportFilter.cxx             |    7 
 writerperfect/uiconfig/ui/wpftencodingdialog.ui                     |    9 -
 58 files changed, 165 insertions(+), 170 deletions(-)

New commits:
commit 5f170e69728b8741ce3c0af1d140023577cc470b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 14 14:06:52 2018 +0100

    weld WPFTEncodingDialog
    
    and pass in parent window for dialog
    
    Change-Id: Ibe9f576a74dfbbee3e568c8d3454440700cb0405
    Reviewed-on: https://gerrit.libreoffice.org/54328
    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/writerperfect/CppunitTest_writerperfect_wpftimport.mk b/writerperfect/CppunitTest_writerperfect_wpftimport.mk
index 02247f46a1d3..101908aadeb4 100644
--- a/writerperfect/CppunitTest_writerperfect_wpftimport.mk
+++ b/writerperfect/CppunitTest_writerperfect_wpftimport.mk
@@ -29,10 +29,13 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_wpftimport,\
 	test \
 	unotest \
 	utl \
+	vcl \
 	wpftqahelper \
 	writerperfect \
 ))
 
+$(eval $(call gb_CppunitTest_use_external,writerperfect_wpftimport,boost_headers))
+
 $(eval $(call gb_CppunitTest_use_ure,writerperfect_wpftimport))
 $(eval $(call gb_CppunitTest_use_vcl,writerperfect_wpftimport))
 
diff --git a/writerperfect/inc/ImportFilter.hxx b/writerperfect/inc/ImportFilter.hxx
index 53029ef32176..1b2bca9dd995 100644
--- a/writerperfect/inc/ImportFilter.hxx
+++ b/writerperfect/inc/ImportFilter.hxx
@@ -31,6 +31,8 @@
 #include <cppuhelper/implbase.hxx>
 
 #include <unotools/mediadescriptor.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 
 #include "DocumentHandler.hxx"
 #include "WPXSvInputStream.hxx"
@@ -73,6 +75,9 @@ public:
             return false;
         }
 
+        css::uno::Reference<css::awt::XWindow> xDialogParent;
+        aDescriptor["ParentWindow"] >>= xDialogParent;
+
         // An XML import service: what we push sax messages to..
         css::uno::Reference<css::xml::sax::XDocumentHandler> xInternalHandler(
             mxContext->getServiceManager()->createInstanceWithContext(
@@ -95,7 +100,8 @@ public:
 
         doRegisterHandlers(exporter);
 
-        return doImportDocument(input, exporter, aDescriptor);
+        return doImportDocument(Application::GetFrameWeld(xDialogParent), input, exporter,
+                                aDescriptor);
     }
 
     virtual void SAL_CALL cancel() override {}
@@ -168,8 +174,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) = 0;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, Generator& rGenerator,
-                                  utl::MediaDescriptor& rDescriptor)
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  Generator& rGenerator, utl::MediaDescriptor& rDescriptor)
         = 0;
     virtual void doRegisterHandlers(Generator&){};
 
diff --git a/writerperfect/inc/WPFTEncodingDialog.hxx b/writerperfect/inc/WPFTEncodingDialog.hxx
index c6c501ff1af7..8b173e34026d 100644
--- a/writerperfect/inc/WPFTEncodingDialog.hxx
+++ b/writerperfect/inc/WPFTEncodingDialog.hxx
@@ -14,18 +14,16 @@
 
 #include <sal/types.h>
 
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
 
 #include "writerperfectdllapi.h"
 
 namespace writerperfect
 {
-class WRITERPERFECT_DLLPUBLIC WPFTEncodingDialog : public ModalDialog
+class WRITERPERFECT_DLLPUBLIC WPFTEncodingDialog : public weld::GenericDialogController
 {
 public:
-    WPFTEncodingDialog(const OUString& title, const OUString& defEncoding);
+    WPFTEncodingDialog(weld::Window* pParent, const OUString& title, const OUString& defEncoding);
 
     virtual ~WPFTEncodingDialog() override;
 
@@ -33,17 +31,14 @@ public:
     bool hasUserCalledCancel() const { return m_userHasCancelled; }
 
 private:
-    VclPtr<ListBox> m_pLbCharset;
-    VclPtr<OKButton> m_pBtnOk;
-    VclPtr<CancelButton> m_pBtnCancel;
-
     bool m_userHasCancelled;
 
-private:
-    DECL_LINK(DoubleClickHdl, ListBox&, void);
-    DECL_LINK(CancelHdl, Button*, void);
+    std::unique_ptr<weld::ComboBoxText> m_xLbCharset;
+    std::unique_ptr<weld::Button> m_xBtnOk;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
 
-    void dispose() override;
+private:
+    DECL_LINK(CancelHdl, weld::Button&, void);
 
     WPFTEncodingDialog(WPFTEncodingDialog const&) = delete;
     WPFTEncodingDialog& operator=(WPFTEncodingDialog const&) = delete;
diff --git a/writerperfect/qa/unit/DrawingImportTest.cxx b/writerperfect/qa/unit/DrawingImportTest.cxx
index f2e0a707a32b..5e71bf3e9b4f 100644
--- a/writerperfect/qa/unit/DrawingImportTest.cxx
+++ b/writerperfect/qa/unit/DrawingImportTest.cxx
@@ -45,14 +45,15 @@ public:
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
                                 rtl::OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
+    virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator,
                                   utl::MediaDescriptor& rDescriptor) override;
 
     static void generate(librevenge::RVNGDrawingInterface& rDocument);
 };
 
-bool DrawingImportFilter::doImportDocument(librevenge::RVNGInputStream&, OdgGenerator& rGenerator,
-                                           utl::MediaDescriptor&)
+bool DrawingImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
+                                           OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     DrawingImportFilter::generate(rGenerator);
     return true;
diff --git a/writerperfect/qa/unit/PresentationImportTest.cxx b/writerperfect/qa/unit/PresentationImportTest.cxx
index de0b951f1c03..8fc5a65d3141 100644
--- a/writerperfect/qa/unit/PresentationImportTest.cxx
+++ b/writerperfect/qa/unit/PresentationImportTest.cxx
@@ -45,13 +45,14 @@ public:
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
                                 rtl::OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
+    virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
+                                  OdpGenerator& rGenerator,
                                   utl::MediaDescriptor& rDescriptor) override;
 
     static void generate(librevenge::RVNGPresentationInterface& rDocument);
 };
 
-bool PresentationImportFilter::doImportDocument(librevenge::RVNGInputStream&,
+bool PresentationImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
                                                 OdpGenerator& rGenerator, utl::MediaDescriptor&)
 {
     PresentationImportFilter::generate(rGenerator);
diff --git a/writerperfect/qa/unit/SpreadsheetImportTest.cxx b/writerperfect/qa/unit/SpreadsheetImportTest.cxx
index ef4e18c16ff0..66b1623b39f4 100644
--- a/writerperfect/qa/unit/SpreadsheetImportTest.cxx
+++ b/writerperfect/qa/unit/SpreadsheetImportTest.cxx
@@ -44,13 +44,14 @@ public:
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
                                 rtl::OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
+    virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
+                                  OdsGenerator& rGenerator,
                                   utl::MediaDescriptor& rDescriptor) override;
 
     static void generate(librevenge::RVNGSpreadsheetInterface& rDocument);
 };
 
-bool SpreadsheetImportFilter::doImportDocument(librevenge::RVNGInputStream&,
+bool SpreadsheetImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
                                                OdsGenerator& rGenerator, utl::MediaDescriptor&)
 {
     SpreadsheetImportFilter::generate(rGenerator);
diff --git a/writerperfect/qa/unit/TextImportTest.cxx b/writerperfect/qa/unit/TextImportTest.cxx
index cbad0f154c27..de085a2f33b0 100644
--- a/writerperfect/qa/unit/TextImportTest.cxx
+++ b/writerperfect/qa/unit/TextImportTest.cxx
@@ -43,14 +43,15 @@ public:
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
                                 rtl::OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
+    virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator,
                                   utl::MediaDescriptor& rDescriptor) override;
 
     static void generate(librevenge::RVNGTextInterface& rDocument);
 };
 
-bool TextImportFilter::doImportDocument(librevenge::RVNGInputStream&, OdtGenerator& rGenerator,
-                                        utl::MediaDescriptor&)
+bool TextImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
+                                        OdtGenerator& rGenerator, utl::MediaDescriptor&)
 {
     TextImportFilter::generate(rGenerator);
     return true;
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
index 2b560e795a55..ee5cc3096d79 100644
--- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
@@ -179,7 +179,8 @@ private:
 }
 
 ////////////////////////////////////////////////////////////
-bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MSWorksCalcImportFilter::doImportDocument(weld::Window* pParent,
+                                               librevenge::RVNGInputStream& rInput,
                                                OdsGenerator& rGenerator, utl::MediaDescriptor&)
 {
     libwps::WPSKind kind = libwps::WPS_TEXT;
@@ -226,14 +227,14 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInp
 
         try
         {
-            const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(title, encoding);
-            if (pDlg->Execute() == RET_OK)
+            writerperfect::WPFTEncodingDialog aDlg(pParent, title, encoding);
+            if (aDlg.run() == RET_OK)
             {
-                if (!pDlg->GetEncoding().isEmpty())
-                    fileEncoding = pDlg->GetEncoding().toUtf8().getStr();
+                if (!aDlg.GetEncoding().isEmpty())
+                    fileEncoding = aDlg.GetEncoding().toUtf8().getStr();
             }
             // we can fail because we are in headless mode, the user has cancelled conversion, ...
-            else if (pDlg->hasUserCalledCancel())
+            else if (aDlg.hasUserCalledCancel())
                 return false;
         }
         catch (...)
@@ -248,7 +249,7 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInp
         // try to ask for a password
         try
         {
-            SfxPasswordDialog aPasswdDlg(nullptr);
+            SfxPasswordDialog aPasswdDlg(pParent);
             aPasswdDlg.SetMinLen(1);
             if (!aPasswdDlg.execute())
                 return false;
@@ -275,6 +276,7 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
     OUString sUrl;
     css::uno::Reference<css::io::XInputStream> xInputStream;
     css::uno::Reference<ucb::XContent> xContent;
+    css::uno::Reference<css::awt::XWindow> xDialogParent;
 
     sal_Int32 nLength = rDescriptor.getLength();
     const css::beans::PropertyValue* pValue = rDescriptor.getConstArray();
@@ -286,6 +288,8 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
             pValue[i].Value >>= xContent;
         else if (pValue[i].Name == "FileName" || pValue[i].Name == "URL")
             pValue[i].Value >>= sUrl;
+        else if (pValue[i].Name == "ParentWindow")
+            pValue[i].Value >>= xDialogParent;
     }
 
     if (!getXContext().is() || !xInputStream.is())
@@ -373,7 +377,8 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
                         = libwps::WPSDocument::isFileFormatSupported(&structuredInput, kind,
                                                                      creator, needEncoding);
                     if (confidence != libwps::WPS_CONFIDENCE_NONE)
-                        return doImportDocument(structuredInput, exporter, aDescriptor);
+                        return doImportDocument(Application::GetFrameWeld(xDialogParent),
+                                                structuredInput, exporter, aDescriptor);
                 }
             }
         }
@@ -382,7 +387,7 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
     {
     }
 
-    return doImportDocument(input, exporter, aDescriptor);
+    return doImportDocument(Application::GetFrameWeld(xDialogParent), input, exporter, aDescriptor);
 }
 
 bool MSWorksCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput,
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.hxx b/writerperfect/source/calc/MSWorksCalcImportFilter.hxx
index 4af9bee1f800..8b303a1737dd 100644
--- a/writerperfect/source/calc/MSWorksCalcImportFilter.hxx
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.hxx
@@ -40,8 +40,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/calc/MWAWCalcImportFilter.cxx b/writerperfect/source/calc/MWAWCalcImportFilter.cxx
index 6981f70ffd45..c251fc1f2b42 100644
--- a/writerperfect/source/calc/MWAWCalcImportFilter.cxx
+++ b/writerperfect/source/calc/MWAWCalcImportFilter.cxx
@@ -39,7 +39,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
     return MWAWDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool MWAWCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MWAWCalcImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                             OdsGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/calc/MWAWCalcImportFilter.hxx b/writerperfect/source/calc/MWAWCalcImportFilter.hxx
index 4b0b3727a9d3..6deb1ff4c1eb 100644
--- a/writerperfect/source/calc/MWAWCalcImportFilter.hxx
+++ b/writerperfect/source/calc/MWAWCalcImportFilter.hxx
@@ -35,8 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/calc/NumbersImportFilter.cxx b/writerperfect/source/calc/NumbersImportFilter.cxx
index 68f091768c0f..3841ca35e12b 100644
--- a/writerperfect/source/calc/NumbersImportFilter.cxx
+++ b/writerperfect/source/calc/NumbersImportFilter.cxx
@@ -22,7 +22,7 @@ using com::sun::star::uno::XInterface;
 
 using libetonyek::EtonyekDocument;
 
-bool NumbersImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool NumbersImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                            OdsGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return EtonyekDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/calc/NumbersImportFilter.hxx b/writerperfect/source/calc/NumbersImportFilter.hxx
index ccb28f7e0492..59ba90e25c15 100644
--- a/writerperfect/source/calc/NumbersImportFilter.hxx
+++ b/writerperfect/source/calc/NumbersImportFilter.hxx
@@ -34,8 +34,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx b/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx
index 913636e31b02..a8505700c2ac 100644
--- a/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx
+++ b/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx
@@ -37,7 +37,8 @@ static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryDat
     return STOFFDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool StarOfficeCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool StarOfficeCalcImportFilter::doImportDocument(weld::Window*,
+                                                  librevenge::RVNGInputStream& rInput,
                                                   OdsGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx b/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx
index d288f91f6b44..1120e5169e24 100644
--- a/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx
+++ b/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx
@@ -36,8 +36,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/common/WPFTEncodingDialog.cxx b/writerperfect/source/common/WPFTEncodingDialog.cxx
index dbd5356e5030..a86d888466b2 100644
--- a/writerperfect/source/common/WPFTEncodingDialog.cxx
+++ b/writerperfect/source/common/WPFTEncodingDialog.cxx
@@ -78,82 +78,46 @@ std::pair<OUStringLiteral, OUStringLiteral> const s_encodings[]
 
 std::size_t const numEncodings = SAL_N_ELEMENTS(s_encodings);
 
-void insertEncodings(ListBox* box)
+void insertEncodings(weld::ComboBoxText& box)
 {
     for (std::size_t i = 0; i < numEncodings; ++i)
-    {
-        sal_IntPtr nAt = box->InsertEntry(s_encodings[i].second);
-        box->SetEntryData(nAt, reinterpret_cast<void*>(static_cast<sal_uIntPtr>(i)));
-    }
+        box.append(s_encodings[i].first, s_encodings[i].second);
 }
 
-void selectEncoding(ListBox* box, const OUString& encoding)
+void selectEncoding(weld::ComboBoxText& box, const OUString& encoding)
 {
-    for (std::size_t i = 0; i < numEncodings; ++i)
-    {
-        if (encoding != s_encodings[i].first)
-            continue;
-        box->SelectEntryPos(i);
-        return;
-    }
+    box.set_active_id(encoding);
 }
 
-OUString getEncoding(ListBox const* box)
-{
-    sal_uIntPtr pos = reinterpret_cast<sal_uIntPtr>(box->GetSelectedEntryData());
-    if (pos >= numEncodings)
-        return OUString();
-    return s_encodings[pos].first;
-}
+OUString getEncoding(const weld::ComboBoxText& box) { return box.get_active_id(); }
 }
 
-WPFTEncodingDialog::WPFTEncodingDialog(const OUString& title, const OUString& encoding)
-    : ModalDialog(nullptr, "WPFTEncodingDialog", "writerperfect/ui/wpftencodingdialog.ui")
-    , m_pLbCharset()
-    , m_pBtnOk()
-    , m_pBtnCancel()
+WPFTEncodingDialog::WPFTEncodingDialog(weld::Window* pParent, const OUString& title,
+                                       const OUString& encoding)
+    : GenericDialogController(pParent, "writerperfect/ui/wpftencodingdialog.ui",
+                              "WPFTEncodingDialog")
     , m_userHasCancelled(false)
+    , m_xLbCharset(m_xBuilder->weld_combo_box_text("comboboxtext"))
+    , m_xBtnOk(m_xBuilder->weld_button("ok"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
 {
-    get(m_pLbCharset, "comboboxtext");
-    get(m_pBtnOk, "ok");
-    get(m_pBtnCancel, "cancel");
+    m_xBtnCancel->connect_clicked(LINK(this, WPFTEncodingDialog, CancelHdl));
 
-    m_pBtnCancel->SetClickHdl(LINK(this, WPFTEncodingDialog, CancelHdl));
+    insertEncodings(*m_xLbCharset);
+    m_xLbCharset->make_sorted();
+    selectEncoding(*m_xLbCharset, encoding);
 
-    insertEncodings(m_pLbCharset);
-    m_pLbCharset->SetStyle(m_pLbCharset->GetStyle() | WB_SORT);
-    // m_pLbCharset->set_height_request(6 * m_pLbCharset->GetTextHeight());
-    m_pLbCharset->SetDoubleClickHdl(LINK(this, WPFTEncodingDialog, DoubleClickHdl));
-    selectEncoding(m_pLbCharset, encoding);
-    m_pLbCharset->Show();
-
-    SetText(title);
+    m_xDialog->set_title(title);
 }
 
-WPFTEncodingDialog::~WPFTEncodingDialog() { disposeOnce(); }
+WPFTEncodingDialog::~WPFTEncodingDialog() {}
 
-OUString WPFTEncodingDialog::GetEncoding() const { return getEncoding(m_pLbCharset); }
+OUString WPFTEncodingDialog::GetEncoding() const { return getEncoding(*m_xLbCharset); }
 
-IMPL_LINK_NOARG(WPFTEncodingDialog, CancelHdl, Button*, void)
+IMPL_LINK_NOARG(WPFTEncodingDialog, CancelHdl, weld::Button&, void)
 {
     m_userHasCancelled = true;
-    Close();
-}
-
-IMPL_LINK(WPFTEncodingDialog, DoubleClickHdl, ListBox&, rLb, void)
-{
-    if (&rLb == m_pLbCharset)
-    {
-        m_pBtnOk->Click();
-    }
-}
-
-void WPFTEncodingDialog::dispose()
-{
-    m_pLbCharset.disposeAndClear();
-    m_pBtnOk.disposeAndClear();
-    m_pBtnCancel.disposeAndClear();
-    ModalDialog::dispose();
+    m_xDialog->response(RET_CANCEL);
 }
 }
 
diff --git a/writerperfect/source/draw/CDRImportFilter.cxx b/writerperfect/source/draw/CDRImportFilter.cxx
index e706ee089e41..f9ca74b44349 100644
--- a/writerperfect/source/draw/CDRImportFilter.cxx
+++ b/writerperfect/source/draw/CDRImportFilter.cxx
@@ -24,7 +24,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool CDRImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool CDRImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                        OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libcdr::CDRDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/CDRImportFilter.hxx b/writerperfect/source/draw/CDRImportFilter.hxx
index e2d35fc24bad..5d7c5334b990 100644
--- a/writerperfect/source/draw/CDRImportFilter.hxx
+++ b/writerperfect/source/draw/CDRImportFilter.hxx
@@ -33,8 +33,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/CMXImportFilter.cxx b/writerperfect/source/draw/CMXImportFilter.cxx
index 5b8ff653585d..84c610c3cf2f 100644
--- a/writerperfect/source/draw/CMXImportFilter.cxx
+++ b/writerperfect/source/draw/CMXImportFilter.cxx
@@ -24,7 +24,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool CMXImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool CMXImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                        OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libcdr::CMXDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/CMXImportFilter.hxx b/writerperfect/source/draw/CMXImportFilter.hxx
index cd35f1b2d45a..0e6d9b46dfa5 100644
--- a/writerperfect/source/draw/CMXImportFilter.hxx
+++ b/writerperfect/source/draw/CMXImportFilter.hxx
@@ -33,8 +33,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/FreehandImportFilter.cxx b/writerperfect/source/draw/FreehandImportFilter.cxx
index 44aa3b39a424..def81cfa1420 100644
--- a/writerperfect/source/draw/FreehandImportFilter.cxx
+++ b/writerperfect/source/draw/FreehandImportFilter.cxx
@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool FreehandImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool FreehandImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                             OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libfreehand::FreeHandDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/FreehandImportFilter.hxx b/writerperfect/source/draw/FreehandImportFilter.hxx
index 0897e4a815d5..99921bdf6255 100644
--- a/writerperfect/source/draw/FreehandImportFilter.hxx
+++ b/writerperfect/source/draw/FreehandImportFilter.hxx
@@ -30,8 +30,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/MSPUBImportFilter.cxx b/writerperfect/source/draw/MSPUBImportFilter.cxx
index ce3967da5736..0927777cc6ae 100644
--- a/writerperfect/source/draw/MSPUBImportFilter.cxx
+++ b/writerperfect/source/draw/MSPUBImportFilter.cxx
@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool MSPUBImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MSPUBImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                          OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libmspub::MSPUBDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/MSPUBImportFilter.hxx b/writerperfect/source/draw/MSPUBImportFilter.hxx
index 5a41d2166234..3e2125198a4f 100644
--- a/writerperfect/source/draw/MSPUBImportFilter.hxx
+++ b/writerperfect/source/draw/MSPUBImportFilter.hxx
@@ -30,8 +30,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/MWAWDrawImportFilter.cxx b/writerperfect/source/draw/MWAWDrawImportFilter.cxx
index b0432e3bbab2..2816d6a37518 100644
--- a/writerperfect/source/draw/MWAWDrawImportFilter.cxx
+++ b/writerperfect/source/draw/MWAWDrawImportFilter.cxx
@@ -40,7 +40,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
     return MWAWDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool MWAWDrawImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MWAWDrawImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                             OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/MWAWDrawImportFilter.hxx b/writerperfect/source/draw/MWAWDrawImportFilter.hxx
index 15cdeb9356ec..98963ebf7510 100644
--- a/writerperfect/source/draw/MWAWDrawImportFilter.hxx
+++ b/writerperfect/source/draw/MWAWDrawImportFilter.hxx
@@ -35,8 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdgGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/draw/PageMakerImportFilter.cxx b/writerperfect/source/draw/PageMakerImportFilter.cxx
index 64866c57f6ee..e3f9cabad9d5 100644
--- a/writerperfect/source/draw/PageMakerImportFilter.cxx
+++ b/writerperfect/source/draw/PageMakerImportFilter.cxx
@@ -22,7 +22,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool PageMakerImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool PageMakerImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                              OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libpagemaker::PMDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/PageMakerImportFilter.hxx b/writerperfect/source/draw/PageMakerImportFilter.hxx
index 50e38fc9ec78..a333924bf9c9 100644
--- a/writerperfect/source/draw/PageMakerImportFilter.hxx
+++ b/writerperfect/source/draw/PageMakerImportFilter.hxx
@@ -31,8 +31,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/QXPImportFilter.cxx b/writerperfect/source/draw/QXPImportFilter.cxx
index 0a719ac58296..f0f71fcba310 100644
--- a/writerperfect/source/draw/QXPImportFilter.cxx
+++ b/writerperfect/source/draw/QXPImportFilter.cxx
@@ -22,7 +22,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool QXPImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool QXPImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                        OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libqxp::QXPDocument::parse(&rInput, &rGenerator) == libqxp::QXPDocument::RESULT_OK;
diff --git a/writerperfect/source/draw/QXPImportFilter.hxx b/writerperfect/source/draw/QXPImportFilter.hxx
index 6b73e8ae1357..8a2538b8bdd9 100644
--- a/writerperfect/source/draw/QXPImportFilter.hxx
+++ b/writerperfect/source/draw/QXPImportFilter.hxx
@@ -30,8 +30,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx
index a0fcb392d811..bdfe3d361c4e 100644
--- a/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx
+++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx
@@ -38,7 +38,8 @@ static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryDat
     return STOFFDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool StarOfficeDrawImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool StarOfficeDrawImportFilter::doImportDocument(weld::Window*,
+                                                  librevenge::RVNGInputStream& rInput,
                                                   OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx
index fb0ebabcd38c..f1cbb643f990 100644
--- a/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx
+++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx
@@ -36,8 +36,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdgGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/draw/VisioImportFilter.cxx b/writerperfect/source/draw/VisioImportFilter.cxx
index 1b377495ebb6..8c72b732c7c4 100644
--- a/writerperfect/source/draw/VisioImportFilter.cxx
+++ b/writerperfect/source/draw/VisioImportFilter.cxx
@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool VisioImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool VisioImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                          OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libvisio::VisioDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/VisioImportFilter.hxx b/writerperfect/source/draw/VisioImportFilter.hxx
index 8468c602e8af..387827a4a94d 100644
--- a/writerperfect/source/draw/VisioImportFilter.hxx
+++ b/writerperfect/source/draw/VisioImportFilter.hxx
@@ -30,8 +30,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/WPGImportFilter.cxx b/writerperfect/source/draw/WPGImportFilter.cxx
index bd4d238245d3..7ed726fb62ba 100644
--- a/writerperfect/source/draw/WPGImportFilter.cxx
+++ b/writerperfect/source/draw/WPGImportFilter.cxx
@@ -27,7 +27,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool WPGImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool WPGImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                        OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libwpg::WPGraphics::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/WPGImportFilter.hxx b/writerperfect/source/draw/WPGImportFilter.hxx
index b31ac6bf8627..3e75f08eed14 100644
--- a/writerperfect/source/draw/WPGImportFilter.hxx
+++ b/writerperfect/source/draw/WPGImportFilter.hxx
@@ -35,8 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/draw/ZMFImportFilter.cxx b/writerperfect/source/draw/ZMFImportFilter.cxx
index 3a71eee63f6a..e44a952053e1 100644
--- a/writerperfect/source/draw/ZMFImportFilter.cxx
+++ b/writerperfect/source/draw/ZMFImportFilter.cxx
@@ -22,7 +22,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool ZMFImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool ZMFImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                        OdgGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libzmf::ZMFDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/draw/ZMFImportFilter.hxx b/writerperfect/source/draw/ZMFImportFilter.hxx
index 85dbf59c0cda..6fef0180d415 100644
--- a/writerperfect/source/draw/ZMFImportFilter.hxx
+++ b/writerperfect/source/draw/ZMFImportFilter.hxx
@@ -30,8 +30,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx
index c535786ff91f..3083790e4f9c 100644
--- a/writerperfect/source/impress/KeynoteImportFilter.cxx
+++ b/writerperfect/source/impress/KeynoteImportFilter.cxx
@@ -48,7 +48,7 @@ using writerperfect::WPXSvInputStream;
 namespace beans = com::sun::star::beans;
 namespace ucb = com::sun::star::ucb;
 
-bool KeynoteImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool KeynoteImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                            OdpGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libetonyek::EtonyekDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/impress/KeynoteImportFilter.hxx b/writerperfect/source/impress/KeynoteImportFilter.hxx
index dc62b44f1d61..cae19663a7c7 100644
--- a/writerperfect/source/impress/KeynoteImportFilter.hxx
+++ b/writerperfect/source/impress/KeynoteImportFilter.hxx
@@ -36,8 +36,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/impress/MWAWPresentationImportFilter.cxx b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
index cd35fb6f275c..46c3ec7f3545 100644
--- a/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
+++ b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
@@ -40,7 +40,8 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
     return MWAWDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool MWAWPresentationImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MWAWPresentationImportFilter::doImportDocument(weld::Window*,
+                                                    librevenge::RVNGInputStream& rInput,
                                                     OdpGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/impress/MWAWPresentationImportFilter.hxx b/writerperfect/source/impress/MWAWPresentationImportFilter.hxx
index 2d004282f7f1..0967eeec7b9e 100644
--- a/writerperfect/source/impress/MWAWPresentationImportFilter.hxx
+++ b/writerperfect/source/impress/MWAWPresentationImportFilter.hxx
@@ -36,8 +36,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdpGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx b/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx
index 34ed2a72ffd3..1a6c5255aea6 100644
--- a/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx
+++ b/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx
@@ -38,7 +38,8 @@ static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryDat
     return STOFFDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool StarOfficePresentationImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool StarOfficePresentationImportFilter::doImportDocument(weld::Window*,
+                                                          librevenge::RVNGInputStream& rInput,
                                                           OdpGenerator& rGenerator,
                                                           utl::MediaDescriptor&)
 {
diff --git a/writerperfect/source/impress/StarOfficePresentationImportFilter.hxx b/writerperfect/source/impress/StarOfficePresentationImportFilter.hxx
index 4df403bae184..f8179455710f 100644
--- a/writerperfect/source/impress/StarOfficePresentationImportFilter.hxx
+++ b/writerperfect/source/impress/StarOfficePresentationImportFilter.hxx
@@ -36,8 +36,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdpGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/writer/AbiWordImportFilter.cxx b/writerperfect/source/writer/AbiWordImportFilter.cxx
index c6d6823276f8..8f0f5162a819 100644
--- a/writerperfect/source/writer/AbiWordImportFilter.cxx
+++ b/writerperfect/source/writer/AbiWordImportFilter.cxx
@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
-bool AbiWordImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool AbiWordImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                            OdtGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return libabw::AbiDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/writer/AbiWordImportFilter.hxx b/writerperfect/source/writer/AbiWordImportFilter.hxx
index 30d0ef77b922..4d49d9d572c4 100644
--- a/writerperfect/source/writer/AbiWordImportFilter.hxx
+++ b/writerperfect/source/writer/AbiWordImportFilter.hxx
@@ -35,8 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
 };
 
 #endif
diff --git a/writerperfect/source/writer/EBookImportFilter.cxx b/writerperfect/source/writer/EBookImportFilter.cxx
index 8bd96a7e12f7..b60efff74123 100644
--- a/writerperfect/source/writer/EBookImportFilter.cxx
+++ b/writerperfect/source/writer/EBookImportFilter.cxx
@@ -22,7 +22,7 @@ using com::sun::star::uno::XInterface;
 
 using libebook::EBOOKDocument;
 
-bool EBookImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool EBookImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                          OdtGenerator& rGenerator,
                                          utl::MediaDescriptor& rDescriptor)
 {
diff --git a/writerperfect/source/writer/EBookImportFilter.hxx b/writerperfect/source/writer/EBookImportFilter.hxx
index 209f080c2cdf..3bbc515783a3 100644
--- a/writerperfect/source/writer/EBookImportFilter.hxx
+++ b/writerperfect/source/writer/EBookImportFilter.hxx
@@ -35,7 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator,
                                   utl::MediaDescriptor& rDescriptor) override;
 };
 
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx
index 4c2c86c5e787..1b082c806a9b 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.cxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.cxx
@@ -32,7 +32,8 @@ static bool handleEmbeddedWKSObject(const librevenge::RVNGBinaryData& data,
     return libwps::WPSDocument::parse(data.getDataStream(), &exporter) == libwps::WPS_OK;
 }
 
-bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MSWorksImportFilter::doImportDocument(weld::Window* pParent,
+                                           librevenge::RVNGInputStream& rInput,
                                            OdtGenerator& rGenerator, utl::MediaDescriptor&)
 {
     libwps::WPSKind kind = libwps::WPS_TEXT;
@@ -69,14 +70,14 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
                     break;
             }
 
-            const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(title, encoding);
-            if (pDlg->Execute() == RET_OK)
+            writerperfect::WPFTEncodingDialog aDlg(pParent, title, encoding);
+            if (aDlg.run() == RET_OK)
             {
-                if (!pDlg->GetEncoding().isEmpty())
-                    fileEncoding = pDlg->GetEncoding().toUtf8().getStr();
+                if (!aDlg.GetEncoding().isEmpty())
+                    fileEncoding = aDlg.GetEncoding().toUtf8().getStr();
             }
             // we can fail because we are in headless mode, the user has cancelled conversion, ...
-            else if (pDlg->hasUserCalledCancel())
+            else if (aDlg.hasUserCalledCancel())
                 return false;
         }
     }
diff --git a/writerperfect/source/writer/MSWorksImportFilter.hxx b/writerperfect/source/writer/MSWorksImportFilter.hxx
index f9caea858b24..a6bd7ec32186 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.hxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.hxx
@@ -35,8 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdtGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/writer/MWAWImportFilter.cxx b/writerperfect/source/writer/MWAWImportFilter.cxx
index 7b166930cea1..ad12a6a677d1 100644
--- a/writerperfect/source/writer/MWAWImportFilter.cxx
+++ b/writerperfect/source/writer/MWAWImportFilter.cxx
@@ -39,7 +39,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
     return MWAWDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool MWAWImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool MWAWImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                         OdtGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/writer/MWAWImportFilter.hxx b/writerperfect/source/writer/MWAWImportFilter.hxx
index 5ea1ad0c2bcf..810ca637ce14 100644
--- a/writerperfect/source/writer/MWAWImportFilter.hxx
+++ b/writerperfect/source/writer/MWAWImportFilter.hxx
@@ -35,8 +35,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdtGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/writer/PagesImportFilter.cxx b/writerperfect/source/writer/PagesImportFilter.cxx
index 6ff8cd1420f6..bcd502fb8bf3 100644
--- a/writerperfect/source/writer/PagesImportFilter.cxx
+++ b/writerperfect/source/writer/PagesImportFilter.cxx
@@ -22,7 +22,7 @@ using com::sun::star::uno::XInterface;
 
 using libetonyek::EtonyekDocument;
 
-bool PagesImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool PagesImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
                                          OdtGenerator& rGenerator, utl::MediaDescriptor&)
 {
     return EtonyekDocument::parse(&rInput, &rGenerator);
diff --git a/writerperfect/source/writer/PagesImportFilter.hxx b/writerperfect/source/writer/PagesImportFilter.hxx
index 03cbefe9f3f6..9457667f271c 100644
--- a/writerperfect/source/writer/PagesImportFilter.hxx
+++ b/writerperfect/source/writer/PagesImportFilter.hxx
@@ -34,7 +34,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator,
                                   utl::MediaDescriptor& rDescriptor) override;
 };
 
diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
index 95764afa4013..8f7143c1e2ee 100644
--- a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
+++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
@@ -40,7 +40,8 @@ static bool handleEmbeddedSTOFFWriterSpreadsheetObject(const librevenge::RVNGBin
     return STOFFDocument::decodeSpreadsheet(data, &exporter);
 }
 
-bool StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
+bool StarOfficeWriterImportFilter::doImportDocument(weld::Window* pParent,
+                                                    librevenge::RVNGInputStream& rInput,
                                                     OdtGenerator& rGenerator, utl::MediaDescriptor&)
 {
     STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN;
@@ -52,7 +53,7 @@ bool StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream&
         // try to ask for a password
         try
         {
-            SfxPasswordDialog aPasswdDlg(nullptr);
+            SfxPasswordDialog aPasswdDlg(pParent);
             aPasswdDlg.SetMinLen(0);
             if (!aPasswdDlg.execute())
                 return false;
diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx
index c84602ed8a8c..585dec14be5a 100644
--- a/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx
+++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx
@@ -36,8 +36,8 @@ public:
 
 private:
     virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
-    virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
-                                  utl::MediaDescriptor&) override;
+    virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+                                  OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
     virtual void doRegisterHandlers(OdtGenerator& rGenerator) override;
 };
 
diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx
index 4b0861c0d9da..d3ac6a37f3ff 100644
--- a/writerperfect/source/writer/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx
@@ -11,6 +11,7 @@
 #include <osl/diagnose.h>
 #include <rtl/tencinfo.h>
 
+#include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
@@ -42,6 +43,7 @@ using com::sun::star::uno::UNO_QUERY;
 using com::sun::star::uno::XComponentContext;
 using com::sun::star::uno::XInterface;
 
+using com::sun::star::awt::XWindow;
 using com::sun::star::document::XImporter;
 using com::sun::star::io::XInputStream;
 using com::sun::star::xml::sax::XDocumentHandler;
@@ -92,10 +94,13 @@ bool WordPerfectImportFilter::importImpl(const Sequence<css::beans::PropertyValu
     sal_Int32 nLength = aDescriptor.getLength();
     const PropertyValue* pValue = aDescriptor.getConstArray();
     Reference<XInputStream> xInputStream;
+    Reference<XWindow> xDialogParent;
     for (sal_Int32 i = 0; i < nLength; i++)
     {
         if (pValue[i].Name == "InputStream")
             pValue[i].Value >>= xInputStream;
+        else if (pValue[i].Name == "ParentWindow")
+            pValue[i].Value >>= xDialogParent;
     }
     if (!xInputStream.is())
     {
@@ -114,7 +119,7 @@ bool WordPerfectImportFilter::importImpl(const Sequence<css::beans::PropertyValu
         int unsuccessfulAttempts = 0;
         while (true)
         {
-            SfxPasswordDialog aPasswdDlg(nullptr);
+            SfxPasswordDialog aPasswdDlg(Application::GetFrameWeld(xDialogParent));
             aPasswdDlg.SetMinLen(0);
             if (!aPasswdDlg.execute())
                 return false;
diff --git a/writerperfect/uiconfig/ui/wpftencodingdialog.ui b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
index b2816fdc3686..067cfb72bad3 100644
--- a/writerperfect/uiconfig/ui/wpftencodingdialog.ui
+++ b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="wpt">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="WPFTEncodingDialog">
@@ -7,8 +7,12 @@
     <property name="border_width">6</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
-    <property name="default_height">-1</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</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>
@@ -72,6 +76,7 @@
         </child>
         <child>
           <object class="GtkComboBoxText" id="comboboxtext">
+            <property name="visible">True</property>
             <property name="can_focus">False</property>
           </object>
           <packing>


More information about the Libreoffice-commits mailing list