weld fpicker cluster

Change-Id: I6566263809ff0032388a0b56571f0cf7428058d7
Reviewed-on: https://gerrit.libreoffice.org/81334
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 2673658..c263369 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -228,8 +228,8 @@

    m_xBasicsBox->connect_changed( LINK( this, LibPage, BasicSelectHdl ) );

    m_xLibBox->connect_editing_started( LINK( this, LibPage, EditingEntryHdl ) );
    m_xLibBox->connect_editing_done( LINK( this, LibPage, EditedEntryHdl ) );
    m_xLibBox->connect_editing(LINK(this, LibPage, EditingEntryHdl),
                               LINK(this, LibPage, EditedEntryHdl));

    FillListBox();
    m_xBasicsBox->set_active(0);
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index fb1d72e..0812647 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -557,8 +557,8 @@

    m_xDropTarget.reset(new SbTreeListBoxDropTarget(*m_xBasicBox));

    m_xBasicBox->connect_editing_started( LINK( this, ObjectPage, EditingEntryHdl ) );
    m_xBasicBox->connect_editing_done( LINK( this, ObjectPage, EditedEntryHdl ) );
    m_xBasicBox->connect_editing(LINK(this, ObjectPage, EditingEntryHdl),
                                 LINK(this, ObjectPage, EditedEntryHdl));

    m_xBasicBox->SetMode( nMode );
    m_xBasicBox->ScanAllEntries();
diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx
index 88c303e..d6abc44 100644
--- a/basctl/source/inc/bastype2.hxx
+++ b/basctl/source/inc/bastype2.hxx
@@ -320,13 +320,10 @@
    float get_approximate_digit_width() const { return m_xControl->get_approximate_digit_width(); }
    int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
    int get_iter_index_in_parent(const weld::TreeIter& rIter) const { return m_xControl->get_iter_index_in_parent(rIter); }
    void connect_editing_started(const Link<const weld::TreeIter&, bool>& rLink)
    void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
                         const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rEndLink)
    {
        m_xControl->connect_editing_started(rLink);
    }
    void connect_editing_done(const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rLink)
    {
        m_xControl->connect_editing_done(rLink);
        m_xControl->connect_editing(rStartLink, rEndLink);
    }

    void make_sorted() { m_xControl->make_sorted(); };
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 1df6422..a5c572e 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -137,7 +137,7 @@
        }

        // Separate the "All commands"category from the actual categories
        m_xControl->append_separator();
        m_xControl->append_separator("");

        typedef std::pair<OUString, sal_Int16> str_id;
        std::vector<str_id> aCategories;
@@ -180,7 +180,7 @@
        }

        // Separate regular commands from styles and macros
        m_xControl->append_separator();
        m_xControl->append_separator("");

        // Add macros category
        m_aGroupInfo.push_back(
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 3c03979..3079b2c 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -667,7 +667,7 @@
    m_xIconStyleLB->append_text(entryForAuto);

    // separate auto and other icon themes
    m_xIconStyleLB->append_separator();
    m_xIconStyleLB->append_separator("");

    for (auto const& installIconTheme : mInstalledIconThemes)
        m_xIconStyleLB->append_text(installIconTheme.GetDisplayName());
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 072c507..a4e75d1 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -98,8 +98,8 @@
        m_xActions->connect_clicked(LINK(this, DbaIndexDialog, OnIndexAction));

        m_xIndexList->connect_changed(LINK(this, DbaIndexDialog, OnIndexSelected));
        m_xIndexList->connect_editing_started(LINK(this, DbaIndexDialog, OnEntryEditing));
        m_xIndexList->connect_editing_done(LINK(this, DbaIndexDialog, OnEntryEdited));
        m_xIndexList->connect_editing(LINK(this, DbaIndexDialog, OnEntryEditing),
                                      LINK(this, DbaIndexDialog, OnEntryEdited));

        m_xFields->SetSizePixel(Size(nWidth, 100));
        m_xFields->Init(_rFieldNames, ::dbtools::getBooleanDataSourceSetting( m_xConnection, "AddIndexAppendix" ));
diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk
index eff3f5e..3aec0b6 100644
--- a/fpicker/Library_fps_office.mk
+++ b/fpicker/Library_fps_office.mk
@@ -52,8 +52,6 @@
	fpicker/source/office/fpinteraction \
	fpicker/source/office/fpsmartcontent \
	fpicker/source/office/fps_office \
	fpicker/source/office/iconview \
	fpicker/source/office/iconviewimpl \
	fpicker/source/office/iodlg \
	fpicker/source/office/iodlgimp \
	fpicker/source/office/OfficeControlAccess \
diff --git a/fpicker/UIConfig_fps.mk b/fpicker/UIConfig_fps.mk
index ee8fea5..2c179b2 100644
--- a/fpicker/UIConfig_fps.mk
+++ b/fpicker/UIConfig_fps.mk
@@ -10,6 +10,7 @@
$(eval $(call gb_UIConfig_UIConfig,fps))

$(eval $(call gb_UIConfig_add_uifiles,fps,\
	fpicker/uiconfig/ui/breadcrumb \
	fpicker/uiconfig/ui/explorerfiledialog \
	fpicker/uiconfig/ui/foldernamedialog \
	fpicker/uiconfig/ui/remotefilesdialog \
diff --git a/fpicker/inc/bitmaps.hlst b/fpicker/inc/bitmaps.hlst
index 8780581..4951ead 100644
--- a/fpicker/inc/bitmaps.hlst
+++ b/fpicker/inc/bitmaps.hlst
@@ -11,8 +11,6 @@
#define INCLUDED_FPICKER_INC_BITMAPS_HRC

#define RID_BMP_FOLDER_OPEN         "res/folderop.png"
#define BMP_FILEDLG_BTN_UP          "res/fp010.png"
#define BMP_FILEDLG_CREATEFOLDER    "fpicker/res/fp014.png"
#define BMP_FILEDLG_PLACE_LOCAL     "fpicker/res/fp015.png"
#define BMP_FILEDLG_PLACE_REMOTE    "fpicker/res/fp016.png"
#define RID_BMP_FOLDER              "svtools/res/folder.png"
diff --git a/fpicker/inc/strings.hrc b/fpicker/inc/strings.hrc
index 05acac0..b175069 100644
--- a/fpicker/inc/strings.hrc
+++ b/fpicker/inc/strings.hrc
@@ -30,7 +30,6 @@
#define STR_BUTTONSELECT                            NC_("STR_BUTTONSELECT", "~Select")
#define STR_PREVIEW                                 NC_("STR_PREVIEW", "File Preview")
#define STR_DEFAULT_DIRECTORY                       NC_("STR_DEFAULT_DIRECTORY", "My Documents")
#define STR_PLACES_TITLE                            NC_("STR_PLACES_TITLE", "Places")
#define RID_FILEOPEN_NOTEXISTENTFILE                NC_("RID_FILEOPEN_NOTEXISTENTFILE", "The file $name$ does not exist.\nMake sure you have entered the correct file name.")
#define STR_SVT_NEW_FOLDER                          NC_("STR_SVT_NEW_FOLDER", "Folder")
#define STR_SVT_NOREMOVABLEDEVICE                   NC_("STR_SVT_NOREMOVABLEDEVICE", "No removable storage device detected.\nMake sure it is plugged in properly and try again.")
diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx
index 073d026..2568398 100644
--- a/fpicker/source/office/OfficeControlAccess.cxx
+++ b/fpicker/source/office/OfficeControlAccess.cxx
@@ -101,22 +101,19 @@
            { "VersionListLabel",       LISTBOX_VERSION_LABEL,          PROPERTY_FLAGS_COMMON | PropFlags::Text          }
        };


        static const sal_Int32 s_nControlCount = SAL_N_ELEMENTS( aDescriptions );

        static ControlDescIterator s_pControls = aDescriptions;
        static ControlDescIterator s_pControlsEnd = aDescriptions + s_nControlCount;


        struct ControlDescriptionLookup
        {
            bool operator()( const ControlDescription& _rDesc1, const ControlDescription& _rDesc2 )
            bool operator()( const ControlDescription& rDesc1, const ControlDescription& rDesc2 )
            {
                return strcmp(_rDesc1.pControlName, _rDesc2.pControlName) < 0;
                return strcmp(rDesc1.pControlName, rDesc2.pControlName) < 0;
            }
        };


        struct ControlProperty
        {
            const sal_Char* pPropertyName;
@@ -125,7 +122,6 @@

        typedef const ControlProperty* ControlPropertyIterator;


        static const ControlProperty aProperties[] =  {
            { "Text",               PropFlags::Text              },
            { "Enabled",            PropFlags::Enabled          },
@@ -137,7 +133,6 @@
            { "Checked",            PropFlags::Checked           }
        };


        static const int s_nPropertyCount = SAL_N_ELEMENTS( aProperties );

        static ControlPropertyIterator s_pProperties = aProperties;
@@ -166,38 +161,48 @@
        }
    }


    OControlAccess::OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView )
        :m_pFilePickerController( _pController )
        ,m_pFileView( _pFileView )
    OControlAccess::OControlAccess(IFilePickerController* pController, SvtFileView* pFileView)
        : m_pFilePickerController(pController)
        , m_pFileView(pFileView)
    {
        DBG_ASSERT( m_pFilePickerController, "OControlAccess::OControlAccess: invalid control locator!" );
    }

    bool OControlAccess::IsFileViewWidget(weld::Widget const * pControl) const
    {
        if (!pControl)
            return false;
        if (!m_pFileView)
            return false;
        return pControl == m_pFileView->identifier();
    }

    void OControlAccess::setHelpURL( vcl::Window* _pControl, const OUString& sHelpURL, bool _bFileView )
    void OControlAccess::setHelpURL(weld::Widget* pControl, const OUString& sHelpURL)
    {
        OUString sHelpID( sHelpURL );
        INetURLObject aHID( sHelpURL );
        if ( aHID.GetProtocol() == INetProtocol::Hid )
              sHelpID = aHID.GetURLPath();
        if (aHID.GetProtocol() == INetProtocol::Hid)
            sHelpID = aHID.GetURLPath();

        // URLs should always be UTF8 encoded and escaped
        OString sID( OUStringToOString( sHelpID, RTL_TEXTENCODING_UTF8 ) );
        if ( _bFileView )
        if (IsFileViewWidget(pControl))
        {
            // the file view "overrides" the SetHelpId
            static_cast< SvtFileView* >( _pControl )->SetHelpId( sID );
            m_pFileView->set_help_id(sID);
        }
        else
            _pControl->SetHelpId( sID );
            pControl->set_help_id(sID);
    }


    OUString OControlAccess::getHelpURL( vcl::Window const * _pControl, bool _bFileView )
    OUString OControlAccess::getHelpURL(weld::Widget const * pControl) const
    {
        OString aHelpId = _pControl->GetHelpId();
        if ( _bFileView )
        OString aHelpId = pControl->get_help_id();
        if (IsFileViewWidget(pControl))
        {
            // the file view "overrides" the SetHelpId
            aHelpId = static_cast< SvtFileView const * >( _pControl )->GetHelpId( );
            aHelpId = m_pFileView->get_help_id();
        }

        OUString sHelpURL;
        OUString aTmp( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ) );
@@ -208,17 +213,16 @@
        return sHelpURL;
    }


    Any OControlAccess::getControlProperty( const OUString& _rControlName, const OUString& _rControlProperty )
    Any OControlAccess::getControlProperty( const OUString& rControlName, const OUString& rControlProperty )
    {
        // look up the control
        sal_Int16 nControlId = -1;
        PropFlags nPropertyMask = PropFlags::NONE;
        Control* pControl = implGetControl( _rControlName, &nControlId, &nPropertyMask );
        weld::Widget* pControl = implGetControl( rControlName, &nControlId, &nPropertyMask );
            // will throw an IllegalArgumentException if the name is not valid

        // look up the property
        ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( _rControlProperty ) );
        ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) );
        if ( aPropDesc == s_pPropertiesEnd )
            // it's a completely unknown property
            lcl_throwIllegalArgumentException();
@@ -230,12 +234,11 @@
        return implGetControlProperty( pControl, aPropDesc->nPropertyId );
    }


    Control* OControlAccess::implGetControl( const OUString& _rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const
    weld::Widget* OControlAccess::implGetControl( const OUString& rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const
    {
        Control* pControl = nullptr;
        weld::Widget* pControl = nullptr;
        ControlDescription tmpDesc;
        OString aControlName = OUStringToOString( _rControlName, RTL_TEXTENCODING_UTF8 );
        OString aControlName = OUStringToOString( rControlName, RTL_TEXTENCODING_UTF8 );
        tmpDesc.pControlName = aControlName.getStr();

        // translate the name into an id
@@ -259,24 +262,22 @@
        return pControl;
    }


    void OControlAccess::setControlProperty( const OUString& _rControlName, const OUString& _rControlProperty, const css::uno::Any& _rValue )
    void OControlAccess::setControlProperty( const OUString& rControlName, const OUString& rControlProperty, const css::uno::Any& rValue )
    {
        // look up the control
        sal_Int16 nControlId = -1;
        Control* pControl = implGetControl( _rControlName, &nControlId );
        weld::Widget* pControl = implGetControl( rControlName, &nControlId );
            // will throw an IllegalArgumentException if the name is not valid

        // look up the property
        ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( _rControlProperty ) );
        ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) );
        if ( aPropDesc == s_pPropertiesEnd )
            lcl_throwIllegalArgumentException();

        // set the property
        implSetControlProperty( nControlId, pControl, aPropDesc->nPropertyId, _rValue, false );
        implSetControlProperty( nControlId, pControl, aPropDesc->nPropertyId, rValue, false );
    }


    Sequence< OUString > OControlAccess::getSupportedControls(  ) const
    {
        Sequence< OUString > aControls( s_nControlCount );
@@ -293,12 +294,11 @@
        return aControls;
    }


    Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& _rControlName )
    Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& rControlName )
    {
        sal_Int16 nControlId = -1;
        PropFlags nPropertyMask = PropFlags::NONE;
        implGetControl( _rControlName, &nControlId, &nPropertyMask );
        implGetControl( rControlName, &nControlId, &nPropertyMask );
            // will throw an IllegalArgumentException if the name is not valid

        // fill in the property names
@@ -313,26 +313,24 @@
        return aProps;
    }


    bool OControlAccess::isControlSupported( const OUString& _rControlName )
    bool OControlAccess::isControlSupported( const OUString& rControlName )
    {
        ControlDescription tmpDesc;
        OString aControlName = OUStringToOString(_rControlName, RTL_TEXTENCODING_UTF8);
        OString aControlName = OUStringToOString(rControlName, RTL_TEXTENCODING_UTF8);
        tmpDesc.pControlName = aControlName.getStr();
        return ::std::binary_search( s_pControls, s_pControlsEnd, tmpDesc, ControlDescriptionLookup() );
    }


    bool OControlAccess::isControlPropertySupported( const OUString& _rControlName, const OUString& _rControlProperty )
    bool OControlAccess::isControlPropertySupported( const OUString& rControlName, const OUString& rControlProperty )
    {
        // look up the control
        sal_Int16 nControlId = -1;
        PropFlags nPropertyMask = PropFlags::NONE;
        implGetControl( _rControlName, &nControlId, &nPropertyMask );
        implGetControl( rControlName, &nControlId, &nPropertyMask );
            // will throw an IllegalArgumentException if the name is not valid

        // look up the property
        ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( _rControlProperty ) );
        ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) );
        if ( aPropDesc == s_pPropertiesEnd )
            // it's a property which is completely unknown
            return false;
@@ -340,21 +338,20 @@
        return bool( aPropDesc->nPropertyId & nPropertyMask );
    }


    void OControlAccess::setValue( sal_Int16 _nControlId, sal_Int16 _nControlAction, const Any& _rValue )
    void OControlAccess::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const Any& rValue )
    {
        Control* pControl = m_pFilePickerController->getControl( _nControlId );
        weld::Widget* pControl = m_pFilePickerController->getControl( nControlId );
        DBG_ASSERT( pControl, "OControlAccess::SetValue: don't have this control in the current mode!" );
        if ( pControl )
        {
            PropFlags nPropertyId = PropFlags::Unknown;
            if ( ControlActions::SET_HELP_URL == _nControlAction )
            if ( ControlActions::SET_HELP_URL == nControlAction )
            {
                nPropertyId = PropFlags::HelpUrl;
            }
            else
            {
                switch ( _nControlId )
                switch ( nControlId )
                {
                    case CHECKBOX_AUTOEXTENSION:
                    case CHECKBOX_PASSWORD:
@@ -374,41 +371,41 @@
                    case LISTBOX_TEMPLATE:
                    case LISTBOX_IMAGE_TEMPLATE:
                    case LISTBOX_IMAGE_ANCHOR:
                        if ( ControlActions::SET_SELECT_ITEM == _nControlAction )
                        if ( ControlActions::SET_SELECT_ITEM == nControlAction )
                        {
                            nPropertyId = PropFlags::SelectedItemIndex;
                        }
                        else
                        {
                            DBG_ASSERT( WindowType::LISTBOX == pControl->GetType(), "OControlAccess::SetValue: implGetControl returned nonsense!" );
                            implDoListboxAction( static_cast< ListBox* >( pControl ), _nControlAction, _rValue );
                            weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
                            assert(pComboBox && "OControlAccess::SetValue: implGetControl returned nonsense!");
                            implDoListboxAction(pComboBox, nControlAction, rValue);
                        }
                        break;
                }
            }

            if ( PropFlags::Unknown != nPropertyId )
                implSetControlProperty( _nControlId, pControl, nPropertyId, _rValue );
                implSetControlProperty( nControlId, pControl, nPropertyId, rValue );
        }
    }


    Any OControlAccess::getValue( sal_Int16 _nControlId, sal_Int16 _nControlAction ) const
    Any OControlAccess::getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) const
    {
        Any aRet;

        Control* pControl = m_pFilePickerController->getControl( _nControlId );
        weld::Widget* pControl = m_pFilePickerController->getControl( nControlId );
        DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
        if ( pControl )
        {
            PropFlags nPropertyId = PropFlags::Unknown;
            if ( ControlActions::SET_HELP_URL == _nControlAction )
            if ( ControlActions::SET_HELP_URL == nControlAction )
            {
                nPropertyId = PropFlags::HelpUrl;
            }
            else
            {
                switch ( _nControlId )
                switch ( nControlId )
                {
                    case CHECKBOX_AUTOEXTENSION:
                    case CHECKBOX_PASSWORD:
@@ -422,7 +419,7 @@
                        break;

                    case LISTBOX_FILTER:
                        if ( ControlActions::GET_SELECTED_ITEM == _nControlAction )
                        if ( ControlActions::GET_SELECTED_ITEM == nControlAction )
                        {
                            aRet <<= m_pFilePickerController->getCurFilter();
                        }
@@ -436,7 +433,7 @@
                    case LISTBOX_TEMPLATE:
                    case LISTBOX_IMAGE_TEMPLATE:
                    case LISTBOX_IMAGE_ANCHOR:
                        switch ( _nControlAction )
                        switch ( nControlAction )
                        {
                            case ControlActions::GET_SELECTED_ITEM:
                                nPropertyId = PropFlags::SelectedItem;
@@ -462,57 +459,47 @@
        return aRet;
    }


    void OControlAccess::setLabel( sal_Int16 nId, const OUString &rLabel )
    {
        Control* pControl = m_pFilePickerController->getControl( nId, true );
        DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
        if ( pControl )
            pControl->SetText( rLabel );
        weld::Label* pControl = dynamic_cast<weld::Label*>(m_pFilePickerController->getControl(nId, true));
        assert(pControl && "OControlAccess::GetValue: don't have this control in the current mode!");
        pControl->set_label(rLabel);
    }


    OUString OControlAccess::getLabel( sal_Int16 nId ) const
    {
        OUString sLabel;

        Control* pControl = m_pFilePickerController->getControl( nId, true );
        DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
        if ( pControl )
            sLabel = pControl->GetText();

        return sLabel;
        weld::Label* pControl = dynamic_cast<weld::Label*>(m_pFilePickerController->getControl(nId, true));
        assert(pControl && "OControlAccess::GetValue: don't have this control in the current mode!");
        return pControl->get_label();
    }


    void OControlAccess::enableControl( sal_Int16 _nId, bool _bEnable )
    void OControlAccess::enableControl(sal_Int16 nId, bool bEnable)
    {
        m_pFilePickerController->enableControl( _nId, _bEnable );
        m_pFilePickerController->enableControl(nId, bEnable);
    }


    void OControlAccess::implDoListboxAction( ListBox* _pListbox, sal_Int16 _nControlAction, const Any& _rValue )
    void OControlAccess::implDoListboxAction(weld::ComboBox* pListbox, sal_Int16 nControlAction, const Any& rValue)
    {
        switch ( _nControlAction )
        switch ( nControlAction )
        {
            case ControlActions::ADD_ITEM:
            {
                OUString aEntry;
                _rValue >>= aEntry;
                rValue >>= aEntry;
                if ( !aEntry.isEmpty() )
                    _pListbox->InsertEntry( aEntry );
                    pListbox->append_text( aEntry );
            }
            break;

            case ControlActions::ADD_ITEMS:
            {
                Sequence < OUString > aTemplateList;
                _rValue >>= aTemplateList;
                rValue >>= aTemplateList;

                if ( aTemplateList.hasElements() )
                {
                    for ( long i=0; i < aTemplateList.getLength(); i++ )
                        _pListbox->InsertEntry( aTemplateList[i] );
                        pListbox->append_text( aTemplateList[i] );
                }
            }
            break;
@@ -520,13 +507,13 @@
            case ControlActions::DELETE_ITEM:
            {
                sal_Int32 nPos = 0;
                if ( _rValue >>= nPos )
                    _pListbox->RemoveEntry( nPos );
                if ( rValue >>= nPos )
                    pListbox->remove( nPos );
            }
            break;

            case ControlActions::DELETE_ITEMS:
                _pListbox->Clear();
                pListbox->clear();
                break;

            default:
@@ -534,16 +521,15 @@
        }
    }


    void OControlAccess::implSetControlProperty( sal_Int16 _nControlId, Control* _pControl, PropFlags _nProperty, const Any& _rValue, bool _bIgnoreIllegalArgument )
    void OControlAccess::implSetControlProperty( sal_Int16 nControlId, weld::Widget* pControl, PropFlags _nProperty, const Any& rValue, bool _bIgnoreIllegalArgument )
    {
        if ( !_pControl )
            _pControl = m_pFilePickerController->getControl( _nControlId );
        DBG_ASSERT( _pControl, "OControlAccess::implSetControlProperty: invalid argument, this will crash!" );
        if ( !_pControl )
        if ( !pControl )
            pControl = m_pFilePickerController->getControl( nControlId );
        DBG_ASSERT( pControl, "OControlAccess::implSetControlProperty: invalid argument, this will crash!" );
        if ( !pControl )
            return;

        DBG_ASSERT( _pControl == m_pFilePickerController->getControl( _nControlId ),
        DBG_ASSERT( pControl == m_pFilePickerController->getControl( nControlId ),
            "OControlAccess::implSetControlProperty: inconsistent parameters!" );

        switch ( _nProperty )
@@ -551,9 +537,11 @@
            case PropFlags::Text:
            {
                OUString sText;
                if ( _rValue >>= sText )
                if (rValue >>= sText)
                {
                    _pControl->SetText( sText );
                    weld::Label* pLabel = dynamic_cast<weld::Label*>(pControl);
                    assert(pLabel);
                    pLabel->set_label(sText);
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -565,9 +553,9 @@
            case PropFlags::Enabled:
            {
                bool bEnabled = false;
                if ( _rValue >>= bEnabled )
                if ( rValue >>= bEnabled )
                {
                    m_pFilePickerController->enableControl( _nControlId, bEnabled );
                    m_pFilePickerController->enableControl( nControlId, bEnabled );
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -579,9 +567,9 @@
            case PropFlags::Visible:
            {
                bool bVisible = false;
                if ( _rValue >>= bVisible )
                if ( rValue >>= bVisible )
                {
                    _pControl->Show( bVisible );
                    pControl->set_visible( bVisible );
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -593,9 +581,9 @@
            case PropFlags::HelpUrl:
            {
                OUString sHelpURL;
                if ( _rValue >>= sHelpURL )
                if ( rValue >>= sHelpURL )
                {
                    setHelpURL( _pControl, sHelpURL, m_pFileView == _pControl );
                    setHelpURL(pControl, sHelpURL);
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -606,19 +594,19 @@

            case PropFlags::ListItems:
            {
                DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
                    "OControlAccess::implSetControlProperty: invalid control/property combination!" );
                weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
                assert(pComboBox && "OControlAccess::implSetControlProperty: invalid control/property combination!");

                Sequence< OUString > aItems;
                if ( _rValue >>= aItems )
                if ( rValue >>= aItems )
                {
                    // remove all previous items
                    static_cast< ListBox* >( _pControl )->Clear();
                    pComboBox->clear();

                    // add the new ones
                    for ( auto const & item : std::as_const(aItems) )
                    for (auto const & item : std::as_const(aItems))
                    {
                        static_cast< ListBox* >( _pControl )->InsertEntry( item );
                        pComboBox->append_text(item);
                    }

                }
@@ -631,13 +619,13 @@

            case PropFlags::SelectedItem:
            {
                DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
                    "OControlAccess::implSetControlProperty: invalid control/property combination!" );
                weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
                assert(pComboBox && "OControlAccess::implSetControlProperty: invalid control/property combination!");

                OUString sSelected;
                if ( _rValue >>= sSelected )
                if ( rValue >>= sSelected )
                {
                    static_cast< ListBox* >( _pControl )->SelectEntry( sSelected );
                    pComboBox->set_active_text(sSelected);
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -648,13 +636,13 @@

            case PropFlags::SelectedItemIndex:
            {
                DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
                    "OControlAccess::implSetControlProperty: invalid control/property combination!" );
                weld::ComboBox* pComboBox = dynamic_cast<weld::ComboBox*>(pControl);
                assert(pComboBox && "OControlAccess::implSetControlProperty: invalid control/property combination!");

                sal_Int32 nPos = 0;
                if ( _rValue >>= nPos )
                if ( rValue >>= nPos )
                {
                    static_cast< ListBox* >( _pControl )->SelectEntryPos( nPos );
                    pComboBox->set_active(nPos);
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -665,13 +653,13 @@

            case PropFlags::Checked:
            {
                DBG_ASSERT( WindowType::CHECKBOX == _pControl->GetType(),
                    "OControlAccess::implSetControlProperty: invalid control/property combination!" );
                weld::ToggleButton* pToggleButton = dynamic_cast<weld::ToggleButton*>(pControl);
                assert(pToggleButton && "OControlAccess::implSetControlProperty: invalid control/property combination!");

                bool bChecked = false;
                if ( _rValue >>= bChecked )
                if ( rValue >>= bChecked )
                {
                    static_cast< CheckBox* >( _pControl )->Check( bChecked );
                    pToggleButton->set_active(bChecked);
                }
                else if ( !_bIgnoreIllegalArgument )
                {
@@ -685,76 +673,80 @@
        }
    }


    Any OControlAccess::implGetControlProperty( Control const * _pControl, PropFlags _nProperty ) const
    Any OControlAccess::implGetControlProperty( weld::Widget const * pControl, PropFlags _nProperty ) const
    {
        DBG_ASSERT( _pControl, "OControlAccess::implGetControlProperty: invalid argument, this will crash!" );
        assert(pControl && "OControlAccess::implGetControlProperty: invalid argument, this will crash!");

        Any aReturn;
        switch ( _nProperty )
        {
            case PropFlags::Text:
                aReturn <<= _pControl->GetText();
            {
                const weld::Label* pLabel = dynamic_cast<const weld::Label*>(pControl);
                assert(pLabel);
                aReturn <<= pLabel->get_label();
                break;

            }
            case PropFlags::Enabled:
                aReturn <<= _pControl->IsEnabled();
                aReturn <<= pControl->get_sensitive();
                break;

            case PropFlags::Visible:
                aReturn <<= _pControl->IsVisible();
                aReturn <<= pControl->get_visible();
                break;

            case PropFlags::HelpUrl:
                aReturn <<= getHelpURL( _pControl, m_pFileView == _pControl );
                aReturn <<= getHelpURL(pControl);
                break;

            case PropFlags::ListItems:
            {
                DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
                    "OControlAccess::implGetControlProperty: invalid control/property combination!" );
                const weld::ComboBox* pComboBox = dynamic_cast<const weld::ComboBox*>(pControl);
                assert(pComboBox && "OControlAccess::implGetControlProperty: invalid control/property combination!");

                Sequence< OUString > aItems( static_cast< ListBox const * >( _pControl )->GetEntryCount() );
                Sequence< OUString > aItems(pComboBox->get_count());
                OUString* pItems = aItems.getArray();
                for ( sal_Int32 i=0; i<static_cast< ListBox const * >( _pControl )->GetEntryCount(); ++i )
                    *pItems++ = static_cast< ListBox const * >( _pControl )->GetEntry( i );
                for (sal_Int32 i = 0; i < pComboBox->get_count(); ++i)
                    *pItems++ = pComboBox->get_text(i);

                aReturn <<= aItems;
                break;
            }
            break;

            case PropFlags::SelectedItem:
            {
                DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
                    "OControlAccess::implGetControlProperty: invalid control/property combination!" );
                const weld::ComboBox* pComboBox = dynamic_cast<const weld::ComboBox*>(pControl);
                assert(pComboBox && "OControlAccess::implGetControlProperty: invalid control/property combination!");

                sal_Int32 nSelected = static_cast< ListBox const * >( _pControl )->GetSelectedEntryPos();
                sal_Int32 nSelected = pComboBox->get_active();
                OUString sSelected;
                if ( LISTBOX_ENTRY_NOTFOUND != nSelected )
                    sSelected = static_cast< ListBox const * >( _pControl )->GetSelectedEntry();
                if (nSelected != -1)
                    sSelected = pComboBox->get_active_text();
                aReturn <<= sSelected;
                break;
            }
            break;

            case PropFlags::SelectedItemIndex:
            {
                DBG_ASSERT( WindowType::LISTBOX == _pControl->GetType(),
                    "OControlAccess::implGetControlProperty: invalid control/property combination!" );
                const weld::ComboBox* pComboBox = dynamic_cast<const weld::ComboBox*>(pControl);
                assert(pComboBox && "OControlAccess::implGetControlProperty: invalid control/property combination!");

                sal_Int32 nSelected = static_cast< ListBox const * >( _pControl )->GetSelectedEntryPos();
                if ( LISTBOX_ENTRY_NOTFOUND != nSelected )
                    aReturn <<= static_cast< ListBox const * >( _pControl )->GetSelectedEntryPos();
                sal_Int32 nSelected = pComboBox->get_active();
                if (nSelected != -1)
                    aReturn <<= nSelected;
                else
                    aReturn <<= sal_Int32(-1);
                break;
            }
            break;

            case PropFlags::Checked:
                DBG_ASSERT( WindowType::CHECKBOX == _pControl->GetType(),
                    "OControlAccess::implGetControlProperty: invalid control/property combination!" );
            {
                const weld::ToggleButton* pToggleButton = dynamic_cast<const weld::ToggleButton*>(pControl);
                assert(pToggleButton && "OControlAccess::implGetControlProperty: invalid control/property combination!");

                aReturn <<= static_cast< CheckBox const * >( _pControl )->IsChecked( );
                aReturn <<= pToggleButton->get_active();
                break;
            }

            default:
                OSL_FAIL( "OControlAccess::implGetControlProperty: invalid property id!" );
@@ -762,8 +754,6 @@
        return aReturn;
    }


}   // namespace svt


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/OfficeControlAccess.hxx b/fpicker/source/office/OfficeControlAccess.hxx
index 0f857cb..e66baae 100644
--- a/fpicker/source/office/OfficeControlAccess.hxx
+++ b/fpicker/source/office/OfficeControlAccess.hxx
@@ -25,7 +25,6 @@
#include "pickercallbacks.hxx"
#include <o3tl/typed_flags_set.hxx>


enum class PropFlags {
    Unknown           =     -1, // used as an error sentinel
    NONE              = 0x0000,
@@ -62,66 +61,68 @@
    class OControlAccess
    {
        IFilePickerController*  m_pFilePickerController;
        VclPtr<SvtFileView>     m_pFileView;
        SvtFileView*     m_pFileView;

    public:
        OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView );
        OControlAccess( IFilePickerController* pController, SvtFileView* pFileView );

        // XControlAccess implementation
        void setControlProperty( const OUString& _rControlName, const OUString& _rControlProperty, const css::uno::Any& _rValue );
        css::uno::Any  getControlProperty( const OUString& _rControlName, const OUString& _rControlProperty );
        void setControlProperty( const OUString& rControlName, const OUString& rControlProperty, const css::uno::Any& rValue );
        css::uno::Any  getControlProperty( const OUString& rControlName, const OUString& rControlProperty );

        // XControlInformation implementation
        css::uno::Sequence< OUString >  getSupportedControls(  ) const;
        css::uno::Sequence< OUString >  getSupportedControlProperties( const OUString& _rControlName );
        static bool                     isControlSupported( const OUString& _rControlName );
        bool                            isControlPropertySupported( const OUString& _rControlName, const OUString& _rControlProperty );
        css::uno::Sequence< OUString >  getSupportedControlProperties( const OUString& rControlName );
        static bool                     isControlSupported( const OUString& rControlName );
        bool                            isControlPropertySupported( const OUString& rControlName, const OUString& rControlProperty );

        // XFilePickerControlAccess
        void                        setValue( sal_Int16 _nId, sal_Int16 _nCtrlAction, const css::uno::Any& _rValue );
        css::uno::Any               getValue( sal_Int16 _nId, sal_Int16 _nCtrlAction ) const;
        void                        setLabel( sal_Int16 _nId, const OUString& _rValue );
        OUString                    getLabel( sal_Int16 _nId ) const;
        void                        enableControl( sal_Int16 _nId, bool _bEnable );
        void                        setValue( sal_Int16 nId, sal_Int16 nCtrlAction, const css::uno::Any& rValue );
        css::uno::Any               getValue( sal_Int16 nId, sal_Int16 nCtrlAction ) const;
        void                        setLabel( sal_Int16 nId, const OUString& rValue );
        OUString                    getLabel( sal_Int16 nId ) const;
        void                        enableControl( sal_Int16 nId, bool bEnable );

        static void             setHelpURL( vcl::Window* _pControl, const OUString& _rURL, bool _bFileView );
        static OUString  getHelpURL( vcl::Window const * _pControl, bool _bFileView );
        void setHelpURL(weld::Widget* pControl, const OUString& rURL);
        OUString getHelpURL(weld::Widget const* pControl) const;

    private:
        /** implements the various methods for setting properties on controls

            @param _nControlId
            @param nControlId
                the id of the control
            @param _pControl
                the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL.
            @param _nProperty
            @param pControl
                the affected control. Must be the same as referred by <arg>nControlId</arg>, or NULL.
            @param nProperty
                the property to set
                See PropFlags::*
            @param _rValue
            @param rValue
                the value to set
            @param _bIgnoreIllegalArgument
            @param bIgnoreIllegalArgument
                if <FALSE/>, an exception will be thrown if the given value is of improper type
        */
        void                        implSetControlProperty(
                                        sal_Int16 _nControlId,
                                        Control* _pControl, PropFlags _nProperty, const css::uno::Any& _rValue,
                                        bool _bIgnoreIllegalArgument = true );
                                        sal_Int16 nControlId,
                                        weld::Widget* pControl, PropFlags nProperty, const css::uno::Any& rValue,
                                        bool bIgnoreIllegalArgument = true );

        Control* implGetControl( const OUString& _rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask = nullptr ) const;
        weld::Widget* implGetControl( const OUString& rControlName, sal_Int16* pId, PropFlags* pPropertyMask = nullptr ) const;

        /** implements the various methods for retrieving properties from controls

            @param _pControl
            @param pControl
                the affected control
                @PRECOND not <NULL/>
            @param _nProperty
            @param nProperty
                the property to retrieve
                See PropFlags::*
            @return
        */
        css::uno::Any  implGetControlProperty( Control const * _pControl, PropFlags _nProperty ) const;
        css::uno::Any  implGetControlProperty( weld::Widget const * pControl, PropFlags nProperty ) const;

        static void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const css::uno::Any& _rValue );
        bool IsFileViewWidget(weld::Widget const * pControl) const;

        static void implDoListboxAction(weld::ComboBox* pListbox, sal_Int16 nCtrlAction, const css::uno::Any& rValue);

    };

diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index ab5d0e3..db7ac9d 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -149,28 +149,28 @@
            if ( !m_aDefaultName.isEmpty() )
            {
                aPath.insertName( m_aDefaultName );
                getDialog()->SetHasFilename( true );
                m_xDlg->SetHasFilename( true );
            }
            getDialog()->SetPath( aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
            m_xDlg->SetPath( aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
            isFileSet = true;
        }
        if ( !isFileSet && !m_aDefaultName.isEmpty() )
        {
            getDialog()->SetPath( m_aDefaultName );
            getDialog()->SetHasFilename( true );
            m_xDlg->SetPath( m_aDefaultName );
            m_xDlg->SetHasFilename( true );
        }
    }
    else
    {
        // set the default standard dir
        INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
        getDialog()->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
        m_xDlg->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
    }

    // set the control values and set the control labels, too
    if ( m_pElemList && !m_pElemList->empty() )
    {
        ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
        ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );

        for (auto const& elem : *m_pElemList)
        {
@@ -193,17 +193,19 @@
                UnoFilterList aSubFilters;
                elem.getSubFilters( aSubFilters );

                getDialog()->AddFilterGroup( elem.getTitle(), aSubFilters );
             }
                m_xDlg->AddFilterGroup( elem.getTitle(), aSubFilters );
            }
            else
            {
                // it's a single filter
                getDialog()->AddFilter( elem.getTitle(), elem.getFilter() );
                m_xDlg->AddFilter( elem.getTitle(), elem.getFilter() );
            }
        }
    }

    // set the default filter
    if ( !m_aCurrentFilter.isEmpty() )
        getDialog()->SetCurFilter( m_aCurrentFilter );
        m_xDlg->SetCurFilter( m_aCurrentFilter );

}

@@ -413,30 +415,28 @@
{
}


sal_Int16 SvtFilePicker::implExecutePicker( )
{
    getDialog()->SetFileCallback( this );
    m_xDlg->SetFileCallback( this );

    prepareExecute();

    getDialog()->EnableAutocompletion();
    m_xDlg->EnableAutocompletion();
    // now we are ready to execute the dialog
    sal_Int16 nRet = getDialog()->Execute();
    sal_Int16 nRet = m_xDlg->run();

    // the execution of the dialog yields, so it is possible the at this point the window or the dialog is closed
    if ( getDialog() )
        getDialog()->SetFileCallback( nullptr );
    if (m_xDlg)
        m_xDlg->SetFileCallback( nullptr );

    return nRet;
}


VclPtr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
std::unique_ptr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( weld::Window* pParent )
{
    PickerFlags nBits = getPickerFlags();

    VclPtrInstance<SvtFileDialog> dialog( _pParent, nBits );
    auto dialog = std::make_unique<SvtFileDialog>(pParent, nBits);

    // Set StandardDir if present
    if ( !m_aStandardDir.isEmpty())
@@ -475,38 +475,31 @@
    OCommonPicker::setTitle( _rTitle );
}


sal_Int16 SAL_CALL SvtFilePicker::execute(  )
{
    return OCommonPicker::execute();
}


// XAsynchronousExecutableDialog functions


void SAL_CALL SvtFilePicker::setDialogTitle( const OUString& _rTitle )
{
    setTitle( _rTitle );
}


void SAL_CALL SvtFilePicker::startExecuteModal( const Reference< css::ui::dialogs::XDialogClosedListener >& xListener )
{
    m_xDlgClosedListener = xListener;
    prepareDialog();
    prepareExecute();
    SvtFileDialog_Base* pDialog = getDialog();
    pDialog->EnableAutocompletion();
    pDialog->StartExecuteAsync([this](sal_Int32 nResult){
    m_xDlg->EnableAutocompletion();
    if (!m_xDlg->PrepareExecute())
        return;
    weld::DialogController::runAsync(m_xDlg, [this](sal_Int32 nResult){
        DialogClosedHdl(nResult);
    });
}


// XFilePicker functions


void SAL_CALL SvtFilePicker::setMultiSelectionMode( sal_Bool bMode )
{
    checkAlive();
@@ -536,15 +529,15 @@
    checkAlive();

    SolarMutexGuard aGuard;
    if ( getDialog() )
    if (m_xDlg)
    {
        OUString aPath = getDialog()->GetPath();
        OUString aPath = m_xDlg->GetPath();

        if( m_aOldHideDirectory == aPath )
            return m_aOldDisplayDirectory;
        m_aOldHideDirectory = aPath;

        if( !getDialog()->ContentIsFolder( aPath ) )
        if( !m_xDlg->ContentIsFolder( aPath ) )
        {
            INetURLObject aFolder( aPath );
            aFolder.CutLastName();
@@ -562,13 +555,13 @@
    checkAlive();

    SolarMutexGuard aGuard;
    if ( ! getDialog() )
    if (!m_xDlg)
    {
        Sequence< OUString > aEmpty;
        return aEmpty;
    }

    return comphelper::containerToSequence(getDialog()->GetPathList());
    return comphelper::containerToSequence(m_xDlg->GetPathList());
}

Sequence< OUString > SAL_CALL SvtFilePicker::getFiles()
@@ -590,9 +583,9 @@
    checkAlive();

    SolarMutexGuard aGuard;
    if ( getDialog() )
    if (m_xDlg)
    {
        ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
        ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
        aAccess.setValue( nElementID, nControlAction, rValue );
    }
    else
@@ -632,9 +625,9 @@
    Any      aAny;

    // execute() called?
    if ( getDialog() )
    if (m_xDlg)
    {
        ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
        ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
        aAny = aAccess.getValue( nElementID, nControlAction );
    }
    else if ( m_pElemList )
@@ -660,9 +653,9 @@
    checkAlive();

    SolarMutexGuard aGuard;
    if ( getDialog() )
    if (m_xDlg)
    {
        ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
        ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
        aAccess.setLabel( nLabelID, rValue );
    }
    else
@@ -698,9 +691,9 @@
    SolarMutexGuard aGuard;
    OUString aLabel;

    if ( getDialog() )
    if (m_xDlg)
    {
        ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
        ::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
        aLabel = aAccess.getLabel( nLabelID );
    }
    else if ( m_pElemList )
@@ -725,9 +718,9 @@
    checkAlive();

    SolarMutexGuard aGuard;
    if ( getDialog() )
    if (m_xDlg)
    {
        ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() );
        ::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
        aAccess.enableControl( nElementID, bEnable );
    }
    else
@@ -776,10 +769,7 @@
    m_xListener.clear();
}


// XFilePreview functions


Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats()
{
    checkAlive();
@@ -792,21 +782,11 @@
    return aFormats;
}


sal_Int32 SAL_CALL SvtFilePicker::getTargetColorDepth()
{
    checkAlive();

    SolarMutexGuard aGuard;
    sal_Int32 nDepth = 0;

    if ( getDialog() )
        nDepth = getDialog()->getTargetColorDepth();

    return nDepth;
    return 0;
}


sal_Int32 SAL_CALL SvtFilePicker::getAvailableWidth()
{
    checkAlive();
@@ -814,13 +794,12 @@
    SolarMutexGuard aGuard;
    sal_Int32 nWidth = 0;

    if ( getDialog() )
        nWidth = getDialog()->getAvailableWidth();
    if (m_xDlg)
        nWidth = m_xDlg->getAvailableWidth();

    return nWidth;
}


sal_Int32 SAL_CALL SvtFilePicker::getAvailableHeight()
{
    checkAlive();
@@ -828,23 +807,21 @@
    SolarMutexGuard aGuard;
    sal_Int32 nHeight = 0;

    if ( getDialog() )
        nHeight = getDialog()->getAvailableHeight();
    if (m_xDlg)
        nHeight = m_xDlg->getAvailableHeight();

    return nHeight;
}


void SAL_CALL SvtFilePicker::setImage( sal_Int16 /*aImageFormat*/, const Any& rImage )
void SAL_CALL SvtFilePicker::setImage(sal_Int16 /*aImageFormat*/, const Any& rImage)
{
    checkAlive();

    SolarMutexGuard aGuard;
    if ( getDialog() )
        getDialog()->setImage( rImage );
    if (m_xDlg)
        m_xDlg->setImage(rImage);
}


sal_Bool SAL_CALL SvtFilePicker::setShowState( sal_Bool )
{
    checkAlive();
@@ -852,7 +829,7 @@
    SolarMutexGuard aGuard;
    bool bRet = false;

    if ( getDialog() )
    if (m_xDlg)
    {
    // #97633 for the system filedialog it's
    // useful to make the preview switchable
@@ -880,8 +857,8 @@
    SolarMutexGuard aGuard;
    bool bRet = false;

    if ( getDialog() )
        bRet = getDialog()->getShowState();
    if (m_xDlg)
        bRet = m_xDlg->getShowState();

    return bRet;
}
@@ -946,8 +923,8 @@

    m_aCurrentFilter = aTitle;

    if ( getDialog() )
        getDialog()->SetCurFilter( aTitle );
    if (m_xDlg)
        m_xDlg->SetCurFilter( aTitle );
}


@@ -956,7 +933,7 @@
    checkAlive();

    SolarMutexGuard aGuard;
    OUString aFilter = getDialog() ? getDialog()->GetCurFilter() :
    OUString aFilter = m_xDlg ? m_xDlg->GetCurFilter() :
                                     m_aCurrentFilter;
    return aFilter;
}
@@ -1091,11 +1068,11 @@
{
}

VclPtr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog( vcl::Window* _pParent )
std::unique_ptr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog(weld::Window* pParent)
{
    PickerFlags nBits = getPickerFlags();

    VclPtrInstance<RemoteFilesDialog> dialog( _pParent, nBits);
    auto dialog = std::make_unique<RemoteFilesDialog>(pParent, nBits);

    // Set StandardDir if present
    if ( !m_aStandardDir.isEmpty())
diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx
index 678ad35..e682581 100644
--- a/fpicker/source/office/OfficeFilePicker.hxx
+++ b/fpicker/source/office/OfficeFilePicker.hxx
@@ -203,7 +203,7 @@

    // OCommonPicker overridables

    virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) override;
    virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
    virtual sal_Int16       implExecutePicker( ) override;
    virtual bool            implHandleInitializationArgument(
                                const OUString& _rName,
@@ -231,7 +231,7 @@
public:
    SvtRemoteFilePicker();

    virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) override;
    virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;

    // disambiguate XInterface

diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx
index 398fbe3..db06eb4 100644
--- a/fpicker/source/office/OfficeFolderPicker.cxx
+++ b/fpicker/source/office/OfficeFolderPicker.cxx
@@ -59,16 +59,18 @@
    m_xListener = xListener;
    prepareDialog();
    prepareExecute();
    SvtFileDialog_Base* pDialog = getDialog();
    pDialog->EnableAutocompletion();
    pDialog->StartExecuteAsync([this](sal_Int32 nResult){

    m_xDlg->EnableAutocompletion();
    if (!m_xDlg->PrepareExecute())
        return;
    weld::DialogController::runAsync(m_xDlg, [this](sal_Int32 nResult){
        DialogClosedHdl(nResult);
    });
}

VclPtr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent )
std::unique_ptr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( weld::Window* pParent )
{
    return VclPtr<SvtFileDialog>::Create( _pParent, PickerFlags::PathDialog );
    return std::make_unique<SvtFileDialog>(pParent, PickerFlags::PathDialog);
}

sal_Int16 SvtFolderPicker::implExecutePicker( )
@@ -76,22 +78,20 @@
    prepareExecute();

    // now we are ready to execute the dialog
    getDialog()->EnableAutocompletion( false );
    sal_Int16 nRet = getDialog()->Execute();

    return nRet;
    m_xDlg->EnableAutocompletion( false );
    return m_xDlg->run();
}

void SvtFolderPicker::prepareExecute()
{
    // set the default directory
    if ( !m_aDisplayDirectory.isEmpty() )
        getDialog()->SetPath( m_aDisplayDirectory );
        m_xDlg->SetPath( m_aDisplayDirectory );
    else
    {
        // set the default standard dir
        INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
        getDialog()->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE) );
        m_xDlg->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE) );
    }
}

@@ -113,10 +113,10 @@

OUString SAL_CALL SvtFolderPicker::getDisplayDirectory()
{
    if ( ! getDialog() )
    if (!m_xDlg)
        return m_aDisplayDirectory;

    std::vector<OUString> aPathList(getDialog()->GetPathList());
    std::vector<OUString> aPathList(m_xDlg->GetPathList());

    if(!aPathList.empty())
        return aPathList[0];
@@ -126,10 +126,10 @@

OUString SAL_CALL SvtFolderPicker::getDirectory()
{
    if ( ! getDialog() )
    if (!m_xDlg)
        return m_aDisplayDirectory;

    std::vector<OUString> aPathList(getDialog()->GetPathList());
    std::vector<OUString> aPathList(m_xDlg->GetPathList());

    if(!aPathList.empty())
        return aPathList[0];
diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx
index e4408df..a9f3606 100644
--- a/fpicker/source/office/OfficeFolderPicker.hxx
+++ b/fpicker/source/office/OfficeFolderPicker.hxx
@@ -93,7 +93,7 @@

    // OCommonPicker overridables

    virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) override;
    virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
    virtual sal_Int16       implExecutePicker( ) override;
};

diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx
index da318d60..f500e9a 100644
--- a/fpicker/source/office/PlacesListBox.cxx
+++ b/fpicker/source/office/PlacesListBox.cxx
@@ -14,96 +14,36 @@
#include <vcl/event.hxx>
#include <bitmaps.hlst>

#define COLUMN_NAME     1


PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString& rTitle ) :
    SvHeaderTabListBox( pParent, WB_TABSTOP | WB_NOINITIALSELECTION ),
    mpHeaderBar( nullptr ),
    mpParent( pParent )
PlacesListBox::PlacesListBox(std::unique_ptr<weld::TreeView> xControl,
                             std::unique_ptr<weld::Button> xAdd,
                             std::unique_ptr<weld::Button> xDel,
                             SvtFileDialog* pFileDlg)
    : maPlaces( )
    , mpDlg(pFileDlg)
    , mxImpl(std::move(xControl))
    , mxAddBtn(std::move(xAdd))
    , mxDelBtn(std::move(xDel))
    , mnNbEditables(0)
    , mbUpdated( false )
    , mbSelectionChanged( false )
{
    Size aBoxSize = pParent->GetSizePixel( );
    mpHeaderBar = VclPtr<HeaderBar>::Create( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
    mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( 600, 16 ) );
    Size aSize(mxImpl->get_approximate_digit_width() * 18,
               mxImpl->get_height_rows(9));
    mxImpl->set_size_request(aSize.Width(), aSize.Height());

    long aTabPositions[] = { 20, 600 };
    SetTabs( SAL_N_ELEMENTS(aTabPositions), aTabPositions, MapUnit::MapPixel );
    mpHeaderBar->InsertItem( COLUMN_NAME, rTitle, 600, HeaderBarItemBits::LEFT );

    Size aHeadSize = mpHeaderBar->GetSizePixel();
    SetPosSizePixel( Point( 0, aHeadSize.getHeight() ),
                  Size( aBoxSize.getWidth(), aBoxSize.getHeight() - aHeadSize.getHeight() ) );

    InitHeaderBar( mpHeaderBar );

    Show( );
    mpHeaderBar->Show();
}

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

void PlacesListBox_Impl::dispose()
{
    mpHeaderBar.disposeAndClear();
    mpParent.clear();
    SvHeaderTabListBox::dispose();
}

void PlacesListBox_Impl::MouseButtonUp( const MouseEvent& rMEvt )
{
    SvHeaderTabListBox::MouseButtonUp( rMEvt );
    mpParent->updateView( );
}

PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, const OUString& rTitle, WinBits nBits ) :
    Control( pParent, nBits ),
    maPlaces( ),
    mpDlg( pFileDlg ),
    mpImpl( nullptr ),
    mpAddBtn( ),
    mpDelBtn( ),
    mnNbEditables( 0 ),
    mbUpdated( false ),
    mbSelectionChanged( false )
{
    mpImpl = VclPtr<PlacesListBox_Impl>::Create( this, rTitle );

    mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) );
    mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ;

    mpAddBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
    mpAddBtn->SetText( "+" );
    mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
    mpAddBtn->Show();

    mpDelBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
    mpDelBtn->SetText( "-" );
    mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
    mpDelBtn->Show();
    mxImpl->connect_changed( LINK( this, PlacesListBox, Selection ) );
    mxImpl->connect_row_activated( LINK( this, PlacesListBox, DoubleClick ) ) ;
}

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

void PlacesListBox::dispose()
{
    mpImpl.disposeAndClear();
    mpAddBtn.disposeAndClear();
    mpDelBtn.disposeAndClear();
    mpDlg.clear();
    Control::dispose();
}

void PlacesListBox::AppendPlace( const PlacePtr& pPlace )
{
    maPlaces.push_back( pPlace );
    mpImpl->InsertEntry( pPlace->GetName( ),
            getEntryIcon( pPlace ), getEntryIcon( pPlace ) );
    mxImpl->append_text(pPlace->GetName());
    mxImpl->set_image(maPlaces.size() - 1, getEntryIcon(pPlace));

    if(pPlace->IsEditable()) {
        ++mnNbEditables;
@@ -111,7 +51,6 @@
    }
}


bool PlacesListBox::IsUpdated() {
    if(mbUpdated) {
        mbUpdated = false;
@@ -120,7 +59,6 @@
    return false;
}


void PlacesListBox::RemovePlace( sal_uInt16 nPos )
{
    if ( nPos < maPlaces.size() )
@@ -130,88 +68,61 @@
            mbUpdated = true;
        }
        maPlaces.erase( maPlaces.begin() + nPos );
        SvTreeListEntry* pEntry = mpImpl->GetEntry( nPos );
        mpImpl->RemoveEntry( pEntry );
        mxImpl->remove(nPos);
    }
}

void PlacesListBox::RemoveSelectedPlace() {
    RemovePlace(mpImpl->GetCurrRow());
    RemovePlace(mxImpl->get_cursor_index());
}

void PlacesListBox::SetAddHdl( const Link<Button*,void>& rHdl )
void PlacesListBox::SetAddHdl( const Link<weld::Button&,void>& rHdl )
{
    mpAddBtn->SetClickHdl( rHdl );
    mxAddBtn->connect_clicked( rHdl );
}

void PlacesListBox::SetDelHdl( const Link<Button*,void>& rHdl )
void PlacesListBox::SetDelHdl( const Link<weld::Button&,void>& rHdl )
{
    mpDelBtn->SetClickHdl( rHdl );
    mxDelBtn->connect_clicked( rHdl );
}

void PlacesListBox::SetDelEnabled( bool enabled )
{
    mpDelBtn->Enable( enabled );
    mxDelBtn->set_sensitive( enabled );
}

void PlacesListBox::SetSizePixel( const Size& rNewSize )
OUString PlacesListBox::getEntryIcon( const PlacePtr& pPlace )
{
    Control::SetSizePixel( rNewSize );
    Size aListSize( rNewSize );
    aListSize.AdjustHeight( -(26 + 18) );
    mpImpl->SetSizePixel( aListSize );

    sal_Int32 nBtnY = rNewSize.Height() - 26;
    mpAddBtn->SetPosPixel( Point( 3, nBtnY ) );
    mpDelBtn->SetPosPixel( Point( 6 + 24, nBtnY ) );
}

bool PlacesListBox::EventNotify( NotifyEvent& rNEvt )
{
    if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
    {
        const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
        const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();

        if( rCode.GetCode() == KEY_RETURN )
        {
            mbSelectionChanged = true;
            updateView();
            return true;
        }
    }
    return Control::EventNotify(rNEvt);
}

Image PlacesListBox::getEntryIcon( const PlacePtr& pPlace )
{
    Image theImage = SvtFileDialog::GetButtonImage( BMP_FILEDLG_PLACE_LOCAL );
    OUString theImage = BMP_FILEDLG_PLACE_LOCAL;
    if ( !pPlace->IsLocal( ) )
        theImage = SvtFileDialog::GetButtonImage( BMP_FILEDLG_PLACE_REMOTE );
        theImage = BMP_FILEDLG_PLACE_REMOTE;
    return theImage;
}

IMPL_LINK_NOARG( PlacesListBox, Selection, SvTreeListBox*, void )
IMPL_LINK_NOARG( PlacesListBox, Selection, weld::TreeView&, void )
{
    sal_uInt32 nSelected = mpImpl->GetCurrRow();
    sal_uInt32 nSelected = mxImpl->get_cursor_index();
    PlacePtr pPlace = maPlaces[nSelected];

    mbSelectionChanged = true;
    if(pPlace->IsEditable())
    if (pPlace->IsEditable())
        mpDlg->RemovablePlaceSelected();
    else
        mpDlg->RemovablePlaceSelected(false);

    updateView();
}

IMPL_LINK_NOARG( PlacesListBox, DoubleClick, SvTreeListBox*, bool )
IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool )
{
    sal_uInt16 nSelected = mpImpl->GetCurrRow();
    sal_uInt16 nSelected = mxImpl->get_cursor_index();
    PlacePtr pPlace = maPlaces[nSelected];
    if ( pPlace->IsEditable() && !pPlace->IsLocal( ) )
    {
        PlaceEditDialog aDlg(mpDlg->GetFrameWeld(), pPlace);
        PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace);
        short aRetCode = aDlg.run();
        switch(aRetCode) {
        switch (aRetCode)
        {
            case RET_OK :
            {
                pPlace->SetName ( aDlg.GetServerName() );
@@ -228,18 +139,14 @@
                break;
        };
    }
    return false;
    return true;
}

void PlacesListBox::updateView( )
{
    if ( mbSelectionChanged )
    {
        mbSelectionChanged = false;
        sal_uInt32 nSelected = mpImpl->GetCurrRow();
        PlacePtr pPlace = maPlaces[nSelected];
        mpDlg->OpenURL_Impl( pPlace->GetUrl( ) );
    }
    sal_uInt32 nSelected = mxImpl->get_cursor_index();
    PlacePtr pPlace = maPlaces[nSelected];
    mpDlg->OpenURL_Impl( pPlace->GetUrl( ) );
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx
index 81a11f0..151a0d1 100644
--- a/fpicker/source/office/PlacesListBox.hxx
+++ b/fpicker/source/office/PlacesListBox.hxx
@@ -12,72 +12,60 @@
#include "iodlg.hxx"

#include <svtools/place.hxx>
#include <vcl/svtabbx.hxx>
#include <vcl/weld.hxx>

#include <memory>
#include <vector>

typedef std::shared_ptr< Place > PlacePtr;
typedef std::shared_ptr<Place> PlacePtr;

class PlacesListBox;
class PlacesListBox_Impl : public SvHeaderTabListBox
{
    private:
        VclPtr<HeaderBar>           mpHeaderBar;
        VclPtr<PlacesListBox>       mpParent;

    public:
        PlacesListBox_Impl( PlacesListBox* pParent, const OUString& rTitle );
        virtual ~PlacesListBox_Impl( ) override;
        virtual void dispose() override;

        virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
};

/** ListBox to handle Places.
  */
class PlacesListBox : public Control
class PlacesListBox
{
    private:
        std::vector< PlacePtr > maPlaces;
        VclPtr<SvtFileDialog>       mpDlg;
        VclPtr<PlacesListBox_Impl>  mpImpl;
        VclPtr<PushButton>          mpAddBtn;
        VclPtr<PushButton>          mpDelBtn;
        sal_Int32            mnNbEditables;
        bool                 mbUpdated;
        bool                 mbSelectionChanged;
private:
    std::vector<PlacePtr> maPlaces;
    SvtFileDialog* mpDlg;
    std::unique_ptr<weld::TreeView> mxImpl;
    std::unique_ptr<weld::Button> mxAddBtn;
    std::unique_ptr<weld::Button> mxDelBtn;
    sal_Int32            mnNbEditables;
    bool                 mbUpdated;
    bool                 mbSelectionChanged;

    public:
        PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, const OUString& rTitle, WinBits nBits );
        virtual ~PlacesListBox( ) override;
        virtual void dispose() override;
public:
    PlacesListBox(std::unique_ptr<weld::TreeView> xTreeView,
                  std::unique_ptr<weld::Button> xAddBtn,
                  std::unique_ptr<weld::Button> xDelBtn,
                  SvtFileDialog* pFileDlg);
    ~PlacesListBox();

        void AppendPlace( const PlacePtr& pPlace );
        void RemovePlace( sal_uInt16 nPos );
        void RemoveSelectedPlace();
        sal_Int32 GetNbEditablePlaces() const { return mnNbEditables;}
        bool IsUpdated();
        const std::vector<PlacePtr>& GetPlaces() const { return maPlaces;}
    void AppendPlace( const PlacePtr& pPlace );
    void RemovePlace( sal_uInt16 nPos );
    void RemoveSelectedPlace();
    sal_Int32 GetNbEditablePlaces() const { return mnNbEditables;}
    bool IsUpdated();
    const std::vector<PlacePtr>& GetPlaces() const { return maPlaces;}

        void SetAddHdl( const Link<Button*,void>& rHdl );
        void SetDelHdl( const Link<Button*,void>& rHdl );
        void SetDelEnabled( bool enabled );
        void SetSizePixel( const Size& rNewSize ) override;
        void updateView( );
    void SetAddHdl( const Link<weld::Button&,void>& rHdl );
    void SetDelHdl( const Link<weld::Button&,void>& rHdl );
    void SetDelEnabled( bool enabled );
    void updateView( );

        const VclPtr<PushButton>& GetAddButton() const { return mpAddBtn; }
        const VclPtr<PushButton>& GetDeleteButton() const { return mpDelBtn; }
        const VclPtr<PlacesListBox_Impl>& GetPlacesListBox() const { return mpImpl; }
    void set_help_id(const OString& rHelpId) { mxImpl->set_help_id(rHelpId); }

        virtual bool EventNotify( NotifyEvent& rNEvt ) override;
    const weld::Button& GetAddButton() const { return *mxAddBtn; }
    const weld::Button& GetDeleteButton() const { return *mxDelBtn; }
    weld::TreeView& GetPlacesListBox() { return *mxImpl; }

    private:
private:

        static Image getEntryIcon( const PlacePtr& pPlace );
    static OUString getEntryIcon(const PlacePtr& pPlace);

        DECL_LINK( Selection, SvTreeListBox*, void );
        DECL_LINK( DoubleClick, SvTreeListBox*, bool );
    DECL_LINK( Selection, weld::TreeView&, void );
    DECL_LINK( DoubleClick, weld::TreeView&, bool );
};

#endif
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 97aa447..a7953385 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -22,7 +22,6 @@
#include <svtools/PlaceEditDialog.hxx>
#include <tools/debug.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <vcl/dialog.hxx>
#include <vcl/errinf.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/treelistentry.hxx>
@@ -30,183 +29,25 @@
#include <vcl/ptrstyle.hxx>
#include <officecfg/Office/Common.hxx>

class FileViewContainer : public vcl::Window
{
    enum FocusState
    {
        Prev = 0,
        TreeView,
        FileView,
        Next,
        FocusCount
    };

    private:
    VclPtr< SvtFileView > m_pFileView;
    VclPtr< FolderTree > m_pTreeView;
    VclPtr< Splitter > m_pSplitter;

    int m_nCurrentFocus;
    VclPtr<vcl::Window> m_pFocusWidgets[FocusState::FocusCount];

    public:
    explicit FileViewContainer( vcl::Window *pParent )
        : Window( pParent, WB_TABSTOP )
        , m_pFileView( nullptr )
        , m_pTreeView( nullptr )
        , m_pSplitter( nullptr )
        , m_nCurrentFocus( 0 )
    {
    }

    virtual ~FileViewContainer() override
    {
        disposeOnce();
    }

    virtual void dispose() override
    {
        m_pFileView.clear();
        m_pTreeView.clear();
        m_pSplitter.clear();
        vcl::Window::dispose();
    }

    void init( SvtFileView* pFileView,
              Splitter* pSplitter,
              FolderTree* pTreeView,
              vcl::Window* pPrevSibling,
              vcl::Window* pNextSibling )
    {
        m_pFileView = pFileView;
        m_pTreeView = pTreeView;
        m_pSplitter = pSplitter;
        m_pFocusWidgets[FocusState::Prev] = pPrevSibling;
        m_pFocusWidgets[FocusState::TreeView] = pTreeView;
        m_pFocusWidgets[FocusState::FileView] = pFileView;
        m_pFocusWidgets[FocusState::Next] = pNextSibling;
    }

    virtual void Resize() override
    {
        Window::Resize();

        if( !m_pFileView || !m_pTreeView )
            return;

        Size aSize = GetSizePixel();
        Point aPos( m_pFileView->GetPosPixel() );
        Size aNewSize( aSize.Width() - aPos.X(), aSize.Height() );

        m_pFileView->SetSizePixel( aNewSize );

        // Resize the Splitter to fit the height
        Size splitterNewSize = m_pSplitter->GetSizePixel();
        splitterNewSize.setHeight( aSize.Height() );
        m_pSplitter->SetSizePixel( splitterNewSize );
        sal_Int32 nMinX = m_pTreeView->GetPosPixel().X();
        sal_Int32 nMaxX = m_pFileView->GetPosPixel().X() + m_pFileView->GetSizePixel().Width() - nMinX;
        m_pSplitter->SetDragRectPixel( tools::Rectangle( Point( nMinX, 0 ), Size( nMaxX, aSize.Width() ) ) );

        // Resize the tree list box to fit the height of the FileView
        Size placesNewSize( m_pTreeView->GetSizePixel() );
        placesNewSize.setHeight( aSize.Height() );
        m_pTreeView->SetSizePixel( placesNewSize );
    }

    void changeFocus( bool bReverse )
    {
        if( !m_pFileView || !m_pTreeView )
            return;

        if( bReverse && m_nCurrentFocus > FocusState::Prev && m_nCurrentFocus <= FocusState::Next )
        {
            m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false);
            m_pFocusWidgets[m_nCurrentFocus]->LoseFocus();

            m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus( true );
            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
        }
        else if( !bReverse && m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus < FocusState::Next )
        {
            m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false);
            m_pFocusWidgets[m_nCurrentFocus]->LoseFocus();

            m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true );
            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
        }
    }

    virtual void GetFocus() override
    {
        if( !m_pFileView || !m_pTreeView )
            return;

        GetFocusFlags aFlags = GetGetFocusFlags();

        if( aFlags & GetFocusFlags::Forward )
            m_nCurrentFocus = FocusState::TreeView;
        else if( aFlags & GetFocusFlags::Backward )
            m_nCurrentFocus = FocusState::FileView;

        if( m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus <= FocusState::Next )
        {
            m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true );
            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
        }
    }

    virtual bool EventNotify( NotifyEvent& rNEvt ) override
    {
        if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
        {
            // we must also update counter when user change focus using mouse
            for(int i = FocusState::Prev; i <= FocusState::Next; i++)
            {
                if( rNEvt.GetWindow() == m_pFocusWidgets[i] )
                {
                    m_nCurrentFocus = i;
                    return true;
                }
            }

            // GETFOCUS for one of FileView's subcontrols
            m_nCurrentFocus = FocusState::FileView;
            return true;
        }
        if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
        {
            const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
            const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
            bool bShift = rCode.IsShift();
            if( rCode.GetCode() == KEY_TAB )
            {
                changeFocus( bShift );
                return true;
            }
        }
        return Window::EventNotify(rNEvt);
    }
};

RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, PickerFlags nBits )
    : SvtFileDialog_Base( pParent, "RemoteFilesDialog", "fps/ui/remotefilesdialog.ui" )
RemoteFilesDialog::RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits )
    : SvtFileDialog_Base( pParent, "fps/ui/remotefilesdialog.ui", "RemoteFilesDialog" )
    , m_xContext( comphelper::getProcessComponentContext() )
    , m_xMasterPasswd( PasswordContainer::create( m_xContext ) )
    , m_nWidth( 0 )
    , m_nHeight( 0 )
    , m_pSplitter( nullptr )
    , m_pFileView( nullptr )
    , m_pContainer( nullptr )
    , m_pAddMenu( nullptr )
    , m_bIsInExecute( false )
    , m_xCancel_btn(m_xBuilder->weld_button("cancel"))
    , m_xAddService_bar(m_xBuilder->weld_toolbar("add_service_bar"))
    , m_xAddService_menu(m_xBuilder->weld_menu("service_edit_menu"))
    , m_xServices_lb(m_xBuilder->weld_combo_box("services_lb"))
    , m_xPathContainer(m_xBuilder->weld_container("breadcrumb_container"))
    , m_xNewFolder(m_xBuilder->weld_button("new_folder"))
    , m_xListView_btn(m_xBuilder->weld_toggle_button("list_view"))
    , m_xIconView_btn(m_xBuilder->weld_toggle_button("icon_view"))
    , m_xFilter_lb(m_xBuilder->weld_combo_box("filter_lb"))
    , m_xName_ed(new AutocompleteEdit(m_xBuilder->weld_entry("filename")))
{
    get( m_pCancel_btn, "cancel" );
    get( m_pAddService_btn, "add_service_btn" );
    get( m_pServices_lb, "services_lb" );
    get( m_pFilter_lb, "filter_lb" );
    get( m_pNewFolder, "new_folder" );
    get( m_pListView_btn, "list_view" );
    get( m_pIconView_btn, "icon_view" );
    m_xAddService_bar->set_item_menu("add_service_btn", m_xAddService_menu.get());

    m_eMode = ( nBits & PickerFlags::SaveAs ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
    m_eType = ( nBits & PickerFlags::PathDialog ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG;
@@ -214,124 +55,94 @@
    m_bIsUpdated = false;
    m_bIsConnected = false;
    m_bServiceChanged = false;
    m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
    m_nCurrentFilter = -1;

    m_pName_ed = VclPtr< AutocompleteEdit >::Create( get< vcl::Window >( "filename_container" ) );
    m_pName_ed->Show();
    m_xName_ed->show();

    m_pFilter_lb->Enable( false );
    m_pName_ed->Enable( false );
    m_pNewFolder->Enable( false );
    // limit width due to super wide strings that may end up here
    m_xFilter_lb->set_size_request(m_xFilter_lb->get_approximate_digit_width() * 60, -1);

    m_xFilter_lb->set_sensitive(false);
    m_xName_ed->set_sensitive(false);
    m_xNewFolder->set_sensitive(false);

    if( m_eMode == REMOTEDLG_MODE_OPEN )
    {
        get( m_pOk_btn, "open" );
        m_xOk_btn = m_xBuilder->weld_button("open");

        m_pNewFolder->Hide();
        m_xNewFolder->hide();
    }
    else
    {
        get( m_pOk_btn, "save" );

        m_pNewFolder->SetModeImage(Image(StockImage::Yes, BMP_FILEDLG_CREATEFOLDER));
        m_pNewFolder->SetClickHdl( LINK( this, RemoteFilesDialog, NewFolderHdl ) );
        m_xOk_btn = m_xBuilder->weld_button("save");
        m_xNewFolder->connect_clicked( LINK( this, RemoteFilesDialog, NewFolderHdl ) );
    }

    m_pIconView_btn->SetClickHdl( LINK( this, RemoteFilesDialog, IconViewHdl ) );
    m_pListView_btn->SetClickHdl( LINK( this, RemoteFilesDialog, ListViewHdl ) );
    m_xListView_btn->set_active(true);
    m_xIconView_btn->connect_clicked( LINK( this, RemoteFilesDialog, IconViewHdl ) );
    m_xListView_btn->connect_clicked( LINK( this, RemoteFilesDialog, ListViewHdl ) );

    m_pOk_btn->Show();
    m_pOk_btn->Enable( false );
    m_xOk_btn->show();
    m_xOk_btn->set_sensitive(false);

    m_pOk_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) );
    m_pCancel_btn->SetClickHdl( LINK( this, RemoteFilesDialog, CancelHdl ) );
    m_xOk_btn->connect_clicked( LINK( this, RemoteFilesDialog, OkHdl ) );
    m_xCancel_btn->connect_clicked( LINK( this, RemoteFilesDialog, CancelHdl ) );

    m_sRootLabel = FpsResId( STR_SVT_ROOTLABEL );
    m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) );
    m_pPath->set_hexpand( true );
    m_pPath->SetClickHdl( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) );
    m_pPath->SetMode( SvtBreadcrumbMode::ALL_VISITED );
    m_pPath->Show();
    m_xPath.reset(new Breadcrumb(m_xPathContainer.get()));
    m_xPath->connect_clicked( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) );
    m_xPath->SetMode( SvtBreadcrumbMode::ALL_VISITED );

    m_pContainer = VclPtr< FileViewContainer >::Create( get< vcl::Window >("container") );
    m_xContainer = m_xBuilder->weld_container("container");
    m_xContainer->set_size_request(m_xContainer->get_approximate_digit_width() * 82, -1);

    m_pContainer->set_hexpand( true );
    m_pContainer->set_vexpand( true );
    m_xFileView.reset(new SvtFileView(m_xDialog.get(),
                                      m_xBuilder->weld_tree_view("fileview"),
                                      m_xBuilder->weld_icon_view("iconview"),
                                      REMOTEDLG_TYPE_PATHDLG == m_eType,
                                      bMultiselection, false));

    m_pFileView = VclPtr< SvtFileView >::Create( m_pContainer, WB_BORDER | WB_TABSTOP,
                                       REMOTEDLG_TYPE_PATHDLG == m_eType,
                                       bMultiselection, false );
    m_xFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
    m_xFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) );
    m_xFileView->EnableDelete( true );

    m_pFileView->Show();
    m_pFileView->EnableAutoResize();
    m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
    m_pFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) );
    m_pFileView->EnableDelete( true );
    m_xTreeView.reset(new FolderTree(m_xBuilder->weld_tree_view("foldertree"), m_xDialog.get()));
    m_xTreeView->connect_changed(LINK(this, RemoteFilesDialog, TreeSelectHdl));

    m_pSplitter = VclPtr< Splitter >::Create( m_pContainer, WB_HSCROLL );
    m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ) );
    m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) );
    m_pSplitter->Show();

    m_pTreeView = VclPtr< FolderTree >::Create( m_pContainer, WB_BORDER );
    Size aSize( 150, 200 );
    m_pTreeView->set_height_request( aSize.Height() );
    m_pTreeView->set_width_request( aSize.Width() );
    m_pTreeView->SetSizePixel( aSize );
    m_pTreeView->Show();

    m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );

    sal_Int32 nPosX = m_pTreeView->GetSizePixel().Width();
    m_pSplitter->SetPosPixel( Point( nPosX, 0 ) );
    nPosX += m_pSplitter->GetSizePixel().Width();
    m_pFileView->SetPosPixel( Point( nPosX, 0 ) );

    m_pContainer->init( m_pFileView, m_pSplitter, m_pTreeView, m_pAddService_btn, m_pFilter_lb );
    m_pContainer->Show();
    m_pContainer->Enable( false );
    m_xContainer->set_sensitive(false);

    m_sIniKey = "RemoteFilesDialog";
    InitSize();

    m_pName_ed->SetGetFocusHdl( LINK( this, RemoteFilesDialog, FileNameGetFocusHdl ) );
    m_pName_ed->SetModifyHdl( LINK( this, RemoteFilesDialog, FileNameModifyHdl ) );
    m_xName_ed->connect_focus_in(LINK(this, RemoteFilesDialog, FileNameGetFocusHdl));
    m_xName_ed->connect_changed(LINK(this, RemoteFilesDialog, FileNameModifyHdl));

    m_pAddService_btn->SetDelayMenu(true);
    m_pAddService_btn->SetDropDown(PushButtonDropdownStyle::SplitMenuButton);

    m_pAddMenu = m_pAddService_btn->GetPopupMenu();
    m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
    m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
    m_xAddService_bar->connect_clicked(LINK( this, RemoteFilesDialog, AddServiceHdl));
    m_xAddService_menu->connect_activate(LINK(this, RemoteFilesDialog, EditServiceMenuHdl));

    FillServicesListbox();

    m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
    m_xServices_lb->connect_changed( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );

    m_pFilter_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectFilterHdl ) );
    m_xFilter_lb->connect_changed( LINK( this, RemoteFilesDialog, SelectFilterHdl ) );
}

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

void RemoteFilesDialog::dispose()
{
    m_pFileView->SetSelectHdl( Link<SvTreeListBox*,void>() );
    m_xFileView->SetSelectHdl(Link<SvtFileView*,void>());

    // save window state
    if( !m_sIniKey.isEmpty() )
    {
        SvtViewOptions aDlgOpt( EViewType::Dialog, m_sIniKey );
        aDlgOpt.SetWindowState( OStringToOUString( GetWindowState(), osl_getThreadTextEncoding() ) );
        aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8));

        Size aSize( GetSizePixel() );
        Size aSize(m_xDialog->get_size());

        OUString sSize = OUString::number( aSize.Width() ) + "|";
        sSize = sSize + OUString::number( aSize.Height() ) + "|";

        OUString sUserData = m_pFileView->GetConfigString();
        OUString sUserData = m_xFileView->GetConfigString();
        aDlgOpt.SetUserItem( "UserData",
                             makeAny( sSize + sUserData ) );
    }
@@ -359,68 +170,27 @@
    }

    batch->commit();

    m_pTreeView.disposeAndClear();
    m_pFileView.disposeAndClear();
    m_pSplitter.disposeAndClear();
    m_pContainer.disposeAndClear();
    m_pPath.disposeAndClear();

    m_pOk_btn.clear();
    m_pCancel_btn.clear();
    m_pAddService_btn.clear();
    m_pServices_lb.clear();
    m_pFilter_lb.clear();
    m_pName_ed.disposeAndClear();
    m_pNewFolder.clear();
    m_pIconView_btn.clear();
    m_pListView_btn.clear();
    m_pAddMenu.clear();

    Dialog::dispose();
}

void RemoteFilesDialog::Resize()
short RemoteFilesDialog::run()
{
    Dialog::Resize();

    if( m_pFileView && m_pContainer )
    if (m_xServices_lb->get_count() > 0)
    {
        Size aSize = m_pContainer->GetSizePixel();
        m_pFileView->SetSizePixel( aSize );
        m_xDialog->show();
        SelectServiceHdl(*m_xServices_lb);
    }
    Invalidate(InvalidateFlags::Update);
}

short RemoteFilesDialog::Execute()
{
    if( m_pServices_lb->GetEntryCount() > 0 )
    if (!m_bIsConnected)
    {
        Show();
        SelectServiceHdl( *m_pServices_lb );
    }
    if( !m_bIsConnected )
    {
        m_pServices_lb->SetNoSelection();
        m_pAddService_btn->SetPopupMenu( nullptr );
        m_xServices_lb->set_active(-1);
        m_xAddService_bar->set_item_menu("add_service_btn", nullptr);
    }

    short nRet = SvtFileDialog_Base::Execute();

    m_bIsInExecute = true;
    short nRet = SvtFileDialog_Base::run();
    m_bIsInExecute = false;
    return nRet;
}

void RemoteFilesDialog::Show()
{
    SvtFileDialog_Base::Show();

    if( m_nWidth > 0 && m_nHeight > 0 )
    {
        Size aSize( m_nWidth, m_nHeight );
        SetSizePixel( aSize );
    }
}

static OUString lcl_GetServiceType( const ServicePtr& pService )
{
    INetProtocol aProtocol = pService->GetUrlObject().GetProtocol();
@@ -466,7 +236,7 @@

    if( aDlgOpt.Exists() )
    {
        SetWindowState( OUStringToOString( aDlgOpt.GetWindowState(), osl_getThreadTextEncoding() ) );
        m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8));

        Any aUserData = aDlgOpt.GetUserItem( "UserData" );
        OUString sCfgStr;
@@ -480,16 +250,14 @@
                return;
            m_nWidth = sCfgStr.copy(0, nPos1++).toInt32();
            m_nHeight = sCfgStr.copy(nPos1, nPos2-nPos1).toInt32();
            m_pFileView->SetConfigString( sCfgStr.copy(nPos2+1) );
            m_xFileView->SetConfigString( sCfgStr.copy(nPos2+1) );
        }
    }
    else
        m_pFileView->SetConfigString( "" );
}

void RemoteFilesDialog::FillServicesListbox()
{
    m_pServices_lb->Clear();
    m_xServices_lb->clear();
    m_aServices.clear();

    // Load from user settings
@@ -517,31 +285,32 @@
            if( placesUrlsList[nPlace] == m_sLastServiceUrl )
                nPos = i;

            m_pServices_lb->InsertEntry( sPrefix + placesNamesList[nPlace] );
            m_xServices_lb->append_text(sPrefix + placesNamesList[nPlace]);

            i++;
        }
    }

    if( m_pServices_lb->GetEntryCount() > 0 )
    if (m_xServices_lb->get_count() > 0)
    {
        m_pServices_lb->SelectEntryPos( nPos );
        m_pAddService_btn->SetPopupMenu( m_pAddMenu );
        m_xServices_lb->set_active(nPos);
        m_xAddService_bar->set_item_menu("add_service_btn", m_xAddService_menu.get());
    }
    else
        m_pAddService_btn->SetPopupMenu( nullptr );
        m_xAddService_bar->set_item_menu("add_service_btn", nullptr);

    EnableControls();
}

int RemoteFilesDialog::GetSelectedServicePos()
{
    int nSelected = m_pServices_lb->GetSelectedEntryPos();
    if( m_aServices.empty() )
        return -1;

    int nPos = 0;
    int i = -1;

    if( m_aServices.empty() )
        return -1;
    int nSelected = m_xServices_lb->get_active();

    int nServices = static_cast<int>(m_aServices.size());
    while( nPos < nServices )
@@ -561,94 +330,85 @@
{
    OUString sName = rFilter;

    if ( rType.isEmpty() )
        sName = "------------------------------------------";

    m_aFilters.emplace_back( rFilter, rType );
    m_pFilter_lb->InsertEntry( sName );
    if (rType.isEmpty())
        m_xFilter_lb->append_separator("");
    else
        m_xFilter_lb->append_text(sName);

    if( m_pFilter_lb->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND )
        m_pFilter_lb->SelectEntryPos( 0 );
    if (m_xFilter_lb->get_active() == -1)
        m_xFilter_lb->set_active(0);
}


void RemoteFilesDialog::OpenURL( OUString const & sURL )
{
    if( m_pFileView )
    if( m_xFileView )
    {
        m_pTreeView->EndSelection();
        DisableControls();

        EnableChildPointerOverwrite( true );
        SetPointer( PointerStyle::Wait );
        Invalidate(InvalidateFlags::Update);
        auto xWait = std::make_unique<weld::WaitObject>(m_xDialog.get());

        if( !sURL.isEmpty() )
        {
            OUString sFilter = FILEDIALOG_FILTER_ALL;

            if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND )
            if( m_nCurrentFilter != -1)
            {
                sFilter = m_aFilters[m_nCurrentFilter].second;
            }

            m_pFileView->EndInplaceEditing();
            m_xFileView->EndInplaceEditing();

            DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" );

            m_pCurrentAsyncAction = new AsyncPickerAction( this, m_pFileView, AsyncPickerAction::Action::eOpenURL );
            m_pCurrentAsyncAction = new AsyncPickerAction( this, m_xFileView.get(), AsyncPickerAction::Action::eOpenURL );

            // -1 timeout - sync
            m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetBlackList() );

            if( m_eMode != REMOTEDLG_MODE_SAVE )
                m_pName_ed->SetText( "" );
                m_xName_ed->set_text( "" );

            m_pFileView->GrabFocus();
            m_xFileView->grab_focus();
        }
        else
        {
            SetPointer( PointerStyle::Arrow );
            EnableChildPointerOverwrite( false );
            xWait.reset();

            // content doesn't exist
            ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS );

            EnableControls();
            return;
        }

        SetPointer( PointerStyle::Arrow );
        EnableChildPointerOverwrite( false );
    }
}

void RemoteFilesDialog::AddFileExtension()
{
    if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND )
    if (m_nCurrentFilter != -1)
    {
        OUString sExt = m_aFilters[m_nCurrentFilter].second;
        OUString sFileName = m_pName_ed->GetText();
        OUString sFileName = m_xName_ed->get_text();

        sal_Int32 nDotPos = sFileName.lastIndexOf( '.' );

        if ( nDotPos == -1 )
        {
            sFileName += sExt.copy( 1 ); // without '*'
            m_pName_ed->SetText( sFileName );
            m_xName_ed->set_text( sFileName );
        }
    }
}

void RemoteFilesDialog::EnableControls()
{
    if( m_pServices_lb->GetEntryCount() > 0 )
    if (m_xServices_lb->get_count() > 0)
    {
        m_pServices_lb->Enable();
        m_xServices_lb->set_sensitive(true);

        if( m_pServices_lb->GetSelectedEntryCount() )
        if (m_xServices_lb->get_active() != -1)
        {
            m_pAddMenu->EnableItem( "change_password", false );
            m_xAddService_menu->set_sensitive("change_password", false);

            try
            {
@@ -664,7 +424,7 @@

                        if( aURLEntries.UserList.hasElements() )
                        {
                            m_pAddMenu->EnableItem( "change_password" );
                            m_xAddService_menu->set_sensitive("change_password", true);
                        }
                    }
                }
@@ -674,50 +434,48 @@
        }
    }
    else
        m_pServices_lb->Enable( false );
        m_xServices_lb->set_sensitive(false);

    if( m_bIsConnected )
    {
        m_pFilter_lb->Enable();
        m_pName_ed->Enable();
        m_pContainer->Enable();
        m_pNewFolder->Enable();
        m_xFilter_lb->set_sensitive(true);
        m_xName_ed->set_sensitive(true);
        m_xContainer->set_sensitive(true);
        m_xNewFolder->set_sensitive(true);

        if( !m_pName_ed->GetText().isEmpty() )
            m_pOk_btn->Enable();
        if (!m_xName_ed->get_text().isEmpty())
            m_xOk_btn->set_sensitive(true);
        else
            m_pOk_btn->Enable( false );
            m_xOk_btn->set_sensitive(false);
    }
    else
    {
        m_pFilter_lb->Enable( false );
        m_pName_ed->Enable( false );
        m_pContainer->Enable( false );
        m_pNewFolder->Enable( false );
        m_pOk_btn->Enable( false );
        m_xFilter_lb->set_sensitive(false);
        m_xName_ed->set_sensitive(false);
        m_xContainer->set_sensitive(false);
        m_xNewFolder->set_sensitive(false);
        m_xOk_btn->set_sensitive(false);
    }

    m_pPath->EnableFields( true );
    m_pAddService_btn->Enable();

    Invalidate(InvalidateFlags::Update);
    m_xPath->EnableFields( true );
    m_xAddService_bar->set_sensitive(true);
}

void RemoteFilesDialog::DisableControls()
{
    m_pServices_lb->Enable( false );
    m_pFilter_lb->Enable( false );
    m_pAddService_btn->Enable( false );
    m_pName_ed->Enable( false );
    m_pContainer->Enable( false );
    m_pOk_btn->Enable( false );
    m_pPath->EnableFields( false );
    m_xServices_lb->set_sensitive(false);
    m_xFilter_lb->set_sensitive(false);
    m_xAddService_bar->set_sensitive(false);
    m_xName_ed->set_sensitive(false);
    m_xContainer->set_sensitive(false);
    m_xOk_btn->set_sensitive(false);
    m_xPath->EnableFields( false );

    m_pCancel_btn->Enable();
    m_xCancel_btn->set_sensitive(true);
}

void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUser
                                    , const OUString& rPassword, bool bPersistent )
void RemoteFilesDialog::SavePassword(const OUString& rURL, const OUString& rUser,
                                     const OUString& rPassword, bool bPersistent)
{
    if( rURL.isEmpty() || rUser.isEmpty() || rPassword.isEmpty() )
        return;
@@ -745,19 +503,21 @@
    {}
}

IMPL_LINK_NOARG ( RemoteFilesDialog, IconViewHdl, Button*, void )
IMPL_LINK_NOARG ( RemoteFilesDialog, IconViewHdl, weld::Button&, void )
{
    m_pFileView->SetViewMode( eIcon );
    m_xListView_btn->set_active(false);
    m_xFileView->SetViewMode( eIcon );
}

IMPL_LINK_NOARG ( RemoteFilesDialog, ListViewHdl, Button*, void )
IMPL_LINK_NOARG ( RemoteFilesDialog, ListViewHdl, weld::Button&, void )
{
    m_pFileView->SetViewMode( eDetailedList );
    m_xIconView_btn->set_active(false);
    m_xFileView->SetViewMode( eDetailedList );
}

IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl, Button*, void )
IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl, const OString&, void )
{
    PlaceEditDialog aDlg(GetFrameWeld());
    PlaceEditDialog aDlg(m_xDialog.get());
    aDlg.ShowPasswordControl();
    short aRetCode = aDlg.run();

@@ -781,10 +541,10 @@
            if(!sPrefix.isEmpty())
                 sPrefix += ": ";

            m_pServices_lb->InsertEntry( sPrefix + newService->GetName() );
            m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 );
            m_pAddService_btn->SetPopupMenu( m_pAddMenu );
            SelectServiceHdl( *m_pServices_lb );
            m_xServices_lb->append_text( sPrefix + newService->GetName() );
            m_xServices_lb->set_active( m_xServices_lb->get_count() - 1 );
            m_xAddService_bar->set_item_menu("add_service_btn", m_xAddService_menu.get());
            SelectServiceHdl( *m_xServices_lb );

            m_bIsUpdated = true;

@@ -798,31 +558,31 @@
    };
}

IMPL_LINK_NOARG( RemoteFilesDialog, SelectServiceHdl, ListBox&, void )
IMPL_LINK_NOARG( RemoteFilesDialog, SelectServiceHdl, weld::ComboBox&, void )
{
    int nPos = GetSelectedServicePos();

    if( nPos >= 0 )
    {
        OUString sURL = m_aServices[nPos]->GetUrl();
        m_pAddService_btn->SetPopupMenu( m_pAddMenu );
        m_xAddService_bar->set_item_menu("add_service_btn", m_xAddService_menu.get());

        m_bServiceChanged = true;
        OpenURL( sURL );
    }
}

IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void )
IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OString&, rIdent, void )
{
    OString sIdent( pButton->GetCurItemIdent() );
    if( sIdent == "edit_service"  && m_pServices_lb->GetEntryCount() > 0 )
    OString sIdent(rIdent);
    if( sIdent == "edit_service"  && m_xServices_lb->get_count() > 0 )
    {
        unsigned int nSelected = m_pServices_lb->GetSelectedEntryPos();
        int nSelected = m_xServices_lb->get_active();
        int nPos = GetSelectedServicePos();

        if( nPos >= 0 )
        {
            PlaceEditDialog aDlg(GetFrameWeld(), m_aServices[nPos]);
            PlaceEditDialog aDlg(m_xDialog.get(), m_aServices[nPos]);
            short aRetCode = aDlg.run();

            switch( aRetCode )
@@ -832,15 +592,15 @@
                    ServicePtr pEditedService = aDlg.GetPlace();

                    m_aServices[nPos] = pEditedService;
                    m_pServices_lb->RemoveEntry( nSelected );
                    m_xServices_lb->remove( nSelected );

                    OUString sPrefix = lcl_GetServiceType( pEditedService );

                    if(!sPrefix.isEmpty())
                        sPrefix += ": ";

                    m_pServices_lb->InsertEntry( sPrefix + pEditedService->GetName(), nSelected );
                    m_pServices_lb->SelectEntryPos( nSelected );
                    m_xServices_lb->insert_text(nSelected, sPrefix + pEditedService->GetName());
                    m_xServices_lb->set_active( nSelected );

                    m_bIsUpdated = true;
                    break;
@@ -855,16 +615,16 @@
            };
        }
    }
    if( sIdent == "delete_service"  && m_pServices_lb->GetEntryCount() > 0 )
    if( sIdent == "delete_service"  && m_xServices_lb->get_count() > 0 )
    {
        unsigned int nSelected = m_pServices_lb->GetSelectedEntryPos();
        int nSelected = m_xServices_lb->get_active();
        int nPos = GetSelectedServicePos();

        if( nPos >= 0 )
        {
            OUString sMsg = FpsResId( STR_SVT_DELETESERVICE );
            sMsg = sMsg.replaceFirst( "$servicename$", m_pServices_lb->GetSelectedEntry() );
            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
            sMsg = sMsg.replaceFirst( "$servicename$", m_xServices_lb->get_active_text() );
            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                      VclMessageType::Question, VclButtonsType::YesNo, sMsg));
            if (xBox->run() == RET_YES)
            {
@@ -892,10 +652,10 @@
                {}

                m_aServices.erase( m_aServices.begin() + nPos );
                m_pServices_lb->RemoveEntry( nSelected );
                m_xServices_lb->remove( nSelected );

                m_pServices_lb->SetNoSelection();
                m_pAddService_btn->SetPopupMenu( nullptr );
                m_xServices_lb->set_active(-1);
                m_xAddService_bar->set_item_menu("add_service_btn", nullptr);

                m_bIsUpdated = true;

@@ -950,128 +710,81 @@
    EnableControls();
}

IMPL_LINK_NOARG( RemoteFilesDialog, DoubleClickHdl, SvTreeListBox*, bool )
IMPL_LINK_NOARG( RemoteFilesDialog, DoubleClickHdl, SvtFileView*, bool )
{
    if( m_pFileView->GetSelectionCount() )
    SvtContentEntry* pData = m_xFileView->FirstSelected();
    if (pData)
    {
        SvTreeListEntry* pEntry = m_pFileView->FirstSelected();

        if( pEntry )
        {
            SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() );

            if( pData )
            {
                if( !pData->mbIsFolder )
                {
                    EndDialog( RET_OK );
                }
                else
                {
                    OpenURL( pData->maURL );
                }
            }
        }
        if (!pData->mbIsFolder)
            m_xDialog->response(RET_OK);
        else
            OpenURL(pData->maURL);
    }

    return true;
}

IMPL_LINK_NOARG( RemoteFilesDialog, SelectHdl, SvTreeListBox*, void )
IMPL_LINK_NOARG( RemoteFilesDialog, SelectHdl, SvtFileView*, void )
{
    SvTreeListEntry* pEntry = m_pFileView->FirstSelected();

    if( pEntry )
    SvtContentEntry* pData = m_xFileView->FirstSelected();
    if (pData)
    {
        SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() );

        if( pData )
        if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) )
            || ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) )
        {
            if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) )
                || ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) )
            {
                // url must contain user info, because we need this info in recent files entry
                // (to fill user field in login box by default)
                INetURLObject aURL( pData->maURL );
                INetURLObject aCurrentURL( m_sLastServiceUrl );
                aURL.SetUser( aCurrentURL.GetUser() );
            // url must contain user info, because we need this info in recent files entry
            // (to fill user field in login box by default)
            INetURLObject aURL( pData->maURL );
            INetURLObject aCurrentURL( m_sLastServiceUrl );
            aURL.SetUser( aCurrentURL.GetUser() );

                m_sPath = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
            m_sPath = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );

                m_pName_ed->SetText( aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset) );
            }
            else
            {
                if( m_eMode == REMOTEDLG_MODE_OPEN )
                {
                    m_sPath.clear();
                    m_pName_ed->SetText( "" );
                }
            }

            EnableControls();
            m_xName_ed->set_text( aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset) );
        }
        else
        {
            if( m_eMode == REMOTEDLG_MODE_OPEN )
            {
                m_sPath.clear();
                m_xName_ed->set_text( "" );
            }
        }

        EnableControls();
    }
}

IMPL_LINK_NOARG( RemoteFilesDialog, FileNameGetFocusHdl, Control&, void )
IMPL_LINK_NOARG(RemoteFilesDialog, FileNameGetFocusHdl, weld::Widget&, void)
{
    m_pFileView->SetNoSelection();
    m_xFileView->SetNoSelection();
}

IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl, Edit&, void )
IMPL_LINK_NOARG(RemoteFilesDialog, FileNameModifyHdl, weld::Entry&, void)
{
    m_pFileView->SetNoSelection();
    if( !m_pOk_btn->IsEnabled() )
    m_xFileView->SetNoSelection();
    if (!m_xOk_btn->get_sensitive())
        EnableControls();
}

IMPL_LINK_NOARG( RemoteFilesDialog, SplitHdl, Splitter*, void )
IMPL_LINK_NOARG( RemoteFilesDialog, SelectFilterHdl, weld::ComboBox&, void )
{
    sal_Int32 nSplitPos = m_pSplitter->GetSplitPosPixel();
    int nPos = m_xFilter_lb->get_active();

    // Resize the tree list box
    sal_Int32 nPlaceX = m_pTreeView->GetPosPixel().X();
    Size placeSize = m_pTreeView->GetSizePixel();
    placeSize.setWidth( nSplitPos - nPlaceX );
    m_pTreeView->SetSizePixel( placeSize );

    // Change Pos and size of the fileview
    Point fileViewPos = m_pFileView->GetPosPixel();
    sal_Int32 nOldX = fileViewPos.X();
    sal_Int32 nNewX = nSplitPos + m_pSplitter->GetSizePixel().Width();
    fileViewPos.setX( nNewX );
    Size fileViewSize = m_pFileView->GetSizePixel();
    fileViewSize.AdjustWidth( -( nNewX - nOldX ) );
    m_pFileView->SetPosSizePixel( fileViewPos, fileViewSize );

    m_pSplitter->SetPosPixel( Point( placeSize.Width(), m_pSplitter->GetPosPixel().Y() ) );
}

IMPL_LINK_NOARG( RemoteFilesDialog, SelectFilterHdl, ListBox&, void )
{
    unsigned int nPos = m_pFilter_lb->GetSelectedEntryPos();

    if( nPos != LISTBOX_ENTRY_NOTFOUND && !m_aFilters[nPos].second.isEmpty() )
    if( nPos != -1 && !m_aFilters[nPos].second.isEmpty() )
    {
        m_nCurrentFilter = nPos;

        OUString sCurrentURL = m_pFileView->GetViewURL();
        OUString sCurrentURL = m_xFileView->GetViewURL();

        if( !sCurrentURL.isEmpty() && m_bIsConnected )
            OpenURL( sCurrentURL );
    }
}

IMPL_LINK( RemoteFilesDialog, TreeSelectHdl, SvTreeListBox *, pBox, void )
IMPL_LINK(RemoteFilesDialog, TreeSelectHdl, weld::TreeView&, rBox, void)
{
    OUString* sURL = static_cast< OUString* >( pBox->GetHdlEntry()->GetUserData() );

    if( sURL )
    {
        OpenURL( *sURL );
        m_pFileView->GrabFocus();
    }
    OpenURL(rBox.get_selected_id());
    m_xFileView->grab_focus();
}

IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr, void )
@@ -1079,21 +792,21 @@
    OpenURL( pPtr->GetHdlURL() );
}

IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl, Button*, void )
IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl, weld::Button&, void )
{
    m_pFileView->EndInplaceEditing();
    m_xFileView->EndInplaceEditing();

    // will be bound after InteractionHandler is enabled
    SmartContent aContent;
    aContent.enableDefaultInteractionHandler();
    // now it can be bound
    aContent.bindTo( m_pFileView->GetViewURL() );
    aContent.bindTo( m_xFileView->GetViewURL() );
    if( !aContent.canCreateFolder() )
        return;

    OUString aTitle;
    aContent.getTitle( aTitle );
    QueryFolderNameDialog aDlg(GetFrameWeld(), aTitle, FpsResId(STR_SVT_NEW_FOLDER));
    QueryFolderNameDialog aDlg(m_xDialog.get(), aTitle, FpsResId(STR_SVT_NEW_FOLDER));
    bool bHandled = false;

    while( !bHandled )
@@ -1103,7 +816,7 @@
            OUString aUrl = aContent.createFolder(aDlg.GetName());
            if( !aUrl.isEmpty() )
            {
                m_pFileView->CreatedFolder(aUrl, aDlg.GetName());
                m_xFileView->CreatedFolder(aUrl, aDlg.GetName());
                bHandled = true;
            }
        }
@@ -1112,9 +825,9 @@
    }
}

IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, Button*, void )
IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, weld::Button&, void )
{
    OUString sNameNoExt = m_pName_ed->GetText();
    OUString sNameNoExt = m_xName_ed->get_text();
    OUString sPathNoExt;

    // auto extension
@@ -1123,12 +836,12 @@

    // check if file/path exists

    OUString sCurrentPath = m_pFileView->GetViewURL();
    OUString sSelectedItem = m_pFileView->GetCurrentURL();
    OUString sName = m_pName_ed->GetText();
    OUString sCurrentPath = m_xFileView->GetViewURL();
    OUString sSelectedItem = m_xFileView->GetCurrentURL();
    OUString sName = m_xName_ed->get_text();

    bool bFileDlg = ( m_eType == REMOTEDLG_TYPE_FILEDLG );
    bool bSelected = ( m_pFileView->GetSelectionCount() > 0 );
    bool bSelected = ( m_xFileView->GetSelectionCount() > 0 );

    if( !sCurrentPath.endsWith("/") )
        sCurrentPath += "/";
@@ -1167,7 +880,7 @@
        {
            OUString sMsg = FpsResId( STR_SVT_ALREADYEXISTOVERWRITE );
            sMsg = sMsg.replaceFirst( "$filename$", sName );
            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                      VclMessageType::Question, VclButtonsType::YesNo, sMsg));
            if (xBox->run() != RET_YES)
                return;
@@ -1178,10 +891,10 @@
        if( ContentIsFolder( sPathNoExt ) )
        {
            OpenURL( sPathNoExt );
            m_pName_ed->SetText( "" );
            m_xName_ed->set_text( "" );

            if( !bSelected )
                m_pName_ed->GrabFocus();
            if (!bSelected)
                m_xName_ed->grab_focus();

            return;
        }
@@ -1190,10 +903,10 @@
            return;
    }

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

IMPL_LINK_NOARG ( RemoteFilesDialog, CancelHdl, Button*, void )
IMPL_LINK_NOARG ( RemoteFilesDialog, CancelHdl, weld::Button&, void )
{
    if( m_pCurrentAsyncAction.is() )
    {
@@ -1202,15 +915,14 @@
    }
    else
    {
        EndDialog();
        m_xDialog->response(RET_CANCEL);
    }
}

// SvtFileDialog_Base

SvtFileView* RemoteFilesDialog::GetView()
{
    return m_pFileView;
    return m_xFileView.get();
}

void RemoteFilesDialog::SetHasFilename( bool )
@@ -1220,7 +932,7 @@
void RemoteFilesDialog::SetBlackList( const css::uno::Sequence< OUString >& rBlackList )
{
    m_aBlackList = rBlackList;
    m_pTreeView->SetBlackList( rBlackList );
    m_xTreeView->SetBlackList( rBlackList );
}

const css::uno::Sequence< OUString >& RemoteFilesDialog::GetBlackList() const
@@ -1247,25 +959,25 @@
        INetURLObject aUrl( m_sPath );
        OUString sFileName = aUrl.GetLastName( INetURLObject::DecodeMechanism::WithCharset );

        m_pName_ed->SetText( sFileName );
        m_xName_ed->set_text( sFileName );
    }
}

OUString RemoteFilesDialog::getCurrentFileText() const
{
    OUString sReturn;
    if( m_pName_ed )
        sReturn = m_pName_ed->GetText();
    if( m_xName_ed )
        sReturn = m_xName_ed->get_text();
    return sReturn;
}

void RemoteFilesDialog::setCurrentFileText( const OUString& rText, bool bSelectAll )
{
    if( m_pName_ed )
    if (m_xName_ed)
    {
        m_pName_ed->SetText( rText );
        m_xName_ed->set_text(rText);
        if( bSelectAll )
            m_pName_ed->SetSelection( Selection( 0, rText.getLength() ) );
            m_xName_ed->select_region(0, -1);
    }
}

@@ -1284,7 +996,7 @@
{
    OUString sFilter;

    if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND )
    if (m_nCurrentFilter != -1)
    {
        sFilter = m_aFilters[m_nCurrentFilter].first;
    }
@@ -1299,7 +1011,7 @@

void RemoteFilesDialog::SetCurFilter( const OUString& rFilter )
{
    DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" );
    DBG_ASSERT( !m_bIsInExecute, "SvtFileDialog::SetCurFilter: currently executing!" );

    // look for corresponding filter
    sal_uInt16 nPos = m_aFilters.size();
@@ -1309,7 +1021,7 @@
        if ( m_aFilters[nPos].first == rFilter )
        {
            m_nCurrentFilter = nPos;
            m_pFilter_lb->SelectEntryPos( m_nCurrentFilter );
            m_xFilter_lb->set_active( m_nCurrentFilter );
            break;
        }
    }
@@ -1342,29 +1054,27 @@
    {
        OUString sURL = m_aServices[nPos]->GetUrl();

        m_pPath->SetRootName( m_sRootLabel );
        m_pTreeView->Clear();
        m_xPath->SetRootName( m_sRootLabel );
        m_xTreeView->clear();

        SvTreeListEntry* pRoot = m_pTreeView->InsertEntry( m_sRootLabel, nullptr, true );
        OUString* sData = new OUString( rURL );
        pRoot->SetUserData( static_cast< void* >( sData ) );
        m_xTreeView->InsertRootEntry(rURL, m_sRootLabel);

        m_pName_ed->GrabFocus();
        m_xName_ed->grab_focus();

        m_sLastServiceUrl = sURL;

        m_bServiceChanged = false;
    }

    m_pPath->SetURL( rURL );
    m_xPath->SetURL( rURL );

    m_pTreeView->SetSelectHdl( Link<SvTreeListBox*,void>() );
    m_xTreeView->connect_changed(Link<weld::TreeView&,void>());

    // read cached data for this url and fill the tree
    const ::std::vector< SvtContentEntry >& rFolders = m_pFileView->GetContent();
    const ::std::vector< SvtContentEntry >& rFolders = m_xFileView->GetContent();
    ::std::vector< std::pair< OUString, OUString > > aFolders;

    m_pName_ed->ClearEntries();
    m_xName_ed->ClearEntries();

    for(const auto & rFolder : rFolders)
    {
@@ -1386,13 +1096,13 @@
            }

            // add entries to the autocompletion mechanism
            m_pName_ed->AddEntry( sTitle );
            m_xName_ed->AddEntry( sTitle );
        }
    }

    m_pTreeView->FillTreeEntry( rURL, aFolders );
    m_xTreeView->FillTreeEntry( rURL, aFolders );

    m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );
    m_xTreeView->connect_changed( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );

    m_bIsConnected = true;
    EnableControls();
@@ -1411,20 +1121,18 @@
std::vector<OUString> RemoteFilesDialog::GetPathList() const
{
    std::vector<OUString> aList;
    sal_uLong nCount = m_pFileView->GetSelectionCount();
    SvTreeListEntry* pEntry = nCount ? m_pFileView->FirstSelected() : nullptr;

    while( pEntry )
    {
    m_xFileView->selected_foreach([this, &aList](weld::TreeIter& rCurEntry){
        // url must contain user info, because we need this info in recent files entry
        // (to fill user field in login box by default)
        INetURLObject aURL( SvtFileView::GetURL( pEntry ) );
        INetURLObject aURL(m_xFileView->GetURL(rCurEntry));
        INetURLObject aCurrentURL( m_sLastServiceUrl );
        aURL.SetUser( aCurrentURL.GetUser() );

        aList.push_back( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
        pEntry = m_pFileView->NextSelected( pEntry );
    }

        return false;
    });

    if( aList.empty() && !m_sPath.isEmpty() )
        aList.push_back( m_sPath );
@@ -1489,12 +1197,6 @@
    return false;
}

sal_Int32 RemoteFilesDialog::getTargetColorDepth()
{
    // This dialog doesn't contain preview
    return 0;
}

sal_Int32 RemoteFilesDialog::getAvailableWidth()
{
    // This dialog doesn't contain preview
@@ -1518,10 +1220,11 @@
    return false;
}

Control* RemoteFilesDialog::getControl( sal_Int16, bool) const
weld::Widget* RemoteFilesDialog::getControl( sal_Int16, bool) const
{
    return nullptr;
}

void RemoteFilesDialog::enableControl( sal_Int16, bool )
{
}
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index ff0a3d6..349a3f7 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -52,18 +52,13 @@

typedef std::shared_ptr< Place > ServicePtr;

class FileViewContainer;

class RemoteFilesDialog : public SvtFileDialog_Base
{
public:
    RemoteFilesDialog( vcl::Window* pParent, PickerFlags nBits );
    RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits );
    virtual ~RemoteFilesDialog() override;

    virtual void dispose() override;
    virtual void Resize() override;
    virtual short Execute() override;
    void Show();
    virtual short run() override;

    // SvtFileDialog_Base

@@ -97,7 +92,6 @@

    virtual void EnableAutocompletion( bool = true) override;

    virtual sal_Int32 getTargetColorDepth() override;
    virtual sal_Int32 getAvailableWidth() override;
    virtual sal_Int32 getAvailableHeight() override;

@@ -105,7 +99,7 @@

    virtual bool getShowState() override;

    virtual Control* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
    virtual weld::Widget* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
    virtual void enableControl( sal_Int16 nControlId, bool bEnable ) override;
    virtual OUString getCurFilter( ) const override;

@@ -123,31 +117,33 @@
    int m_nWidth;
    int m_nHeight;

    bool m_bIsInExecute;

    OUString m_sPath;
    OUString m_sStdDir;
    OUString m_sRootLabel;
    OUString m_sLastServiceUrl;
    unsigned int m_nCurrentFilter;
    int m_nCurrentFilter;

    ::rtl::Reference< ::svt::AsyncPickerAction > m_pCurrentAsyncAction;

    css::uno::Sequence< OUString > m_aBlackList;

    VclPtr< PushButton > m_pOk_btn;
    VclPtr< CancelButton > m_pCancel_btn;
    VclPtr< MenuButton > m_pAddService_btn;
    VclPtr< ListBox > m_pServices_lb;
    VclPtr< Breadcrumb > m_pPath;
    VclPtr< PushButton > m_pNewFolder;
    VclPtr< PushButton > m_pListView_btn;
    VclPtr< PushButton > m_pIconView_btn;
    VclPtr< Splitter > m_pSplitter;
    VclPtr< FolderTree > m_pTreeView;
    VclPtr< SvtFileView > m_pFileView;
    VclPtr< FileViewContainer > m_pContainer;
    VclPtr< ListBox > m_pFilter_lb;
    VclPtr< AutocompleteEdit > m_pName_ed;
    VclPtr<PopupMenu> m_pAddMenu;
    std::unique_ptr<weld::Button> m_xOk_btn;
    std::unique_ptr<weld::Button> m_xCancel_btn;
    std::unique_ptr<weld::Toolbar> m_xAddService_bar;
    std::unique_ptr<weld::Menu> m_xAddService_menu;
    std::unique_ptr<weld::ComboBox> m_xServices_lb;
    std::unique_ptr<weld::Container> m_xPathContainer;
    std::unique_ptr<Breadcrumb> m_xPath;
    std::unique_ptr<weld::Button> m_xNewFolder;
    std::unique_ptr<weld::ToggleButton> m_xListView_btn;
    std::unique_ptr<weld::ToggleButton> m_xIconView_btn;
    std::unique_ptr<FolderTree> m_xTreeView;
    std::unique_ptr<SvtFileView> m_xFileView;
    std::unique_ptr<weld::Container> m_xContainer;
    std::unique_ptr<weld::ComboBox> m_xFilter_lb;
    std::unique_ptr<AutocompleteEdit> m_xName_ed;

    std::vector< ServicePtr > m_aServices;
    std::vector< std::pair< OUString, OUString > > m_aFilters;
@@ -166,33 +162,33 @@
    void EnableControls();
    void DisableControls();

    void SavePassword( const OUString& rURL, const OUString& rUser
                    , const OUString& rPassword, bool bPersistent );
    void SavePassword(const OUString& rURL, const OUString& rUser,
                      const OUString& rPassword, bool bPersistent);

    DECL_LINK ( AddServiceHdl, Button*, void );
    DECL_LINK ( SelectServiceHdl, ListBox&, void );
    DECL_LINK ( EditServiceMenuHdl, MenuButton *, void );
    DECL_LINK ( AddServiceHdl, const OString&, void );
    DECL_LINK ( SelectServiceHdl, weld::ComboBox&, void );
    DECL_LINK ( EditServiceMenuHdl, const OString&, void );

    DECL_LINK( DoubleClickHdl, SvTreeListBox*, bool );
    DECL_LINK( SelectHdl, SvTreeListBox*, void );
    DECL_LINK( DoubleClickHdl, SvtFileView*, bool );
    DECL_LINK( SelectHdl, SvtFileView*, void );

    DECL_LINK( FileNameGetFocusHdl, Control&, void );
    DECL_LINK( FileNameModifyHdl, Edit&, void );
    DECL_LINK( FileNameGetFocusHdl, weld::Widget&, void );
    DECL_LINK( FileNameModifyHdl, weld::Entry&, void );

    DECL_LINK( SplitHdl, Splitter*, void );

    DECL_LINK( SelectFilterHdl, ListBox&, void );
    DECL_LINK( SelectFilterHdl, weld::ComboBox&, void );

    DECL_LINK( TreeSelectHdl, SvTreeListBox*, void );
    DECL_LINK( TreeSelectHdl, weld::TreeView&, void );

    DECL_LINK( SelectBreadcrumbHdl, Breadcrumb *, void );

    DECL_LINK( NewFolderHdl, Button*, void );
    DECL_LINK( IconViewHdl, Button*, void );
    DECL_LINK( ListViewHdl, Button*, void );
    DECL_LINK( NewFolderHdl, weld::Button&, void );
    DECL_LINK( IconViewHdl, weld::Button&, void );
    DECL_LINK( ListViewHdl, weld::Button&, void );

    DECL_LINK( OkHdl, Button*, void );
    DECL_LINK( CancelHdl, Button*, void );
    DECL_LINK( OkHdl, weld::Button&, void );
    DECL_LINK( CancelHdl, weld::Button&, void );
};

#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx
index 6f4cb42..830577f 100644
--- a/fpicker/source/office/asyncfilepicker.hxx
+++ b/fpicker/source/office/asyncfilepicker.hxx
@@ -24,7 +24,6 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.h>
#include <salhelper/simplereferenceobject.hxx>
#include <vcl/vclptr.hxx>

class SvtFileView;
class SvtFileDialog_Base;
@@ -47,8 +46,8 @@

    private:
        Action                      m_eAction;
        VclPtr<SvtFileView>         m_pView;
        VclPtr<SvtFileDialog_Base>  m_pDialog;
        SvtFileView*                m_pView;
        SvtFileDialog_Base*         m_pDialog;
        OUString                    m_sURL;
        OUString                    m_sFileName;
        bool                        m_bRunning;
diff --git a/fpicker/source/office/autocmpledit.cxx b/fpicker/source/office/autocmpledit.cxx
index d7b5f63..f6dddd0 100644
--- a/fpicker/source/office/autocmpledit.cxx
+++ b/fpicker/source/office/autocmpledit.cxx
@@ -11,11 +11,20 @@
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>

AutocompleteEdit::AutocompleteEdit( vcl::Window* pParent )
    : Edit( pParent )
    , m_nCurrent( 0 )
AutocompleteEdit::AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry)
    : m_xEntry(std::move(xEntry))
    , m_nCurrent(0)
{
    SetAutocompleteHdl(LINK(this, AutocompleteEdit, AutoCompleteHdl_Impl));
    m_xEntry->connect_changed(LINK(this, AutocompleteEdit, ChangedHdl));

    m_aChangedIdle.SetInvokeHandler(LINK(this, AutocompleteEdit, TryAutoComplete));
    m_aChangedIdle.SetDebugName("fpicker::AutocompleteEdit m_aChangedIdle");
}

IMPL_LINK_NOARG(AutocompleteEdit, ChangedHdl, weld::Entry&, void)
{
    m_aChangeHdl.Call(*m_xEntry);
    m_aChangedIdle.Start(); //launch this to happen on idle after cursor position will have been set
}

void AutocompleteEdit::AddEntry( const OUString& rEntry )
@@ -29,18 +38,16 @@
    m_aMatching.clear();
}

IMPL_LINK_NOARG(AutocompleteEdit, AutoCompleteHdl_Impl, Edit&, void)
IMPL_LINK_NOARG(AutocompleteEdit, TryAutoComplete, Timer *, void)
{
    if( Application::AnyInput( VclInputFlags::KEYBOARD ) )
    OUString aCurText = m_xEntry->get_text();

    int nStartPos, nEndPos;
    m_xEntry->get_selection_bounds(nStartPos, nEndPos);
    if (std::max(nStartPos, nEndPos) != aCurText.getLength())
        return;

    OUString aCurText = GetText();
    Selection aSelection( GetSelection() );

    if( aSelection.Max() != aCurText.getLength() )
        return;

    sal_uInt16 nLen = static_cast<sal_uInt16>(aSelection.Min());
    auto nLen = std::min(nStartPos, nEndPos);
    aCurText = aCurText.copy( 0, nLen );
    if( aCurText.isEmpty() )
        return;
@@ -50,11 +57,9 @@
        if( Match( aCurText ) )
        {
            m_nCurrent = 0;
            SetText( m_aMatching[0] );
            sal_uInt16 nNewLen = m_aMatching[0].getLength();

            Selection aSel( nLen, nNewLen );
            SetSelection( aSel );
            m_xEntry->set_text(m_aMatching[0]);
            auto nNewLen = m_aMatching[0].getLength();
            m_xEntry->select_region(nLen, nNewLen);
        }
    }
}
@@ -77,6 +82,7 @@
    return bRet;
}

#if 0
bool AutocompleteEdit::PreNotify( NotifyEvent& rNEvt )
{
    if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
@@ -103,5 +109,6 @@

    return Edit::PreNotify( rNEvt );
}
#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/autocmpledit.hxx b/fpicker/source/office/autocmpledit.hxx
index 89b431e..03e05bf 100644
--- a/fpicker/source/office/autocmpledit.hxx
+++ b/fpicker/source/office/autocmpledit.hxx
@@ -10,22 +10,38 @@
#ifndef INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
#define INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX

#include <vcl/edit.hxx>
#include <vcl/idle.hxx>
#include <vcl/weld.hxx>
#include <vector>

class AutocompleteEdit : public Edit
class AutocompleteEdit
{
private:
    std::unique_ptr<weld::Entry> m_xEntry;

    std::vector< OUString > m_aEntries;
    std::vector< OUString > m_aMatching;
    std::vector< OUString >::size_type m_nCurrent;
    Idle m_aChangedIdle;
    Link<weld::Entry&, void> m_aChangeHdl;

    DECL_LINK(AutoCompleteHdl_Impl, Edit&, void);
    DECL_LINK(ChangedHdl, weld::Entry&, void);
    DECL_LINK(TryAutoComplete, Timer*, void);

    bool Match( const OUString& rText );
    bool PreNotify( NotifyEvent& rNEvt ) override;

public:
    AutocompleteEdit( vcl::Window* pParent );
    AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry);

    void show() { m_xEntry->show(); }
    void set_sensitive(bool bSensitive) { m_xEntry->set_sensitive(bSensitive); }
    OUString get_text() const { return m_xEntry->get_text(); }
    void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
    void grab_focus() { m_xEntry->grab_focus(); }
    void select_region(int nStartPos, int nEndPos) { m_xEntry->select_region(nStartPos, nEndPos); }

    void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aChangeHdl = rLink; }
    void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_xEntry->connect_focus_in(rLink); }

    void AddEntry( const OUString& rEntry );
    void ClearEntries();
diff --git a/fpicker/source/office/breadcrumb.cxx b/fpicker/source/office/breadcrumb.cxx
index 0396647..1216a54 100644
--- a/fpicker/source/office/breadcrumb.cxx
+++ b/fpicker/source/office/breadcrumb.cxx
@@ -8,76 +8,39 @@
 */

#include <tools/urlobj.hxx>
#include <vcl/fixedhyper.hxx>
#include <vcl/svapp.hxx>
#include "breadcrumb.hxx"

class CustomLink : public FixedHyperlink
Breadcrumb::Breadcrumb(weld::Container* pParent)
    : m_pParent(pParent)
    , m_nMaxWidth(m_pParent->get_preferred_size().Width())
{
public:
    CustomLink( vcl::Window* pParent, WinBits nWinStyle )
    : FixedHyperlink( pParent, nWinStyle )
    {
        vcl::Font aFont = GetControlFont( );
        aFont.SetUnderline( LINESTYLE_NONE );
        SetControlFont( aFont );
    }

protected:
    virtual void MouseMove( const MouseEvent& rMEvt ) override
    {
        // changes the style if the control is enabled
        if ( !rMEvt.IsLeaveWindow() && IsEnabled() )
        {
            vcl::Font aFont = GetControlFont( );
            aFont.SetUnderline( LINESTYLE_SINGLE );
            SetControlFont( aFont );
        }
        else
        {
            vcl::Font aFont = GetControlFont( );
            aFont.SetUnderline( LINESTYLE_NONE );
            SetControlFont( aFont );
        }

        FixedHyperlink::MouseMove( rMEvt );
    }
};

Breadcrumb::Breadcrumb( vcl::Window* pParent ) : VclHBox( pParent )
{
    m_pParent->connect_size_allocate(LINK(this, Breadcrumb, SizeAllocHdl));
    m_eMode = SvtBreadcrumbMode::ONLY_CURRENT_PATH;
    set_spacing( SPACING );
    appendField(); // root
}

IMPL_LINK(Breadcrumb, SizeAllocHdl, const Size&, rSize, void)
{
    m_nMaxWidth = rSize.Width();
}

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

void Breadcrumb::dispose()
{
    for( std::vector<VclPtr<FixedHyperlink>>::size_type i = 0; i < m_aLinks.size(); i++ )
    {
        m_aSeparators[i].disposeAndClear();
        m_aLinks[i].disposeAndClear();
    }

    VclHBox::dispose();
    m_pParent->connect_size_allocate(Link<const Size&, void>());
}

void Breadcrumb::EnableFields( bool bEnable )
{
    VclHBox::Enable( bEnable );
    if( bEnable )
    {
        INetURLObject aURL( m_aCurrentURL );
        int nSegments = aURL.getSegmentCount();
        m_aLinks[nSegments]->Enable( false );
        m_aSegments[nSegments]->m_xLink->set_sensitive(false);
    }
}

void Breadcrumb::SetClickHdl( const Link<Breadcrumb*,void>& rLink )
void Breadcrumb::connect_clicked( const Link<Breadcrumb*,void>& rLink )
{
    m_aClickHdl = rLink;
}
@@ -92,13 +55,13 @@
    m_sRootName = rURL;

    // we changed root - clear all fields
    for( std::vector<VclPtr<FixedHyperlink>>::size_type i = 1; i < m_aLinks.size(); i++ )
    for (size_t i = 1; i < m_aSegments.size(); ++i)
    {
        m_aLinks[i]->SetText( "" );
        m_aSegments[i]->m_xLink->set_label("");

        m_aLinks[i]->Hide();
        m_aSeparators[i]->Hide();
        m_aLinks[i]->Enable();
        m_aSegments[i]->m_xLink->hide();
        m_aSegments[i]->m_xSeparator->hide();
        m_aSegments[i]->m_xLink->set_sensitive(true);
    }
}

@@ -130,16 +93,16 @@
    bool bClear = ( m_eMode == SvtBreadcrumbMode::ONLY_CURRENT_PATH );

    // root field

    m_aLinks[0]->SetText( m_sRootName );
    m_aLinks[0]->Enable();
    m_aLinks[0]->SetURL( sRootPath );
    m_aSegments[0]->m_xLink->set_label( m_sRootName );
    m_aSegments[0]->m_xLink->set_sensitive(true);
    m_aSegments[0]->m_xLink->set_uri(sRootPath);
    m_aUris[m_aSegments[0]->m_xLink.get()] = sRootPath;

    // fill the other fields

    for( unsigned int i = 1; i < static_cast<unsigned int>(nSegments) + 1; i++ )
    {
        if( i >= m_aLinks.size() )
        if( i >= m_aSegments.size() )
            appendField();

        unsigned int nEnd = sPath.indexOf( '/', nPos + 1 );
@@ -147,37 +110,33 @@

        if( m_eMode == SvtBreadcrumbMode::ALL_VISITED )
        {
            if( m_aLinks[i]->GetText() != sLabel )
            if( m_aSegments[i]->m_xLink->get_label() != sLabel )
                bClear = true;
        }

        m_aLinks[i]->SetText( sLabel );
        m_aLinks[i]->SetURL( sRootPath + sPath.copy( 0, nEnd ) );
        m_aLinks[i]->Hide();
        m_aLinks[i]->Enable();
        m_aSegments[i]->m_xLink->set_label( sLabel );
        m_aUris[m_aSegments[i]->m_xLink.get()] = sRootPath + sPath.copy(0, nEnd);
        m_aSegments[i]->m_xLink->hide();
        m_aSegments[i]->m_xLink->set_sensitive(true);

        m_aSeparators[i]->Hide();
        m_aSegments[i]->m_xSeparator->hide();

        nPos = nEnd;
    }

    // clear unused fields

    for( std::vector<VclPtr<FixedHyperlink>>::size_type i = nSegments + 1; i < m_aLinks.size(); i++ )
    for (size_t i = nSegments + 1; i < m_aSegments.size(); i++ )
    {
        if( bClear )
            m_aLinks[i]->SetText( "" );
            m_aSegments[i]->m_xLink->set_label( "" );

        m_aLinks[i]->Hide();
        m_aSeparators[i]->Hide();
        m_aLinks[i]->Enable();
        m_aSegments[i]->m_xLink->hide();
        m_aSegments[i]->m_xSeparator->hide();
        m_aSegments[i]->m_xLink->set_sensitive(true);
    }

    // show fields

    Resize();
    unsigned int nMaxWidth = GetSizePixel().Width();
    unsigned int nSeparatorWidth = m_aSeparators[0]->GetSizePixel().Width();
    unsigned int nSeparatorWidth = m_aSegments[0]->m_xSeparator->get_preferred_size().Width();
    unsigned int nCurrentWidth = 0;
    unsigned int nLastVisible = nSegments;

@@ -195,9 +154,9 @@
        {
            unsigned int nIndex = nSegments - i;

            if( showField( nIndex, nMaxWidth - nCurrentWidth ) )
            if( showField( nIndex, m_nMaxWidth - nCurrentWidth ) )
            {
                nCurrentWidth += m_aLinks[nIndex]->GetSizePixel().Width()
                nCurrentWidth += m_aSegments[nIndex]->m_xLink->get_preferred_size().Width()
                                + nSeparatorWidth + 2*SPACING;
            }
            else
@@ -205,27 +164,27 @@
                // label is too long
                if( nSegments != 0 )
                {
                    m_aLinks[0]->SetText( "..." );
                    m_aLinks[0]->Enable( false );
                    m_aSegments[0]->m_xLink->set_label("...");
                    m_aSegments[0]->m_xLink->set_sensitive(false);
                }
                bLeft = false;
            }
        }

        if( nSegments + i == static_cast<int>(m_aLinks.size()) )
        if( nSegments + i == static_cast<int>(m_aSegments.size()) )
            bRight = false;

        if( i != 0 && bRight )
        {
            unsigned int nIndex = nSegments + i;

            if( m_aLinks[nIndex]->GetText().isEmpty() )
            if( m_aSegments[nIndex]->m_xLink->get_label().isEmpty() )
            {
                bRight = false;
            }
            else if( showField( nIndex, nMaxWidth - nCurrentWidth ) )
            else if( showField( nIndex, m_nMaxWidth - nCurrentWidth ) )
            {
                nCurrentWidth += m_aLinks[nIndex]->GetSizePixel().Width()
                nCurrentWidth += m_aSegments[nIndex]->m_xLink->get_preferred_size().Width()
                                + nSeparatorWidth + 3*SPACING;
                nLastVisible = nIndex;
            }
@@ -239,10 +198,10 @@
    }

    // current dir should be inactive
    m_aLinks[nSegments]->Enable( false );
    m_aSegments[nSegments]->m_xLink->set_sensitive(false);

    // hide last separator
    m_aSeparators[nLastVisible]->Hide();
    m_aSegments[nLastVisible]->m_xSeparator->hide();
}

void Breadcrumb::SetMode( SvtBreadcrumbMode eMode )
@@ -252,30 +211,29 @@

void Breadcrumb::appendField()
{
    m_aLinks.push_back( VclPtr< CustomLink >::Create( this, WB_TABSTOP ) );
    m_aLinks[m_aLinks.size() - 1]->Hide();
    m_aLinks[m_aLinks.size() - 1]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) );

    m_aSeparators.push_back( VclPtr< FixedText >::Create( this ) );
    m_aSeparators[m_aLinks.size() - 1]->SetText( ">" );
    m_aSeparators[m_aLinks.size() - 1]->Hide();
    m_aSegments.emplace_back(std::make_unique<BreadcrumbPath>(m_pParent));
    size_t nIndex = m_aSegments.size() - 1;
    m_aSegments[nIndex]->m_xLink->hide();
    m_aSegments[nIndex]->m_xLink->connect_clicked( LINK( this, Breadcrumb, ClickLinkHdl ) );
    m_aSegments[nIndex]->m_xSeparator->set_label( ">" );
    m_aSegments[nIndex]->m_xSeparator->hide();
}

bool Breadcrumb::showField( unsigned int nIndex, unsigned int nWidthMax )
{
    m_aLinks[nIndex]->Show();
    m_aSeparators[nIndex]->Show();
    m_aSegments[nIndex]->m_xLink->show();
    m_aSegments[nIndex]->m_xSeparator->show();

    unsigned int nSeparatorWidth = m_aSeparators[0]->GetSizePixel().Width();
    unsigned int nWidth = m_aLinks[nIndex]->GetSizePixel().Width()
    unsigned int nSeparatorWidth = m_aSegments[0]->m_xSeparator->get_preferred_size().Width();
    unsigned int nWidth = m_aSegments[nIndex]->m_xLink->get_preferred_size().Width()
            + nSeparatorWidth + 3*SPACING;

    if( nWidth > nWidthMax )
    {
        if( nIndex != 0 )
        {
            m_aLinks[nIndex]->Hide();
            m_aSeparators[nIndex]->Hide();
            m_aSegments[nIndex]->m_xLink->hide();
            m_aSegments[nIndex]->m_xSeparator->hide();
        }

        return false;
@@ -284,10 +242,18 @@
    return true;
}

IMPL_LINK( Breadcrumb, ClickLinkHdl, FixedHyperlink&, rLink, void )
IMPL_LINK( Breadcrumb, ClickLinkHdl, weld::LinkButton&, rLink, void )
{
    m_sClickedURL = rLink.GetURL();
    m_sClickedURL = m_aUris[&rLink];
    m_aClickHdl.Call( this );
}

BreadcrumbPath::BreadcrumbPath(weld::Container* pContainer)
    : m_xBuilder(Application::CreateBuilder(pContainer, "fps/ui/breadcrumb.ui"))
    , m_xContainer(m_xBuilder->weld_container("container"))
    , m_xLink(m_xBuilder->weld_link_button("link"))
    , m_xSeparator(m_xBuilder->weld_label("label"))
{
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/breadcrumb.hxx b/fpicker/source/office/breadcrumb.hxx
index 0fe53c4..784ef32 100644
--- a/fpicker/source/office/breadcrumb.hxx
+++ b/fpicker/source/office/breadcrumb.hxx
@@ -10,12 +10,10 @@
#ifndef INCLUDED_SVTOOLS_BREADCRUMB_HXX
#define INCLUDED_SVTOOLS_BREADCRUMB_HXX

#include <vcl/layout.hxx>

#include <vcl/weld.hxx>
#include <map>
#include <vector>

class FixedHyperlink;

#define SPACING 6

enum SvtBreadcrumbMode
@@ -24,40 +22,50 @@
    ALL_VISITED = 1
};

class CustomLink;

class Breadcrumb : public VclHBox
struct BreadcrumbPath
{
    private:
        std::vector< VclPtr< CustomLink > > m_aLinks;
        std::vector< VclPtr< FixedText > > m_aSeparators;
    BreadcrumbPath(weld::Container* pParent);
    std::unique_ptr<weld::Builder> m_xBuilder;
    std::unique_ptr<weld::Container> m_xContainer;
    std::unique_ptr<weld::LinkButton> m_xLink;
    std::unique_ptr<weld::Label> m_xSeparator;
};

        OUString m_sRootName;
        OUString m_sClickedURL;
        OUString m_aCurrentURL;
class Breadcrumb
{
private:
    weld::Container* m_pParent;
    int m_nMaxWidth;

        SvtBreadcrumbMode m_eMode;
    std::vector<std::unique_ptr<BreadcrumbPath>> m_aSegments;
    std::map<weld::LinkButton*, OUString> m_aUris;

        Link<Breadcrumb*,void> m_aClickHdl;
    OUString m_sRootName;
    OUString m_sClickedURL;
    OUString m_aCurrentURL;

        void appendField();
        bool showField( unsigned int nIndex, unsigned int nWidthMax );
    SvtBreadcrumbMode m_eMode;

        DECL_LINK( ClickLinkHdl, FixedHyperlink&, void );
    Link<Breadcrumb*,void> m_aClickHdl;

    public:
        Breadcrumb( vcl::Window* pParent );
        virtual ~Breadcrumb() override;
    void appendField();
    bool showField( unsigned int nIndex, unsigned int nWidthMax );

        void dispose() override;
        void EnableFields( bool bEnable );
    DECL_LINK(SizeAllocHdl, const Size&, void);
    DECL_LINK(ClickLinkHdl, weld::LinkButton&, void);

        void SetClickHdl( const Link<Breadcrumb*,void>& rLink );
        const OUString& GetHdlURL() const;
public:
    Breadcrumb(weld::Container* pParent);
    ~Breadcrumb();

        void SetRootName( const OUString& rURL );
        void SetURL( const OUString& rURL );
        void SetMode( SvtBreadcrumbMode eMode );
    void EnableFields( bool bEnable );

    void connect_clicked( const Link<Breadcrumb*,void>& rLink );
    const OUString& GetHdlURL() const;

    void SetRootName( const OUString& rURL );
    void SetURL( const OUString& rURL );
    void SetMode( SvtBreadcrumbMode eMode );
};

#endif
diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx
index b52d4ed..2b2413b 100644
--- a/fpicker/source/office/commonpicker.cxx
+++ b/fpicker/source/office/commonpicker.cxx
@@ -52,7 +52,6 @@
    OCommonPicker::OCommonPicker()
        :OCommonPicker_Base( m_aMutex )
        ,OPropertyContainer( GetBroadcastHelper() )
        ,m_pDlg( nullptr )
        ,m_nCancelEvent( nullptr )
        ,m_bExecuting( false )
    {
@@ -105,7 +104,7 @@
        {
            // set the title
            if ( !m_aTitle.isEmpty() )
                m_pDlg->SetText( m_aTitle );
                m_xDlg->set_title(m_aTitle);
        }
    }

@@ -121,11 +120,11 @@

        {
            ::osl::MutexGuard aOwnGuard( m_aMutex );
            if ( m_bExecuting && m_pDlg )
                m_pDlg->EndDialog();
            if ( m_bExecuting && m_xDlg )
                m_xDlg->response(RET_CANCEL);
        }

        m_pDlg.disposeAndClear();
        m_xDlg.reset();
        m_xWindow = nullptr;
        m_xDialogParent = nullptr;
    }
@@ -137,9 +136,7 @@
        disposeComponent( m_xParentListenerAdapter );
    }


    // XEventListener

    void SAL_CALL OCommonPicker::disposing( const EventObject& _rSource )
    {
        SolarMutexGuard aGuard;
@@ -150,11 +147,16 @@
        {
            stopWindowListening();

            if ( !bDialogDying )    // it's the parent which is dying -> delete the dialog
                m_pDlg.disposeAndClear();
            else
                m_pDlg.clear();
            SAL_WARN_IF(bDialogDying && m_bExecuting, "fpicker.office", "unexpected disposing before response" );

            // it's the parent which is dying -> delete the dialog
            {
                ::osl::MutexGuard aOwnGuard(m_aMutex);
                if (m_bExecuting && m_xDlg)
                    m_xDlg->response(RET_CANCEL);
            }

            m_xDlg.reset();
            m_xWindow = nullptr;
            m_xDialogParent = nullptr;
        }
@@ -164,9 +166,7 @@
        }
    }


    // property set related methods

    ::cppu::IPropertyArrayHelper* OCommonPicker::createArrayHelper( ) const
    {
        Sequence< Property > aProps;
@@ -174,50 +174,51 @@
        return new cppu::OPropertyArrayHelper( aProps );
    }


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


    Reference< XPropertySetInfo > SAL_CALL OCommonPicker::getPropertySetInfo(  )
    {
        return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
    }


    void SAL_CALL OCommonPicker::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
    void SAL_CALL OCommonPicker::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue)
    {
        OPropertyContainer::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
        OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, rValue);

        // if the HelpURL changed, forward this to the dialog
        if ( PROPERTY_ID_HELPURL == _nHandle )
            if ( m_pDlg )
                OControlAccess::setHelpURL( m_pDlg, m_sHelpURL, false );
        if (PROPERTY_ID_HELPURL == nHandle && m_xDlg)
        {
            ::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
            aAccess.setHelpURL(m_xDlg->getDialog(), m_sHelpURL);
        }
    }


    bool OCommonPicker::createPicker()
    {
        if ( !m_pDlg )
        if ( !m_xDlg )
        {
            m_pDlg.reset( implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) ) );
            SAL_WARN_IF( !m_pDlg, "fpicker.office", "OCommonPicker::createPicker: invalid dialog returned!" );
            m_xDlg = implCreateDialog(Application::GetFrameWeld(m_xDialogParent));
            SAL_WARN_IF( !m_xDlg, "fpicker.office", "OCommonPicker::createPicker: invalid dialog returned!" );

            if ( m_pDlg )
            if ( m_xDlg )
            {
                weld::Dialog* pDlg = m_xDlg->getDialog();

                ::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
                // synchronize the help id of the dialog without help URL property
                if ( !m_sHelpURL.isEmpty() )
                {   // somebody already set the help URL while we had no dialog yet
                    OControlAccess::setHelpURL( m_pDlg, m_sHelpURL, false );
                    aAccess.setHelpURL(pDlg, m_sHelpURL);
                }
                else
                {
                    m_sHelpURL = OControlAccess::getHelpURL( m_pDlg, false );
                    m_sHelpURL = aAccess.getHelpURL(pDlg);
                }

                m_xWindow = VCLUnoHelper::GetInterface( m_pDlg );
                m_xWindow = pDlg->GetXWindow();

                // add as event listener to the window
                OSL_ENSURE( m_xWindow.is(), "OCommonPicker::createFileDialog: invalid window component!" );
@@ -227,10 +228,14 @@
                        // the adapter will add itself as listener, and forward notifications
                }

                // _and_ add as event listener to the parent - in case the parent is destroyed
                // before we are disposed, our disposal would access dead VCL windows then...
                m_xDialogParent = VCLUnoHelper::GetInterface( m_pDlg->GetParent() );
                OSL_ENSURE( m_xDialogParent.is() || !m_pDlg->GetParent(), "OCommonPicker::createFileDialog: invalid window component (the parent this time)!" );
                VclPtr<vcl::Window> xVclDialog(VCLUnoHelper::GetWindow(m_xWindow));
                if (xVclDialog) // this block is quite possibly unnecessary by now
                {
                    // _and_ add as event listener to the parent - in case the parent is destroyed
                    // before we are disposed, our disposal would access dead VCL windows then...
                    m_xDialogParent = VCLUnoHelper::GetInterface(xVclDialog->GetParent());
                    OSL_ENSURE(m_xDialogParent.is() || !xVclDialog->GetParent(), "OCommonPicker::createFileDialog: invalid window component (the parent this time)!");
                }
                if ( m_xDialogParent.is() )
                {
                    m_xParentListenerAdapter = new OWeakEventListenerAdapter( this, m_xDialogParent );
@@ -239,12 +244,10 @@
            }
        }

        return nullptr != m_pDlg;
        return nullptr != m_xDlg;
    }


    // XControlAccess functions

    void SAL_CALL OCommonPicker::setControlProperty( const OUString& aControlName, const OUString& aControlProperty, const Any& aValue )
    {
        checkAlive();
@@ -252,12 +255,11 @@
        SolarMutexGuard aGuard;
        if ( createPicker() )
        {
            ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
            ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
            aAccess.setControlProperty( aControlName, aControlProperty, aValue );
        }
    }


    Any SAL_CALL OCommonPicker::getControlProperty( const OUString& aControlName, const OUString& aControlProperty )
    {
        checkAlive();
@@ -265,16 +267,14 @@
        SolarMutexGuard aGuard;
        if ( createPicker() )
        {
            ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
            ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
            return aAccess.getControlProperty( aControlName, aControlProperty );
        }

        return Any();
    }


    // XControlInformation functions

    Sequence< OUString > SAL_CALL OCommonPicker::getSupportedControls(  )
    {
        checkAlive();
@@ -282,14 +282,13 @@
        SolarMutexGuard aGuard;
        if ( createPicker() )
        {
            ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
            ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
            return aAccess.getSupportedControls( );
        }

        return Sequence< OUString >();
    }


    sal_Bool SAL_CALL OCommonPicker::isControlSupported( const OUString& aControlName )
    {
        checkAlive();
@@ -303,7 +302,6 @@
        return false;
    }


    Sequence< OUString > SAL_CALL OCommonPicker::getSupportedControlProperties( const OUString& aControlName )
    {
        checkAlive();
@@ -311,14 +309,13 @@
        SolarMutexGuard aGuard;
        if ( createPicker() )
        {
            ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
            ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
            return aAccess.getSupportedControlProperties( aControlName );
        }

        return Sequence< OUString >();
    }


    sal_Bool SAL_CALL OCommonPicker::isControlPropertySupported( const OUString& aControlName, const OUString& aControlProperty )
    {
        checkAlive();
@@ -326,7 +323,7 @@
        SolarMutexGuard aGuard;
        if ( createPicker() )
        {
            ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() );
            ::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
            return aAccess.isControlPropertySupported( aControlName, aControlProperty );
        }

@@ -387,11 +384,10 @@
        m_nCancelEvent = Application::PostUserEvent( LINK( this, OCommonPicker, OnCancelPicker ) );
    }


    IMPL_LINK_NOARG(OCommonPicker, OnCancelPicker, void*, void)
    {
        // By definition, the solar mutex is locked when we arrive here. Note that this
        // is important, as for instance the consistency of m_pDlg depends on this mutex.
        // is important, as for instance the consistency of m_xDlg depends on this mutex.
        ::osl::MutexGuard aGuard( m_aMutex );
        m_nCancelEvent = nullptr;

@@ -401,14 +397,12 @@
            // being executed at this time.
            return;

        OSL_ENSURE( getDialog(), "OCommonPicker::OnCancelPicker: executing, but no dialog!" );
        if ( getDialog() )
            getDialog()->EndDialog();
        OSL_ENSURE( m_xDlg, "OCommonPicker::OnCancelPicker: executing, but no dialog!" );
        if (m_xDlg)
            m_xDlg->response(RET_CANCEL);
    }


    // XInitialization functions

    void SAL_CALL OCommonPicker::initialize( const Sequence< Any >& _rArguments )
    {
        checkAlive();
@@ -462,7 +456,6 @@
        }
    }


    bool OCommonPicker::implHandleInitializationArgument( const OUString& _rName, const Any& _rValue )
    {
        bool bKnown = true;
@@ -470,15 +463,13 @@
        {
            m_xDialogParent.clear();
            OSL_VERIFY( _rValue >>= m_xDialogParent );
            OSL_ENSURE( VCLUnoHelper::GetWindow( m_xDialogParent ), "OCommonPicker::implHandleInitializationArgument: invalid parent window given!" );
            OSL_ENSURE( m_xDialogParent.is(), "OCommonPicker::implHandleInitializationArgument: invalid parent window given!" );
        }
        else
            bKnown = false;
        return bKnown;
    }


}   // namespace svt


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx
index 1a379a2..e4c5e71 100644
--- a/fpicker/source/office/commonpicker.hxx
+++ b/fpicker/source/office/commonpicker.hxx
@@ -31,10 +31,9 @@
#include <comphelper/proparrhlp.hxx>
#include <comphelper/uno3.hxx>
#include <tools/link.hxx>
#include <vcl/vclptr.hxx>

class SvtFileDialog_Base;
namespace vcl { class Window; }
namespace weld { class Window; }
struct ImplSVEvent;

namespace svt
@@ -61,7 +60,6 @@
        css::uno::Reference< css::awt::XWindow >                  m_xWindow;
        // </properties>

        VclPtr<SvtFileDialog_Base>      m_pDlg;
        ImplSVEvent *                   m_nCancelEvent;
        bool                            m_bExecuting;

@@ -75,7 +73,7 @@
        OUString     m_aDisplayDirectory;

    protected:
        SvtFileDialog_Base*  getDialog() { return m_pDlg; }
        std::shared_ptr<SvtFileDialog_Base> m_xDlg;

        const    ::cppu::OBroadcastHelper&   GetBroadcastHelper() const  { return OCommonPicker_Base::rBHelper; }
        ::cppu::OBroadcastHelper&   GetBroadcastHelper()        { return OCommonPicker_Base::rBHelper; }
@@ -89,7 +87,7 @@
        // overridables

        // will be called with locked SolarMutex
        virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) = 0;
        virtual std::unique_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) = 0;
        virtual sal_Int16       implExecutePicker( ) = 0;
            // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...

diff --git a/fpicker/source/office/contentenumeration.hxx b/fpicker/source/office/contentenumeration.hxx
index 2b0be7d..bb906ce 100644
--- a/fpicker/source/office/contentenumeration.hxx
+++ b/fpicker/source/office/contentenumeration.hxx
@@ -45,9 +45,11 @@
    public:
        OUString    maType;
        OUString    maTargetURL;
        OUString    maDisplayText;
        OUString    maDisplayName;
        OUString    maDisplaySize;
        OUString    maDisplayDate;
        DateTime    maModDate;
        Image       maImage;
        OUString    maImage;
        sal_Int64   maSize;
        bool        mbIsFolder;
        bool        mbIsVolume;
diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx
index 719ea92..442e8327 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -17,55 +17,50 @@
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <vcl/treelistbox.hxx>
#include <sal/config.h>
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <vcl/treelistentry.hxx>
#include <svtools/svtresid.hxx>
#include <svtools/imagemgr.hxx>
#include <svtools/querydelete.hxx>
#include <vcl/event.hxx>
#include <vcl/headbar.hxx>
#include <vcl/svtabbx.hxx>
#include <svtools/strings.hrc>
#include <bitmaps.hlst>
#include <toolkit/helper/vclunohelper.hxx>
#include "contentenumeration.hxx"
#include <vcl/AccessibleBrowseBoxObjType.hxx>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <vcl/waitobj.hxx>
#include <vcl/settings.hxx>
#include <com/sun/star/ucb/XCommandInfo.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>

#include <algorithm>
#include <vector>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <rtl/math.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
#include <salhelper/timer.hxx>
#include <vcl/svapp.hxx>
#include <vcl/dialog.hxx>
#include <svtools/urlfilter.hxx>
#include <unotools/collatorwrapper.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/intlwrapper.hxx>
#include <unotools/syslocale.hxx>
#include <svtools/urlfilter.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <vcl/svapp.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
#include <vcl/settings.hxx>
#include <vcl/timer.hxx>
#include <memory>
#include "fileview.hxx"
#include "iconview.hxx"

using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
@@ -85,7 +80,6 @@
#define COLUMN_SIZE         3
#define COLUMN_DATE         4

#define ROW_HEIGHT                17    // the height of a row has to be a little higher than the bitmap
#define QUICK_SEARCH_TIMEOUT    1500    // time in mSec before the quicksearch string will be reset

enum class FileViewFlags
@@ -120,68 +114,122 @@

}


class ViewTabListBox_Impl : public SvHeaderTabListBox
class ViewTabListBox_Impl
{
private:
    Reference< XCommandEnvironment >    mxCmdEnv;
    std::unique_ptr<VclBuilder> mxBuilder;
    VclPtr<PopupMenu> mxMenu;
    std::unique_ptr<weld::TreeView> mxTreeView;
    std::unique_ptr<weld::TreeIter> mxScratchIter;

    ::osl::Mutex            maMutex;
    VclPtr<HeaderBar>       mpHeaderBar;
    SvtFileView_Impl*       mpParent;
    Timer                   maResetQuickSearch;
    OUString                maQuickSearchText;
    OUString const          msAccessibleDescText;
    OUString const          msFolder;
    OUString const          msFile;
    sal_uInt32              mnSearchIndex;
    bool                    mbResizeDisabled        : 1;
    bool                    mbAutoResize            : 1;
    bool                    mbEnableDelete          : 1;
    bool                    mbEnableDelete;
    bool                    mbEditing;
    bool const              mbShowHeader;
    bool const              mbShowType;

    void            DeleteEntries();
    void            DoQuickSearch( sal_Unicode rChar );
    bool            Kill( const OUString& rURL );

protected:
    virtual bool     DoubleClickHdl() override;
    virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override;

public:
    ViewTabListBox_Impl( vcl::Window* pParentWin, SvtFileView_Impl* pParent, FileViewFlags nFlags );
    virtual ~ViewTabListBox_Impl() override;
    virtual void dispose() override;
    ViewTabListBox_Impl(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel, SvtFileView_Impl* pParent, FileViewFlags nFlags);
    virtual ~ViewTabListBox_Impl();

    virtual void    Resize() override;
    virtual void    KeyInput( const KeyEvent& rKEvt ) override;
    virtual bool    EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) override;
    std::unique_ptr<weld::TreeIter> make_iterator() const { return mxTreeView->make_iterator(); }
    void insert(const OUString &rEntry, const OUString& rId, const OUString& rImage, weld::TreeIter& rIter)
    {
        mxTreeView->insert(nullptr, -1, &rEntry, &rId, nullptr, nullptr, &rImage, false, &rIter);
    }
    void append(const OUString& rId, const OUString& rStr, const OUString& rType, const OUString& rSize, const OUString& rDate, const OUString& rImage)
    {
        mxTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, mxScratchIter.get());
        int nCol = 1;
        if (mbShowType)
            mxTreeView->set_text(*mxScratchIter, rType, nCol++);
        mxTreeView->set_text(*mxScratchIter, rSize, nCol++);
        mxTreeView->set_text(*mxScratchIter, rDate, nCol++);
    }

    void            ClearAll();
    HeaderBar*      GetHeaderBar() const { return mpHeaderBar; }
    void scroll_to_row(const weld::TreeIter& rIter) { mxTreeView->scroll_to_row(rIter); }
    void set_cursor(int nPos) { mxTreeView->set_cursor(nPos); }
    void set_cursor(const weld::TreeIter& rIter) { mxTreeView->set_cursor(rIter); }
    bool get_cursor(weld::TreeIter* pIter) const { return mxTreeView->get_cursor(pIter); }
    bool get_iter_first(weld::TreeIter& rIter) const { return mxTreeView->get_iter_first(rIter); }
    bool get_selected(weld::TreeIter* pIter) const { return mxTreeView->get_selected(pIter); }

    void            EnableAutoResize() { mbAutoResize = true; }
    OUString get_selected_text() const { return mxTreeView->get_selected_text(); }

    void unselect_all() { mxTreeView->unselect_all(); }

    OUString get_id(const weld::TreeIter& rIter) { return mxTreeView->get_id(rIter); }

    void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { mxTreeView->connect_row_activated(rLink); }
    void connect_changed(const Link<weld::TreeView&, void>& rLink) { mxTreeView->connect_changed(rLink); }

    int n_children() const { return mxTreeView->n_children(); }

    void freeze() { mxTreeView->freeze(); }
    void thaw() { mxTreeView->thaw(); }

    void show() { mxTreeView->show(); }
    void hide() { mxTreeView->hide(); }
    bool get_visible() const { return mxTreeView->get_visible(); }

    int count_selected_rows() const { return mxTreeView->count_selected_rows(); }

    void grab_focus() { mxTreeView->grab_focus(); }
    bool has_focus() const { return mxTreeView->has_focus(); }

    void set_help_id(const OString& rHelpId) { mxTreeView->set_help_id(rHelpId); }
    OString get_help_id() const { return mxTreeView->get_help_id(); }

    bool IsEditingActive() const { return mbEditing; }

    void end_editing()
    {
        mxTreeView->end_editing();
        mxTreeView->connect_editing(Link<const weld::TreeIter&, bool>(), Link<const IterString&, bool>());
        mbEditing = false;
    }

    void selected_foreach(const std::function<bool(weld::TreeIter&)>& func)
    {
        mxTreeView->selected_foreach(func);
    }

    weld::TreeView* getWidget() const
    {
        return mxTreeView.get();
    }

    void            clear() { mxTreeView->clear(); }

    void            EnableDelete( bool bEnable ) { mbEnableDelete = bEnable; }
    bool            TypeColumnVisible() const { return mbShowType; }

    const Reference< XCommandEnvironment >& GetCommandEnvironment() const { return mxCmdEnv; }

    DECL_LINK(ResetQuickSearch_Impl, Timer *, void);
    DECL_LINK(CommandHdl, const CommandEvent&, bool);
    DECL_LINK(EditingEntryHdl, const weld::TreeIter&, bool);
    typedef std::pair<const weld::TreeIter&, OUString> IterString;
    DECL_LINK(EditedEntryHdl, const IterString&, bool);
    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);

    virtual VclPtr<PopupMenu> CreateContextMenu() override;
    virtual void        ExecuteContextMenuAction( sal_uInt16 nSelectedPopentry ) override;
    void            ExecuteContextMenuAction(const OString& rSelectedPopentry);
};


//= SvtFileView_Impl


class SvtFileView_Impl  :public ::svt::IEnumerationResultHandler
{
protected:
    VclPtr<SvtFileView>                 mpAntiImpl;
    Link<SvTreeListBox*,void>           m_aSelectHandler;
    SvtFileView*                        m_pAntiImpl;
    Link<SvtFileView*,void>             m_aSelectHandler;

    ::rtl::Reference< ::svt::FileViewContentEnumerator >
                                        m_xContentEnumerator;
@@ -194,12 +242,13 @@

public:

    ::std::vector< std::unique_ptr<SortingData_Impl> >  maContent;
    ::std::vector<std::unique_ptr<SortingData_Impl>>  maContent;
    ::std::vector<std::unique_ptr<SvtContentEntry>> maEntries;
    ::osl::Mutex                        maMutex;

    VclPtr<SvTreeListBox>               mpCurView;
    VclPtr<ViewTabListBox_Impl>         mpView;
    VclPtr<IconView>                    mpIconView;
    weld::Window*           m_pTopLevel;
    std::unique_ptr<ViewTabListBox_Impl> mxView;
    std::unique_ptr<weld::IconView> mxIconView;
    sal_uInt16              mnSortColumn;
    bool                    mbAscending     : 1;
    bool const              mbOnlyFolder    : 1;
@@ -210,14 +259,20 @@

    OUString                maViewURL;
    OUString                maCurrentFilter;
    Image const             maFolderImage;
    OUString                maFolderImage;
    Link<SvtFileView*,void> maOpenDoneLink;
    Link<SvtFileView*,bool> maDoubleClickHandler;

    Reference< XCommandEnvironment >    mxCmdEnv;

    SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommandEnvironment > const & xEnv,
                                              FileViewFlags nFlags,
                                              bool bOnlyFolder );
    virtual                ~SvtFileView_Impl();
    SvtFileView_Impl(SvtFileView* pAntiImpl, weld::Window* pTopLevel,
                     std::unique_ptr<weld::TreeView> xTreeView,
                     std::unique_ptr<weld::IconView> xIconView,
                     Reference < XCommandEnvironment > const & xEnv,
                     FileViewFlags nFlags,
                     bool bOnlyFolder);

    virtual ~SvtFileView_Impl();

    void                    Clear();

@@ -234,17 +289,17 @@
    void                    CancelRunningAsyncAction();

    void                    OpenFolder_Impl();
    static void             ReplaceTabWithString( OUString& aValue );
    static OUString         ReplaceTabWithString(const OUString& rValue);
    void                    CreateDisplayText_Impl();
    void                    SortFolderContent_Impl();

    void                    EntryRemoved( const OUString& rURL );
    void                    EntryRenamed( OUString& rURL,
                                          const OUString& rName );
    OUString                FolderInserted( const OUString& rURL,
    const SortingData_Impl& FolderInserted( const OUString& rURL,
                                            const OUString& rTitle );

    sal_uLong               GetEntryPos( const OUString& rURL );
    int                     GetEntryPos( const OUString& rURL );

    void                    SetViewMode( FileViewMode eMode );

@@ -255,17 +310,46 @@
                                             const OUString& rTitle,
                                             bool bWrapAround );

    void                    SetSelectHandler( const Link<SvTreeListBox*,void>& _rHdl );
    void                    SetSelectHandler( const Link<SvtFileView*,void>& rHdl );
    void                    SetDoubleClickHandler(const Link<SvtFileView*,bool>& rHdl);

    void                    InitSelection();
    void                    ResetCursor();

    inline void             EndEditing();
    void EndEditing()
    {
        if (mxView->IsEditingActive())
            mxView->end_editing();
    }

    void                    onTimeout();
    void onTimeout();

    void grab_focus()
    {
        if (mxView->get_visible())
            mxView->grab_focus();
        else
            mxIconView->grab_focus();
    }

    bool has_focus() const
    {
        return mxView->has_focus() || mxIconView->has_focus();
    }

    int GetSortColumn() const
    {
        sal_uInt16 nOldSortID = mnSortColumn;
        // skip "TYPE"
        if (!mxView->TypeColumnVisible() && nOldSortID != COLUMN_TITLE)
            --nOldSortID;
        return nOldSortID - 1;
    }

protected:
    DECL_LINK( SelectionMultiplexer, SvTreeListBox*, void );
    DECL_LINK(ChangedHdl, weld::TreeView&, void);
    DECL_LINK(SelectionChangedHdl, weld::IconView&, void);
    DECL_LINK(RowActivatedHdl, weld::TreeView&, bool);
    DECL_LINK(ItemActivatedHdl, weld::IconView&, bool);

    // IEnumerationResultHandler overridables
    virtual void        enumerationDone( ::svt::EnumerationResult eResult ) override;
@@ -274,13 +358,7 @@

inline void SvtFileView_Impl::EnableDelete( bool bEnable )
{
    mpView->EnableDelete( bEnable );
}

inline void SvtFileView_Impl::EndEditing()
{
    if ( mpCurView->IsEditingActive() )
        mpCurView->EndEditing();
    mxView->EnableDelete( bEnable );
}

namespace
@@ -330,80 +408,49 @@
    }
}

ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
                                          SvtFileView_Impl* pParent,
                                          FileViewFlags nFlags ) :

    SvHeaderTabListBox( pParentWin, WB_TABSTOP ),

    mpHeaderBar         ( nullptr ),
    mpParent            ( pParent ),
    msAccessibleDescText( SvtResId(STR_SVT_ACC_DESC_FILEVIEW) ),
    msFolder            ( SvtResId(STR_SVT_ACC_DESC_FOLDER) ),
    msFile              ( SvtResId(STR_SVT_ACC_DESC_FILE) ),
    mnSearchIndex       ( 0 ),
    mbResizeDisabled    ( false ),
    mbAutoResize        ( false ),
    mbEnableDelete      ( false ),
    mbShowHeader        ( !(nFlags & FileViewFlags::SHOW_NONE) )
ViewTabListBox_Impl::ViewTabListBox_Impl(std::unique_ptr<weld::TreeView> xTreeView,
                                         weld::Window* pTopLevel,
                                         SvtFileView_Impl* pParent,
                                         FileViewFlags nFlags)
    : mxTreeView(std::move(xTreeView))
    , mxScratchIter(mxTreeView->make_iterator())
    , mpParent( pParent )
    , mnSearchIndex( 0 )
    , mbEnableDelete( false )
    , mbEditing( false )
    , mbShowHeader( !(nFlags & FileViewFlags::SHOW_NONE) )
    , mbShowType(nFlags & FileViewFlags::SHOW_TYPE)
{
    Size aBoxSize = pParentWin->GetSizePixel();
    mpHeaderBar = VclPtr<HeaderBar>::Create( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
    mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), mpHeaderBar->CalcWindowSizePixel() );

    HeaderBarItemBits nBits = HeaderBarItemBits::LEFT | HeaderBarItemBits::CLICKABLE;

    long aTabPositions[] = { 20, 180, 320, 400, 600 };
    SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions, MapUnit::MapPixel);
    SetTabJustify(2, SvTabJustify::AdjustRight); // column "Size"

    mpHeaderBar->InsertItem(COLUMN_TITLE, SvtResId(STR_SVT_FILEVIEW_COLUMN_TITLE), 180, nBits | HeaderBarItemBits::UPARROW);
    std::vector<int> aWidths;
    aWidths.push_back(180);
    if (nFlags & FileViewFlags::SHOW_TYPE)
    {
        mpHeaderBar->InsertItem(COLUMN_TYPE, SvtResId(STR_SVT_FILEVIEW_COLUMN_TYPE), 140, nBits);
    }
    mpHeaderBar->InsertItem(COLUMN_SIZE, SvtResId(STR_SVT_FILEVIEW_COLUMN_SIZE), 80, nBits);
    mpHeaderBar->InsertItem(COLUMN_DATE, SvtResId(STR_SVT_FILEVIEW_COLUMN_DATE), 500, nBits);
        aWidths.push_back(140);
    aWidths.push_back(80);
    mxTreeView->set_column_fixed_widths(aWidths);

    Size aHeadSize = mpHeaderBar->GetSizePixel();
    SetPosSizePixel( Point( 0, aHeadSize.Height() ),
                     Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
    InitHeaderBar( mpHeaderBar );
    SetHighlightRange();
    SetEntryHeight( ROW_HEIGHT );
    if (nFlags & FileViewFlags::MULTISELECTION)
        SetSelectionMode( SelectionMode::Multiple );

    Show();
    if( mbShowHeader )
        mpHeaderBar->Show();
        mxTreeView->set_selection_mode(SelectionMode::Multiple);

    maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT );
    maResetQuickSearch.SetInvokeHandler( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) );

    Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    Reference< XInteractionHandler > xInteractionHandler(
        InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
        InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW);

    mxCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );

    EnableContextMenuHandling();
    mxTreeView->connect_popup_menu(LINK(this, ViewTabListBox_Impl, CommandHdl));
    mxTreeView->connect_key_press(LINK(this, ViewTabListBox_Impl, KeyInputHdl));
}

IMPL_LINK_NOARG(ViewTabListBox_Impl, EditingEntryHdl, const weld::TreeIter&, bool)
{
    return mbEditing;
}

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

void ViewTabListBox_Impl::dispose()
{
    maResetQuickSearch.Stop();

    mxMenu.disposeAndClear();
    mxBuilder.reset();

    mpHeaderBar.disposeAndClear();
    SvHeaderTabListBox::dispose();
}

IMPL_LINK_NOARG(ViewTabListBox_Impl, ResetQuickSearch_Impl, Timer *, void)
@@ -414,47 +461,17 @@
    mnSearchIndex = 0;
}


void ViewTabListBox_Impl::Resize()
IMPL_LINK(ViewTabListBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
{
    SvTabListBox::Resize();
    Size aBoxSize = Control::GetParent()->GetOutputSizePixel();
    if (mbEditing)
        return false;

    if ( mbResizeDisabled || !aBoxSize.Width() )
        return;

    Size aBarSize;
    if ( mbShowHeader )
    {
        aBarSize = mpHeaderBar->GetSizePixel();
        aBarSize.setWidth( mbAutoResize ? aBoxSize.Width() : GetSizePixel().Width() );
        mpHeaderBar->SetSizePixel( aBarSize );
    }

    if ( mbAutoResize )
    {
        mbResizeDisabled = true;
        SetPosSizePixel( Point( 0, aBarSize.Height() ),
                        Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
        mbResizeDisabled = false;
    }
}


void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt )
{
    bool bHandled = false;

    const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
    if ( 0 == rKeyCode.GetModifier() )
    {
        if ( rKeyCode.GetCode() == KEY_RETURN )
        {
            ResetQuickSearch_Impl( nullptr );
            GetDoubleClickHdl().Call( this );
            bHandled = true;
        }
        else if ( ( rKeyCode.GetCode() == KEY_DELETE ) &&
        if ( ( rKeyCode.GetCode() == KEY_DELETE ) &&
                  mbEnableDelete )
        {
            ResetQuickSearch_Impl( nullptr );
@@ -469,131 +486,125 @@
        }
    }

    if ( !bHandled )
    {
    if (!bHandled)
        ResetQuickSearch_Impl( nullptr );
        SvHeaderTabListBox::KeyInput( rKEvt );
    }
    return bHandled;
}


VclPtr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool)
{
    if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
        return false;

    bool bEnableDelete = mbEnableDelete;
    bool bEnableRename = true;

    if ( bEnableDelete || bEnableRename )
    {
        sal_Int32 nSelectedEntries = GetSelectionCount();
        bEnableDelete &= nSelectedEntries > 0;
        bEnableRename &= nSelectedEntries == 1;
    }
    int nCount = 0;
    mxTreeView->selected_foreach([this, &nCount, &bEnableDelete, &bEnableRename](weld::TreeIter& rEntry){
        ++nCount;

    if ( bEnableDelete || bEnableRename )
    {
        SvTreeListEntry* pEntry = FirstSelected();
        while ( pEntry )
        ::ucbhelper::Content aCnt;
        try
        {
            ::ucbhelper::Content aCnt;
            OUString aURL(reinterpret_cast<SvtContentEntry*>(
                mxTreeView->get_id(rEntry).toInt64())->maURL);
            aCnt = ::ucbhelper::Content( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
        }
        catch( Exception const & )
        {
            bEnableDelete = bEnableRename = false;
        }

        if ( bEnableDelete )
        {
            try
            {
                OUString aURL( static_cast< SvtContentEntry * >(
                    pEntry->GetUserData() )->maURL );
                aCnt = ::ucbhelper::Content( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
                Reference< XCommandInfo > aCommands = aCnt.getCommands();
                if ( aCommands.is() )
                    bEnableDelete = aCommands->hasCommandByName( "delete" );
                else
                    bEnableDelete = false;
            }
            catch( Exception const & )
            {
                bEnableDelete = bEnableRename = false;
                bEnableDelete = false;
            }
        }

            if ( bEnableDelete )
        if ( bEnableRename )
        {
            try
            {
                try
                Reference< XPropertySetInfo > aProps = aCnt.getProperties();
                if ( aProps.is() )
                {
                    Reference< XCommandInfo > aCommands = aCnt.getCommands();
                    if ( aCommands.is() )
                        bEnableDelete = aCommands->hasCommandByName( "delete" );
                    else
                        bEnableDelete = false;
                    Property aProp = aProps->getPropertyByName("Title");
                    bEnableRename
                        = !( aProp.Attributes & PropertyAttribute::READONLY );
                }
                catch( Exception const & )
                {
                    bEnableDelete = false;
                }
            }

            if ( bEnableRename )
            {
                try
                {
                    Reference< XPropertySetInfo > aProps = aCnt.getProperties();
                    if ( aProps.is() )
                    {
                        Property aProp = aProps->getPropertyByName("Title");
                        bEnableRename
                            = !( aProp.Attributes & PropertyAttribute::READONLY );
                    }
                    else
                        bEnableRename = false;
                }
                catch( Exception const & )
                {
                else
                    bEnableRename = false;
                }
            }
            catch( Exception const & )
            {
                bEnableRename = false;
            }
        }

            pEntry = ( bEnableDelete || bEnableRename )
                ? NextSelected( pEntry )
                : nullptr;
        bool bStop = !bEnableDelete && !bEnableRename;
        return bStop;
    });

    if (nCount == 0)
        bEnableDelete = false;
    if (nCount != 1)
        bEnableRename = false;

    if (bEnableDelete || bEnableRename)
    {
        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxTreeView.get(), "svt/ui/fileviewmenu.ui"));
        auto xContextMenu = xBuilder->weld_menu("menu");
        xContextMenu->set_visible("delete", bEnableDelete);
        xContextMenu->set_visible("rename", bEnableRename);
        OString sCommand(xContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
        ExecuteContextMenuAction(sCommand);
    }

    return true;
}

void ViewTabListBox_Impl::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
{
    if (rSelectedPopupEntry == "delete")
        DeleteEntries();
    else if (rSelectedPopupEntry == "rename")
    {
        std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator();
        if (mxTreeView->get_selected(xEntry.get()))
        {
            mbEditing = true;

            mxTreeView->connect_editing(LINK(this, ViewTabListBox_Impl, EditingEntryHdl),
                                        LINK(this, ViewTabListBox_Impl, EditedEntryHdl));

            mxTreeView->start_editing(*xEntry);
        }
    }

    if ( bEnableDelete || bEnableRename )
    {
        mxMenu.disposeAndClear();
        mxBuilder.reset(new VclBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svt/ui/fileviewmenu.ui", ""));
        mxMenu.set(mxBuilder->get_menu("menu"));
        mxMenu->EnableItem(mxMenu->GetItemId("delete"), bEnableDelete);
        mxMenu->EnableItem(mxMenu->GetItemId("rename"), bEnableRename);
        mxMenu->RemoveDisabledEntries( true, true );
        return mxMenu;
    }

    return nullptr;
}

void ViewTabListBox_Impl::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
{
    if (nSelectedPopupEntry == mxMenu->GetItemId("delete"))
        DeleteEntries();
    else if (nSelectedPopupEntry == mxMenu->GetItemId("rename"))
        EditEntry( FirstSelected() );
}

void ViewTabListBox_Impl::ClearAll()
{
    for ( sal_uLong i = 0; i < GetEntryCount(); ++i )
        delete static_cast<SvtContentEntry*>(GetEntry(i)->GetUserData());
    Clear();
}


void ViewTabListBox_Impl::DeleteEntries()
{
    short eResult = svtools::QUERYDELETE_YES;
    SvTreeListEntry* pEntry = FirstSelected();
    OUString aURL;

    while ( pEntry )
    {
        SvTreeListEntry *pCurEntry = pEntry;
        pEntry = NextSelected( pEntry );

        if ( pCurEntry->GetUserData() )
            aURL = static_cast<SvtContentEntry*>(pCurEntry->GetUserData())->maURL;

        if ( aURL.isEmpty() )
            continue;
    mxTreeView->selected_foreach([this, &eResult](weld::TreeIter& rCurEntry){
        OUString aURL;
        if (!mxTreeView->get_id(rCurEntry).isEmpty())
            aURL = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64())->maURL;
        if (aURL.isEmpty())
        {
            mxTreeView->unselect(rCurEntry);
            return false;
        }

        bool canDelete = true;
        try
@@ -611,15 +622,18 @@
        }

        if (!canDelete)
            continue; // process next entry
        {
            mxTreeView->unselect(rCurEntry);
            return false; // process next entry
        }

        if ( eResult != svtools::QUERYDELETE_ALL )
        {
            INetURLObject aObj( aURL );
            svtools::QueryDeleteDlg_Impl aDlg(
                GetFrameWeld(), aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset));
                mxTreeView.get(), aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset));

            if ( GetSelectionCount() > 1 )
            if (mxTreeView->count_selected_rows() > 1)
                aDlg.EnableAllButton();

            eResult = aDlg.run();
@@ -630,22 +644,33 @@
        {
            if ( Kill( aURL ) )
            {
                delete static_cast<SvtContentEntry*>(pCurEntry->GetUserData());
                GetModel()->Remove( pCurEntry );
                delete reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64());
                mpParent->EntryRemoved( aURL );
            }
        }
    }

        return false;
    });

    mxTreeView->remove_selection();
}


bool ViewTabListBox_Impl::EditedEntry( SvTreeListEntry* pEntry,
                                 const OUString& rNewText )
IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, bool)
{
    mbEditing = false;

    mxTreeView->connect_editing(Link<const weld::TreeIter&, bool>(), Link<const IterString&, bool>());

    const weld::TreeIter& rEntry = rIterString.first;
    OUString sNewText = rIterString.second;

    if (sNewText.isEmpty())
        return false;

    bool bRet = false;

    OUString aURL;
    SvtContentEntry* pData = static_cast<SvtContentEntry*>(pEntry->GetUserData());
    SvtContentEntry* pData = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rEntry).toInt64());

    if ( pData )
        aURL = pData->maURL;
@@ -680,14 +705,14 @@
        if ( canRename )
        {
            Any aValue;
            aValue <<= rNewText;
            aValue <<= sNewText;
            aContent.setPropertyValue( aPropName, aValue );
            mpParent->EntryRenamed( aURL, rNewText );
            mpParent->EntryRenamed(aURL, sNewText);

            if (pData)
                pData->maURL = aURL;

            pEntry->SetUserData( pData );
            mxTreeView->set_id(rEntry, OUString::number(reinterpret_cast<sal_Int64>(pData)));

            bRet = true;
        }
@@ -699,7 +724,6 @@
    return bRet;
}


void ViewTabListBox_Impl::DoQuickSearch( sal_Unicode rChar )
{
    ::osl::MutexGuard aGuard( maMutex );
@@ -721,64 +745,17 @@
        bFound = mpParent->SearchNextEntry( mnSearchIndex, maQuickSearchText, true );
    }

    if ( bFound )
    if (bFound)
    {
        SvTreeListEntry* pEntry = GetEntry( mnSearchIndex );
        if ( pEntry )
        {
            SelectAll( false );
            Select( pEntry );
            SetCurEntry( pEntry );
            MakeVisible( pEntry );
        }
        mxTreeView->unselect_all();
        mxTreeView->select(mnSearchIndex);
        mxTreeView->set_cursor(mnSearchIndex);
        mxTreeView->scroll_to_row(mnSearchIndex);
    }

    maResetQuickSearch.Start();
}


bool ViewTabListBox_Impl::DoubleClickHdl()
{
    SvHeaderTabListBox::DoubleClickHdl();
    return false;
        // this means "do no additional handling". Especially this means that the SvImpLBox does not
        // recognize that the entry at the double click position change after the handler call (which is
        // the case if in the handler, our content was replaced)
        // If it _would_ recognize this change, it would take this as a reason to select the entry, again
        // - which is not what in the case of content replace
        // (I really doubt that this behaviour of the SvImpLBox does make any sense at all, but
        // who knows ...)
}

OUString ViewTabListBox_Impl::GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const
{
    OUString sRet = SvHeaderTabListBox::GetAccessibleObjectDescription( _eType, _nPos );
    if ( ::vcl::BBTYPE_TABLECELL == _eType )
    {
        sal_Int32 nRow = -1;
        const sal_uInt16 nColumnCount = GetColumnCount();
        if (nColumnCount > 0)
            nRow = _nPos / nColumnCount;
        SvTreeListEntry* pEntry = GetEntry( nRow );
        if ( pEntry )
        {
            SvtContentEntry* pData = static_cast<SvtContentEntry*>(pEntry->GetUserData());
            if ( pData )
            {
                const OUString sVar1( "%1" );
                const OUString sVar2( "%2" );
                OUString aText( msAccessibleDescText );
                aText = aText.replaceAll( sVar1, pData->mbIsFolder ? msFolder : msFile );
                aText = aText.replaceAll( sVar2, pData->maURL );
                sRet += aText;
            }
        }
    }

    return sRet;
}


bool ViewTabListBox_Impl::Kill( const OUString& rContent )
{
    bool bRet = true;
@@ -802,10 +779,10 @@
    return bRet;
}

SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
                          bool bOnlyFolder, bool bMultiSelection, bool bShowType ) :

    Control( pParent, nBits )
SvtFileView::SvtFileView(weld::Window* pTopLevel,
                         std::unique_ptr<weld::TreeView> xTreeView,
                         std::unique_ptr<weld::IconView> xIconView,
                         bool bOnlyFolder, bool bMultiSelection, bool bShowType )
{
    FileViewFlags nFlags = FileViewFlags::NONE;
    if ( bMultiSelection )
@@ -815,31 +792,27 @@

    Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    Reference< XInteractionHandler > xInteractionHandler(
        InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
        InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW);
    Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );

    mpImpl.reset( new SvtFileView_Impl( this, xCmdEnv, nFlags, bOnlyFolder ) );
    mpImpl->mpView->ForbidEmptyText();
    mpImpl.reset(new SvtFileView_Impl(this, pTopLevel, std::move(xTreeView), std::move(xIconView), xCmdEnv, nFlags, bOnlyFolder));

    HeaderBar* pHeaderBar = mpImpl->mpView->GetHeaderBar();
    pHeaderBar->SetSelectHdl( LINK( this, SvtFileView, HeaderSelect_Impl ) );
    pHeaderBar->SetEndDragHdl( LINK( this, SvtFileView, HeaderEndDrag_Impl ) );
    weld::TreeView* pView = mpImpl->mxView->getWidget();
    pView->connect_column_clicked(LINK(this, SvtFileView, HeaderSelect_Impl));
}

void SvtFileView::grab_focus()
{
    mpImpl->grab_focus();
}

bool SvtFileView::has_focus() const
{
    return mpImpl->has_focus();
}

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

void SvtFileView::dispose()
{
    mpImpl.reset();
    Control::dispose();
}

Size SvtFileView::GetOptimalSize() const
{
    return LogicToPixel(Size(208, 50), MapMode(MapUnit::MapAppFont));
}

void SvtFileView::SetViewMode( FileViewMode eMode )
@@ -847,53 +820,66 @@
    mpImpl->SetViewMode( eMode );
}

OUString SvtFileView::GetURL( SvTreeListEntry const * pEntry )
OUString SvtFileView::GetURL(const weld::TreeIter& rEntry) const
{
    OUString aURL;
    if ( pEntry && pEntry->GetUserData() )
        aURL = static_cast<SvtContentEntry*>(pEntry->GetUserData())->maURL;
    return aURL;
    SvtContentEntry* pEntry;
    if (mpImpl->mxView->get_visible())
        pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry).toInt64());
    else
        pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry).toInt64());
    if (pEntry)
        return pEntry->maURL;
    return OUString();
}


OUString SvtFileView::GetCurrentURL() const
{
    SvtContentEntry* pEntry = nullptr;
    OUString aURL;
    SvTreeListEntry* pEntry = mpImpl->mpCurView->FirstSelected();
    if ( pEntry && pEntry->GetUserData() )
        aURL = static_cast<SvtContentEntry*>(pEntry->GetUserData())->maURL;
    if (mpImpl->mxView->get_visible())
    {
        std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
        if (mpImpl->mxView->get_selected(xEntry.get()))
            pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64());
    }
    else
    {
        std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
        if (mpImpl->mxIconView->get_selected(xEntry.get()))
            pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64());
    }
    if (pEntry)
        aURL = pEntry->maURL;
    return aURL;
}


void SvtFileView::CreatedFolder( const OUString& rUrl, const OUString& rNewFolder )
{
    OUString sEntry = mpImpl->FolderInserted( rUrl, rNewFolder );
    const SortingData_Impl& rEntry = mpImpl->FolderInserted( rUrl, rNewFolder );

    SvTreeListEntry* pEntry = mpImpl->mpView->InsertEntry( sEntry, mpImpl->maFolderImage, mpImpl->maFolderImage );
    SvtContentEntry* pUserData = new SvtContentEntry( rUrl, true );
    pEntry->SetUserData( pUserData );
    mpImpl->mpView->MakeVisible( pEntry );
    mpImpl->maEntries.emplace_back(std::make_unique<SvtContentEntry>(rUrl, true));
    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mpImpl->maEntries.back().get())));

    SvTreeListEntry* pEntry2 = mpImpl->mpIconView->InsertEntry( sEntry.getToken( 0, '\t' ), mpImpl->maFolderImage, mpImpl->maFolderImage );
    SvtContentEntry* pUserData2 = new SvtContentEntry( rUrl, true );
    pEntry2->SetUserData( pUserData2 );
    mpImpl->mpIconView->MakeVisible( pEntry2 );
    std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
    mpImpl->mxView->insert(rEntry.maDisplayName, sId, mpImpl->maFolderImage, *xEntry);
    mpImpl->mxView->scroll_to_row(*xEntry);

    std::unique_ptr<weld::TreeIter> xIconEntry = mpImpl->mxIconView->make_iterator();
    mpImpl->mxIconView->insert(-1, &rEntry.maDisplayName, &sId, &mpImpl->maFolderImage, xIconEntry.get());
    mpImpl->mxIconView->scroll_to_item(*xEntry);
}


FileViewResult SvtFileView::PreviousLevel( const FileViewAsyncAction* pAsyncDescriptor )
{
    FileViewResult eResult = eFailure;

    OUString sParentURL;
    if ( GetParentURL( sParentURL ) )
        eResult = Initialize( sParentURL, mpImpl->maCurrentFilter, pAsyncDescriptor, mpBlackList );
        eResult = Initialize( sParentURL, mpImpl->maCurrentFilter, pAsyncDescriptor, maBlackList );

    return eResult;
}


bool SvtFileView::GetParentURL( OUString& rParentURL ) const
{
    bool bRet = false;
@@ -920,42 +906,31 @@
    return bRet;
}


const OString& SvtFileView::GetHelpId( ) const
OString SvtFileView::get_help_id() const
{
    return mpImpl->mpView->GetHelpId( );
    return mpImpl->mxView->get_help_id();
}


void SvtFileView::SetHelpId( const OString& rHelpId )
void SvtFileView::set_help_id(const OString& rHelpId)
{
    mpImpl->mpView->SetHelpId( rHelpId );
    mpImpl->mxView->set_help_id(rHelpId);
}


void SvtFileView::SetSizePixel( const Size& rNewSize )
OUString SvtFileView::get_selected_text() const
{
    Control::SetSizePixel( rNewSize );
    mpImpl->mpView->SetSizePixel( rNewSize );
    mpImpl->mpIconView->SetSizePixel( rNewSize );
    if (mpImpl->mxView->get_visible())
        return mpImpl->mxView->get_selected_text();
    return mpImpl->mxIconView->get_selected_text();
}


void SvtFileView::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
{
    SetPosPixel( rNewPos );
    SetSizePixel( rNewSize );
}


FileViewResult SvtFileView::Initialize(
    const OUString& rURL,
    const OUString& rFilter,
    const FileViewAsyncAction* pAsyncDescriptor,
    const css::uno::Sequence< OUString >& rBlackList  )
    const css::uno::Sequence< OUString >& rBlackList )
{
    WaitObject aWaitCursor( this );
    mpBlackList = rBlackList;
    weld::WaitObject aWaitCursor(mpImpl->m_pTopLevel);
    maBlackList = rBlackList;

    OUString sPushURL( mpImpl->maViewURL );

@@ -984,7 +959,7 @@
    mpImpl->maCurrentFilter = rFilter.toAsciiLowerCase();

    mpImpl->Clear();
    FileViewResult eResult = mpImpl->GetFolderContent_Impl( mpImpl->maViewURL, pAsyncDescriptor, mpBlackList );
    FileViewResult eResult = mpImpl->GetFolderContent_Impl(mpImpl->maViewURL, pAsyncDescriptor, maBlackList);
    OSL_ENSURE( ( eResult != eStillRunning ) || pAsyncDescriptor, "SvtFileView::ExecuteFilter: we told it to read synchronously!" );
    return eResult;
}
@@ -996,51 +971,43 @@

void SvtFileView::SetNoSelection()
{
    mpImpl->mpCurView->SelectAll( false );
    mpImpl->mxView->unselect_all();
    mpImpl->mxIconView->unselect_all();
}


void SvtFileView::GetFocus()
void SvtFileView::SetSelectHdl(const Link<SvtFileView*,void>& rHdl)
{
    Control::GetFocus();
    if ( mpImpl && mpImpl->mpCurView )
        mpImpl->mpCurView->GrabFocus();
    mpImpl->SetSelectHandler(rHdl);
}


void SvtFileView::SetSelectHdl( const Link<SvTreeListBox*,void>& rHdl )
void SvtFileView::SetDoubleClickHdl(const Link<SvtFileView*,bool>& rHdl)
{
    mpImpl->SetSelectHandler( rHdl );
    mpImpl->SetDoubleClickHandler(rHdl);
}


void SvtFileView::SetDoubleClickHdl( const Link<SvTreeListBox*,bool>& rHdl )
{
    mpImpl->mpView->SetDoubleClickHdl( rHdl );
    mpImpl->mpIconView->SetDoubleClickHdl( rHdl );
}


sal_uLong SvtFileView::GetSelectionCount() const
{
    return mpImpl->mpCurView->GetSelectionCount();
    if (mpImpl->mxView->get_visible())
        return mpImpl->mxView->count_selected_rows();
    return mpImpl->mxIconView->count_selected_items();
}


SvTreeListEntry* SvtFileView::FirstSelected() const
SvtContentEntry* SvtFileView::FirstSelected() const
{
    return mpImpl->mpCurView->FirstSelected();
}
    if (mpImpl->mxView->get_visible())
    {
        SvtContentEntry* pRet = nullptr;
        std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
        if (mpImpl->mxView->get_selected(xEntry.get()))
            pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64());
        return pRet;
    }


SvTreeListEntry* SvtFileView::NextSelected( SvTreeListEntry* pEntry ) const
{
    return mpImpl->mpCurView->NextSelected( pEntry );
}

void SvtFileView::EnableAutoResize()
{
    mpImpl->mpView->EnableAutoResize();
    SvtContentEntry* pRet = nullptr;
    std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
    if (mpImpl->mxIconView->get_selected(xEntry.get()))
        pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64());
    return pRet;
}

const OUString& SvtFileView::GetViewURL() const
@@ -1063,92 +1030,53 @@
    return mpImpl->EndEditing();
}

IMPL_LINK( SvtFileView, HeaderSelect_Impl, HeaderBar*, pBar, void )
IMPL_LINK(SvtFileView, HeaderSelect_Impl, int, nColumn, void)
{
    DBG_ASSERT( pBar, "no headerbar" );
    sal_uInt16 nItemID = pBar->GetCurItemId();
    sal_uInt16 nItemID = nColumn + 1;
    // skip "TYPE"
    if (!mpImpl->mxView->TypeColumnVisible() && nItemID != COLUMN_TITLE)
        ++nItemID;

    HeaderBarItemBits nBits;
    weld::TreeView* pView = mpImpl->mxView->getWidget();
    bool bSortAtoZ = mpImpl->mbAscending;

    // clear the arrow of the recently used column
    if ( nItemID != mpImpl->mnSortColumn )
    //set new arrow positions in headerbar
    if (nItemID != mpImpl->mnSortColumn)
    {
        if ( !nItemID )
        {
            // first call -> remove arrow from title column,
            // because another column is the sort column
            nItemID = mpImpl->mnSortColumn;
            mpImpl->mnSortColumn = COLUMN_TITLE;
        }
        nBits = pBar->GetItemBits( mpImpl->mnSortColumn );
        nBits &= ~HeaderBarItemBits( HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW );
        pBar->SetItemBits( mpImpl->mnSortColumn, nBits );
    }

    nBits = pBar->GetItemBits( nItemID );

    bool bUp = ( ( nBits & HeaderBarItemBits::UPARROW ) == HeaderBarItemBits::UPARROW );

    if ( bUp )
    {
        nBits &= ~HeaderBarItemBits::UPARROW;
        nBits |= HeaderBarItemBits::DOWNARROW;
        // remove old indicator, new will be created in OpenFolder_Impl
        pView->set_sort_indicator(TRISTATE_INDET, mpImpl->GetSortColumn());
    }
    else
    {
        nBits &= ~HeaderBarItemBits::DOWNARROW;
        nBits |= HeaderBarItemBits::UPARROW;
    }
        bSortAtoZ = !bSortAtoZ;

    pBar->SetItemBits( nItemID, nBits );
    mpImpl->Resort_Impl( nItemID, !bUp );
    mpImpl->Resort_Impl(nItemID, bSortAtoZ);
}


IMPL_LINK( SvtFileView, HeaderEndDrag_Impl, HeaderBar*, pBar, void )
{
    if ( pBar->IsItemMode() )
        return;

    Size aSize;
    sal_uInt16 nTabs = pBar->GetItemCount();
    long nTmpSize = 0;

    for ( sal_uInt16 i = 1; i <= nTabs; ++i )
    {
        long nWidth = pBar->GetItemSize(i);
        aSize.setWidth(  nWidth + nTmpSize );
        nTmpSize += nWidth;
        mpImpl->mpView->SetTab( i, aSize.Width(), MapUnit::MapPixel );
    }
}


OUString SvtFileView::GetConfigString() const
{
    OUString sRet;
    HeaderBar* pBar = mpImpl->mpView->GetHeaderBar();
    DBG_ASSERT( pBar, "invalid headerbar" );

    // sort order
    sRet += OUString::number( mpImpl->mnSortColumn ) + ";";
    HeaderBarItemBits nBits = pBar->GetItemBits( mpImpl->mnSortColumn );
    bool bUp = ( ( nBits & HeaderBarItemBits::UPARROW ) == HeaderBarItemBits::UPARROW );
    OUString sRet = OUString::number( mpImpl->mnSortColumn ) + ";";

    bool bUp = mpImpl->mbAscending;
    sRet += bUp ? OUString("1") : OUString("0");
    sRet += ";";

    sal_uInt16 nCount = pBar->GetItemCount();
    for ( sal_uInt16 i = 0; i < nCount; ++i )
    weld::TreeView* pView = mpImpl->mxView->getWidget();
    sal_uInt16 nCount = mpImpl->mxView->TypeColumnVisible() ? 4 : 3;
    for (sal_uInt16 i = 0; i < nCount; ++i)
    {
        sal_uInt16 nId = pBar->GetItemId(i);
        sal_uInt16 nId = i + 1;
        // skip "TYPE"
        if (!mpImpl->mxView->TypeColumnVisible() && nId != COLUMN_TITLE)
            ++nId;

        sRet += OUString::number( nId )
                + ";"
                + OUString::number( pBar->GetItemSize( nId ) )
                + OUString::number(pView->get_column_width(i))
                + ";";
    }

    sRet = comphelper::string::stripEnd(sRet, ';');
    return sRet;
    return comphelper::string::stripEnd(sRet, ';');
}

::std::vector< SvtContentEntry > SvtFileView::GetContent()
@@ -1164,84 +1092,69 @@
    return aContent;
}

void SvtFileView::SetConfigString( const OUString& rCfgStr )
void SvtFileView::SetConfigString(const OUString& rCfgStr)
{
    HeaderBar* pBar = mpImpl->mpView->GetHeaderBar();
    DBG_ASSERT( pBar, "invalid headerbar" );

    sal_Int32 nIdx = 0;
    mpImpl->mnSortColumn = static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32());
    bool bUp = static_cast<bool>(static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32()));
    HeaderBarItemBits nBits = pBar->GetItemBits( mpImpl->mnSortColumn );
    mpImpl->mbAscending = static_cast<bool>(static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32()));

    if ( bUp )
    {
        nBits &= ~HeaderBarItemBits::UPARROW;
        nBits |= HeaderBarItemBits::DOWNARROW;
    }
    else
    {
        nBits &= ~HeaderBarItemBits::DOWNARROW;
        nBits |= HeaderBarItemBits::UPARROW;
    }
    pBar->SetItemBits( mpImpl->mnSortColumn, nBits );
    std::vector<int> aWidths(mpImpl->mxView->TypeColumnVisible() ? 4 : 3, -1);

    while ( nIdx != -1 )
    {
        sal_uInt16 nItemId = static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32());
        pBar->SetItemSize( nItemId, rCfgStr.getToken( 0, ';', nIdx ).toInt32() );

        int nWidth = rCfgStr.getToken( 0, ';', nIdx ).toInt32();

        // skip "TYPE"
        if (!mpImpl->mxView->TypeColumnVisible() && nItemId != COLUMN_TITLE)
            --nItemId;
        int nColumn = nItemId - 1;

        if (nColumn >= 0 && static_cast<unsigned int>(nColumn) < aWidths.size())
            aWidths[nColumn] = nWidth;
    }

    HeaderSelect_Impl( pBar );
    HeaderEndDrag_Impl( pBar );
    weld::TreeView* pView = mpImpl->mxView->getWidget();
    pView->set_column_fixed_widths(aWidths);
}


void SvtFileView::StateChanged( StateChangedType nStateChange )
{
    if ( nStateChange == StateChangedType::Enable )
        Invalidate();
    Control::StateChanged( nStateChange );
}


// class SvtFileView_Impl


SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommandEnvironment > const & xEnv, FileViewFlags nFlags, bool bOnlyFolder )

    :mpAntiImpl                 ( pAntiImpl )
    ,m_eAsyncActionResult       ( ::svt::EnumerationResult::ERROR )
    ,m_bRunningAsyncAction      ( false )
    ,m_bAsyncActionCancelled    ( false )
    ,mnSortColumn               ( COLUMN_TITLE )
    ,mbAscending                ( true )
    ,mbOnlyFolder               ( bOnlyFolder )
    ,mnSuspendSelectCallback    ( 0 )
    ,mbIsFirstResort            ( true )
    ,aIntlWrapper               ( Application::GetSettings().GetLanguageTag() )
    ,maFolderImage              (StockImage::Yes, RID_BMP_FOLDER)
    ,mxCmdEnv ( xEnv )

SvtFileView_Impl::SvtFileView_Impl(SvtFileView* pAntiImpl, weld::Window* pTopLevel,
                                   std::unique_ptr<weld::TreeView> xTreeView,
                                   std::unique_ptr<weld::IconView> xIconView,
                                   Reference < XCommandEnvironment > const & xEnv,
                                   FileViewFlags nFlags, bool bOnlyFolder)
    : m_pAntiImpl                ( pAntiImpl )
    , m_eAsyncActionResult       ( ::svt::EnumerationResult::ERROR )
    , m_bRunningAsyncAction      ( false )
    , m_bAsyncActionCancelled    ( false )
    , m_pTopLevel                ( pTopLevel )
    , mxView(new ViewTabListBox_Impl(std::move(xTreeView), pTopLevel, this, nFlags))
    , mxIconView(std::move(xIconView))
    , mnSortColumn               ( COLUMN_TITLE )
    , mbAscending                ( true )
    , mbOnlyFolder               ( bOnlyFolder )
    , mnSuspendSelectCallback    ( 0 )
    , mbIsFirstResort            ( true )
    , aIntlWrapper               ( Application::GetSettings().GetLanguageTag() )
    , maFolderImage              (RID_BMP_FOLDER)
    , mxCmdEnv ( xEnv )
{
    mpView = VclPtr<ViewTabListBox_Impl>::Create( mpAntiImpl, this, nFlags );
    mpCurView = mpView;
    mpIconView = VclPtr<IconView>::Create( mpAntiImpl, WB_TABSTOP );
    mpIconView->Hide();
    mpView->EnableCellFocus();
}
    weld::TreeView* pWidget = mxView->getWidget();

    // set the width to something small so its the parent that decides the final
    // width
    Size aSize(42, pWidget->get_height_rows(7));
    pWidget->set_size_request(aSize.Width(), aSize.Height());
    mxIconView->set_size_request(aSize.Width(), aSize.Height());
}

SvtFileView_Impl::~SvtFileView_Impl()
{
    Clear();
    mpView.disposeAndClear();
    mpCurView.clear();
    mpIconView.disposeAndClear();
    mpAntiImpl.clear();
}


void SvtFileView_Impl::Clear()
{
    ::osl::MutexGuard aGuard( maMutex );
@@ -1249,7 +1162,6 @@
    maContent.clear();
}


FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
    const OUString& rFolder,
    const FileViewAsyncAction* pAsyncDescriptor,
@@ -1265,7 +1177,6 @@
    return GetFolderContent_Impl( aFolder, pAsyncDescriptor, rBlackList );
}


FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
    const FolderDescriptor& _rFolder,
    const FileViewAsyncAction* pAsyncDescriptor,
@@ -1276,7 +1187,7 @@

    OSL_ENSURE( !m_xContentEnumerator.is(), "SvtFileView_Impl::GetFolderContent_Impl: still running another enumeration!" );
    m_xContentEnumerator.set(new ::svt::FileViewContentEnumerator(
        mpView->GetCommandEnvironment(), maContent, maMutex));
        mxView->GetCommandEnvironment(), maContent, maMutex));
        // TODO: should we cache and re-use this thread?

    if ( !pAsyncDescriptor )
@@ -1346,8 +1257,9 @@

        m_aCurrentAsyncActionHandler = pAsyncDescriptor->aFinishHandler;
        DBG_ASSERT( m_aCurrentAsyncActionHandler.IsSet(), "SvtFileView_Impl::GetFolderContent_Impl: nobody interested when it's finished?" );
        mpView->ClearAll();
        mpIconView->ClearAll();
        maEntries.clear();
        mxView->clear();
        mxIconView->clear();
        return eStillRunning;
    }

@@ -1365,7 +1277,6 @@
    return eFailure;
}


void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
{
    if ( rFilter.isEmpty() || ( rFilter == ALL_FILES_FILTER ) )
@@ -1395,90 +1306,105 @@
        maContent.end());
}


IMPL_LINK( SvtFileView_Impl, SelectionMultiplexer, SvTreeListBox*, _pSource, void )
IMPL_LINK_NOARG(SvtFileView_Impl, ChangedHdl, weld::TreeView&, void)
{
    if (!mnSuspendSelectCallback)
        m_aSelectHandler.Call( _pSource );
        m_aSelectHandler.Call(m_pAntiImpl);
}


void SvtFileView_Impl::SetSelectHandler( const Link<SvTreeListBox*,void>& _rHdl )
IMPL_LINK_NOARG(SvtFileView_Impl, SelectionChangedHdl, weld::IconView&, void)
{
    m_aSelectHandler = _rHdl;

    Link<SvTreeListBox*,void> aMasterHandler;
    if ( m_aSelectHandler.IsSet() )
        aMasterHandler = LINK( this, SvtFileView_Impl, SelectionMultiplexer );

    mpView->SetSelectHdl( aMasterHandler );
    mpIconView->SetSelectHdl( aMasterHandler );
    if (!mnSuspendSelectCallback)
        m_aSelectHandler.Call(m_pAntiImpl);
}


void SvtFileView_Impl::InitSelection()
void SvtFileView_Impl::SetSelectHandler(const Link<SvtFileView*,void>& rHdl)
{
    mpCurView->SelectAll( false );
    SvTreeListEntry* pFirst = mpCurView->First();
    if ( pFirst )
        mpCurView->SetCursor( pFirst, true );
    m_aSelectHandler = rHdl;

    mxView->connect_changed(LINK(this, SvtFileView_Impl, ChangedHdl));
    mxIconView->connect_selection_changed(LINK(this, SvtFileView_Impl, SelectionChangedHdl));
}

IMPL_LINK_NOARG(SvtFileView_Impl, RowActivatedHdl, weld::TreeView&, bool)
{
    return maDoubleClickHandler.Call(m_pAntiImpl);
}

IMPL_LINK_NOARG(SvtFileView_Impl, ItemActivatedHdl, weld::IconView&, bool)
{
    return maDoubleClickHandler.Call(m_pAntiImpl);
}

void SvtFileView_Impl::SetDoubleClickHandler(const Link<SvtFileView*,bool>& rHdl)
{
    maDoubleClickHandler = rHdl;

    mxView->connect_row_activated(LINK(this, SvtFileView_Impl, RowActivatedHdl));
    mxIconView->connect_item_activated(LINK(this, SvtFileView_Impl, ItemActivatedHdl));
}

void SvtFileView_Impl::OpenFolder_Impl()
{
    ::osl::MutexGuard aGuard( maMutex );

    mpView->SetUpdateMode( false );
    mpIconView->SetUpdateMode( false );
    mpView->ClearAll();
    mpIconView->ClearAll();
    mxView->freeze();
    mxIconView->freeze();
    maEntries.clear();
    mxView->clear();
    mxIconView->clear();

    for (auto const& elem : maContent)
    {
        if ( mbOnlyFolder && ! elem->mbIsFolder )
        if (mbOnlyFolder && !elem->mbIsFolder)
            continue;

        // insert entry and set user data
        SvTreeListEntry* pEntry = mpView->InsertEntry( elem->maDisplayText,
                                                   elem->maImage,
                                                   elem->maImage );

        SvTreeListEntry* pEntry2 = mpIconView->InsertEntry( elem->maDisplayText.getToken( 0, '\t' ),
                                                   elem->maImage, elem->maImage );

        SvtContentEntry* pUserData = new SvtContentEntry( elem->maTargetURL,
                                                          elem->mbIsFolder );
        SvtContentEntry* pUserData2 = new SvtContentEntry( elem->maTargetURL,
                                                          elem->mbIsFolder );

        pEntry->SetUserData( pUserData );
        pEntry2->SetUserData( pUserData2 );
        maEntries.emplace_back(std::make_unique<SvtContentEntry>(elem->maTargetURL, elem->mbIsFolder));
        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maEntries.back().get())));
        mxView->append(sId, elem->maDisplayName, elem->maType, elem->maDisplaySize, elem->maDisplayDate, elem->maImage);
        mxIconView->append(sId, elem->maDisplayName, elem->maImage);
    }

    InitSelection();

    ++mnSuspendSelectCallback;
    mpView->SetUpdateMode( true );
    mpIconView->SetUpdateMode( true );
    mxView->thaw();

    //set sort indicator
    weld::TreeView* pView = mxView->getWidget();
    pView->set_sort_indicator(mbAscending ? TRISTATE_TRUE : TRISTATE_FALSE, GetSortColumn());

    mxIconView->thaw();
    --mnSuspendSelectCallback;

    ResetCursor();
}


void SvtFileView_Impl::ResetCursor()
{
    // deselect
    SvTreeListEntry* pEntry = mpCurView->FirstSelected();
    if ( pEntry )
        mpCurView->Select( pEntry, false );
    // set cursor to the first entry
    mpCurView->SetCursor( mpCurView->First(), true );
    mpCurView->Update();
    if (mxView->get_visible())
    {
        // deselect
        mxView->unselect_all();
        std::unique_ptr<weld::TreeIter> xFirst = mxView->make_iterator();
        if (mxView->get_iter_first(*xFirst))
        {
            // set cursor to the first entry
            mxView->set_cursor(*xFirst);
        }
    }
    else
    {
        // deselect
        mxIconView->unselect_all();
        std::unique_ptr<weld::TreeIter> xFirst = mxIconView->make_iterator();
        if (mxIconView->get_iter_first(*xFirst))
        {
            // set cursor to the first entry
            mxIconView->set_cursor(*xFirst);
        }
    }
}


void SvtFileView_Impl::CancelRunningAsyncAction()
{
    DBG_TESTSOLARMUTEX();
@@ -1551,48 +1477,43 @@
    SortFolderContent_Impl();
    CreateDisplayText_Impl();
    OpenFolder_Impl();
    maOpenDoneLink.Call( mpAntiImpl );
    maOpenDoneLink.Call( m_pAntiImpl );
}


void SvtFileView_Impl::ReplaceTabWithString( OUString& aValue )
OUString SvtFileView_Impl::ReplaceTabWithString(const OUString& rValue)
{
    OUString const aTab( "\t" );
    OUString const aTabString( "%09" );

    sal_Int32 iPos;

    OUString aValue(rValue);
    while ( ( iPos = aValue.indexOf( aTab ) ) >= 0 )
       aValue = aValue.replaceAt( iPos, 1, aTabString );
        aValue = aValue.replaceAt( iPos, 1, aTabString );
    return aValue;
}


void SvtFileView_Impl::CreateDisplayText_Impl()
{
    ::osl::MutexGuard aGuard( maMutex );

    OUString const aTab( "\t" );
    OUString const aDateSep( ", " );

    for (auto const& elem : maContent)
    {
        // title, type, size, date
        OUString aValue = elem->GetTitle();
        ReplaceTabWithString( aValue );
        aValue += aTab + elem->maType + aTab;
        elem->maDisplayName = ReplaceTabWithString(elem->GetTitle());
        // folders don't have a size
        if ( ! elem->mbIsFolder )
            aValue += CreateExactSizeText( elem->maSize );
        aValue += aTab;
            elem->maDisplaySize = CreateExactSizeText( elem->maSize );
        // set the date, but volumes have no date
        if ( ! elem->mbIsFolder || ! elem->mbIsVolume )
        {
            SvtSysLocale aSysLocale;
            const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
            aValue += rLocaleData.getDate( elem->maModDate )
                    + aDateSep
                    + rLocaleData.getTime( elem->maModDate, false );
            elem->maDisplayDate = rLocaleData.getDate( elem->maModDate )
                                  + aDateSep
                                  + rLocaleData.getTime( elem->maModDate, false );
        }
        elem->maDisplayText = aValue;

        // detect image
        if ( elem->mbIsFolder )
@@ -1600,10 +1521,10 @@
            ::svtools::VolumeInfo aVolInfo( elem->mbIsVolume, elem->mbIsRemote,
                                            elem->mbIsRemoveable, elem->mbIsFloppy,
                                            elem->mbIsCompactDisc );
            elem->maImage = SvFileInformationManager::GetFolderImage( aVolInfo );
            elem->maImage = SvFileInformationManager::GetFolderImageId(aVolInfo);
        }
        else
            elem->maImage = SvFileInformationManager::GetFileImage( INetURLObject( elem->maTargetURL ) );
            elem->maImage = SvFileInformationManager::GetFileImageId(INetURLObject(elem->maTargetURL));
    }
}

@@ -1617,12 +1538,14 @@
         return;

    // reset the quick search index
    mpView->ResetQuickSearch_Impl( nullptr );
    mxView->ResetQuickSearch_Impl( nullptr );

    std::unique_ptr<weld::TreeIter> xEntry(mxView->make_iterator());
    bool bEntry = mxView->get_cursor(xEntry.get());

    OUString aEntryURL;
    SvTreeListEntry* pEntry = mpView->GetCurEntry();
    if ( pEntry && pEntry->GetUserData() )
        aEntryURL = static_cast<SvtContentEntry*>(pEntry->GetUserData())->maURL;
    if (bEntry && !mxView->get_id(*xEntry).isEmpty())
        aEntryURL = reinterpret_cast<SvtContentEntry*>(mxView->get_id(*xEntry).toInt64())->maURL;

    mnSortColumn = nColumn;
    mbAscending = bAscending;
@@ -1632,13 +1555,11 @@

    if ( !mbIsFirstResort )
    {
        sal_uLong nPos = GetEntryPos( aEntryURL );
        if ( nPos < mpView->GetEntryCount() )
        int nPos = GetEntryPos( aEntryURL );
        if (nPos != -1 && nPos < mxView->n_children())
        {
            pEntry = mpView->GetEntry( nPos );

            ++mnSuspendSelectCallback;  // #i15668#
            mpView->SetCurEntry( pEntry );
            mxView->set_cursor(nPos);
            --mnSuspendSelectCallback;
        }
    }
@@ -1646,7 +1567,6 @@
        mbIsFirstResort = false;
}


static bool                     gbAscending = true;
static sal_Int16                gnColumn = COLUMN_TITLE;
static const CollatorWrapper*   pCollatorWrapper = nullptr;
@@ -1763,11 +1683,7 @@
    if (aFoundElem != maContent.end())
    {
        (*aFoundElem)->SetNewTitle( rTitle );
        OUString aDisplayText = (*aFoundElem)->maDisplayText;
        sal_Int32 nIndex = aDisplayText.indexOf( '\t' );

        if ( nIndex > 0 )
            (*aFoundElem)->maDisplayText = aDisplayText.replaceAt( 0, nIndex, rTitle );
        (*aFoundElem)->maDisplayName = ReplaceTabWithString(rTitle);

        INetURLObject aURLObj( rURL );
        aURLObj.setName( rTitle, INetURLObject::EncodeMechanism::All );
@@ -1778,8 +1694,7 @@
    }
}


OUString SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& rTitle )
const SortingData_Impl& SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& rTitle )
{
    ::osl::MutexGuard aGuard( maMutex );

@@ -1792,69 +1707,53 @@

    ::svtools::VolumeInfo aVolInfo;
    pData->maType = SvFileInformationManager::GetFolderDescription( aVolInfo );
    pData->maImage = SvFileInformationManager::GetFolderImage( aVolInfo );
    pData->maImage = SvFileInformationManager::GetFolderImageId( aVolInfo );

    OUString aValue;
    OUString const aTab( "\t" );
    OUString const aDateSep( ", " );

    // title, type, size, date
    aValue = pData->GetTitle();
    ReplaceTabWithString( aValue );
    aValue += aTab + pData->maType + aTab +
        // folders don't have a size
        aTab;
    pData->maDisplayName = ReplaceTabWithString(pData->GetTitle());
    // set the date
    SvtSysLocale aSysLocale;
    const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
    aValue += rLocaleData.getDate( pData->maModDate )
            + aDateSep
            + rLocaleData.getTime( pData->maModDate );
    pData->maDisplayDate = rLocaleData.getDate( pData->maModDate )
                           + aDateSep
                           + rLocaleData.getTime( pData->maModDate );

    pData->maDisplayText = aValue;
    maContent.push_back( std::move(pData) );

    return aValue;
    return *maContent.back();
}


sal_uLong SvtFileView_Impl::GetEntryPos( const OUString& rURL )
int SvtFileView_Impl::GetEntryPos(const OUString& rURL)
{
    ::osl::MutexGuard aGuard( maMutex );

    auto aFoundElem = std::find_if(maContent.begin(), maContent.end(),
          [&](const std::unique_ptr<SortingData_Impl> & data) { return data->maTargetURL == rURL; });
    return aFoundElem != maContent.end()?std::distance(maContent.begin(), aFoundElem):0;
    return aFoundElem != maContent.end() ? std::distance(maContent.begin(), aFoundElem) : -1;
}


void SvtFileView_Impl::SetViewMode( FileViewMode eMode )
{
    switch ( eMode )
    {
        case eDetailedList:
            mpCurView = mpView;
            mpView->Show();
            mpView->GetHeaderBar()->Show();
            mpIconView->Hide();
            mxView->show();
            mxIconView->hide();
            break;

        case eIcon:
            mpCurView = mpIconView;
            mpView->Hide();
            mpView->GetHeaderBar()->Hide();
            mpIconView->Show();
            mxView->hide();
            mxIconView->show();
            break;

        default:
            mpCurView = mpView;
            mpView->Show();
            mpView->GetHeaderBar()->Show();
            mpIconView->Hide();
            mxView->show();
            mxIconView->hide();
    };
}


bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTitle, bool bWrapAround )
{
    ::osl::MutexGuard aGuard( maMutex );
@@ -1894,4 +1793,17 @@
    }
}

void SvtFileView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func)
{
    if (mpImpl->mxView->get_visible())
        mpImpl->mxView->selected_foreach(func);
    else
        mpImpl->mxIconView->selected_foreach(func);
}

weld::Widget* SvtFileView::identifier() const
{
    return mpImpl->mxView->getWidget();
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/fileview.hxx b/fpicker/source/office/fileview.hxx
index 141159e..89b16ec 100644
--- a/fpicker/source/office/fileview.hxx
+++ b/fpicker/source/office/fileview.hxx
@@ -22,6 +22,8 @@
#include <memory>
#include <com/sun/star/uno/Sequence.h>
#include <vcl/ctrl.hxx>
#include <vcl/errinf.hxx>
#include <vcl/weld.hxx>
#include <rtl/ustring.hxx>

namespace com :: sun :: star :: ucb { class XContent; }
@@ -29,10 +31,7 @@
// class SvtFileView -----------------------------------------------------

class SvtFileView_Impl;
class SvTreeListEntry;
class HeaderBar;
struct SvtContentEntry;
class SvTreeListBox;

/// the result of an action in the FileView
enum FileViewResult
@@ -62,38 +61,39 @@
    }
};

class SvtFileView : public Control
class SvtFileView
{
private:
    std::unique_ptr<SvtFileView_Impl> mpImpl;
    css::uno::Sequence< OUString >    mpBlackList;
    css::uno::Sequence<OUString> maBlackList;

    DECL_LINK( HeaderSelect_Impl, HeaderBar*, void );
    DECL_LINK( HeaderEndDrag_Impl, HeaderBar*, void );

protected:
    virtual void GetFocus() override;
    DECL_LINK(HeaderSelect_Impl, int, void);

public:
    SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection, bool bShowType = true );
    virtual ~SvtFileView() override;
    virtual void dispose() override;

    virtual Size GetOptimalSize() const override;
    SvtFileView(weld::Window* pTopLevel,
                std::unique_ptr<weld::TreeView> xTreeView,
                std::unique_ptr<weld::IconView> xIconView,
                bool bOnlyFolder, bool bMultiSelection, bool bShowType = true);
    virtual ~SvtFileView();

    void                    SetViewMode( FileViewMode eMode );

    const OUString&         GetViewURL() const;
    static OUString         GetURL( SvTreeListEntry const * pEntry );
    OUString                GetURL(const weld::TreeIter& rEntry) const;
    OUString                GetCurrentURL() const;

    bool                    GetParentURL( OUString& _rParentURL ) const;
    void                    CreatedFolder( const OUString& rUrl, const OUString& rNewFolder );

    void                    SetHelpId( const OString& rHelpId );
    const OString&          GetHelpId( ) const;
    void                    SetSizePixel( const Size& rNewSize ) override;
    virtual void            SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) override;
    void                    set_help_id(const OString& rHelpId);
    OString                 get_help_id() const;

    void                    grab_focus();
    bool                    has_focus() const;

    OUString                get_selected_text() const;

    weld::Widget*           identifier() const; // just to uniquely identify this widget

    /** initialize the view with the content of a folder given by URL, and apply an immediate filter

@@ -153,14 +153,14 @@

    void                    SetNoSelection();

    void                    SetSelectHdl( const Link<SvTreeListBox*,void>& rHdl );
    void                    SetDoubleClickHdl( const Link<SvTreeListBox*,bool>& rHdl );
    void                    SetSelectHdl( const Link<SvtFileView*,void>& rHdl );
    void                    SetDoubleClickHdl( const Link<SvtFileView*,bool>& rHdl );
    void                    SetOpenDoneHdl( const Link<SvtFileView*,void>& rHdl );

    sal_uLong               GetSelectionCount() const;
    SvTreeListEntry*        FirstSelected() const;
    SvTreeListEntry*        NextSelected( SvTreeListEntry* pEntry ) const;
    void                    EnableAutoResize();
    SvtContentEntry*        FirstSelected() const;

    void selected_foreach(const std::function<bool(weld::TreeIter&)>& func);

    void                    EnableDelete( bool bEnable );

@@ -171,9 +171,6 @@
    void                    EndInplaceEditing();

    ::std::vector< SvtContentEntry > GetContent();

protected:
    virtual void            StateChanged( StateChangedType nStateChange ) override;
};

// struct SvtContentEntry ------------------------------------------------
diff --git a/fpicker/source/office/foldertree.cxx b/fpicker/source/office/foldertree.cxx
index a2cc56a..e97411c 100644
--- a/fpicker/source/office/foldertree.cxx
+++ b/fpicker/source/office/foldertree.cxx
@@ -11,9 +11,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <vcl/dialog.hxx>
#include <vcl/treelistentry.hxx>
#include <vcl/ptrstyle.hxx>
#include <com/sun/star/task/InteractionHandler.hpp>
#include "contentenumeration.hxx"
#include "foldertree.hxx"
@@ -21,44 +19,51 @@

using namespace ::com::sun::star::task;

FolderTree::FolderTree( vcl::Window* pParent, WinBits nBits )
    : SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP )
FolderTree::FolderTree(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel)
    : m_xTreeView(std::move(xTreeView))
    , m_pTopLevel(pTopLevel)
{
    m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 24,
                                  m_xTreeView->get_height_rows(7));

    Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    Reference< XInteractionHandler > xInteractionHandler(
                InteractionHandler::createWithParent(xContext, VCLUnoHelper::GetInterface(GetParentDialog())), UNO_QUERY_THROW );
                InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW);
    m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );

    Image aFolderImage(StockImage::Yes, RID_BMP_FOLDER);
    Image aFolderExpandedImage(StockImage::Yes, RID_BMP_FOLDER_OPEN);
    SetDefaultCollapsedEntryBmp( aFolderImage );
    SetDefaultExpandedEntryBmp( aFolderExpandedImage );
    m_xTreeView->connect_expanding(LINK(this, FolderTree, RequestingChildrenHdl));
}

void FolderTree::RequestingChildren( SvTreeListEntry* pEntry )
IMPL_LINK(FolderTree, RequestingChildrenHdl, const weld::TreeIter&, rEntry, bool)
{
    EnableChildPointerOverwrite( true );
    SetPointer( PointerStyle::Wait );
    Invalidate(InvalidateFlags::Update);
    weld::WaitObject aWait(m_pTopLevel);

    FillTreeEntry( pEntry );
    FillTreeEntry(rEntry);

    SetPointer( PointerStyle::Arrow );
    EnableChildPointerOverwrite( false );
    return true;
}

void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry )
void FolderTree::InsertRootEntry(const OUString& rId, const OUString& rRootLabel)
{
    if( !pEntry )
        return;
    std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
    OUString sFolderImage(RID_BMP_FOLDER);
    m_xTreeView->insert(nullptr, -1, &rRootLabel, &rId, nullptr, nullptr,
                        &sFolderImage, true, xEntry.get());
    m_xTreeView->set_cursor(*xEntry);
}

    OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() );
void FolderTree::FillTreeEntry(const weld::TreeIter& rEntry)
{
    OUString sURL = m_xTreeView->get_id(rEntry);
    OUString sFolderImage(RID_BMP_FOLDER);

    if( pURL && m_sLastUpdatedDir != *pURL )
    if (m_sLastUpdatedDir != sURL)
    {
        while (SvTreeListEntry* pChild = FirstChild(pEntry))
        while (m_xTreeView->iter_has_child(rEntry))
        {
            GetModel()->Remove(pChild);
            std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(&rEntry));
            m_xTreeView->iter_children(*xChild);
            m_xTreeView->remove(*xChild);
        }

        ::std::vector< std::unique_ptr<SortingData_Impl> > aContent;
@@ -67,22 +72,19 @@
            xContentEnumerator(new FileViewContentEnumerator(
            m_xEnv, aContent, m_aMutex));

        FolderDescriptor aFolder( *pURL );
        FolderDescriptor aFolder(sURL);

        EnumerationResult eResult =
            xContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList );

        if ( EnumerationResult::SUCCESS == eResult )
        if (EnumerationResult::SUCCESS == eResult)
        {
            for(const auto & i : aContent)
            {
                if( i->mbIsFolder )
                {
                    SvTreeListEntry* pNewEntry = InsertEntry( i->GetTitle(), pEntry, true );

                    OUString* sData = new OUString( i->maTargetURL );
                    pNewEntry->SetUserData( static_cast< void* >( sData ) );
                }
                if (!i->mbIsFolder)
                    continue;
                m_xTreeView->insert(&rEntry, -1, &i->GetTitle(), &i->maTargetURL,
                    nullptr, nullptr, &sFolderImage, true, nullptr);
            }
        }
    }
@@ -96,27 +98,30 @@

void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders )
{
    SetTreePath( rUrl );
    SetTreePath(rUrl);

    SvTreeListEntry* pParent = GetCurEntry();
    std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator());
    bool bParent = m_xTreeView->get_cursor(xParent.get());

    if( !(pParent && !IsExpanded( pParent )) )
    if (!bParent || m_xTreeView->get_row_expanded(*xParent))
        return;

    while (SvTreeListEntry* pChild = FirstChild(pParent))
    OUString sFolderImage(RID_BMP_FOLDER);
    while (m_xTreeView->iter_has_child(*xParent))
    {
        GetModel()->Remove(pChild);
        std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(xParent.get()));
        m_xTreeView->iter_children(*xChild);
        m_xTreeView->remove(*xChild);
    }

    for (auto const& folder : rFolders)
    {
        SvTreeListEntry* pNewEntry = InsertEntry( folder.first, pParent, true  );
        OUString* sData = new OUString( folder.second );
        pNewEntry->SetUserData( static_cast< void* >( sData ) );
        m_xTreeView->insert(xParent.get(), -1, &folder.first, &folder.second,
            nullptr, nullptr, &sFolderImage, true, nullptr);
    }

    m_sLastUpdatedDir = rUrl;
    Expand( pParent );
    m_xTreeView->expand_row(*xParent);
}

void FolderTree::SetTreePath( OUString const & sUrl )
@@ -126,14 +131,15 @@

    OUString sPath = aUrl.GetURLPath( INetURLObject::DecodeMechanism::WithCharset );

    SvTreeListEntry* pEntry = First();
    bool end = false;
    std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
    bool bEntry = m_xTreeView->get_iter_first(*xEntry);
    bool bEnd = false;

    while( pEntry && !end )
    while (bEntry && !bEnd)
    {
        if( pEntry->GetUserData() )
        if (!m_xTreeView->get_id(*xEntry).isEmpty())
        {
            OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() );
            OUString sNodeUrl = m_xTreeView->get_id(*xEntry);

            INetURLObject aUrlObj( sNodeUrl );
            aUrlObj.setFinalSlash();
@@ -142,19 +148,19 @@

            if( sPath == sNodeUrl )
            {
                Select( pEntry );
                end = true;
                m_xTreeView->select(*xEntry);
                bEnd = true;
            }
            else if( sPath.startsWith( sNodeUrl ) )
            {
                if( !IsExpanded( pEntry ) )
                    Expand( pEntry );
                if (!m_xTreeView->get_row_expanded(*xEntry))
                    m_xTreeView->expand_row(*xEntry);

                pEntry = FirstChild( pEntry );
                bEntry = m_xTreeView->iter_children(*xEntry);
            }
            else
            {
                pEntry = pEntry->NextSibling();
                bEntry = m_xTreeView->iter_next_sibling(*xEntry);
            }
        }
        else
diff --git a/fpicker/source/office/foldertree.hxx b/fpicker/source/office/foldertree.hxx
index 03710ef..7e5e858 100644
--- a/fpicker/source/office/foldertree.hxx
+++ b/fpicker/source/office/foldertree.hxx
@@ -11,35 +11,39 @@
#define INCLUDED_SVTOOLS_FOLDERTREE_HXX

#include <com/sun/star/uno/Sequence.hxx>
#include <tools/wintypes.hxx>
#include <vcl/treelistbox.hxx>
#include <vcl/weld.hxx>

namespace com :: sun :: star :: ucb { class XCommandEnvironment; }

class SvTreeListEntry;

using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
using namespace ::svt;

class FolderTree : public SvTreeListBox
class FolderTree
{
private:
    std::unique_ptr<weld::TreeView> m_xTreeView;
    weld::Window* m_pTopLevel;
    Reference< XCommandEnvironment > m_xEnv;
    ::osl::Mutex m_aMutex;
    Sequence< OUString > m_aBlackList;

    OUString m_sLastUpdatedDir;

    DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);

public:
    FolderTree( vcl::Window* pParent, WinBits nBits );
    FolderTree(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel);

    virtual void RequestingChildren( SvTreeListEntry* pEntry ) override;
    void clear() { m_xTreeView->clear(); }

    void FillTreeEntry( SvTreeListEntry* pEntry );
    void FillTreeEntry( const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders );
    void SetTreePath( OUString const & sUrl );
    void SetBlackList( const css::uno::Sequence< OUString >& rBlackList );
    void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }

    void InsertRootEntry(const OUString& rId, const OUString& rRootLabel);
    void FillTreeEntry(const weld::TreeIter& rEntry);
    void FillTreeEntry(const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders);
    void SetTreePath(OUString const & sUrl);
    void SetBlackList(const css::uno::Sequence< OUString >& rBlackList);
};

#endif
diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx
index 9db337f..5176e62 100644
--- a/fpicker/source/office/fpdialogbase.hxx
+++ b/fpicker/source/office/fpdialogbase.hxx
@@ -19,7 +19,7 @@
#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX
#define INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX

#include <vcl/dialog.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -57,14 +57,16 @@

// SvtFileDialog_Base

class SvtFileDialog_Base : public Dialog, public ::svt::IFilePickerController
class SvtFileDialog_Base : public weld::GenericDialogController, public ::svt::IFilePickerController
{
public:
    SvtFileDialog_Base( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription )
        : Dialog(pParent, rID, rUIXMLDescription)
    SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID)
        : weld::GenericDialogController(pParent, rUIXMLDescription, rID)
    {
    }

    virtual bool PrepareExecute() { return true ; }

    virtual SvtFileView* GetView() = 0;

    virtual void SetHasFilename( bool bHasFilename ) = 0;
@@ -94,7 +96,6 @@

    virtual void EnableAutocompletion( bool _bEnable = true ) = 0;

    virtual sal_Int32 getTargetColorDepth() = 0;
    virtual sal_Int32 getAvailableWidth() = 0;
    virtual sal_Int32 getAvailableHeight() = 0;

diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index de406c9..61e5b2c 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -28,8 +28,8 @@
#include <fpsofficeResMgr.hxx>
#include <tools/stream.hxx>
#include <tools/urlobj.hxx>
#include <vcl/errinf.hxx>
#include <vcl/event.hxx>
#include <vcl/graph.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
@@ -95,20 +95,14 @@
using namespace CommonFilePickerElementIds;
using namespace InternalFilePickerElementIds;

// Time to wait while traveling in the filterbox until
// the browsebox gets filtered ( in ms).
#define TRAVELFILTER_TIMEOUT    750

// functions -------------------------------------------------------------

namespace
{


    OUString getMostCurrentFilter( std::unique_ptr<SvtExpFileDlg_Impl> const & pImpl )
    {
        assert( pImpl && "invalid impl pointer" );
        const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter.get();
        const SvtFileDialogFilter_Impl* pFilter = pImpl->m_xUserFilter.get();

        if ( !pFilter )
            pFilter = pImpl->GetCurFilter();
@@ -119,7 +113,6 @@
        return pFilter->GetType();
    }


    bool restoreCurrentFilter( std::unique_ptr<SvtExpFileDlg_Impl> const & pImpl )
    {
        SAL_WARN_IF( !pImpl->GetCurFilter(), "fpicker.office", "restoreCurrentFilter: no current filter!" );
@@ -283,360 +276,113 @@
}

// SvtFileDialog

SvtFileDialog::SvtFileDialog
(
    vcl::Window* _pParent,
    PickerFlags nBits
) :
    SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" )

    ,_pCbReadOnly( nullptr )
    ,_pCbLinkBox( nullptr)
    ,_pCbPreviewBox( nullptr )
    ,_pCbSelection( nullptr )
    ,_pPbPlay( nullptr )
    ,_pPrevWin( nullptr )
    ,_pPrevBmp( nullptr )
    ,_pFileView( nullptr )
    ,_pFileNotifier( nullptr )
    ,pImpl( new SvtExpFileDlg_Impl )
    ,_nPickerFlags( nBits )
    ,_bIsInExecute( false )
    ,m_bInExecuteAsync( false )
    ,m_bHasFilename( false )
    ,m_context(comphelper::getProcessComponentContext())
SvtFileDialog::SvtFileDialog(weld::Window* pParent, PickerFlags nStyle)
    : SvtFileDialog_Base(pParent, "fps/ui/explorerfiledialog.ui", "ExplorerFileDialog")
    , m_xCbReadOnly(m_xBuilder->weld_check_button("readonly"))
    , m_xCbLinkBox(m_xBuilder->weld_check_button("link"))
    , m_xCbPreviewBox(m_xBuilder->weld_check_button("cb_preview"))
    , m_xCbSelection(m_xBuilder->weld_check_button("selection"))
    , m_xPbPlay(m_xBuilder->weld_button("play"))
    , m_xPreviewFrame(m_xBuilder->weld_widget("previewframe"))
    , m_xPrevBmp(m_xBuilder->weld_image("preview"))
    , m_pFileNotifier(nullptr)
    , m_xImpl(new SvtExpFileDlg_Impl)
    , m_nPickerFlags(nStyle)
    , m_bIsInExecute(false)
    , m_bInExecuteAsync(false)
    , m_bHasFilename(false)
    , m_xContext(comphelper::getProcessComponentContext())
{
    Init_Impl( nBits );
}
    m_xImpl->m_xCbOptions = m_xBuilder->weld_check_button("options");
    m_xImpl->m_xFtFileName = m_xBuilder->weld_label("file_name_label");
    m_xImpl->m_xEdFileName.reset(new URLBox(m_xBuilder->weld_combo_box("file_name")));
    m_xImpl->m_xFtFileType = m_xBuilder->weld_label("file_type_label");
    m_xImpl->m_xLbFilter = m_xBuilder->weld_combo_box("file_type");
    m_xImpl->m_xEdCurrentPath.reset(new URLBox(m_xBuilder->weld_combo_box("current_path")));
    m_xImpl->m_xBtnFileOpen = m_xBuilder->weld_button("open");
    m_xImpl->m_xBtnCancel = m_xBuilder->weld_button("cancel");
    m_xImpl->m_xBtnHelp = m_xBuilder->weld_button("help");
    m_xImpl->m_xBtnConnectToServer = m_xBuilder->weld_button("connect_to_server");
    m_xImpl->m_xBtnNewFolder = m_xBuilder->weld_button("new_folder");
    m_xImpl->m_xCbPassword = m_xBuilder->weld_check_button("password");
    m_xImpl->m_xCbGPGEncrypt = m_xBuilder->weld_check_button("gpgencrypt");
    m_xImpl->m_xCbAutoExtension = m_xBuilder->weld_check_button("extension");
    m_xImpl->m_xFtFileVersion = m_xBuilder->weld_label("shared_label");
    m_xImpl->m_xLbFileVersion = m_xBuilder->weld_combo_box("shared");
    m_xImpl->m_xFtTemplates = m_xBuilder->weld_label("shared_label");
    m_xImpl->m_xLbTemplates = m_xBuilder->weld_combo_box("shared");
    m_xImpl->m_xFtImageTemplates = m_xBuilder->weld_label("shared_label");
    m_xImpl->m_xLbImageTemplates = m_xBuilder->weld_combo_box("shared");
    m_xImpl->m_xFtImageAnchor = m_xBuilder->weld_label("shared_label");
    m_xImpl->m_xLbImageAnchor = m_xBuilder->weld_combo_box("shared");

    // because the "<All Formats> (*.bmp,*...)" entry is too wide,
    // we need to disable the auto width feature of the filter box
    int nWidth = m_xImpl->m_xLbFilter->get_approximate_digit_width() * 60;
    m_xImpl->m_xLbImageTemplates->set_size_request(nWidth, -1);
    m_xImpl->m_xLbFilter->set_size_request(nWidth, -1);

class CustomContainer : public vcl::Window
{
    enum FocusState
    {
        Prev = 0,
        Places,
        Add,
        Delete,
        FileView,
        Next,
        FocusCount
    };
    m_xImpl->m_xBtnUp.reset(new SvtUpButton_Impl(m_xBuilder->weld_toolbar("up_bar"),
                                                 m_xBuilder->weld_menu("up_menu"),
                                                 this));
    m_xImpl->m_xBtnUp->set_help_id(HID_FILEOPEN_LEVELUP);
    m_xImpl->m_xBtnUp->show();

    SvtExpFileDlg_Impl* pImpl;
    VclPtr<SvtFileView> _pFileView;
    VclPtr<Splitter>    _pSplitter;
    m_xImpl->m_nStyle = nStyle;
    m_xImpl->m_eMode = ( nStyle & PickerFlags::SaveAs ) ? FILEDLG_MODE_SAVE : FILEDLG_MODE_OPEN;
    m_xImpl->m_eDlgType = FILEDLG_TYPE_FILEDLG;

    int m_nCurrentFocus;
    VclPtr<vcl::Window> m_pFocusWidgets[FocusState::FocusCount];

public:
    explicit CustomContainer(vcl::Window *pParent)
        : Window(pParent)
        , pImpl(nullptr)
        , _pFileView(nullptr)
        , _pSplitter(nullptr)
        , m_nCurrentFocus(FocusState::Prev)
    {
    }
    virtual ~CustomContainer() override { disposeOnce(); }
    virtual void dispose() override
    {
        _pFileView.clear();
        _pSplitter.clear();
        vcl::Window::dispose();
    }

    void init(SvtExpFileDlg_Impl* pImp,
              SvtFileView* pFileView,
              Splitter* pSplitter,
              vcl::Window* pPrev,
              vcl::Window* pNext)
    {
        pImpl      = pImp;
        _pFileView = pFileView;
        _pSplitter = pSplitter;

        m_pFocusWidgets[FocusState::Prev] = pPrev;
        m_pFocusWidgets[FocusState::Places] = pImpl->_pPlaces->GetPlacesListBox();
        m_pFocusWidgets[FocusState::Add] = pImpl->_pPlaces->GetAddButton();
        m_pFocusWidgets[FocusState::Delete] = pImpl->_pPlaces->GetDeleteButton();
        m_pFocusWidgets[FocusState::FileView] = pFileView;
        m_pFocusWidgets[FocusState::Next] = pNext;
    }

    virtual void Resize() override
    {
        Window::Resize();

        if (!pImpl || !pImpl->_pPlaces)
            return;

        Size aSize = GetSizePixel();

        Point aBoxPos(_pFileView->GetPosPixel());
        Size aNewSize(aSize.Width() - aBoxPos.X(), aSize.Height());
        _pFileView->SetSizePixel( aNewSize );

        // Resize the Splitter to fit the height
        Size splitterNewSize = _pSplitter->GetSizePixel( );
        splitterNewSize.setHeight( aSize.Height() );
        _pSplitter->SetSizePixel( splitterNewSize );
        sal_Int32 nMinX = pImpl->_pPlaces->GetPosPixel( ).X( );
        sal_Int32 nMaxX = _pFileView->GetPosPixel( ).X( ) + _pFileView->GetSizePixel( ).Width() - nMinX;
        _pSplitter->SetDragRectPixel( tools::Rectangle( Point( nMinX, 0 ), Size( nMaxX, aSize.Width() ) ) );

        // Resize the places list box to fit the height of the FileView
        Size placesNewSize(pImpl->_pPlaces->GetSizePixel());
        placesNewSize.setHeight( aSize.Height() );
        pImpl->_pPlaces->SetSizePixel( placesNewSize );
    }

    void changeFocus( bool bReverse )
    {
        if( !_pFileView || !pImpl || !pImpl->_pPlaces )
            return;

        if( bReverse && m_nCurrentFocus > FocusState::Prev && m_nCurrentFocus <= FocusState::Next )
        {
            m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false);
            m_pFocusWidgets[m_nCurrentFocus]->LoseFocus();

            m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus( true );
            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
        }
        else if( !bReverse && m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus < FocusState::Next )
        {
            m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false);
            m_pFocusWidgets[m_nCurrentFocus]->LoseFocus();

            m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true );
            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
        }
    }

    virtual void GetFocus() override
    {
        if( !_pFileView || !pImpl || !pImpl->_pPlaces )
            return;

        GetFocusFlags aFlags = GetGetFocusFlags();

        if( aFlags & GetFocusFlags::Forward )
            m_nCurrentFocus = FocusState::Places;
        else if( aFlags & GetFocusFlags::Backward )
            m_nCurrentFocus = FocusState::FileView;

        if( m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus <= FocusState::Next )
        {
            m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true );
            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
        }
    }

    virtual bool EventNotify( NotifyEvent& rNEvt ) override
    {
        if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
        {
            // we must also update counter when user change focus using mouse
            for(int i = FocusState::Prev; i <= FocusState::Next; i++)
            {
                if( rNEvt.GetWindow() == m_pFocusWidgets[i] )
                {
                    m_nCurrentFocus = i;
                    return true;
                }
            }

            // GETFOCUS for one of FileView's subcontrols
            m_nCurrentFocus = FocusState::FileView;
            return true;
        }
        if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
        {
            const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
            const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
            bool bShift = rCode.IsShift();
            if( rCode.GetCode() == KEY_TAB )
            {
                changeFocus( bShift );
                return true;
            }
        }
        return Window::EventNotify(rNEvt);
    }
};

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

void SvtFileDialog::dispose()
{
    if ( !pImpl->_aIniKey.isEmpty() )
    {
        // save window state
        SvtViewOptions aDlgOpt( EViewType::Dialog, pImpl->_aIniKey );
        aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(), osl_getThreadTextEncoding()));
        OUString sUserData = _pFileView->GetConfigString();
        aDlgOpt.SetUserItem( "UserData",
                             makeAny( sUserData ) );
    }

    _pFileView->SetSelectHdl( Link<SvTreeListBox*,void>() );

    // Save bookmarked places
    if(pImpl->_pPlaces->IsUpdated()) {
        const std::vector<PlacePtr> aPlaces = pImpl->_pPlaces->GetPlaces();
        Sequence< OUString > placesUrlsList(pImpl->_pPlaces->GetNbEditablePlaces());
        Sequence< OUString > placesNamesList(pImpl->_pPlaces->GetNbEditablePlaces());
        int i(0);
        for (auto const& place : aPlaces)
        {
            if(place->IsEditable()) {
                placesUrlsList[i] = place->GetUrl();
                placesNamesList[i] = place->GetName();
                ++i;
            }
        }

        std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context));
        officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(placesUrlsList, batch);
        officecfg::Office::Common::Misc::FilePickerPlacesNames::set(placesNamesList, batch);
        batch->commit();
    }

    _pFileView.disposeAndClear();
    pImpl.reset();
    _pSplitter.disposeAndClear();
    _pContainer.disposeAndClear();
    _pPrevBmp.disposeAndClear();
    _pCbReadOnly.clear();
    _pCbLinkBox.clear();
    _pCbPreviewBox.clear();
    _pCbSelection.clear();
    _pPbPlay.clear();
    _pPrevWin.clear();
    m_aDisabledControls.clear();
    Dialog::dispose();
}

void SvtFileDialog::Init_Impl
(
    PickerFlags nStyle
)
{
    get(_pCbReadOnly, "readonly");
    get(_pCbLinkBox, "link");
    get(_pCbPreviewBox, "cb_preview");
    get(_pCbSelection, "selection");
    get(_pPrevWin, "preview");
    get(_pPbPlay, "play");
    get(pImpl->_pCbOptions, "options");
    get(pImpl->_pFtFileName, "file_name_label");
    get(pImpl->_pEdFileName, "file_name");
    pImpl->_pEdFileName->GetFocus();
    get(pImpl->_pFtFileType, "file_type_label");
    get(pImpl->_pLbFilter, "file_type");
    get(pImpl->_pEdCurrentPath, "current_path");
    get(pImpl->_pBtnFileOpen, "open");
    get(pImpl->_pBtnCancel, "cancel");
    get(pImpl->_pBtnHelp, "help");
    get(pImpl->_pBtnConnectToServer, "connect_to_server");
    get(pImpl->_pBtnNewFolder, "new_folder");
    get(pImpl->_pCbPassword, "password");
    get(pImpl->_pCbGPGEncrypt, "gpgencrypt");
    get(pImpl->_pCbAutoExtension, "extension");
    get(pImpl->_pFtFileVersion, "shared_label");
    get(pImpl->_pLbFileVersion, "shared");
    get(pImpl->_pFtTemplates, "shared_label");
    get(pImpl->_pLbTemplates, "shared");
    get(pImpl->_pFtImageTemplates, "shared_label");
    get(pImpl->_pLbImageTemplates, "shared");
    get(pImpl->_pFtImageAnchor, "shared_label");
    get(pImpl->_pLbImageAnchor, "shared");

    pImpl->_pLbImageTemplates->setMaxWidthChars(40);
    pImpl->_pLbFilter->setMaxWidthChars(40);

    vcl::Window *pUpContainer = get<vcl::Window>("up");
    pImpl->_pBtnUp = VclPtr<SvtUpButton_Impl>::Create(pUpContainer, this, 0);
    pImpl->_pBtnUp->SetHelpId( HID_FILEOPEN_LEVELUP );
    pImpl->_pBtnUp->set_vexpand(true);
    pImpl->_pBtnUp->Show();

    pImpl->_nStyle = nStyle;
    pImpl->_eMode = ( nStyle & PickerFlags::SaveAs ) ? FILEDLG_MODE_SAVE : FILEDLG_MODE_OPEN;
    pImpl->_eDlgType = FILEDLG_TYPE_FILEDLG;

    if ( nStyle & PickerFlags::PathDialog )
        pImpl->_eDlgType = FILEDLG_TYPE_PATHDLG;
    if (nStyle & PickerFlags::PathDialog)
        m_xImpl->m_eDlgType = FILEDLG_TYPE_PATHDLG;

    // Set the directory for the "back to the default dir" button
    INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
    SetStandardDir( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );

    // Create control element, the order defines the tab control.
    pImpl->_pEdFileName->SetSelectHdl( LINK( this, SvtFileDialog, EntrySelectHdl_Impl ) );
    pImpl->_pEdFileName->SetOpenHdl( LINK( this, SvtFileDialog, OpenUrlHdl_Impl ) );
    m_xImpl->m_xEdFileName->connect_changed( LINK( this, SvtFileDialog, EntrySelectHdl_Impl ) );
    m_xImpl->m_xEdFileName->connect_entry_activate( LINK( this, SvtFileDialog, OpenUrlHdl_Impl ) );

    // in folder picker mode, only auto-complete directories (no files)
    bool bIsFolderPicker = ( pImpl->_eDlgType == FILEDLG_TYPE_PATHDLG );
    pImpl->_pEdFileName->SetOnlyDirectories( bIsFolderPicker );
    bool bIsFolderPicker = m_xImpl->m_eDlgType == FILEDLG_TYPE_PATHDLG;
    m_xImpl->m_xEdFileName->SetOnlyDirectories( bIsFolderPicker );

    // in save mode, don't use the autocompletion as selection in the edit part
    bool bSaveMode = ( FILEDLG_MODE_SAVE == pImpl->_eMode );
    pImpl->_pEdFileName->SetNoURLSelection( bSaveMode );
    bool bSaveMode = FILEDLG_MODE_SAVE == m_xImpl->m_eMode;
    m_xImpl->m_xEdFileName->SetNoURLSelection( bSaveMode );

    pImpl->_pBtnUp->SetAccessibleName( pImpl->_pBtnUp->GetQuickHelpText() );
    if (nStyle & PickerFlags::MultiSelection)
        m_xImpl->m_bMultiSelection = true;

    if ( nStyle & PickerFlags::MultiSelection )
        pImpl->_bMultiSelection = true;
    m_xContainer = m_xBuilder->weld_container("container");
    m_xContainer->set_size_request(m_xContainer->get_approximate_digit_width() * 95, -1);

    _pContainer.reset(VclPtr<CustomContainer>::Create(get<vcl::Window>("container")));
    Size aSize(LogicToPixel(Size(270, 85), MapMode(MapUnit::MapAppFont)));
    _pContainer->set_height_request(aSize.Height());
    _pContainer->set_width_request(aSize.Width());
    _pContainer->set_hexpand(true);
    _pContainer->set_vexpand(true);
    _pContainer->SetStyle( _pContainer->GetStyle() | WB_TABSTOP );

    _pFileView = VclPtr<SvtFileView>::Create( _pContainer, WB_BORDER,
                                       FILEDLG_TYPE_PATHDLG == pImpl->_eDlgType,
                                       pImpl->_bMultiSelection );
    _pFileView->Show();
    _pFileView->EnableAutoResize();
    _pFileView->SetHelpId( HID_FILEDLG_STANDARD );
    _pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP );

    _pSplitter = VclPtr<Splitter>::Create( _pContainer, WB_HSCROLL );
    _pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
    _pSplitter->SetSplitHdl( LINK( this, SvtFileDialog, Split_Hdl ) );

    Image aNewFolderImg( GetButtonImage( BMP_FILEDLG_CREATEFOLDER ) );
    pImpl->_pBtnNewFolder->SetModeImage( aNewFolderImg );
    m_xFileView.reset(new SvtFileView(m_xDialog.get(),
                                      m_xBuilder->weld_tree_view("fileview"),
                                      m_xBuilder->weld_icon_view("iconview"),
                                      FILEDLG_TYPE_PATHDLG == m_xImpl->m_eDlgType,
                                      m_xImpl->m_bMultiSelection));
    m_xFileView->set_help_id( HID_FILEDLG_STANDARD );

    if ( nStyle & PickerFlags::ReadOnly )
    {
        _pCbReadOnly->SetHelpId( HID_FILEOPEN_READONLY );
        _pCbReadOnly->SetText( FpsResId( STR_SVT_FILEPICKER_READONLY ) );
        _pCbReadOnly->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        _pCbReadOnly->Show();
        m_xCbReadOnly->set_help_id( HID_FILEOPEN_READONLY );
        m_xCbReadOnly->set_label( FpsResId( STR_SVT_FILEPICKER_READONLY ) );
        m_xCbReadOnly->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xCbReadOnly->show();
    }

    if ( nStyle & PickerFlags::Password )
    {
        pImpl->_pCbPassword->SetText( FpsResId( STR_SVT_FILEPICKER_PASSWORD ) );
        pImpl->_pCbPassword->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        pImpl->_pCbPassword->Show();
        pImpl->_pCbGPGEncrypt->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        pImpl->_pCbGPGEncrypt->Show();
        m_xImpl->m_xCbPassword->set_label( FpsResId( STR_SVT_FILEPICKER_PASSWORD ) );
        m_xImpl->m_xCbPassword->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xImpl->m_xCbPassword->show();
        m_xImpl->m_xCbGPGEncrypt->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xImpl->m_xCbGPGEncrypt->show();
    }

    // set the ini file for extracting the size
    pImpl->_aIniKey = "FileDialog";
    m_xImpl->m_aIniKey = "FileDialog";

    AddControls_Impl( );

@@ -652,70 +398,68 @@

    if ( nStyle & PickerFlags::PathDialog )
    {
        pImpl->_pFtFileName->SetText( FpsResId( STR_PATHNAME ) );
        m_xImpl->m_xFtFileName->set_label( FpsResId( STR_PATHNAME ) );
        pResId = STR_PATHSELECT;
        pButtonResId = STR_BUTTONSELECT;
    }

    SetText( FpsResId( pResId ) );
    m_xDialog->set_title(FpsResId(pResId));

    if ( pButtonResId )
        pImpl->_pBtnFileOpen->SetText( FpsResId( pButtonResId ) );
        m_xImpl->m_xBtnFileOpen->set_label( FpsResId( pButtonResId ) );

    if ( FILEDLG_TYPE_FILEDLG != pImpl->_eDlgType )
    if ( FILEDLG_TYPE_FILEDLG != m_xImpl->m_eDlgType )
    {
        pImpl->_pFtFileType->Hide();
        pImpl->GetFilterListControl()->Hide();
        m_xImpl->m_xFtFileType->hide();
        m_xImpl->GetFilterListControl()->hide();
    }

    // Setting preferences of the control elements.
    pImpl->_pBtnNewFolder->SetClickHdl( LINK( this, SvtFileDialog, NewFolderHdl_Impl ) );
    pImpl->_pBtnFileOpen->SetClickHdl( LINK( this, SvtFileDialog, OpenClickHdl_Impl ) );
    pImpl->_pBtnCancel->SetClickHdl( LINK( this, SvtFileDialog, CancelHdl_Impl ) );
    pImpl->SetFilterListSelectHdl( LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) );
    pImpl->_pEdFileName->SetGetFocusHdl( LINK( this, SvtFileDialog, FileNameGetFocusHdl_Impl ) );
    pImpl->_pEdFileName->SetModifyHdl( LINK( this, SvtFileDialog, FileNameModifiedHdl_Impl ) );
    pImpl->_pEdCurrentPath->SetOpenHdl ( LINK( this, SvtFileDialog, URLBoxModifiedHdl_Impl ) );
    pImpl->_pBtnConnectToServer->SetClickHdl( LINK ( this, SvtFileDialog, ConnectToServerPressed_Hdl ) );
    m_xImpl->m_xBtnNewFolder->connect_clicked( LINK( this, SvtFileDialog, NewFolderHdl_Impl ) );
    m_xImpl->m_xBtnFileOpen->connect_clicked( LINK( this, SvtFileDialog, OpenClickHdl_Impl ) );
    m_xImpl->m_xBtnCancel->connect_clicked( LINK( this, SvtFileDialog, CancelHdl_Impl ) );
    m_xImpl->SetFilterListSelectHdl( LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) );
    m_xImpl->m_xEdFileName->connect_focus_in( LINK( this, SvtFileDialog, FileNameGetFocusHdl_Impl ) );
    m_xImpl->m_xEdFileName->connect_changed( LINK( this, SvtFileDialog, FileNameModifiedHdl_Impl ) );
    m_xImpl->m_xEdCurrentPath->connect_entry_activate( LINK( this, SvtFileDialog, URLBoxModifiedHdl_Impl ) );
    m_xImpl->m_xBtnConnectToServer->connect_clicked( LINK ( this, SvtFileDialog, ConnectToServerPressed_Hdl ) );


    _pFileView->SetSelectHdl( LINK( this, SvtFileDialog, SelectHdl_Impl ) );
    _pFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) );
    _pFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) );

    m_xFileView->SetSelectHdl( LINK( this, SvtFileDialog, SelectHdl_Impl ) );
    m_xFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) );
    m_xFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) );

    // set timer for the filterbox travel
    pImpl->_aFilterTimer.SetTimeout( TRAVELFILTER_TIMEOUT );
    pImpl->_aFilterTimer.SetInvokeHandler( LINK( this, SvtFileDialog, FilterSelectTimerHdl_Impl ) );
    m_xImpl->m_aFilterIdle.SetPriority(TaskPriority::LOWEST);
    m_xImpl->m_aFilterIdle.SetInvokeHandler( LINK( this, SvtFileDialog, FilterSelectTimerHdl_Impl ) );

    if ( PickerFlags::SaveAs & nStyle )
    {
        // different help ids if in save-as mode
        SetHelpId( HID_FILESAVE_DIALOG );
        m_xDialog->set_help_id( HID_FILESAVE_DIALOG );

        pImpl->_pEdFileName->SetHelpId( HID_FILESAVE_FILEURL );
        pImpl->_pBtnFileOpen->SetHelpId( HID_FILESAVE_DOSAVE );
        pImpl->_pBtnNewFolder->SetHelpId( HID_FILESAVE_CREATEDIRECTORY );
        pImpl->_pBtnUp->SetHelpId( HID_FILESAVE_LEVELUP );
        pImpl->GetFilterListControl()->SetHelpId( HID_FILESAVE_FILETYPE );
        _pFileView->SetHelpId( HID_FILESAVE_FILEVIEW );
        m_xImpl->m_xEdFileName->set_help_id( HID_FILESAVE_FILEURL );
        m_xImpl->m_xBtnFileOpen->set_help_id( HID_FILESAVE_DOSAVE );
        m_xImpl->m_xBtnNewFolder->set_help_id( HID_FILESAVE_CREATEDIRECTORY );
        m_xImpl->m_xBtnUp->set_help_id( HID_FILESAVE_LEVELUP );
        m_xImpl->GetFilterListControl()->set_help_id( HID_FILESAVE_FILETYPE );
        m_xFileView->set_help_id( HID_FILESAVE_FILEVIEW );

        // formerly, there was only _pLbFileVersion, which was used for 3 different
        // use cases. For reasons of maintainability, I introduced extra members (_pLbTemplates, _pLbImageTemplates)
        // for the extra use cases, and separated _pLbFileVersion
        // I did not find out in which cases the help ID is really needed HID_FILESAVE_TEMPLATE - all
        // tests I made lead to a dialog where _no_ of the three list boxes was present.
        if ( pImpl->_pLbFileVersion )
            pImpl->_pLbFileVersion->SetHelpId( HID_FILESAVE_TEMPLATE );
        if ( pImpl->_pLbTemplates )
            pImpl->_pLbTemplates->SetHelpId( HID_FILESAVE_TEMPLATE );
        if ( pImpl->_pLbImageTemplates )
            pImpl->_pLbImageTemplates->SetHelpId( HID_FILESAVE_TEMPLATE );
        if ( m_xImpl->m_xLbFileVersion )
            m_xImpl->m_xLbFileVersion->set_help_id( HID_FILESAVE_TEMPLATE );
        if ( m_xImpl->m_xLbTemplates )
            m_xImpl->m_xLbTemplates->set_help_id( HID_FILESAVE_TEMPLATE );
        if ( m_xImpl->m_xLbImageTemplates )
            m_xImpl->m_xLbImageTemplates->set_help_id( HID_FILESAVE_TEMPLATE );

        if ( pImpl->_pCbPassword ) pImpl->_pCbPassword->SetHelpId( HID_FILESAVE_SAVEWITHPASSWORD );
        if ( pImpl->_pCbAutoExtension ) pImpl->_pCbAutoExtension->SetHelpId( HID_FILESAVE_AUTOEXTENSION );
        if ( pImpl->_pCbOptions ) pImpl->_pCbOptions->SetHelpId( HID_FILESAVE_CUSTOMIZEFILTER );
        if ( _pCbSelection ) _pCbSelection->SetHelpId( HID_FILESAVE_SELECTION );
        if ( m_xImpl->m_xCbPassword ) m_xImpl->m_xCbPassword->set_help_id( HID_FILESAVE_SAVEWITHPASSWORD );
        if ( m_xImpl->m_xCbAutoExtension ) m_xImpl->m_xCbAutoExtension->set_help_id( HID_FILESAVE_AUTOEXTENSION );
        if ( m_xImpl->m_xCbOptions ) m_xImpl->m_xCbOptions->set_help_id( HID_FILESAVE_CUSTOMIZEFILTER );
        if ( m_xCbSelection ) m_xCbSelection->set_help_id( HID_FILESAVE_SELECTION );
    }

    /// read our settings from the configuration
@@ -724,20 +468,54 @@
        "/org.openoffice.Office.UI/FilePicker"
    );

    _pContainer->init(pImpl.get(), _pFileView, _pSplitter, pImpl->_pBtnNewFolder, pImpl->_pEdFileName);
    _pContainer->Show();

    Resize();
    m_xDialog->connect_size_allocate(LINK(this, SvtFileDialog, SizeAllocHdl));
    SizeAllocHdl(Size());
}

IMPL_LINK_NOARG( SvtFileDialog, NewFolderHdl_Impl, Button*, void)
SvtFileDialog::~SvtFileDialog()
{
    _pFileView->EndInplaceEditing();
    if (!m_xImpl->m_aIniKey.isEmpty())
    {
        // save window state
        SvtViewOptions aDlgOpt( EViewType::Dialog, m_xImpl->m_aIniKey );
        aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8));
        OUString sUserData = m_xFileView->GetConfigString();
        aDlgOpt.SetUserItem( "UserData",
                             makeAny( sUserData ) );
    }

    SmartContent aContent( _pFileView->GetViewURL( ) );
    m_xFileView->SetSelectHdl(Link<SvtFileView*,void>());

    // Save bookmarked places
    if (m_xImpl->m_xPlaces->IsUpdated()) {
        const std::vector<PlacePtr> aPlaces = m_xImpl->m_xPlaces->GetPlaces();
        Sequence< OUString > placesUrlsList(m_xImpl->m_xPlaces->GetNbEditablePlaces());
        Sequence< OUString > placesNamesList(m_xImpl->m_xPlaces->GetNbEditablePlaces());
        int i(0);
        for (auto const& place : aPlaces)
        {
            if(place->IsEditable()) {
                placesUrlsList[i] = place->GetUrl();
                placesNamesList[i] = place->GetName();
                ++i;
            }
        }

        std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_xContext));
        officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(placesUrlsList, batch);
        officecfg::Office::Common::Misc::FilePickerPlacesNames::set(placesNamesList, batch);
        batch->commit();
    }
}

IMPL_LINK_NOARG(SvtFileDialog, NewFolderHdl_Impl, weld::Button&, void)
{
    m_xFileView->EndInplaceEditing();

    SmartContent aContent( m_xFileView->GetViewURL( ) );
    OUString aTitle;
    aContent.getTitle( aTitle );
    QueryFolderNameDialog aDlg(GetFrameWeld(), aTitle, FpsResId(STR_SVT_NEW_FOLDER));
    QueryFolderNameDialog aDlg(m_xDialog.get(), aTitle, FpsResId(STR_SVT_NEW_FOLDER));
    bool bHandled = false;

    while ( !bHandled )
@@ -747,7 +525,7 @@
            OUString aUrl = aContent.createFolder(aDlg.GetName());
            if ( !aUrl.isEmpty( ) )
            {
                _pFileView->CreatedFolder(aUrl, aDlg.GetName());
                m_xFileView->CreatedFolder(aUrl, aDlg.GetName());
                bHandled = true;
            }
        }
@@ -759,7 +537,7 @@
void SvtFileDialog::createNewUserFilter( const OUString& _rNewFilter )
{
    // delete the old user filter and create a new one
    pImpl->_pUserFilter.reset( new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter ) );
    m_xImpl->m_xUserFilter.reset( new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter ) );

    // remember the extension
    bool bIsAllFiles = _rNewFilter == FILEDIALOG_FILTER_ALL;
@@ -771,18 +549,18 @@
        // is always "*.<something>". But changing this would take some more time than I have now...

    // now, the default extension is set to the one of the user filter (or empty)
    if ( pImpl->GetCurFilter( ) )
        SetDefaultExt( pImpl->GetCurFilter( )->GetExtension() );
    if ( m_xImpl->GetCurFilter( ) )
        SetDefaultExt( m_xImpl->GetCurFilter( )->GetExtension() );
    else
        EraseDefaultExt();
}


AdjustFilterFlags SvtFileDialog::adjustFilter( const OUString& _rFilter )
AdjustFilterFlags SvtFileDialog::adjustFilter( const OUString& rFilter )
{
    AdjustFilterFlags nReturn = AdjustFilterFlags::NONE;

    const bool bNonEmpty = !_rFilter.isEmpty();
    const bool bNonEmpty = !rFilter.isEmpty();
    if ( bNonEmpty )
    {
        nReturn |= AdjustFilterFlags::NonEmpty;
@@ -790,11 +568,11 @@
        bool bFilterChanged = true;

        // search for a corresponding filter
        SvtFileDialogFilter_Impl* pFilter = FindFilter_Impl( _rFilter, false, bFilterChanged );
        SvtFileDialogFilter_Impl* pFilter = FindFilter_Impl( rFilter, false, bFilterChanged );

        // look for multi-ext filters if necessary
        if ( !pFilter )
            pFilter = FindFilter_Impl( _rFilter, true, bFilterChanged );
            pFilter = FindFilter_Impl( rFilter, true, bFilterChanged );

        if ( bFilterChanged )
            nReturn |= AdjustFilterFlags::Changed;
@@ -803,15 +581,14 @@
        {
            nReturn |= AdjustFilterFlags::UserFilter;
            // no filter found : use it as user defined filter
            createNewUserFilter( _rFilter );
            createNewUserFilter( rFilter );
        }
    }

    return nReturn;
}


IMPL_LINK_NOARG(SvtFileDialog, CancelHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvtFileDialog, CancelHdl_Impl, weld::Button&, void)
{
    if ( m_pCurrentAsyncAction.is() )
    {
@@ -820,22 +597,24 @@
    }
    else
    {
        EndDialog();
        m_xDialog->response(RET_CANCEL);
    }
}

IMPL_LINK( SvtFileDialog, OpenClickHdl_Impl, weld::Button&, rVoid, void )
{
    OpenHdl_Impl(&rVoid);
}

IMPL_LINK( SvtFileDialog, OpenClickHdl_Impl, Button*, pVoid, void )
IMPL_LINK( SvtFileDialog, OpenUrlHdl_Impl, weld::ComboBox&, rVoid, bool )
{
    OpenHdl_Impl(pVoid);
    OpenHdl_Impl(&rVoid);
    return true;
}
IMPL_LINK( SvtFileDialog, OpenUrlHdl_Impl, SvtURLBox*, pVoid, void )
{
    OpenHdl_Impl(pVoid);
}

void SvtFileDialog::OpenHdl_Impl(void const * pVoid)
{
    if ( pImpl->_bMultiSelection && _pFileView->GetSelectionCount() > 1 )
    if ( m_xImpl->m_bMultiSelection && m_xFileView->GetSelectionCount() > 1 )
    {
        // special open in case of multiselection
        OpenMultiSelection_Impl();
@@ -843,30 +622,28 @@
    }

    OUString aFileName;
    OUString aOldPath( _pFileView->GetViewURL() );
    if ( pImpl->_bDoubleClick || _pFileView->HasChildPathFocus() )
    OUString aOldPath(m_xFileView->GetViewURL());
    if ( m_xImpl->m_bDoubleClick || m_xFileView->has_focus() )
    {
        // Selection done by doubleclicking in the view, get filename from the view
        aFileName = _pFileView->GetCurrentURL();
        aFileName = m_xFileView->GetCurrentURL();
    }

    if ( aFileName.isEmpty() )
    {
        // if an entry is selected in the view...
        if ( _pFileView->GetSelectionCount() )
        if ( m_xFileView->GetSelectionCount() )
        {   // -> use this one. This will allow us to step down this folder
            aFileName = _pFileView->GetCurrentURL();
            aFileName = m_xFileView->GetCurrentURL();
        }
    }

    if ( aFileName.isEmpty() )
    {
        if ( pImpl->_eMode == FILEDLG_MODE_OPEN && pImpl->_pEdFileName->IsTravelSelect() )
            // OpenHdl called from URLBox; travelling through the list of URLs should not cause an opening
            return;                   // MBA->PB: seems to be called never ?!

        // get the URL from the edit field ( if not empty )
        if ( !pImpl->_pEdFileName->GetText().isEmpty() )
        if ( !m_xImpl->m_xEdFileName->get_active_text().isEmpty() )
        {
            OUString aText = pImpl->_pEdFileName->GetText();
            OUString aText = m_xImpl->m_xEdFileName->get_active_text();

            // did we reach the root?
            if ( !INetURLObject( aOldPath ).getSegmentCount() )
@@ -881,26 +658,26 @@
            if ( ( 1 == aText.getLength() ) && ( '~' == aText[0] ) )
            {
                // go to the home directory
                if ( lcl_getHomeDirectory( _pFileView->GetViewURL(), aFileName ) )
                if ( lcl_getHomeDirectory( m_xFileView->GetViewURL(), aFileName ) )
                    // in case we got a home dir, reset the text of the edit
                    pImpl->_pEdFileName->SetText( OUString() );
                    m_xImpl->m_xEdFileName->set_entry_text( OUString() );
            }
            if ( aFileName.isEmpty() )
#endif
            {
                // get url from autocomplete edit
                aFileName = pImpl->_pEdFileName->GetURL();
                aFileName = m_xImpl->m_xEdFileName->GetURL();
            }
        }
        else if ( pVoid == pImpl->_pBtnFileOpen.get() )
        else if ( pVoid == m_xImpl->m_xBtnFileOpen.get() )
            // OpenHdl was called for the "Open" Button; if edit field is empty, use selected element in the view
            aFileName = _pFileView->GetCurrentURL();
            aFileName = m_xFileView->GetCurrentURL();
    }

    // MBA->PB: ?!
    if ( aFileName.isEmpty() && pVoid == pImpl->_pEdFileName && pImpl->_pUserFilter )
    if ( aFileName.isEmpty() && pVoid == m_xImpl->m_xEdFileName.get() && m_xImpl->m_xUserFilter )
    {
        pImpl->_pUserFilter.reset();
        m_xImpl->m_xUserFilter.reset();
        return;
    }

@@ -908,9 +685,9 @@
    if ( !nLen )
    {
        // if the dialog was opened to select a folder, the last selected folder should be selected
        if( pImpl->_eDlgType == FILEDLG_TYPE_PATHDLG )
        if( m_xImpl->m_eDlgType == FILEDLG_TYPE_PATHDLG )
        {
            aFileName = pImpl->_pEdCurrentPath->GetText();
            aFileName = m_xImpl->m_xEdCurrentPath->get_active_text();
            nLen = aFileName.getLength();
        }
        else
@@ -919,7 +696,7 @@
    }

    // mark input as selected
    pImpl->_pEdFileName->SetSelection( Selection( 0, nLen ) );
    m_xImpl->m_xEdFileName->select_entry_region(0, nLen);

    // if a path with wildcards is given, divide the string into path and wildcards
    OUString aFilter;
@@ -931,15 +708,15 @@
    if ( nNewFilterFlags & AdjustFilterFlags::Changed )
    {
        // cut off all text before wildcard in edit and select wildcard
        pImpl->_pEdFileName->SetText( aFilter );
        pImpl->_pEdFileName->SetSelection( Selection( 0, aFilter.getLength() ) );
        m_xImpl->m_xEdFileName->set_entry_text( aFilter );
        m_xImpl->m_xEdFileName->select_entry_region(0, -1);
    }

    {
        INetURLObject aFileObject( aFileName );
        if ( ( aFileObject.GetProtocol() == INetProtocol::NotValid ) && !aFileName.isEmpty() )
        {
            OUString sCompleted = SvtURLBox::ParseSmart( aFileName, _pFileView->GetViewURL() );
            OUString sCompleted = SvtURLBox::ParseSmart( aFileName, m_xFileView->GetViewURL() );
            if ( !sCompleted.isEmpty() )
                aFileName = sCompleted;
        }
@@ -980,7 +757,7 @@
            return;

        if ( m_aContent.isInvalid() &&
             ( pImpl->_eMode == FILEDLG_MODE_OPEN ) )
             ( m_xImpl->m_eMode == FILEDLG_MODE_OPEN ) )
        {
            if ( !pHandler->wasUsed() )
                ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS );
@@ -995,35 +772,35 @@
            m_aContent.enableDefaultInteractionHandler();
     }

    if  (   !bIsFolder                                      // no existent folder
        &&  pImpl->_pCbAutoExtension                 // auto extension is enabled in general
        &&  pImpl->_pCbAutoExtension->IsChecked()    // auto extension is really to be used
        &&  !GetDefaultExt().isEmpty()               // there is a default extension
    if  (   !bIsFolder                              // no existent folder
        &&  m_xImpl->m_xCbAutoExtension             // auto extension is enabled in general
        &&  m_xImpl->m_xCbAutoExtension->get_active()// auto extension is really to be used
        &&  !GetDefaultExt().isEmpty()              // there is a default extension
        &&  GetDefaultExt() != "*" // the default extension is not "all"
        && !(   FILEDLG_MODE_SAVE == pImpl->_eMode       // we're saving a file
            &&  _pFileView->GetSelectionCount()          // there is a selected file in the file view -> it will later on
        && !(   FILEDLG_MODE_SAVE == m_xImpl->m_eMode    // we're saving a file
            &&  m_xFileView->GetSelectionCount()          // there is a selected file in the file view -> it will later on
            )                                                   //    (in SvtFileDialog::GetPathList) be taken as file to save to

        && FILEDLG_MODE_OPEN != pImpl->_eMode // #i83408# don't append extension on open
        && FILEDLG_MODE_OPEN != m_xImpl->m_eMode // #i83408# don't append extension on open
        )
    {
        // check extension and append the default extension if necessary
        appendDefaultExtension(aFileName,
                               GetDefaultExt(),
                               pImpl->GetCurFilter()->GetType());
                               m_xImpl->GetCurFilter()->GetType());
    }

    bool bOpenFolder = ( FILEDLG_TYPE_PATHDLG == pImpl->_eDlgType ) &&
                       !pImpl->_bDoubleClick && pVoid != pImpl->_pEdFileName;
    bool bOpenFolder = ( FILEDLG_TYPE_PATHDLG == m_xImpl->m_eDlgType ) &&
                       !m_xImpl->m_bDoubleClick && pVoid != m_xImpl->m_xEdFileName.get();
    if ( bIsFolder )
    {
        if ( bOpenFolder )
        {
            _aPath = aFileName;
            m_aPath = aFileName;
        }
        else
        {
            if ( aFileName != _pFileView->GetViewURL() )
            if ( aFileName != m_xFileView->GetViewURL() )
            {
                OpenURL_Impl( aFileName );
            }
@@ -1039,7 +816,7 @@
    else if ( !( nNewFilterFlags & AdjustFilterFlags::NonEmpty ) )
    {
        // if applicable save URL
        _aPath = aFileName;
        m_aPath = aFileName;
    }
    else
    {
@@ -1056,7 +833,7 @@
        return;
    }

    switch ( pImpl->_eMode )
    switch (m_xImpl->m_eMode)
    {
        case FILEDLG_MODE_SAVE:
        {
@@ -1067,7 +844,7 @@
                    "$filename$",
                    aFileObj.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset)
                );
                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                          VclMessageType::Question, VclButtonsType::YesNo, aMsg));
                if (xBox->run() != RET_YES)
                    return;
@@ -1113,7 +890,7 @@
                    }
                    sError = sError.replaceFirst( "$name$", sInvalidFile );

                    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
                    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                              VclMessageType::Warning, VclButtonsType::Ok, sError));
                    xBox->run();
                    return;
@@ -1126,57 +903,37 @@
            OSL_FAIL("SvtFileDialog, OpenHdl_Impl: invalid mode!");
    }

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


void SvtFileDialog::EnableAutocompletion( bool _bEnable )
void SvtFileDialog::EnableAutocompletion(bool bEnable)
{
    pImpl->_pEdFileName->EnableAutocompletion( _bEnable );
    m_xImpl->m_xEdFileName->EnableAutocomplete(bEnable);
}


IMPL_LINK_NOARG( SvtFileDialog, FilterSelectHdl_Impl, ListBox&, void )
IMPL_LINK_NOARG( SvtFileDialog, FilterSelectHdl_Impl, weld::ComboBox&, void )
{
    OUString sSelectedFilterDisplayName;
    SvtFileDialogFilter_Impl* pSelectedFilter = pImpl->GetSelectedFilterEntry( sSelectedFilterDisplayName );
    SvtFileDialogFilter_Impl* pSelectedFilter = m_xImpl->GetSelectedFilterEntry( sSelectedFilterDisplayName );
    if ( !pSelectedFilter )
    {   // there is no current selection. This happens if for instance the user selects a group separator using
        // the keyboard, and then presses enter: When the selection happens, we immediately deselect the entry,
        // so in this situation there is no current selection.
        if ( restoreCurrentFilter( pImpl ) )
        if ( restoreCurrentFilter( m_xImpl ) )
            ExecuteFilter();
    }
    else
    {
        if ( pSelectedFilter->isGroupSeparator() )
        {   // group separators can't be selected
            // return to the previously selected entry
            if ( pImpl->IsFilterListTravelSelect() )
            {
                pImpl->SetNoFilterListSelection( );

                // stop the timer for executing the filter
                if ( pImpl->_aFilterTimer.IsActive() )
                    pImpl->m_bNeedDelayedFilterExecute = true;
                pImpl->_aFilterTimer.Stop();
            }
            else
            {
                if ( restoreCurrentFilter( pImpl ) )
                    ExecuteFilter();
            }
        }
        else if (   ( pSelectedFilter != pImpl->GetCurFilter() )
                ||  pImpl->_pUserFilter
                )
        if (   ( pSelectedFilter != m_xImpl->GetCurFilter() )
           ||  m_xImpl->m_xUserFilter
           )
        {
            // Store the old filter for the auto extension handling
            OUString sLastFilterExt = pImpl->GetCurFilter()->GetExtension();
            pImpl->_pUserFilter.reset();
            OUString sLastFilterExt = m_xImpl->GetCurFilter()->GetExtension();
            m_xImpl->m_xUserFilter.reset();

            // if applicable remove filter of the user
            pImpl->SetCurFilter( pSelectedFilter, sSelectedFilterDisplayName );
            m_xImpl->SetCurFilter( pSelectedFilter, sSelectedFilterDisplayName );

            // if applicable show extension
            SetDefaultExt( pSelectedFilter->GetExtension() );
@@ -1190,20 +947,8 @@

            // if the user is traveling fast through the filterbox
            // do not filter instantly
            if ( pImpl->IsFilterListTravelSelect() )
            {
                // FilterSelectHdl_Impl should be started again in
                // TRAVELFILTER_TIMEOUT ms
                pImpl->_aFilterTimer.Start();
            }
            else
            {
                // stop previously started timer
                pImpl->_aFilterTimer.Stop();

                // filter the view again
                ExecuteFilter();
            }
            // FilterSelectHdl_Impl should be started again at idle
            m_xImpl->m_aFilterIdle.Start();
        }
    }
}
@@ -1214,38 +959,35 @@
    ExecuteFilter();
}

IMPL_LINK_NOARG( SvtFileDialog, FileNameGetFocusHdl_Impl, Control&, void )
IMPL_LINK_NOARG( SvtFileDialog, FileNameGetFocusHdl_Impl, weld::Widget&, void )
{
    _pFileView->SetNoSelection();
    _pFileView->Update();
    m_xFileView->SetNoSelection();
}


IMPL_LINK_NOARG( SvtFileDialog, FileNameModifiedHdl_Impl, Edit&, void )
IMPL_LINK( SvtFileDialog, FileNameModifiedHdl_Impl, weld::ComboBox&, rComboBox, void )
{
    FileNameGetFocusHdl_Impl( *pImpl->_pEdFileName );
    FileNameGetFocusHdl_Impl(rComboBox);
}


IMPL_LINK_NOARG( SvtFileDialog, URLBoxModifiedHdl_Impl, SvtURLBox*, void )
IMPL_LINK_NOARG(SvtFileDialog, URLBoxModifiedHdl_Impl, weld::ComboBox&, bool)
{
    OUString aPath = pImpl->_pEdCurrentPath->GetURL();
    OUString aPath = m_xImpl->m_xEdCurrentPath->GetURL();
    OpenURL_Impl(aPath);
    return true;
}


IMPL_LINK_NOARG( SvtFileDialog, ConnectToServerPressed_Hdl, Button*, void )
IMPL_LINK_NOARG( SvtFileDialog, ConnectToServerPressed_Hdl, weld::Button&, void )
{
    _pFileView->EndInplaceEditing();
    m_xFileView->EndInplaceEditing();

    PlaceEditDialog aDlg(GetFrameWeld());
    PlaceEditDialog aDlg(m_xDialog.get());
    short aRetCode = aDlg.run();

    switch (aRetCode) {
        case RET_OK :
        {
            PlacePtr newPlace = aDlg.GetPlace();
            pImpl->_pPlaces->AppendPlace(newPlace);
            m_xImpl->m_xPlaces->AppendPlace(newPlace);

            break;
        }
@@ -1256,32 +998,29 @@
    };
}


IMPL_LINK_NOARG ( SvtFileDialog, AddPlacePressed_Hdl, Button*, void )
IMPL_LINK_NOARG ( SvtFileDialog, AddPlacePressed_Hdl, weld::Button&, void )
{
    // Maybe open the PlacesDialog would have been a better idea
    // there is an ux choice to make we did not make...
    INetURLObject aURLObj( _pFileView->GetViewURL() );
    INetURLObject aURLObj( m_xFileView->GetViewURL() );
    PlacePtr newPlace(
        new Place( aURLObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset),
                _pFileView->GetViewURL(), true));
    pImpl->_pPlaces->AppendPlace(newPlace);
                m_xFileView->GetViewURL(), true));
    m_xImpl->m_xPlaces->AppendPlace(newPlace);
}


IMPL_LINK_NOARG ( SvtFileDialog, RemovePlacePressed_Hdl, Button*, void )
IMPL_LINK_NOARG ( SvtFileDialog, RemovePlacePressed_Hdl, weld::Button&, void )
{
    pImpl->_pPlaces->RemoveSelectedPlace();
    m_xImpl->m_xPlaces->RemoveSelectedPlace();
}


SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl
(
    const OUString& _rFilter,
    bool _bMultiExt,/*  TRUE - regard filter with several extensions
    const OUString& rFilter,
    bool bMultiExt,/*  TRUE - regard filter with several extensions
                            FALSE - do not ...
                        */
    bool& _rFilterChanged
    bool& rFilterChanged
)

/*  [Description]
@@ -1291,7 +1030,7 @@

{
    SvtFileDialogFilter_Impl* pFoundFilter = nullptr;
    SvtFileDialogFilterList_Impl& rList = pImpl->m_aFilter;
    SvtFileDialogFilterList_Impl& rList = m_xImpl->m_aFilter;
    sal_uInt16 nFilter = rList.size();

    while ( nFilter-- )
@@ -1299,33 +1038,33 @@
        SvtFileDialogFilter_Impl* pFilter = rList[ nFilter ].get();
        const OUString& rType = pFilter->GetType();

        if ( _bMultiExt )
        if ( bMultiExt )
        {
            sal_Int32 nIdx = 0;
            while ( !pFoundFilter && nIdx != -1 )
            {
                const OUString aSingleType = rType.getToken( 0, FILEDIALOG_DEF_EXTSEP, nIdx );
#ifdef UNX
                if ( aSingleType == _rFilter )
                if ( aSingleType == rFilter )
#else
                if ( aSingleType.equalsIgnoreAsciiCase( _rFilter ) )
                if ( aSingleType.equalsIgnoreAsciiCase( rFilter ) )
#endif
                    pFoundFilter = pFilter;
            }
        }
#ifdef UNX
        else if ( rType == _rFilter )
        else if ( rType == rFilter )
#else
        else if ( rType.equalsIgnoreAsciiCase( _rFilter ) )
        else if ( rType.equalsIgnoreAsciiCase( rFilter ) )
#endif
            pFoundFilter = pFilter;

        if ( pFoundFilter )
        {
            // activate filter
            _rFilterChanged = pImpl->_pUserFilter || ( pImpl->GetCurFilter() != pFilter );
            rFilterChanged = m_xImpl->m_xUserFilter || ( m_xImpl->GetCurFilter() != pFilter );

            createNewUserFilter( _rFilter );
            createNewUserFilter( rFilter );

            break;
        }
@@ -1336,36 +1075,30 @@

void SvtFileDialog::ExecuteFilter()
{
    pImpl->m_bNeedDelayedFilterExecute = false;
    executeAsync( AsyncPickerAction::eExecuteFilter, OUString(), getMostCurrentFilter( pImpl ) );
    m_xImpl->m_bNeedDelayedFilterExecute = false;
    executeAsync( AsyncPickerAction::eExecuteFilter, OUString(), getMostCurrentFilter(m_xImpl) );
}


void SvtFileDialog::OpenMultiSelection_Impl()

/*  [Description]

    OpenHandler for MultiSelection
*/

void SvtFileDialog::OpenMultiSelection_Impl()
{
    sal_uLong nCount = _pFileView->GetSelectionCount();
    SvTreeListEntry* pEntry = nCount ? _pFileView->FirstSelected() : nullptr;
    SvtContentEntry* pEntry = m_xFileView->FirstSelected();

    if ( nCount && pEntry )
        _aPath = SvtFileView::GetURL( pEntry );
    if (pEntry)
        m_aPath = pEntry->maURL;

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


void SvtFileDialog::UpdateControls( const OUString& rURL )
{
    pImpl->_pEdFileName->SetBaseURL( rURL );
    m_xImpl->m_xEdFileName->SetBaseURL( rURL );

    INetURLObject aObj( rURL );


    {
        OUString sText;
        SAL_WARN_IF( INetProtocol::NotValid == aObj.GetProtocol(), "fpicker.office", "SvtFileDialog::UpdateControls: Invalid URL!" );
@@ -1385,9 +1118,9 @@
        }

        // path mode ?
        if ( FILEDLG_TYPE_PATHDLG == pImpl->_eDlgType )
        if ( FILEDLG_TYPE_PATHDLG == m_xImpl->m_eDlgType )
            // -> set new path in the edit field
            pImpl->_pEdFileName->SetText( sText );
            m_xImpl->m_xEdFileName->set_entry_text( sText );

        // in the "current path" field, truncate the trailing slash
        if ( aObj.hasFinalSlash() )
@@ -1401,88 +1134,82 @@
        if ( sText.isEmpty() && !rURL.isEmpty() )
            // happens, for instance, for URLs which the INetURLObject does not know to belong to a hierarchical scheme
            sText = rURL;
        pImpl->_pEdCurrentPath->SetText( sText );
        m_xImpl->m_xEdCurrentPath->set_entry_text(sText);
    }

    m_aPath = rURL;

    _aPath = rURL;
    if ( _pFileNotifier )
        _pFileNotifier->notify( DIRECTORY_CHANGED, 0 );
    m_xImpl->m_xBtnUp->FillURLMenu();

    if (m_pFileNotifier)
        m_pFileNotifier->notify( DIRECTORY_CHANGED, 0 );
}


IMPL_LINK( SvtFileDialog, SelectHdl_Impl, SvTreeListBox*, pBox, void )
IMPL_LINK( SvtFileDialog, SelectHdl_Impl, SvtFileView*, pBox, void )
{
    SvTreeListEntry* pEntry = pBox->FirstSelected();
    assert( pEntry && "SelectHandler without selected entry" );
    SvtContentEntry* pUserData = static_cast<SvtContentEntry*>(pEntry->GetUserData());

    if ( pUserData )
    SvtContentEntry* pUserData = pBox->FirstSelected();
    if (pUserData)
    {
        INetURLObject aObj( pUserData->maURL );
        if ( FILEDLG_TYPE_PATHDLG == pImpl->_eDlgType )
        if ( FILEDLG_TYPE_PATHDLG == m_xImpl->m_eDlgType )
        {
            if ( aObj.GetProtocol() == INetProtocol::File )
            {
                if ( !pUserData->mbIsFolder )
                    aObj.removeSegment();
                OUString aName = aObj.getFSysPath( static_cast<FSysStyle>(FSysStyle::Detect & ~FSysStyle::Vos) );
                pImpl->_pEdFileName->SetText( aName );
                pImpl->_pEdFileName->SetSelection( Selection( 0, aName.getLength() ) );
                _aPath = pUserData->maURL;
                m_xImpl->m_xEdFileName->set_entry_text( aName );
                m_xImpl->m_xEdFileName->select_entry_region(0, -1);
                m_aPath = pUserData->maURL;
            }
            else if ( !pUserData->mbIsFolder )
            {
                pImpl->_pEdFileName->SetText( pUserData->maURL );
                pImpl->_pEdFileName->SetSelection( Selection( 0, pUserData->maURL.getLength() ) );
                _aPath = pUserData->maURL;
                m_xImpl->m_xEdFileName->set_entry_text( pUserData->maURL );
                m_xImpl->m_xEdFileName->select_entry_region(0, -1);
                m_aPath = pUserData->maURL;
            }
            else
                pImpl->_pEdFileName->SetText( OUString() );
               m_xImpl->m_xEdFileName->set_entry_text( OUString() );
        }
        else
        {
            if ( !pUserData->mbIsFolder )
            {
                OUString aName = SvTabListBox::GetEntryText( pEntry, 0 );
                pImpl->_pEdFileName->SetText( aName );
                pImpl->_pEdFileName->SetSelection( Selection( 0, aName.getLength() ) );
                _aPath = pUserData->maURL;
                OUString aName = pBox->get_selected_text();
                m_xImpl->m_xEdFileName->set_entry_text( aName );
                m_xImpl->m_xEdFileName->select_entry_region(0, -1);
                m_aPath = pUserData->maURL;
            }
        }
    }

    if ( pImpl->_bMultiSelection && _pFileView->GetSelectionCount() > 1 )
    if ( m_xImpl->m_bMultiSelection && m_xFileView->GetSelectionCount() > 1 )
    {
        // clear the file edit for multiselection
        pImpl->_pEdFileName->SetText( OUString() );
        m_xImpl->m_xEdFileName->set_entry_text( OUString() );
    }

    FileSelect();
}


IMPL_LINK_NOARG(SvtFileDialog, DblClickHdl_Impl, SvTreeListBox*, bool)
IMPL_LINK_NOARG(SvtFileDialog, DblClickHdl_Impl, SvtFileView*, bool)
{
    pImpl->_bDoubleClick = true;
    m_xImpl->m_bDoubleClick = true;
    OpenHdl_Impl( nullptr );
    pImpl->_bDoubleClick = false;

    return false;
    m_xImpl->m_bDoubleClick = false;
    return true;
}


IMPL_LINK_NOARG(SvtFileDialog, EntrySelectHdl_Impl, ComboBox&, void)
IMPL_LINK_NOARG(SvtFileDialog, EntrySelectHdl_Impl, weld::ComboBox&, void)
{
    FileSelect();
}


IMPL_LINK( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView, void )
{
    const OUString& sCurrentFolder( pView->GetViewURL() );
    // check if we can create new folders
    EnableControl( pImpl->_pBtnNewFolder, ContentCanMakeFolder( sCurrentFolder ) );
    EnableControl( m_xImpl->m_xBtnNewFolder.get(), ContentCanMakeFolder( sCurrentFolder ) );

    // check if we can travel one level up
    bool bCanTravelUp = ContentHasParentFolder( pView->GetViewURL() );
@@ -1495,85 +1222,49 @@

        aCurrentFolder.removeSegment();
    }
    EnableControl( pImpl->_pBtnUp, bCanTravelUp );
    EnableControl( m_xImpl->m_xBtnUp->getWidget(), bCanTravelUp );
}


IMPL_LINK_NOARG(SvtFileDialog, AutoExtensionHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvtFileDialog, AutoExtensionHdl_Impl, weld::Button&, void)
{
    if ( _pFileNotifier )
        _pFileNotifier->notify( CTRL_STATE_CHANGED,
                                CHECKBOX_AUTOEXTENSION );
    if (m_pFileNotifier)
        m_pFileNotifier->notify(CTRL_STATE_CHANGED, CHECKBOX_AUTOEXTENSION);

    // update the extension of the current file if necessary
    lcl_autoUpdateFileExtension( this, pImpl->GetCurFilter()->GetExtension() );
    lcl_autoUpdateFileExtension( this, m_xImpl->GetCurFilter()->GetExtension() );
}


IMPL_LINK( SvtFileDialog, ClickHdl_Impl, Button*, pCheckBox, void )
IMPL_LINK( SvtFileDialog, ClickHdl_Impl, weld::Button&, rCheckBox, void )
{
    if ( ! _pFileNotifier )
    if (!m_pFileNotifier)
        return;

    sal_Int16 nId = -1;

    if ( pCheckBox == pImpl->_pCbOptions )
    if ( &rCheckBox == m_xImpl->m_xCbOptions.get() )
        nId = CHECKBOX_FILTEROPTIONS;
    else if ( pCheckBox == _pCbSelection )
    else if ( &rCheckBox == m_xCbSelection.get() )
        nId = CHECKBOX_SELECTION;
    else if ( pCheckBox == _pCbReadOnly )
    else if ( &rCheckBox == m_xCbReadOnly.get() )
        nId = CHECKBOX_READONLY;
    else if ( pCheckBox == pImpl->_pCbPassword )
    else if ( &rCheckBox == m_xImpl->m_xCbPassword.get() )
        nId = CHECKBOX_PASSWORD;
    else if ( pCheckBox == pImpl->_pCbGPGEncrypt )
    else if ( &rCheckBox == m_xImpl->m_xCbGPGEncrypt.get() )
        nId = CHECKBOX_GPGENCRYPTION;
    else if ( pCheckBox == _pCbLinkBox )
    else if ( &rCheckBox == m_xCbLinkBox.get() )
        nId = CHECKBOX_LINK;
    else if ( pCheckBox == _pCbPreviewBox )
    else if ( &rCheckBox == m_xCbPreviewBox.get() )
        nId = CHECKBOX_PREVIEW;

    if ( nId != -1 )
        _pFileNotifier->notify( CTRL_STATE_CHANGED, nId );
        m_pFileNotifier->notify( CTRL_STATE_CHANGED, nId );
}


IMPL_LINK_NOARG(SvtFileDialog, PlayButtonHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvtFileDialog, PlayButtonHdl_Impl, weld::Button&, void)
{
    if ( _pFileNotifier )
        _pFileNotifier->notify( CTRL_STATE_CHANGED,
                                PUSHBUTTON_PLAY );
}


bool SvtFileDialog::EventNotify( NotifyEvent& rNEvt )

/*  [Description]

    This method gets called to catch <BACKSPACE>.
*/

{
    MouseNotifyEvent nType = rNEvt.GetType();
    bool bRet = false;

    if ( MouseNotifyEvent::KEYINPUT == nType && rNEvt.GetKeyEvent() )
    {
        const vcl::KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
        sal_uInt16 nCode = rKeyCode.GetCode();

        if ( !rKeyCode.GetModifier() &&
             KEY_BACKSPACE == nCode && !pImpl->_pEdFileName->HasChildPathFocus() )
        {
            bRet = false;

            if ( !bRet && pImpl->_pBtnUp->IsEnabled() )
            {
                PrevLevel_Impl();
                bRet = true;
            }
        }
    }
    return bRet || Dialog::EventNotify(rNEvt);
    if (m_pFileNotifier)
        m_pFileNotifier->notify(CTRL_STATE_CHANGED, PUSHBUTTON_PLAY);
}

namespace
@@ -1642,30 +1333,30 @@
}


short SvtFileDialog::Execute()
short SvtFileDialog::run()
{
    if ( !PrepareExecute() )
        return 0;

    // start the dialog
    _bIsInExecute = true;
    short nResult = Dialog::Execute();
    _bIsInExecute = false;
    m_bIsInExecute = true;
    short nResult = GenericDialogController::run();
    m_bIsInExecute = false;

    SAL_WARN_IF( m_pCurrentAsyncAction.is(), "fpicker.office", "SvtFilePicker::Execute: still running an async action!" );
    SAL_WARN_IF( m_pCurrentAsyncAction.is(), "fpicker.office", "SvtFilePicker::run: still running an async action!" );
        // the dialog should not be cancellable while an async action is running - first, the action
        // needs to be cancelled

    // remember last directory
    if ( RET_OK == nResult )
    {
        INetURLObject aURL( _aPath );
        INetURLObject aURL( m_aPath );
        if ( aURL.GetProtocol() == INetProtocol::File )
        {
            // remember the selected directory only for file URLs not for virtual folders
            sal_Int32 nLevel = aURL.getSegmentCount();
            bool bDir = m_aContent.isFolder( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
            if ( nLevel > 1 && ( FILEDLG_TYPE_FILEDLG == pImpl->_eDlgType || !bDir ) )
            if ( nLevel > 1 && ( FILEDLG_TYPE_FILEDLG == m_xImpl->m_eDlgType || !bDir ) )
                aURL.removeSegment();
        }
    }
@@ -1673,21 +1364,12 @@
    return nResult;
}

bool SvtFileDialog::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
{
    if (!PrepareExecute())
        return false;

    // start of the dialog
    return Dialog::StartExecuteAsync(rCtx);
}

void SvtFileDialog::onAsyncOperationStarted()
{
    EnableUI( false );
    // the cancel button must be always enabled
    pImpl->_pBtnCancel->Enable();
    pImpl->_pBtnCancel->GrabFocus();
    m_xImpl->m_xBtnCancel->set_sensitive(true);
    m_xImpl->m_xBtnCancel->grab_focus();
}

void SvtFileDialog::onAsyncOperationFinished()
@@ -1695,18 +1377,16 @@
    EnableUI( true );
    m_pCurrentAsyncAction = nullptr;
    if ( !m_bInExecuteAsync )
        pImpl->_pEdFileName->GrabFocus();
        // (if m_bInExecuteAsync is true, then the operation was finished within the minimum wait time,
        // and to the user, the operation appears to be synchronous)
        m_xImpl->m_xEdFileName->grab_focus();
    // (if m_bInExecuteAsync is true, then the operation was finished within the minimum wait time,
    // and to the user, the operation appears to be synchronous)
}


void SvtFileDialog::RemovablePlaceSelected(bool enable)
{
    pImpl->_pPlaces->SetDelEnabled( enable );
    m_xImpl->m_xPlaces->SetDelEnabled( enable );
}


void SvtFileDialog::displayIOException( const OUString& _rURL, IOErrorCode _eCode )
{
    try
@@ -1748,42 +1428,39 @@
    }
}


void SvtFileDialog::EnableUI( bool _bEnable )
void SvtFileDialog::EnableUI(bool bEnable)
{
    Enable( _bEnable );
    m_xDialog->set_sensitive(bEnable);

    if ( _bEnable )
    if (bEnable)
    {
        for ( auto& rxControl : m_aDisabledControls )
        for (auto& rxControl : m_aDisabledControls)
        {
            rxControl->Enable( false );
            rxControl->set_sensitive(false);
        }
    }
}


void SvtFileDialog::EnableControl( Control* _pControl, bool _bEnable )
void SvtFileDialog::EnableControl(weld::Widget* pControl, bool bEnable)
{
    if ( !_pControl )
    if (!pControl)
    {
        SAL_WARN( "fpicker.office", "SvtFileDialog::EnableControl: invalid control!" );
        return;
    }

    _pControl->Enable( _bEnable );
    pControl->set_sensitive(bEnable);

    if ( _bEnable )
    if (bEnable)
    {
        auto aPos = m_aDisabledControls.find( _pControl );
        auto aPos = m_aDisabledControls.find( pControl );
        if ( m_aDisabledControls.end() != aPos )
            m_aDisabledControls.erase( aPos );
    }
    else
        m_aDisabledControls.insert( _pControl );
        m_aDisabledControls.insert( pControl );
}


bool SvtFileDialog::PrepareExecute()
{
    if (comphelper::LibreOfficeKit::isActive())
@@ -1807,7 +1484,7 @@
                = aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_ONLY );
            if ( xResultSet.is() && !xResultSet->next() )
            {
                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                          VclMessageType::Warning, VclButtonsType::Ok,
                                                          FpsResId(STR_SVT_NOREMOVABLEDEVICE)));
                xBox->run();
@@ -1822,7 +1499,7 @@
        }
    }

    if ( ( pImpl->_nStyle & PickerFlags::SaveAs ) && m_bHasFilename )
    if ( ( m_xImpl->m_nStyle & PickerFlags::SaveAs ) && m_bHasFilename )
        // when doing a save-as, we do not want the handler to handle "this file does not exist" messages
        // - finally we're going to save that file, aren't we?
        m_aContent.enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::E_DOESNOTEXIST);
@@ -1831,46 +1508,46 @@

    // possibly just a filename without a path
    OUString aFileNameOnly;
    if( !_aPath.isEmpty() && (pImpl->_eMode == FILEDLG_MODE_SAVE)
                     && (_aPath.indexOf(':') == -1)
                     && (_aPath.indexOf('\\') == -1)
                     && (_aPath.indexOf('/') == -1))
    if( !m_aPath.isEmpty() && (m_xImpl->m_eMode == FILEDLG_MODE_SAVE)
                     && (m_aPath.indexOf(':') == -1)
                     && (m_aPath.indexOf('\\') == -1)
                     && (m_aPath.indexOf('/') == -1))
    {
        aFileNameOnly = _aPath;
        _aPath.clear();
        aFileNameOnly = m_aPath;
        m_aPath.clear();
    }

    // no starting path specified?
    if ( _aPath.isEmpty() )
    if ( m_aPath.isEmpty() )
    {
        // then use the standard directory
        _aPath = lcl_ensureFinalSlash( pImpl->GetStandardDir() );
        m_aPath = lcl_ensureFinalSlash( m_xImpl->GetStandardDir() );

        // attach given filename to path
        if ( !aFileNameOnly.isEmpty() )
            _aPath += aFileNameOnly;
            m_aPath += aFileNameOnly;
    }


    _aPath = implGetInitialURL( _aPath, GetStandardDir() );
    m_aPath = implGetInitialURL( m_aPath, GetStandardDir() );

    if ( pImpl->_nStyle & PickerFlags::SaveAs && !m_bHasFilename )
    if ( m_xImpl->m_nStyle & PickerFlags::SaveAs && !m_bHasFilename )
        // when doing a save-as, we do not want the handler to handle "this file does not exist" messages
        // - finally we're going to save that file, aren't we?
        m_aContent.enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::E_DOESNOTEXIST);

    // if applicable show filter
    pImpl->InitFilterList();
    m_xImpl->InitFilterList();

    // set up initial filter
    sal_uInt16 nFilterCount = GetFilterCount();
    OUString aAll = FpsResId( STR_FILTERNAME_ALL );
    bool bHasAll = pImpl->HasFilterListEntry( aAll );
    if ( pImpl->GetCurFilter() || nFilterCount == 1 || ( nFilterCount == 2 && bHasAll ) )
    bool bHasAll = m_xImpl->HasFilterListEntry( aAll );
    if ( m_xImpl->GetCurFilter() || nFilterCount == 1 || ( nFilterCount == 2 && bHasAll ) )
    {
        // if applicable set the only filter or the only filter that
        // does not refer to all files, as the current one
        if ( !pImpl->GetCurFilter() )
        if ( !m_xImpl->GetCurFilter() )
        {
            sal_uInt16 nPos = 0;
            if ( 2 == nFilterCount && bHasAll )
@@ -1882,14 +1559,14 @@
                        break;
                }
            }
            SvtFileDialogFilter_Impl* pNewCurFilter = pImpl->m_aFilter[ nPos ].get();
            assert( pNewCurFilter && "SvtFileDialog::Execute: invalid filter pos!" );
            pImpl->SetCurFilter( pNewCurFilter, pNewCurFilter->GetName() );
            SvtFileDialogFilter_Impl* pNewCurFilter = m_xImpl->m_aFilter[ nPos ].get();
            assert( pNewCurFilter && "SvtFileDialog::run: invalid filter pos!" );
            m_xImpl->SetCurFilter( pNewCurFilter, pNewCurFilter->GetName() );
        }

        // adjust view
        pImpl->SelectFilterListEntry( pImpl->GetCurFilter()->GetName() );
        SetDefaultExt( pImpl->GetCurFilter()->GetExtension() );
        m_xImpl->SelectFilterListEntry( m_xImpl->GetCurFilter()->GetName() );
        SetDefaultExt( m_xImpl->GetCurFilter()->GetExtension() );
        sal_Int32 nSepPos = GetDefaultExt().indexOf( FILEDIALOG_DEF_EXTSEP );
        if ( nSepPos != -1 )
            EraseDefaultExt( nSepPos );
@@ -1900,33 +1577,33 @@
        if ( !bHasAll )
        {
            SvtFileDialogFilter_Impl* pAllFilter = implAddFilter( aAll, FILEDIALOG_FILTER_ALL );
            pImpl->InsertFilterListEntry( pAllFilter );
            pImpl->SetCurFilter( pAllFilter, aAll );
            m_xImpl->InsertFilterListEntry( pAllFilter );
            m_xImpl->SetCurFilter( pAllFilter, aAll );
        }
        pImpl->SelectFilterListEntry( aAll );
        m_xImpl->SelectFilterListEntry( aAll );
    }

    // if applicable isolate filter
    OUString aFilter;

    if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) )
    if ( !IsolateFilterFromPath_Impl( m_aPath, aFilter ) )
        return false;

    AdjustFilterFlags nNewFilterFlags = adjustFilter( aFilter );
    if ( nNewFilterFlags & ( AdjustFilterFlags::NonEmpty | AdjustFilterFlags::UserFilter ) )
    {
        pImpl->_pEdFileName->SetText( aFilter );
        m_xImpl->m_xEdFileName->set_entry_text( aFilter );
    }

    // create and show instance for set path
    INetURLObject aFolderURL( _aPath );
    INetURLObject aFolderURL( m_aPath );
    OUString aFileName( aFolderURL.getName( INetURLObject::LAST_SEGMENT, false ) );
    sal_Int32 nFileNameLen = aFileName.getLength();
    bool bFileToSelect = nFileNameLen != 0;
    if ( bFileToSelect && aFileName[ nFileNameLen - 1 ] != '/' )
    {
        OUString aDecodedName = aFolderURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
        pImpl->_pEdFileName->SetText( aDecodedName );
        m_xImpl->m_xEdFileName->set_entry_text( aDecodedName );
        aFolderURL.removeSegment();
    }

@@ -1944,22 +1621,18 @@

    OpenURL_Impl( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );

    _pFileView->Show();
    _pSplitter->Show();

    // if applicable read and set size from ini
    InitSize();

    return true;
}


void SvtFileDialog::executeAsync( ::svt::AsyncPickerAction::Action _eAction,
                                    const OUString& _rURL, const OUString& _rFilter )
void SvtFileDialog::executeAsync( ::svt::AsyncPickerAction::Action eAction,
                                    const OUString& rURL, const OUString& rFilter )
{
    SAL_WARN_IF( m_pCurrentAsyncAction.is(), "fpicker.office", "SvtFileDialog::executeAsync: previous async action not yet finished!" );

    m_pCurrentAsyncAction = new AsyncPickerAction( this, _pFileView, _eAction );
    m_pCurrentAsyncAction = new AsyncPickerAction( this, m_xFileView.get(), eAction );

    bool bReallyAsync = true;
    m_aConfiguration.getNodeValue( OUString( "FillAsynchronously" ) ) >>= bReallyAsync;
@@ -1970,107 +1643,100 @@
    m_aConfiguration.getNodeValue( OUString( "Timeout/Max" ) ) >>= nMaxTimeout;

    m_bInExecuteAsync = true;
    m_pCurrentAsyncAction->execute( _rURL, _rFilter, bReallyAsync ? nMinTimeout : -1, nMaxTimeout, GetBlackList() );
    m_pCurrentAsyncAction->execute(rURL, rFilter, bReallyAsync ? nMinTimeout : -1, nMaxTimeout, GetBlackList());
    m_bInExecuteAsync = false;
}


void SvtFileDialog::FileSelect()
{
    if ( _pFileNotifier )
        _pFileNotifier->notify( FILE_SELECTION_CHANGED, 0 );
    if (m_pFileNotifier)
        m_pFileNotifier->notify( FILE_SELECTION_CHANGED, 0 );
}


void SvtFileDialog::FilterSelect()
{
    if ( _pFileNotifier )
        _pFileNotifier->notify( CTRL_STATE_CHANGED,
    if (m_pFileNotifier)
        m_pFileNotifier->notify( CTRL_STATE_CHANGED,
                                LISTBOX_FILTER );
}


void SvtFileDialog::SetStandardDir( const OUString& rStdDir )

/*  [Description]

   This method sets the path for the default button.
*/

void SvtFileDialog::SetStandardDir( const OUString& rStdDir )
{
    INetURLObject aObj( rStdDir );
    SAL_WARN_IF( aObj.GetProtocol() == INetProtocol::NotValid, "fpicker.office", "Invalid protocol!" );
    aObj.setFinalSlash();
    pImpl->SetStandardDir( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
    m_xImpl->SetStandardDir( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
}

void SvtFileDialog::SetBlackList( const css::uno::Sequence< OUString >& rBlackList )
{
    pImpl->SetBlackList( rBlackList );
    m_xImpl->SetBlackList( rBlackList );
}


const css::uno::Sequence< OUString >& SvtFileDialog::GetBlackList() const
{
    return pImpl->GetBlackList();
    return m_xImpl->GetBlackList();
}


const OUString& SvtFileDialog::GetStandardDir() const

/*  [Description]

    This method returns the standard path.
*/

const OUString& SvtFileDialog::GetStandardDir() const
{
    return pImpl->GetStandardDir();
    return m_xImpl->GetStandardDir();
}


void SvtFileDialog::PrevLevel_Impl()
{
    _pFileView->EndInplaceEditing();
    m_xFileView->EndInplaceEditing();

    OUString sDummy;
    executeAsync( AsyncPickerAction::ePrevLevel, sDummy, sDummy );
}


void SvtFileDialog::OpenURL_Impl( const OUString& _rURL )
{
    _pFileView->EndInplaceEditing();
    m_xFileView->EndInplaceEditing();

    executeAsync( AsyncPickerAction::eOpenURL, _rURL, getMostCurrentFilter( pImpl ) );
    executeAsync( AsyncPickerAction::eOpenURL, _rURL, getMostCurrentFilter( m_xImpl ) );
}


SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const OUString& _rFilter, const OUString& _rType )
SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const OUString& rFilter, const OUString& _rType )
{
    SvtFileDialogFilter_Impl* pNewFilter = new SvtFileDialogFilter_Impl( _rFilter, _rType );
    pImpl->m_aFilter.push_front( std::unique_ptr<SvtFileDialogFilter_Impl>( pNewFilter ) );
    SvtFileDialogFilter_Impl* pNewFilter = new SvtFileDialogFilter_Impl( rFilter, _rType );
    m_xImpl->m_aFilter.push_front( std::unique_ptr<SvtFileDialogFilter_Impl>( pNewFilter ) );

    if ( !pImpl->GetCurFilter() )
        pImpl->SetCurFilter( pNewFilter, _rFilter );
    if ( !m_xImpl->GetCurFilter() )
        m_xImpl->SetCurFilter( pNewFilter, rFilter );

    return pNewFilter;
}


void SvtFileDialog::AddFilter( const OUString& _rFilter, const OUString& _rType )
void SvtFileDialog::AddFilter( const OUString& rFilter, const OUString& _rType )
{
    SAL_WARN_IF( IsInExecute(), "fpicker.office", "SvtFileDialog::AddFilter: currently executing!" );
    implAddFilter ( _rFilter, _rType );
    SAL_WARN_IF( m_bIsInExecute, "fpicker.office", "SvtFileDialog::AddFilter: currently executing!" );
    implAddFilter ( rFilter, _rType );
}


void SvtFileDialog::AddFilterGroup( const OUString& _rFilter, const Sequence< StringPair >& _rFilters )
void SvtFileDialog::AddFilterGroup( const OUString& rFilter, const Sequence< StringPair >& rFilters )
{
    SAL_WARN_IF( IsInExecute(), "fpicker.office", "SvtFileDialog::AddFilter: currently executing!" );
    SAL_WARN_IF( m_bIsInExecute, "fpicker.office", "SvtFileDialog::AddFilter: currently executing!" );

    implAddFilter( _rFilter, OUString() );
    const StringPair* pSubFilters       =               _rFilters.getConstArray();
    const StringPair* pSubFiltersEnd    = pSubFilters + _rFilters.getLength();
    implAddFilter( rFilter, OUString() );
    const StringPair* pSubFilters       =               rFilters.getConstArray();
    const StringPair* pSubFiltersEnd    = pSubFilters + rFilters.getLength();
    for ( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
        implAddFilter( pSubFilters->First, pSubFilters->Second );
}
@@ -2078,28 +1744,27 @@

void SvtFileDialog::SetCurFilter( const OUString& rFilter )
{
    SAL_WARN_IF( IsInExecute(), "fpicker.office", "SvtFileDialog::SetCurFilter: currently executing!" );
    SAL_WARN_IF( m_bIsInExecute, "fpicker.office", "SvtFileDialog::SetCurFilter: currently executing!" );

    // look for corresponding filter
    sal_uInt16 nPos = pImpl->m_aFilter.size();
    sal_uInt16 nPos = m_xImpl->m_aFilter.size();

    while ( nPos-- )
    {
        SvtFileDialogFilter_Impl* pFilter = pImpl->m_aFilter[ nPos ].get();
        SvtFileDialogFilter_Impl* pFilter = m_xImpl->m_aFilter[ nPos ].get();
        if ( pFilter->GetName() == rFilter )
        {
            pImpl->SetCurFilter( pFilter, rFilter );
            m_xImpl->SetCurFilter( pFilter, rFilter );
            break;
        }
    }
}


OUString SvtFileDialog::GetCurFilter() const
{
    OUString aFilter;

    const SvtFileDialogFilter_Impl* pCurrentFilter = pImpl->GetCurFilter();
    const SvtFileDialogFilter_Impl* pCurrentFilter = m_xImpl->GetCurFilter();
    if ( pCurrentFilter )
        aFilter = pCurrentFilter->GetName();

@@ -2111,66 +1776,56 @@
    return GetCurFilter();
}


sal_uInt16 SvtFileDialog::GetFilterCount() const
{
    return pImpl->m_aFilter.size();
    return m_xImpl->m_aFilter.size();
}


const OUString& SvtFileDialog::GetFilterName( sal_uInt16 nPos ) const
{
    assert( nPos < GetFilterCount() && "invalid index" );
    return pImpl->m_aFilter[ nPos ]->GetName();
    return m_xImpl->m_aFilter[ nPos ]->GetName();
}


void SvtFileDialog::InitSize()
{
    if ( pImpl->_aIniKey.isEmpty() )
    if (m_xImpl->m_aIniKey.isEmpty())
        return;

    // initialize from config
    SvtViewOptions aDlgOpt( EViewType::Dialog, pImpl->_aIniKey );
    SvtViewOptions aDlgOpt( EViewType::Dialog, m_xImpl->m_aIniKey );

    if ( aDlgOpt.Exists() )
    {
        SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), osl_getThreadTextEncoding()));
        m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8));

        Any aUserData = aDlgOpt.GetUserItem( "UserData");
        OUString sCfgStr;
        if ( aUserData >>= sCfgStr )
            _pFileView->SetConfigString( sCfgStr );
            m_xFileView->SetConfigString( sCfgStr );
    }
}


std::vector<OUString> SvtFileDialog::GetPathList() const
{
    std::vector<OUString> aList;
    sal_uLong           nCount = _pFileView->GetSelectionCount();
    SvTreeListEntry*    pEntry = nCount ? _pFileView->FirstSelected() : nullptr;

    if ( ! pEntry )
    m_xFileView->selected_foreach([this, &aList](weld::TreeIter& rCurEntry){
        aList.push_back(m_xFileView->GetURL(rCurEntry));
        return false;
    });

    if (aList.empty())
    {
        if ( !pImpl->_pEdFileName->GetText().isEmpty() && _bIsInExecute )
            aList.push_back(pImpl->_pEdFileName->GetURL());
        if ( !m_xImpl->m_xEdFileName->get_active_text().isEmpty() && m_bIsInExecute )
            aList.push_back(m_xImpl->m_xEdFileName->GetURL());
        else
            aList.push_back(_aPath);
    }
    else
    {
        while ( pEntry )
        {
            aList.push_back(SvtFileView::GetURL(pEntry));
            pEntry = _pFileView->NextSelected( pEntry );
        }
            aList.push_back(m_aPath);
    }

    return aList;
}


bool SvtFileDialog::IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilter )
{
    OUString aReversePath = comphelper::string::reverseString(rPath);
@@ -2240,164 +1895,138 @@
    return true;
}


void SvtFileDialog::implUpdateImages( )
IMPL_LINK_NOARG(SvtFileDialog, SizeAllocHdl, const Size&, void)
{
    // set the appropriate images on the buttons
    if ( pImpl->_pBtnUp )
        pImpl->_pBtnUp->SetModeImage( GetButtonImage( BMP_FILEDLG_BTN_UP ) );

    if ( pImpl->_pBtnNewFolder )
        pImpl->_pBtnNewFolder->SetModeImage( GetButtonImage( BMP_FILEDLG_CREATEFOLDER ) );
    if (m_pFileNotifier)
        m_pFileNotifier->notify(DIALOG_SIZE_CHANGED, 0);
}


void SvtFileDialog::DataChanged( const DataChangedEvent& _rDCEvt )
weld::Widget* SvtFileDialog::getControl( sal_Int16 nControlId, bool bLabelControl ) const
{
    if ( DataChangedEventType::SETTINGS == _rDCEvt.GetType() )
        implUpdateImages( );
    weld::Widget* pReturn = nullptr;

    Dialog::DataChanged( _rDCEvt );
}


void SvtFileDialog::Resize()
{
    Dialog::Resize();

    if ( IsRollUp() )
        return;

    if ( _pFileNotifier )
        _pFileNotifier->notify( DIALOG_SIZE_CHANGED, 0 );
}

Control* SvtFileDialog::getControl( sal_Int16 _nControlId, bool _bLabelControl ) const
{
    Control* pReturn = nullptr;

    switch ( _nControlId )
    switch ( nControlId )
    {
        case CONTROL_FILEVIEW:
            pReturn = _bLabelControl ? nullptr : static_cast< Control* >( _pFileView );
            pReturn = bLabelControl ? nullptr : m_xFileView->identifier();
            break;

        case EDIT_FILEURL:
            pReturn =   _bLabelControl
                    ?   static_cast< Control* >( pImpl->_pFtFileName )
                    :   static_cast< Control* >( pImpl->_pEdFileName );
            pReturn =   bLabelControl
                    ? static_cast<weld::Widget*>(m_xImpl->m_xFtFileName.get())
                    : static_cast<weld::Widget*>(m_xImpl->m_xEdFileName->getWidget());
            break;

        case EDIT_FILEURL_LABEL:
            pReturn = pImpl->_pFtFileName;
            pReturn = m_xImpl->m_xFtFileName.get();
            break;

        case CHECKBOX_AUTOEXTENSION:
            pReturn = pImpl->_pCbAutoExtension;
            pReturn = m_xImpl->m_xCbAutoExtension.get();
            break;

        case CHECKBOX_PASSWORD:
            pReturn = pImpl->_pCbPassword;
            pReturn = m_xImpl->m_xCbPassword.get();
            break;

        case CHECKBOX_GPGENCRYPTION:
            pReturn = pImpl->_pCbGPGEncrypt;
            pReturn = m_xImpl->m_xCbGPGEncrypt.get();
            break;

        case CHECKBOX_FILTEROPTIONS:
            pReturn = pImpl->_pCbOptions;
            pReturn = m_xImpl->m_xCbOptions.get();
            break;

        case CHECKBOX_READONLY:
            pReturn = _pCbReadOnly;
            pReturn = m_xCbReadOnly.get();
            break;

        case CHECKBOX_LINK:
            pReturn = _pCbLinkBox;
            pReturn = m_xCbLinkBox.get();
            break;

        case CHECKBOX_PREVIEW:
            pReturn = _pCbPreviewBox;
            pReturn = m_xCbPreviewBox.get();
            break;

        case CHECKBOX_SELECTION:
            pReturn = _pCbSelection;
            pReturn = m_xCbSelection.get();
            break;

        case LISTBOX_FILTER:
            pReturn = _bLabelControl ? pImpl->_pFtFileType : pImpl->GetFilterListControl();
            pReturn = bLabelControl ? m_xImpl->m_xFtFileType.get() : m_xImpl->GetFilterListControl();
            break;

        case LISTBOX_FILTER_LABEL:
            pReturn = pImpl->_pFtFileType;
            pReturn = m_xImpl->m_xFtFileType.get();
            break;

        case FIXEDTEXT_CURRENTFOLDER:
            pReturn = pImpl->_pEdCurrentPath;
            pReturn = m_xImpl->m_xEdCurrentPath->getWidget();
            break;

        case LISTBOX_VERSION:
            pReturn =   _bLabelControl
                    ?   static_cast< Control* >( pImpl->_pFtFileVersion )
                    :   static_cast< Control* >( pImpl->_pLbFileVersion );
            pReturn =   bLabelControl
                    ? static_cast<weld::Widget*>(m_xImpl->m_xFtFileVersion.get())
                    : static_cast<weld::Widget*>(m_xImpl->m_xLbFileVersion.get());
            break;

        case LISTBOX_TEMPLATE:
            pReturn =   _bLabelControl
                    ?   static_cast< Control* >( pImpl->_pFtTemplates )
                    :   static_cast< Control* >( pImpl->_pLbTemplates );
            pReturn =   bLabelControl
                    ? static_cast<weld::Widget*>(m_xImpl->m_xFtTemplates.get())
                    : static_cast<weld::Widget*>(m_xImpl->m_xLbTemplates.get());
            break;

        case LISTBOX_IMAGE_TEMPLATE:
            pReturn =   _bLabelControl
                    ?   static_cast< Control* >( pImpl->_pFtImageTemplates )
                    :   static_cast< Control* >( pImpl->_pLbImageTemplates );
            pReturn =   bLabelControl
                    ? static_cast<weld::Widget*>(m_xImpl->m_xFtImageTemplates.get())
                    : static_cast<weld::Widget*>(m_xImpl->m_xLbImageTemplates.get());
            break;

        case LISTBOX_IMAGE_ANCHOR:
            pReturn =   _bLabelControl
                    ?   static_cast< Control* >( pImpl->_pFtImageAnchor )
                    :   static_cast< Control* >( pImpl->_pLbImageAnchor );
            pReturn =   bLabelControl
                    ? static_cast<weld::Widget*>(m_xImpl->m_xFtImageAnchor.get())
                    : static_cast<weld::Widget*>(m_xImpl->m_xLbImageAnchor.get());
            break;

        case LISTBOX_VERSION_LABEL:
            pReturn = pImpl->_pFtFileVersion;
            pReturn = m_xImpl->m_xFtFileVersion.get();
            break;

        case LISTBOX_TEMPLATE_LABEL:
            pReturn = pImpl->_pFtTemplates;
            pReturn = m_xImpl->m_xFtTemplates.get();
            break;

        case LISTBOX_IMAGE_TEMPLATE_LABEL:
            pReturn = pImpl->_pFtImageTemplates;
            pReturn = m_xImpl->m_xFtImageTemplates.get();
            break;

        case LISTBOX_IMAGE_ANCHOR_LABEL:
            pReturn = pImpl->_pFtImageAnchor;
            pReturn = m_xImpl->m_xFtImageAnchor.get();
            break;

        case PUSHBUTTON_OK:
            pReturn = pImpl->_pBtnFileOpen;
            pReturn = m_xImpl->m_xBtnFileOpen.get();
            break;

        case PUSHBUTTON_CANCEL:
            pReturn = pImpl->_pBtnCancel;
            pReturn = m_xImpl->m_xBtnCancel.get();
            break;

        case PUSHBUTTON_PLAY:
            pReturn = _pPbPlay;
            pReturn = m_xPbPlay.get();
            break;

        case PUSHBUTTON_HELP:
            pReturn = pImpl->_pBtnHelp;
            pReturn = m_xImpl->m_xBtnHelp.get();
            break;

        case TOOLBOXBUTOON_LEVEL_UP:
            pReturn = pImpl->_pBtnUp;
            pReturn = m_xImpl->m_xBtnUp->getWidget();
            break;

        case TOOLBOXBUTOON_NEW_FOLDER:
            pReturn = pImpl->_pBtnNewFolder;
            pReturn = m_xImpl->m_xBtnNewFolder.get();
            break;

        case LISTBOX_FILTER_SELECTOR:
@@ -2410,170 +2039,147 @@
    return pReturn;
}


void SvtFileDialog::enableControl( sal_Int16 _nControlId, bool _bEnable )
void SvtFileDialog::enableControl(sal_Int16 nControlId, bool bEnable)
{
    Control* pControl = getControl( _nControlId );
    if ( pControl )
        EnableControl( pControl, _bEnable );
    Control* pLabel = getControl( _nControlId, true );
    if ( pLabel )
        EnableControl( pLabel, _bEnable );
    weld::Widget* pControl = getControl(nControlId);
    if (pControl)
        EnableControl(pControl, bEnable);
    weld::Widget* pLabel = getControl(nControlId, true);
    if (pLabel)
        EnableControl(pLabel, bEnable);
}


void SvtFileDialog::AddControls_Impl( )
{
    // create the "insert as link" checkbox, if needed
    if ( _nPickerFlags & PickerFlags::InsertAsLink )
    if ( m_nPickerFlags & PickerFlags::InsertAsLink )
    {
        _pCbLinkBox ->SetText( FpsResId( STR_SVT_FILEPICKER_INSERT_AS_LINK ) );
        _pCbLinkBox ->SetHelpId( HID_FILEDLG_LINK_CB );
        _pCbLinkBox->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        _pCbLinkBox->Show();
        m_xCbLinkBox->set_label( FpsResId( STR_SVT_FILEPICKER_INSERT_AS_LINK ) );
        m_xCbLinkBox->set_help_id( HID_FILEDLG_LINK_CB );
        m_xCbLinkBox->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xCbLinkBox->show();
    }

    // create the "show preview" checkbox ( and the preview window, too ), if needed
    if ( _nPickerFlags & PickerFlags::ShowPreview  )
    if ( m_nPickerFlags & PickerFlags::ShowPreview  )
    {
        pImpl->_aIniKey = "ImportGraphicDialog";
        // because the "<All Formats> (*.bmp,*...)" entry is too wide,
        // we need to disable the auto width feature of the filter box
        pImpl->DisableFilterBoxAutoWidth();
        m_xImpl->m_aIniKey = "ImportGraphicDialog";

        // "preview"
        _pCbPreviewBox->SetText( FpsResId( STR_SVT_FILEPICKER_SHOW_PREVIEW ) );
        _pCbPreviewBox->SetHelpId( HID_FILEDLG_PREVIEW_CB );
        _pCbPreviewBox->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        _pCbPreviewBox->Show();
        m_xCbPreviewBox->set_label( FpsResId( STR_SVT_FILEPICKER_SHOW_PREVIEW ) );
        m_xCbPreviewBox->set_help_id( HID_FILEDLG_PREVIEW_CB );
        m_xCbPreviewBox->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xCbPreviewBox->show();

        // generate preview window just here
        _pPrevWin->SetOutputSizePixel(Size(200, 300));
        _pPrevWin->Show();

        _pPrevBmp = VclPtr<FixedBitmap>::Create( _pPrevWin, WB_BORDER );
        _pPrevBmp->SetBackground( Wallpaper( COL_WHITE ) );
        _pPrevBmp->SetSizePixel(_pPrevWin->GetSizePixel());
        _pPrevBmp->Show();
        _pPrevBmp->SetAccessibleName(FpsResId(STR_PREVIEW));
        m_aPreviewSize = Size(200, 300);
        m_xPrevBmp->set_size_request(m_aPreviewSize.Width(), m_aPreviewSize.Height());
        m_xPrevBmp->connect_size_allocate(LINK(this, SvtFileDialog, PreviewSizeAllocHdl));
        m_xPreviewFrame->show();
        m_xPrevBmp->set_accessible_name(FpsResId(STR_PREVIEW));
    }

    if ( _nPickerFlags & PickerFlags::AutoExtension )
    if ( m_nPickerFlags & PickerFlags::AutoExtension )
    {
        pImpl->_pCbAutoExtension->SetText( FpsResId( STR_SVT_FILEPICKER_AUTO_EXTENSION ) );
        pImpl->_pCbAutoExtension->Check();
        pImpl->_pCbAutoExtension->SetClickHdl( LINK( this, SvtFileDialog, AutoExtensionHdl_Impl ) );
        pImpl->_pCbAutoExtension->Show();
        m_xImpl->m_xCbAutoExtension->set_label( FpsResId( STR_SVT_FILEPICKER_AUTO_EXTENSION ) );
        m_xImpl->m_xCbAutoExtension->set_active(true);
        m_xImpl->m_xCbAutoExtension->connect_clicked( LINK( this, SvtFileDialog, AutoExtensionHdl_Impl ) );
        m_xImpl->m_xCbAutoExtension->show();
    }

    if ( _nPickerFlags & PickerFlags::FilterOptions )
    if ( m_nPickerFlags & PickerFlags::FilterOptions )
    {
        pImpl->_pCbOptions->SetText( FpsResId( STR_SVT_FILEPICKER_FILTER_OPTIONS ) );
        pImpl->_pCbOptions->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        pImpl->_pCbOptions->Show();
        m_xImpl->m_xCbOptions->set_label( FpsResId( STR_SVT_FILEPICKER_FILTER_OPTIONS ) );
        m_xImpl->m_xCbOptions->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xImpl->m_xCbOptions->show();
    }

    if ( _nPickerFlags & PickerFlags::Selection )
    if ( m_nPickerFlags & PickerFlags::Selection )
    {
        _pCbSelection->SetText( FpsResId( STR_SVT_FILEPICKER_SELECTION ) );
        _pCbSelection->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        _pCbSelection->Show();
        m_xCbSelection->set_label( FpsResId( STR_SVT_FILEPICKER_SELECTION ) );
        m_xCbSelection->connect_clicked( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
        m_xCbSelection->show();
    }

    if ( _nPickerFlags & PickerFlags::PlayButton )
    if ( m_nPickerFlags & PickerFlags::PlayButton )
    {
        _pPbPlay->SetText( FpsResId( STR_SVT_FILEPICKER_PLAY ) );
        _pPbPlay->SetHelpId( HID_FILESAVE_DOPLAY );
        _pPbPlay->SetClickHdl( LINK( this, SvtFileDialog, PlayButtonHdl_Impl ) );
        _pPbPlay->Show();
        m_xPbPlay->set_label( FpsResId( STR_SVT_FILEPICKER_PLAY ) );
        m_xPbPlay->set_help_id( HID_FILESAVE_DOPLAY );
        m_xPbPlay->connect_clicked( LINK( this, SvtFileDialog, PlayButtonHdl_Impl ) );
        m_xPbPlay->show();
    }

    if ( _nPickerFlags & PickerFlags::ShowVersions )
    if ( m_nPickerFlags & PickerFlags::ShowVersions )
    {
        pImpl->_pFtFileVersion->SetText( FpsResId( STR_SVT_FILEPICKER_VERSION ) );
        pImpl->_pFtFileVersion->Show();
        m_xImpl->m_xFtFileVersion->set_label( FpsResId( STR_SVT_FILEPICKER_VERSION ) );
        m_xImpl->m_xFtFileVersion->show();

        pImpl->_pLbFileVersion->SetHelpId( HID_FILEOPEN_VERSION );
        pImpl->_pLbFileVersion->Show();
        m_xImpl->m_xLbFileVersion->set_help_id( HID_FILEOPEN_VERSION );
        m_xImpl->m_xLbFileVersion->show();
    }
    else if ( _nPickerFlags & PickerFlags::Templates )
    else if ( m_nPickerFlags & PickerFlags::Templates )
    {
        pImpl->_pFtTemplates->SetText( FpsResId( STR_SVT_FILEPICKER_TEMPLATES ) );
        pImpl->_pFtTemplates->Show();
        m_xImpl->m_xFtTemplates->set_label( FpsResId( STR_SVT_FILEPICKER_TEMPLATES ) );
        m_xImpl->m_xFtTemplates->show();

        pImpl->_pLbTemplates->SetHelpId( HID_FILEOPEN_VERSION );
        pImpl->_pLbTemplates->Show();
            // This is strange. During the re-factoring during 96930, I discovered that this help id
            // is set in the "Templates mode". This was hidden in the previous implementation.
            // Shouldn't this be a more meaningful help id.
        m_xImpl->m_xLbTemplates->set_help_id( HID_FILEOPEN_VERSION );
        m_xImpl->m_xLbTemplates->show();
        // This is strange. During the re-factoring during 96930, I discovered that this help id
        // is set in the "Templates mode". This was hidden in the previous implementation.
        // Shouldn't this be a more meaningful help id.
    }
    else if ( _nPickerFlags & PickerFlags::ImageTemplate )
    else if ( m_nPickerFlags & PickerFlags::ImageTemplate )
    {
        pImpl->_pFtImageTemplates->SetText( FpsResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) );
        pImpl->_pFtImageTemplates->Show();
        m_xImpl->m_xFtImageTemplates->set_label( FpsResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) );
        m_xImpl->m_xFtImageTemplates->show();

        pImpl->_pLbImageTemplates->SetHelpId( HID_FILEOPEN_IMAGE_TEMPLATE );
        pImpl->_pLbImageTemplates->Show();
        m_xImpl->m_xLbImageTemplates->set_help_id( HID_FILEOPEN_IMAGE_TEMPLATE );
        m_xImpl->m_xLbImageTemplates->show();
    }
    else if ( _nPickerFlags & PickerFlags::ImageAnchor )
    else if ( m_nPickerFlags & PickerFlags::ImageAnchor )
    {
        pImpl->_pFtImageAnchor->SetText( FpsResId( STR_SVT_FILEPICKER_IMAGE_ANCHOR ) );
        pImpl->_pFtImageAnchor->Show();
        m_xImpl->m_xFtImageAnchor->set_label( FpsResId( STR_SVT_FILEPICKER_IMAGE_ANCHOR ) );
        m_xImpl->m_xFtImageAnchor->show();

        pImpl->_pLbImageAnchor->SetHelpId( HID_FILEOPEN_IMAGE_ANCHOR );
        pImpl->_pLbImageAnchor->Show();
        m_xImpl->m_xLbImageAnchor->set_help_id( HID_FILEOPEN_IMAGE_ANCHOR );
        m_xImpl->m_xLbImageAnchor->show();
    }

    pImpl->_pPlaces = VclPtr<PlacesListBox>::Create(_pContainer, this, FpsResId(STR_PLACES_TITLE), WB_BORDER);
    pImpl->_pPlaces->SetHelpId("SVT_HID_FILESAVE_PLACES_LISTBOX");
    Size aSize(LogicToPixel(Size(50, 85), MapMode(MapUnit::MapAppFont)));
    pImpl->_pPlaces->set_height_request(aSize.Height());
    pImpl->_pPlaces->set_width_request(aSize.Width());
    pImpl->_pPlaces->SetSizePixel(aSize);
    pImpl->_pPlaces->Show();

    sal_Int32 nPosX = pImpl->_pPlaces->GetSizePixel().Width();
    _pSplitter->SetPosPixel(Point(nPosX, 0));
    nPosX += _pSplitter->GetSizePixel().Width();
    _pFileView->SetPosPixel(Point(nPosX, 0));

    pImpl->_pPlaces->SetAddHdl( LINK ( this, SvtFileDialog, AddPlacePressed_Hdl ) );
    pImpl->_pPlaces->SetDelHdl( LINK ( this, SvtFileDialog, RemovePlacePressed_Hdl ) );
    m_xImpl->m_xPlaces.reset(new PlacesListBox(m_xBuilder->weld_tree_view("places"),
                                               m_xBuilder->weld_button("add"),
                                               m_xBuilder->weld_button("del"),
                                               this));
    m_xImpl->m_xPlaces->set_help_id("SVT_HID_FILESAVE_PLACES_LISTBOX");
    m_xImpl->m_xPlaces->SetAddHdl( LINK ( this, SvtFileDialog, AddPlacePressed_Hdl ) );
    m_xImpl->m_xPlaces->SetDelHdl( LINK ( this, SvtFileDialog, RemovePlacePressed_Hdl ) );

    initDefaultPlaces();
}


sal_Int32 SvtFileDialog::getTargetColorDepth()
IMPL_LINK(SvtFileDialog, PreviewSizeAllocHdl, const Size&, rSize, void)
{
    if ( _pPrevBmp )
        return _pPrevBmp->GetBitCount();
    else
        return 0;
    m_aPreviewSize = rSize;
}


sal_Int32 SvtFileDialog::getAvailableWidth()
{
    if ( _pPrevBmp )
        return _pPrevBmp->GetOutputSizePixel().Width();
    if (m_xPrevBmp)
        return m_aPreviewSize.Width();
    else
        return 0;
}


sal_Int32 SvtFileDialog::getAvailableHeight()
{
    if ( _pPrevBmp )
        return _pPrevBmp->GetOutputSizePixel().Height();
    if (m_xPrevBmp)
        return m_aPreviewSize.Height();
    else
        return 0;
}


void SvtFileDialog::setImage( const Any& rImage )
void SvtFileDialog::setImage(const Any& rImage)
{
    if ( ! _pPrevBmp || ! _pPrevBmp->IsVisible() )
    if (!m_xPrevBmp || !m_xPreviewFrame->get_visible())
        return;

    Sequence < sal_Int8 > aBmpSequence;
@@ -2586,46 +2192,41 @@
                               StreamMode::READ );
        ReadDIBBitmapEx(aBmp, aData);

        _pPrevBmp->SetBitmap( aBmp );
        m_xPrevBmp->set_image(Graphic(aBmp).GetXGraphic());
    }
    else
    {
        BitmapEx aEmpty;
        _pPrevBmp->SetBitmap( aEmpty );
        m_xPrevBmp->set_image(nullptr);
    }
}


OUString SvtFileDialog::getCurrentFileText( ) const
{
    OUString sReturn;
    if ( pImpl && pImpl->_pEdFileName )
        sReturn = pImpl->_pEdFileName->GetText();
    if (m_xImpl && m_xImpl->m_xEdFileName)
        sReturn = m_xImpl->m_xEdFileName->get_active_text();
    return sReturn;
}


void SvtFileDialog::setCurrentFileText( const OUString& _rText, bool _bSelectAll )
void SvtFileDialog::setCurrentFileText( const OUString& _rText, bool m_bSelectAll )
{
    if ( pImpl && pImpl->_pEdFileName )
    if (m_xImpl && m_xImpl->m_xEdFileName)
    {
        pImpl->_pEdFileName->SetText( _rText );
        if ( _bSelectAll )
            pImpl->_pEdFileName->SetSelection( Selection( 0, _rText.getLength() ) );
        m_xImpl->m_xEdFileName->set_entry_text( _rText );
        if ( m_bSelectAll )
            m_xImpl->m_xEdFileName->select_entry_region(0, -1);
    }
}


bool SvtFileDialog::isAutoExtensionEnabled() const
{
    return pImpl->_pCbAutoExtension && pImpl->_pCbAutoExtension->IsChecked();
    return m_xImpl->m_xCbAutoExtension && m_xImpl->m_xCbAutoExtension->get_active();
}


bool SvtFileDialog::getShowState()
{
    if ( _pPrevBmp )
        return _pPrevBmp->IsVisible();
    if (m_xPreviewFrame)
        return m_xPreviewFrame->get_visible();
    else
        return false;
}
@@ -2664,15 +2265,15 @@
    return m_aContent.isValid();
}

void SvtFileDialog::appendDefaultExtension(OUString& _rFileName,
                                           const OUString& _rFilterDefaultExtension,
                                           const OUString& _rFilterExtensions)
void SvtFileDialog::appendDefaultExtension(OUString& rFileName,
                                           const OUString& rFilterDefaultExtension,
                                           const OUString& rFilterExtensions)
{
    const OUString aType(_rFilterExtensions.toAsciiLowerCase());
    const OUString aType(rFilterExtensions.toAsciiLowerCase());

    if ( aType != FILEDIALOG_FILTER_ALL )
    {
        const OUString aTemp(_rFileName.toAsciiLowerCase());
        const OUString aTemp(rFileName.toAsciiLowerCase());
        sal_Int32 nPos = 0;

        do
@@ -2687,54 +2288,27 @@
        }
        while (nPos>=0);

        _rFileName += "." + _rFilterDefaultExtension;
        rFileName += "." + rFilterDefaultExtension;
    }
}

void SvtFileDialog::initDefaultPlaces( )
{
    PlacePtr pRootPlace( new Place( FpsResId(STR_DEFAULT_DIRECTORY), GetStandardDir() ) );
    pImpl->_pPlaces->AppendPlace( pRootPlace );
    m_xImpl->m_xPlaces->AppendPlace( pRootPlace );

    // Load from user settings
    Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_context));
    Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_context));
    Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_xContext));
    Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_xContext));

    for(sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace)
    {
        PlacePtr pPlace(new Place(placesNamesList[nPlace], placesUrlsList[nPlace], true));
        pImpl->_pPlaces->AppendPlace(pPlace);
        m_xImpl->m_xPlaces->AppendPlace(pPlace);
    }

    // Reset the placesList "updated" state
    pImpl->_pPlaces->IsUpdated();
}

IMPL_LINK_NOARG( SvtFileDialog, Split_Hdl, Splitter*, void )
{
    sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel();

    // Resize the places list
    sal_Int32 nPlaceX = pImpl->_pPlaces->GetPosPixel( ).X();
    Size placeSize = pImpl->_pPlaces->GetSizePixel( );
    placeSize.setWidth( nSplitPos - nPlaceX );
    pImpl->_pPlaces->SetSizePixel( placeSize );

    // Change Pos and size of the fileview
    Point fileViewPos = _pFileView->GetPosPixel();
    sal_Int32 nOldX = fileViewPos.X();
    sal_Int32 nNewX = nSplitPos + _pSplitter->GetSizePixel().Width();
    fileViewPos.setX( nNewX );
    Size fileViewSize = _pFileView->GetSizePixel();
    fileViewSize.AdjustWidth( -( nNewX - nOldX ) );
    _pFileView->SetPosSizePixel( fileViewPos, fileViewSize );

    _pSplitter->SetPosPixel( Point( placeSize.Width(), _pSplitter->GetPosPixel().Y() ) );
}

Image SvtFileDialog::GetButtonImage(const OUString& rButtonId)
{
    return Image(StockImage::Yes, rButtonId);
    m_xImpl->m_xPlaces->IsUpdated();
}

QueryFolderNameDialog::QueryFolderNameDialog(weld::Window* _pParent,
diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx
index e6adff2..bd5d922 100644
--- a/fpicker/source/office/iodlg.hxx
+++ b/fpicker/source/office/iodlg.hxx
@@ -44,9 +44,8 @@
class SvTabListBox;
class SvtFileView;
class SvtFileDialogFilter_Impl;
class SvtURLBox;
class SvtExpFileDlg_Impl;
class CustomContainer;
class URLBox;

enum class AdjustFilterFlags {
    NONE            = 0x0000,
@@ -62,25 +61,24 @@
class SvtFileDialog final : public SvtFileDialog_Base
{
private:
    VclPtr<CheckBox>            _pCbReadOnly;
    VclPtr<CheckBox>            _pCbLinkBox;
    VclPtr<CheckBox>            _pCbPreviewBox;
    VclPtr<CheckBox>            _pCbSelection;
    VclPtr<PushButton>          _pPbPlay;
    VclPtr<vcl::Window>         _pPrevWin;
    VclPtr<FixedBitmap>         _pPrevBmp;
    VclPtr<CustomContainer>     _pContainer;
    VclPtr<SvtFileView>         _pFileView;
    VclPtr<Splitter>            _pSplitter;
    ::svt::IFilePickerListener* _pFileNotifier;
    std::unique_ptr<SvtExpFileDlg_Impl>  pImpl;
    PickerFlags                 _nPickerFlags;
    bool                        _bIsInExecute   :   1;
    std::unique_ptr<weld::CheckButton> m_xCbReadOnly;
    std::unique_ptr<weld::CheckButton> m_xCbLinkBox;
    std::unique_ptr<weld::CheckButton> m_xCbPreviewBox;
    std::unique_ptr<weld::CheckButton> m_xCbSelection;
    std::unique_ptr<weld::Button> m_xPbPlay;
    std::unique_ptr<weld::Widget> m_xPreviewFrame;
    std::unique_ptr<weld::Image> m_xPrevBmp;
    std::unique_ptr<weld::Container> m_xContainer;
    std::unique_ptr<SvtFileView> m_xFileView;
    ::svt::IFilePickerListener* m_pFileNotifier;
    std::unique_ptr<SvtExpFileDlg_Impl> m_xImpl;
    Size                        m_aPreviewSize;
    PickerFlags                 m_nPickerFlags;
    bool                        m_bIsInExecute   :   1;

    ::svt::SmartContent         m_aContent;

    ::std::set< VclPtr<Control> >
                                m_aDisabledControls;
    ::std::set<weld::Widget*>   m_aDisabledControls;

    ::utl::OConfigurationNode   m_aConfiguration;
    ::rtl::Reference< ::svt::AsyncPickerAction >
@@ -88,26 +86,26 @@
    bool                        m_bInExecuteAsync;
    bool                        m_bHasFilename;
    css::uno::Reference < css::uno::XComponentContext >
                                m_context;
                                m_xContext;

    DECL_LINK(            FilterSelectHdl_Impl, ListBox&, void );
    DECL_LINK(            FilterSelectHdl_Impl, weld::ComboBox&, void );
    DECL_LINK(            FilterSelectTimerHdl_Impl, Timer*, void );
    DECL_LINK(            NewFolderHdl_Impl, Button*, void );
    DECL_LINK(            OpenUrlHdl_Impl, SvtURLBox*, void );
    DECL_LINK(            OpenClickHdl_Impl, Button*, void );
    DECL_LINK(            CancelHdl_Impl, Button*, void );
    DECL_LINK(            FileNameGetFocusHdl_Impl, Control&, void );
    DECL_LINK(            FileNameModifiedHdl_Impl, Edit&, void );
    DECL_LINK(            NewFolderHdl_Impl, weld::Button&, void );
    DECL_LINK(            OpenUrlHdl_Impl, weld::ComboBox&, bool );
    DECL_LINK(            OpenClickHdl_Impl, weld::Button&, void );
    DECL_LINK(            CancelHdl_Impl, weld::Button&, void );
    DECL_LINK(            FileNameGetFocusHdl_Impl, weld::Widget&, void );
    DECL_LINK(            FileNameModifiedHdl_Impl, weld::ComboBox&, void );

    DECL_LINK(            URLBoxModifiedHdl_Impl, SvtURLBox*, void );
    DECL_LINK(            ConnectToServerPressed_Hdl, Button*, void );
    DECL_LINK(            URLBoxModifiedHdl_Impl, weld::ComboBox&, bool );
    DECL_LINK(            ConnectToServerPressed_Hdl, weld::Button&, void );

    DECL_LINK(            AddPlacePressed_Hdl, Button*, void );
    DECL_LINK(            RemovePlacePressed_Hdl, Button*, void );
    DECL_LINK(            Split_Hdl, Splitter*, void );
    DECL_LINK(            AddPlacePressed_Hdl, weld::Button&, void );
    DECL_LINK(            RemovePlacePressed_Hdl, weld::Button&, void );
    DECL_LINK(            PreviewSizeAllocHdl, const Size&, void);

    void                        OpenHdl_Impl(void const * pVoid);
    void                        Init_Impl( PickerFlags nBits );
    void                  OpenHdl_Impl(void const * pVoid);

    /** find a filter with the given wildcard
    @param _rFilter
        the wildcard pattern to look for in the filter list
@@ -126,24 +124,20 @@
    void                        OpenMultiSelection_Impl();
    void                        AddControls_Impl( );

    DECL_LINK( SelectHdl_Impl, SvTreeListBox*, void );
    DECL_LINK( DblClickHdl_Impl, SvTreeListBox*, bool);
    DECL_LINK( EntrySelectHdl_Impl, ComboBox&, void);
    DECL_LINK( OpenDoneHdl_Impl, SvtFileView*, void );
    DECL_LINK( AutoExtensionHdl_Impl, Button*, void);
    DECL_LINK( ClickHdl_Impl, Button*, void );
    DECL_LINK( PlayButtonHdl_Impl, Button*, void);

    DECL_LINK(SelectHdl_Impl, SvtFileView*, void);
    DECL_LINK(DblClickHdl_Impl, SvtFileView*, bool);
    DECL_LINK(EntrySelectHdl_Impl, weld::ComboBox&, void);
    DECL_LINK(OpenDoneHdl_Impl, SvtFileView*, void);
    DECL_LINK(AutoExtensionHdl_Impl, weld::Button&, void);
    DECL_LINK(ClickHdl_Impl, weld::Button&, void);
    DECL_LINK(PlayButtonHdl_Impl, weld::Button&, void);
    DECL_LINK(SizeAllocHdl, const Size&, void);

    // removes a filter with wildcards from the path and returns it
    static bool IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilter );

    void    implUpdateImages( );

    virtual bool                EventNotify( NotifyEvent& rNEvt ) override;

    OUString                    _aPath;
    OUString                    _aDefExt;
    OUString                    m_aPath;
    OUString                    m_aDefExt;

    /** enables or disables the complete UI of the file picker, with only offering a
        cancel button
@@ -158,19 +152,17 @@

    /** enables or disables a control

        You are strongly encouraged to prefer this method over pControl->Enable( _bEnable ). See
        You are strongly encouraged to prefer this method over pControl->Enable( bEnable ). See
        <member>EnableUI</member> for details.
    */
    void                        EnableControl( Control* _pControl, bool _bEnable );
    bool                        PrepareExecute();
    void                        EnableControl(weld::Widget* pControl, bool bEnable);
    virtual bool                PrepareExecute() override;

public:
                                SvtFileDialog( vcl::Window* _pParent, PickerFlags nBits );
                                SvtFileDialog( weld::Window* pParent, PickerFlags nBits );
                                virtual ~SvtFileDialog() override;
    virtual void                dispose() override;

    virtual short               Execute() override;
    virtual bool                StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
    virtual short               run() override;

            void                FileSelect();
            void                FilterSelect() override;
@@ -193,9 +185,6 @@
            sal_uInt16          GetFilterCount() const;
            const OUString&     GetFilterName( sal_uInt16 nPos ) const;

    virtual void                Resize() override;
    virtual void                DataChanged( const DataChangedEvent& _rDCEvt ) override;

    void                        PrevLevel_Impl();
    void                        OpenURL_Impl( const OUString& rURL );

@@ -205,9 +194,8 @@
    void                        UpdateControls( const OUString& rURL ) override;
    void                        EnableAutocompletion( bool _bEnable = true ) override;

    void                        SetFileCallback( ::svt::IFilePickerListener *pNotifier ) override { _pFileNotifier = pNotifier; }
    void                        SetFileCallback( ::svt::IFilePickerListener *pNotifier ) override { m_pFileNotifier = pNotifier; }

    sal_Int32                   getTargetColorDepth() override;
    sal_Int32                   getAvailableWidth() override;
    sal_Int32                   getAvailableHeight() override;
    void                        setImage( const css::uno::Any& rImage ) override;
@@ -232,8 +220,6 @@
    inline void                 EraseDefaultExt( sal_Int32 _nIndex = 0 );
    inline const OUString&      GetDefaultExt() const;

    static Image                GetButtonImage(const OUString& rButtonId);

    bool                        ContentIsFolder( const OUString& rURL ) override { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); }
    bool                        ContentHasParentFolder( const OUString& rURL );
    bool                        ContentCanMakeFolder( const OUString& rURL );
@@ -242,7 +228,7 @@
private:
    SvtFileDialogFilter_Impl*   implAddFilter( const OUString& _rFilter, const OUString& _rType );

    /** updates _pUserFilter with a new filter
    /** updates m_xUserFilter with a new filter
        <p>No checks for necessity are made.</p>
    */
    void                        createNewUserFilter( const OUString& _rNewFilter );
@@ -250,7 +236,7 @@
    AdjustFilterFlags           adjustFilter( const OUString& _rFilter );

    // IFilePickerController, needed by OControlAccess
    virtual Control*            getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const override;
    virtual weld::Widget*       getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
    virtual void                enableControl( sal_Int16 _nControlId, bool _bEnable ) override;
    virtual OUString            getCurFilter( ) const override;

@@ -286,7 +272,7 @@

inline void SvtFileDialog::SetPath( const OUString& rNewURL )
{
    _aPath = rNewURL;
    m_aPath = rNewURL;
}


@@ -298,32 +284,31 @@

inline const OUString& SvtFileDialog::GetPath()
{
    return _aPath;
    return m_aPath;
}


inline void SvtFileDialog::SetDefaultExt( const OUString& rExt )
{
    _aDefExt = rExt;
    m_aDefExt = rExt;
}

inline void SvtFileDialog::EraseDefaultExt( sal_Int32 _nIndex )
{
    _aDefExt = _aDefExt.copy( 0, _nIndex );
    m_aDefExt = m_aDefExt.copy( 0, _nIndex );
}

inline const OUString& SvtFileDialog::GetDefaultExt() const
{
    return _aDefExt;
    return m_aDefExt;
}


inline SvtFileView* SvtFileDialog::GetView()
{
    return _pFileView;
    return m_xFileView.get();
}


#endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index d6e841c..fef6a72 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -34,78 +34,37 @@
using namespace ::utl;

SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType )
    :m_aName( rName )
    ,m_aType( rType )
    : m_aName( rName )
    , m_aType( rType )
{
    m_aType = m_aType.toAsciiLowerCase();
}


SvtFileDialogFilter_Impl::~SvtFileDialogFilter_Impl()
{
}


// SvtFileDialogFilterList_Impl


//= SvtFileDialogURLSelector
SvtFileDialogURLSelector::SvtFileDialogURLSelector(vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, const OUString& rButtonId)
    :MenuButton ( _pParent, nBits )
    ,m_pDlg     ( _pDlg )
    ,m_pMenu    ( VclPtr<PopupMenu>::Create() )
{
    SetStyle( GetStyle() | WB_NOPOINTERFOCUS | WB_RECTSTYLE | WB_SMALLSTYLE );
    SetModeImage(SvtFileDialog::GetButtonImage(rButtonId));
    SetDelayMenu(true);
    SetDropDown(PushButtonDropdownStyle::Toolbox);
}


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

void SvtFileDialogURLSelector::dispose()
{
    m_pMenu.disposeAndClear();
    m_pDlg.clear();
    MenuButton::dispose();
}


void SvtFileDialogURLSelector::Activate()
{
    m_pMenu->Clear();

    FillURLMenu( m_pMenu );

    SetPopupMenu( m_pMenu );
}


//= SvtUpButton_Impl


SvtUpButton_Impl::SvtUpButton_Impl( vcl::Window *pParent, SvtFileDialog* pDlg, WinBits nBits )
    :SvtFileDialogURLSelector( pParent, pDlg, nBits, BMP_FILEDLG_BTN_UP )
SvtUpButton_Impl::SvtUpButton_Impl(std::unique_ptr<weld::Toolbar> xToolbar,
                                   std::unique_ptr<weld::Menu> xMenu,
                                   SvtFileDialog* pDlg)
    : m_xToolbar(std::move(xToolbar))
    , m_xMenu(std::move(xMenu))
    , m_pDlg(pDlg)
{
    m_xToolbar->set_item_menu("up_btn", m_xMenu.get());
    m_xToolbar->connect_clicked(LINK(this, SvtUpButton_Impl, ClickHdl));
    m_xMenu->connect_activate(LINK(this, SvtUpButton_Impl, SelectHdl));
}


SvtUpButton_Impl::~SvtUpButton_Impl()
void SvtUpButton_Impl::FillURLMenu()
{
}


void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
{
    SvtFileView* pBox = GetDialogParent()->GetView();
    SvtFileView* pBox = m_pDlg->GetView();

    sal_uInt16 nItemId = 1;

    _aURLs.clear();
    aURLs.clear();
    m_xMenu->clear();

    // determine parent levels
    INetURLObject aObject( pBox->GetViewURL() );
@@ -114,7 +73,7 @@
    ::svtools::VolumeInfo aVolInfo( true /* volume */, false /* remote */,
                                    false /* removable */, false /* floppy */,
                                    false /* compact disk */ );
    Image aVolumeImage( SvFileInformationManager::GetFolderImage( aVolInfo ) );
    OUString aVolumeImage( SvFileInformationManager::GetFolderImageId( aVolInfo ) );

    while ( nCount >= 1 )
    {
@@ -122,98 +81,61 @@
        OUString aParentURL(aObject.GetMainURL(INetURLObject::DecodeMechanism::NONE));

        OUString aTitle;
        if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.isEmpty())

        if (nCount == 1) // adjust the title of the top level entry (the workspace)
            aTitle = SvlResId(STR_SVT_MIMETYPE_CNT_FSYSBOX);
        else if (!m_pDlg->ContentGetTitle(aParentURL, aTitle) || aTitle.isEmpty())
            aTitle = aObject.getName();

        Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
            ? SvFileInformationManager::GetImage( aObject ) : aVolumeImage;
        OUString aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
            ? SvFileInformationManager::GetImageId( aObject ) : aVolumeImage;

        _pMenu->InsertItem( nItemId++, aTitle, aImage );
        _aURLs.push_back(aParentURL);
        m_xMenu->append(OUString::number(nItemId), aTitle, aImage);
        aURLs.push_back(aParentURL);

        if ( nCount == 1 )
        {
            // adjust the title of the top level entry (the workspace)
            _pMenu->SetItemText(--nItemId, SvlResId(STR_SVT_MIMETYPE_CNT_FSYSBOX));
        }
        ++nItemId;
        --nCount;
    }
}

void SvtUpButton_Impl::Select()
IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OString&, rId, void)
{
    sal_uInt16 nId = GetCurItemId();

    if ( nId )
    sal_uInt32 nId = rId.toUInt32();
    if (nId)
    {
        --nId;
        assert( nId <= _aURLs.size() &&  "SvtUpButton_Impl: wrong index" );
        assert( nId <= aURLs.size() &&  "SvtUpButton_Impl: wrong index" );

        GetDialogParent()->OpenURL_Impl(_aURLs[nId]);
        m_pDlg->OpenURL_Impl(aURLs[nId]);
    }
}

void SvtUpButton_Impl::Click()
IMPL_LINK_NOARG(SvtUpButton_Impl, ClickHdl, const OString&, void)
{
    GetDialogParent()->PrevLevel_Impl();
}

Size SvtUpButton_Impl::GetOptimalSize() const
{
    return LogicToPixel(Size(12, 12), MapMode(MapUnit::MapAppFont));
    m_pDlg->PrevLevel_Impl();
}

// SvtExpFileDlg_Impl
SvtExpFileDlg_Impl::SvtExpFileDlg_Impl()   :

    _pCurFilter         ( nullptr ),
    _pFtFileName        ( nullptr ),
    _pEdFileName        ( nullptr ),
    _pFtFileVersion     ( nullptr ),
    _pLbFileVersion     ( nullptr ),
    _pFtTemplates       ( nullptr ),
    _pLbTemplates       ( nullptr ),
    _pFtImageTemplates  ( nullptr ),
    _pLbImageTemplates  ( nullptr ),
    _pFtImageAnchor     ( nullptr ),
    _pLbImageAnchor     ( nullptr ),
    _pFtFileType        ( nullptr ),
    _pLbFilter          ( nullptr ),
    _pBtnFileOpen       ( nullptr ),
    _pBtnCancel         ( nullptr ),
    _pBtnHelp           ( nullptr ),
    _pBtnUp             ( nullptr ),
    _pBtnNewFolder      ( nullptr ),
    _pCbPassword        ( nullptr ),
    _pCbGPGEncrypt      ( nullptr ),
    _pEdCurrentPath     ( nullptr ),
    _pCbAutoExtension   ( nullptr ),
    _pCbOptions         ( nullptr ),
    _pPlaces            ( nullptr ),
    _pBtnConnectToServer( nullptr ),
    _eMode              ( FILEDLG_MODE_OPEN ),
    _eDlgType           ( FILEDLG_TYPE_FILEDLG ),
    _nStyle             ( PickerFlags::NONE ),
    _bDoubleClick       ( false ),
    m_bNeedDelayedFilterExecute ( false ),
    _bMultiSelection    ( false )
SvtExpFileDlg_Impl::SvtExpFileDlg_Impl()
    : m_pCurFilter( nullptr )
    , m_eMode( FILEDLG_MODE_OPEN )
    , m_eDlgType( FILEDLG_TYPE_FILEDLG )
    , m_nStyle( PickerFlags::NONE )
    , m_bDoubleClick( false )
    , m_bNeedDelayedFilterExecute ( false )
    , m_bMultiSelection( false )
{
}


SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
{
    _pBtnUp.disposeAndClear();
    _pUserFilter.reset();
    _pPlaces.disposeAndClear();
}


void SvtExpFileDlg_Impl::SetStandardDir( const OUString& _rDir )
{
    _aStdDir = _rDir;
    if ( _aStdDir.isEmpty() )
        _aStdDir = "file:///";
    m_aStdDir = _rDir;
    if (m_aStdDir.isEmpty())
        m_aStdDir = "file:///";
}

namespace {
@@ -230,29 +152,25 @@
            ||  ( rDisplayName == lcl_DecoratedFilter( pFilter->GetName() ) ),
            "SvtExpFileDlg_Impl::SetCurFilter: arguments are inconsistent!" );

    _pCurFilter = pFilter;
    m_pCurFilter = pFilter;
    m_sCurrentFilterDisplayName = rDisplayName;
}


void SvtExpFileDlg_Impl::InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc )
void SvtExpFileDlg_Impl::InsertFilterListEntry(const SvtFileDialogFilter_Impl* pFilterDesc)
{
    OUString sName = _pFilterDesc->GetName();
    if ( _pFilterDesc->isGroupSeparator() )
        sName = "------------------------------------------";
    // insert and set user data
    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pFilterDesc)));
    OUString sName = pFilterDesc->GetName();
    if (pFilterDesc->isGroupSeparator())
        m_xLbFilter->append_separator(sId);
    else
        sName = _pFilterDesc->GetName();

    // insert an set user data
    const sal_Int32 nPos = _pLbFilter->InsertEntry( sName );
    _pLbFilter->SetEntryData( nPos, const_cast< void* >( static_cast< const void* >( _pFilterDesc ) ) );
        m_xLbFilter->append(sId, sName);
}


void SvtExpFileDlg_Impl::InitFilterList( )
{
    // clear the current list
    _pLbFilter->Clear();
    m_xLbFilter->clear();

    // reinit it
    sal_uInt16 nPos = m_aFilter.size();
diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx
index 137fd1d..68af8a3 100644
--- a/fpicker/source/office/iodlgimp.hxx
+++ b/fpicker/source/office/iodlgimp.hxx
@@ -76,179 +76,151 @@
    FILEDLG_TYPE_PATHDLG
};

class SvtFileDialogURLSelector : public MenuButton
{
public:
    virtual ~SvtFileDialogURLSelector() override;
    virtual void dispose() override;
private:
    VclPtr<SvtFileDialog>      m_pDlg;
    VclPtr<PopupMenu>          m_pMenu;

protected:
    SvtFileDialog*  GetDialogParent()       { return m_pDlg; }

    virtual void    FillURLMenu( PopupMenu* _pMenu ) = 0;

    SvtFileDialogURLSelector(vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, const OUString& rButtonId);

    virtual void        Activate() override;
};

class SvtUpButton_Impl : public SvtFileDialogURLSelector
class SvtUpButton_Impl
{
private:
    std::vector<OUString> _aURLs;
    std::unique_ptr<weld::Toolbar> m_xToolbar;
    std::unique_ptr<weld::Menu> m_xMenu;
    SvtFileDialog* m_pDlg;

    std::vector<OUString> aURLs;

public:
    SvtUpButton_Impl( vcl::Window* pParent, SvtFileDialog* pDlg, WinBits nBits );
    virtual ~SvtUpButton_Impl() override;
    SvtUpButton_Impl(std::unique_ptr<weld::Toolbar> xToolbar,
                     std::unique_ptr<weld::Menu> xMenu,
                     SvtFileDialog* pDlg);

protected:
    virtual void        FillURLMenu( PopupMenu* _pMenu ) override;
    virtual void        Select() override;
    virtual void        Click() override;
    virtual Size        GetOptimalSize() const override;
    void set_help_id(const OString& rHelpId) { m_xToolbar->set_help_id(rHelpId); }
    void show() { m_xToolbar->show(); }

    void FillURLMenu();

    weld::Widget* getWidget() { return m_xToolbar.get(); }

private:

    DECL_LINK(SelectHdl, const OString&, void);
    DECL_LINK(ClickHdl, const OString&, void);
};

class SvtURLBox;
class URLBox;
class SvtExpFileDlg_Impl
{
private:
    const SvtFileDialogFilter_Impl* _pCurFilter;
    OUString                        m_sCurrentFilterDisplayName;    // may differ from _pCurFilter->GetName in case it is a cached entry
    const SvtFileDialogFilter_Impl* m_pCurFilter;
    OUString                        m_sCurrentFilterDisplayName;    // may differ from m_pCurFilter->GetName in case it is a cached entry

    css::uno::Sequence< OUString > _aBlackList;
    css::uno::Sequence< OUString > m_aBlackList;

public:
    SvtFileDialogFilterList_Impl    m_aFilter;
    std::unique_ptr<SvtFileDialogFilter_Impl> _pUserFilter;
    std::unique_ptr<SvtFileDialogFilter_Impl> m_xUserFilter;

    VclPtr<FixedText>                      _pFtFileName;
    VclPtr<SvtURLBox>                      _pEdFileName;
    std::unique_ptr<weld::Label> m_xFtFileName;
    std::unique_ptr<URLBox> m_xEdFileName;

    VclPtr<FixedText>                      _pFtFileVersion;
    VclPtr<ListBox>                        _pLbFileVersion;
    std::unique_ptr<weld::Label> m_xFtFileVersion;
    std::unique_ptr<weld::ComboBox> m_xLbFileVersion;

    VclPtr<FixedText>                      _pFtTemplates;
    VclPtr<ListBox>                        _pLbTemplates;
    std::unique_ptr<weld::Label> m_xFtTemplates;
    std::unique_ptr<weld::ComboBox> m_xLbTemplates;

    VclPtr<FixedText>                      _pFtImageTemplates;
    VclPtr<ListBox>                        _pLbImageTemplates;
    std::unique_ptr<weld::Label> m_xFtImageTemplates;
    std::unique_ptr<weld::ComboBox> m_xLbImageTemplates;

    VclPtr<FixedText>                      _pFtImageAnchor;
    VclPtr<ListBox>                        _pLbImageAnchor;
    std::unique_ptr<weld::Label> m_xFtImageAnchor;
    std::unique_ptr<weld::ComboBox> m_xLbImageAnchor;

    VclPtr<FixedText>                      _pFtFileType;
    VclPtr<ListBox>                        _pLbFilter;
    VclPtr<PushButton>                     _pBtnFileOpen;
    VclPtr<PushButton>                     _pBtnCancel;
    VclPtr<HelpButton>                     _pBtnHelp;
    VclPtr<SvtUpButton_Impl>               _pBtnUp;
    VclPtr<PushButton>                     _pBtnNewFolder;
    VclPtr<CheckBox>                       _pCbPassword;
    VclPtr<CheckBox>                       _pCbGPGEncrypt;
    VclPtr<SvtURLBox>                      _pEdCurrentPath;
    VclPtr<CheckBox>                       _pCbAutoExtension;
    VclPtr<CheckBox>                       _pCbOptions;
    std::unique_ptr<weld::Label> m_xFtFileType;
    std::unique_ptr<weld::ComboBox> m_xLbFilter;
    std::unique_ptr<weld::Button> m_xBtnFileOpen;
    std::unique_ptr<weld::Button> m_xBtnCancel;
    std::unique_ptr<weld::Button> m_xBtnHelp;
    std::unique_ptr<SvtUpButton_Impl> m_xBtnUp;
    std::unique_ptr<weld::Button> m_xBtnNewFolder;
    std::unique_ptr<weld::CheckButton> m_xCbPassword;
    std::unique_ptr<weld::CheckButton> m_xCbGPGEncrypt;
    std::unique_ptr<URLBox> m_xEdCurrentPath;
    std::unique_ptr<weld::CheckButton> m_xCbAutoExtension;
    std::unique_ptr<weld::CheckButton> m_xCbOptions;

    VclPtr<PlacesListBox>                  _pPlaces;
    VclPtr<PushButton>                     _pBtnConnectToServer;
    std::unique_ptr<PlacesListBox> m_xPlaces;
    std::unique_ptr<weld::Button> m_xBtnConnectToServer;

    SvtFileDlgMode                  _eMode;
    SvtFileDlgType                  _eDlgType;
    PickerFlags                     _nStyle;
    SvtFileDlgMode m_eMode;
    SvtFileDlgType m_eDlgType;
    PickerFlags m_nStyle;

    OUString                        _aStdDir;
    OUString m_aStdDir;

    // delay filter when traveling the filterbox
    Timer                           _aFilterTimer;
    Idle m_aFilterIdle;

    // shows OpenHdl_Imp() if the open was triggered by a double click
    bool                        _bDoubleClick;
    bool                        m_bNeedDelayedFilterExecute;
    bool m_bDoubleClick;
    bool m_bNeedDelayedFilterExecute;

    // MultiSelection?
    bool                        _bMultiSelection;
    bool m_bMultiSelection;

    // remember sizes
    OUString                        _aIniKey;
    OUString m_aIniKey;

    explicit                SvtExpFileDlg_Impl();
                            ~SvtExpFileDlg_Impl();
    explicit SvtExpFileDlg_Impl();
    ~SvtExpFileDlg_Impl();

    void             SetBlackList( const css::uno::Sequence< OUString >& rBlackList ) { m_aBlackList = rBlackList; }
    const css::uno::Sequence< OUString >& GetBlackList() const { return m_aBlackList; }
    void                    SetStandardDir( const OUString& rDir );
    const OUString&  GetStandardDir() const { return m_aStdDir; }

    void             SetBlackList( const css::uno::Sequence< OUString >& rBlackList ) { _aBlackList = rBlackList; }
    const css::uno::Sequence< OUString >& GetBlackList() const { return _aBlackList; }
    void                    SetStandardDir( const OUString& _rDir );
    const OUString&  GetStandardDir() const          { return _aStdDir; }
    void             DisableFilterBoxAutoWidth()     { _pLbFilter->EnableDDAutoWidth( false ); }


    // access to the filter listbox only as Control* - we want to maintain the entries/userdata ourself
            Control*        GetFilterListControl()          { return _pLbFilter; }
            const Control*  GetFilterListControl() const    { return _pLbFilter; }
    inline  void            SetFilterListSelectHdl( const Link<ListBox&,void>& _rHandler );
    // access to the filter listbox only as weld::Widget* - we want to maintain the entries/userdata ourself
    weld::Widget* GetFilterListControl() { return m_xLbFilter.get(); }
    const weld::Widget*  GetFilterListControl() const { return m_xLbFilter.get(); }
    void SetFilterListSelectHdl(const Link<weld::ComboBox&, void>& rHandler)
    {
        m_xLbFilter->connect_changed(rHandler);
    }

    // inits the listbox for the filters from the filter list (_pFilter)
            void            InitFilterList( );
    inline  bool            HasFilterListEntry( const OUString& _rFilterName );
    inline  void            SelectFilterListEntry( const OUString& _rFilterName );
    inline  void            SetNoFilterListSelection( );
            void            InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
                                // _pFilterDesc must already have been added to _pFilter
    inline  SvtFileDialogFilter_Impl*   GetSelectedFilterEntry( OUString& /* [out] */ _rDisplayName ) const;
    inline  bool        IsFilterListTravelSelect() const;
    bool HasFilterListEntry( const OUString& rFilterName )
    {
        return m_xLbFilter->find_text(rFilterName) != -1;
    }

    void SelectFilterListEntry( const OUString& rFilterName )
    {
        m_xLbFilter->set_active_text(rFilterName);
    }

    // access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName
    inline      const SvtFileDialogFilter_Impl*     GetCurFilter( ) const;
    inline      const OUString&                     GetCurFilterDisplayName() const;
                void                                SetCurFilter( SvtFileDialogFilter_Impl const * _pFilter, const OUString& _rDisplayName );
    void SetNoFilterListSelection( )
    {
        m_xLbFilter->set_active(-1);
    }

    void            InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
    // _pFilterDesc must already have been added to _pFilter
    SvtFileDialogFilter_Impl* GetSelectedFilterEntry( OUString& rDisplayName ) const
    {
        rDisplayName = m_xLbFilter->get_active_text();
        return reinterpret_cast<SvtFileDialogFilter_Impl*>(m_xLbFilter->get_active_id().toInt64());
    }

    // access to the current filter via methods only - need to care for consistency between m_pCurFilter and m_sCurrentFilterDisplayName
    const SvtFileDialogFilter_Impl* GetCurFilter( ) const
    {
        return m_pCurFilter;
    }

    const OUString& GetCurFilterDisplayName() const
    {
        return m_sCurrentFilterDisplayName;
    }

    void SetCurFilter( SvtFileDialogFilter_Impl const * _pFilter, const OUString& rDisplayName );
};

inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link<ListBox&,void>& _rHandler )
{
    _pLbFilter->SetSelectHdl( _rHandler );
}

inline bool SvtExpFileDlg_Impl::HasFilterListEntry( const OUString& _rFilterName )
{
    return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) );
}

inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const OUString& _rFilterName )
{
    _pLbFilter->SelectEntry( _rFilterName );
}

inline  void SvtExpFileDlg_Impl::SetNoFilterListSelection( )
{
    _pLbFilter->SetNoSelection( );
}

inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( OUString& _rDisplayName ) const
{
    _rDisplayName = _pLbFilter->GetSelectedEntry();
    return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetSelectedEntryData () );
}

inline bool SvtExpFileDlg_Impl::IsFilterListTravelSelect() const
{
    return _pLbFilter->IsTravelSelect();
}

inline const SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetCurFilter( ) const
{
    return _pCurFilter;
}

inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const
{
    return m_sCurrentFilterDisplayName;
}

#endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/office/pickercallbacks.hxx b/fpicker/source/office/pickercallbacks.hxx
index 115d6fb..9c965f7d 100644
--- a/fpicker/source/office/pickercallbacks.hxx
+++ b/fpicker/source/office/pickercallbacks.hxx
@@ -23,35 +23,29 @@
#include <sal/types.h>
#include <rtl/ustring.hxx>

class Control;

namespace weld { class Widget; }

namespace svt
{


    class IFilePickerController
    {
    public:
        virtual Control*    getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const = 0;
        virtual void        enableControl( sal_Int16 _nControlId, bool _bEnable ) = 0;
        virtual weld::Widget* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const = 0;
        virtual void        enableControl( sal_Int16 nControlId, bool bEnable ) = 0;
        virtual OUString    getCurFilter( ) const = 0;

    protected:
        ~IFilePickerController() {}
    };


    class IFilePickerListener
    {
    public:
        virtual void    notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) = 0;
        virtual void    notify( sal_Int16 nEventId, sal_Int16 nControlId ) = 0;

    protected:
        ~IFilePickerListener() {}
    };


}   // namespace svt


diff --git a/fpicker/uiconfig/ui/breadcrumb.ui b/fpicker/uiconfig/ui/breadcrumb.ui
new file mode 100644
index 0000000..c41dc62
--- /dev/null
+++ b/fpicker/uiconfig/ui/breadcrumb.ui
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="fps">
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkGrid" id="container">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="column_spacing">6</property>
    <child>
      <object class="GtkLinkButton" id="link">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <property name="receives_default">True</property>
        <property name="relief">none</property>
      </object>
      <packing>
        <property name="left_attach">0</property>
        <property name="top_attach">0</property>
      </packing>
    </child>
    <child>
      <object class="GtkLabel" id="label">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
      </object>
      <packing>
        <property name="left_attach">1</property>
        <property name="top_attach">0</property>
      </packing>
    </child>
  </object>
</interface>
diff --git a/fpicker/uiconfig/ui/explorerfiledialog.ui b/fpicker/uiconfig/ui/explorerfiledialog.ui
index 16da6c7..54fa3f5 100644
--- a/fpicker/uiconfig/ui/explorerfiledialog.ui
+++ b/fpicker/uiconfig/ui/explorerfiledialog.ui
@@ -1,8 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="fps">
  <requires lib="gtk+" version="3.18"/>
  <requires lib="LibreOffice" version="1.0"/>
  <object class="GtkImage" id="image1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-add</property>
  </object>
  <object class="GtkImage" id="image2">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="stock">gtk-remove</property>
  </object>
  <object class="GtkImage" id="image4">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">fpicker/res/fp014.png</property>
  </object>
  <object class="GtkTreeStore" id="liststore1">
    <columns>
      <!-- column-name expander -->
      <column type="GdkPixbuf"/>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkTreeStore" id="liststore2">
    <columns>
      <!-- column-name expander -->
      <column type="GdkPixbuf"/>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkTreeStore" id="liststore3">
    <columns>
      <!-- column-name expander -->
      <column type="GdkPixbuf"/>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name text2 -->
      <column type="gchararray"/>
      <!-- column-name text3 -->
      <column type="gchararray"/>
      <!-- column-name text1 -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkDialog" id="ExplorerFileDialog">
    <property name="can_focus">False</property>
    <property name="hexpand">True</property>
@@ -10,6 +60,9 @@
    <property name="border_width">6</property>
    <property name="modal">True</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>
@@ -55,11 +108,17 @@
                    <property name="hexpand">True</property>
                    <property name="spacing">6</property>
                    <child>
                      <object class="svtlo-SvtURLBox" id="current_path">
                      <object class="GtkComboBoxText" id="current_path">
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="can_focus">False</property>
                        <property name="valign">center</property>
                        <property name="hexpand">True</property>
                        <property name="max_width_chars">40</property>
                        <property name="has_entry">True</property>
                        <child internal-child="entry">
                          <object class="GtkEntry">
                            <property name="can_focus">True</property>
                          </object>
                        </child>
                      </object>
                      <packing>
                        <property name="expand">False</property>
@@ -75,6 +134,7 @@
                        <property name="receives_default">True</property>
                        <property name="has_tooltip">True</property>
                        <property name="tooltip_text" translatable="yes" context="explorerfiledialog|connect_to_server|tooltip_text">Connect To Server</property>
                        <property name="valign">center</property>
                        <child internal-child="accessible">
                          <object class="AtkObject" id="connect_to_server-atkobject">
                            <property name="AtkObject::accessible-name" translatable="yes" context="explorerfiledialog|connect_to_server-atkobject">Connect To Server</property>
@@ -88,12 +148,38 @@
                      </packing>
                    </child>
                    <child>
                      <object class="GtkBox" id="up">
                      <object class="GtkScrolledWindow">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="orientation">vertical</property>
                        <property name="can_focus">True</property>
                        <property name="valign">center</property>
                        <property name="hscrollbar_policy">never</property>
                        <property name="vscrollbar_policy">never</property>
                        <property name="shadow_type">in</property>
                        <property name="propagate_natural_width">True</property>
                        <property name="propagate_natural_height">True</property>
                        <child>
                          <placeholder/>
                          <object class="GtkViewport">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <child>
                              <object class="GtkToolbar" id="up_bar">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <child>
                                  <object class="GtkMenuToolButton" id="up_btn">
                                    <property name="visible">True</property>
                                    <property name="can_focus">False</property>
                                    <property name="use_underline">True</property>
                                    <property name="icon_name">res/fp010.png</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="homogeneous">True</property>
                                  </packing>
                                </child>
                              </object>
                            </child>
                          </object>
                        </child>
                      </object>
                      <packing>
@@ -110,6 +196,9 @@
                        <property name="receives_default">True</property>
                        <property name="has_tooltip">True</property>
                        <property name="tooltip_text" translatable="yes" context="explorerfiledialog|new_folder|tooltip_text">Create New Folder</property>
                        <property name="valign">center</property>
                        <property name="image">image4</property>
                        <property name="always_show_image">True</property>
                        <child internal-child="accessible">
                          <object class="AtkObject" id="new_folder-atkobject">
                            <property name="AtkObject::accessible-name" translatable="yes" context="explorerfiledialog|new_folder-atkobject">Create New Folder</property>
@@ -137,7 +226,260 @@
                    <property name="vexpand">True</property>
                    <property name="orientation">vertical</property>
                    <child>
                      <placeholder/>
                      <object class="GtkPaned">
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <child>
                          <object class="GtkBox">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="hexpand">True</property>
                            <property name="vexpand">True</property>
                            <property name="orientation">vertical</property>
                            <property name="spacing">6</property>
                            <child>
                              <object class="GtkScrolledWindow">
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="hexpand">True</property>
                                <property name="vexpand">True</property>
                                <property name="shadow_type">in</property>
                                <child>
                                  <object class="GtkTreeView" id="places">
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="hexpand">True</property>
                                    <property name="vexpand">True</property>
                                    <property name="model">liststore1</property>
                                    <property name="headers_clickable">False</property>
                                    <property name="search_column">1</property>
                                    <property name="show_expanders">False</property>
                                    <child internal-child="selection">
                                      <object class="GtkTreeSelection"/>
                                    </child>
                                    <child>
                                      <object class="GtkTreeViewColumn" id="treeviewcolumn5">
                                        <property name="resizable">True</property>
                                        <property name="spacing">6</property>
                                        <property name="title" translatable="yes" context="explorerfiledialog|places">Places</property>
                                        <child>
                                          <object class="GtkCellRendererPixbuf" id="cellrenderertext6"/>
                                          <attributes>
                                            <attribute name="pixbuf">0</attribute>
                                          </attributes>
                                        </child>
                                        <child>
                                          <object class="GtkCellRendererText" id="cellrenderer11"/>
                                          <attributes>
                                            <attribute name="text">1</attribute>
                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                  </object>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="position">0</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkBox">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="halign">start</property>
                                <property name="spacing">6</property>
                                <child>
                                  <object class="GtkButton" id="add">
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">True</property>
                                    <property name="image">image1</property>
                                    <property name="always_show_image">True</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">0</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkButton" id="del">
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">True</property>
                                    <property name="image">image2</property>
                                    <property name="always_show_image">True</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">1</property>
                                  </packing>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">True</property>
                                <property name="pack_type">end</property>
                                <property name="position">1</property>
                              </packing>
                            </child>
                          </object>
                          <packing>
                            <property name="resize">False</property>
                            <property name="shrink">True</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkBox">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="hexpand">True</property>
                            <property name="vexpand">True</property>
                            <property name="orientation">vertical</property>
                            <child>
                              <object class="GtkScrolledWindow">
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="hexpand">True</property>
                                <property name="vexpand">True</property>
                                <property name="shadow_type">in</property>
                                <child>
                                  <object class="GtkTreeView" id="fileview">
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="hexpand">True</property>
                                    <property name="vexpand">True</property>
                                    <property name="model">liststore3</property>
                                    <property name="search_column">1</property>
                                    <property name="show_expanders">False</property>
                                    <child internal-child="selection">
                                      <object class="GtkTreeSelection"/>
                                    </child>
                                    <child>
                                      <object class="GtkTreeViewColumn" id="treeviewcolumn3">
                                        <property name="resizable">True</property>
                                        <property name="spacing">6</property>
                                        <property name="title" translatable="yes" context="explorerfiledialog|name">Name</property>
                                        <property name="clickable">True</property>
                                        <child>
                                          <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
                                          <attributes>
                                            <attribute name="pixbuf">0</attribute>
                                          </attributes>
                                        </child>
                                        <child>
                                          <object class="GtkCellRendererText" id="cellrenderer1"/>
                                          <attributes>
                                            <attribute name="text">1</attribute>
                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                    <child>
                                      <object class="GtkTreeViewColumn" id="treeviewcolumn4">
                                        <property name="resizable">True</property>
                                        <property name="spacing">6</property>
                                        <property name="title" translatable="yes" context="explorerfiledialog|type">Type</property>
                                        <property name="clickable">True</property>
                                        <child>
                                          <object class="GtkCellRendererText" id="cellrenderer5"/>
                                          <attributes>
                                            <attribute name="text">2</attribute>
                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                    <child>
                                      <object class="GtkTreeViewColumn" id="treeviewcolumn1">
                                        <property name="resizable">True</property>
                                        <property name="spacing">6</property>
                                        <property name="title" translatable="yes" context="explorerfiledialog|size">Size</property>
                                        <property name="clickable">True</property>
                                        <child>
                                          <object class="GtkCellRendererText" id="cellrenderer2"/>
                                          <attributes>
                                            <attribute name="text">3</attribute>
                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                    <child>
                                      <object class="GtkTreeViewColumn" id="treeviewcolumn2">
                                        <property name="resizable">True</property>
                                        <property name="spacing">6</property>
                                        <property name="title" translatable="yes" context="explorerfiledialog|date">Date modified</property>
                                        <property name="clickable">True</property>
                                        <child>
                                          <object class="GtkCellRendererText" id="cellrenderer3"/>
                                          <attributes>
                                            <attribute name="text">4</attribute>
                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                  </object>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="position">0</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkScrolledWindow">
                                <property name="can_focus">True</property>
                                <property name="no_show_all">True</property>
                                <property name="hexpand">True</property>
                                <property name="vexpand">True</property>
                                <property name="shadow_type">in</property>
                                <child>
                                  <object class="GtkIconView" id="iconview">
                                    <property name="can_focus">True</property>
                                    <property name="no_show_all">True</property>
                                    <property name="margin">6</property>
                                    <property name="hexpand">True</property>
                                    <property name="vexpand">True</property>
                                    <property name="model">liststore2</property>
                                    <child>
                                      <object class="GtkCellRendererPixbuf" id="icon"/>
                                      <attributes>
                                        <attribute name="pixbuf">0</attribute>
                                      </attributes>
                                    </child>
                                    <child>
                                      <object class="GtkCellRendererText" id="text"/>
                                      <attributes>
                                        <attribute name="text">1</attribute>
                                      </attributes>
                                    </child>
                                  </object>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="position">1</property>
                              </packing>
                            </child>
                          </object>
                          <packing>
                            <property name="resize">True</property>
                            <property name="shrink">True</property>
                          </packing>
                        </child>
                      </object>
                      <packing>
                        <property name="expand">True</property>
                        <property name="fill">True</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
@@ -238,7 +580,6 @@
                            <property name="hexpand">True</property>
                            <property name="row_spacing">6</property>
                            <property name="column_spacing">6</property>
                            <property name="row_homogeneous">True</property>
                            <child>
                              <object class="GtkLabel" id="file_name_label">
                                <property name="visible">True</property>
@@ -258,6 +599,7 @@
                                <property name="can_focus">False</property>
                                <property name="halign">end</property>
                                <property name="use_underline">True</property>
                                <property name="mnemonic_widget">shared</property>
                              </object>
                              <packing>
                                <property name="left_attach">0</property>
@@ -279,19 +621,7 @@
                              </packing>
                            </child>
                            <child>
                              <object class="svtlo-SvtURLBox" id="file_name">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
                                <property name="max_width_chars">40</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="top_attach">0</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkComboBox" id="shared">
                              <object class="GtkComboBoxText" id="shared">
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
                              </object>
@@ -301,7 +631,7 @@
                              </packing>
                            </child>
                            <child>
                              <object class="GtkComboBox" id="file_type">
                              <object class="GtkComboBoxText" id="file_type">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
@@ -311,6 +641,24 @@
                                <property name="top_attach">1</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkComboBoxText" id="file_name">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
                                <property name="has_entry">True</property>
                                <child internal-child="entry">
                                  <object class="GtkEntry">
                                    <property name="can_focus">True</property>
                                    <property name="activates_default">True</property>
                                  </object>
                                </child>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="top_attach">0</property>
                              </packing>
                            </child>
                          </object>
                          <packing>
                            <property name="left_attach">0</property>
@@ -324,46 +672,6 @@
                            <property name="hexpand">True</property>
                            <property name="row_spacing">6</property>
                            <child>
                              <object class="GtkBox" id="box1">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
                                <property name="spacing">12</property>
                                <child>
                                  <object class="GtkCheckButton" id="link">
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">False</property>
                                    <property name="use_underline">True</property>
                                    <property name="xalign">0</property>
                                    <property name="draw_indicator">True</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">0</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkCheckButton" id="cb_preview">
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">False</property>
                                    <property name="use_underline">True</property>
                                    <property name="xalign">0</property>
                                    <property name="draw_indicator">True</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">1</property>
                                  </packing>
                                </child>
                              </object>
                              <packing>
                                <property name="left_attach">0</property>
                                <property name="top_attach">0</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkCheckButton" id="readonly">
                                <property name="label" translatable="yes" context="explorerfiledialog|readonly">_Read-only</property>
                                <property name="can_focus">True</property>
@@ -465,6 +773,46 @@
                                <property name="top_attach">2</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkBox" id="box1">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="hexpand">True</property>
                                <property name="spacing">12</property>
                                <child>
                                  <object class="GtkCheckButton" id="link">
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">False</property>
                                    <property name="use_underline">True</property>
                                    <property name="xalign">0</property>
                                    <property name="draw_indicator">True</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">0</property>
                                  </packing>
                                </child>
                                <child>
                                  <object class="GtkCheckButton" id="cb_preview">
                                    <property name="can_focus">True</property>
                                    <property name="receives_default">False</property>
                                    <property name="use_underline">True</property>
                                    <property name="xalign">0</property>
                                    <property name="draw_indicator">True</property>
                                  </object>
                                  <packing>
                                    <property name="expand">False</property>
                                    <property name="fill">True</property>
                                    <property name="position">1</property>
                                  </packing>
                                </child>
                              </object>
                              <packing>
                                <property name="left_attach">0</property>
                                <property name="top_attach">0</property>
                              </packing>
                            </child>
                          </object>
                          <packing>
                            <property name="left_attach">0</property>
@@ -499,10 +847,30 @@
                <property name="orientation">vertical</property>
                <property name="spacing">6</property>
                <child>
                  <object class="GtkDrawingArea" id="preview">
                    <property name="width_request">200</property>
                    <property name="can_focus">False</property>
                    <property name="vexpand">True</property>
                  <object class="GtkScrolledWindow" id="previewframe">
                    <property name="can_focus">True</property>
                    <property name="no_show_all">True</property>
                    <property name="valign">start</property>
                    <property name="hscrollbar_policy">never</property>
                    <property name="vscrollbar_policy">never</property>
                    <property name="shadow_type">in</property>
                    <property name="propagate_natural_width">True</property>
                    <property name="propagate_natural_height">True</property>
                    <child>
                      <object class="GtkViewport">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkImage" id="preview">
                            <property name="width_request">200</property>
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="valign">start</property>
                            <property name="vexpand">True</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
@@ -527,4 +895,8 @@
      </object>
    </child>
  </object>
  <object class="GtkMenu" id="up_menu">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
  </object>
</interface>
diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui
index 9136176..93c17f05 100644
--- a/fpicker/uiconfig/ui/remotefilesdialog.ui
+++ b/fpicker/uiconfig/ui/remotefilesdialog.ui
@@ -12,33 +12,44 @@
    <property name="can_focus">False</property>
    <property name="icon_name">svx/res/gallist.png</property>
  </object>
  <object class="GtkMenu" id="service_edit_menu">
  <object class="GtkImage" id="image3">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <child>
      <object class="GtkMenuItem" id="edit_service">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="remotefilesdialog|edit_service">_Edit service</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="delete_service">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="remotefilesdialog|delete_service">_Delete service</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="change_password">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="remotefilesdialog|change_password">_Change password</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <property name="icon_name">fpicker/res/fp014.png</property>
  </object>
  <object class="GtkTreeStore" id="liststore1">
    <columns>
      <!-- column-name expander -->
      <column type="GdkPixbuf"/>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkTreeStore" id="liststore2">
    <columns>
      <!-- column-name expander -->
      <column type="GdkPixbuf"/>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkTreeStore" id="liststore3">
    <columns>
      <!-- column-name expander -->
      <column type="GdkPixbuf"/>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name text2 -->
      <column type="gchararray"/>
      <!-- column-name text3 -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
    </columns>
  </object>
  <object class="GtkDialog" id="RemoteFilesDialog">
    <property name="can_focus">False</property>
@@ -151,6 +162,7 @@
              <object class="GtkComboBoxText" id="services_lb">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="valign">center</property>
                <accessibility>
                  <relation type="labelled-by" target="label1"/>
                </accessibility>
@@ -162,14 +174,38 @@
              </packing>
            </child>
            <child>
              <object class="GtkMenuButton" id="add_service_btn">
                <property name="label" translatable="yes" context="remotefilesdialog|add_service_btn">Add service</property>
              <object class="GtkScrolledWindow">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="popup">service_edit_menu</property>
                <property name="valign">center</property>
                <property name="hscrollbar_policy">never</property>
                <property name="vscrollbar_policy">never</property>
                <property name="shadow_type">in</property>
                <property name="propagate_natural_width">True</property>
                <property name="propagate_natural_height">True</property>
                <child>
                  <placeholder/>
                  <object class="GtkViewport">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <child>
                      <object class="GtkToolbar" id="add_service_bar">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkMenuToolButton" id="add_service_btn">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="label" translatable="yes" context="remotefilesdialog|add_service_btn">Add service</property>
                            <property name="use_underline">True</property>
                          </object>
                          <packing>
                            <property name="expand">False</property>
                            <property name="homogeneous">True</property>
                          </packing>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
              <packing>
@@ -207,13 +243,14 @@
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="list_view">
              <object class="GtkToggleButton" id="list_view">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="has_tooltip">True</property>
                <property name="tooltip_text" translatable="yes" context="remotefilesdialog|list_view|tooltip_text">List view</property>
                <property name="image">image2</property>
                <property name="active">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
@@ -222,7 +259,7 @@
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="icon_view">
              <object class="GtkToggleButton" id="icon_view">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
@@ -246,6 +283,8 @@
                <property name="has_tooltip">True</property>
                <property name="tooltip_text" translatable="yes" context="remotefilesdialog|new_folder|tooltip_text">Create New Folder</property>
                <property name="margin_left">6</property>
                <property name="image">image3</property>
                <property name="always_show_image">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
@@ -262,15 +301,182 @@
        </child>
        <child>
          <object class="GtkBox" id="container">
            <property name="width_request">555</property>
            <property name="height_request">200</property>
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="hexpand">True</property>
            <property name="vexpand">True</property>
            <property name="orientation">vertical</property>
            <child>
              <placeholder/>
              <object class="GtkPaned">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="hexpand">True</property>
                <property name="vexpand">True</property>
                <child>
                  <object class="GtkScrolledWindow">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="hexpand">True</property>
                    <property name="vexpand">True</property>
                    <property name="shadow_type">in</property>
                    <child>
                      <object class="GtkTreeView" id="foldertree">
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <property name="model">liststore1</property>
                        <property name="headers_visible">False</property>
                        <property name="headers_clickable">False</property>
                        <child internal-child="selection">
                          <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
                        </child>
                        <child>
                          <object class="GtkTreeViewColumn" id="treeviewcolumn5">
                            <property name="resizable">True</property>
                            <property name="spacing">6</property>
                            <child>
                              <object class="GtkCellRendererPixbuf" id="cellrenderertext6"/>
                              <attributes>
                                <attribute name="pixbuf">0</attribute>
                              </attributes>
                            </child>
                            <child>
                              <object class="GtkCellRendererText" id="cellrenderer11"/>
                              <attributes>
                                <attribute name="text">1</attribute>
                              </attributes>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="resize">False</property>
                    <property name="shrink">True</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkBox">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="vexpand">True</property>
                    <property name="orientation">vertical</property>
                    <child>
                      <object class="GtkScrolledWindow">
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <property name="shadow_type">in</property>
                        <child>
                          <object class="GtkTreeView" id="fileview">
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="hexpand">True</property>
                            <property name="vexpand">True</property>
                            <property name="model">liststore3</property>
                            <property name="show_expanders">False</property>
                            <child internal-child="selection">
                              <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
                            </child>
                            <child>
                              <object class="GtkTreeViewColumn" id="treeviewcolumn3">
                                <property name="resizable">True</property>
                                <property name="spacing">6</property>
                                <property name="title" translatable="yes" context="remotefilesdialog|name">Name</property>
                                <property name="clickable">True</property>
                                <child>
                                  <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
                                  <attributes>
                                    <attribute name="pixbuf">0</attribute>
                                  </attributes>
                                </child>
                                <child>
                                  <object class="GtkCellRendererText" id="cellrenderer1"/>
                                  <attributes>
                                    <attribute name="text">1</attribute>
                                  </attributes>
                                </child>
                              </object>
                            </child>
                            <child>
                              <object class="GtkTreeViewColumn" id="treeviewcolumn4">
                                <property name="resizable">True</property>
                                <property name="spacing">6</property>
                                <property name="title" translatable="yes" context="remotefilesdialog|size">Size</property>
                                <property name="clickable">True</property>
                                <child>
                                  <object class="GtkCellRendererText" id="cellrenderer2"/>
                                  <attributes>
                                    <attribute name="text">2</attribute>
                                  </attributes>
                                </child>
                              </object>
                            </child>
                            <child>
                              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
                                <property name="resizable">True</property>
                                <property name="spacing">6</property>
                                <property name="title" translatable="yes" context="remotefilesdialog|date">Date modified</property>
                                <property name="clickable">True</property>
                                <child>
                                  <object class="GtkCellRendererText" id="cellrenderer3"/>
                                  <attributes>
                                    <attribute name="text">3</attribute>
                                  </attributes>
                                </child>
                              </object>
                            </child>
                          </object>
                        </child>
                      </object>
                      <packing>
                        <property name="expand">True</property>
                        <property name="fill">True</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkScrolledWindow">
                        <property name="can_focus">True</property>
                        <property name="no_show_all">True</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                        <property name="shadow_type">in</property>
                        <child>
                          <object class="GtkIconView" id="iconview">
                            <property name="can_focus">True</property>
                            <property name="no_show_all">True</property>
                            <property name="margin">6</property>
                            <property name="hexpand">True</property>
                            <property name="vexpand">True</property>
                            <property name="model">liststore2</property>
                            <property name="pixbuf_column">0</property>
                            <property name="text_column">1</property>
                          </object>
                        </child>
                      </object>
                      <packing>
                        <property name="expand">True</property>
                        <property name="fill">True</property>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="resize">True</property>
                    <property name="shrink">True</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
          </object>
          <packing>
@@ -304,6 +510,8 @@
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes" context="remotefilesdialog|nameLabel">File name</property>
                <property name="use_underline">True</property>
                <property name="mnemonic_widget">filename</property>
                <property name="xalign">0</property>
              </object>
              <packing>
@@ -324,13 +532,10 @@
              </packing>
            </child>
            <child>
              <object class="GtkBox" id="filename_container">
              <object class="GtkEntry" id="filename">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="orientation">vertical</property>
                <child>
                  <placeholder/>
                </child>
                <property name="can_focus">True</property>
                <property name="activates_default">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
@@ -349,8 +554,36 @@
    <action-widgets>
      <action-widget response="-11">help</action-widget>
      <action-widget response="-6">cancel</action-widget>
      <action-widget response="101">open</action-widget>
      <action-widget response="102">save</action-widget>
      <action-widget response="-5">open</action-widget>
      <action-widget response="-5">save</action-widget>
    </action-widgets>
  </object>
  <object class="GtkMenu" id="service_edit_menu">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <child>
      <object class="GtkMenuItem" id="edit_service">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="remotefilesdialog|edit_service">_Edit service</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="delete_service">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="remotefilesdialog|delete_service">_Delete service</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="change_password">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes" context="remotefilesdialog|change_password">_Change password</property>
        <property name="use_underline">True</property>
      </object>
    </child>
  </object>
</interface>
diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx
index 697ab8a..0eb8b5e 100644
--- a/include/svtools/imagemgr.hxx
+++ b/include/svtools/imagemgr.hxx
@@ -124,6 +124,7 @@
    SVT_DLLPUBLIC static OUString GetFileImageId( const INetURLObject& rURL );
    SVT_DLLPUBLIC static Image  GetFileImage( const INetURLObject& rURL );
    SVT_DLLPUBLIC static Image  GetImageNoDefault(const INetURLObject& rURL, bool bBig = false, Size const & rPreferredSize = Size());
    SVT_DLLPUBLIC static OUString GetFolderImageId( const svtools::VolumeInfo& rInfo );
    SVT_DLLPUBLIC static Image  GetFolderImage( const svtools::VolumeInfo& rInfo );

    SVT_DLLPUBLIC static OUString GetDescription( const INetURLObject& rObject );
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index ff2a674..c6c3b03 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -98,9 +98,12 @@
    rtl::Reference< MatchContext_Impl > pCtx;
    std::unique_ptr<SvtURLBox_Impl> pImpl;
    INetProtocol                    eSmartProtocol;
    bool                            bOnlyDirectories    : 1;
    bool                            bHistoryDisabled    : 1;
    bool                            bNoSelection        : 1;

    Link<weld::ComboBox&, void>     aChangeHdl;
    Link<weld::Widget&, void>       aFocusInHdl;
    Link<weld::Widget&, void>       aFocusOutHdl;

    std::unique_ptr<weld::ComboBox> m_xWidget;
@@ -122,16 +125,21 @@
    void                connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); }
    void                connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; }
    void                trigger_changed() { aChangeHdl.Call(*m_xWidget); }
    void                connect_focus_in(const Link<weld::Widget&, void>& rLink) { aFocusInHdl = rLink; }
    void                connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; }
    void                append_text(const OUString& rStr) { m_xWidget->append_text(rStr); }
    int                 find_text(const OUString& rStr) const { return m_xWidget->find_text(rStr); }
    OUString            get_active_text() const { return m_xWidget->get_active_text(); }
    void                grab_focus() { m_xWidget->grab_focus(); }
    void                set_sensitive(bool bSensitive) { m_xWidget->set_sensitive(bSensitive); }
    void                EnableAutocomplete() { m_xWidget->set_entry_completion(true); }
    void                set_help_id(const OString& rHelpId) { m_xWidget->set_help_id(rHelpId); }
    void                select_entry_region(int nStartPos, int nEndPos) { m_xWidget->select_entry_region(nStartPos, nEndPos); }

    void                EnableAutocomplete(bool bEnable = true) { m_xWidget->set_entry_completion(bEnable); }
    void                SetBaseURL( const OUString& rURL );
    const OUString&     GetBaseURL() const { return aBaseURL; }
    void                SetOnlyDirectories( bool bDir );
    void                SetNoURLSelection( bool bSet );
    void                SetSmartProtocol( INetProtocol eProt );
    INetProtocol        GetSmartProtocol() const { return eSmartProtocol; }
    OUString            GetURL();
diff --git a/include/svtools/strings.hrc b/include/svtools/strings.hrc
index a7ddf80..5b99e51 100644
--- a/include/svtools/strings.hrc
+++ b/include/svtools/strings.hrc
@@ -103,22 +103,11 @@
#define STR_FURTHER_OBJECT                      NC_("STR_FURTHER_OBJECT", "Further objects")
#define STR_UNKNOWN_SOURCE                      NC_("STR_UNKNOWN_SOURCE", "Unknown source")

#define STR_SVT_FILEVIEW_COLUMN_TITLE           NC_("STR_SVT_FILEVIEW_COLUMN_TITLE", "Name")
#define STR_SVT_FILEVIEW_COLUMN_SIZE            NC_("STR_SVT_FILEVIEW_COLUMN_SIZE", "Size")
#define STR_SVT_FILEVIEW_COLUMN_DATE            NC_("STR_SVT_FILEVIEW_COLUMN_DATE", "Date modified")
#define STR_SVT_FILEVIEW_COLUMN_TYPE            NC_("STR_SVT_FILEVIEW_COLUMN_TYPE", "Type")
#define STR_SVT_BYTES                           NC_("STR_SVT_BYTES", "Bytes")
#define STR_SVT_KB                              NC_("STR_SVT_KB", "KB")
#define STR_SVT_MB                              NC_("STR_SVT_MB", "MB")
#define STR_SVT_GB                              NC_("STR_SVT_GB", "GB")

// descriptions of accessible objects
#define STR_SVT_ACC_DESC_TABLISTBOX             NC_("STR_SVT_ACC_DESC_TABLISTBOX", "Row: %1, Column: %2")
#define STR_SVT_ACC_DESC_FILEVIEW               NC_("STR_SVT_ACC_DESC_FILEVIEW", ", Type: %1, URL: %2")
#define STR_SVT_ACC_DESC_FOLDER                 NC_("STR_SVT_ACC_DESC_FOLDER", "Folder")
#define STR_SVT_ACC_DESC_FILE                   NC_("STR_SVT_ACC_DESC_FILE", "File")
#define STR_SVT_ACC_EMPTY_FIELD                 NC_("STR_SVT_ACC_EMPTY_FIELD", "Empty Field")

/*
 * resources for CollatorResource / CollatorResourceData resp.
 */
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index f370d28..847fda6 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -188,6 +188,7 @@
    friend class SvImpLBox;
    friend class IconViewImpl;
    friend class TreeControlPeer;
    friend class SalInstanceIconView;
    friend class SalInstanceTreeView;
    friend class SalInstanceEntryTreeView;

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 300cdf0..21550aa 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>

#include <assert.h>
#include <memory>
#include <vector>

@@ -599,8 +600,8 @@
    {
        insert(-1, rStr, &rId, nullptr, &rImage);
    }
    virtual void insert_separator(int pos) = 0;
    void append_separator() { insert_separator(-1); }
    virtual void insert_separator(int pos, const OUString& rId) = 0;
    void append_separator(const OUString& rId) { insert_separator(-1, rId); }

    virtual int get_count() const = 0;
    virtual void make_sorted() = 0;
@@ -911,16 +912,15 @@

    void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }

    // return true to allow editing, false to disallow
    virtual void connect_editing_started(const Link<const TreeIter&, bool>& rLink)
    {
        m_aEditingStartedHdl = rLink;
    }

    // rStartLink returns true to allow editing, false to disallow
    // rEndLink returns true to accept the edit, false to reject
    virtual void
    connect_editing_done(const Link<const std::pair<const TreeIter&, OUString>&, bool>& rLink)
    connect_editing(const Link<const TreeIter&, bool>& rStartLink,
                    const Link<const std::pair<const TreeIter&, OUString>&, bool>& rEndLink)
    {
        m_aEditingDoneHdl = rLink;
        assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off");
        m_aEditingStartedHdl = rStartLink;
        m_aEditingDoneHdl = rEndLink;
    }

    virtual void start_editing(const weld::TreeIter& rEntry) = 0;
@@ -993,6 +993,77 @@
    using Widget::set_sensitive;
};

class VCL_DLLPUBLIC IconView : virtual public Container
{
private:
    OUString m_sSavedValue;

protected:
    Link<IconView&, void> m_aSelectionChangeHdl;
    Link<IconView&, bool> m_aItemActivatedHdl;

    void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
    bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }

public:
    virtual void insert(int pos, const OUString* pStr, const OUString* pId,
                        const OUString* pIconName, TreeIter* pRet)
        = 0;

    void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
    {
        insert(-1, &rStr, &rId, &rImage, nullptr);
    }

    void connect_selection_changed(const Link<IconView&, void>& rLink)
    {
        m_aSelectionChangeHdl = rLink;
    }

    /* A row is "activated" when the user double clicks a treeview row. It may
       also be emitted when a row is selected and Space or Enter is pressed.

       a return of "true" means the activation has been handled, a "false" propagates
       the activation to the default handler which expands/collapses the row, if possible.
    */
    void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }

    virtual OUString get_selected_id() const = 0;

    virtual void clear() = 0;

    virtual int count_selected_items() const = 0;

    virtual OUString get_selected_text() const = 0;

    //by index
    virtual void select(int pos) = 0;
    virtual void unselect(int pos) = 0;

    //via iter
    virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
    virtual bool get_selected(TreeIter* pIter) const = 0;
    virtual bool get_cursor(TreeIter* pIter) const = 0;
    virtual void set_cursor(const TreeIter& rIter) = 0;
    virtual bool get_iter_first(TreeIter& rIter) const = 0;
    virtual OUString get_id(const TreeIter& rIter) const = 0;
    virtual void scroll_to_item(const TreeIter& rIter) = 0;

    // call func on each selected element until func returns true or we run out of elements
    virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;

    //all of them
    void select_all() { unselect(-1); }
    void unselect_all() { select(-1); }

    // return the number of toplevel nodes
    virtual int n_children() const = 0;

    void save_value() { m_sSavedValue = get_selected_text(); }
    OUString const& get_saved_value() const { return m_sSavedValue; }
    bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
};

class VCL_DLLPUBLIC Button : virtual public Container
{
protected:
@@ -1334,6 +1405,7 @@
public:
    virtual void set_from_icon_name(const OUString& rIconName) = 0;
    virtual void set_image(VirtualDevice* pDevice) = 0;
    virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
};

class VCL_DLLPUBLIC Calendar : virtual public Widget
@@ -1846,6 +1918,7 @@
    virtual bool get_item_sensitive(const OString& rIdent) const = 0;
    virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
    virtual bool get_item_active(const OString& rIdent) const = 0;
    virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
    virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0;

    virtual void insert_separator(int pos, const OUString& rId) = 0;
@@ -1927,6 +2000,8 @@
        = 0;
    virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id, bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<IconView> weld_icon_view(const OString& id, bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Label> weld_label(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<TextView> weld_text_view(const OString& id, bool bTakeOwnership = false)
        = 0;
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 0adda72..f06f746 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -4982,10 +4982,6 @@
fpicker/source/office/fileview.hxx
fpicker/source/office/foldertree.cxx
fpicker/source/office/foldertree.hxx
fpicker/source/office/iconview.cxx
fpicker/source/office/iconview.hxx
fpicker/source/office/iconviewimpl.cxx
fpicker/source/office/iconviewimpl.hxx
fpicker/source/office/fpdialogbase.hxx
fpicker/source/office/fpinteraction.cxx
fpicker/source/office/fpinteraction.hxx
@@ -17253,6 +17249,8 @@
vcl/inc/headless/svpvd.hxx
vcl/inc/helpwin.hxx
vcl/inc/hyperlabel.hxx
vcl/inc/iconview.hxx
vcl/inc/iconviewimpl.hxx
vcl/inc/image.h
vcl/inc/impanmvw.hxx
vcl/inc/impdel.hxx
@@ -17915,6 +17913,8 @@
vcl/source/toolkit/group.cxx
vcl/source/toolkit/morebtn.cxx
vcl/source/treelist/headbar.cxx
vcl/source/treelist/iconview.cxx
vcl/source/treelist/iconviewimpl.cxx
vcl/source/treelist/imap.cxx
vcl/source/treelist/imap2.cxx
vcl/source/treelist/imap3.cxx
diff --git a/solenv/sanitizers/ui/fps.suppr b/solenv/sanitizers/ui/fps.suppr
index 8a80071..25be7fb 100644
--- a/solenv/sanitizers/ui/fps.suppr
+++ b/solenv/sanitizers/ui/fps.suppr
@@ -1,7 +1,6 @@
fpicker/uiconfig/ui/explorerfiledialog.ui://svtlo-SvtURLBox[@id='current_path'] no-labelled-by
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkLabel[@id='shared_label'] orphan-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkComboBox[@id='shared'] no-labelled-by
fpicker/uiconfig/ui/breadcrumb.ui://GtkLabel[@id='label'] orphan-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkCheckButton[@id='link'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkCheckButton[@id='cb_preview'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkDrawingArea[@id='preview'] no-labelled-by
fpicker/uiconfig/ui/remotefilesdialog.ui://GtkLabel[@id='nameLabel'] orphan-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkButton[@id='add'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkButton[@id='del'] button-no-label
fpicker/uiconfig/ui/explorerfiledialog.ui://GtkMenuToolButton[@id='up_btn'] button-no-label
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 0486958..0f68239 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -126,6 +126,8 @@
    svtools::AsynchronLink          aLink;
    OUString const                  aText;
    URLBox*                         pBox;
    bool const                      bOnlyDirectories;
    bool const                      bNoSelection;

    osl::Mutex mutex_;
    bool stopped_;
@@ -482,6 +484,8 @@
    , aLink( LINK( this, MatchContext_Impl, Select_Impl ) )
    , aText( rText )
    , pBox( pBoxP )
    , bOnlyDirectories( pBoxP->bOnlyDirectories )
    , bNoSelection( pBoxP->bNoSelection )
    , stopped_(false)
    , commandId_(0)
{
@@ -587,7 +591,7 @@
        pBox->append_text(completion);
    }

    pBox->EnableAutocomplete();
    pBox->EnableAutocomplete(!bNoSelection);

    // transfer string lists to listbox and forget them
    pBox->pImpl->aURLs = aURLs;
@@ -682,7 +686,10 @@

        try
        {
            uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS );
            ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS;
            if ( bOnlyDirectories )
                eInclude = INCLUDE_FOLDERS_ONLY;
            uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude );

            uno::Reference < XAnyCompareFactory > xCompare;
            uno::Reference < XSortedDynamicResultSetFactory > xSRSFac =
@@ -1240,6 +1247,10 @@
        }
    }

    if ( bOnlyDirectories )
        // don't scan history picklist if only directories are allowed, picklist contains only files
        return;

    bool bFull = false;

    INetURLObject aCurObj;
@@ -1957,9 +1968,11 @@
    OUString aCurText = m_xWidget->get_active_text();
    int nStartPos, nEndPos;
    m_xWidget->get_entry_selection_bounds(nStartPos, nEndPos);
    if (nEndPos != aCurText.getLength())
    if (std::max(nStartPos, nEndPos) != aCurText.getLength())
        return;
    aCurText = aCurText.copy(0, nStartPos);

    auto nLen = std::min(nStartPos, nEndPos);
    aCurText = aCurText.copy( 0, nLen );
    if (!aCurText.isEmpty())
    {
        if (pCtx.is())
@@ -1977,7 +1990,9 @@

URLBox::URLBox(std::unique_ptr<weld::ComboBox> pWidget)
    : eSmartProtocol(INetProtocol::NotValid)
    , bHistoryDisabled(false)
    , bOnlyDirectories( false )
    , bHistoryDisabled( false )
    , bNoSelection( false )
    , m_xWidget(std::move(pWidget))
{
    //don't grow to fix mega-long urls
@@ -2085,11 +2100,11 @@

IMPL_LINK_NOARG(URLBox, FocusInHdl, weld::Widget&, void)
{
    (void)this; // loplugin:staticmethod
#ifndef UNX
    // pb: don't select automatically on unix #93251#
    m_xWidget->select_entry_region(0, -1);
#endif
    aFocusInHdl.Call(*m_xWidget);
}

IMPL_LINK_NOARG(URLBox, FocusOutHdl, weld::Widget&, void)
@@ -2103,6 +2118,18 @@
    aFocusOutHdl.Call(*m_xWidget);
}

void URLBox::SetOnlyDirectories( bool bDir )
{
    bOnlyDirectories = bDir;
    if ( bOnlyDirectories )
        m_xWidget->clear();
}

void URLBox::SetNoURLSelection( bool bSet )
{
    bNoSelection = bSet;
}

OUString URLBox::GetURL()
{
    // wait for end of autocompletion
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index bd16300..32edd99 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -788,6 +788,23 @@
    return GetImageFromList_Impl(nImage, bBig, rPreferredSize);
}

OUString SvFileInformationManager::GetFolderImageId( const svtools::VolumeInfo& rInfo )
{
    SvImageId nImage = SvImageId::Folder;
    DBG_ASSERT( nImage != SvImageId::NONE, "invalid ImageId" );

    if ( rInfo.m_bIsRemote )
        nImage = SvImageId::NetworkDevice;
    else if ( rInfo.m_bIsCompactDisc )
        nImage = SvImageId::CDRomDevice;
    else if ( rInfo.m_bIsRemoveable || rInfo.m_bIsFloppy )
        nImage = SvImageId::RemoveableDevice;
    else if ( rInfo.m_bIsVolume )
        nImage = SvImageId::FixedDevice;

    return GetImageNameFromList_Impl(nImage, false/*bBig*/);
}

Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo )
{
    SvImageId nImage = SvImageId::Folder;
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index c186898..3cb8099 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -451,7 +451,7 @@
        rBox.append_text(rItem);
    for(const auto& rItem : rNext)
        rBox.append_text(rItem);
    rBox.append_separator();
    rBox.append_separator("");
    //now insert all strings sorted
    const auto nStartPos = rBox.get_count();

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 7cb6c27..00b98cd 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -243,6 +243,8 @@
    vcl/source/outdev/nativecontrols \
    vcl/source/outdev/map \
    vcl/source/treelist/headbar \
    vcl/source/treelist/iconview \
    vcl/source/treelist/iconviewimpl \
    vcl/source/treelist/imap \
    vcl/source/treelist/imap2 \
    vcl/source/treelist/imap3 \
diff --git a/fpicker/source/office/iconview.hxx b/vcl/inc/iconview.hxx
similarity index 97%
rename from fpicker/source/office/iconview.hxx
rename to vcl/inc/iconview.hxx
index 17a9103..750f7ec 100644
--- a/fpicker/source/office/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -31,8 +31,6 @@

    virtual tools::Rectangle GetFocusRect( SvTreeListEntry*, long nEntryPos ) override;

    void ClearAll();

    void PaintEntry( SvTreeListEntry&, long nX, long nY, vcl::RenderContext& rRenderContext);
};

diff --git a/fpicker/source/office/iconviewimpl.hxx b/vcl/inc/iconviewimpl.hxx
similarity index 100%
rename from fpicker/source/office/iconviewimpl.hxx
rename to vcl/inc/iconviewimpl.hxx
diff --git a/vcl/inc/treeglue.hxx b/vcl/inc/treeglue.hxx
index 05ebee5..d67ce09 100644
--- a/vcl/inc/treeglue.hxx
+++ b/vcl/inc/treeglue.hxx
@@ -17,16 +17,40 @@

class LclHeaderTabListBox : public SvHeaderTabListBox
{
private:
    Link<SvTreeListEntry*, bool> m_aEditingEntryHdl;
    Link<std::pair<SvTreeListEntry*, OUString>, bool> m_aEditedEntryHdl;

public:
    LclHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle)
        : SvHeaderTabListBox(pParent, nWinStyle)
    {
    }

    void SetEditingEntryHdl(const Link<SvTreeListEntry*, bool>& rLink)
    {
        m_aEditingEntryHdl = rLink;
    }

    void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink)
    {
        m_aEditedEntryHdl = rLink;
    }

    virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
    {
        return GetDragDropMode();
    }

    virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
    {
        return m_aEditingEntryHdl.Call(pEntry);
    }

    virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override
    {
        return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText));
    }
};

class LclTabListBox : public SvTabListBox
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index ef81c7f..6b4dcd0 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <officecfg/Office/Common.hxx>
#include <iconview.hxx>
#include <salframe.hxx>
#include <salinst.hxx>
#include <salvd.hxx>
@@ -914,6 +915,10 @@
        auto nInsertPos = pos == -1 ? MENU_APPEND : pos;
        m_xMenu->InsertSeparator(rId.toUtf8(), nInsertPos);
    }
    PopupMenu* getMenu() const
    {
        return m_xMenu.get();
    }
    virtual ~SalInstanceMenu() override
    {
        m_xMenu->SetSelectHdl(Link<::Menu*, bool>());
@@ -933,6 +938,7 @@
private:
    VclPtr<ToolBox> m_xToolBox;
    std::map<sal_uInt16, VclPtr<vcl::Window>> m_aFloats;
    std::map<sal_uInt16, VclPtr<PopupMenu>> m_aMenus;

    DECL_LINK(ClickHdl, ToolBox*, void);
    DECL_LINK(DropdownClick, ToolBox*, void);
@@ -963,12 +969,24 @@
        if (m_xToolBox->GetItemBits(nItemId) & ToolBoxItemBits::DROPDOWN)
        {
            auto pFloat = m_aFloats[nItemId];
            if (!pFloat)
                return;
            if (bActive)
                vcl::Window::GetDockingManager()->StartPopupMode(m_xToolBox, pFloat, FloatWinPopupFlags::GrabFocus);
            else
                vcl::Window::GetDockingManager()->EndPopupMode(pFloat);
            if (pFloat)
            {
                if (bActive)
                    vcl::Window::GetDockingManager()->StartPopupMode(m_xToolBox, pFloat, FloatWinPopupFlags::GrabFocus);
                else
                    vcl::Window::GetDockingManager()->EndPopupMode(pFloat);
            }
            auto pPopup = m_aMenus[nItemId];
            if (pPopup)
            {
                if (bActive)
                {
                    tools::Rectangle aRect = m_xToolBox->GetItemRect(nItemId);
                    pPopup->Execute(m_xToolBox, aRect, PopupMenuFlags::ExecuteDown);
                }
                else
                    pPopup->EndExecute();
            }
        }
    }

@@ -985,7 +1003,20 @@
        if (pFloat)
            pFloat->EnableDocking();

        m_aFloats[m_xToolBox->GetItemId(OUString::fromUtf8(rIdent))] = pFloat;
        sal_uInt16 nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent));
        m_aFloats[nId] = pFloat;
        m_aMenus[nId] = nullptr;
    }

    virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override
    {
        SalInstanceMenu* pInstanceMenu = dynamic_cast<SalInstanceMenu*>(pMenu);

        PopupMenu* pPopup = pInstanceMenu? pInstanceMenu->getMenu() : nullptr;

        sal_uInt16 nId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent));
        m_aMenus[nId] = pPopup;
        m_aFloats[nId] = nullptr;
    }

    virtual void insert_separator(int pos, const OUString& /*rId*/) override
@@ -2961,6 +2992,11 @@
    {
        m_xImage->SetImage(createImage(*pDevice));
    }

    virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
    {
        m_xImage->SetImage(::Image(rImage));
    }
};

class SalInstanceCalendar : public SalInstanceWidget, public virtual weld::Calendar
@@ -3330,6 +3366,8 @@
                pHeaderBar->SetEndDragHdl(LINK(this, SalInstanceTreeView, EndDragHdl));
                pHeaderBar->SetSelectHdl(LINK(this, SalInstanceTreeView, HeaderBarClickedHdl));
            }
            pHeaderBox->SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
            pHeaderBox->SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
        }
        else
        {
@@ -3884,16 +3922,11 @@
        return ::get_text_emphasis(pEntry, col);
    }

    virtual void connect_editing_started(const Link<const weld::TreeIter&, bool>& rLink) override
    virtual void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
                                const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rEndLink) override
    {
        m_xTreeView->EnableInplaceEditing(true);
        weld::TreeView::connect_editing_started(rLink);
    }

    virtual void connect_editing_done(const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rLink) override
    {
        m_xTreeView->EnableInplaceEditing(true);
        weld::TreeView::connect_editing_done(rLink);
        m_xTreeView->EnableInplaceEditing(rStartLink.IsSet() || rEndLink.IsSet());
        weld::TreeView::connect_editing(rStartLink, rEndLink);
    }

    virtual void start_editing(const weld::TreeIter& rIter) override
@@ -4633,6 +4666,242 @@
    return signal_editing_done(std::pair<const weld::TreeIter&, OUString>(SalInstanceTreeIter(rIterString.first), rIterString.second));
}

class SalInstanceIconView : public SalInstanceContainer, public virtual weld::IconView
{
private:
    // owner for UserData
    std::vector<std::unique_ptr<OUString>> m_aUserData;
    VclPtr<::IconView> m_xIconView;

    DECL_LINK(SelectHdl, SvTreeListBox*, void);
    DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
    DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);

public:
    SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
        : SalInstanceContainer(pIconView, pBuilder, bTakeOwnership)
        , m_xIconView(pIconView)
    {
        m_xIconView->SetSelectHdl(LINK(this, SalInstanceIconView, SelectHdl));
        m_xIconView->SetDeselectHdl(LINK(this, SalInstanceIconView, DeSelectHdl));
        m_xIconView->SetDoubleClickHdl(LINK(this, SalInstanceIconView, DoubleClickHdl));
    }

    virtual void freeze() override
    {
        SalInstanceWidget::freeze();
        m_xIconView->SetUpdateMode(false);
    }

    virtual void thaw() override
    {
        m_xIconView->SetUpdateMode(true);
        SalInstanceWidget::thaw();
    }

    virtual void insert(int pos, const OUString* pStr, const OUString* pId,
                        const OUString* pIconName, weld::TreeIter* pRet) override
    {
        disable_notify_events();
        auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
        void* pUserData;
        if (pId)
        {
            m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
            pUserData = m_aUserData.back().get();
        }
        else
            pUserData = nullptr;

        SvTreeListEntry* pEntry = new SvTreeListEntry;
        if (pIconName)
        {
            Image aImage(createImage(*pIconName));
            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
        }
        else
        {
            Image aDummy;
            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
        }
        if (pStr)
            pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
        pEntry->SetUserData(pUserData);
        m_xIconView->Insert(pEntry, nullptr, nInsertPos);

        if (pRet)
        {
            SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
            pVclRetIter->iter = pEntry;
        }

        enable_notify_events();
    }

    virtual OUString get_selected_id() const override
    {
        assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
        if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
        {
            if (const OUString* pStr = static_cast<const OUString*>(pEntry->GetUserData()))
                return *pStr;
        }
        return OUString();
    }

    virtual OUString get_selected_text() const override
    {
        assert(m_xIconView->IsUpdateMode() && "don't request selection when frozen");
        if (SvTreeListEntry* pEntry = m_xIconView->FirstSelected())
            return m_xIconView->GetEntryText(pEntry);
        return OUString();
    }

    virtual int count_selected_items() const override
    {
        return m_xIconView->GetSelectionCount();
    }

    virtual void select(int pos) override
    {
        assert(m_xIconView->IsUpdateMode() && "don't select when frozen");
        disable_notify_events();
        if (pos == -1 || (pos == 0 && n_children() == 0))
            m_xIconView->SelectAll(false);
        else
        {
            SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
            m_xIconView->Select(pEntry, true);
            m_xIconView->MakeVisible(pEntry);
        }
        enable_notify_events();
    }

    virtual void unselect(int pos) override
    {
        assert(m_xIconView->IsUpdateMode() && "don't select when frozen");
        disable_notify_events();
        if (pos == -1)
            m_xIconView->SelectAll(true);
        else
        {
            SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos);
            m_xIconView->Select(pEntry, false);
        }
        enable_notify_events();
    }

    virtual int n_children() const override
    {
        return m_xIconView->GetModel()->GetChildList(nullptr).size();
    }

    virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig) const override
    {
        return std::unique_ptr<weld::TreeIter>(new SalInstanceTreeIter(static_cast<const SalInstanceTreeIter*>(pOrig)));
    }

    virtual bool get_selected(weld::TreeIter* pIter) const override
    {
        SvTreeListEntry* pEntry = m_xIconView->FirstSelected();
        auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
        if (pVclIter)
            pVclIter->iter = pEntry;
        return pEntry != nullptr;
    }

    virtual bool get_cursor(weld::TreeIter* pIter) const override
    {
        SvTreeListEntry* pEntry = m_xIconView->GetCurEntry();
        auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
        if (pVclIter)
            pVclIter->iter = pEntry;
        return pEntry != nullptr;
    }

    virtual void set_cursor(const weld::TreeIter& rIter) override
    {
        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
        disable_notify_events();
        m_xIconView->SetCurEntry(rVclIter.iter);
        enable_notify_events();
    }

    virtual bool get_iter_first(weld::TreeIter& rIter) const override
    {
        SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
        rVclIter.iter = m_xIconView->GetEntry(0);
        return rVclIter.iter != nullptr;
    }

    virtual void scroll_to_item(const weld::TreeIter& rIter) override
    {
        assert(m_xIconView->IsUpdateMode() && "don't select when frozen");
        disable_notify_events();
        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
        m_xIconView->MakeVisible(rVclIter.iter);
        enable_notify_events();
    }

    virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
    {
        SalInstanceTreeIter aVclIter(m_xIconView->FirstSelected());
        while (aVclIter.iter)
        {
            if (func(aVclIter))
                return;
            aVclIter.iter = m_xIconView->NextSelected(aVclIter.iter);
        }
    }

    virtual OUString get_id(const weld::TreeIter& rIter) const override
    {
        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
        const OUString* pStr = static_cast<const OUString*>(rVclIter.iter->GetUserData());
        if (pStr)
            return *pStr;
        return OUString();
    }

    virtual void clear() override
    {
        disable_notify_events();
        m_xIconView->Clear();
        m_aUserData.clear();
        enable_notify_events();
    }

    virtual ~SalInstanceIconView() override
    {
        m_xIconView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
        m_xIconView->SetSelectHdl(Link<SvTreeListBox*, void>());
        m_xIconView->SetDeselectHdl(Link<SvTreeListBox*, void>());
    }
};

IMPL_LINK_NOARG(SalInstanceIconView, SelectHdl, SvTreeListBox*, void)
{
    if (notify_events_disabled())
        return;
    signal_selection_changed();
}

IMPL_LINK_NOARG(SalInstanceIconView, DeSelectHdl, SvTreeListBox*, void)
{
    if (notify_events_disabled())
        return;
    if (m_xIconView->GetSelectionMode() == SelectionMode::Single)
        return;
    signal_selection_changed();
}

IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool)
{
    if (notify_events_disabled())
        return false;
    return !signal_item_activated();
}

class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
{
private:
@@ -5472,7 +5741,7 @@
        }
    }

    virtual void insert_separator(int pos) override
    virtual void insert_separator(int pos, const OUString& /*rId*/) override
    {
        auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos;
        m_xComboBox->AddSeparator(nInsertPos - 1);
@@ -5588,7 +5857,7 @@
        }
    }

    virtual void insert_separator(int pos) override
    virtual void insert_separator(int pos, const OUString& /*rId*/) override
    {
        auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos;
        m_xComboBox->AddSeparator(nInsertPos - 1);
@@ -5667,7 +5936,7 @@
        rEntry.AddEventListener(LINK(this, SalInstanceEntryTreeView, KeyPressListener));
    }

    virtual void insert_separator(int /*pos*/) override
    virtual void insert_separator(int /*pos*/, const OUString& /*rId*/) override
    {
        assert(false);
    }
@@ -6036,6 +6305,12 @@
        return pTreeView ? std::make_unique<SalInstanceTreeView>(pTreeView, this, bTakeOwnership) : nullptr;
    }

    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id, bool bTakeOwnership) override
    {
        IconView* pIconView = m_xBuilder->get<IconView>(id);
        return pIconView ? std::make_unique<SalInstanceIconView>(pIconView, this, bTakeOwnership) : nullptr;
    }

    virtual std::unique_ptr<weld::Label> weld_label(const OString &id, bool bTakeOwnership) override
    {
        Control* pLabel = m_xBuilder->get<Control>(id);
diff --git a/fpicker/source/office/iconview.cxx b/vcl/source/treelist/iconview.cxx
similarity index 95%
rename from fpicker/source/office/iconview.cxx
rename to vcl/source/treelist/iconview.cxx
index b6571b7..5c2e5b2 100644
--- a/fpicker/source/office/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -19,12 +19,11 @@

#include <vcl/treelistentry.hxx>
#include <vcl/viewdataentry.hxx>
#include "fileview.hxx"
#include "iconview.hxx"
#include "iconviewimpl.hxx"
#include <iconview.hxx>
#include <iconviewimpl.hxx>

IconView::IconView( vcl::Window* pParent, WinBits nBits )
: SvTreeListBox( pParent, nBits )
    : SvTreeListBox( pParent, nBits )
{
    nColumns = 1;
    mbCenterAndClipText = true;
@@ -74,14 +73,6 @@
    return aRect;
}

void IconView::ClearAll()
{
    for ( sal_uLong i = 0; i < GetEntryCount(); ++i )
        delete static_cast<SvtContentEntry*>(GetEntry(i)->GetUserData());

    Clear();
}

void IconView::PaintEntry(SvTreeListEntry& rEntry, long nX, long nY,
                            vcl::RenderContext& rRenderContext)
{
diff --git a/fpicker/source/office/iconviewimpl.cxx b/vcl/source/treelist/iconviewimpl.cxx
similarity index 99%
rename from fpicker/source/office/iconviewimpl.cxx
rename to vcl/source/treelist/iconviewimpl.cxx
index ff3bdfc..9014220 100644
--- a/fpicker/source/office/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -19,8 +19,8 @@

#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
#include "iconview.hxx"
#include "iconviewimpl.hxx"
#include <iconview.hxx>
#include <iconviewimpl.hxx>

IconViewImpl::IconViewImpl( SvTreeListBox* pTreeListBox, SvTreeList* pTreeList, WinBits nWinStyle )
: SvImpLBox( pTreeListBox, pTreeList, nWinStyle )
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f6b38a5..67f9616 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -48,6 +48,7 @@
#include <vcl/slider.hxx>
#include <vcl/weld.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <iconview.hxx>
#include <svdata.hxx>
#include <bitmaps.hlst>
#include <messagedialog.hxx>
@@ -2040,6 +2041,29 @@
            xWindow = xBox;
        }
    }
    else if (name == "GtkIconView")
    {
        assert(rMap.find(OString("model")) != rMap.end() && "GtkIconView must have a model");

        //window we want to apply the packing props for this GtkIconView to
        VclPtr<vcl::Window> xWindowForPackingProps;
        extractModel(id, rMap);
        WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_HIDESELECTION;
        //IconView manages its own scrolling,
        vcl::Window *pRealParent = prepareWidgetOwnScrolling(pParent, nWinStyle);
        if (pRealParent != pParent)
            nWinStyle |= WB_BORDER;

        VclPtr<IconView> xBox = VclPtr<IconView>::Create(pRealParent, nWinStyle);
        xWindowForPackingProps = xBox;

        xWindow = xBox;
        xBox->SetNoAutoCurEntry(true);
        xBox->SetQuickSearch(true);

        if (pRealParent != pParent)
            cleanupWidgetOwnScrolling(pParent, xWindowForPackingProps, rMap);
    }
    else if (name == "GtkTreeView")
    {
        if (!m_bLegacy)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9cc600d..b72495c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1907,6 +1907,21 @@

    bool signal_button(GdkEventButton* pEvent)
    {
        Point aPos(pEvent->x, pEvent->y);
        if (SwapForRTL())
            aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());

        if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
        {
            //if handled for context menu, stop processing
            CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true);
            if (signal_popup_menu(aCEvt))
                return true;
        }

        if (!m_aMousePressHdl.IsSet() && !m_aMouseReleaseHdl.IsSet())
            return false;

        SalEvent nEventType = SalEvent::NONE;
        switch (pEvent->type)
        {
@@ -1954,19 +1969,6 @@
                return false;
        }

        Point aPos(pEvent->x, pEvent->y);

        if (SwapForRTL())
            aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());

        if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
        {
            //if handled for context menu, stop processing
            CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true);
            if (signal_popup_menu(aCEvt))
                return true;
        }

        sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
        sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
        MouseEvent aMEvt(aPos, m_nLastMouseClicks, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
@@ -3111,6 +3113,11 @@
        m_aMap.clear();
    }

    GtkMenu* getMenu() const
    {
        return m_pMenu;
    }

    virtual ~MenuHelper()
    {
        for (auto& a : m_aMap)
@@ -3305,12 +3312,13 @@

    int getButtonPriority(const OString &rType)
    {
        static const size_t N_TYPES = 6;
        static const size_t N_TYPES = 7;
        static const ButtonOrder aDiscardCancelSave[N_TYPES] =
        {
            { "/discard", 0 },
            { "/cancel", 1 },
            { "/no", 2 },
            { "/open", 3 },
            { "/save", 3 },
            { "/yes", 3 },
            { "/ok", 3 }
@@ -3318,6 +3326,7 @@

        static const ButtonOrder aSaveDiscardCancel[N_TYPES] =
        {
            { "/open", 0 },
            { "/save", 0 },
            { "/yes", 0 },
            { "/ok", 0 },
@@ -6555,6 +6564,8 @@
        }
    }

    void set_menu(weld::Menu* pMenu);

    virtual ~GtkInstanceMenuButton() override
    {
        if (m_pMenuHack)
@@ -6785,6 +6796,14 @@
    }
};

void GtkInstanceMenuButton::set_menu(weld::Menu* pMenu)
{
    GtkInstanceMenu* pPopoverWidget = dynamic_cast<GtkInstanceMenu*>(pMenu);
    m_pPopover = nullptr;
    GtkWidget* pMenuWidget = GTK_WIDGET(pPopoverWidget ? pPopoverWidget->getMenu() : nullptr);
    gtk_menu_button_set_popup(m_pMenuButton, pMenuWidget);
}

class GtkInstanceToolbar : public GtkInstanceWidget, public virtual weld::Toolbar
{
private:
@@ -6916,6 +6935,11 @@
        m_aMenuButtonMap[rIdent]->set_popover(pPopover);
    }

    virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override
    {
        m_aMenuButtonMap[rIdent]->set_menu(pMenu);
    }

    virtual ~GtkInstanceToolbar() override
    {
        for (auto& a : m_aMap)
@@ -7136,13 +7160,26 @@
    virtual void set_image(VirtualDevice* pDevice) override
    {
        if (gtk_check_version(3, 20, 0) == nullptr)
            gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
        else
        {
            GdkPixbuf* pixbuf = getPixbuf(*pDevice);
            gtk_image_set_from_pixbuf(m_pImage, pixbuf);
            g_object_unref(pixbuf);
            if (pDevice)
                gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
            else
                gtk_image_set_from_surface(m_pImage, nullptr);
            return;
        }

        GdkPixbuf* pixbuf = pDevice ? getPixbuf(*pDevice) : nullptr;
        gtk_image_set_from_pixbuf(m_pImage, pixbuf);
        if (pixbuf)
            g_object_unref(pixbuf);
    }

    virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
    {
        GdkPixbuf* pixbuf = getPixbuf(rImage);
        gtk_image_set_from_pixbuf(m_pImage, pixbuf);
        if (pixbuf)
            g_object_unref(pixbuf);
    }
};

@@ -8032,6 +8069,15 @@
        pThis->signal_cell_edited(pCell, path, pNewText);
    }

    static void restoreNonEditable(GObject* pCell)
    {
        if (g_object_get_data(pCell, "g-lo-RestoreNonEditable"))
        {
            g_object_set(pCell, "editable", false, "editable-set", false, nullptr);
            g_object_set_data(pCell, "g-lo-RestoreNonEditable", reinterpret_cast<gpointer>(false));
        }
    }

    void signal_cell_edited(GtkCellRendererText* pCell, const gchar *path, const gchar* pNewText)
    {
        GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
@@ -8047,6 +8093,13 @@
            void* pData = g_object_get_data(G_OBJECT(pCell), "g-lo-CellIndex");
            set(aGtkIter.iter, reinterpret_cast<sal_IntPtr>(pData), sText);
        }

        restoreNonEditable(G_OBJECT(pCell));
    }

    static void signalCellEditingCanceled(GtkCellRenderer* pCell, gpointer /*widget*/)
    {
        restoreNonEditable(G_OBJECT(pCell));
    }

    void signal_column_clicked(GtkTreeViewColumn* pClickedColumn)
@@ -8202,6 +8255,7 @@
                    m_aWeightMap[nIndex] = -1;
                    m_aSensitiveMap[nIndex] = -1;
                    g_signal_connect(G_OBJECT(pCellRenderer), "editing-started", G_CALLBACK(signalCellEditingStarted), this);
                    g_signal_connect(G_OBJECT(pCellRenderer), "editing-canceled", G_CALLBACK(signalCellEditingCanceled), this);
                    g_signal_connect(G_OBJECT(pCellRenderer), "edited", G_CALLBACK(signalCellEdited), this);
                }
                else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer))
@@ -9228,7 +9282,6 @@
        if (!gtk_tree_view_row_expanded(m_pTreeView, path))
            gtk_tree_view_expand_to_path(m_pTreeView, path);
        gtk_tree_path_free(path);

    }

    virtual void collapse_row(const weld::TreeIter& rIter) override
@@ -9525,6 +9578,27 @@
        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
        GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));

        // allow editing of cells which are not usually editable, so we can have double click
        // do its usual row-activate but if we explicitly want to edit (remote files dialog)
        // we can still do that
        GList *pRenderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(pColumn));
        for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer))
        {
            GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data);
            if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
            {
                gboolean is_editable(false);
                g_object_get(pCellRenderer, "editable", &is_editable, nullptr);
                if (!is_editable)
                {
                    g_object_set(pCellRenderer, "editable", true, "editable-set", true, nullptr);
                    g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-RestoreNonEditable", reinterpret_cast<gpointer>(true));
                    break;
                }
            }
        }
        g_list_free(pRenderers);

        gtk_tree_view_set_cursor(m_pTreeView, path, pColumn, true);

        gtk_tree_path_free(path);
@@ -9614,6 +9688,373 @@
    end_editing();
}

class GtkInstanceIconView : public GtkInstanceContainer, public virtual weld::IconView
{
private:
    GtkIconView* m_pIconView;
    GtkTreeStore* m_pTreeStore;
    std::vector<int> m_aViewColToModelCol;
    std::vector<int> m_aModelColToViewCol;
    gint m_nTextCol;
    gint m_nImageCol;
    gint m_nIdCol;
    gulong m_nSelectionChangedSignalId;
    gulong m_nItemActivatedSignalId;
    ImplSVEvent* m_pSelectionChangeEvent;

    DECL_LINK(async_signal_selection_changed, void*, void);

    void launch_signal_selection_changed()
    {
        //tdf#117991 selection change is sent before the focus change, and focus change
        //is what will cause a spinbutton that currently has the focus to set its contents
        //as the spin button value. So any LibreOffice callbacks on
        //signal-change would happen before the spinbutton value-change occurs.
        //To avoid this, send the signal-change to LibreOffice to occur after focus-change
        //has been processed
        if (m_pSelectionChangeEvent)
            Application::RemoveUserEvent(m_pSelectionChangeEvent);
        m_pSelectionChangeEvent = Application::PostUserEvent(LINK(this, GtkInstanceIconView, async_signal_selection_changed));
    }

    static void signalSelectionChanged(GtkIconView*, gpointer widget)
    {
        GtkInstanceIconView* pThis = static_cast<GtkInstanceIconView*>(widget);
        pThis->launch_signal_selection_changed();
    }

    void handle_item_activated()
    {
        if (signal_item_activated())
            return;
    }

    static void signalItemActivated(GtkIconView*, GtkTreePath*, gpointer widget)
    {
        GtkInstanceIconView* pThis = static_cast<GtkInstanceIconView*>(widget);
        SolarMutexGuard aGuard;
        pThis->handle_item_activated();
    }

    void insert_item(GtkTreeIter& iter, int pos, const OUString* pId, const OUString* pText, const OUString* pIconName)
    {
        gtk_tree_store_insert_with_values(m_pTreeStore, &iter, nullptr, pos,
                                          m_nTextCol, !pText ? nullptr : OUStringToOString(*pText, RTL_TEXTENCODING_UTF8).getStr(),
                                          m_nIdCol, !pId ? nullptr : OUStringToOString(*pId, RTL_TEXTENCODING_UTF8).getStr(),
                                          -1);
        if (pIconName)
        {
            GdkPixbuf* pixbuf = getPixbuf(*pIconName);
            gtk_tree_store_set(m_pTreeStore, &iter, m_nImageCol, pixbuf, -1);
            if (pixbuf)
                g_object_unref(pixbuf);
        }
    }

    OUString get(const GtkTreeIter& iter, int col) const
    {
        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
        gchar* pStr;
        gtk_tree_model_get(pModel, const_cast<GtkTreeIter*>(&iter), col, &pStr, -1);
        OUString sRet(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
        g_free(pStr);
        return sRet;
    }

    bool get_selected_iterator(GtkTreeIter* pIter) const
    {
        assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen");
        bool bRet = false;
        {
            GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore);
            GList* pList = gtk_icon_view_get_selected_items(m_pIconView);
            for (GList* pItem = g_list_first(pList); pItem; pItem = g_list_next(pItem))
            {
                if (pIter)
                {
                    GtkTreePath* path = static_cast<GtkTreePath*>(pItem->data);
                    gtk_tree_model_get_iter(pModel, pIter, path);
                }
                bRet = true;
                break;
            }
            g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
        }
        return bRet;
    }

public:
    GtkInstanceIconView(GtkIconView* pIconView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
        : GtkInstanceContainer(GTK_CONTAINER(pIconView), pBuilder, bTakeOwnership)
        , m_pIconView(pIconView)
        , m_pTreeStore(GTK_TREE_STORE(gtk_icon_view_get_model(m_pIconView)))
        , m_nTextCol(gtk_icon_view_get_text_column(m_pIconView))
        , m_nImageCol(gtk_icon_view_get_pixbuf_column(m_pIconView))
        , m_nSelectionChangedSignalId(g_signal_connect(pIconView, "selection-changed",
                                      G_CALLBACK(signalSelectionChanged), this))
        , m_nItemActivatedSignalId(g_signal_connect(pIconView, "item-activated", G_CALLBACK(signalItemActivated), this))
        , m_pSelectionChangeEvent(nullptr)
    {
        m_nIdCol = m_nTextCol + 1;
    }

    virtual void insert(int pos, const OUString* pText, const OUString* pId, const OUString* pIconName, weld::TreeIter* pRet) override
    {
        disable_notify_events();
        GtkTreeIter iter;
        insert_item(iter, pos, pId, pText, pIconName);
        if (pRet)
        {
            GtkInstanceTreeIter* pGtkRetIter = static_cast<GtkInstanceTreeIter*>(pRet);
            pGtkRetIter->iter = iter;
        }
        enable_notify_events();
    }

    virtual OUString get_selected_id() const override
    {
        assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen");
        GtkTreeIter iter;
        if (get_selected_iterator(&iter))
            return get(iter, m_nIdCol);
        return OUString();
    }

    virtual void clear() override
    {
        disable_notify_events();
        gtk_tree_store_clear(m_pTreeStore);
        enable_notify_events();
    }

    virtual void freeze() override
    {
        disable_notify_events();
        g_object_ref(m_pTreeStore);
        GtkInstanceContainer::freeze();
        gtk_icon_view_set_model(m_pIconView, nullptr);
        enable_notify_events();
    }

    virtual void thaw() override
    {
        disable_notify_events();
        gtk_icon_view_set_model(m_pIconView, GTK_TREE_MODEL(m_pTreeStore));
        GtkInstanceContainer::thaw();
        g_object_unref(m_pTreeStore);
        enable_notify_events();
    }

    virtual Size get_size_request() const override
    {
        GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
        if (GTK_IS_SCROLLED_WINDOW(pParent))
        {
            return Size(gtk_scrolled_window_get_min_content_width(GTK_SCROLLED_WINDOW(pParent)),
                        gtk_scrolled_window_get_min_content_height(GTK_SCROLLED_WINDOW(pParent)));
        }
        int nWidth, nHeight;
        gtk_widget_get_size_request(m_pWidget, &nWidth, &nHeight);
        return Size(nWidth, nHeight);
    }

    virtual Size get_preferred_size() const override
    {
        Size aRet(-1, -1);
        GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
        if (GTK_IS_SCROLLED_WINDOW(pParent))
        {
            aRet = Size(gtk_scrolled_window_get_min_content_width(GTK_SCROLLED_WINDOW(pParent)),
                        gtk_scrolled_window_get_min_content_height(GTK_SCROLLED_WINDOW(pParent)));
        }
        GtkRequisition size;
        gtk_widget_get_preferred_size(m_pWidget, nullptr, &size);
        if (aRet.Width() == -1)
            aRet.setWidth(size.width);
        if (aRet.Height() == -1)
            aRet.setHeight(size.height);
        return aRet;
    }

    virtual void show() override
    {
        GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
        if (GTK_IS_SCROLLED_WINDOW(pParent))
            gtk_widget_show(pParent);
        gtk_widget_show(m_pWidget);
    }

    virtual void hide() override
    {
        GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
        if (GTK_IS_SCROLLED_WINDOW(pParent))
            gtk_widget_hide(pParent);
        gtk_widget_hide(m_pWidget);
    }

    virtual OUString get_selected_text() const override
    {
        assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen");
        GtkTreeIter iter;
        if (get_selected_iterator(&iter))
            return get(iter, m_nTextCol);
        return OUString();
    }

    virtual int count_selected_items() const override
    {
        GList* pList = gtk_icon_view_get_selected_items(m_pIconView);
        int nRet = g_list_length(pList);
        g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
        return nRet;
    }

    virtual void select(int pos) override
    {
        assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen");
        disable_notify_events();
        if (pos == -1 || (pos == 0 && n_children() == 0))
        {
            gtk_icon_view_unselect_all(m_pIconView);
        }
        else
        {
            GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
            gtk_icon_view_select_path(m_pIconView, path);
            gtk_icon_view_scroll_to_path(m_pIconView, path, false, 0, 0);
            gtk_tree_path_free(path);
        }
        enable_notify_events();
    }

    virtual void unselect(int pos) override
    {
        assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen");
        disable_notify_events();
        if (pos == -1 || (pos == 0 && n_children() == 0))
        {
            gtk_icon_view_select_all(m_pIconView);
        }
        else
        {
            GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
            gtk_icon_view_select_path(m_pIconView, path);
            gtk_tree_path_free(path);
        }
        enable_notify_events();
    }

    virtual bool get_selected(weld::TreeIter* pIter) const override
    {
        GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter);
        return get_selected_iterator(pGtkIter ? &pGtkIter->iter : nullptr);
    }

    virtual bool get_cursor(weld::TreeIter* pIter) const override
    {
        GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter);
        GtkTreePath* path;
        gtk_icon_view_get_cursor(m_pIconView, &path, nullptr);
        if (pGtkIter && path)
        {
            GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
            gtk_tree_model_get_iter(pModel, &pGtkIter->iter, path);
        }
        return path != nullptr;
    }

    virtual void set_cursor(const weld::TreeIter& rIter) override
    {
        const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
        GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
        gtk_icon_view_set_cursor(m_pIconView, path, nullptr, false);
        gtk_tree_path_free(path);
    }

    virtual bool get_iter_first(weld::TreeIter& rIter) const override
    {
        GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
        return gtk_tree_model_get_iter_first(pModel, &rGtkIter.iter);
    }

    virtual void scroll_to_item(const weld::TreeIter& rIter) override
    {
        assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen");
        disable_notify_events();
        const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
        GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
        gtk_icon_view_scroll_to_path(m_pIconView, path, false, 0, 0);
        gtk_tree_path_free(path);
        enable_notify_events();
    }

    virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig) const override
    {
        return std::unique_ptr<weld::TreeIter>(new GtkInstanceTreeIter(static_cast<const GtkInstanceTreeIter*>(pOrig)));
    }

    virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
    {
        GtkInstanceTreeIter aGtkIter(nullptr);

        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
        GList* pList = gtk_icon_view_get_selected_items(m_pIconView);
        for (GList* pItem = g_list_first(pList); pItem; pItem = g_list_next(pItem))
        {
            GtkTreePath* path = static_cast<GtkTreePath*>(pItem->data);
            gtk_tree_model_get_iter(pModel, &aGtkIter.iter, path);
            if (func(aGtkIter))
                break;
        }
        g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
    }

    virtual int n_children() const override
    {
        return gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_pTreeStore), nullptr);
    }

    virtual OUString get_id(const weld::TreeIter& rIter) const override
    {
        const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
        return get(rGtkIter.iter, m_nIdCol);
    }

    virtual void disable_notify_events() override
    {
        g_signal_handler_block(m_pIconView, m_nSelectionChangedSignalId);
        g_signal_handler_block(m_pIconView, m_nItemActivatedSignalId);

        GtkInstanceContainer::disable_notify_events();
    }

    virtual void enable_notify_events() override
    {
        GtkInstanceContainer::enable_notify_events();

        g_signal_handler_unblock(m_pIconView, m_nItemActivatedSignalId);
        g_signal_handler_unblock(m_pIconView, m_nSelectionChangedSignalId);
    }

    virtual ~GtkInstanceIconView() override
    {
        if (m_pSelectionChangeEvent)
            Application::RemoveUserEvent(m_pSelectionChangeEvent);

        g_signal_handler_disconnect(m_pIconView, m_nItemActivatedSignalId);
        g_signal_handler_disconnect(m_pIconView, m_nSelectionChangedSignalId);
    }
};

IMPL_LINK_NOARG(GtkInstanceIconView, async_signal_selection_changed, void*, void)
{
    m_pSelectionChangeEvent = nullptr;
    signal_selection_changed();
}

class GtkInstanceSpinButton : public GtkInstanceEntry, public virtual weld::SpinButton
{
private:
@@ -11118,7 +11559,7 @@
        bodge_wayland_menu_not_appearing();
    }

    virtual void insert_separator(int pos) override
    virtual void insert_separator(int pos, const OUString& rId) override
    {
        disable_notify_events();
        GtkTreeIter iter;
@@ -11126,7 +11567,7 @@
        m_aSeparatorRows.push_back(pos);
        if (!gtk_combo_box_get_row_separator_func(m_pComboBox))
            gtk_combo_box_set_row_separator_func(m_pComboBox, separatorFunction, this, nullptr);
        insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, nullptr, "", nullptr, nullptr);
        insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, &rId, "", nullptr, nullptr);
        enable_notify_events();
        bodge_wayland_menu_not_appearing();
    }
@@ -11491,7 +11932,7 @@
        m_nEntryInsertTextSignalId = g_signal_connect(pWidget, "insert-text", G_CALLBACK(signalEntryInsertText), this);
    }

    virtual void insert_separator(int /*pos*/) override
    virtual void insert_separator(int /*pos*/, const OUString& /*rId*/) override
    {
        assert(false);
    }
@@ -12262,6 +12703,15 @@
        return std::make_unique<GtkInstanceTreeView>(pTreeView, this, bTakeOwnership);
    }

    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id, bool bTakeOwnership) override
    {
        GtkIconView* pIconView = GTK_ICON_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pIconView)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pIconView));
        return std::make_unique<GtkInstanceIconView>(pIconView, this, bTakeOwnership);
    }

    virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& containerid, const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
    {
        GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, containerid.getStr()));