Resolves: tdf#120423 dispatch against the correct Frame

Change-Id: I5ea2e5d7b79efbd2b14d0b528e5a5c3e44e643bc
Reviewed-on: https://gerrit.libreoffice.org/72292
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Tested-by: Jenkins
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index 0a96696..668c433 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -168,7 +168,7 @@ void ChartController::executeDispatch_InsertSpecialCharacter()
    aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) );

    vcl::Window* pWin = GetChartWindow();
    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet, false));
    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet, nullptr));
    if( pDlg->Execute() == RET_OK )
    {
        const SfxItemSet* pSet = pDlg->GetOutputItemSet();
diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx
index 90d181d..0b5d3b1 100644
--- a/comphelper/source/misc/dispatchcommand.cxx
+++ b/comphelper/source/misc/dispatchcommand.cxx
@@ -31,22 +31,15 @@ using namespace css;

namespace comphelper {

bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, const uno::Reference<css::frame::XDispatchResultListener>& aListener)
bool dispatchCommand(const OUString& rCommand, const uno::Reference<css::frame::XFrame>& rFrame, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, const uno::Reference<css::frame::XDispatchResultListener>& rListener)
{
    // Target where we will execute the .uno: command
    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
    uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);

    uno::Reference<frame::XFrame> xFrame(xDesktop->getActiveFrame());
    if (!xFrame.is())
        xFrame.set(xDesktop, uno::UNO_QUERY);

    uno::Reference<frame::XDispatchProvider> xDispatchProvider(xFrame, uno::UNO_QUERY);
    uno::Reference<frame::XDispatchProvider> xDispatchProvider(rFrame, uno::UNO_QUERY);
    if (!xDispatchProvider.is())
        return false;

    util::URL aCommandURL;
    aCommandURL.Complete = rCommand;
    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
    uno::Reference<util::XURLTransformer> xParser = util::URLTransformer::create(xContext);
    xParser->parseStrict(aCommandURL);

@@ -57,13 +50,26 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea
    // And do the work...
    uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
    if (xNotifyingDisp.is())
        xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
        xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, rListener);
    else
        xDisp->dispatch(aCommandURL, rArguments);

    return true;
}

bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, const uno::Reference<css::frame::XDispatchResultListener>& rListener)
{
    // Target where we will execute the .uno: command
    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
    uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);

    uno::Reference<frame::XFrame> xFrame(xDesktop->getActiveFrame());
    if (!xFrame.is())
        xFrame.set(xDesktop, uno::UNO_QUERY);

    return dispatchCommand(rCommand, xFrame, rArguments, rListener);
}

} // namespace comphelper

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index e83fdbe..807b772 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -52,11 +52,12 @@

using namespace css;

SvxCharacterMap::SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet, bool bInsert)
SvxCharacterMap::SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet,
                                 const css::uno::Reference<css::frame::XFrame>& rFrame)
    : SfxDialogController(pParent, "cui/ui/specialcharacters.ui", "SpecialCharactersDialog")
    , m_xVirDev(VclPtr<VirtualDevice>::Create())
    , isSearchMode(true)
    , m_bHasInsert(bInsert)
    , m_xFrame(rFrame)
    , mxContext(comphelper::getProcessComponentContext())
    , m_aRecentCharView{SvxCharView(m_xVirDev),
                        SvxCharView(m_xVirDev),
@@ -91,7 +92,7 @@ SvxCharacterMap::SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet, 
                     SvxCharView(m_xVirDev),
                     SvxCharView(m_xVirDev)}
    , m_aShowChar(m_xVirDev)
    , m_xOKBtn(bInsert ? m_xBuilder->weld_button("insert") : m_xBuilder->weld_button("ok"))
    , m_xOKBtn(m_xFrame.is() ? m_xBuilder->weld_button("insert") : m_xBuilder->weld_button("ok"))
    , m_xFontText(m_xBuilder->weld_label("fontft"))
    , m_xFontLB(m_xBuilder->weld_combo_box("fontlb"))
    , m_xSubsetText(m_xBuilder->weld_label("subsetft"))
@@ -512,13 +513,15 @@ void SvxCharacterMap::init()
    getFavCharacterList();
    updateFavCharControl();

    bool bHasInsert = m_xFrame.is();

    for(int i = 0; i < 16; i++)
    {
        m_aRecentCharView[i].SetHasInsert(m_bHasInsert);
        m_aRecentCharView[i].SetHasInsert(bHasInsert);
        m_aRecentCharView[i].setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
        m_aRecentCharView[i].setClearClickHdl(LINK(this,SvxCharacterMap, RecentClearClickHdl));
        m_aRecentCharView[i].setClearAllClickHdl(LINK(this,SvxCharacterMap, RecentClearAllClickHdl));
        m_aFavCharView[i].SetHasInsert(m_bHasInsert);
        m_aFavCharView[i].SetHasInsert(bHasInsert);
        m_aFavCharView[i].setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
        m_aFavCharView[i].setClearClickHdl(LINK(this,SvxCharacterMap, FavClearClickHdl));
        m_aFavCharView[i].setClearAllClickHdl(LINK(this,SvxCharacterMap, FavClearAllClickHdl));
@@ -608,7 +611,7 @@ void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph)
    if(sGlyph.isEmpty())
        return;

    if (m_bHasInsert) {
    if (m_xFrame.is()) {
        uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );

        uno::Sequence<beans::PropertyValue> aArgs(2);
@@ -617,7 +620,7 @@ void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph)

        aArgs[1].Name = "FontName";
        aArgs[1].Value <<= aFont.GetFamilyName();
        comphelper::dispatchCommand(".uno:InsertSymbol", aArgs);
        comphelper::dispatchCommand(".uno:InsertSymbol", m_xFrame, aArgs);

        updateRecentCharacterList(sGlyph, aFont.GetFamilyName());

diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index dd8c8bf..413d9c6 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1311,16 +1311,17 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog(
    return VclPtr<CuiAbstractTabController_Impl>::Create(o3tl::make_unique<SvxLineTabDialog>(pParent, pAttr, pModel, pObj,bHasObj));
}

VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert)
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr,
                                                                          const Reference< XFrame >& rDocumentFrame)
{
    return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(o3tl::make_unique<SvxCharacterMap>(pParent, &rAttr, bInsert));
    return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(o3tl::make_unique<SvxCharacterMap>(pParent, &rAttr, rDocumentFrame));
}

VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog(weld::Window* pParent,
                                                                              const SfxItemSet& rAttr,
                                                                              const Reference< XFrame >& _rxDocumentFrame)
                                                                              const Reference< XFrame >& rDocumentFrame)
{
    return VclPtr<CuiAbstractSingleTabController_Impl>::Create(o3tl::make_unique<SfxMacroAssignDlg>(pParent, _rxDocumentFrame, rAttr));
    return VclPtr<CuiAbstractSingleTabController_Impl>::Create(o3tl::make_unique<SfxMacroAssignDlg>(pParent, rDocumentFrame, rAttr));
}

VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(vcl::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index cd6dffd..0ebec66 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -681,10 +681,10 @@ public:
                                            sal_uInt32 nResId ) override;
    virtual VclPtr<SfxAbstractDialog>    CreateCharMapDialog(weld::Window* pParent,
                                                             const SfxItemSet& rAttr,
                                                             bool bInsert) override;
                                                             const css::uno::Reference< css::frame::XFrame >& rFrame) override;
    virtual VclPtr<SfxAbstractDialog>    CreateEventConfigDialog(weld::Window* pParent,
                                                                 const SfxItemSet& rAttr,
                                                                 const css::uno::Reference< css::frame::XFrame >& _rxFrame) override;
                                                                 const css::uno::Reference< css::frame::XFrame >& rFrame) override;
    virtual VclPtr<VclAbstractDialog>    CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame,
                                                           sal_uInt32 nResId,
                                                           const OUString& rParameter ) override;
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index 4ca3ed0..f4b0b67 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -26,7 +26,7 @@ extern "C"
SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(vcl::Window const * i_pParent, const vcl::Font& i_rFont, OUString& o_rResult)
{
    bool bRet = false;
    SvxCharacterMap aDlg(i_pParent ? i_pParent->GetFrameWeld() : nullptr, nullptr, false);
    SvxCharacterMap aDlg(i_pParent ? i_pParent->GetFrameWeld() : nullptr, nullptr, nullptr);
    aDlg.DisableFontSelection();
    aDlg.SetCharFont(i_rFont);
    if (aDlg.run() == RET_OK)
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index 1928fe3..544d344 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -78,7 +78,7 @@ private:
    vcl::Font           aFont;
    std::unique_ptr<const SubsetMap> pSubsetMap;
    bool                isSearchMode;
    bool                m_bHasInsert;
    css::uno::Reference<css::frame::XFrame> m_xFrame;
    std::deque<OUString> maRecentCharList;
    std::deque<OUString> maRecentCharFontList;
    std::deque<OUString> maFavCharList;
@@ -140,7 +140,8 @@ private:
    void selectCharByCode(Radix radix);

public:
    SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet, const bool bInsert=true);
    SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet,
                    const css::uno::Reference<css::frame::XFrame>& rFrame);
    virtual short run() override;

    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 8fae6fd..354fc5d 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -622,7 +622,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, weld::Button&, void)
    int nSelEntryPos = m_xCheckLB->get_selected_index();
    if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
    {
        SvxCharacterMap aMapDlg(GetDialogFrameWeld(), nullptr, false);
        SvxCharacterMap aMapDlg(GetDialogFrameWeld(), nullptr, nullptr);
        ImpUserData* pUserData = reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos).toInt64());
        aMapDlg.SetCharFont(*pUserData->pFont);
        aMapDlg.SetChar( (*pUserData->pString)[0] );
@@ -1857,7 +1857,7 @@ IMPL_LINK(OfaQuoteTabPage, QuoteHdl, weld::Button&, rBtn, void)
    else if (&rBtn == m_xDblEndQuotePB.get())
        nMode = DBL_END;
    // start character selection dialog
    SvxCharacterMap aMap(GetDialogFrameWeld(), nullptr, false);
    SvxCharacterMap aMap(GetDialogFrameWeld(), nullptr, nullptr);
    aMap.SetCharFont( OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT,
                        LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne ));
    aMap.set_title(nMode < SGL_END ? CuiResId(RID_SVXSTR_STARTQUOTE)  : CuiResId(RID_SVXSTR_ENDQUOTE));
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index a12cc64..3886d27 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3101,7 +3101,7 @@ void SvxCharTwoLinesPage::Initialize()
void SvxCharTwoLinesPage::SelectCharacter(weld::TreeView* pBox)
{
    bool bStart = pBox == m_xStartBracketLB.get();
    SvxCharacterMap aDlg(GetFrameWeld(), nullptr, false);
    SvxCharacterMap aDlg(GetFrameWeld(), nullptr, nullptr);
    aDlg.DisableFontSelection();

    if (aDlg.run() == RET_OK)
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 7f4fa43..d99d388 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1950,7 +1950,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::ToggleButton&

IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
{
    SvxCharacterMap aMap(GetDialogFrameWeld(), nullptr, false);
    SvxCharacterMap aMap(GetDialogFrameWeld(), nullptr, nullptr);

    sal_uInt16 nMask = 1;
    const vcl::Font* pFmtFont = nullptr;
diff --git a/include/comphelper/dispatchcommand.hxx b/include/comphelper/dispatchcommand.hxx
index 4753177..f0b67ed 100644
--- a/include/comphelper/dispatchcommand.hxx
+++ b/include/comphelper/dispatchcommand.hxx
@@ -15,7 +15,7 @@
#include <com/sun/star/uno/Reference.hxx>

namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } }
namespace com { namespace sun { namespace star { namespace frame { class XDispatchResultListener; } } } }
namespace com { namespace sun { namespace star { namespace frame { class XDispatchResultListener; class XFrame; } } } }
namespace com { namespace sun { namespace star { namespace uno { template <typename > class Sequence; } } } }

namespace comphelper
@@ -29,7 +29,12 @@ namespace comphelper
*/
COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand,
        const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
        const css::uno::Reference<css::frame::XDispatchResultListener>& aListener = css::uno::Reference<css::frame::XDispatchResultListener>());
        const css::uno::Reference<css::frame::XDispatchResultListener>& rListener = css::uno::Reference<css::frame::XDispatchResultListener>());

COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand,
        const css::uno::Reference<css::frame::XFrame>& rFrame,
        const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
        const css::uno::Reference<css::frame::XDispatchResultListener>& rListener = css::uno::Reference<css::frame::XDispatchResultListener>());

}

diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 4f6be06..e3e0f4a 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -425,7 +425,8 @@ public:
                                                                        const SfxItemSet& rAttr,
                                                                        const SdrView* pView,
                                                                        sal_uInt32 nResId )=0;
    virtual VclPtr<SfxAbstractDialog>       CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) = 0;
    virtual VclPtr<SfxAbstractDialog>       CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr,
                                                                const css::uno::Reference<css::frame::XFrame>& rFrame) = 0;
    virtual VclPtr<SfxAbstractDialog>       CreateEventConfigDialog(weld::Window* pParent, const SfxItemSet& rAttr,
                                                                    const css::uno::Reference< css::frame::XFrame >& _rxFrame) = 0;
    virtual VclPtr<AbstractSvxPostItDialog>    CreateSvxPostItDialog(weld::Window* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 0005ae9..b401cff 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2470,8 +2470,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                SfxAllItemSet aSet( GetPool() );
                aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
                aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) );

                ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pTabViewShell->GetFrameWeld(), aSet, true));
                SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
                auto xFrame = pViewFrame->GetFrame().GetFrameInterface();
                ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pTabViewShell->GetFrameWeld(), aSet, xFrame));
                pDlg->Execute();
            }
            break;
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index c215025..a42519d 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -332,7 +332,8 @@ void ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont,
    SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() );
    aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
    aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) );
    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rFrame.GetWindow().GetFrameWeld(), aSet, true));
    auto xFrame = rFrame.GetFrame().GetFrameInterface();
    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rFrame.GetWindow().GetFrameWeld(), aSet, xFrame));
    pDlg->Execute();
}

diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 81dc443..683390a 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -190,8 +190,9 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq )
            aSet.Put( *pFontItem );

        SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
        auto xFrame = mpViewShell ? mpViewShell->GetFrame()->GetFrame().GetFrameInterface() : nullptr;
        ScopedVclPtr<SfxAbstractDialog> pDlg( pFact->CreateCharMapDialog(mpView->GetViewShell()->GetFrameWeld(), aSet,
            true ) );
            xFrame) );

        // If a character is selected, it can be shown
        // pDLg->SetFont( );
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index 8131efc..efc546c 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -105,7 +105,7 @@ IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, weld::Button&, void)
    aAllSet.Put( rFont );

    SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, false));
    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, nullptr));
    if (RET_OK == pDlg->Execute())
    {
        const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false);
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 1f0f66f..9565128 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -335,7 +335,7 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl, weld::Button&, void)
    SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
    SfxAllItemSet aSet( rSh.GetAttrPool() );
    aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) );
    ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, false));
    ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, nullptr));
    if( RET_OK == pMap->Execute() )
    {
        const SfxInt32Item* pItem = SfxItemSet::GetItem<SfxInt32Item>(pMap->GetOutputItemSet(), SID_ATTR_CHAR, false);
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 5b14408..caadf19 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1748,7 +1748,8 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
            aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );

        // If character is selected then it can be shown.
        ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, true));
        auto xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
        ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, xFrame));
        pDlg->Execute();
        return;
    }
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 5a13c7a..025ea65 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -722,7 +722,8 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)

        // If character is selected, it can be shown
        SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
        ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, true));
        auto xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
        ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, xFrame));
        pDlg->Execute();
        return;
    }
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 2b9603e..2b59a32 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -933,7 +933,8 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
            aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) );

        SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
        ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, true));
        auto xFrame = GetView().GetViewFrame()->GetFrame().GetFrameInterface();
        ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, xFrame));
        pDlg->Execute();
        return;
    }