weld SvxLineEndDefTabPage

Change-Id: I3e947511bbffae4cd48388b17a8fb9a13d453bab
Reviewed-on: https://gerrit.libreoffice.org/61139
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 1bd2d5d..e837743 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1967,7 +1967,7 @@ IMPL_LINK_NOARG(SvxMainMenuOrganizerDialog, ModifyHdl, weld::Entry&, void)
    const int nNewMenuPos = m_xMenuListBox->find_id(m_sNewMenuEntryId);
    const int nOldSelection = m_xMenuListBox->get_selected_index();
    m_xMenuListBox->remove(nNewMenuPos);
    m_xMenuListBox->insert(nNewMenuPos, m_sNewMenuEntryId, pNewEntryData->GetName(), nullptr);
    m_xMenuListBox->insert(nNewMenuPos, m_sNewMenuEntryId, pNewEntryData->GetName(), nullptr, nullptr);
    m_xMenuListBox->select(nOldSelection);
}

@@ -2005,7 +2005,7 @@ IMPL_LINK( SvxMainMenuOrganizerDialog, MoveHdl, weld::Button&, rButton, void )
    OUString sId = m_xMenuListBox->get_id(nSourceEntry);
    OUString sEntry = m_xMenuListBox->get_text(nSourceEntry);
    m_xMenuListBox->remove(nSourceEntry);
    m_xMenuListBox->insert(nTargetEntry, sId, sEntry, nullptr);
    m_xMenuListBox->insert(nTargetEntry, sId, sEntry, nullptr, nullptr);
    m_xMenuListBox->select(nTargetEntry);

    UpdateButtonStates();
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 28cdf1b..c7e2431 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -326,15 +326,6 @@ class SvxLineEndDefTabPage : public SfxTabPage
    using TabPage::DeactivatePage;

private:
    VclPtr<Edit>                m_pEdtName;
    VclPtr<LineEndLB>           m_pLbLineEnds;
    VclPtr<PushButton>          m_pBtnAdd;
    VclPtr<PushButton>          m_pBtnModify;
    VclPtr<PushButton>          m_pBtnDelete;
    VclPtr<PushButton>          m_pBtnLoad;
    VclPtr<PushButton>          m_pBtnSave;
    VclPtr<SvxXLinePreview>     m_pCtlPreview;

    const SfxItemSet&   rOutAttrs;
    const SdrObject*    pPolyObj;

@@ -348,17 +339,28 @@ private:
    sal_uInt16          nDlgType;
    sal_Int32*          pPosLineEndLb;

    DECL_LINK( ClickAddHdl_Impl, Button*, void );
    DECL_LINK( ClickModifyHdl_Impl, Button*, void );
    DECL_LINK( ClickDeleteHdl_Impl, Button*, void );
    DECL_LINK( ClickLoadHdl_Impl, Button*, void );
    DECL_LINK( ClickSaveHdl_Impl, Button*, void );
    DECL_LINK( SelectLineEndHdl_Impl, ListBox&, void );
    XLinePreview m_aCtlPreview;
    std::unique_ptr<weld::Entry> m_xEdtName;
    std::unique_ptr<SvxLineEndLB> m_xLbLineEnds;
    std::unique_ptr<weld::Button> m_xBtnAdd;
    std::unique_ptr<weld::Button> m_xBtnModify;
    std::unique_ptr<weld::Button> m_xBtnDelete;
    std::unique_ptr<weld::Button> m_xBtnLoad;
    std::unique_ptr<weld::Button> m_xBtnSave;
    std::unique_ptr<weld::CustomWeld> m_xCtlPreview;

    DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
    DECL_LINK(ClickModifyHdl_Impl, weld::Button&, void);
    DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
    DECL_LINK(ClickLoadHdl_Impl, weld::Button&, void);
    DECL_LINK(ClickSaveHdl_Impl, weld::Button&, void);
    DECL_LINK(SelectLineEndHdl_Impl, weld::ComboBox&, void);

    void SelectLineEndHdl_Impl();
    void CheckChanges_Impl();

public:
    SvxLineEndDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
    SvxLineEndDefTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
    virtual ~SvxLineEndDefTabPage() override;
    virtual void dispose() override;

diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 4f525e9..4222266 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -50,55 +50,44 @@

#define XOUT_WIDTH    150

SvxLineEndDefTabPage::SvxLineEndDefTabPage
(
    vcl::Window* pParent,
    const SfxItemSet& rInAttrs
) :

    SfxTabPage( pParent
              , "LineEndPage"
              , "cui/ui/lineendstabpage.ui"
              , &rInAttrs ),
    rOutAttrs           ( rInAttrs ),
    pPolyObj            ( nullptr ),

    aXLineAttr          ( rInAttrs.GetPool() ),
    rXLSet              ( aXLineAttr.GetItemSet() ),
    pnLineEndListState  ( nullptr ),
    pPageType           ( nullptr ),
    nDlgType            ( 0 ),
    pPosLineEndLb       ( nullptr )
SvxLineEndDefTabPage::SvxLineEndDefTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs)
    : SfxTabPage(pParent , "cui/ui/lineendstabpage.ui", "LineEndPage", &rInAttrs)
    , rOutAttrs(rInAttrs)
    , pPolyObj(nullptr)
    , aXLineAttr(rInAttrs.GetPool())
    , rXLSet(aXLineAttr.GetItemSet())
    , pnLineEndListState(nullptr)
    , pPageType(nullptr)
    , nDlgType(0)
    , pPosLineEndLb(nullptr)
    , m_xEdtName(m_xBuilder->weld_entry("EDT_NAME"))
    , m_xLbLineEnds(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_LINEENDS")))
    , m_xBtnAdd(m_xBuilder->weld_button("BTN_ADD"))
    , m_xBtnModify(m_xBuilder->weld_button("BTN_MODIFY"))
    , m_xBtnDelete(m_xBuilder->weld_button("BTN_DELETE"))
    , m_xBtnLoad(m_xBuilder->weld_button("BTN_LOAD"))
    , m_xBtnSave(m_xBuilder->weld_button("BTN_SAVE"))
    , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview))
{
    get(m_pEdtName,"EDT_NAME");
    get(m_pLbLineEnds,"LB_LINEENDS");
    get(m_pBtnAdd,"BTN_ADD");
    get(m_pBtnModify,"BTN_MODIFY");
    get(m_pBtnDelete,"BTN_DELETE");
    get(m_pBtnLoad,"BTN_LOAD");
    get(m_pBtnSave,"BTN_SAVE");
    get(m_pCtlPreview,"CTL_PREVIEW");

    // this page needs ExchangeSupport
    SetExchangeSupport();

    rXLSet.Put( XLineStyleItem(css::drawing::LineStyle_SOLID) );
    rXLSet.Put( XLineWidthItem(XOUT_WIDTH) );
    rXLSet.Put( XLineColorItem( OUString(), COL_BLACK ) );
    rXLSet.Put( XLineStartWidthItem( m_pCtlPreview->GetOutputSize().Height()  / 2 ) );
    rXLSet.Put( XLineEndWidthItem( m_pCtlPreview->GetOutputSize().Height() / 2 ) );
    rXLSet.Put( XLineStartWidthItem( m_aCtlPreview.GetOutputSize().Height()  / 2 ) );
    rXLSet.Put( XLineEndWidthItem( m_aCtlPreview.GetOutputSize().Height() / 2 ) );

    // #i34740#
    m_pCtlPreview->SetLineAttributes(aXLineAttr.GetItemSet());
    m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());

    m_pBtnAdd->SetClickHdl( LINK( this, SvxLineEndDefTabPage, ClickAddHdl_Impl ) );
    m_pBtnModify->SetClickHdl( LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl ) );
    m_pBtnDelete->SetClickHdl( LINK( this, SvxLineEndDefTabPage, ClickDeleteHdl_Impl ) );
    m_pBtnLoad->SetClickHdl( LINK( this, SvxLineEndDefTabPage, ClickLoadHdl_Impl ) );
    m_pBtnSave->SetClickHdl( LINK( this, SvxLineEndDefTabPage, ClickSaveHdl_Impl ) );
    m_xBtnAdd->connect_clicked(LINK(this, SvxLineEndDefTabPage, ClickAddHdl_Impl));
    m_xBtnModify->connect_clicked(LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl));
    m_xBtnDelete->connect_clicked(LINK( this, SvxLineEndDefTabPage, ClickDeleteHdl_Impl));
    m_xBtnLoad->connect_clicked(LINK( this, SvxLineEndDefTabPage, ClickLoadHdl_Impl));
    m_xBtnSave->connect_clicked(LINK( this, SvxLineEndDefTabPage, ClickSaveHdl_Impl));

    m_pLbLineEnds->SetSelectHdl( LINK( this, SvxLineEndDefTabPage, SelectLineEndHdl_Impl ) );

    m_xLbLineEnds->connect_changed(LINK(this, SvxLineEndDefTabPage, SelectLineEndHdl_Impl));
}

SvxLineEndDefTabPage::~SvxLineEndDefTabPage()
@@ -108,28 +97,21 @@ SvxLineEndDefTabPage::~SvxLineEndDefTabPage()

void SvxLineEndDefTabPage::dispose()
{
    m_pEdtName.clear();
    m_pLbLineEnds.clear();
    m_pBtnAdd.clear();
    m_pBtnModify.clear();
    m_pBtnDelete.clear();
    m_pBtnLoad.clear();
    m_pBtnSave.clear();
    m_pCtlPreview.clear();
    m_xCtlPreview.reset();
    m_xLbLineEnds.reset();
    SfxTabPage::dispose();
}

void SvxLineEndDefTabPage::Resize()
{
    rXLSet.Put(XLineStartWidthItem(m_pCtlPreview->GetOutputSize().Height()  / 2 ));
    rXLSet.Put(XLineEndWidthItem(m_pCtlPreview->GetOutputSize().Height() / 2 ));
    rXLSet.Put(XLineStartWidthItem(m_aCtlPreview.GetOutputSize().Height()  / 2));
    rXLSet.Put(XLineEndWidthItem(m_aCtlPreview.GetOutputSize().Height() / 2));
    SfxTabPage::Resize();
}


void SvxLineEndDefTabPage::Construct()
{
    m_pLbLineEnds->Fill( pLineEndList );
    m_xLbLineEnds->Fill( pLineEndList );

    bool bCreateArrowPossible = true;

@@ -150,10 +132,9 @@ void SvxLineEndDefTabPage::Construct()
    }

    if( !bCreateArrowPossible )
        m_pBtnAdd->Disable();
        m_xBtnAdd->set_sensitive(false);
}


void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& )
{
    if( nDlgType == 0 ) // area dialog
@@ -161,17 +142,17 @@ void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& )
        // ActivatePage() is called before the dialog receives PageCreated() !!!
        if( pLineEndList.is() )
        {
            if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND )
            if( *pPosLineEndLb != -1)
            {
                m_pLbLineEnds->SelectEntryPos( *pPosLineEndLb );
                SelectLineEndHdl_Impl( *m_pLbLineEnds );
                m_xLbLineEnds->set_active(*pPosLineEndLb);
                SelectLineEndHdl_Impl();
            }
            INetURLObject   aURL( pLineEndList->GetPath() );

            aURL.Append( pLineEndList->GetName() );
            DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
            *pPageType = PageType::Area; // 3
            *pPosLineEndLb = LISTBOX_ENTRY_NOTFOUND;
            *pPosLineEndLb = -1;
        }
    }
}
@@ -190,23 +171,23 @@ DeactivateRC SvxLineEndDefTabPage::DeactivatePage( SfxItemSet* _pSet )

void SvxLineEndDefTabPage::CheckChanges_Impl()
{
    sal_Int32 nPos = m_pLbLineEnds->GetSelectedEntryPos();
    int nPos = m_xLbLineEnds->get_active();

    if ( nPos != LISTBOX_ENTRY_NOTFOUND )
    if (nPos != -1)
    {
        OUString aString = m_pEdtName->GetText();
        OUString aString = m_xEdtName->get_text();

        if( aString != m_pLbLineEnds->GetSelectedEntry() )
        if( aString != m_xLbLineEnds->get_active_text() )
        {
            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querychangelineenddialog.ui"));
            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querychangelineenddialog.ui"));
            std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskChangeLineEndDialog"));
            if (xQueryBox->run() == RET_YES)
                ClickModifyHdl_Impl( nullptr );
                ClickModifyHdl_Impl(*m_xBtnModify);
        }
    }
    nPos = m_pLbLineEnds->GetSelectedEntryPos();
    nPos = m_xLbLineEnds->get_active();

    if ( nPos != LISTBOX_ENTRY_NOTFOUND )
    if (nPos != -1)
        *pPosLineEndLb = nPos;
}

@@ -219,7 +200,7 @@ bool SvxLineEndDefTabPage::FillItemSet( SfxItemSet* rSet )
        {
            CheckChanges_Impl();

            long nPos = m_pLbLineEnds->GetSelectedEntryPos();
            int nPos = m_xLbLineEnds->get_active();
            const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);

            rSet->Put( XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
@@ -229,68 +210,63 @@ bool SvxLineEndDefTabPage::FillItemSet( SfxItemSet* rSet )
    return true;
}


void SvxLineEndDefTabPage::Reset( const SfxItemSet* )
{
    m_pLbLineEnds->SelectEntryPos( 0 );
    m_xLbLineEnds->set_active(0);

    // Update lineend
    if( pLineEndList->Count() > 0 )
    {
        int nPos = m_pLbLineEnds->GetSelectedEntryPos();
        int nPos = m_xLbLineEnds->get_active();

        const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);

        m_pEdtName->SetText( m_pLbLineEnds->GetSelectedEntry() );
        m_xEdtName->set_text(m_xLbLineEnds->get_active_text());

        rXLSet.Put( XLineStartItem( OUString(), pEntry->GetLineEnd() ) );
        rXLSet.Put( XLineEndItem( OUString(), pEntry->GetLineEnd() ) );

        // #i34740#
        m_pCtlPreview->SetLineAttributes(aXLineAttr.GetItemSet());

        m_pCtlPreview->Invalidate();
        m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
        m_aCtlPreview.Invalidate();
    }

    // determine button state
    if( pLineEndList->Count() )
    {
        m_pBtnModify->Enable();
        m_pBtnDelete->Enable();
        m_pBtnSave->Enable();
        m_xBtnModify->set_sensitive(true);
        m_xBtnDelete->set_sensitive(true);
        m_xBtnSave->set_sensitive(true);
    }
    else
    {
        m_pBtnModify->Disable();
        m_pBtnDelete->Disable();
        m_pBtnSave->Disable();
        m_xBtnModify->set_sensitive(false);
        m_xBtnDelete->set_sensitive(false);
        m_xBtnSave->set_sensitive(false);
    }
}


VclPtr<SfxTabPage> SvxLineEndDefTabPage::Create( TabPageParent pWindow, const SfxItemSet* rSet )
VclPtr<SfxTabPage> SvxLineEndDefTabPage::Create(TabPageParent pParent, const SfxItemSet* rSet)
{
    return VclPtr<SvxLineEndDefTabPage>::Create( pWindow.pParent, *rSet );
    return VclPtr<SvxLineEndDefTabPage>::Create(pParent, *rSet );
}


IMPL_LINK_NOARG(SvxLineEndDefTabPage, SelectLineEndHdl_Impl, ListBox&, void)
void SvxLineEndDefTabPage::SelectLineEndHdl_Impl()
{
    if( pLineEndList->Count() > 0 )
    {
        int nPos = m_pLbLineEnds->GetSelectedEntryPos();
        int nPos = m_xLbLineEnds->get_active();

        const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);

        m_pEdtName->SetText( m_pLbLineEnds->GetSelectedEntry() );
        m_xEdtName->set_text(m_xLbLineEnds->get_active_text());

        rXLSet.Put( XLineStartItem( OUString(), pEntry->GetLineEnd() ) );
        rXLSet.Put( XLineEndItem( OUString(), pEntry->GetLineEnd() ) );

        // #i34740#
        m_pCtlPreview->SetLineAttributes(aXLineAttr.GetItemSet());

        m_pCtlPreview->Invalidate();
        m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
        m_aCtlPreview.Invalidate();

        // Is not set before, in order to only take the new style,
        // if there is an entry selected in the ListBox
@@ -298,15 +274,18 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, SelectLineEndHdl_Impl, ListBox&, void)
    }
}


IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvxLineEndDefTabPage, SelectLineEndHdl_Impl, weld::ComboBox&, void)
{
    sal_Int32 nPos = m_pLbLineEnds->GetSelectedEntryPos();
    SelectLineEndHdl_Impl();
}

    if( nPos != LISTBOX_ENTRY_NOTFOUND )
IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, weld::Button&, void)
{
    int nPos = m_xLbLineEnds->get_active();
    if (nPos != -1)
    {
        OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINEEND));
        OUString aName( m_pEdtName->GetText() );
        OUString aName(m_xEdtName->get_text());
        long nCount = pLineEndList->Count();
        bool bDifferent = true;

@@ -318,12 +297,12 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void)
        // if yes, repeat and demand a new name
        if ( !bDifferent )
        {
            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui"));
            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/queryduplicatedialog.ui"));
            std::unique_ptr<weld::MessageDialog> xWarningBox(xBuilder->weld_message_dialog("DuplicateNameDialog"));
            xWarningBox->run();

            SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
            ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc));
            ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetDialogFrameWeld(), aName, aDesc));
            bool bLoop = true;

            while( !bDifferent && bLoop && pDlg->Execute() == RET_OK )
@@ -354,10 +333,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void)
                // #123497# Need to replace the existing entry with a new one
                pLineEndList->Replace(o3tl::make_unique<XLineEndEntry>(pOldEntry->GetLineEnd(), aName), nPos);

                m_pEdtName->SetText( aName );
                m_xEdtName->set_text(aName);

                m_pLbLineEnds->Modify(*pLineEndList->GetLineEnd(nPos), nPos, pLineEndList->GetUiBitmap(nPos));
                m_pLbLineEnds->SelectEntryPos( nPos );
                m_xLbLineEnds->Modify(*pLineEndList->GetLineEnd(nPos), nPos, pLineEndList->GetUiBitmap(nPos));
                m_xLbLineEnds->set_active(nPos);

                // set flag for modified
                *pnLineEndListState |= ChangeType::MODIFIED;
@@ -372,8 +351,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void)
    }
}


IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
    if( pPolyObj )
    {
@@ -427,7 +405,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void)
        }

        SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
        ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc ));
        ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetDialogFrameWeld(), aName, aDesc ));
        bool bLoop = true;

        while ( bLoop && pDlg->Execute() == RET_OK )
@@ -445,78 +423,76 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void)
            {
                bLoop = false;

                long nLineEndCount = pLineEndList->Count();
                auto nLineEndCount = pLineEndList->Count();
                pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNewPolyPolygon, aName), nLineEndCount);

                // add to the ListBox
                m_pLbLineEnds->Append(*pLineEndList->GetLineEnd(nLineEndCount), pLineEndList->GetUiBitmap(nLineEndCount));
                m_pLbLineEnds->SelectEntryPos( m_pLbLineEnds->GetEntryCount() - 1 );
                m_xLbLineEnds->Append(*pLineEndList->GetLineEnd(nLineEndCount), pLineEndList->GetUiBitmap(nLineEndCount));
                m_xLbLineEnds->set_active(m_xLbLineEnds->get_count() - 1);

                *pnLineEndListState |= ChangeType::MODIFIED;

                SelectLineEndHdl_Impl( *m_pLbLineEnds );
                SelectLineEndHdl_Impl();
            }
            else
            {
                std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui"));
                std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/queryduplicatedialog.ui"));
                std::unique_ptr<weld::MessageDialog> xWarningBox(xBuilder->weld_message_dialog("DuplicateNameDialog"));
                xWarningBox->run();
            }
        }
    }
    else
        m_pBtnAdd->Disable();
        m_xBtnAdd->set_sensitive(false);

    // determine button state
    if ( pLineEndList->Count() )
    {
        m_pBtnModify->Enable();
        m_pBtnDelete->Enable();
        m_pBtnSave->Enable();
        m_xBtnModify->set_sensitive(true);
        m_xBtnDelete->set_sensitive(true);
        m_xBtnSave->set_sensitive(true);
    }
}


IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickDeleteHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickDeleteHdl_Impl, weld::Button&, void)
{
    sal_Int32 nPos = m_pLbLineEnds->GetSelectedEntryPos();
    int nPos = m_xLbLineEnds->get_active();

    if( nPos != LISTBOX_ENTRY_NOTFOUND )
    if (nPos != -1)
    {
        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletelineenddialog.ui"));
        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querydeletelineenddialog.ui"));
        std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelLineEndDialog"));

        if (xQueryBox->run() == RET_YES)
        {
            pLineEndList->Remove(nPos);
            m_pLbLineEnds->RemoveEntry( nPos );
            m_pLbLineEnds->SelectEntryPos( 0 );
            m_xLbLineEnds->remove(nPos);
            m_xLbLineEnds->set_active(0);

            SelectLineEndHdl_Impl( *m_pLbLineEnds );
            SelectLineEndHdl_Impl();
            *pPageType = PageType::Area; // LineEnd shall not be taken over

            *pnLineEndListState |= ChangeType::MODIFIED;

            m_pCtlPreview->Invalidate();
            m_aCtlPreview.Invalidate();
        }
    }
    // determine button state
    if( !pLineEndList->Count() )
    {
        m_pBtnModify->Disable();
        m_pBtnDelete->Disable();
        m_pBtnSave->Disable();
        m_xBtnModify->set_sensitive(false);
        m_xBtnDelete->set_sensitive(false);
        m_xBtnSave->set_sensitive(false);
    }
}


IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, weld::Button&, void)
{
    sal_uInt16 nReturn = RET_YES;

    if ( *pnLineEndListState & ChangeType::MODIFIED )
    {
        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querysavelistdialog.ui"));
        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querysavelistdialog.ui"));
        std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("AskSaveList"));

        nReturn = xBox->run();
@@ -528,7 +504,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void)
    if ( nReturn != RET_CANCEL )
    {
        ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
                                      FileDialogFlags::NONE, GetFrameWeld());
                                      FileDialogFlags::NONE, GetDialogFrameWeld());
        OUString aStrFilterType( "*.soe" );
        aDlg.AddFilter( aStrFilterType, aStrFilterType );

@@ -561,8 +537,8 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void)
            {
                pLineEndList = pLeList;
                static_cast<SvxLineTabDialog*>( GetParentDialog() )->SetNewLineEndList( pLineEndList );
                m_pLbLineEnds->Clear();
                m_pLbLineEnds->Fill( pLineEndList );
                m_xLbLineEnds->clear();
                m_xLbLineEnds->Fill( pLineEndList );
                Reset( &rOutAttrs );

                pLineEndList->SetName( aURL.getName() );
@@ -572,7 +548,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void)
            }
            else
            {
                std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui"));
                std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querynoloadedfiledialog.ui"));
                std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoLoadedFileDialog"));
                xBox->run();
            }
@@ -582,22 +558,21 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void)
    // determine button state
    if ( pLineEndList->Count() )
    {
        m_pBtnModify->Enable();
        m_pBtnDelete->Enable();
        m_pBtnSave->Enable();
        m_xBtnModify->set_sensitive(true);
        m_xBtnDelete->set_sensitive(true);
        m_xBtnSave->set_sensitive(true);
    }
    else
    {
        m_pBtnModify->Disable();
        m_pBtnDelete->Disable();
        m_pBtnSave->Disable();
        m_xBtnModify->set_sensitive(false);
        m_xBtnDelete->set_sensitive(false);
        m_xBtnSave->set_sensitive(false);
    }
}


IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl, Button*, void)
IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl, weld::Button&, void)
{
    ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, GetFrameWeld());
    ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, GetDialogFrameWeld());
    OUString aStrFilterType( "*.soe" );
    aDlg.AddFilter( aStrFilterType, aStrFilterType );

@@ -640,7 +615,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl, Button*, void)
        }
        else
        {
            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynosavefiledialog.ui"));
            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querynosavefiledialog.ui"));
            std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoSaveFileDialog"));
            xBox->run();
        }
@@ -653,10 +628,10 @@ void SvxLineEndDefTabPage::DataChanged( const DataChangedEvent& rDCEvt )

    if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
    {
        sal_Int32 nOldSelect = m_pLbLineEnds->GetSelectedEntryPos();
        m_pLbLineEnds->Clear();
        m_pLbLineEnds->Fill( pLineEndList );
        m_pLbLineEnds->SelectEntryPos( nOldSelect );
        auto nOldSelect = m_xLbLineEnds->get_active();
        m_xLbLineEnds->clear();
        m_xLbLineEnds->Fill(pLineEndList);
        m_xLbLineEnds->set_active(nOldSelect);
    }
}

diff --git a/cui/uiconfig/ui/lineendstabpage.ui b/cui/uiconfig/ui/lineendstabpage.ui
index 3668c13..81145b0 100644
--- a/cui/uiconfig/ui/lineendstabpage.ui
+++ b/cui/uiconfig/ui/lineendstabpage.ui
@@ -1,7 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
  <!-- interface-requires gtk+ 3.0 -->
  <!-- interface-requires LibreOffice 1.0 -->
  <requires lib="gtk+" version="3.0"/>
  <object class="GtkImage" id="image1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">res/sc05501.png</property>
  </object>
  <object class="GtkImage" id="image2">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="icon_name">res/sc05502.png</property>
  </object>
  <object class="GtkListStore" id="liststore4">
    <columns>
      <!-- column-name text -->
      <column type="gchararray"/>
      <!-- column-name id -->
      <column type="gchararray"/>
      <!-- column-name image -->
      <column type="GdkPixbuf"/>
    </columns>
  </object>
  <object class="GtkFrame" id="LineEndPage">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
@@ -45,31 +65,27 @@
                      <object class="GtkLabel" id="FT_TITLE">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="lineendstabpage|FT_TITLE">_Title:</property>
                        <property name="use_underline">True</property>
                        <property name="mnemonic_widget">EDT_NAME</property>
                        <property name="xalign">0</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="FT_LINE_END_STYLE">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="lineendstabpage|FT_LINE_END_STYLE">Arrow _style:</property>
                        <property name="use_underline">True</property>
                        <property name="xalign">0</property>
                      </object>
                      <packing>
                        <property name="left_attach">0</property>
                        <property name="top_attach">1</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
@@ -83,21 +99,19 @@
                      <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="svxlo-LineEndLB" id="LB_LINEENDS">
                      <object class="GtkComboBox" id="LB_LINEENDS">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="halign">start</property>
                        <property name="model">liststore4</property>
                        <property name="id_column">1</property>
                      </object>
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="top_attach">1</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
@@ -106,14 +120,13 @@
                        <property name="can_focus">False</property>
                        <property name="valign">end</property>
                        <property name="vexpand">True</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="lineendstabpage|FI_TIP">Add a selected object to create new arrow styles.</property>
                        <property name="xalign">0</property>
                      </object>
                      <packing>
                        <property name="left_attach">0</property>
                        <property name="top_attach">2</property>
                        <property name="width">2</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                  </object>
@@ -194,8 +207,6 @@
                          <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>
@@ -212,8 +223,6 @@
                          <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>
                      </object>
@@ -246,9 +255,24 @@
                <property name="orientation">vertical</property>
                <property name="spacing">6</property>
                <child>
                  <object class="svxlo-SvxXLinePreview" id="CTL_PREVIEW">
                  <object class="GtkScrolledWindow">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hscrollbar_policy">never</property>
                    <property name="vscrollbar_policy">never</property>
                    <property name="shadow_type">in</property>
                    <child>
                      <object class="GtkViewport">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkDrawingArea" id="CTL_PREVIEW">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
@@ -271,22 +295,12 @@
      <object class="GtkLabel" id="label1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="xalign">0</property>
        <property name="label" translatable="yes" context="lineendstabpage|label1">Organize Arrow Styles</property>
        <property name="xalign">0</property>
        <attributes>
          <attribute name="weight" value="bold"/>
        </attributes>
      </object>
    </child>
  </object>
  <object class="GtkImage" id="image1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="pixbuf">res/sc05501.png</property>
  </object>
  <object class="GtkImage" id="image2">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="pixbuf">res/sc05502.png</property>
  </object>
</interface>
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 90c4fc6..2061a21 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -268,7 +268,6 @@ public:
    void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );
};


/************************************************************************/

class SAL_WARN_UNUSED SVX_DLLPUBLIC LineEndLB : public ListBox
@@ -283,6 +282,27 @@ public:
    void    Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );
};

class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLineEndLB
{
private:
    std::unique_ptr<weld::ComboBox> m_xControl;

public:
    SvxLineEndLB(std::unique_ptr<weld::ComboBox> pControl);

    void Fill( const XLineEndListRef &pList, bool bStart = true );

    void    Append( const XLineEndEntry& rEntry, const BitmapEx& rBitmap );
    void    Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap );

    void clear() { m_xControl->clear(); }
    void remove(int nPos) { m_xControl->remove(nPos); }
    int get_active() const { return m_xControl->get_active(); }
    void set_active(int nPos) { m_xControl->set_active(nPos); }
    OUString get_active_text() const { return m_xControl->get_active_text(); }
    void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
    int get_count() const { return m_xControl->get_count(); }
};

class SdrObject;
class SdrPathObj;
@@ -353,6 +373,11 @@ public:
        mpBufferDevice->SetDrawMode(nDrawMode);
    }

    Size GetOutputSize() const
    {
        return mpBufferDevice->PixelToLogic(GetOutputSizePixel());
    }

    // dada read access
    SdrModel& getModel() const
    {
@@ -398,6 +423,32 @@ public:
    virtual Size GetOptimalSize() const override;
};

class SAL_WARN_UNUSED SVX_DLLPUBLIC XLinePreview : public PreviewBase
{
private:
    SdrPathObj*                                     mpLineObjA;
    SdrPathObj*                                     mpLineObjB;
    SdrPathObj*                                     mpLineObjC;

    Graphic*                                        mpGraphic;
    bool                                            mbWithSymbol;
    Size                                            maSymbolSize;

public:
    XLinePreview();
    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
    virtual ~XLinePreview() override;

    void SetLineAttributes(const SfxItemSet& rItemSet);

    void ShowSymbol( bool b ) { mbWithSymbol = b; };
    void SetSymbol( Graphic* p, const Size& s );
    void ResizeSymbol( const Size& s );

    virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
    virtual void Resize() override;
};

class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXRectPreview : public PreviewBase
{
private:
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 1ca91e7..ddfd104 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -258,12 +258,20 @@ protected:
public:
    virtual void insert_text(int pos, const OUString& rStr) = 0;
    void append_text(const OUString& rStr) { insert_text(-1, rStr); }
    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pImage)
    virtual void insert(int pos, const OUString& rId, const OUString& rStr,
                        const OUString* pIconName, VirtualDevice* pImageSufface)
        = 0;
    void append(const OUString& rId, const OUString& rStr) { insert(-1, rId, rStr, nullptr); }
    void append(const OUString& rId, const OUString& rStr)
    {
        insert(-1, rId, rStr, nullptr, nullptr);
    }
    void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
    {
        insert(-1, rId, rStr, &rImage);
        insert(-1, rId, rStr, &rImage, nullptr);
    }
    void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
    {
        insert(-1, rId, rStr, nullptr, &rImage);
    }

    virtual int get_count() const = 0;
@@ -318,13 +326,21 @@ protected:

public:
    virtual void insert_text(const OUString& rText, int pos) = 0;
    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pImage)
    virtual void insert(int pos, const OUString& rId, const OUString& rStr,
                        const OUString* pIconName, VirtualDevice* pImageSurface)
        = 0;
    void append_text(const OUString& rText) { insert_text(rText, -1); }
    void append(const OUString& rId, const OUString& rStr) { insert(-1, rId, rStr, nullptr); }
    void append(const OUString& rId, const OUString& rStr)
    {
        insert(-1, rId, rStr, nullptr, nullptr);
    }
    void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
    {
        insert(-1, rId, rStr, &rImage);
        insert(-1, rId, rStr, &rImage, nullptr);
    }
    void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
    {
        insert(-1, rId, rStr, nullptr, &rImage);
    }

    void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
@@ -630,9 +646,9 @@ public:
        m_xTreeView->insert_text(rStr, pos);
    }
    virtual void insert(int pos, const OUString& rId, const OUString& rStr,
                        const OUString* pImage) override
                        const OUString* pIconName, VirtualDevice* pImageSurface) override
    {
        m_xTreeView->insert(pos, rId, rStr, pImage);
        m_xTreeView->insert(pos, rId, rStr, pIconName, pImageSurface);
    }

    virtual int get_count() const override { return m_xTreeView->n_children(); }
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 9052f5d..95762ac 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -220,7 +220,7 @@ void ScMoveTableDlg::InitDocListBox()
                aEntryName += msCurrentDoc;
            }

            m_xLbDoc->insert(i, OUString::number(reinterpret_cast<sal_uInt64>(&pScSh->GetDocument())), aEntryName, nullptr);
            m_xLbDoc->insert(i, OUString::number(reinterpret_cast<sal_uInt64>(&pScSh->GetDocument())), aEntryName, nullptr, nullptr);

            i++;
        }
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 683264b..403876b 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -550,8 +550,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, UpHdl, weld::Button&, void)
        m_xImagesLst->remove_text(sActEntry);
        m_xImagesLst->remove_text(sUpperEntry);

        m_xImagesLst->insert(nActPos - 1, sAct, sActEntry, nullptr);
        m_xImagesLst->insert(nActPos, sUpper, sUpperEntry, nullptr);
        m_xImagesLst->insert(nActPos - 1, sAct, sActEntry, nullptr, nullptr);
        m_xImagesLst->insert(nActPos, sUpper, sUpperEntry, nullptr, nullptr);

        m_xImagesLst->select(nActPos - 1);
    }
@@ -573,8 +573,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, DownHdl, weld::Button&, void)
        m_xImagesLst->remove_text(sActEntry);
        m_xImagesLst->remove_text(sDownEntry);

        m_xImagesLst->insert(nActPos, sDown, sDownEntry, nullptr);
        m_xImagesLst->insert(nActPos + 1, sAct, sActEntry, nullptr);
        m_xImagesLst->insert(nActPos, sDown, sDownEntry, nullptr, nullptr);
        m_xImagesLst->insert(nActPos + 1, sAct, sActEntry, nullptr, nullptr);

        m_xImagesLst->select(nActPos + 1);
    }
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index 3dfc611..b7b3840 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -378,7 +378,7 @@ void SdDefineCustomShowDlg::ClickButtonHdl2(void const * p)
            {
                OUString aStr = m_xLbPages->get_text(i);
                SdPage* pPage = rDoc.GetSdPage(i, PageKind::Standard);
                m_xLbCustomPages->insert(nPosCP, OUString::number(reinterpret_cast<sal_uInt64>(pPage)), aStr, nullptr);
                m_xLbCustomPages->insert(nPosCP, OUString::number(reinterpret_cast<sal_uInt64>(pPage)), aStr, nullptr, nullptr);
                m_xLbCustomPages->select(nPosCP != -1 ? nPosCP : m_xLbCustomPages->n_children() - 1);

                if (nPosCP != -1)
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 4cef840..4daa88b 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -200,7 +200,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
                 rTupel.nFlags != SfxStyleSearchBits::AllVisible &&
                 rTupel.nFlags != SfxStyleSearchBits::All )
            {
                m_xFilterLb->insert(nIdx, OUString::number(i), rTupel.aName, nullptr);
                m_xFilterLb->insert(nIdx, OUString::number(i), rTupel.aName, nullptr, nullptr);
                if ( ( rTupel.nFlags & nMask ) == nMask )
                    nStyleFilterIdx = nIdx;
                ++nIdx;
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 1ff8801..a6dfa35 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1682,7 +1682,7 @@ void SvtFontSizeBox::Fill( const FontMetric* pFontMetric, const FontList* pList 
                OUString    aSizeName = aFontSizeNames.GetIndexName( i );
                sal_IntPtr  nSize = aFontSizeNames.GetIndexSize( i );
                OUString sId(OUString::number(-nSize)); // mark as special
                m_xComboBox->insert(nPos, sId, aSizeName, nullptr);
                m_xComboBox->insert(nPos, sId, aSizeName, nullptr, nullptr);
                nPos++;
            }
        }
@@ -1696,7 +1696,7 @@ void SvtFontSizeBox::Fill( const FontMetric* pFontMetric, const FontList* pList 
                if ( !aSizeName.isEmpty() )
                {
                    OUString sId(OUString::number(-(*pTempAry))); // mark as special
                    m_xComboBox->insert(nPos, sId, aSizeName, nullptr);
                    m_xComboBox->insert(nPos, sId, aSizeName, nullptr, nullptr);
                    nPos++;
                }
                pTempAry++;
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 0750a53..f75661d 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1176,6 +1176,73 @@ void LineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const Bitma
    }
}

SvxLineEndLB::SvxLineEndLB(std::unique_ptr<weld::ComboBox> pControl)
    : m_xControl(std::move(pControl))
{
}

void SvxLineEndLB::Fill( const XLineEndListRef &pList, bool bStart )
{
    if( !pList.is() )
        return;

    long nCount = pList->Count();
    ScopedVclPtrInstance< VirtualDevice > pVD;
    m_xControl->freeze();

    for( long i = 0; i < nCount; i++ )
    {
        const XLineEndEntry* pEntry = pList->GetLineEnd(i);
        const BitmapEx aBitmap = pList->GetUiBitmap( i );
        if( !aBitmap.IsEmpty() )
        {
            const Size aBmpSize(aBitmap.GetSizePixel());
            pVD->SetOutputSizePixel(Size(aBmpSize.Width() / 2, aBmpSize.Height()), false);
            pVD->DrawBitmapEx(bStart ? Point() : Point(aBmpSize.Width() / 2, 0), aBitmap);
            m_xControl->append("", pEntry->GetName(), *pVD);
        }
        else
            m_xControl->append_text(pEntry->GetName());
    }

    m_xControl->thaw();
}

void SvxLineEndLB::Append( const XLineEndEntry& rEntry, const BitmapEx& rBitmap )
{
    if(!rBitmap.IsEmpty())
    {
        ScopedVclPtrInstance< VirtualDevice > pVD;

        const Size aBmpSize(rBitmap.GetSizePixel());
        pVD->SetOutputSizePixel(Size(aBmpSize.Width() / 2, aBmpSize.Height() / 2), false);
        pVD->DrawBitmapEx(Point(aBmpSize.Width() / 2, 0), rBitmap);
        m_xControl->append("", rEntry.GetName(), *pVD);
    }
    else
    {
        m_xControl->append_text(rEntry.GetName());
    }
}

void SvxLineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap )
{
    m_xControl->remove(nPos);

    if(!rBitmap.IsEmpty())
    {
        ScopedVclPtrInstance< VirtualDevice > pVD;

        const Size aBmpSize(rBitmap.GetSizePixel());
        pVD->SetOutputSizePixel(Size(aBmpSize.Width() / 2, aBmpSize.Height() / 2), false);
        pVD->DrawBitmapEx(Point(aBmpSize.Width() / 2, 0), rBitmap);
        m_xControl->insert(nPos, "", rEntry.GetName(), nullptr, pVD);
    }
    else
    {
        m_xControl->insert_text(nPos, rEntry.GetName());
    }
}

void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground)
{
@@ -1456,6 +1523,134 @@ void SvxXLinePreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
    LocalPostPaint(rRenderContext);
}

void XLinePreview::Resize()
{
    PreviewBase::Resize();

    const Size aOutputSize(GetOutputSize());
    const sal_Int32 nDistance(500);
    const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance));

    // create DrawObectA
    const sal_Int32 aYPosA(aOutputSize.Height() / 2);
    const basegfx::B2DPoint aPointA1( nDistance,  aYPosA);
    const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA );
    basegfx::B2DPolygon aPolygonA;
    aPolygonA.append(aPointA1);
    aPolygonA.append(aPointA2);
    mpLineObjA->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonA));

    // create DrawObectB
    const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4);
    const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4);
    const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance,  aYPosB1);
    const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 );
    const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 );
    basegfx::B2DPolygon aPolygonB;
    aPolygonB.append(aPointB1);
    aPolygonB.append(aPointB2);
    aPolygonB.append(aPointB3);
    mpLineObjB->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonB));

    // create DrawObectC
    basegfx::B2DPolygon aPolygonC;
    const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance,  aYPosB1);
    const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 );
    const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 );
    aPolygonC.append(aPointC1);
    aPolygonC.append(aPointC2);
    aPolygonC.append(aPointC3);
    mpLineObjC->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonC));
}

XLinePreview::XLinePreview()
    : mpLineObjA(nullptr)
    , mpLineObjB(nullptr)
    , mpLineObjC(nullptr)
    , mpGraphic(nullptr)
    , mbWithSymbol(false)
{
}

void XLinePreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
    PreviewBase::SetDrawingArea(pDrawingArea);

    mpLineObjA = new SdrPathObj(getModel(), OBJ_LINE);
    mpLineObjB = new SdrPathObj(getModel(), OBJ_PLIN);
    mpLineObjC = new SdrPathObj(getModel(), OBJ_PLIN);

    Resize();
    Invalidate();
}

XLinePreview::~XLinePreview()
{
    SdrObject *pFoo = mpLineObjA;
    SdrObject::Free( pFoo );
    pFoo = mpLineObjB;
    SdrObject::Free( pFoo );
    pFoo = mpLineObjC;
    SdrObject::Free( pFoo );
}

void XLinePreview::SetSymbol(Graphic* p,const Size& s)
{
    mpGraphic = p;
    maSymbolSize = s;
}

void XLinePreview::ResizeSymbol(const Size& s)
{
    if ( s != maSymbolSize )
    {
        maSymbolSize = s;
        Invalidate();
    }
}

void XLinePreview::SetLineAttributes(const SfxItemSet& rItemSet)
{
    // Set ItemSet at objects
    mpLineObjA->SetMergedItemSet(rItemSet);

    // At line joints, do not use arrows
    SfxItemSet aTempSet(rItemSet);
    aTempSet.ClearItem(XATTR_LINESTART);
    aTempSet.ClearItem(XATTR_LINEEND);

    mpLineObjB->SetMergedItemSet(aTempSet);
    mpLineObjC->SetMergedItemSet(aTempSet);
}

void XLinePreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
    LocalPrePaint(rRenderContext);

    // paint objects to buffer device
    sdr::contact::SdrObjectVector aObjectVector;
    aObjectVector.push_back(mpLineObjA);
    aObjectVector.push_back(mpLineObjB);
    aObjectVector.push_back(mpLineObjC);

    sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, nullptr);
    sdr::contact::DisplayInfo aDisplayInfo;

    // do processing
    aPainter.ProcessDisplay(aDisplayInfo);

    if ( mbWithSymbol && mpGraphic )
    {
        const Size aOutputSize(GetOutputSize());
        Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
        aPos.AdjustX( -(maSymbolSize.Width() / 2) );
        aPos.AdjustY( -(maSymbolSize.Height() / 2) );
        mpGraphic->Draw(&getBufferDevice(), aPos, maSymbolSize);
    }

    LocalPostPaint(rRenderContext);
}

SvxXShadowPreview::SvxXShadowPreview()
    : mpRectangleObject(nullptr)
    , mpRectangleShadow(nullptr)
@@ -1565,6 +1760,10 @@ PreviewBase::PreviewBase()
void PreviewBase::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
    CustomWidgetController::SetDrawingArea(pDrawingArea);
    Size aSize(getPreviewStripSize(pDrawingArea->get_ref_device()));
    pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
    SetOutputSizePixel(aSize);

    mpBufferDevice = VclPtr<VirtualDevice>::Create(pDrawingArea->get_ref_device());
    mpBufferDevice->SetMapMode(MapMode(MapUnit::Map100thMM));
}
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 4d270ba..177b2cd 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -189,7 +189,7 @@ SwColumnDlg::SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh)
    {
        const OUString sPageStr = pApplyToLB->get_text(nPagePos) + pPageDesc->GetName();
        pApplyToLB->remove(nPagePos);
        pApplyToLB->insert(nPagePos, OUString::number(LISTBOX_PAGE), sPageStr, nullptr);
        pApplyToLB->insert(nPagePos, OUString::number(LISTBOX_PAGE), sPageStr, nullptr, nullptr);
    }
    else
        pApplyToLB->remove( nPagePos );
diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx
index f66f6a4..3965461 100644
--- a/sw/source/uibase/misc/numberingtypelistbox.cxx
+++ b/sw/source/uibase/misc/numberingtypelistbox.cxx
@@ -113,7 +113,7 @@ void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags)
        }
        if (bInsert)
        {
            m_xWidget->insert(nPos, OUString::number(nValue), SvxNumberingTypeTable::GetString(i), nullptr);
            m_xWidget->insert(nPos, OUString::number(nValue), SvxNumberingTypeTable::GetString(i), nullptr, nullptr);
        }
    }
    if (nTypeFlags & SwInsertNumTypes::Extended)
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index de16210..5065835 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -687,7 +687,7 @@ void InsertStringSorted(const OUString& rId, const OUString& rEntry, weld::Combo
            break;
        ++nOffset;
    }
    rToFill.insert(nOffset, rId, rEntry, nullptr);
    rToFill.insert(nOffset, rId, rEntry, nullptr, nullptr);
}

void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, bool bSorted, bool bWithDefault)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f329503..d70cae8 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1610,6 +1610,11 @@ namespace
        }
        return Image(BitmapEx(rImage));
    }

    Image createImage(VirtualDevice& rDevice)
    {
        return Image(BitmapEx(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSizePixel())));
    }
}

class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
@@ -1634,14 +1639,16 @@ public:
        m_xTreeView->InsertEntry(rText, pos == -1 ? LISTBOX_APPEND : pos);
    }

    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pImage) override
    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface) override
    {
        auto nInsertPos = pos == -1 ? COMBOBOX_APPEND : pos;
        sal_Int32 nInsertedAt;
        if (!pImage)
        if (!pIconName && !pImageSurface)
            nInsertedAt = m_xTreeView->InsertEntry(rStr, nInsertPos);
        else if (pIconName)
            nInsertedAt = m_xTreeView->InsertEntry(rStr, createImage(*pIconName), nInsertPos);
        else
            nInsertedAt = m_xTreeView->InsertEntry(rStr, createImage(*pImage), nInsertPos);
            nInsertedAt = m_xTreeView->InsertEntry(rStr, createImage(*pImageSurface), nInsertPos);
        m_xTreeView->SetEntryData(nInsertedAt, new OUString(rId));
    }

@@ -2316,14 +2323,16 @@ public:
        m_xComboBox->RemoveEntry(pos);
    }

    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pImage) override
    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface) override
    {
        auto nInsertPos = pos == -1 ? COMBOBOX_APPEND : pos;
        sal_Int32 nInsertedAt;
        if (!pImage)
        if (!pIconName && !pImageSurface)
            nInsertedAt = m_xComboBox->InsertEntry(rStr, nInsertPos);
        else if (pIconName)
            nInsertedAt = m_xComboBox->InsertEntry(rStr, createImage(*pIconName), nInsertPos);
        else
            nInsertedAt = m_xComboBox->InsertEntry(rStr, createImage(*pImage), nInsertPos);
            nInsertedAt = m_xComboBox->InsertEntry(rStr, createImage(*pImageSurface), nInsertPos);
        m_xComboBox->SetEntryData(nInsertedAt, new OUString(rId));
    }

@@ -2410,14 +2419,16 @@ public:
        m_xComboBox->RemoveEntryAt(pos);
    }

    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pImage) override
    virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface) override
    {
        auto nInsertPos = pos == -1 ? COMBOBOX_APPEND : pos;
        sal_Int32 nInsertedAt;
        if (!pImage)
        if (!pIconName && !pImageSurface)
            nInsertedAt = m_xComboBox->InsertEntry(rStr, nInsertPos);
        else if (pIconName)
            nInsertedAt = m_xComboBox->InsertEntryWithImage(rStr, createImage(*pIconName), nInsertPos);
        else
            nInsertedAt = m_xComboBox->InsertEntryWithImage(rStr, createImage(*pImage), nInsertPos);
            nInsertedAt = m_xComboBox->InsertEntryWithImage(rStr, createImage(*pImageSurface), nInsertPos);
        m_xComboBox->SetEntryData(nInsertedAt, new OUString(rId));
    }

diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index 2a75f30..45efe3d 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -329,7 +329,7 @@ RTSDevicePage::RTSDevicePage(weld::Widget* pPage, RTSDialog* pParent)
            || int(bAutoIsPDF) == m_pParent->m_aJobData.m_nPDFDevice);

    OUString sStr = m_xLevelBox->get_text(0);
    m_xLevelBox->insert(0, m_xLevelBox->get_id(0), sStr.replaceAll("%s", bAutoIsPDF ? m_xLevelBox->get_text(5) : m_xLevelBox->get_text(1)), nullptr);
    m_xLevelBox->insert(0, m_xLevelBox->get_id(0), sStr.replaceAll("%s", bAutoIsPDF ? m_xLevelBox->get_text(5) : m_xLevelBox->get_text(1)), nullptr, nullptr);
    m_xLevelBox->remove(1);

    for (int i = 0; i < m_xLevelBox->get_count(); ++i)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f34dda6..033c0be 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2778,6 +2778,14 @@ namespace
        OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47();
        return load_icon_by_name(rIconName, sIconTheme, sUILang);
    }

    GdkPixbuf* load_icon_from_surface(VirtualDevice& rDevice)
    {
        Size aSize(rDevice.GetOutputSizePixel());
        cairo_surface_t* surface = get_underlying_cairo_surface(rDevice);
        return gdk_pixbuf_get_from_surface(surface, 0, 0, aSize.Width(), aSize.Height());
    }

}

class GtkInstanceButton : public GtkInstanceContainer, public virtual weld::Button
@@ -3181,13 +3189,11 @@ public:
        }
        if (pDevice)
        {
            cairo_surface_t* surface = get_underlying_cairo_surface(*pDevice);
            if (gtk_check_version(3, 20, 0) == nullptr)
                gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
            else
            {
                Size aSize(pDevice->GetOutputSizePixel());
                GdkPixbuf* pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, aSize.Width(), aSize.Height());
                GdkPixbuf* pixbuf = load_icon_from_surface(*pDevice);
                gtk_image_set_from_pixbuf(m_pImage, pixbuf);
                g_object_unref(pixbuf);
            }
@@ -3646,11 +3652,11 @@ namespace
        return found;
    }

    void insert_row(GtkListStore* pListStore, int pos, const OUString& rId, const OUString& rText, const OUString* pImage)
    void insert_row(GtkListStore* pListStore, int pos, const OUString& rId, const OUString& rText, const OUString* pIconName, VirtualDevice* pDevice)
    {
        GtkTreeIter iter;
        gtk_list_store_insert(pListStore, &iter, pos);
        if (!pImage)
        if (!pIconName && !pDevice)
        {
            gtk_list_store_set(pListStore, &iter,
                    0, OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
@@ -3661,21 +3667,29 @@ namespace
        {
            GdkPixbuf* pixbuf = nullptr;

            if (pImage->lastIndexOf('.') != pImage->getLength() - 4)
            if (pIconName)
            {
                assert((*pImage == "dialog-warning" || *pImage == "dialog-error" || *pImage == "dialog-information") && "unknown stock image");
                if (pIconName->lastIndexOf('.') != pIconName->getLength() - 4)
                {
                    assert((*pIconName== "dialog-warning" || *pIconName== "dialog-error" ||*pIconName== "dialog-information") &&
                           "unknown stock image");

                GError *error = nullptr;
                GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
                pixbuf = gtk_icon_theme_load_icon(icon_theme, OUStringToOString(*pImage, RTL_TEXTENCODING_UTF8).getStr(),
                                                  16, GTK_ICON_LOOKUP_USE_BUILTIN, &error);
                    GError *error = nullptr;
                    GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
                    pixbuf = gtk_icon_theme_load_icon(icon_theme, OUStringToOString(*pIconName, RTL_TEXTENCODING_UTF8).getStr(),
                                                      16, GTK_ICON_LOOKUP_USE_BUILTIN, &error);
                }
                else
                {
                    const AllSettings& rSettings = Application::GetSettings();
                    pixbuf = load_icon_by_name(*pIconName,
                                               rSettings.GetStyleSettings().DetermineIconTheme(),
                                               rSettings.GetUILanguageTag().getBcp47());
                }
            }
            else
            {
                const AllSettings& rSettings = Application::GetSettings();
                pixbuf = load_icon_by_name(*pImage,
                                           rSettings.GetStyleSettings().DetermineIconTheme(),
                                           rSettings.GetUILanguageTag().getBcp47());
                pixbuf = load_icon_from_surface(*pDevice);
            }

            gtk_list_store_set(pListStore, &iter,
@@ -3754,10 +3768,10 @@ public:
        enable_notify_events();
    }

    virtual void insert(int pos, const OUString& rId, const OUString& rText, const OUString* pImage) override
    virtual void insert(int pos, const OUString& rId, const OUString& rText, const OUString* pIconName, VirtualDevice* pImageSurface) override
    {
        disable_notify_events();
        insert_row(m_pListStore, pos, rId, rText, pImage);
        insert_row(m_pListStore, pos, rId, rText, pIconName, pImageSurface);
        enable_notify_events();
    }

@@ -4876,10 +4890,10 @@ public:
        enable_notify_events();
    }

    virtual void insert(int pos, const OUString& rId, const OUString& rText, const OUString* pImage) override
    virtual void insert(int pos, const OUString& rId, const OUString& rText, const OUString* pIconName, VirtualDevice* pImageSurface) override
    {
        disable_notify_events();
        insert_row(GTK_LIST_STORE(gtk_combo_box_get_model(m_pComboBox)), pos, rId, rText, pImage);
        insert_row(GTK_LIST_STORE(gtk_combo_box_get_model(m_pComboBox)), pos, rId, rText, pIconName, pImageSurface);
        enable_notify_events();
    }