[Libreoffice-commits] core.git: 2 commits - include/vcl sfx2/inc sfx2/source sw/source sw/uiconfig sw/UIConfig_swriter.mk vcl/source vcl/unx writerperfect/source writerperfect/uiconfig

Caolán McNamara caolanm at redhat.com
Wed Apr 18 19:39:45 UTC 2018


 include/vcl/weld.hxx                                  |   12 
 sfx2/inc/guisaveas.hxx                                |    1 
 sfx2/source/doc/guisaveas.cxx                         |   39 ++
 sw/UIConfig_swriter.mk                                |    1 
 sw/source/ui/index/swuiidxmrk.cxx                     |  242 +++++++++---------
 sw/source/uibase/inc/swuiidxmrk.hxx                   |    4 
 sw/uiconfig/swriter/ui/bibliofragment.ui              |   66 ++++
 sw/uiconfig/swriter/ui/createauthorentry.ui           |    7 
 vcl/source/app/salvtables.cxx                         |   50 ++-
 vcl/unx/gtk3/gtk3gtkinst.cxx                          |   47 ++-
 writerperfect/source/writer/EPUBExportDialog.cxx      |  153 ++++-------
 writerperfect/source/writer/EPUBExportDialog.hxx      |   57 ++--
 writerperfect/source/writer/EPUBExportUIComponent.cxx |   13 
 writerperfect/source/writer/EPUBExportUIComponent.hxx |    7 
 writerperfect/uiconfig/ui/exportepub.ui               |   20 -
 15 files changed, 433 insertions(+), 286 deletions(-)

New commits:
commit 158cd800d607898b1d2fe9bf4514900802ca1d90
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 18 11:49:10 2018 +0100

    weld EPUBExportDialog and add parent
    
    Change-Id: Iec4fa3afb1e90ec36f792ea65b8c57b11cff98b3
    Reviewed-on: https://gerrit.libreoffice.org/53094
    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/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index 94f3d591b8e9..da4af8900c66 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -80,6 +80,7 @@ public:
                                     const OUString& aDefExtension,
                                     bool rDefaultIsAlien );
 
+    static css::uno::Reference<css::awt::XWindow> GetModelXWindow(const css::uno::Reference<css::frame::XModel>& rModel);
     static vcl::Window* GetModelWindow( const css::uno::Reference< css::frame::XModel >& xModel );
 
 };
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 428d9d35128f..17e8edd623cb 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -63,6 +63,7 @@
 #include <tools/debug.hxx>
 #include <tools/urlobj.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/window.hxx>
@@ -593,8 +594,13 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
                     aProps[nProperty].Value >>= aServiceName;
                     if( !aServiceName.isEmpty() )
                     {
+                        uno::Sequence<uno::Any> aDialogArgs(comphelper::InitAnyPropertySequence(
+                        {
+                            {"ParentWindow", uno::Any(SfxStoringHelper::GetModelXWindow(m_xModel))},
+                        }));
+
                         uno::Reference< ui::dialogs::XExecutableDialog > xFilterDialog(
-                                                    comphelper::getProcessServiceFactory()->createInstance( aServiceName ), uno::UNO_QUERY );
+                                                    comphelper::getProcessServiceFactory()->createInstanceWithArguments(aServiceName, aDialogArgs), uno::UNO_QUERY );
                         uno::Reference< beans::XPropertyAccess > xFilterProperties( xFilterDialog, uno::UNO_QUERY );
 
                         if( xFilterDialog.is() && xFilterProperties.is() )
@@ -1809,9 +1815,8 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
     return aDlg.run() == RET_OK;
 }
 
-vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
+uno::Reference<awt::XWindow> SfxStoringHelper::GetModelXWindow(const uno::Reference<frame::XModel>& xModel)
 {
-    VclPtr<vcl::Window> pWin;
     try {
         if ( xModel.is() )
         {
@@ -1821,13 +1826,7 @@ vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XMod
                 uno::Reference< frame::XFrame > xFrame = xController->getFrame();
                 if ( xFrame.is() )
                 {
-                    uno::Reference< awt::XWindow > xWindow = xFrame->getContainerWindow();
-                    if ( xWindow.is() )
-                    {
-                        VCLXWindow* pVCLWindow = VCLXWindow::GetImplementation( xWindow );
-                        if ( pVCLWindow )
-                            pWin = pVCLWindow->GetWindow();
-                    }
+                    return xFrame->getContainerWindow();
                 }
             }
         }
@@ -1836,6 +1835,26 @@ vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XMod
     {
     }
 
+    return uno::Reference<awt::XWindow>();
+}
+
+vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
+{
+    VclPtr<vcl::Window> pWin;
+
+    try {
+        uno::Reference<awt::XWindow> xWindow = GetModelXWindow(xModel);
+        if ( xWindow.is() )
+        {
+            VCLXWindow* pVCLWindow = VCLXWindow::GetImplementation( xWindow );
+            if ( pVCLWindow )
+                pWin = pVCLWindow->GetWindow();
+        }
+    }
+    catch ( const uno::Exception& )
+    {
+    }
+
     return pWin;
 }
 
diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx
index c01bc32ec111..bf1f4a0e4cfd 100644
--- a/writerperfect/source/writer/EPUBExportDialog.cxx
+++ b/writerperfect/source/writer/EPUBExportDialog.cxx
@@ -70,25 +70,37 @@ sal_Int32 PositionToVersion(sal_Int32 nPosition)
 namespace writerperfect
 {
 
-EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap &rFilterData, uno::Reference<uno::XComponentContext> xContext, css::uno::Reference<css::lang::XComponent> xDocument)
-    : ModalDialog(pParent, "EpubDialog", "writerperfect/ui/exportepub.ui"),
-      mxContext(std::move(xContext)),
-      mrFilterData(rFilterData),
-      mxSourceDocument(std::move(xDocument))
+EPUBExportDialog::EPUBExportDialog(weld::Window *pParent, comphelper::SequenceAsHashMap &rFilterData, uno::Reference<uno::XComponentContext> xContext, css::uno::Reference<css::lang::XComponent> xDocument)
+    : GenericDialogController(pParent, "writerperfect/ui/exportepub.ui", "EpubDialog")
+    , m_xContext(std::move(xContext))
+    , m_rFilterData(rFilterData)
+    , m_xSourceDocument(std::move(xDocument))
+    , m_xVersion(m_xBuilder->weld_combo_box_text("versionlb"))
+    , m_xSplit(m_xBuilder->weld_combo_box_text("splitlb"))
+    , m_xLayout(m_xBuilder->weld_combo_box_text("layoutlb"))
+    , m_xCoverPath(m_xBuilder->weld_entry("coverpath"))
+    , m_xCoverButton(m_xBuilder->weld_button("coverbutton"))
+    , m_xMediaDir(m_xBuilder->weld_entry("mediadir"))
+    , m_xMediaButton(m_xBuilder->weld_button("mediabutton"))
+    , m_xOKButton(m_xBuilder->weld_button("ok"))
+    , m_xIdentifier(m_xBuilder->weld_entry("identifier"))
+    , m_xTitle(m_xBuilder->weld_entry("title"))
+    , m_xInitialCreator(m_xBuilder->weld_entry("author"))
+    , m_xLanguage(m_xBuilder->weld_entry("language"))
+    , m_xDate(m_xBuilder->weld_entry("date"))
+
 {
-    get(m_pVersion, "versionlb");
-    assert(PositionToVersion(m_pVersion->GetSelectedEntryPos()) == EPUBExportFilter::GetDefaultVersion());
+    assert(PositionToVersion(m_xVersion->get_active()) == EPUBExportFilter::GetDefaultVersion());
 
     auto it = rFilterData.find("EPUBVersion");
     if (it != rFilterData.end())
     {
         sal_Int32 nVersion = 0;
         if (it->second >>= nVersion)
-            m_pVersion->SelectEntryPos(VersionToPosition(nVersion));
+            m_xVersion->set_active(VersionToPosition(nVersion));
     }
-    m_pVersion->SetSelectHdl(LINK(this, EPUBExportDialog, VersionSelectHdl));
+    m_xVersion->connect_changed(LINK(this, EPUBExportDialog, VersionSelectHdl));
 
-    get(m_pSplit, "splitlb");
     it = rFilterData.find("EPUBSplitMethod");
     if (it != rFilterData.end())
     {
@@ -96,13 +108,12 @@ EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsH
         if (it->second >>= nSplitMethod)
             // No conversion, 1:1 mapping between libepubgen::EPUBSplitMethod
             // and entry positions.
-            m_pSplit->SelectEntryPos(nSplitMethod);
+            m_xSplit->set_active(nSplitMethod);
     }
     else
-        m_pSplit->SelectEntryPos(EPUBExportFilter::GetDefaultSplitMethod());
-    m_pSplit->SetSelectHdl(LINK(this, EPUBExportDialog, SplitSelectHdl));
+        m_xSplit->set_active(EPUBExportFilter::GetDefaultSplitMethod());
+    m_xSplit->connect_changed(LINK(this, EPUBExportDialog, SplitSelectHdl));
 
-    get(m_pLayout, "layoutlb");
     it = rFilterData.find("EPUBLayoutMethod");
     if (it != rFilterData.end())
     {
@@ -110,137 +121,105 @@ EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsH
         if (it->second >>= nLayoutMethod)
             // No conversion, 1:1 mapping between libepubgen::EPUBLayoutMethod
             // and entry positions.
-            m_pLayout->SelectEntryPos(nLayoutMethod);
+            m_xLayout->set_active(nLayoutMethod);
     }
     else
-        m_pLayout->SelectEntryPos(EPUBExportFilter::GetDefaultLayoutMethod());
-    m_pLayout->SetSelectHdl(LINK(this, EPUBExportDialog, LayoutSelectHdl));
-
-    get(m_pCoverPath, "coverpath");
-
-    get(m_pCoverButton, "coverbutton");
-    m_pCoverButton->SetClickHdl(LINK(this, EPUBExportDialog, CoverClickHdl));
-
-    get(m_pMediaDir, "mediadir");
+        m_xLayout->set_active(EPUBExportFilter::GetDefaultLayoutMethod());
+    m_xLayout->connect_changed(LINK(this, EPUBExportDialog, LayoutSelectHdl));
 
-    get(m_pMediaButton, "mediabutton");
-    m_pMediaButton->SetClickHdl(LINK(this, EPUBExportDialog, MediaClickHdl));
+    m_xCoverButton->connect_clicked(LINK(this, EPUBExportDialog, CoverClickHdl));
 
-    get(m_pIdentifier, "identifier");
+    m_xMediaButton->connect_clicked(LINK(this, EPUBExportDialog, MediaClickHdl));
 
-    get(m_pTitle, "title");
-    uno::Reference<document::XDocumentPropertiesSupplier> xDPS(mxSourceDocument, uno::UNO_QUERY);
+    uno::Reference<document::XDocumentPropertiesSupplier> xDPS(m_xSourceDocument, uno::UNO_QUERY);
     uno::Reference<document::XDocumentProperties> xDP;
     if (xDPS.is())
         xDP = xDPS->getDocumentProperties();
     if (xDP.is())
-        m_pTitle->SetText(xDP->getTitle());
+        m_xTitle->set_text(xDP->getTitle());
 
-    get(m_pInitialCreator, "author");
     if (xDP.is())
-        m_pInitialCreator->SetText(xDP->getAuthor());
+        m_xInitialCreator->set_text(xDP->getAuthor());
 
-    get(m_pLanguage, "language");
     if (xDP.is())
     {
         OUString aLanguage(LanguageTag::convertToBcp47(xDP->getLanguage(), false));
-        m_pLanguage->SetText(aLanguage);
+        m_xLanguage->set_text(aLanguage);
     }
 
-    get(m_pDate, "date");
     if (xDP.is())
     {
         OUStringBuffer aBuffer;
         util::DateTime aDate(xDP->getModificationDate());
         sax::Converter::convertDateTime(aBuffer, aDate, nullptr, true);
-        m_pDate->SetText(aBuffer.makeStringAndClear());
+        m_xDate->set_text(aBuffer.makeStringAndClear());
     }
 
-    get(m_pOKButton, "ok");
-    m_pOKButton->SetClickHdl(LINK(this, EPUBExportDialog, OKClickHdl));
+    m_xOKButton->connect_clicked(LINK(this, EPUBExportDialog, OKClickHdl));
 }
 
-IMPL_LINK_NOARG(EPUBExportDialog, VersionSelectHdl, ListBox &, void)
+IMPL_LINK_NOARG(EPUBExportDialog, VersionSelectHdl, weld::ComboBoxText &, void)
 {
-    mrFilterData["EPUBVersion"] <<= PositionToVersion(m_pVersion->GetSelectedEntryPos());
+    m_rFilterData["EPUBVersion"] <<= PositionToVersion(m_xVersion->get_active());
 }
 
-IMPL_LINK_NOARG(EPUBExportDialog, SplitSelectHdl, ListBox &, void)
+IMPL_LINK_NOARG(EPUBExportDialog, SplitSelectHdl, weld::ComboBoxText &, void)
 {
     // No conversion, 1:1 mapping between entry positions and
     // libepubgen::EPUBSplitMethod.
-    mrFilterData["EPUBSplitMethod"] <<= m_pSplit->GetSelectedEntryPos();
+    m_rFilterData["EPUBSplitMethod"] <<= static_cast<sal_Int32>(m_xSplit->get_active());
 }
 
-IMPL_LINK_NOARG(EPUBExportDialog, LayoutSelectHdl, ListBox &, void)
+IMPL_LINK_NOARG(EPUBExportDialog, LayoutSelectHdl, weld::ComboBoxText &, void)
 {
     // No conversion, 1:1 mapping between entry positions and
     // libepubgen::EPUBLayoutMethod.
-    mrFilterData["EPUBLayoutMethod"] <<= m_pLayout->GetSelectedEntryPos();
-    m_pSplit->Enable(m_pLayout->GetSelectedEntryPos() != libepubgen::EPUB_LAYOUT_METHOD_FIXED);
+    m_rFilterData["EPUBLayoutMethod"] <<= static_cast<sal_Int32>(m_xLayout->get_active());
+    m_xSplit->set_sensitive(m_xLayout->get_active() != libepubgen::EPUB_LAYOUT_METHOD_FIXED);
 }
 
-IMPL_LINK_NOARG(EPUBExportDialog, CoverClickHdl, Button *, void)
+IMPL_LINK_NOARG(EPUBExportDialog, CoverClickHdl, weld::Button &, void)
 {
-    SvxOpenGraphicDialog aDlg("Import", GetFrameWeld());
+    SvxOpenGraphicDialog aDlg("Import", m_xDialog.get());
     aDlg.EnableLink(false);
     if (aDlg.Execute() == ERRCODE_NONE)
-        m_pCoverPath->SetText(aDlg.GetPath());
+        m_xCoverPath->set_text(aDlg.GetPath());
 }
 
-IMPL_LINK_NOARG(EPUBExportDialog, MediaClickHdl, Button *, void)
+IMPL_LINK_NOARG(EPUBExportDialog, MediaClickHdl, weld::Button &, void)
 {
-    uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(mxContext);
+    uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(m_xContext);
     if (xFolderPicker->execute() != ui::dialogs::ExecutableDialogResults::OK)
         return;
 
-    m_pMediaDir->SetText(xFolderPicker->getDirectory());
+    m_xMediaDir->set_text(xFolderPicker->getDirectory());
 }
 
-IMPL_LINK_NOARG(EPUBExportDialog, OKClickHdl, Button *, void)
+IMPL_LINK_NOARG(EPUBExportDialog, OKClickHdl, weld::Button &, void)
 {
     // General
-    if (!m_pCoverPath->GetText().isEmpty())
-        mrFilterData["RVNGCoverImage"] <<= m_pCoverPath->GetText();
-    if (!m_pMediaDir->GetText().isEmpty())
-        mrFilterData["RVNGMediaDir"] <<= m_pMediaDir->GetText();
+    if (!m_xCoverPath->get_text().isEmpty())
+        m_rFilterData["RVNGCoverImage"] <<= m_xCoverPath->get_text();
+    if (!m_xMediaDir->get_text().isEmpty())
+        m_rFilterData["RVNGMediaDir"] <<= m_xMediaDir->get_text();
 
     // Metadata
-    if (!m_pIdentifier->GetText().isEmpty())
-        mrFilterData["RVNGIdentifier"] <<= m_pIdentifier->GetText();
-    if (!m_pTitle->GetText().isEmpty())
-        mrFilterData["RVNGTitle"] <<= m_pTitle->GetText();
-    if (!m_pInitialCreator->GetText().isEmpty())
-        mrFilterData["RVNGInitialCreator"] <<= m_pInitialCreator->GetText();
-    if (!m_pLanguage->GetText().isEmpty())
-        mrFilterData["RVNGLanguage"] <<= m_pLanguage->GetText();
-    if (!m_pDate->GetText().isEmpty())
-        mrFilterData["RVNGDate"] <<= m_pDate->GetText();
-
-    EndDialog(RET_OK);
+    if (!m_xIdentifier->get_text().isEmpty())
+        m_rFilterData["RVNGIdentifier"] <<= m_xIdentifier->get_text();
+    if (!m_xTitle->get_text().isEmpty())
+        m_rFilterData["RVNGTitle"] <<= m_xTitle->get_text();
+    if (!m_xInitialCreator->get_text().isEmpty())
+        m_rFilterData["RVNGInitialCreator"] <<= m_xInitialCreator->get_text();
+    if (!m_xLanguage->get_text().isEmpty())
+        m_rFilterData["RVNGLanguage"] <<= m_xLanguage->get_text();
+    if (!m_xDate->get_text().isEmpty())
+        m_rFilterData["RVNGDate"] <<= m_xDate->get_text();
+
+    m_xDialog->response(RET_OK);
 }
 
 EPUBExportDialog::~EPUBExportDialog()
 {
-    disposeOnce();
-}
-
-void EPUBExportDialog::dispose()
-{
-    m_pVersion.clear();
-    m_pSplit.clear();
-    m_pCoverPath.clear();
-    m_pCoverButton.clear();
-    m_pOKButton.clear();
-    m_pIdentifier.clear();
-    m_pTitle.clear();
-    m_pInitialCreator.clear();
-    m_pLanguage.clear();
-    m_pDate.clear();
-    m_pMediaDir.clear();
-    m_pMediaButton.clear();
-    m_pLayout.clear();
-    ModalDialog::dispose();
 }
 
 } // namespace writerperfect
diff --git a/writerperfect/source/writer/EPUBExportDialog.hxx b/writerperfect/source/writer/EPUBExportDialog.hxx
index ab90c48ee04c..51326c1ae1f6 100644
--- a/writerperfect/source/writer/EPUBExportDialog.hxx
+++ b/writerperfect/source/writer/EPUBExportDialog.hxx
@@ -10,10 +10,7 @@
 #ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTDIALOG_HXX
 #define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTDIALOG_HXX
 
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
 
 namespace comphelper
 {
@@ -24,37 +21,37 @@ namespace writerperfect
 {
 
 /// EPUB export options dialog.
-class EPUBExportDialog : public ModalDialog
+class EPUBExportDialog : public weld::GenericDialogController
 {
 public:
-    EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap &rFilterData, css::uno::Reference<css::uno::XComponentContext> xContext, css::uno::Reference<css::lang::XComponent> xDocument);
+    EPUBExportDialog(weld::Window *pParent, comphelper::SequenceAsHashMap &rFilterData, css::uno::Reference<css::uno::XComponentContext> xContext, css::uno::Reference<css::lang::XComponent> xDocument);
     ~EPUBExportDialog() override;
-    void dispose() override;
 
 private:
-    DECL_LINK(VersionSelectHdl, ListBox &, void);
-    DECL_LINK(SplitSelectHdl, ListBox &, void);
-    DECL_LINK(LayoutSelectHdl, ListBox &, void);
-    DECL_LINK(CoverClickHdl, Button *, void);
-    DECL_LINK(MediaClickHdl, Button *, void);
-    DECL_LINK(OKClickHdl, Button *, void);
-
-    css::uno::Reference<css::uno::XComponentContext> mxContext;
-    comphelper::SequenceAsHashMap &mrFilterData;
-    css::uno::Reference<css::lang::XComponent> mxSourceDocument;
-    VclPtr<ListBox> m_pVersion;
-    VclPtr<ListBox> m_pSplit;
-    VclPtr<ListBox> m_pLayout;
-    VclPtr<Edit> m_pCoverPath;
-    VclPtr<PushButton> m_pCoverButton;
-    VclPtr<Edit> m_pMediaDir;
-    VclPtr<PushButton> m_pMediaButton;
-    VclPtr<PushButton> m_pOKButton;
-    VclPtr<Edit> m_pIdentifier;
-    VclPtr<Edit> m_pTitle;
-    VclPtr<Edit> m_pInitialCreator;
-    VclPtr<Edit> m_pLanguage;
-    VclPtr<Edit> m_pDate;
+    DECL_LINK(VersionSelectHdl, weld::ComboBoxText &, void);
+    DECL_LINK(SplitSelectHdl, weld::ComboBoxText &, void);
+    DECL_LINK(LayoutSelectHdl, weld::ComboBoxText &, void);
+    DECL_LINK(CoverClickHdl, weld::Button &, void);
+    DECL_LINK(MediaClickHdl, weld::Button &, void);
+    DECL_LINK(OKClickHdl, weld::Button &, void);
+
+    css::uno::Reference<css::uno::XComponentContext> m_xContext;
+    comphelper::SequenceAsHashMap &m_rFilterData;
+    css::uno::Reference<css::lang::XComponent> m_xSourceDocument;
+
+    std::unique_ptr<weld::ComboBoxText> m_xVersion;
+    std::unique_ptr<weld::ComboBoxText> m_xSplit;
+    std::unique_ptr<weld::ComboBoxText> m_xLayout;
+    std::unique_ptr<weld::Entry> m_xCoverPath;
+    std::unique_ptr<weld::Button> m_xCoverButton;
+    std::unique_ptr<weld::Entry> m_xMediaDir;
+    std::unique_ptr<weld::Button> m_xMediaButton;
+    std::unique_ptr<weld::Button> m_xOKButton;
+    std::unique_ptr<weld::Entry> m_xIdentifier;
+    std::unique_ptr<weld::Entry> m_xTitle;
+    std::unique_ptr<weld::Entry> m_xInitialCreator;
+    std::unique_ptr<weld::Entry> m_xLanguage;
+    std::unique_ptr<weld::Entry> m_xDate;
 };
 
 } // namespace writerperfect
diff --git a/writerperfect/source/writer/EPUBExportUIComponent.cxx b/writerperfect/source/writer/EPUBExportUIComponent.cxx
index 4df8ea4a1946..abf533f7f19a 100644
--- a/writerperfect/source/writer/EPUBExportUIComponent.cxx
+++ b/writerperfect/source/writer/EPUBExportUIComponent.cxx
@@ -10,7 +10,7 @@
 #include "EPUBExportUIComponent.hxx"
 
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-
+#include <comphelper/namedvaluecollection.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/vclptr.hxx>
@@ -72,12 +72,19 @@ void EPUBExportUIComponent::setTitle(const OUString &/*rTitle*/)
 {
 }
 
+void SAL_CALL EPUBExportUIComponent::initialize(const uno::Sequence<uno::Any>& rArguments)
+{
+    ::comphelper::NamedValueCollection aProperties(rArguments);
+    if (aProperties.has("ParentWindow"))
+        aProperties.get("ParentWindow") >>= mxDialogParent;
+}
+
 sal_Int16 EPUBExportUIComponent::execute()
 {
     SolarMutexGuard aGuard;
 
-    ScopedVclPtrInstance<EPUBExportDialog> pDialog(Application::GetDefDialogParent(), maFilterData, mxContext, mxSourceDocument);
-    if (pDialog->Execute() == RET_OK)
+    EPUBExportDialog aDialog(Application::GetFrameWeld(mxDialogParent), maFilterData, mxContext, mxSourceDocument);
+    if (aDialog.run() == RET_OK)
         return ui::dialogs::ExecutableDialogResults::OK;
     return ui::dialogs::ExecutableDialogResults::CANCEL;
 }
diff --git a/writerperfect/source/writer/EPUBExportUIComponent.hxx b/writerperfect/source/writer/EPUBExportUIComponent.hxx
index 865571dde97b..f2288a91ad76 100644
--- a/writerperfect/source/writer/EPUBExportUIComponent.hxx
+++ b/writerperfect/source/writer/EPUBExportUIComponent.hxx
@@ -10,8 +10,10 @@
 #ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTUICOMPONENT_HXX
 #define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTUICOMPONENT_HXX
 
+#include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/beans/XPropertyAccess.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/document/XExporter.hpp>
@@ -26,6 +28,7 @@ namespace writerperfect
 class EPUBExportUIComponent : public cppu::WeakImplHelper
     <
     css::beans::XPropertyAccess,
+    css::lang::XInitialization,
     css::lang::XServiceInfo,
     css::ui::dialogs::XExecutableDialog,
     css::document::XExporter
@@ -50,6 +53,9 @@ public:
     // XExporter
     void SAL_CALL setSourceDocument(const css::uno::Reference<css::lang::XComponent> &xDocument) override;
 
+    // XInitialization
+    void SAL_CALL   initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
+
 private:
     /// The full set of property values.
     comphelper::SequenceAsHashMap maMediaDescriptor;
@@ -58,6 +64,7 @@ private:
     /// UNO context.
     css::uno::Reference<css::uno::XComponentContext> mxContext;
     css::uno::Reference<css::lang::XComponent> mxSourceDocument;
+    css::uno::Reference<css::awt::XWindow> mxDialogParent;
 };
 
 } // namespace writerperfect
diff --git a/writerperfect/uiconfig/ui/exportepub.ui b/writerperfect/uiconfig/ui/exportepub.ui
index 114cd0376952..8b1ff34d7b00 100644
--- a/writerperfect/uiconfig/ui/exportepub.ui
+++ b/writerperfect/uiconfig/ui/exportepub.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="wpt">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="EpubDialog">
@@ -8,6 +8,8 @@
     <property name="title" translatable="yes" context="exportepub|EpubDialog">EPUB Export</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -296,6 +298,7 @@
                               <object class="GtkEntry" id="coverpath">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
+                                <property name="activates_default">True</property>
                               </object>
                               <packing>
                                 <property name="expand">True</property>
@@ -369,6 +372,7 @@
                               <object class="GtkEntry" id="mediadir">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
+                                <property name="activates_default">True</property>
                               </object>
                               <packing>
                                 <property name="expand">True</property>
@@ -451,6 +455,7 @@
                           <object class="GtkEntry" id="identifier">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -491,6 +496,7 @@
                           <object class="GtkEntry" id="title">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -516,6 +522,7 @@
                           <object class="GtkEntry" id="author">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -541,6 +548,7 @@
                           <object class="GtkEntry" id="language">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -566,6 +574,7 @@
                           <object class="GtkEntry" id="date">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -602,11 +611,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
-  </object>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">9999</property>
-    <property name="value">1</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
commit dc7f9a1f79a94107d6113ee6569dbcbf15cf3071
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 18 14:26:09 2018 +0100

    weld SwCreateAuthEntryDlg_Impl
    
    Change-Id: Ib654539cca64efe479cf3c9b8b585ab17019edeb
    Reviewed-on: https://gerrit.libreoffice.org/53117
    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/vcl/weld.hxx b/include/vcl/weld.hxx
index 47d399a8eb69..4e0d91ac9b0f 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -63,6 +63,11 @@ public:
     virtual void set_grid_top_attach(int nAttach) = 0;
     virtual int get_grid_top_attach() const = 0;
 
+    virtual void set_hexpand(bool bExpand) = 0;
+    virtual bool get_hexpand() const = 0;
+    virtual void set_vexpand(bool bExpand) = 0;
+    virtual bool get_vexpand() const = 0;
+
     virtual void set_margin_top(int nMargin) = 0;
     virtual void set_margin_bottom(int nMargin) = 0;
 
@@ -83,8 +88,8 @@ public:
 class VCL_DLLPUBLIC Container : virtual public Widget
 {
 public:
-    virtual void remove(weld::Widget* pWidget) = 0;
-    virtual void add(weld::Widget* pWidget) = 0;
+    //remove and add in one go
+    virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) = 0;
 };
 
 class VCL_DLLPUBLIC ScrolledWindow : virtual public Container
@@ -219,7 +224,6 @@ public:
     void append_text(const OUString& rStr) { insert_text(-1, rStr); }
     virtual void insert(int pos, const OUString& rId, const OUString& rStr) = 0;
     void append(const OUString& rId, const OUString& rStr) { insert(-1, rId, rStr); }
-    using Container::remove;
     virtual void remove(int pos) = 0;
     virtual int find_text(const OUString& rStr) const = 0;
     virtual int find_id(const OUString& rId) const = 0;
@@ -269,7 +273,6 @@ public:
     }
     virtual int n_children() const = 0;
     virtual void select(int pos) = 0;
-    using Container::remove;
     virtual void remove(int pos) = 0;
     virtual int find(const OUString& rText) const = 0;
     virtual int find_id(const OUString& rId) const = 0;
@@ -604,6 +607,7 @@ class VCL_DLLPUBLIC Label : virtual public Widget
 public:
     virtual void set_label(const OUString& rText) = 0;
     virtual OUString get_label() const = 0;
+    virtual void set_mnemonic_widget(Widget* pTarget) = 0;
 };
 
 class VCL_DLLPUBLIC TextView : virtual public Container
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 0ef338bb2792..9092d085e48d 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -99,6 +99,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/autoformattable \
 	sw/uiconfig/swriter/ui/autotext \
 	sw/uiconfig/swriter/ui/bibliographyentry \
+	sw/uiconfig/swriter/ui/bibliofragment \
 	sw/uiconfig/swriter/ui/bulletsandnumbering \
 	sw/uiconfig/swriter/ui/businessdatapage \
 	sw/uiconfig/swriter/ui/cannotsavelabeldialog \
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index f0b1307dccb8..ea8d23ecde67 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -992,38 +992,41 @@ void SwIndexMarkModalDlg::dispose()
     SvxStandardDialog::dispose();
 }
 
-class SwCreateAuthEntryDlg_Impl : public ModalDialog
+class SwCreateAuthEntryDlg_Impl : public weld::GenericDialogController
 {
-    VclPtr<FixedText>      pFixedTexts[AUTH_FIELD_END];
-    VclPtr<ListBox>        pTypeListBox;
-    VclPtr<ComboBox>       pIdentifierBox;
-    VclPtr<Edit>           pEdits[AUTH_FIELD_END];
+    std::vector<std::unique_ptr<weld::Builder>> m_aBuilders;
 
-    VclPtr<OKButton>       m_pOKBT;
-
-    Link<Edit*,bool>       aShortNameCheckLink;
+    Link<weld::Entry&,bool>       aShortNameCheckLink;
 
     SwWrtShell&     rWrtSh;
 
     bool            m_bNewEntryMode;
     bool            m_bNameAllowed;
 
-    DECL_LINK(IdentifierHdl, ComboBox&, void);
-    DECL_LINK(ShortNameHdl, Edit&, void);
-    DECL_LINK(EnableHdl, ListBox&, void);
+    std::vector<std::unique_ptr<weld::Container>> m_aOrigContainers;
+    std::vector<std::unique_ptr<weld::Label>> m_aFixedTexts;
+    std::unique_ptr<weld::Entry> pEdits[AUTH_FIELD_END];
+    std::unique_ptr<weld::Button> m_xOKBT;
+    std::unique_ptr<weld::Container> m_xBox;
+    std::unique_ptr<weld::Container> m_xLeft;
+    std::unique_ptr<weld::Container> m_xRight;
+    std::unique_ptr<weld::ComboBoxText> m_xTypeListBox;
+    std::unique_ptr<weld::ComboBoxText> m_xIdentifierBox;
+
+    DECL_LINK(IdentifierHdl, weld::ComboBoxText&, void);
+    DECL_LINK(ShortNameHdl, weld::Entry&, void);
+    DECL_LINK(EnableHdl, weld::ComboBoxText&, void);
 
 public:
-    SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
-                            const OUString pFields[],
-                            SwWrtShell& rSh,
-                            bool bNewEntry,
-                            bool bCreate);
-    virtual ~SwCreateAuthEntryDlg_Impl() override;
-    virtual void    dispose() override;
+    SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
+                              const OUString pFields[],
+                              SwWrtShell& rSh,
+                              bool bNewEntry,
+                              bool bCreate);
 
     OUString        GetEntryText(ToxAuthorityField eField) const;
 
-    void            SetCheckNameHdl(const Link<Edit*,bool>& rLink) {aShortNameCheckLink = rLink;}
+    void            SetCheckNameHdl(const Link<weld::Entry&,bool>& rLink) {aShortNameCheckLink = rLink;}
 
 };
 
@@ -1251,14 +1254,14 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, Button*, pButton, void)
     OUString sOldId = m_sCreatedEntry[0];
     for(int i = 0; i < AUTH_FIELD_END; i++)
         m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i];
-    ScopedVclPtrInstance<SwCreateAuthEntryDlg_Impl> aDlg(pButton,
+    SwCreateAuthEntryDlg_Impl aDlg(pButton->GetFrameWeld(),
                 bCreate ? m_sCreatedEntry : m_sFields,
                 *pSh, bNewEntry, bCreate);
     if(bNewEntry)
     {
-        aDlg->SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
+        aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
     }
-    if(RET_OK == aDlg->Execute())
+    if(RET_OK == aDlg.run())
     {
         if(bCreate && !sOldId.isEmpty())
         {
@@ -1266,7 +1269,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, Button*, pButton, void)
         }
         for(int i = 0; i < AUTH_FIELD_END; i++)
         {
-            m_sFields[i] = aDlg->GetEntryText(static_cast<ToxAuthorityField>(i));
+            m_sFields[i] = aDlg.GetEntryText(static_cast<ToxAuthorityField>(i));
             m_sCreatedEntry[i] = m_sFields[i];
         }
         if(bNewEntry && !m_pFromDocContentRB->IsChecked())
@@ -1352,7 +1355,7 @@ IMPL_LINK(SwAuthorMarkPane, ChangeSourceHdl, Button*, pButton, void)
 
 IMPL_LINK(SwAuthorMarkPane, EditModifyHdl, Edit&, rEdit, void)
 {
-    Link<Edit*,bool> aAllowed = LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl);
+    Link<Edit*,bool> aAllowed = LINK(this, SwAuthorMarkPane, IsEditAllowedHdl);
     bool bResult = aAllowed.Call(&rEdit);
     m_pActionBT->Enable(bResult);
     if(bResult)
@@ -1363,7 +1366,29 @@ IMPL_LINK(SwAuthorMarkPane, EditModifyHdl, Edit&, rEdit, void)
     }
 };
 
-IMPL_LINK(SwAuthorMarkPane, IsEntryAllowedHdl, Edit*, pEdit, bool)
+IMPL_LINK(SwAuthorMarkPane, IsEntryAllowedHdl, weld::Entry&, rEdit, bool)
+{
+    OUString sEntry = rEdit.get_text();
+    bool bAllowed = false;
+    if(!sEntry.isEmpty())
+    {
+        if(m_pEntryLB->GetEntryPos(sEntry) != LISTBOX_ENTRY_NOTFOUND)
+            return false;
+        else if(bIsFromComponent)
+        {
+            const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
+                                        pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
+            bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
+        }
+        else
+        {
+            bAllowed = !xBibAccess.is() || !xBibAccess->hasByName(sEntry);
+        }
+    }
+    return bAllowed;
+}
+
+IMPL_LINK(SwAuthorMarkPane, IsEditAllowedHdl, Edit*, pEdit, bool)
 {
     OUString sEntry = pEdit->GetText();
     bool bAllowed = false;
@@ -1458,62 +1483,69 @@ namespace
     };
 }
 
-SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
+SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
         const OUString pFields[],
         SwWrtShell& rSh,
         bool bNewEntry,
         bool bCreate)
-    : ModalDialog(pParent, "CreateAuthorEntryDialog", "modules/swriter/ui/createauthorentry.ui")
-
-    ,
-
-    pTypeListBox(nullptr),
-    pIdentifierBox(nullptr),
-    rWrtSh(rSh),
-    m_bNewEntryMode(bNewEntry),
-    m_bNameAllowed(true)
+    : GenericDialogController(pParent, "modules/swriter/ui/createauthorentry.ui", "CreateAuthorEntryDialog")
+    , rWrtSh(rSh)
+    , m_bNewEntryMode(bNewEntry)
+    , m_bNameAllowed(true)
+    , m_xOKBT(m_xBuilder->weld_button("ok"))
+    , m_xBox(m_xBuilder->weld_container("box"))
+    , m_xLeft(m_xBuilder->weld_container("leftgrid"))
+    , m_xRight(m_xBuilder->weld_container("rightgrid"))
 {
-    get(m_pOKBT, "ok");
-
-    VclGrid *pLeft = get<VclGrid>("leftgrid");
-    VclGrid *pRight = get<VclGrid>("rightgrid");
-
     bool bLeft = true;
     sal_Int32 nLeftRow(0), nRightRow(0);
     for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
     {
+        //m_xBox parent just to have some parent during setup, added contents are not directly visible under m_xBox
+        m_aBuilders.emplace_back(Application::CreateBuilder(m_xBox.get(), "modules/swriter/ui/bibliofragment.ui"));
         const TextInfo aCurInfo = aTextInfoArr[nIndex];
 
-        pFixedTexts[nIndex] = VclPtr<FixedText>::Create(bLeft ? pLeft : pRight, WB_VCENTER);
-
-        pFixedTexts[nIndex]->set_grid_left_attach(0);
-        pFixedTexts[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
-        pFixedTexts[nIndex]->SetText(SwResId(STR_AUTH_FIELD_ARY[aCurInfo.nToxField]));
-        pFixedTexts[nIndex]->Show();
-        pEdits[nIndex] = nullptr;
+        m_aOrigContainers.emplace_back(m_aBuilders.back()->weld_container("biblioentry"));
+        m_aFixedTexts.emplace_back(m_aBuilders.back()->weld_label("label"));
+        if (bLeft)
+            m_aOrigContainers.back()->move(m_aFixedTexts.back().get(), m_xLeft.get());
+        else
+            m_aOrigContainers.back()->move(m_aFixedTexts.back().get(), m_xRight.get());
+        m_aFixedTexts.back()->set_grid_left_attach(0);
+        m_aFixedTexts.back()->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
+        m_aFixedTexts.back()->set_label(SwResId(STR_AUTH_FIELD_ARY[aCurInfo.nToxField]));
+        m_aFixedTexts.back()->show();
         if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
         {
-            pTypeListBox = VclPtr<ListBox>::Create(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER);
+            m_xTypeListBox.reset(m_aBuilders.back()->weld_combo_box_text("listbox"));
+            if (bLeft)
+                m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xLeft.get());
+            else
+                m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xRight.get());
+
             for (int j = 0; j < AUTH_TYPE_END; j++)
-                pTypeListBox->InsertEntry(SwAuthorityFieldType::GetAuthTypeName(static_cast<ToxAuthorityType>(j)));
-            pTypeListBox->EnableAutoSize(true);
+                m_xTypeListBox->append_text(SwAuthorityFieldType::GetAuthTypeName(static_cast<ToxAuthorityType>(j)));
             if(!pFields[aCurInfo.nToxField].isEmpty())
             {
-                pTypeListBox->SelectEntryPos(pFields[aCurInfo.nToxField].toInt32());
+                m_xTypeListBox->set_active(pFields[aCurInfo.nToxField].toInt32());
             }
-            pTypeListBox->set_grid_left_attach(1);
-            pTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
-            pTypeListBox->set_hexpand(true);
-            pTypeListBox->Show();
-            pTypeListBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl));
-            pTypeListBox->SetHelpId(aCurInfo.pHelpId);
-            pFixedTexts[nIndex]->set_mnemonic_widget(pTypeListBox);
+            m_xTypeListBox->set_grid_left_attach(1);
+            m_xTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
+            m_xTypeListBox->set_hexpand(true);
+            m_xTypeListBox->show();
+            m_xTypeListBox->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl));
+            m_xTypeListBox->set_help_id(aCurInfo.pHelpId);
+            m_aFixedTexts.back()->set_mnemonic_widget(m_xTypeListBox.get());
         }
         else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
         {
-            pIdentifierBox = VclPtr<ComboBox>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER);
+            m_xIdentifierBox.reset(m_aBuilders.back()->weld_combo_box_text("combobox"));
+            if (bLeft)
+                m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xLeft.get());
+            else
+                m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xRight.get());
 
-            pIdentifierBox->SetSelectHdl(LINK(this,
+            m_xIdentifierBox->connect_changed(LINK(this,
                                     SwCreateAuthEntryDlg_Impl, IdentifierHdl));
 
             const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
@@ -1522,38 +1554,42 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
             {
                 std::vector<OUString> aIds;
                 pFType->GetAllEntryIdentifiers( aIds );
-                for(const OUString & i : aIds)
-                    pIdentifierBox->InsertEntry(i);
+                for (const OUString& a : aIds)
+                    m_xIdentifierBox->append_text(a);
             }
-            pIdentifierBox->SetText(pFields[aCurInfo.nToxField]);
-            pIdentifierBox->set_grid_left_attach(1);
-            pIdentifierBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
-            pIdentifierBox->set_hexpand(true);
-            pIdentifierBox->Show();
-            pIdentifierBox->SetHelpId(aCurInfo.pHelpId);
-            pFixedTexts[nIndex]->set_mnemonic_widget(pIdentifierBox);
+            m_xIdentifierBox->set_entry_text(pFields[aCurInfo.nToxField]);
+            m_xIdentifierBox->set_grid_left_attach(1);
+            m_xIdentifierBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
+            m_xIdentifierBox->set_hexpand(true);
+            m_xIdentifierBox->show();
+            m_xIdentifierBox->set_help_id(aCurInfo.pHelpId);
+            m_aFixedTexts.back()->set_mnemonic_widget(m_xIdentifierBox.get());
         }
         else
         {
-            pEdits[nIndex] = VclPtr<Edit>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER);
-            pEdits[nIndex]->SetWidthInChars(14);
+            pEdits[nIndex].reset(m_aBuilders.back()->weld_entry("entry"));
+            if (bLeft)
+                m_aOrigContainers.back()->move(pEdits[nIndex].get(), m_xLeft.get());
+            else
+                m_aOrigContainers.back()->move(pEdits[nIndex].get(), m_xRight.get());
+
             pEdits[nIndex]->set_grid_left_attach(1);
             pEdits[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
             pEdits[nIndex]->set_hexpand(true);
-            pEdits[nIndex]->SetText(pFields[aCurInfo.nToxField]);
-            pEdits[nIndex]->Show();
-            pEdits[nIndex]->SetHelpId(aCurInfo.pHelpId);
+            pEdits[nIndex]->set_text(pFields[aCurInfo.nToxField]);
+            pEdits[nIndex]->show();
+            pEdits[nIndex]->set_help_id(aCurInfo.pHelpId);
             if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
             {
-                pEdits[nIndex]->SetModifyHdl(LINK(this, SwCreateAuthEntryDlg_Impl, ShortNameHdl));
+                pEdits[nIndex]->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, ShortNameHdl));
                 m_bNameAllowed = !pFields[nIndex].isEmpty();
                 if(!bCreate)
                 {
-                    pFixedTexts[nIndex]->Enable(false);
-                    pEdits[nIndex]->Enable(false);
+                    m_aFixedTexts.back()->set_sensitive(false);
+                    pEdits[nIndex]->set_sensitive(false);
                 }
             }
-            pFixedTexts[nIndex]->set_mnemonic_widget(pEdits[nIndex]);
+            m_aFixedTexts.back()->set_mnemonic_widget(pEdits[nIndex].get());
         }
         if(bLeft)
             ++nLeftRow;
@@ -1561,39 +1597,21 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
             ++nRightRow;
         bLeft = !bLeft;
     }
-    EnableHdl(*pTypeListBox);
-}
-
-SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl()
-{
-    disposeOnce();
-}
-
-void SwCreateAuthEntryDlg_Impl::dispose()
-{
-    for(int i = 0; i < AUTH_FIELD_END; i++)
-    {
-        pFixedTexts[i].disposeAndClear();
-        pEdits[i].disposeAndClear();
-    }
-    pTypeListBox.disposeAndClear();
-    pIdentifierBox.disposeAndClear();
-    m_pOKBT.clear();
-    ModalDialog::dispose();
+    EnableHdl(*m_xTypeListBox);
 }
 
 OUString  SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
 {
     if( AUTH_FIELD_AUTHORITY_TYPE == eField )
     {
-        OSL_ENSURE(pTypeListBox, "No ListBox");
-        return OUString::number(pTypeListBox->GetSelectedEntryPos());
+        OSL_ENSURE(m_xTypeListBox, "No ListBox");
+        return OUString::number(m_xTypeListBox->get_active());
     }
 
     if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
     {
-        OSL_ENSURE(pIdentifierBox, "No ComboBox");
-        return pIdentifierBox->GetText();
+        OSL_ENSURE(m_xIdentifierBox, "No ComboBox");
+        return m_xIdentifierBox->get_active_text();
     }
 
     for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
@@ -1601,21 +1619,21 @@ OUString  SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) cons
         const TextInfo aCurInfo = aTextInfoArr[nIndex];
         if(aCurInfo.nToxField == eField)
         {
-            return pEdits[nIndex]->GetText();
+            return pEdits[nIndex]->get_text();
         }
     }
 
     return OUString();
 }
 
-IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox&, rBox, void)
+IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, weld::ComboBoxText&, rBox, void)
 {
     const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
                                 rWrtSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
     if(pFType)
     {
         const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
-                                                        rBox.GetText());
+                                                        rBox.get_active_text());
         if(pEntry)
         {
             for(int i = 0; i < AUTH_FIELD_END; i++)
@@ -1624,29 +1642,29 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox&, rBox, void)
                 if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
                     continue;
                 if(AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField)
-                    pTypeListBox->SelectEntry(
+                    m_xTypeListBox->set_active(
                                 pEntry->GetAuthorField(aCurInfo.nToxField));
                 else
-                    pEdits[i]->SetText(
+                    pEdits[i]->set_text(
                                 pEntry->GetAuthorField(aCurInfo.nToxField));
             }
         }
     }
 }
 
-IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, Edit&, rEdit, void)
+IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, weld::Entry&, rEdit, void)
 {
-    if(aShortNameCheckLink.IsSet())
+    if (aShortNameCheckLink.IsSet())
     {
-        bool bEnable = aShortNameCheckLink.Call(&rEdit);
+        bool bEnable = aShortNameCheckLink.Call(rEdit);
         m_bNameAllowed |= bEnable;
-        m_pOKBT->Enable(pTypeListBox->GetSelectedEntryCount() && bEnable);
+        m_xOKBT->set_sensitive(m_xTypeListBox->get_active() != -1 && bEnable);
     }
 }
 
-IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, ListBox&, rBox, void)
+IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, weld::ComboBoxText&, rBox, void)
 {
-    m_pOKBT->Enable(m_bNameAllowed && rBox.GetSelectedEntryCount());
+    m_xOKBT->set_sensitive(m_bNameAllowed && rBox.get_active() != -1);
 };
 
 SwAuthMarkFloatDlg::SwAuthMarkFloatDlg(SfxBindings* _pBindings,
diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx
index 12b04046ec32..b1ad4e718a6e 100644
--- a/sw/source/uibase/inc/swuiidxmrk.hxx
+++ b/sw/source/uibase/inc/swuiidxmrk.hxx
@@ -31,6 +31,7 @@
 #include <vcl/group.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
 
 #include <sfx2/childwin.hxx>
 #include <toxe.hxx>
@@ -216,7 +217,8 @@ class SwAuthorMarkPane
     DECL_LINK(CreateEntryHdl, Button*, void);
     DECL_LINK(CompEntryHdl, ListBox&, void);
     DECL_LINK(ChangeSourceHdl, Button*, void);
-    DECL_LINK(IsEntryAllowedHdl, Edit*, bool);
+    DECL_LINK(IsEditAllowedHdl, Edit*, bool);
+    DECL_LINK(IsEntryAllowedHdl, weld::Entry&, bool);
     DECL_LINK(EditModifyHdl, Edit&, void);
 
     void InitControls();
diff --git a/sw/uiconfig/swriter/ui/bibliofragment.ui b/sw/uiconfig/swriter/ui/bibliofragment.ui
new file mode 100644
index 000000000000..4bf528dc6e28
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/bibliofragment.ui
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkGrid" id="biblioentry">
+    <property name="can_focus">False</property>
+    <property name="no_show_all">True</property>
+    <property name="valign">start</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="column_spacing">6</property>
+    <child>
+      <object class="GtkEntry" id="entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">False</property>
+        <property name="activates_default">True</property>
+        <property name="width_chars">14</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBoxText" id="listbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">3</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBoxText" id="combobox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="has_entry">True</property>
+        <child internal-child="entry">
+          <object class="GtkEntry">
+            <property name="can_focus">True</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sw/uiconfig/swriter/ui/createauthorentry.ui b/sw/uiconfig/swriter/ui/createauthorentry.ui
index 8df461bf9fd7..5e2d96736564 100644
--- a/sw/uiconfig/swriter/ui/createauthorentry.ui
+++ b/sw/uiconfig/swriter/ui/createauthorentry.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="CreateAuthorEntryDialog">
@@ -85,7 +85,7 @@
                 <property name="top_padding">6</property>
                 <property name="left_padding">12</property>
                 <child>
-                  <object class="GtkBox" id="box1">
+                  <object class="GtkBox" id="box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
@@ -206,5 +206,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index dd831b6d3a8f..159fd97a4d2e 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -296,6 +296,26 @@ public:
         return m_xWidget->get_grid_top_attach();
     }
 
+    virtual void set_hexpand(bool bExpand) override
+    {
+        m_xWidget->set_hexpand(bExpand);
+    }
+
+    virtual bool get_hexpand() const override
+    {
+        return m_xWidget->get_hexpand();
+    }
+
+    virtual void set_vexpand(bool bExpand) override
+    {
+        m_xWidget->set_vexpand(bExpand);
+    }
+
+    virtual bool get_vexpand() const override
+    {
+        return m_xWidget->get_vexpand();
+    }
+
     virtual void set_margin_top(int nMargin) override
     {
         m_xWidget->set_margin_top(nMargin);
@@ -422,17 +442,13 @@ public:
         , m_xContainer(pContainer)
     {
     }
-    virtual void remove(weld::Widget* pWidget) override
-    {
-        SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
-        assert(pVclWidget);
-        pVclWidget->getWidget()->SetParent(nullptr);
-    }
-    virtual void add(weld::Widget* pWidget) override
+    virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override
     {
         SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
         assert(pVclWidget);
-        pVclWidget->getWidget()->SetParent(m_xContainer);
+        SalInstanceContainer* pNewVclParent = dynamic_cast<SalInstanceContainer*>(pNewParent);
+        assert(pNewVclParent);
+        pVclWidget->getWidget()->SetParent(pNewVclParent->getWidget());
     }
 };
 
@@ -1129,8 +1145,6 @@ public:
         m_xTreeView->SetEntryData(nInsertedAt, new OUString(rId));
     }
 
-    using SalInstanceContainer::remove;
-
     virtual void remove(int pos) override
     {
         m_xTreeView->RemoveEntry(pos);
@@ -1374,6 +1388,12 @@ public:
     {
         return m_xLabel->GetText();
     }
+
+    virtual void set_mnemonic_widget(Widget* pTarget) override
+    {
+        SalInstanceWidget* pTargetWidget = dynamic_cast<SalInstanceWidget*>(pTarget);
+        m_xLabel->set_mnemonic_widget(pTargetWidget ? pTargetWidget->getWidget() : nullptr);
+    }
 };
 
 class SalInstanceTextView : public SalInstanceContainer, public virtual weld::TextView
@@ -1695,8 +1715,6 @@ public:
         return m_xComboBoxText->GetSelectedEntry();
     }
 
-    using SalInstanceContainer::remove;
-
     virtual void remove(int pos) override
     {
         m_xComboBoxText->RemoveEntry(pos);
@@ -1765,8 +1783,6 @@ public:
         return m_xComboBoxText->GetText();
     }
 
-    using SalInstanceContainer::remove;
-
     virtual void remove(int pos) override
     {
         m_xComboBoxText->RemoveEntryAt(pos);
@@ -2054,8 +2070,7 @@ namespace weld
             m_xOrigParent.reset(m_xRelocate->weld_parent());
             //fdo#75121, a bit tricky because the widgets we want to align with
             //don't actually exist in the ui description, they're implied
-            m_xOrigParent->remove(m_xRelocate.get());
-            m_xContentArea->add(m_xRelocate.get());
+            m_xOrigParent->move(m_xRelocate.get(), m_xContentArea.get());
         }
     }
 
@@ -2063,8 +2078,7 @@ namespace weld
     {
         if (m_xRelocate)
         {
-            m_xContentArea->remove(m_xRelocate.get());
-            m_xOrigParent->add(m_xRelocate.get());
+            m_xContentArea->move(m_xRelocate.get(), m_xOrigParent.get());
         }
     }
 }
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 4c273766bde0..14e8af024d01 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1319,6 +1319,26 @@ public:
         return nAttach;
     }
 
+    virtual void set_hexpand(bool bExpand) override
+    {
+        gtk_widget_set_hexpand(m_pWidget, bExpand);
+    }
+
+    virtual bool get_hexpand() const override
+    {
+        return gtk_widget_get_hexpand(m_pWidget);
+    }
+
+    virtual void set_vexpand(bool bExpand) override
+    {
+        gtk_widget_set_vexpand(m_pWidget, bExpand);
+    }
+
+    virtual bool get_vexpand() const override
+    {
+        return gtk_widget_get_vexpand(m_pWidget);
+    }
+
     virtual void set_margin_top(int nMargin) override
     {
         gtk_widget_set_margin_top(m_pWidget, nMargin);
@@ -1621,18 +1641,19 @@ public:
     {
     }
 
-    virtual void remove(weld::Widget* pWidget) override
-    {
-        GtkInstanceWidget* pGtkWidget = dynamic_cast<GtkInstanceWidget*>(pWidget);
-        assert(pGtkWidget);
-        gtk_container_remove(m_pContainer, pGtkWidget->getWidget());
-    }
+    GtkContainer* getContainer() { return m_pContainer; }
 
-    virtual void add(weld::Widget* pWidget) override
+    virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override
     {
         GtkInstanceWidget* pGtkWidget = dynamic_cast<GtkInstanceWidget*>(pWidget);
         assert(pGtkWidget);
-        gtk_container_add(m_pContainer, pGtkWidget->getWidget());
+        GtkInstanceContainer* pNewGtkParent = dynamic_cast<GtkInstanceContainer*>(pNewParent);
+        assert(pNewGtkParent);
+        GtkWidget* pChild = pGtkWidget->getWidget();
+        g_object_ref(pChild);
+        gtk_container_remove(getContainer(), pChild);
+        gtk_container_add(pNewGtkParent->getContainer(), pChild);
+        g_object_unref(pChild);
     }
 };
 
@@ -2917,8 +2938,6 @@ public:
         enable_notify_events();
     }
 
-    using GtkInstanceContainer::remove;
-
     virtual void remove(int pos) override
     {
         disable_notify_events();
@@ -3268,6 +3287,12 @@ public:
     {
         return ::get_label(m_pLabel);
     }
+
+    virtual void set_mnemonic_widget(Widget* pTarget) override
+    {
+        GtkInstanceWidget* pTargetWidget = dynamic_cast<GtkInstanceWidget*>(pTarget);
+        gtk_label_set_mnemonic_widget(m_pLabel, pTargetWidget ? pTargetWidget->getWidget() : nullptr);
+    }
 };
 
 class GtkInstanceTextView : public GtkInstanceContainer, public virtual weld::TextView
@@ -3801,8 +3826,6 @@ public:
         enable_notify_events();
     }
 
-    using GtkInstanceContainer::remove;
-
     virtual void remove(int pos) override
     {
         disable_notify_events();


More information about the Libreoffice-commits mailing list