move paths option page .ui to cui and adapt code

Change-Id: I60063a0d101ef47271194e45ee59f9ff622a4f1c
diff --git a/cui/UI_cui.mk b/cui/UI_cui.mk
index db290b7..820dcf2 100644
--- a/cui/UI_cui.mk
+++ b/cui/UI_cui.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\
	cui/uiconfig/ui/optadvancedpage \
	cui/uiconfig/ui/optappearancepage \
	cui/uiconfig/ui/optfontspage \
	cui/uiconfig/ui/optpathspage \
	cui/uiconfig/ui/personalization_tab \
	cui/uiconfig/ui/pickbulletpage \
	cui/uiconfig/ui/pickgraphicpage \
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index 8621fe4..62e2b93 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/dbregister.hxx
@@ -26,6 +26,7 @@
#include <svl/poolitem.hxx>
#include "ControlFocusHelper.hxx"
#include <sfx2/basedlgs.hxx>
#include <svx/simptabl.hxx>

class SvTreeListEntry;
namespace svx
@@ -46,12 +47,11 @@ namespace svx
        FixedLine           aStdBox;
        FixedText           aTypeText;
        FixedText           aPathText;
        SvxControlFocusHelper   aPathCtrl;
        SvxSimpleTableContainer aPathCtrl;
        PushButton          m_aNew;
        PushButton          m_aEdit;
        PushButton          m_aDelete;

        HeaderBar*          pHeaderBar;
        ::svx::OptHeaderTabListBox* pPathBox;
        SvTreeListEntry*        m_pCurEntry;
        sal_uLong               m_nOldCount;
diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc
index 43e79e1..e67692a 100644
--- a/cui/source/inc/helpid.hrc
+++ b/cui/source/inc/helpid.hrc
@@ -24,7 +24,6 @@
// Help-Ids --------------------------------------------------------------

#define HID_OPTIONS_SAVE "CUI_HID_OPTIONS_SAVE"
#define HID_OPTIONS_PATH "CUI_HID_OPTIONS_PATH"
#define HID_OPTIONS_GENERAL "CUI_HID_OPTIONS_GENERAL"
#define HID_OPTIONS_LINGU "CUI_HID_OPTIONS_LINGU"
#define HID_OPTIONS_DICT_NEW "CUI_HID_OPTIONS_DICT_NEW"
@@ -41,7 +40,6 @@
#define HID_EDIT_MODULES "CUI_HID_EDIT_MODULES"
#define HID_LNGDLG_NUM_PREBREAK "CUI_HID_LNGDLG_NUM_PREBREAK"
#define HID_OPTIONS_COLORCONFIG_SAVE_SCHEME "CUI_HID_OPTIONS_COLORCONFIG_SAVE_SCHEME"
#define HID_OPTIONS_PATHS_SELECTFOLDER "CUI_HID_OPTIONS_PATHS_SELECTFOLDER"
#define HID_OPTIONS_JAVA_PARAMETER "CUI_HID_OPTIONS_JAVA_PARAMETER"
#define HID_OPTIONS_JAVA_CLASSPATH "CUI_HID_OPTIONS_JAVA_CLASSPATH"
#define HID_SVXPAGE_JSEARCH_OPTIONS "CUI_HID_SVXPAGE_JSEARCH_OPTIONS"
@@ -60,11 +58,9 @@
#define HID_DBPATH_HEADERBAR "CUI_HID_DBPATH_HEADERBAR"
#define HID_OFAPAGE_SMARTTAG_OPTIONS "CUI_HID_OFAPAGE_SMARTTAG_OPTIONS"
#define HID_OFAPAGE_MSFLTR2_CLB "CUI_HID_OFAPAGE_MSFLTR2_CLB"
#define HID_OPTPATH_CTL_PATH "CUI_HID_OPTPATH_CTL_PATH"
#define HID_OFADLG_TREELISTBOX "CUI_HID_OFADLG_TREELISTBOX"
#define HID_DLG_WEBCONNECTION_INFO "CUI_HID_DLG_WEBCONNECTION_INFO"
#define HID_OPTIONS_DICT_EDIT_ENTRIES_LIST "CUI_HID_OPTIONS_DICT_EDIT_ENTRIES_LIST"
#define HID_OPTPATH_HEADERBAR "CUI_HID_OPTPATH_HEADERBAR"
#define HID_WARN_NAME_DUPLICATE "CUI_HID_WARN_NAME_DUPLICATE"
#define HID_COLORPAGE_DOCCOLOR_LB "CUI_HID_COLORPAGE_DOCCOLOR_LB"
#define HID_COLORPAGE_DOCBOUNDARIES_LB "CUI_HID_COLORPAGE_DOCBOUNDARIES_LB"
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index 4a25dfe..e6b8982 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -20,14 +20,9 @@
#define _SVX_OPTPATH_HXX

#include <sfx2/tabdlg.hxx>
#include <svx/simptabl.hxx>
#include <vcl/fixed.hxx>
#include <vcl/group.hxx>

#ifdef _SVX_OPTPATH_CXX
#include <svtools/headbar.hxx>
#else
class HeaderBar;
#endif
#include "ControlFocusHelper.hxx"

#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
@@ -47,14 +42,10 @@ class SvxPathTabPage;
class SvxPathTabPage : public SfxTabPage
{
private:
    FixedLine           aStdBox;
    FixedText           aTypeText;
    FixedText           aPathText;
    SvxControlFocusHelper aPathCtrl;
    PushButton          aStandardBtn;
    PushButton          aPathBtn;
    SvxSimpleTableContainer* m_pPathCtrl;
    PushButton*         m_pStandardBtn;
    PushButton*         m_pPathBtn;

    HeaderBar*                  pHeaderBar;
    ::svx::OptHeaderTabListBox* pPathBox;
    OptPath_Impl*               pImpl;

diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index e6917f2..dfa2def 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -113,7 +113,6 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const Sfx
    m_aNew          ( this, CUI_RES( BTN_NEW ) ),
    m_aEdit         ( this, CUI_RES( BTN_EDIT ) ),
    m_aDelete       ( this, CUI_RES( BTN_DELETE ) ),
    pHeaderBar      ( NULL ),
    pPathBox        ( NULL ),
    m_pCurEntry     ( NULL ),
    m_nOldCount     ( 0 ),
@@ -127,41 +126,38 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const Sfx


    WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
    pPathBox = new ::svx::OptHeaderTabListBox( &aPathCtrl, nBits );
    pPathBox = new ::svx::OptHeaderTabListBox( aPathCtrl, nBits );

    pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
    pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
    pHeaderBar->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, HeaderSelect_Impl ) );
    pHeaderBar->SetEndDragHdl( LINK( this, DbRegistrationOptionsPage, HeaderEndDrag_Impl ) );
    HeaderBar &rBar = pPathBox->GetTheHeaderBar();

    rBar.SetSelectHdl( LINK( this, DbRegistrationOptionsPage, HeaderSelect_Impl ) );
    rBar.SetEndDragHdl( LINK( this, DbRegistrationOptionsPage, HeaderEndDrag_Impl ) );
    Size aSz;
    aSz.Width() = TAB_WIDTH1;
    pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(),
    rBar.InsertItem( ITEMID_TYPE, aTypeText.GetText(),
                            LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
                            HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
    aSz.Width() = TAB_WIDTH2;
    pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(),
    rBar.InsertItem( ITEMID_PATH, aPathText.GetText(),
                            LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
                            HIB_LEFT | HIB_VCENTER );

    static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
    Size aHeadSize = pHeaderBar->GetSizePixel();
    static long aTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
    Size aHeadSize = rBar.GetSizePixel();

    aPathCtrl.SetFocusControl( pPathBox );
    pPathBox->SetStyle( pPathBox->GetStyle()|nBits );
    pPathBox->SetDoubleClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) );
    pPathBox->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, PathSelect_Impl ) );
    pPathBox->SetSelectionMode( SINGLE_SELECTION );
    pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ),
                               Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
    pPathBox->SetTabs( &nTabs[0], MAP_APPFONT );
    pPathBox->InitHeaderBar( pHeaderBar );
    pPathBox->SvxSimpleTable::SetTabs( aTabs, MAP_APPFONT );
    pPathBox->SetHighlightRange();

    pPathBox->SetHelpId( HID_DBPATH_CTL_PATH );
    pHeaderBar->SetHelpId( HID_DBPATH_HEADERBAR );
    rBar.SetHelpId( HID_DBPATH_HEADERBAR );

    pPathBox->Show();
    pHeaderBar->Show();
    pPathBox->ShowTable();

    FreeResource();
}
@@ -170,14 +166,9 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const Sfx

DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
{
    // #110603# do not grab focus to a destroyed window !!!
    aPathCtrl.SetFocusControl( NULL );

    pHeaderBar->Hide();
    for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
        delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() );
    delete pPathBox;
    delete pHeaderBar;
}

// -----------------------------------------------------------------------
@@ -240,12 +231,14 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet )
    String aUserData = GetUserData();
    if ( aUserData.Len() )
    {
        HeaderBar &rBar = pPathBox->GetTheHeaderBar();

        // restore column width
        pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
        rBar.SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
        HeaderEndDrag_Impl( NULL );
        // restore sort direction
        sal_Bool bUp = (sal_Bool)(sal_uInt16)aUserData.GetToken(1).ToInt32();
        HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
        HeaderBarItemBits nBits = rBar.GetItemBits(ITEMID_TYPE);

        if ( bUp )
        {
@@ -257,7 +250,7 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet )
            nBits &= ~HIB_DOWNARROW;
            nBits |= HIB_UPARROW;
        }
        pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
        rBar.SetItemBits( ITEMID_TYPE, nBits );
        HeaderSelect_Impl( NULL );
    }
}
@@ -266,8 +259,10 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet )

void DbRegistrationOptionsPage::FillUserData()
{
    OUString aUserData = OUString::number( pHeaderBar->GetItemSize( ITEMID_TYPE ) ) + ";";
    HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE );
    HeaderBar &rBar = pPathBox->GetTheHeaderBar();

    OUString aUserData = OUString::number( rBar.GetItemSize( ITEMID_TYPE ) ) + ";";
    HeaderBarItemBits nBits = rBar.GetItemBits( ITEMID_TYPE );
    sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
    aUserData += (bUp ? OUString("1") : OUString("0"));
    SetUserData( aUserData );
@@ -320,7 +315,7 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, HeaderBar*, pBar )
    if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
        return 0;

    HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
    HeaderBarItemBits nBits = pBar->GetItemBits(ITEMID_TYPE);
    sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
    SvSortMode eMode = SortAscending;

@@ -335,7 +330,7 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, HeaderBar*, pBar )
        nBits &= ~HIB_DOWNARROW;
        nBits |= HIB_UPARROW;
    }
    pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
    pBar->SetItemBits( ITEMID_TYPE, nBits );
    SvTreeList* pModel = pPathBox->GetModel();
    pModel->SetSortMode( eMode );
    pModel->Resort();
@@ -349,22 +344,22 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
    if ( pBar && !pBar->GetCurItemId() )
        return 0;

    if ( !pHeaderBar->IsItemMode() )
    if ( !pBar->IsItemMode() )
    {
        Size aSz;
        sal_uInt16 nTabs = pHeaderBar->GetItemCount();
        sal_uInt16 nTabs = pBar->GetItemCount();
        long nTmpSz = 0;
        long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE);
        long nBarWidth = pHeaderBar->GetSizePixel().Width();
        long nWidth = pBar->GetItemSize(ITEMID_TYPE);
        long nBarWidth = pBar->GetSizePixel().Width();

        if(nWidth < TAB_WIDTH_MIN)
            pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
            pBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
        else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
            pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );
            pBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );

        for ( sal_uInt16 i = 1; i <= nTabs; ++i )
        {
            long _nWidth = pHeaderBar->GetItemSize(i);
            long _nWidth = pBar->GetItemSize(i);
            aSz.Width() =  _nWidth + nTmpSz;
            nTmpSz += _nWidth;
            pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx
index 7a63518..0ad3049 100644
--- a/cui/source/options/optHeaderTabListbox.cxx
+++ b/cui/source/options/optHeaderTabListbox.cxx
@@ -53,9 +53,8 @@ void OptLBoxString_Impl::Paint(
}
// -----------------------------------------------------------------------------

OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :

    SvHeaderTabListBox( pParent, nWinStyle )
OptHeaderTabListBox::OptHeaderTabListBox(SvxSimpleTableContainer& rParent, WinBits nWinStyle)
    : SvxSimpleTable(rParent, nWinStyle)
{
}

diff --git a/cui/source/options/optHeaderTabListbox.hxx b/cui/source/options/optHeaderTabListbox.hxx
index 8124a1c..cb4e1f2 100644
--- a/cui/source/options/optHeaderTabListbox.hxx
+++ b/cui/source/options/optHeaderTabListbox.hxx
@@ -19,16 +19,16 @@
#ifndef SVX_OPTHEADERTABLISTBOX_HXX
#define SVX_OPTHEADERTABLISTBOX_HXX

#include <svtools/svtabbx.hxx>
#include <svx/simptabl.hxx>

namespace svx
{
    // class OptHeaderTabListBox ---------------------------------------------

    class OptHeaderTabListBox : public SvHeaderTabListBox
    class OptHeaderTabListBox : public SvxSimpleTable
    {
    public:
        OptHeaderTabListBox( Window* pParent, WinBits nBits );
        OptHeaderTabListBox(SvxSimpleTableContainer& rParent, WinBits nBits);

        virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind);
    };
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 769e7be..5c322ae 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -37,7 +37,6 @@

#include "optpath.hxx"
#include <dialmgr.hxx>
#include "optpath.hrc"
#include <cuires.hrc>
#include "helpid.hrc"
#include <comphelper/configuration.hxx>
@@ -63,9 +62,7 @@ using namespace svx;

// define ----------------------------------------------------------------

#define TAB_WIDTH1      80
#define TAB_WIDTH_MIN   10
#define TAB_WIDTH2      1000
#define ITEMID_TYPE       1
#define ITEMID_PATH       2

@@ -81,11 +78,12 @@ struct OptPath_Impl
{
    SvtDefaultOptions           m_aDefOpt;
    Image                       m_aLockImage;
    String                      m_sMultiPathDlg;
    OUString                    m_sMultiPathDlg;
    Reference< XPropertySet >   m_xPathSettings;

    OptPath_Impl(const ResId& rLockRes)
        : m_aLockImage(rLockRes)
    OptPath_Impl(const Image& rLockImage, const OUString& rMultiPathDlg)
        : m_aLockImage(rLockImage)
        , m_sMultiPathDlg(rMultiPathDlg)
    {
    }
};
@@ -200,61 +198,50 @@ sal_Bool IsMultiPath_Impl( const sal_uInt16 nIndex )

// class SvxPathTabPage --------------------------------------------------

SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) :

    SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_PATH ), rSet ),

    aStdBox         ( this, CUI_RES( GB_STD ) ),
    aTypeText       ( this, CUI_RES( FT_TYPE ) ),
    aPathText       ( this, CUI_RES( FT_PATH ) ),
    aPathCtrl       ( this, CUI_RES( LB_PATH ) ),
    aStandardBtn    ( this, CUI_RES( BTN_STANDARD ) ),
    aPathBtn        ( this, CUI_RES( BTN_PATH ) ),
    pHeaderBar      ( NULL ),
    pPathBox        ( NULL ),
    pImpl           ( new OptPath_Impl( CUI_RES(IMG_LOCK) ) ),
    xDialogListener ( new ::svt::DialogClosedListener() )

SvxPathTabPage::SvxPathTabPage(Window* pParent, const SfxItemSet& rSet)
    :SfxTabPage( pParent, "OptPathsPage", "cui/ui/optpathspage.ui", rSet)
    , xDialogListener ( new ::svt::DialogClosedListener() )
{
    pImpl->m_sMultiPathDlg = String( CUI_RES( STR_MULTIPATHDLG ) );
    aStandardBtn.SetClickHdl( LINK( this, SvxPathTabPage, StandardHdl_Impl ) );
    pImpl = new OptPath_Impl(get<FixedImage>("lock")->GetImage(),
        get<FixedText>("editpaths")->GetText());
    get(m_pStandardBtn, "default");
    get(m_pPathBtn, "edit");
    get(m_pPathCtrl, "paths");

    m_pStandardBtn->SetClickHdl(LINK(this, SvxPathTabPage, StandardHdl_Impl));
    Link aLink = LINK( this, SvxPathTabPage, PathHdl_Impl );
    aPathBtn.SetClickHdl( aLink );
    Size aBoxSize = aPathCtrl.GetOutputSizePixel();
    pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
    pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
    pHeaderBar->SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) );
    pHeaderBar->SetEndDragHdl( LINK( this, SvxPathTabPage, HeaderEndDrag_Impl ) );
    Size aSz;
    aSz.Width() = TAB_WIDTH1;
    pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(),
                            LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
    m_pPathBtn->SetClickHdl( aLink );

    Size aControlSize(236 , 147);
    aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
    m_pPathCtrl->set_width_request(aControlSize.Width());
    m_pPathCtrl->set_height_request(aControlSize.Height());
    WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
    pPathBox = new svx::OptHeaderTabListBox( *m_pPathCtrl, nBits );

    HeaderBar &rBar = pPathBox->GetTheHeaderBar();
    rBar.SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) );
    rBar.SetEndDragHdl( LINK( this, SvxPathTabPage, HeaderEndDrag_Impl ) );

    rBar.InsertItem( ITEMID_TYPE, get<FixedText>("type")->GetText(),
                            0,
                            HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
    aSz.Width() = TAB_WIDTH2;
    pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(),
                            LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
    rBar.InsertItem( ITEMID_PATH, get<FixedText>("path")->GetText(),
                            0,
                            HIB_LEFT | HIB_VCENTER );

    static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
    Size aHeadSize = pHeaderBar->GetSizePixel();
    long nWidth1 = rBar.GetTextWidth(rBar.GetItemText(1));
    long nWidth2 = rBar.GetTextWidth(rBar.GetItemText(2));

    WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
    pPathBox = new svx::OptHeaderTabListBox( &aPathCtrl, nBits );
    aPathCtrl.SetFocusControl( pPathBox );
    long aTabs[] = {3, 0, 0, 0};
    aTabs[2] = nWidth1 + 12;
    aTabs[3] = aTabs[2] + nWidth2 + 12;
    pPathBox->SetTabs(aTabs, MAP_PIXEL);

    pPathBox->SetDoubleClickHdl( aLink );
    pPathBox->SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) );
    pPathBox->SetSelectionMode( MULTIPLE_SELECTION );
    pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ),
                               Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
    pPathBox->SetTabs( &nTabs[0], MAP_APPFONT );
    pPathBox->InitHeaderBar( pHeaderBar );
    pPathBox->SetHighlightRange();
    pPathBox->SetHelpId( HID_OPTPATH_CTL_PATH );
    pHeaderBar->SetHelpId( HID_OPTPATH_HEADERBAR );
    pPathBox->Show();
    pHeaderBar->Show();

    FreeResource();

    xDialogListener->SetDialogClosedLink( LINK( this, SvxPathTabPage, DialogClosedHdl ) );
}
@@ -263,14 +250,9 @@ SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) :

SvxPathTabPage::~SvxPathTabPage()
{
    // #110603# do not grab focus to a destroyed window !!!
    aPathCtrl.SetFocusControl( NULL );

    pHeaderBar->Hide();
    for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
        delete (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData();
    delete pPathBox;
    delete pHeaderBar;
    delete pImpl;
}

@@ -304,6 +286,10 @@ void SvxPathTabPage::Reset( const SfxItemSet& )
    pPathBox->Clear();
    SvtPathOptions aPathOpt; //! deprecated

    HeaderBar &rBar = pPathBox->GetTheHeaderBar();
    long nWidth1 = rBar.GetTextWidth(rBar.GetItemText(1));
    long nWidth2 = rBar.GetTextWidth(rBar.GetItemText(2));

    for( sal_uInt16 i = 0; i <= (sal_uInt16)SvtPathOptions::PATH_WORK; ++i )
    {
        // only writer uses autotext
@@ -327,6 +313,8 @@ void SvxPathTabPage::Reset( const SfxItemSet& )
            case SvtPathOptions::PATH_WORK:
            {
                String aStr( CUI_RES( RID_SVXSTR_PATH_NAME_START + i ) );
                nWidth1 = std::max(nWidth1, pPathBox->GetTextWidth(aStr));
                aStr += '\t';
                String sInternal, sUser, sWritable;
                sal_Bool bReadOnly = sal_False;
                GetPathList( i, sInternal, sUser, sWritable, bReadOnly );
@@ -335,8 +323,9 @@ void SvxPathTabPage::Reset( const SfxItemSet& )
                    sTmpPath += MULTIPATH_DELIMITER;
                sTmpPath += sWritable;
                String aValue( sTmpPath );
                aStr += '\t';
                aStr += Convert_Impl( aValue );
                aValue = Convert_Impl( aValue );
                nWidth2 = std::max(nWidth2, pPathBox->GetTextWidth(aValue));
                aStr += aValue;
                SvTreeListEntry* pEntry = pPathBox->InsertEntry( aStr );
                if ( bReadOnly )
                {
@@ -350,15 +339,23 @@ void SvxPathTabPage::Reset( const SfxItemSet& )
        }
    }

    long aTabs[] = {3, 0, 0, 0};
    aTabs[2] = nWidth1 + 12;
    aTabs[3] = aTabs[2] + nWidth2 + 12;
    pPathBox->SetTabs(aTabs, MAP_PIXEL);

#if 0
    String aUserData = GetUserData();
    if ( aUserData.Len() )
    {
        fprintf(stderr, "FOO\n");

        // restore column width
        pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
        HeaderEndDrag_Impl( NULL );
        rBar.SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
        HeaderEndDrag_Impl( &rBar );
        // restore sort direction
        sal_Bool bUp = (sal_Bool)(sal_uInt16)aUserData.GetToken(1).ToInt32();
        HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
        HeaderBarItemBits nBits = rBar.GetItemBits(ITEMID_TYPE);

        if ( bUp )
        {
@@ -370,9 +367,10 @@ void SvxPathTabPage::Reset( const SfxItemSet& )
            nBits &= ~HIB_DOWNARROW;
            nBits |= HIB_UPARROW;
        }
        pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
        HeaderSelect_Impl( NULL );
        rBar.SetItemBits( ITEMID_TYPE, nBits );
        HeaderSelect_Impl( &rBar );
    }
#endif
    PathSelect_Impl( NULL );
}

@@ -380,8 +378,10 @@ void SvxPathTabPage::Reset( const SfxItemSet& )

void SvxPathTabPage::FillUserData()
{
    String aUserData = OUString::number( pHeaderBar->GetItemSize( ITEMID_TYPE ) ) + ";";
    HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE );
    HeaderBar &rBar = pPathBox->GetTheHeaderBar();

    String aUserData = OUString::number( rBar.GetItemSize( ITEMID_TYPE ) ) + ";";
    HeaderBarItemBits nBits = rBar.GetItemBits( ITEMID_TYPE );
    sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
    aUserData += bUp ? '1' : '0';
    SetUserData( aUserData );
@@ -405,8 +405,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathSelect_Impl)
        pEntry = pPathBox->NextSelected( pEntry );
    }

    aPathBtn.Enable( 1 == nSelCount && bEnable);
    aStandardBtn.Enable( nSelCount > 0 && bEnable);
    m_pPathBtn->Enable( 1 == nSelCount && bEnable);
    m_pStandardBtn->Enable( nSelCount > 0 && bEnable);
    return 0;
}

@@ -645,7 +645,7 @@ IMPL_LINK( SvxPathTabPage, HeaderSelect_Impl, HeaderBar*, pBar )
    if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
        return 0;

    HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
    HeaderBarItemBits nBits = pBar->GetItemBits(ITEMID_TYPE);
    sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
    SvSortMode eMode = SortAscending;

@@ -660,7 +660,7 @@ IMPL_LINK( SvxPathTabPage, HeaderSelect_Impl, HeaderBar*, pBar )
        nBits &= ~HIB_DOWNARROW;
        nBits |= HIB_UPARROW;
    }
    pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
    pBar->SetItemBits( ITEMID_TYPE, nBits );
    SvTreeList* pModel = pPathBox->GetModel();
    pModel->SetSortMode( eMode );
    pModel->Resort();
@@ -674,22 +674,22 @@ IMPL_LINK( SvxPathTabPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
    if ( pBar && !pBar->GetCurItemId() )
        return 0;

    if ( !pHeaderBar->IsItemMode() )
    if ( !pBar->IsItemMode() )
    {
        Size aSz;
        sal_uInt16 nTabs = pHeaderBar->GetItemCount();
        sal_uInt16 nTabs = pBar->GetItemCount();
        long nTmpSz = 0;
        long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE);
        long nBarWidth = pHeaderBar->GetSizePixel().Width();
        long nWidth = pBar->GetItemSize(ITEMID_TYPE);
        long nBarWidth = pBar->GetSizePixel().Width();

        if(nWidth < TAB_WIDTH_MIN)
            pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
            pBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
        else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
            pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );
            pBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );

        for ( sal_uInt16 i = 1; i <= nTabs; ++i )
        {
            long _nWidth = pHeaderBar->GetItemSize(i);
            long _nWidth = pBar->GetItemSize(i);
            aSz.Width() =  _nWidth + nTmpSz;
            nTmpSz += _nWidth;
            pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
diff --git a/cui/source/options/optpath.hrc b/cui/source/options/optpath.hrc
deleted file mode 100644
index 3b1a259..0000000
--- a/cui/source/options/optpath.hrc
+++ /dev/null
@@ -1,33 +0,0 @@
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef _SVX_OPTPATH_HRC
#define _SVX_OPTPATH_HRC

// defines ---------------------------------------------------------------

#define FT_TYPE                 10
#define FT_PATH                 11
#define LB_PATH                 12
#define BTN_PATH                13
#define BTN_STANDARD            14
#define GB_STD                  15
#define IMG_LOCK                16
#define STR_MULTIPATHDLG        17

#endif

diff --git a/cui/source/options/optpath.src b/cui/source/options/optpath.src
index ff4a800..8173a70 100644
--- a/cui/source/options/optpath.src
+++ b/cui/source/options/optpath.src
@@ -15,79 +15,17 @@
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#include "optpath.hrc"
#include <cuires.hrc>
#include <sfx2/sfx.hrc>
#include "helpid.hrc"

 // RID_SFXPAGE_PATH -----------------------------------------------------
#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
TabPage RID_SFXPAGE_PATH
{
    HelpId = HID_OPTIONS_PATH ;
    OutputSize = TRUE ;
    SVLook = TRUE ;
    Hide = TRUE ;
    Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
    Text [ en-US ] = "Paths" ;
    FixedText FT_TYPE
    {
        Hide = TRUE;
        Pos = MAP_APPFONT ( 12 , 14 ) ;
        Size = MAP_APPFONT ( 40 , 10 ) ;
        Text [ en-US ] = "Type" ;
    };
    FixedText FT_PATH
    {
        Hide = TRUE;
        Pos = MAP_APPFONT ( 110 , 14 ) ;
        Size = MAP_APPFONT ( 40 , 10 ) ;
        Text [ en-US ] = "Path" ;
    };
    Control LB_PATH
    {
        Pos = MAP_APPFONT ( 12 , 14 ) ;
        Size = MAP_APPFONT ( 236 , 147 ) ;
        Border = TRUE ;
        TabStop = TRUE;
    };
    PushButton BTN_PATH
    {
        HelpID = "cui:PushButton:RID_SFXPAGE_PATH:BTN_PATH";
        Pos = MAP_APPFONT ( 183 , 165 ) ;
        Size = MAP_APPFONT ( 65 , 14 ) ;
        Text [ en-US ] = "~Edit..." ;
    };
    PushButton BTN_STANDARD
    {
        HelpID = "cui:PushButton:RID_SFXPAGE_PATH:BTN_STANDARD";
        Pos = MAP_APPFONT ( 115 , 165 ) ;
        Size = MAP_APPFONT ( 65 , 14 ) ;
        Text [ en-US ] = "~Default" ;
    };
    FixedLine GB_STD
    {
        Pos = MAP_APPFONT ( 6 , 3 ) ;
        Size = MAP_APPFONT ( 248 , 8 ) ;
        Text [ en-US ] = "Paths used by %PRODUCTNAME" ;
    };
    Image IMG_LOCK
    {
        ImageBitmap = Bitmap { File = "lock.bmp"; };
        MaskColor = STD_MASKCOLOR;
    };
    String STR_MULTIPATHDLG
    {
        Text [ en-US ] = "Edit Paths: %1" ;
    };
};
ErrorBox RID_SVXERR_OPT_DOUBLEPATHS
{
    BUTTONS = WB_OK ;
    DEFBUTTON = WB_DEF_OK ;
    Message [ en-US ] = "The configuration and mail directories must be specified as separate directories.\nPlease choose a new path." ;
};
 // ******************************************************************* EOF

String RID_SVXSTR_KEY_CONFIG_DIR
{
    Text [ en-US ] = "Configuration" ;
@@ -108,7 +46,6 @@ String RID_SVXSTR_KEY_BASIC_PATH
{
    Text = "BASIC" ;
};

String RID_SVXSTR_KEY_PALETTE_PATH
{
    Text [ en-US ] = "Palettes" ;
@@ -141,7 +78,6 @@ String RID_SVXSTR_KEY_GALLERY_DIR
{
    Text [ en-US ] = "Gallery" ;
};

String RID_SVXSTR_KEY_STORAGE_DIR
{
    Text [ en-US ] = "Message Storage" ;
diff --git a/cui/uiconfig/ui/optpathspage.ui b/cui/uiconfig/ui/optpathspage.ui
new file mode 100644
index 0000000..e3f8091
--- /dev/null
+++ b/cui/uiconfig/ui/optpathspage.ui
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <object class="GtkBox" id="OptPathsPage">
    <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">12</property>
    <child>
      <object class="GtkFrame" id="frame1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="hexpand">True</property>
        <property name="vexpand">True</property>
        <property name="label_xalign">0</property>
        <property name="shadow_type">none</property>
        <child>
          <object class="GtkAlignment" id="alignment1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="top_padding">6</property>
            <property name="left_padding">12</property>
            <child>
              <object class="GtkBox" id="box1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="orientation">vertical</property>
                <child>
                  <object class="GtkGrid" id="grid1">
                    <property name="can_focus">False</property>
                    <property name="no_show_all">True</property>
                    <property name="column_homogeneous">True</property>
                    <child>
                      <object class="GtkLabel" id="type">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes">Type</property>
                      </object>
                      <packing>
                        <property name="left_attach">0</property>
                        <property name="top_attach">0</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkLabel" id="path">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes">Path</property>
                      </object>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="top_attach">0</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkLabel" id="editpaths">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes">Edit Paths: %1</property>
                      </object>
                      <packing>
                        <property name="left_attach">2</property>
                        <property name="top_attach">0</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkImage" id="lock">
                        <property name="can_focus">False</property>
                        <property name="no_show_all">True</property>
                        <property name="pixbuf">res/lock.png</property>
                      </object>
                      <packing>
                        <property name="left_attach">3</property>
                        <property name="top_attach">0</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">0</property>
                  </packing>
                </child>
                <child>
                  <object class="svxcorelo:SvxSimpleTableContainer" id="paths">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="vexpand">True</property>
                  </object>
                  <packing>
                    <property name="expand">True</property>
                    <property name="fill">True</property>
                    <property name="position">1</property>
                  </packing>
                </child>
              </object>
            </child>
          </object>
        </child>
        <child type="label">
          <object class="GtkLabel" id="label1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">Paths used by %PRODUCTNAME</property>
            <attributes>
              <attribute name="weight" value="bold"/>
            </attributes>
          </object>
        </child>
      </object>
      <packing>
        <property name="expand">True</property>
        <property name="fill">True</property>
        <property name="position">0</property>
      </packing>
    </child>
    <child>
      <object class="GtkButtonBox" id="buttonbox1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="spacing">12</property>
        <property name="layout_style">end</property>
        <child>
          <object class="GtkButton" id="default">
            <property name="label" translatable="yes">_Default</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_underline">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="edit">
            <property name="label">_Edit...</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_underline">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="position">1</property>
      </packing>
    </child>
  </object>
</interface>
diff --git a/sw/uiconfig/swriter/ui/libpaths.ui b/sw/uiconfig/swriter/ui/libpaths.ui
deleted file mode 100644
index bcd6c8d..0000000
--- a/sw/uiconfig/swriter/ui/libpaths.ui
+++ /dev/null
@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <object class="GtkBox" id="box1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="orientation">vertical</property>
    <child>
      <object class="GtkFrame" id="frame1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label_xalign">0</property>
        <property name="shadow_type">none</property>
        <child>
          <object class="GtkAlignment" id="alignment1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="left_padding">12</property>
            <child>
              <object class="GtkScrolledWindow" id="scrolledwindow1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="shadow_type">in</property>
                <child>
                  <placeholder/>
                </child>
              </object>
            </child>
          </object>
        </child>
        <child type="label">
          <object class="GtkLabel" id="label1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">Paths used by LibreOffice</property>
          </object>
        </child>
      </object>
      <packing>
        <property name="expand">False</property>
        <property name="fill">True</property>
        <property name="position">0</property>
      </packing>
    </child>
    <child>
      <object class="GtkButtonBox" id="buttonbox1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="spacing">12</property>
        <property name="layout_style">end</property>
        <child>
          <object class="GtkButton" id="button1">
            <property name="label" translatable="yes">~Default</property>
            <property name="use_action_appearance">False</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_action_appearance">False</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="button2">
            <property name="label">gtk-edit</property>
            <property name="use_action_appearance">False</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_action_appearance">False</property>
            <property name="use_stock">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="position">1</property>
      </packing>
    </child>
  </object>
</interface>