weld AddressBookSourceDialog

Change-Id: I3e83c41db04268b7370fdb7370f5b630419c6d4e
Reviewed-on: https://gerrit.libreoffice.org/68622
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx
index 90b2dd3..29c5bfa 100644
--- a/include/svtools/addresstemplate.hxx
+++ b/include/svtools/addresstemplate.hxx
@@ -22,10 +22,7 @@

#include <memory>
#include <svtools/svtdllapi.h>
#include <vcl/dialog.hxx>
#include <vcl/combobox.hxx>
#include <vcl/button.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/weld.hxx>

namespace com :: sun :: star :: container { class XNameAccess; }
namespace com :: sun :: star :: sdbc { class XDataSource; }
@@ -38,15 +35,12 @@ namespace com :: sun :: star :: util { struct AliasProgrammaticPair; }

namespace svt
{


    // = AddressBookSourceDialog

    struct AddressBookSourceDialogData;
    class SVT_DLLPUBLIC AddressBookSourceDialog final : public ModalDialog
    class SVT_DLLPUBLIC AddressBookSourceDialog final : public weld::GenericDialogController
    {
    public:
        AddressBookSourceDialog( vcl::Window* _pParent,
        AddressBookSourceDialog(weld::Window* _pParent,
            const css::uno::Reference< css::uno::XComponentContext >& _rxORB );

        /** if you use this ctor, the dialog
@@ -68,7 +62,7 @@ namespace svt
                the table name to display. It must refer to a valid table, relative to a connection
                obtained from <arg>_rxTransientDS</arg>
        */
        AddressBookSourceDialog( vcl::Window* _pParent,
        AddressBookSourceDialog(weld::Window* _pParent,
            const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
            const css::uno::Reference< css::sdbc::XDataSource >& _rxTransientDS,
            const OUString& _rDataSourceName,
@@ -77,7 +71,6 @@ namespace svt
        );

        virtual ~AddressBookSourceDialog() override;
        virtual void dispose() override;

        // to be used if the object was constructed for editing a field mapping only
        void        getFieldMapping(
@@ -86,12 +79,9 @@ namespace svt
    private:
        void    implConstruct();

        // Window overridables
        virtual bool        PreNotify( NotifyEvent& _rNEvt ) override;

        // implementations
        void    implScrollFields(sal_Int32 _nPos, bool _bAdjustFocus, bool _bAdjustScrollbar);
        static void implSelectField(ListBox* _pBox, const OUString& _rText);
        void    implScrollFields(sal_Int32 nPos, bool bAdjustFocus, bool bAdjustScrollbar);
        static void implSelectField(weld::ComboBox* pBox, const OUString& rText);

        void    resetTables();
        void    resetFields();
@@ -102,21 +92,15 @@ namespace svt
        // initialize the dialog from the configuration data
        void    loadConfiguration();

        DECL_LINK(OnFieldScroll, ScrollBar*, void);
        DECL_LINK(OnFieldSelect, ListBox&, void);
        DECL_LINK(OnAdministrateDatasources, Button*, void);
        DECL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, Control&, void);
        DECL_LINK(OnComboLoseFocus, Control&, void);
        DECL_LINK(OnComboSelect, ComboBox&, void);
        DECL_LINK(OnOkClicked, Button*, void);
        DECL_LINK(OnFieldScroll, weld::ScrolledWindow&, void);
        DECL_LINK(OnFieldSelect, weld::ComboBox&, void);
        DECL_LINK(OnAdministrateDatasources, weld::Button&, void);
        DECL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget&, void);
        DECL_LINK(OnComboLoseFocus, weld::Widget&, void);
        DECL_LINK(OnComboSelect, weld::ComboBox&, void);
        DECL_LINK(OnOkClicked, weld::Button&, void);
        DECL_LINK(OnDelayedInitialize, void*, void);

        // Controls
        VclPtr<ComboBox>       m_pDatasource;
        VclPtr<PushButton>     m_pAdministrateDatasources;
        VclPtr<ComboBox>       m_pTable;
        VclPtr<ScrollBar>      m_pFieldScroller;

        // string to display for "no selection"
        const OUString         m_sNoFieldSelection;

@@ -129,13 +113,18 @@ namespace svt
        css::uno::Reference< css::container::XNameAccess >
                               m_xCurrentDatasourceTables;

        // Controls
        std::unique_ptr<weld::ComboBox> m_xDatasource;
        std::unique_ptr<weld::Button> m_xAdministrateDatasources;
        std::unique_ptr<weld::ComboBox> m_xTable;
        std::unique_ptr<weld::ScrolledWindow> m_xFieldScroller;
        std::unique_ptr<weld::Button> m_xOKButton;
        std::unique_ptr<weld::Widget> m_xGrid;

        std::unique_ptr<AddressBookSourceDialogData> m_pImpl;
    };


}   // namespace svt


#endif // INCLUDED_SVTOOLS_ADDRESSTEMPLATE_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index d08edda..c972a4b 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -666,8 +666,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )

        case SID_TEMPLATE_ADDRESSBOKSOURCE:
        {
            ScopedVclPtrInstance< svt::AddressBookSourceDialog > aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
            aDialog->Execute();
            svt::AddressBookSourceDialog aDialog(rReq.GetFrameWeld(), ::comphelper::getProcessComponentContext());
            aDialog.run();
            bDone = true;
            break;
        }
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 74c200c..56d9062 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -79,10 +79,10 @@ namespace svt

    namespace
    {
        OUString lcl_getSelectedDataSource( const ComboBox& _dataSourceCombo )
        OUString lcl_getSelectedDataSource( const weld::ComboBox& dataSourceCombo )
        {
            OUString selectedDataSource = _dataSourceCombo.GetText();
            if ( _dataSourceCombo.GetEntryPos( selectedDataSource ) == LISTBOX_ENTRY_NOTFOUND )
            OUString selectedDataSource = dataSourceCombo.get_active_text();
            if (dataSourceCombo.find_text(selectedDataSource) == -1)
            {
                // none of the pre-selected entries -> assume a path to a database document
                OFileNotation aFileNotation( selectedDataSource, OFileNotation::N_SYSTEM );
@@ -425,8 +425,8 @@ void AssignmentPersistentData::ImplCommit()

    struct AddressBookSourceDialogData
    {
        std::array<VclPtr<FixedText>, FIELD_PAIRS_VISIBLE*2> pFieldLabels;
        std::array<VclPtr<ListBox>, FIELD_PAIRS_VISIBLE*2> pFields;
        std::array<std::unique_ptr<weld::Label>, FIELD_PAIRS_VISIBLE*2> pFieldLabels;
        std::array<std::unique_ptr<weld::ComboBox>, FIELD_PAIRS_VISIBLE*2> pFields;

        /// when working transient, we need the data source
        Reference< XDataSource >
@@ -479,13 +479,10 @@ void AssignmentPersistentData::ImplCommit()
        AddressBookSourceDialogData & operator= (const AddressBookSourceDialogData &) = delete;
    };


    // = AddressBookSourceDialog


    AddressBookSourceDialog::AddressBookSourceDialog(vcl::Window* _pParent,
    AddressBookSourceDialog::AddressBookSourceDialog(weld::Window* pParent,
            const Reference< XComponentContext >& _rxORB )
        : ModalDialog(_pParent, "AddressTemplateDialog", "svt/ui/addresstemplatedialog.ui")
        : GenericDialogController(pParent, "svt/ui/addresstemplatedialog.ui", "AddressTemplateDialog")
        , m_sNoFieldSelection(SvtResId(STR_NO_FIELD_SELECTION))
        , m_xORB(_rxORB)
        , m_pImpl( new AddressBookSourceDialogData )
@@ -493,11 +490,10 @@ void AssignmentPersistentData::ImplCommit()
        implConstruct();
    }


    AddressBookSourceDialog::AddressBookSourceDialog( vcl::Window* _pParent, const Reference< XComponentContext >& _rxORB,
    AddressBookSourceDialog::AddressBookSourceDialog(weld::Window* pParent, const Reference< XComponentContext >& _rxORB,
        const Reference< XDataSource >& _rxTransientDS, const OUString& _rDataSourceName,
        const OUString& _rTable, const Sequence< AliasProgrammaticPair >& _rMapping )
        : ModalDialog(_pParent, "AddressTemplateDialog", "svt/ui/addresstemplatedialog.ui")
        : GenericDialogController(pParent, "svt/ui/addresstemplatedialog.ui", "AddressTemplateDialog")
        , m_sNoFieldSelection(SvtResId(STR_NO_FIELD_SELECTION))
        , m_xORB(_rxORB)
        , m_pImpl( new AddressBookSourceDialogData( _rxTransientDS, _rDataSourceName, _rTable, _rMapping ) )
@@ -505,26 +501,26 @@ void AssignmentPersistentData::ImplCommit()
        implConstruct();
    }


    void AddressBookSourceDialog::implConstruct()
    {
        get(m_pDatasource, "datasource");
        get(m_pAdministrateDatasources, "admin");
        get(m_pTable, "datatable");
        VclScrolledWindow *pScrollWindow = get<VclScrolledWindow>("scrollwindow");
        pScrollWindow->setUserManagedScrolling(true);
        m_pFieldScroller = &pScrollWindow->getVertScrollBar();
        m_xOKButton = m_xBuilder->weld_button("ok");
        m_xDatasource = m_xBuilder->weld_combo_box("datasource");
        m_xAdministrateDatasources = m_xBuilder->weld_button("admin");
        m_xTable = m_xBuilder->weld_combo_box("datatable");
        m_xFieldScroller = m_xBuilder->weld_scrolled_window("scrollwindow");
        m_xFieldScroller->set_user_managed_scrolling();
        m_xGrid = m_xBuilder->weld_widget("grid");
        m_xFieldScroller->set_size_request(-1, m_xGrid->get_preferred_size().Height());

        for (sal_Int32 row=0; row<FIELD_PAIRS_VISIBLE; ++row)
        {
            for (sal_Int32 column=0; column<2; ++column)
            {
                // the label
                m_pImpl->pFieldLabels[row * 2 + column] = get<FixedText>(OString("label") + OString::number(row * 2 + column));
                m_pImpl->pFieldLabels[row * 2 + column] = m_xBuilder->weld_label(OString("label") + OString::number(row * 2 + column));
                // the listbox
                m_pImpl->pFields[row * 2 + column] = get<ListBox>(OString("box") + OString::number(row * 2 + column));
                m_pImpl->pFields[row * 2 + column]->SetSelectHdl(LINK(this, AddressBookSourceDialog, OnFieldSelect));

                m_pImpl->pFields[row * 2 + column] = m_xBuilder->weld_combo_box(OString("box") + OString::number(row * 2 + column));
                m_pImpl->pFields[row * 2 + column]->connect_changed(LINK(this, AddressBookSourceDialog, OnFieldSelect));
            }
        }

@@ -571,52 +567,51 @@ void AssignmentPersistentData::ImplCommit()
        m_pImpl->aFieldLabels.push_back( SvtResId( STR_FIELD_USER4));

        long nLabelWidth = 0;
        long nListBoxWidth = m_pImpl->pFields[0]->approximate_char_width() * 20;
        long nListBoxWidth = m_pImpl->pFields[0]->get_approximate_digit_width() * 18;
        for (auto const& fieldLabel : m_pImpl->aFieldLabels)
        {
            nLabelWidth = std::max(nLabelWidth, FixedText::getTextDimensions(m_pImpl->pFieldLabels[0], fieldLabel, 0x7FFFFFFF).Width());
            m_pImpl->pFieldLabels[0]->set_label(fieldLabel);
            nLabelWidth = std::max(nLabelWidth, m_pImpl->pFieldLabels[0]->get_preferred_size().Width());
        }
        for (sal_Int32 row=0; row<FIELD_PAIRS_VISIBLE; ++row)
        {
            for (sal_Int32 column=0; column<2; ++column)
            {
                m_pImpl->pFieldLabels[row * 2 + column]->set_width_request(nLabelWidth);
                m_pImpl->pFields[row * 2 + column]->set_width_request(nListBoxWidth);
                m_pImpl->pFieldLabels[row * 2 + column]->set_size_request(nLabelWidth, -1);
                m_pImpl->pFields[row * 2 + column]->set_size_request(nListBoxWidth, -1);
            }
        }


        // force a even number of known fields
        m_pImpl->bOddFieldNumber = (m_pImpl->aFieldLabels.size() % 2) != 0;
        if (m_pImpl->bOddFieldNumber)
            m_pImpl->aFieldLabels.emplace_back( );
            m_pImpl->aFieldLabels.emplace_back();

        // limit the scrollbar range accordingly
        sal_Int32 nOverallFieldPairs = m_pImpl->aFieldLabels.size() / 2;
        m_pFieldScroller->SetRange( Range(0, nOverallFieldPairs - FIELD_PAIRS_VISIBLE) );
        m_pFieldScroller->SetLineSize(1);
        m_pFieldScroller->SetPageSize(FIELD_PAIRS_VISIBLE);
        m_xFieldScroller->vadjustment_configure(0, 0, nOverallFieldPairs,
                                                1, FIELD_PAIRS_VISIBLE - 1, FIELD_PAIRS_VISIBLE);

        // reset the current field assignments
        m_pImpl->aFieldAssignments.resize(m_pImpl->aFieldLabels.size());
            // (empty strings mean "no assignment")
        // (empty strings mean "no assignment")

        // some knittings
        m_pFieldScroller->SetScrollHdl(LINK(this, AddressBookSourceDialog, OnFieldScroll));
        m_pAdministrateDatasources->SetClickHdl(LINK(this, AddressBookSourceDialog, OnAdministrateDatasources));
        m_pDatasource->EnableAutocomplete(true);
        m_pTable->EnableAutocomplete(true);
        m_pTable->SetGetFocusHdl(LINK(this, AddressBookSourceDialog, OnComboGetFocus));
        m_pDatasource->SetGetFocusHdl(LINK(this, AddressBookSourceDialog, OnComboGetFocus));
        m_pTable->SetLoseFocusHdl(LINK(this, AddressBookSourceDialog, OnComboLoseFocus));
        m_pDatasource->SetLoseFocusHdl(LINK(this, AddressBookSourceDialog, OnComboLoseFocus));
        m_pTable->SetSelectHdl(LINK(this, AddressBookSourceDialog, OnComboSelect));
        m_pDatasource->SetSelectHdl(LINK(this, AddressBookSourceDialog, OnComboSelect));
        get<OKButton>("ok")->SetClickHdl(LINK(this, AddressBookSourceDialog, OnOkClicked));
        m_xFieldScroller->connect_vadjustment_changed(LINK(this, AddressBookSourceDialog, OnFieldScroll));
        m_xAdministrateDatasources->connect_clicked(LINK(this, AddressBookSourceDialog, OnAdministrateDatasources));
        m_xDatasource->set_entry_completion(true);
        m_xTable->set_entry_completion(true);
        m_xTable->connect_focus_in(LINK(this, AddressBookSourceDialog, OnComboGetFocus));
        m_xDatasource->connect_focus_in(LINK(this, AddressBookSourceDialog, OnComboGetFocus));
        m_xTable->connect_focus_out(LINK(this, AddressBookSourceDialog, OnComboLoseFocus));
        m_xDatasource->connect_focus_out(LINK(this, AddressBookSourceDialog, OnComboLoseFocus));
        m_xTable->connect_changed(LINK(this, AddressBookSourceDialog, OnComboSelect));
        m_xDatasource->connect_changed(LINK(this, AddressBookSourceDialog, OnComboSelect));
        m_xOKButton->connect_clicked(LINK(this, AddressBookSourceDialog, OnOkClicked));

        // initialize the field controls
        resetFields();
        m_pFieldScroller->SetThumbPos(0);
        m_xFieldScroller->vadjustment_set_value(0);
        m_pImpl->nFieldScrollPos = -1;
        implScrollFields(0, false, false);

@@ -630,28 +625,17 @@ void AssignmentPersistentData::ImplCommit()
        for (sal_Int32 i = 0; i<nAdjustedTokenCount; ++i)
            m_pImpl->aLogicalFieldNames.push_back(sLogicalFieldNames.getToken(0, ';', nIdx));

        PostUserEvent(LINK(this, AddressBookSourceDialog, OnDelayedInitialize), nullptr, true);
            // so the dialog will at least show up before we do the loading of the
            // configuration data and the (maybe time consuming) analysis of the data source/table to select
        Application::PostUserEvent(LINK(this, AddressBookSourceDialog, OnDelayedInitialize), nullptr, false);

        if ( m_pImpl->bWorkingPersistent )
        // so the dialog will at least show up before we do the loading of the
        // configuration data and the (maybe time consuming) analysis of the data source/table to select

        if (m_pImpl->bWorkingPersistent)
            return;

        StyleSettings aSystemStyle = GetSettings().GetStyleSettings();
        const ::Color& rNewColor = aSystemStyle.GetDialogColor();

        m_pDatasource->SetReadOnly();
        m_pDatasource->SetBackground( Wallpaper( rNewColor ) );
        m_pDatasource->SetControlBackground( rNewColor );

        m_pTable->SetReadOnly();
        m_pTable->SetBackground( Wallpaper( rNewColor ) );
        m_pTable->SetControlBackground( rNewColor );

        m_pAdministrateDatasources->Hide( );
        m_xAdministrateDatasources->hide();
    }


    void AddressBookSourceDialog::getFieldMapping(Sequence< AliasProgrammaticPair >& _rMapping) const
    {
        _rMapping.realloc( m_pImpl->aLogicalFieldNames.size() );
@@ -671,7 +655,6 @@ void AssignmentPersistentData::ImplCommit()
        _rMapping.realloc( pPair - _rMapping.getArray() );
    }


    void AddressBookSourceDialog::loadConfiguration()
    {
        OUString sName = m_pImpl->pConfigData->getDatasourceName();
@@ -682,8 +665,8 @@ void AssignmentPersistentData::ImplCommit()
            sName = aFileNotation.get(OFileNotation::N_SYSTEM);
        }

        m_pDatasource->SetText(sName);
        m_pTable->SetText(m_pImpl->pConfigData->getCommand());
        m_xDatasource->set_entry_text(sName);
        m_xTable->set_entry_text(m_pImpl->pConfigData->getCommand());
        // we ignore the CommandType: only tables are supported

        // the logical names for the fields
@@ -698,23 +681,10 @@ void AssignmentPersistentData::ImplCommit()
        }
    }


    AddressBookSourceDialog::~AddressBookSourceDialog()
    {
        disposeOnce();
    }

    void AddressBookSourceDialog::dispose()
    {
        m_pImpl.reset();
        m_pDatasource.clear();
        m_pAdministrateDatasources.clear();
        m_pTable.clear();
        m_pFieldScroller.clear();
        ModalDialog::dispose();
    }


    void AddressBookSourceDialog::initializeDatasources()
    {
        if (!m_xDatabaseContext.is())
@@ -731,11 +701,11 @@ void AssignmentPersistentData::ImplCommit()
            if (!m_xDatabaseContext.is())
            {
                const OUString sContextServiceName("com.sun.star.sdb.DatabaseContext");
                ShowServiceNotAvailableError(GetFrameWeld(), sContextServiceName, false);
                ShowServiceNotAvailableError(m_xDialog.get(), sContextServiceName, false);
                return;
            }
        }
        m_pDatasource->Clear();
        m_xDatasource->clear();

        // fill the datasources listbox
        Sequence< OUString > aDatasourceNames;
@@ -750,46 +720,44 @@ void AssignmentPersistentData::ImplCommit()
        const OUString* pDatasourceNames = aDatasourceNames.getConstArray();
        const OUString* pEnd = pDatasourceNames + aDatasourceNames.getLength();
        for (; pDatasourceNames < pEnd; ++pDatasourceNames)
            m_pDatasource->InsertEntry(*pDatasourceNames);
            m_xDatasource->append_text(*pDatasourceNames);
    }


    IMPL_LINK(AddressBookSourceDialog, OnFieldScroll, ScrollBar*, _pScrollBar, void)
    IMPL_LINK(AddressBookSourceDialog, OnFieldScroll, weld::ScrolledWindow&, rScrollBar, void)
    {
        implScrollFields( _pScrollBar->GetThumbPos(), true, true );
        implScrollFields(rScrollBar.vadjustment_get_value(), true, true);
    }


    void AddressBookSourceDialog::resetTables()
    {
        if (!m_xDatabaseContext.is())
            return;

        WaitObject aWaitCursor(this);
        weld::WaitObject aWaitCursor(m_xDialog.get());

        // no matter what we do here, we handled the currently selected data source (no matter if successful or not)
        m_pDatasource->SaveValue();
        m_xDatasource->save_value();

        // create an interaction handler (may be needed for connecting)
        Reference< XInteractionHandler > xHandler;
        try
        {
            xHandler.set(
                InteractionHandler::createWithParent(m_xORB, VCLUnoHelper::GetInterface(this)),
                InteractionHandler::createWithParent(m_xORB, m_xDialog->GetXWindow()),
                UNO_QUERY_THROW );
        }
        catch(const Exception&) { }
        if (!xHandler.is())
        {
            const OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler");
            ShowServiceNotAvailableError(GetFrameWeld(), sInteractionHandlerServiceName, true);
            ShowServiceNotAvailableError(m_xDialog.get(), sInteractionHandlerServiceName, true);
            return;
        }

        // the currently selected table
        OUString sOldTable = m_pTable->GetText();
        OUString sOldTable = m_xTable->get_active_text();

        m_pTable->Clear();
        m_xTable->clear();

        m_xCurrentDatasourceTables= nullptr;

@@ -801,7 +769,7 @@ void AssignmentPersistentData::ImplCommit()
            Reference< XCompletedConnection > xDS;
            if ( m_pImpl->bWorkingPersistent )
            {
                OUString sSelectedDS = lcl_getSelectedDataSource(*m_pDatasource);
                OUString sSelectedDS = lcl_getSelectedDataSource(*m_xDatasource);

                // get the data source the user has chosen and let it build a connection
                INetURLObject aURL( sSelectedDS );
@@ -852,7 +820,7 @@ void AssignmentPersistentData::ImplCommit()
        const OUString* pEnd = pTableNames + aTableNames.getLength();
        for (;pTableNames != pEnd; ++pTableNames)
        {
            m_pTable->InsertEntry(*pTableNames);
            m_xTable->append_text(*pTableNames);
            if (*pTableNames == sOldTable)
                bKnowOldTable = true;
        }
@@ -860,20 +828,19 @@ void AssignmentPersistentData::ImplCommit()
        // set the old table, if the new data source knows a table with this name, too. Else reset the tables edit field.
        if (!bKnowOldTable)
            sOldTable.clear();
        m_pTable->SetText(sOldTable);
        m_xTable->set_entry_text(sOldTable);

        resetFields();
    }


    void AddressBookSourceDialog::resetFields()
    {
        WaitObject aWaitCursor(this);
        weld::WaitObject aWaitCursor(m_xDialog.get());

        // no matter what we do here, we handled the currently selected table (no matter if successful or not)
        m_pDatasource->SaveValue();
        m_xDatasource->save_value();

        OUString sSelectedTable = m_pTable->GetText();
        OUString sSelectedTable = m_xTable->get_active_text();
        Sequence< OUString > aColumnNames;
        try
        {
@@ -911,31 +878,31 @@ void AssignmentPersistentData::ImplCommit()
        OUString sSaveSelection;
        for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++aInitialSelection)
        {
            VclPtr<ListBox>& pListbox = m_pImpl->pFields[i];
            sSaveSelection = pListbox->GetSelectedEntry();
            weld::ComboBox* pListbox = m_pImpl->pFields[i].get();
            sSaveSelection = pListbox->get_active_text();

            pListbox->Clear();
            pListbox->clear();

            // the one entry for "no selection"
            pListbox->InsertEntry(m_sNoFieldSelection, 0);
            pListbox->append_text(m_sNoFieldSelection);
            // as it's entry data, set the index of the list box in our array
            pListbox->SetEntryData(0, reinterpret_cast<void*>(i));
            pListbox->set_id(0, OUString::number(i));

            // the field names
            for (pColumnNames = aColumnNames.getConstArray(); pColumnNames != pEnd; ++pColumnNames)
                pListbox->InsertEntry(*pColumnNames);
                pListbox->append_text(*pColumnNames);

            if (!aInitialSelection->isEmpty() && (aColumnNameSet.end() != aColumnNameSet.find(*aInitialSelection)))
                // we can select the entry as specified in our field assignment array
                pListbox->SelectEntry(*aInitialSelection);
                pListbox->set_active_text(*aInitialSelection);
            else
                // try to restore the selection
                if (aColumnNameSet.end() != aColumnNameSet.find(sSaveSelection))
                    // the old selection is a valid column name
                    pListbox->SelectEntry(sSaveSelection);
                    pListbox->set_active_text(sSaveSelection);
                else
                    // select the <none> entry
                    pListbox->SelectEntryPos(0);
                    pListbox->set_active(0);
        }

        // adjust m_pImpl->aFieldAssignments
@@ -945,21 +912,20 @@ void AssignmentPersistentData::ImplCommit()
                    fieldAssignment.clear();
    }


    IMPL_LINK(AddressBookSourceDialog, OnFieldSelect, ListBox&, _rListbox, void)
    IMPL_LINK(AddressBookSourceDialog, OnFieldSelect, weld::ComboBox&, rListbox, void)
    {
        // the index of the affected list box in our array
        sal_IntPtr nListBoxIndex = reinterpret_cast<sal_IntPtr>(_rListbox.GetEntryData(0));
        sal_Int32 nListBoxIndex = rListbox.get_id(0).toInt32();
        DBG_ASSERT(nListBoxIndex >= 0 && nListBoxIndex < FIELD_CONTROLS_VISIBLE,
            "AddressBookSourceDialog::OnFieldScroll: invalid list box entry!");

        // update the array where we remember the field selections
        if (0 == _rListbox.GetSelectedEntryPos())
        if (0 == rListbox.get_active())
            // it's the "no field selection" entry
            m_pImpl->aFieldAssignments[m_pImpl->nFieldScrollPos * 2 + nListBoxIndex].clear();
        else
            // it's a regular field entry
            m_pImpl->aFieldAssignments[m_pImpl->nFieldScrollPos * 2 + nListBoxIndex] = _rListbox.GetSelectedEntry();
            m_pImpl->aFieldAssignments[m_pImpl->nFieldScrollPos * 2 + nListBoxIndex] = rListbox.get_active_text();
    }


@@ -992,20 +958,20 @@ void AssignmentPersistentData::ImplCommit()
        // loop
        for (sal_Int32 i=0; i<FIELD_PAIRS_VISIBLE; ++i)
        {
            if ((*pLeftListControl)->HasChildPathFocus())
            if ((*pLeftListControl)->has_focus())
            {
                nOldFocusRow = i;
                nOldFocusColumn = 0;
            }
            else if ((*pRightListControl)->HasChildPathFocus())
            else if ((*pRightListControl)->has_focus())
            {
                nOldFocusRow = i;
                nOldFocusColumn = 1;
            }

            // the new texts of the label controls
            (*pLeftLabelControl)->SetText(*pLeftColumnLabel);
            (*pRightLabelControl)->SetText(*pRightColumnLabel);
            (*pLeftLabelControl)->set_label(*pLeftColumnLabel);
            (*pRightLabelControl)->set_label(*pRightColumnLabel);

            // we may have to hide the controls in the right column, if we have no label text for it
            // (which means we have an odd number of fields, though we forced our internal arrays to
@@ -1014,11 +980,11 @@ void AssignmentPersistentData::ImplCommit()
            // an invisible left hand side column, too. But right now, the left hand side controls are always
            // visible)
            bool bHideRightColumn = pRightColumnLabel->isEmpty();
            (*pRightLabelControl)->Show(!bHideRightColumn);
            (*pRightListControl)->Show(!bHideRightColumn);
            (*pRightLabelControl)->show(!bHideRightColumn);
            (*pRightListControl)->show(!bHideRightColumn);
            // the new selections of the listboxes
            implSelectField(*pLeftListControl, *pLeftAssignment);
            implSelectField(*pRightListControl, *pRightAssignment);
            implSelectField(pLeftListControl->get(), *pLeftAssignment);
            implSelectField(pRightListControl->get(), *pRightAssignment);

            // the index of the last visible list box
            ++m_pImpl->nLastVisibleListIndex;   // the left hand side box is always visible
@@ -1050,27 +1016,25 @@ void AssignmentPersistentData::ImplCommit()
            nNewFocusRow = std::min(nNewFocusRow, sal_Int32(FIELD_PAIRS_VISIBLE - 1), ::std::less< sal_Int32 >());
            nNewFocusRow = std::max(nNewFocusRow, sal_Int32(0), ::std::less< sal_Int32 >());
            // set the new focus (in the same column)
            m_pImpl->pFields[nNewFocusRow * 2 + nOldFocusColumn]->GrabFocus();
            m_pImpl->pFields[nNewFocusRow * 2 + nOldFocusColumn]->grab_focus();
        }

        m_pImpl->nFieldScrollPos = _nPos;

        if (_bAdjustScrollbar)
            m_pFieldScroller->SetThumbPos(m_pImpl->nFieldScrollPos);
            m_xFieldScroller->vadjustment_set_value(m_pImpl->nFieldScrollPos);
    }


    void AddressBookSourceDialog::implSelectField(ListBox* _pBox, const OUString& _rText)
    void AddressBookSourceDialog::implSelectField(weld::ComboBox* pBox, const OUString& rText)
    {
        if (!_rText.isEmpty())
        if (!rText.isEmpty())
            // a valid field name
            _pBox->SelectEntry(_rText);
            pBox->set_active_text(rText);
        else
            // no selection for this item
            _pBox->SelectEntryPos(0);
            pBox->set_active(0);
    }


    IMPL_LINK_NOARG(AddressBookSourceDialog, OnDelayedInitialize, void*, void)
    {
        // load the initial data from the configuration
@@ -1080,46 +1044,41 @@ void AssignmentPersistentData::ImplCommit()

        if ( !m_pImpl->bWorkingPersistent )
            if ( m_pImpl->pFields[0] )
                m_pImpl->pFields[0]->GrabFocus();
                m_pImpl->pFields[0]->grab_focus();
    }


    IMPL_LINK(AddressBookSourceDialog, OnComboSelect, ComboBox&, _rBox, void)
    IMPL_LINK(AddressBookSourceDialog, OnComboSelect, weld::ComboBox&, rBox, void)
    {
        if (&_rBox == m_pDatasource)
        if (&rBox == m_xDatasource.get())
            resetTables();
        else
            resetFields();
    }


    IMPL_STATIC_LINK(
        AddressBookSourceDialog, OnComboGetFocus, Control&, _rBox, void)
    IMPL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget&, rBox, void)
    {
        static_cast<ComboBox&>(_rBox).SaveValue();
        dynamic_cast<weld::ComboBox&>(rBox).save_value();
    }


    IMPL_LINK(AddressBookSourceDialog, OnComboLoseFocus, Control&, rControl, void)
    IMPL_LINK(AddressBookSourceDialog, OnComboLoseFocus, weld::Widget&, rControl, void)
    {
        ComboBox* _pBox = static_cast<ComboBox*>(&rControl);
        if ( _pBox->IsValueChangedFromSaved() )
        weld::ComboBox& rBox = dynamic_cast<weld::ComboBox&>(rControl);
        if (rBox.get_value_changed_from_saved())
        {
            if (_pBox == m_pDatasource)
            if (&rBox == m_xDatasource.get())
                resetTables();
            else
                resetFields();
        }
    }


    IMPL_LINK_NOARG(AddressBookSourceDialog, OnOkClicked, Button*, void)
    IMPL_LINK_NOARG(AddressBookSourceDialog, OnOkClicked, weld::Button&, void)
    {
        OUString sSelectedDS = lcl_getSelectedDataSource(*m_pDatasource);
        OUString sSelectedDS = lcl_getSelectedDataSource(*m_xDatasource);
        if ( m_pImpl->bWorkingPersistent )
        {
            m_pImpl->pConfigData->setDatasourceName(sSelectedDS);
            m_pImpl->pConfigData->setCommand(m_pTable->GetText());
            m_pImpl->pConfigData->setCommand(m_xTable->get_active_text());
        }

        // AddressBookSourceDialog::loadConfiguration: inconsistence between field names and field assignments!
@@ -1133,23 +1092,21 @@ void AssignmentPersistentData::ImplCommit()
            ++aAssignment;
        }


        EndDialog(RET_OK);
        m_xDialog->response(RET_OK);
    }


    IMPL_LINK_NOARG(AddressBookSourceDialog, OnAdministrateDatasources, Button*, void)
    IMPL_LINK_NOARG(AddressBookSourceDialog, OnAdministrateDatasources, weld::Button&, void)
    {
        // create the dialog object
        Reference< XExecutableDialog > xAdminDialog;
        try
        {
            xAdminDialog = AddressBookSourcePilot::createWithParent( m_xORB, VCLUnoHelper::GetInterface(this) );
            xAdminDialog = AddressBookSourcePilot::createWithParent(m_xORB, m_xDialog->GetXWindow());
        }
        catch(const Exception&) { }
        if (!xAdminDialog.is())
        {
            ShowServiceNotAvailableError(GetFrameWeld(), "com.sun.star.ui.dialogs.AddressBookSourcePilot", true);
            ShowServiceNotAvailableError(m_xDialog.get(), "com.sun.star.ui.dialogs.AddressBookSourcePilot", true);
            return;
        }

@@ -1170,7 +1127,7 @@ void AssignmentPersistentData::ImplCommit()
                        OFileNotation aFileNotation( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
                        sName = aFileNotation.get(OFileNotation::N_SYSTEM);
                    }
                    m_pDatasource->InsertEntry(sName);
                    m_xDatasource->append_text(sName);
                    m_pImpl->pConfigData.reset( new AssignmentPersistentData );
                    loadConfiguration();
                    resetTables();
@@ -1189,53 +1146,6 @@ void AssignmentPersistentData::ImplCommit()
//      initializeDatasources();
    }

    bool AddressBookSourceDialog::PreNotify( NotifyEvent& _rNEvt )
    {
        if (_rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
        {
            const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
            sal_uInt16 nCode  = pKeyEvent->GetKeyCode().GetCode();
            bool   bShift = pKeyEvent->GetKeyCode().IsShift();
            bool   bCtrl  = pKeyEvent->GetKeyCode().IsMod1();
            bool   bAlt =   pKeyEvent->GetKeyCode().IsMod2();

            if (KEY_TAB == nCode)
            {   // somebody pressed the tab key
                if (!bAlt && !bCtrl && !bShift)
                {   // it's really the only the key (no modifiers)
                    if (m_pImpl->pFields[m_pImpl->nLastVisibleListIndex]->HasChildPathFocus())
                        // the last of our visible list boxes has the focus
                        if (m_pImpl->nFieldScrollPos < m_pFieldScroller->GetRangeMax())
                        {   // we can still scroll down
                            sal_Int32 nNextFocusList = m_pImpl->nLastVisibleListIndex + 1 - 2;
                            // -> scroll down
                            implScrollFields(m_pImpl->nFieldScrollPos + 1, false, true);
                            // give the left control in the "next" line the focus
                            m_pImpl->pFields[nNextFocusList]->GrabFocus();
                            // return saying "have handled this"
                            return true;
                        }
                }
                else if (!bAlt && !bCtrl && bShift)
                {   // it's shift-tab
                    if (m_pImpl->pFields[0]->HasChildPathFocus())
                        // our first list box has the focus
                        if (m_pImpl->nFieldScrollPos > 0)
                        {   // we can still scroll up
                            // -> scroll up
                            implScrollFields(m_pImpl->nFieldScrollPos - 1, false, true);
                            // give the right control in the "previous" line the focus
                            m_pImpl->pFields[0 - 1 + 2]->GrabFocus();
                            // return saying "have handled this"
                            return true;
                        }
                }
            }
        }

        return ModalDialog::PreNotify(_rNEvt);
    }

}   // namespace svt


diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx
index 27afba0..c6086c1 100644
--- a/svtools/source/uno/addrtempuno.cxx
+++ b/svtools/source/uno/addrtempuno.cxx
@@ -26,7 +26,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/util/AliasProgrammaticPair.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
#include <rtl/ref.hxx>

using namespace svt;
@@ -114,13 +114,11 @@ namespace {
        return xInfo;
    }


    ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper()
    {
        return *getArrayHelper();
    }


    ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const
    {
        Sequence< Property > aProps;
@@ -128,13 +126,12 @@ namespace {
        return new ::cppu::OPropertyArrayHelper(aProps);
    }


    void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult)
    {
        OGenericUnoDialog::executedDialog(_nExecutionResult);

        if ( _nExecutionResult && m_aDialog )
            static_cast< AddressBookSourceDialog* >( m_aDialog.m_xVclDialog.get() )->getFieldMapping( m_aAliases );
            static_cast<AddressBookSourceDialog*>(m_aDialog.m_xWeldDialog.get())->getFieldMapping(m_aAliases);
    }

    void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments)
@@ -199,16 +196,14 @@ namespace {
        OGenericUnoDialog::implInitialize( _rValue );
    }


    svt::OGenericUnoDialog::Dialog OAddressBookSourceDialogUno::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
    {
        auto _pParent = VCLUnoHelper::GetWindow(rParent);
        weld::Window* pParent = Application::GetFrameWeld(rParent);
        if ( m_xDataSource.is() && !m_sTable.isEmpty() )
            return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases));
            return svt::OGenericUnoDialog::Dialog(std::make_unique<AddressBookSourceDialog>(pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases));
        else
            return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext));
            return svt::OGenericUnoDialog::Dialog(std::make_unique<AddressBookSourceDialog>(pParent, m_aContext));
    }

}

extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/svtools/uiconfig/ui/addresstemplatedialog.ui b/svtools/uiconfig/ui/addresstemplatedialog.ui
index 0d5b218..5c14090 100644
--- a/svtools/uiconfig/ui/addresstemplatedialog.ui
+++ b/svtools/uiconfig/ui/addresstemplatedialog.ui
@@ -1,13 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="svt">
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkDialog" id="AddressTemplateDialog">
    <property name="can_focus">False</property>
    <property name="resizable">False</property>
    <property name="border_width">6</property>
    <property name="title" translatable="yes" context="addresstemplatedialog|AddressTemplateDialog">Templates: Address Book Assignment</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>
      <placeholder/>
    </child>
    <child internal-child="vbox">
      <object class="GtkBox" id="dialog-vbox1">
        <property name="can_focus">False</property>
@@ -100,10 +106,10 @@
                          <object class="GtkLabel" id="label33">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="xalign">1</property>
                            <property name="label" translatable="yes" context="addresstemplatedialog|label33">Data source:</property>
                            <property name="use_underline">True</property>
                            <property name="mnemonic_widget">datasource</property>
                            <property name="xalign">1</property>
                          </object>
                          <packing>
                            <property name="left_attach">0</property>
@@ -114,10 +120,10 @@
                          <object class="GtkLabel" id="label43">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="xalign">1</property>
                            <property name="label" translatable="yes" context="addresstemplatedialog|label43">Table:</property>
                            <property name="use_underline">True</property>
                            <property name="mnemonic_widget">datatable</property>
                            <property name="xalign">1</property>
                          </object>
                          <packing>
                            <property name="left_attach">0</property>
@@ -132,7 +138,8 @@
                            <property name="has_entry">True</property>
                            <child internal-child="entry">
                              <object class="GtkEntry" id="comboboxtext-entry">
                                <property name="can_focus">False</property>
                                <property name="can_focus">True</property>
                                <property name="activates_default">True</property>
                              </object>
                            </child>
                          </object>
@@ -149,7 +156,8 @@
                            <property name="has_entry">True</property>
                            <child internal-child="entry">
                              <object class="GtkEntry" id="comboboxtext-entry1">
                                <property name="can_focus">False</property>
                                <property name="can_focus">True</property>
                                <property name="activates_default">True</property>
                              </object>
                            </child>
                          </object>
@@ -214,6 +222,7 @@
                        <property name="can_focus">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <property name="hscrollbar_policy">never</property>
                        <property name="vscrollbar_policy">always</property>
                        <property name="shadow_type">in</property>
                        <child>
@@ -221,28 +230,150 @@
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <child>
                              <object class="GtkGrid" id="grid4">
                              <object class="GtkGrid" id="grid">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
                                <property name="column_spacing">18</property>
                                <property name="column_homogeneous">True</property>
                                <child>
                                  <object class="GtkGrid" id="grid5">
                                  <object class="GtkGrid">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="hexpand">True</property>
                                    <property name="vexpand">True</property>
                                    <property name="row_spacing">6</property>
                                    <property name="column_spacing">12</property>
                                    <property name="border_width">6</property>
                                    <property name="column_spacing">18</property>
                                    <property name="column_homogeneous">True</property>
                                    <child>
                                      <object class="GtkLabel" id="label0">
                                      <object class="GtkGrid" id="grid5">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box0</property>
                                        <property name="hexpand">True</property>
                                        <property name="vexpand">True</property>
                                        <property name="row_spacing">6</property>
                                        <property name="column_spacing">12</property>
                                        <child>
                                          <object class="GtkLabel" id="label0">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box0</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box0">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label2">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box2</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label4">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box4</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">2</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label6">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box6</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">3</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label8">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box8</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">4</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box2">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box4">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">2</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box6">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">3</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box8">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">4</property>
                                          </packing>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
@@ -250,261 +381,150 @@
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box0">
                                      <object class="GtkGrid" id="grid6">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                        <property name="vexpand">True</property>
                                        <property name="row_spacing">6</property>
                                        <property name="column_spacing">12</property>
                                        <child>
                                          <object class="GtkLabel" id="label1">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box1</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box1">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">0</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label3">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box3</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label5">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box5</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">2</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label7">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box7</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">3</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkLabel" id="label9">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="label">label</property>
                                            <property name="use_underline">True</property>
                                            <property name="mnemonic_widget">box9</property>
                                            <property name="xalign">1</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">0</property>
                                            <property name="top_attach">4</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box3">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">1</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box5">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">2</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box7">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">3</property>
                                          </packing>
                                        </child>
                                        <child>
                                          <object class="GtkComboBoxText" id="box9">
                                            <property name="visible">True</property>
                                            <property name="can_focus">False</property>
                                            <property name="hexpand">True</property>
                                          </object>
                                          <packing>
                                            <property name="left_attach">1</property>
                                            <property name="top_attach">4</property>
                                          </packing>
                                        </child>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label2">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box2</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">1</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label4">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box4</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">2</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label6">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box6</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">3</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label8">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box8</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">4</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box2">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">1</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box4">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">2</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box6">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">3</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box8">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">4</property>
                                      </packing>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">0</property>
                                    <property name="top_attach">0</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkGrid" id="grid6">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="hexpand">True</property>
                                    <property name="vexpand">True</property>
                                    <property name="row_spacing">6</property>
                                    <property name="column_spacing">12</property>
                                    <child>
                                      <object class="GtkLabel" id="label1">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box1</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box1">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">0</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label3">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box3</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">1</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label5">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box5</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">2</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label7">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box7</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">3</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkLabel" id="label9">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="xalign">1</property>
                                        <property name="label" translatable="no">label</property>
                                        <property name="use_underline">True</property>
                                        <property name="mnemonic_widget">box9</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">0</property>
                                        <property name="top_attach">4</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box3">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">1</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box5">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">2</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box7">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">3</property>
                                      </packing>
                                    </child>
                                    <child>
                                      <object class="GtkComboBoxText" id="box9">
                                        <property name="visible">True</property>
                                        <property name="can_focus">False</property>
                                        <property name="hexpand">True</property>
                                      </object>
                                      <packing>
                                        <property name="left_attach">1</property>
                                        <property name="top_attach">4</property>
                                      </packing>
                                    </child>
                                  </object>
                                  <packing>
                                    <property name="left_attach">1</property>
                                    <property name="top_attach">0</property>
                                  </packing>
                                </child>
                              </object>
                            </child>
                          </object>