[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 25 14:40:23 UTC 2018


 sw/inc/swabstdlg.hxx                        |    2 
 sw/source/ui/dialog/swdlgfact.cxx           |    5 
 sw/source/ui/dialog/swdlgfact.hxx           |    2 
 sw/source/ui/index/swuiidxmrk.cxx           |  373 +++++++++++++++++++++++++++-
 sw/source/uibase/inc/swuiidxmrk.hxx         |   59 ++++
 sw/source/uibase/shells/textidx.cxx         |    2 
 sw/uiconfig/swriter/ui/bibliographyentry.ui |   86 ++----
 7 files changed, 462 insertions(+), 67 deletions(-)

New commits:
commit af428a570e05a7d38476208152630853dc15f41f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 25 12:16:44 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 25 16:39:55 2018 +0200

    weld SwAuthMarkModalDlg
    
    Change-Id: Ief3a32a6001cf8b388107c74dc96fc82430d6398
    Reviewed-on: https://gerrit.libreoffice.org/62354
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 59f7e12ad227..cf621ad6e89a 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -400,7 +400,7 @@ public:
                                                          bool bDraw,
                                                          const OString& sDefPage = OString() ) = 0;
 
-    virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0;
+    virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(weld::Window *pParent, SwWrtShell &rSh) = 0;
 
     virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) = 0;
 
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index ed9cc2b47001..15a96a671249 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -875,10 +875,9 @@ VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwParaDlg(weld:
     return VclPtr<AbstractTabController_Impl>::Create(o3tl::make_unique<SwParaDlg>(pParent, rVw, rCoreSet, DLG_STD, nullptr, bDraw, sDefPage));
 }
 
-VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAutoMarkDialog(vcl::Window *pParent, SwWrtShell &rSh)
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAutoMarkDialog(weld::Window *pParent, SwWrtShell &rSh)
 {
-    VclPtr<Dialog> pDlg = VclPtr<SwAuthMarkModalDlg>::Create( pParent, rSh );
-    return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
+    return VclPtr<AbstractGenericDialog_Impl>::Create(o3tl::make_unique<SwAuthMarkModalDlg>(pParent, rSh));
 }
 
 VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 3943fb159bce..78d79677c0ed 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -629,7 +629,7 @@ public:
                                                     bool bDraw,
                                                     const OString& sDefPage = OString()) override;
 
-    virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(vcl::Window *pParent, SwWrtShell &rSh) override;
+    virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(weld::Window *pParent, SwWrtShell &rSh) override;
     virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) override;
     virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh) override;
     virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) override;
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index cc6775996300..b986228698fa 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1443,6 +1443,361 @@ void SwAuthorMarkPane::Activate()
     m_pActionBT->Enable(!pSh->HasReadonlySel());
 }
 
+bool AuthorMarkPane::bIsFromComponent = true;
+
+AuthorMarkPane::AuthorMarkPane(weld::DialogController &rDialog, weld::Builder& rBuilder, bool bNewDlg)
+    : m_rDialog(rDialog)
+    , bNewEntry(bNewDlg)
+    , bBibAccessInitialized(false)
+    , pSh(nullptr)
+    , m_xFromComponentRB(rBuilder.weld_radio_button("frombibliography"))
+    , m_xFromDocContentRB(rBuilder.weld_radio_button("fromdocument"))
+    , m_xAuthorFI(rBuilder.weld_label("author"))
+    , m_xTitleFI(rBuilder.weld_label("title"))
+    , m_xEntryED(rBuilder.weld_entry("entryed"))
+    , m_xEntryLB(rBuilder.weld_combo_box("entrylb"))
+    , m_xActionBT(rBuilder.weld_button(bNewEntry ? OString("insert") : OString("modify")))
+    , m_xCloseBT(rBuilder.weld_button("close"))
+    , m_xCreateEntryPB(rBuilder.weld_button("new"))
+    , m_xEditEntryPB(rBuilder.weld_button("edit"))
+{
+    m_xActionBT->show(true);
+    m_xFromComponentRB->show(bNewEntry);
+    m_xFromDocContentRB->show(bNewEntry);
+    m_xFromComponentRB->set_active(bIsFromComponent);
+    m_xFromDocContentRB->set_active(!bIsFromComponent);
+
+    m_xActionBT->connect_clicked(LINK(this,AuthorMarkPane, InsertHdl));
+    m_xCloseBT->connect_clicked(LINK(this,AuthorMarkPane, CloseHdl));
+    m_xCreateEntryPB->connect_clicked(LINK(this,AuthorMarkPane, CreateEntryHdl));
+    m_xEditEntryPB->connect_clicked(LINK(this,AuthorMarkPane, CreateEntryHdl));
+    m_xFromComponentRB->connect_toggled(LINK(this,AuthorMarkPane, ChangeSourceHdl));
+    m_xFromDocContentRB->connect_toggled(LINK(this,AuthorMarkPane, ChangeSourceHdl));
+    m_xEntryED->connect_changed(LINK(this,AuthorMarkPane, EditModifyHdl));
+
+    m_rDialog.set_title(SwResId(
+                    bNewEntry ? STR_AUTHMRK_INSERT : STR_AUTHMRK_EDIT));
+
+    m_xEntryED->show(!bNewEntry);
+    m_xEntryLB->show(bNewEntry);
+    if (bNewEntry)
+    {
+        m_xEntryLB->connect_changed(LINK(this, AuthorMarkPane, CompEntryHdl));
+    }
+}
+
+void AuthorMarkPane::ReInitDlg(SwWrtShell& rWrtShell)
+{
+    pSh = &rWrtShell;
+    InitControls();
+}
+
+IMPL_LINK_NOARG(AuthorMarkPane, CloseHdl, weld::Button&, void)
+{
+    if(bNewEntry)
+    {
+        SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
+                    SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+    }
+    else
+    {
+        m_rDialog.response(RET_CANCEL);
+    }
+}
+
+IMPL_LINK( AuthorMarkPane, CompEntryHdl, weld::ComboBox&, rBox, void)
+{
+    const OUString sEntry(rBox.get_active_text());
+    if(bIsFromComponent)
+    {
+        if(xBibAccess.is() && !sEntry.isEmpty())
+        {
+            if(xBibAccess->hasByName(sEntry))
+            {
+                uno::Any aEntry(xBibAccess->getByName(sEntry));
+                uno::Sequence<beans::PropertyValue> aFieldProps;
+                if(aEntry >>= aFieldProps)
+                {
+                    const beans::PropertyValue* pProps = aFieldProps.getConstArray();
+                    for(sal_Int32 i = 0; i < AUTH_FIELD_END && i < aFieldProps.getLength(); i++)
+                    {
+                        m_sFields[i] = lcl_FindColumnEntry(
+                                pProps, aFieldProps.getLength(), m_sColumnTitles[i]);
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        if(!sEntry.isEmpty())
+        {
+            const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
+                                        pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
+            const SwAuthEntry*  pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : nullptr;
+            for(int i = 0; i < AUTH_FIELD_END; i++)
+                m_sFields[i] = pEntry ?
+                            pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)) : OUString();
+        }
+    }
+    if (rBox.get_active_text().isEmpty())
+    {
+        for(OUString & s : m_sFields)
+            s.clear();
+    }
+    m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
+    m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
+}
+
+IMPL_LINK_NOARG(AuthorMarkPane, InsertHdl, weld::Button&, void)
+{
+    //insert or update the SwAuthorityField...
+    if(pSh)
+    {
+        bool bDifferent = false;
+        OSL_ENSURE(!m_sFields[AUTH_FIELD_IDENTIFIER].isEmpty() , "No Id is set!");
+        OSL_ENSURE(!m_sFields[AUTH_FIELD_AUTHORITY_TYPE].isEmpty() , "No authority type is set!");
+        //check if the entry already exists with different content
+        const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
+                                        pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
+        const SwAuthEntry*  pEntry = pFType ?
+                pFType->GetEntryByIdentifier( m_sFields[AUTH_FIELD_IDENTIFIER])
+                : nullptr;
+        if(pEntry)
+        {
+            for(int i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
+                bDifferent |= m_sFields[i] != pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
+            if(bDifferent)
+            {
+                std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_rDialog.getDialog(),
+                                                            VclMessageType::Question, VclButtonsType::YesNo,
+                                                            SwResId(STR_QUERY_CHANGE_AUTH_ENTRY)));
+                if (RET_YES != xQuery->run())
+                    return;
+            }
+        }
+
+        SwFieldMgr aMgr(pSh);
+        OUStringBuffer sFields;
+        for(OUString & s : m_sFields)
+        {
+            sFields.append(s).append(TOX_STYLE_DELIMITER);
+        }
+        if(bNewEntry)
+        {
+            if(bDifferent)
+            {
+                SwAuthEntry aNewData;
+                for(int i = 0; i < AUTH_FIELD_END; i++)
+                    aNewData.SetAuthorField(static_cast<ToxAuthorityField>(i), m_sFields[i]);
+                pSh->ChangeAuthorityData(&aNewData);
+            }
+            SwInsertField_Data aData(TYP_AUTHORITY, 0, sFields.makeStringAndClear(), OUString(), 0 );
+            aMgr.InsertField( aData );
+        }
+        else if(aMgr.GetCurField())
+        {
+            aMgr.UpdateCurField(0, sFields.makeStringAndClear(), OUString());
+        }
+    }
+    if(!bNewEntry)
+        CloseHdl(*m_xCloseBT);
+}
+
+IMPL_LINK(AuthorMarkPane, CreateEntryHdl, weld::Button&, rButton, void)
+{
+    bool bCreate = &rButton == m_xCreateEntryPB.get();
+    OUString sOldId = m_sCreatedEntry[0];
+    for(int i = 0; i < AUTH_FIELD_END; i++)
+        m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i];
+    SwCreateAuthEntryDlg_Impl aDlg(m_rDialog.getDialog(),
+                bCreate ? m_sCreatedEntry : m_sFields,
+                *pSh, bNewEntry, bCreate);
+    if(bNewEntry)
+    {
+        aDlg.SetCheckNameHdl(LINK(this, AuthorMarkPane, IsEntryAllowedHdl));
+    }
+    if(RET_OK == aDlg.run())
+    {
+        if(bCreate && !sOldId.isEmpty())
+        {
+            m_xEntryLB->remove_text(sOldId);
+        }
+        for(int i = 0; i < AUTH_FIELD_END; i++)
+        {
+            m_sFields[i] = aDlg.GetEntryText(static_cast<ToxAuthorityField>(i));
+            m_sCreatedEntry[i] = m_sFields[i];
+        }
+        if(bNewEntry && !m_xFromDocContentRB->get_active())
+        {
+            m_xFromDocContentRB->set_active(true);
+            ChangeSourceHdl(*m_xFromDocContentRB);
+        }
+        if(bCreate)
+        {
+            OSL_ENSURE(m_xEntryLB->find_text(m_sFields[AUTH_FIELD_IDENTIFIER]) == -1,
+                        "entry exists!");
+            m_xEntryLB->append_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
+            m_xEntryLB->set_active_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
+        }
+        m_xEntryED->set_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
+        m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
+        m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
+        m_xActionBT->set_sensitive(true);
+    }
+}
+
+IMPL_LINK_NOARG(AuthorMarkPane, ChangeSourceHdl, weld::ToggleButton&, void)
+{
+    bool bFromComp = m_xFromComponentRB->get_active();
+    bIsFromComponent = bFromComp;
+    m_xCreateEntryPB->set_sensitive(!bIsFromComponent);
+    m_xEntryLB->clear();
+    if(bIsFromComponent)
+    {
+        if(!bBibAccessInitialized)
+        {
+            uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
+            xBibAccess = frame::Bibliography::create( xContext );
+            uno::Reference< beans::XPropertySet >  xPropSet(xBibAccess, uno::UNO_QUERY);
+            OUString uPropName("BibliographyDataFieldNames");
+            if(xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName(uPropName))
+            {
+                uno::Any aNames = xPropSet->getPropertyValue(uPropName);
+                uno::Sequence<beans::PropertyValue> aSeq;
+                if( aNames >>= aSeq)
+                {
+                    const beans::PropertyValue* pArr = aSeq.getConstArray();
+                    for(sal_Int32 i = 0; i < aSeq.getLength(); i++)
+                    {
+                        OUString sTitle = pArr[i].Name;
+                        sal_Int16 nField = 0;
+                        pArr[i].Value >>= nField;
+                        if(nField >= 0 && nField < AUTH_FIELD_END)
+                            m_sColumnTitles[nField] = sTitle;
+                    }
+                }
+            }
+            bBibAccessInitialized = true;
+        }
+        if(xBibAccess.is())
+        {
+            uno::Sequence<OUString> aIdentifiers = xBibAccess->getElementNames();
+            const OUString* pNames = aIdentifiers.getConstArray();
+            for(sal_Int32 i = 0; i < aIdentifiers.getLength(); i++)
+                m_xEntryLB->append_text(pNames[i]);
+        }
+    }
+    else
+    {
+        const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
+                                    pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
+        if(pFType)
+        {
+            std::vector<OUString> aIds;
+            pFType->GetAllEntryIdentifiers( aIds );
+            for(const OUString & i : aIds)
+                m_xEntryLB->append_text(i);
+        }
+        if(!m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].isEmpty())
+            m_xEntryLB->append_text(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
+    }
+    m_xEntryLB->set_active(0);
+    CompEntryHdl(*m_xEntryLB);
+}
+
+IMPL_LINK(AuthorMarkPane, EditModifyHdl, weld::Entry&, rEdit, void)
+{
+    Link<weld::Entry&,bool> aAllowed = LINK(this, AuthorMarkPane, IsEditAllowedHdl);
+    bool bResult = aAllowed.Call(rEdit);
+    m_xActionBT->set_sensitive(bResult);
+    if(bResult)
+    {
+        OUString sEntry(rEdit.get_text());
+        m_sFields[AUTH_FIELD_IDENTIFIER] = sEntry;
+        m_sCreatedEntry[AUTH_FIELD_IDENTIFIER] = sEntry;
+    }
+};
+
+IMPL_LINK(AuthorMarkPane, IsEntryAllowedHdl, weld::Entry&, rEdit, bool)
+{
+    OUString sEntry = rEdit.get_text();
+    bool bAllowed = false;
+    if(!sEntry.isEmpty())
+    {
+        if (m_xEntryLB->find_text(sEntry) != -1)
+            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(AuthorMarkPane, IsEditAllowedHdl, weld::Entry&, rEdit, bool)
+{
+    OUString sEntry = rEdit.get_text();
+    bool bAllowed = false;
+    if(!sEntry.isEmpty())
+    {
+        if (m_xEntryLB->find_text(sEntry) != -1)
+            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;
+}
+
+void AuthorMarkPane::InitControls()
+{
+    OSL_ENSURE(pSh, "no shell?");
+    SwField* pField = pSh->GetCurField();
+    OSL_ENSURE(bNewEntry || pField, "no current marker");
+    if(bNewEntry)
+    {
+        ChangeSourceHdl(m_xFromComponentRB->get_active() ? *m_xFromComponentRB : *m_xFromDocContentRB);
+        m_xCreateEntryPB->set_sensitive(!m_xFromComponentRB->get_active());
+        if(!m_xFromComponentRB->get_active() && !m_sCreatedEntry[0].isEmpty())
+            for(int i = 0; i < AUTH_FIELD_END; i++)
+                m_sFields[i] = m_sCreatedEntry[i];
+    }
+    if(bNewEntry || !pField || pField->GetTyp()->Which() != SwFieldIds::TableOfAuthorities)
+        return;
+
+    const SwAuthEntry* pEntry = static_cast<SwAuthorityFieldType*>(pField->GetTyp())->
+            GetEntryByHandle(static_cast<SwAuthorityField*>(pField)->GetHandle());
+
+    OSL_ENSURE(pEntry, "No authority entry found");
+    if(!pEntry)
+        return;
+    for(int i = 0; i < AUTH_FIELD_END; i++)
+        m_sFields[i] = pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
+
+    m_xEntryED->set_text(pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER));
+    m_xAuthorFI->set_label(pEntry->GetAuthorField(AUTH_FIELD_AUTHOR));
+    m_xTitleFI->set_label(pEntry->GetAuthorField(AUTH_FIELD_TITLE));
+}
+
+void AuthorMarkPane::Activate()
+{
+    m_xActionBT->set_sensitive(!pSh->HasReadonlySel());
+}
+
 namespace
 {
     const char* STR_AUTH_FIELD_ARY[] =
@@ -1691,17 +2046,25 @@ void SwAuthMarkFloatDlg::ReInitDlg(SwWrtShell& rWrtShell)
     m_aContent.ReInitDlg( rWrtShell );
 }
 
-SwAuthMarkModalDlg::SwAuthMarkModalDlg(vcl::Window *pParent, SwWrtShell& rSh)
-    : SvxStandardDialog(pParent, "BibliographyEntryDialog",
-        "modules/swriter/ui/bibliographyentry.ui")
-    , m_aContent(*this, false)
+SwAuthMarkModalDlg::SwAuthMarkModalDlg(weld::Window *pParent, SwWrtShell& rSh)
+    : SfxDialogController(pParent, "modules/swriter/ui/bibliographyentry.ui",
+                          "BibliographyEntryDialog")
+    , m_aContent(*this, *m_xBuilder, false)
 {
     m_aContent.ReInitDlg(rSh);
 }
 
+short SwAuthMarkModalDlg::run()
+{
+    short ret = SfxDialogController::run();
+    if (ret == RET_OK)
+        Apply();
+    return ret;
+}
+
 void SwAuthMarkModalDlg::Apply()
 {
-    m_aContent.InsertHdl(nullptr);
+    m_aContent.InsertHdl(*m_aContent.m_xActionBT);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx
index 750cd717945c..3c8f63754998 100644
--- a/sw/source/uibase/inc/swuiidxmrk.hxx
+++ b/sw/source/uibase/inc/swuiidxmrk.hxx
@@ -229,6 +229,56 @@ public:
     void    ReInitDlg(SwWrtShell& rWrtShell);
 };
 
+class AuthorMarkPane
+{
+    weld::DialogController& m_rDialog;
+
+    static bool     bIsFromComponent;
+
+    friend class SwAuthMarkModalDlg;
+    friend class SwAuthMarkFloatDlg;
+
+    bool const      bNewEntry;
+    bool            bBibAccessInitialized;
+
+    SwWrtShell*     pSh;
+
+    OUString        m_sColumnTitles[AUTH_FIELD_END];
+    OUString        m_sFields[AUTH_FIELD_END];
+
+    OUString        m_sCreatedEntry[AUTH_FIELD_END];
+
+    css::uno::Reference< css::container::XNameAccess >    xBibAccess;
+
+    std::unique_ptr<weld::RadioButton> m_xFromComponentRB;
+    std::unique_ptr<weld::RadioButton> m_xFromDocContentRB;
+    std::unique_ptr<weld::Label> m_xAuthorFI;
+    std::unique_ptr<weld::Label> m_xTitleFI;
+    std::unique_ptr<weld::Entry> m_xEntryED;
+    std::unique_ptr<weld::ComboBox> m_xEntryLB;
+    std::unique_ptr<weld::Button> m_xActionBT;
+    std::unique_ptr<weld::Button> m_xCloseBT;
+    std::unique_ptr<weld::Button> m_xCreateEntryPB;
+    std::unique_ptr<weld::Button> m_xEditEntryPB;
+
+    DECL_LINK(InsertHdl, weld::Button&, void);
+    DECL_LINK(CloseHdl, weld::Button&, void);
+    DECL_LINK(CreateEntryHdl, weld::Button&, void);
+    DECL_LINK(CompEntryHdl, weld::ComboBox&, void);
+    DECL_LINK(ChangeSourceHdl, weld::ToggleButton&, void);
+    DECL_LINK(IsEditAllowedHdl, weld::Entry&, bool);
+    DECL_LINK(IsEntryAllowedHdl, weld::Entry&, bool);
+    DECL_LINK(EditModifyHdl, weld::Entry&, void);
+
+    void InitControls();
+    void Activate();
+
+public:
+    AuthorMarkPane(weld::DialogController& rDialog, weld::Builder& rBuilder, bool bNew);
+
+    void    ReInitDlg(SwWrtShell& rWrtShell);
+};
+
 class SwAuthMarkFloatDlg : public SfxModelessDialog
 {
     SwAuthorMarkPane m_aContent;
@@ -242,13 +292,14 @@ public:
     void    ReInitDlg(SwWrtShell& rWrtShell);
 };
 
-class SwAuthMarkModalDlg : public SvxStandardDialog
+class SwAuthMarkModalDlg : public SfxDialogController
 {
-    SwAuthorMarkPane m_aContent;
+    AuthorMarkPane m_aContent;
+    void Apply();
 public:
-    SwAuthMarkModalDlg(vcl::Window *pParent, SwWrtShell& rSh);
+    SwAuthMarkModalDlg(weld::Window *pParent, SwWrtShell& rSh);
 
-    virtual void        Apply() override;
+    virtual short int run() override;
 };
 
 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx
index 0363566f248b..a8e36de82379 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -55,7 +55,7 @@ void SwTextShell::ExecIdx(SfxRequest const &rReq)
         case FN_EDIT_AUTH_ENTRY_DLG :
         {
             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-            ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwAutoMarkDialog(pMDI, GetShell()));
+            ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwAutoMarkDialog(GetView().GetFrameWeld(), GetShell()));
             pDlg->Execute();
         }
         break;
diff --git a/sw/uiconfig/swriter/ui/bibliographyentry.ui b/sw/uiconfig/swriter/ui/bibliographyentry.ui
index a662de63f86d..32ff10e594e0 100644
--- a/sw/uiconfig/swriter/ui/bibliographyentry.ui
+++ b/sw/uiconfig/swriter/ui/bibliographyentry.ui
@@ -1,11 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="BibliographyEntryDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="bibliographyentry|BibliographyEntryDialog">Insert Bibliography Entry</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>
@@ -16,13 +20,12 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="insert">
-                <property name="label" translatable="yes" context="bibliographyentry|insert">Insert</property>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="no_show_all">True</property>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -31,13 +34,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="modify">
-                <property name="label" translatable="yes" context="bibliographyentry|modify">Apply</property>
+              <object class="GtkButton" id="new">
+                <property name="label">gtk-new</property>
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="no_show_all">True</property>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -46,8 +48,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="close">
-                <property name="label">gtk-close</property>
+              <object class="GtkButton" id="edit">
+                <property name="label">gtk-edit</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -60,8 +62,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="close">
+                <property name="label">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -74,12 +76,13 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="new">
-                <property name="label">gtk-new</property>
-                <property name="visible">True</property>
+              <object class="GtkButton" id="insert">
+                <property name="label" translatable="yes" context="bibliographyentry|insert">Insert</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
+                <property name="no_show_all">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -88,12 +91,13 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="edit">
-                <property name="label">gtk-edit</property>
-                <property name="visible">True</property>
+              <object class="GtkButton" id="modify">
+                <property name="label" translatable="yes" context="bibliographyentry|modify">Apply</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
+                <property name="no_show_all">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -133,8 +137,8 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="margin_top">12</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="bibliographyentry|label2">Author</property>
+                        <property name="xalign">0</property>
                         <attributes>
                           <attribute name="weight" value="bold"/>
                         </attributes>
@@ -142,16 +146,14 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label3">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="bibliographyentry|label3">Title</property>
+                        <property name="xalign">0</property>
                         <attributes>
                           <attribute name="weight" value="bold"/>
                         </attributes>
@@ -159,38 +161,32 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">4</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="author">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="width_chars">60</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label5">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="bibliographyentry|label5">Short name</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">entrylb</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">6</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -202,12 +198,10 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">5</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkComboBox" id="entrylb">
+                      <object class="GtkComboBoxText" id="entrylb">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
@@ -215,8 +209,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">7</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -229,13 +221,10 @@
                         <property name="xalign">0</property>
                         <property name="active">True</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">fromdocument</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -252,8 +241,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -261,12 +248,11 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
+                        <property name="activates_default">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">8</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
@@ -293,12 +279,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">insert</action-widget>
-      <action-widget response="0">modify</action-widget>
-      <action-widget response="-7">close</action-widget>
       <action-widget response="-11">help</action-widget>
-      <action-widget response="0">new</action-widget>
-      <action-widget response="0">edit</action-widget>
+      <action-widget response="-7">close</action-widget>
     </action-widgets>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list