summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-14 12:41:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-14 17:11:56 +0200
commit430b3f4db745dfe08b989745e340e0503dd0ac34 (patch)
tree8c66cfd8fa3c9e90786d1e14f38cc84a05b2f7a3 /cui
parentf264b2ffc4f8cad28cfe852ddba63f30293e321c (diff)
Resolves: tdf#120423 dispatch against the correct Frame
Change-Id: I5ea2e5d7b79efbd2b14d0b528e5a5c3e44e643bc Reviewed-on: https://gerrit.libreoffice.org/72284 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/cuicharmap.cxx17
-rw-r--r--cui/source/factory/dlgfact.cxx9
-rw-r--r--cui/source/factory/dlgfact.hxx4
-rw-r--r--cui/source/factory/init.cxx2
-rw-r--r--cui/source/inc/cuicharmap.hxx5
-rw-r--r--cui/source/tabpages/autocdlg.cxx4
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--cui/source/tabpages/numpages.cxx2
8 files changed, 25 insertions, 20 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index cd6c82ea16c4..48cd29e58f37 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -51,11 +51,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),
@@ -90,7 +91,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"))
@@ -511,13 +512,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));
@@ -607,7 +610,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);
@@ -616,7 +619,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 66de3a634901..31e52bce2bf6 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1286,16 +1286,17 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog(
return VclPtr<CuiAbstractTabController_Impl>::Create(std::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(std::make_unique<SvxCharacterMap>(pParent, &rAttr, bInsert));
+ return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(std::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(std::make_unique<SfxMacroAssignDlg>(pParent, _rxDocumentFrame, rAttr));
+ return VclPtr<CuiAbstractSingleTabController_Impl>::Create(std::make_unique<SfxMacroAssignDlg>(pParent, rDocumentFrame, rAttr));
}
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(weld::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index f48afb3fbf31..97615f681348 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -684,10 +684,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 4ca3ed0e6e89..f4b0b67328a9 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 3500e4a12fff..95e65f170c44 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -74,7 +74,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;
@@ -136,7 +136,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 bf40344031ec..884163bb2085 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -619,7 +619,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] );
@@ -1751,7 +1751,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 d58992ddb283..1422602fc5b9 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3115,7 +3115,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 80d871be981e..4c8a9bd21f28 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;