[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 2 commits - editeng/inc editeng/source include/vcl solenv/clang-format vcl/inc vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 18 09:32:07 UTC 2021
editeng/inc/helpids.h | 24 -----
editeng/source/editeng/editview.cxx | 158 ++++++++++++++++++------------------
include/vcl/weld.hxx | 1
solenv/clang-format/excludelist | 1
vcl/inc/salvtables.hxx | 1
vcl/source/app/salvtables.cxx | 4
vcl/unx/gtk3/gtk3gtkinst.cxx | 10 ++
7 files changed, 96 insertions(+), 103 deletions(-)
New commits:
commit 37d894167fa94a230d82fe55a421bca220ac6691
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Dec 12 21:21:09 2020 +0000
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jun 18 11:31:44 2021 +0200
weld editview menu
also squashed:
lok: remove popup auto correct item
The auto correct options and auto correct
menu item are no longer need it.
Change-Id: I26bd2d011b5665f198f18d35b8433becca904991
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107572
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117256
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/editeng/inc/helpids.h b/editeng/inc/helpids.h
deleted file mode 100644
index 8c4639e8951d..000000000000
--- a/editeng/inc/helpids.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#pragma once
-
-#define HID_EDITENG_SPELLER_WORDLANGUAGE "EDITENG_HID_EDITENG_SPELLER_WORDLANGUAGE"
-#define HID_EDITENG_SPELLER_PARALANGUAGE "EDITENG_HID_EDITENG_SPELLER_PARALANGUAGE"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 636d2280dd60..b589e6130217 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -20,7 +20,6 @@
#include <memory>
#include <sal/macros.h>
-#include <vcl/builder.hxx>
#include <vcl/image.hxx>
#include <com/sun/star/i18n/WordType.hpp>
@@ -47,9 +46,7 @@
#include <eerdll2.hxx>
#include <editeng/editrids.hrc>
#include <editeng.hxx>
-#include <helpids.h>
#include <i18nlangtag/lang.h>
-#include <vcl/menu.hxx>
#include <vcl/window.hxx>
#include <editeng/acorrcfg.hxx>
#include <editeng/unolingu.hxx>
@@ -887,7 +884,7 @@ bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWron
return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong );
}
-static void LOKSendSpellPopupMenu(Menu* pMenu, LanguageType nGuessLangWord,
+static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLangWord,
LanguageType nGuessLangPara, sal_uInt16 nSuggestions)
{
if (!comphelper::LibreOfficeKit::isActive())
@@ -905,13 +902,13 @@ static void LOKSendSpellPopupMenu(Menu* pMenu, LanguageType nGuessLangWord,
{
for(int i = 0; i < nSuggestions; ++i)
{
- sal_uInt16 nItemId = MN_ALTSTART + i;
- OUString sText = pMenu->GetItemText(nItemId);
+ OString sItemId = OString::number(MN_ALTSTART + i);
+ OUString sText = rMenu.get_label(sItemId);
aItemTree.put("text", sText.toUtf8().getStr());
aItemTree.put("type", "command");
OUString sCommandString = ".uno:SpellCheckApplySuggestion?ApplyRule:string=Spelling_" + sText;
aItemTree.put("command", sCommandString.toUtf8().getStr());
- aItemTree.put("enabled", pMenu->IsItemEnabled(nItemId));
+ aItemTree.put("enabled", rMenu.get_sensitive(sItemId));
aMenu.push_back(std::make_pair("", aItemTree));
aItemTree.clear();
}
@@ -925,10 +922,10 @@ static void LOKSendSpellPopupMenu(Menu* pMenu, LanguageType nGuessLangWord,
OUString aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) );
OUString aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) );
- aItemTree.put("text", pMenu->GetItemText(pMenu->GetItemId("ignore")).toUtf8().getStr());
+ aItemTree.put("text", rMenu.get_label("ignore").toUtf8().getStr());
aItemTree.put("type", "command");
aItemTree.put("command", ".uno:SpellCheckIgnoreAll?Type:string=Spelling");
- aItemTree.put("enabled", pMenu->IsItemEnabled(pMenu->GetItemId("ignore")));
+ aItemTree.put("enabled", rMenu.get_sensitive("ignore"));
aMenu.push_back(std::make_pair("", aItemTree));
aItemTree.clear();
@@ -936,19 +933,19 @@ static void LOKSendSpellPopupMenu(Menu* pMenu, LanguageType nGuessLangWord,
aMenu.push_back(std::make_pair("", aItemTree));
aItemTree.clear();
- aItemTree.put("text", pMenu->GetItemText(MN_WORDLANGUAGE).toUtf8().getStr());
+ aItemTree.put("text", rMenu.get_label("wordlanguage").toUtf8().getStr());
aItemTree.put("type", "command");
OUString sCommandString = ".uno:LanguageStatus?Language:string=Current_" + aTmpWord;
aItemTree.put("command", sCommandString.toUtf8().getStr());
- aItemTree.put("enabled", pMenu->IsItemEnabled(MN_WORDLANGUAGE));
+ aItemTree.put("enabled", rMenu.get_sensitive("wordlanguage"));
aMenu.push_back(std::make_pair("", aItemTree));
aItemTree.clear();
- aItemTree.put("text", pMenu->GetItemText(MN_PARALANGUAGE).toUtf8().getStr());
+ aItemTree.put("text", rMenu.get_label("paralanguage").toUtf8().getStr());
aItemTree.put("type", "command");
sCommandString = ".uno:LanguageStatus?Language:string=Paragraph_" + aTmpPara;
aItemTree.put("command", sCommandString.toUtf8().getStr());
- aItemTree.put("enabled", pMenu->IsItemEnabled(MN_PARALANGUAGE));
+ aItemTree.put("enabled", rMenu.get_sensitive("paralanguage"));
aMenu.push_back(std::make_pair("", aItemTree));
aItemTree.clear();
@@ -970,17 +967,18 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
if ( !(xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true )) )
return;
- VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), "editeng/ui/spellmenu.ui", "");
- VclPtr<PopupMenu> aPopupMenu(aBuilder.get_menu("editviewspellmenu"));
- const sal_uInt16 nAutoCorrId = aPopupMenu->GetItemId("autocorrect");
- PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu(nAutoCorrId);
- const sal_uInt16 nInsertId = aPopupMenu->GetItemId("insert");
- PopupMenu *pInsertMenu = aPopupMenu->GetPopupMenu(nInsertId); // add word to user-dictionaries
- pInsertMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics ); //! necessary to retrieve the correct dictionary names later
- const sal_uInt16 nAddId = aPopupMenu->GetItemId("add");
- const sal_uInt16 nIgnoreId = aPopupMenu->GetItemId("ignore");
- const sal_uInt16 nCheckId = aPopupMenu->GetItemId("check");
- const sal_uInt16 nAutoCorrectDlgId = aPopupMenu->GetItemId("autocorrectdlg");
+ // PaMtoEditCursor returns Logical units
+ tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
+ // GetWindowPos works in Logical units
+ aTempRect = pImpEditView->GetWindowPos(aTempRect);
+ // Convert to pixels
+ aTempRect = pImpEditView->GetOutputDevice().LogicToPixel(aTempRect);
+
+ weld::Widget* pPopupParent = pImpEditView->GetPopupParent(aTempRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "editeng/ui/spellmenu.ui"));
+ std::unique_ptr<weld::Menu> xPopupMenu(xBuilder->weld_menu("editviewspellmenu"));
+ std::unique_ptr<weld::Menu> xInsertMenu(xBuilder->weld_menu("insertmenu")); // add word to user-dictionaries
+ std::unique_ptr<weld::Menu> xAutoMenu(xBuilder->weld_menu("automenu"));
EditPaM aPaM2( aPaM );
aPaM2.SetIndex( aPaM2.GetIndex()+1 );
@@ -1036,23 +1034,17 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
if (nGuessLangPara == LANGUAGE_NONE)
nGuessLangPara = nGuessLangWord;
- aPopupMenu->InsertSeparator();
+ xPopupMenu->append_separator("separator1");
OUString aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) );
OUString aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) );
OUString aWordStr( EditResId( RID_STR_WORD ) );
aWordStr = aWordStr.replaceFirst( "%x", aTmpWord );
OUString aParaStr( EditResId( RID_STR_PARAGRAPH ) );
aParaStr = aParaStr.replaceFirst( "%x", aTmpPara );
- aPopupMenu->InsertItem( MN_WORDLANGUAGE, aWordStr );
- aPopupMenu->SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE );
- aPopupMenu->InsertItem( MN_PARALANGUAGE, aParaStr );
- aPopupMenu->SetHelpId( MN_PARALANGUAGE, HID_EDITENG_SPELLER_PARALANGUAGE );
+ xPopupMenu->append("wordlanguage", aWordStr);
+ xPopupMenu->append("paralanguage", aParaStr);
}
- // ## Create mnemonics here
- aPopupMenu->CreateAutoMnemonics();
- aPopupMenu->SetMenuFlags(aPopupMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics);
-
// Replace suggestions...
Sequence< OUString > aAlt;
if (xSpellAlt.is())
@@ -1064,13 +1056,16 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
for ( sal_uInt16 nW = 0; nW < nWords; nW++ )
{
OUString aAlternate( pAlt[nW] );
- aPopupMenu->InsertItem( MN_ALTSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
- pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
+ xPopupMenu->append(OUString::number(MN_ALTSTART + nW), aAlternate);
+ xAutoMenu->append(OUString::number(MN_AUTOSTART + nW), aAlternate);
}
- aPopupMenu->InsertSeparator(OString(), nWords);
+ xPopupMenu->append_separator("separator2");
}
else
- aPopupMenu->RemoveItem(nAutoCorrId); // delete?
+ {
+ xAutoMenu.reset();
+ xPopupMenu->remove("autocorrect");
+ }
SvtLinguConfig aCfg;
@@ -1103,11 +1098,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
&& (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage )
&& (!xStor.is() || !xStor->isReadonly()) )
{
- // the extra 1 is because of the (possible) external
- // linguistic entry above
- sal_uInt16 nPos = MN_DICTSTART + i;
- pInsertMenu->InsertItem( nPos, xDicTmp->getName() );
- aDicNameSingle = xDicTmp->getName();
+ OUString sImage;
uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
if (xSvcInfo.is())
@@ -1115,26 +1106,34 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage(
xSvcInfo->getImplementationName()) );
if (!aDictionaryImageUrl.isEmpty() )
- {
- Image aImage( aDictionaryImageUrl );
- pInsertMenu->SetItemImage( nPos, aImage );
- }
+ sImage = aDictionaryImageUrl;
+ }
+
+ if (sImage.isEmpty())
+ {
+ xInsertMenu->append(OUString::number(MN_DICTSTART + i), xDicTmp->getName());
}
+ else
+ {
+ Image aImage(sImage);
+ ScopedVclPtr<VirtualDevice> xVirDev(pPopupParent->create_virtual_device());
+ Size aSize(aImage.GetSizePixel());
+ xVirDev->SetOutputSizePixel(aSize);
+ xVirDev->DrawImage(Point(0, 0), aImage);
+ xInsertMenu->append(OUString::number(MN_DICTSTART + i), xDicTmp->getName(), *xVirDev);
+ }
+ aDicNameSingle = xDicTmp->getName();
}
}
}
- if (pInsertMenu->GetItemCount() != 1)
- aPopupMenu->EnableItem(nAddId, false);
- if (pInsertMenu->GetItemCount() < 2)
- aPopupMenu->EnableItem(nInsertId, false);
-
- aPopupMenu->RemoveDisabledEntries( true, true );
-
- tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
- Point aScreenPos = pImpEditView->GetWindowPos( aTempRect.TopLeft() );
- aScreenPos = pImpEditView->GetWindow()->OutputToScreenPixel( aScreenPos );
- aTempRect = pImpEditView->GetWindow()->LogicToPixel( tools::Rectangle(aScreenPos, aTempRect.GetSize() ));
+ if (xInsertMenu->n_children() != 1)
+ xPopupMenu->remove("add");
+ if (xInsertMenu->n_children() < 2)
+ {
+ xInsertMenu.reset();
+ xPopupMenu->remove("insert");
+ }
//tdf#106123 store and restore the EditPaM around the menu Execute
//because the loss of focus in the current editeng causes writer
@@ -1143,26 +1142,26 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
-
if (comphelper::LibreOfficeKit::isActive())
{
- aPopupMenu->RemoveItem(nAutoCorrId);
- aPopupMenu->RemoveItem(nAutoCorrectDlgId);
+ xPopupMenu->remove("autocorrect");
+ xPopupMenu->remove("autocorrectdlg");
// For mobile phones, send the context menu structure
const SfxViewShell* pViewShell = SfxViewShell::Current();
if (pViewShell && pViewShell->isLOKMobilePhone())
{
- LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
+ LOKSendSpellPopupMenu(*xPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
return;
}
}
- sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose);
+
+ OString sId = xPopupMenu->popup_at_rect(pPopupParent, aTempRect);
aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
- if (nId == nIgnoreId)
+ if (sId == "ignore")
{
OUString aWord = pImpEditView->SpellIgnoreWord();
if ( pCallBack )
@@ -1172,9 +1171,9 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
}
SetSelection( aOldSel );
}
- else if ( ( nId == MN_WORDLANGUAGE ) || ( nId == MN_PARALANGUAGE ) )
+ else if (sId == "wordlanguage" || sId == "paralanguage")
{
- LanguageType nLangToUse = (nId == MN_WORDLANGUAGE) ? nGuessLangWord : nGuessLangPara;
+ LanguageType nLangToUse = (sId == "wordlanguage") ? nGuessLangWord : nGuessLangPara;
SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
@@ -1184,7 +1183,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CTL ) );
if (nScriptType == SvtScriptType::ASIAN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CJK ) );
- if ( nId == MN_PARALANGUAGE )
+ if (sId == "paralanguage")
{
ESelection aSel = GetSelection();
aSel.nStartPos = 0;
@@ -1196,12 +1195,12 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
if ( pCallBack )
{
- SpellCallbackInfo aInf( ( nId == MN_WORDLANGUAGE ) ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE );
+ SpellCallbackInfo aInf( (sId == "wordlanguage") ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE );
pCallBack->Call( aInf );
}
SetSelection( aOldSel );
}
- else if (nId == nCheckId)
+ else if (sId == "check")
{
if ( !pCallBack )
{
@@ -1219,16 +1218,19 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
pCallBack->Call( aInf );
}
}
- else if (nId == nAutoCorrectDlgId && pCallBack)
+ else if (sId == "autocorrectdlg" && pCallBack)
{
SpellCallbackInfo aInf( SpellCallbackCommand::AUTOCORRECT_OPTIONS, OUString() );
pCallBack->Call( aInf );
}
- else if ( nId >= MN_DICTSTART || nId == nAddId)
+ else if ( sId.toInt32() >= MN_DICTSTART || sId == "add")
{
OUString aDicName;
- if (nId >= MN_DICTSTART)
- aDicName = pInsertMenu->GetItemText(nId);
+ if (sId.toInt32() >= MN_DICTSTART)
+ {
+ // strip_mnemonic is necessary to retrieve the correct dictionary name
+ aDicName = pPopupParent->strip_mnemonic(xInsertMenu->get_label(sId));
+ }
else
aDicName = aDicNameSingle;
@@ -1253,19 +1255,19 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
}
SetSelection( aOldSel );
}
- else if ( nId >= MN_AUTOSTART )
+ else if ( sId.toInt32() >= MN_AUTOSTART )
{
- DBG_ASSERT(nId - MN_AUTOSTART < aAlt.getLength(), "index out of range");
- OUString aWord = pAlt[nId - MN_AUTOSTART];
+ DBG_ASSERT(sId.toInt32() - MN_AUTOSTART < aAlt.getLength(), "index out of range");
+ OUString aWord = pAlt[sId.toInt32() - MN_AUTOSTART];
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
if ( pAutoCorrect )
pAutoCorrect->PutText( aSelected, aWord, pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ) );
InsertText( aWord );
}
- else if ( nId >= MN_ALTSTART ) // Replace
+ else if ( sId.toInt32() >= MN_ALTSTART ) // Replace
{
- DBG_ASSERT(nId - MN_ALTSTART < aAlt.getLength(), "index out of range");
- OUString aWord = pAlt[nId - MN_ALTSTART];
+ DBG_ASSERT(sId.toInt32() - MN_ALTSTART < aAlt.getLength(), "index out of range");
+ OUString aWord = pAlt[sId.toInt32() - MN_ALTSTART];
InsertText( aWord );
}
else
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 2798a3933fa4..a441626f53f9 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3463,7 +3463,6 @@ editeng/inc/editattr.hxx
editeng/inc/editdoc.hxx
editeng/inc/edtspell.hxx
editeng/inc/eerdll2.hxx
-editeng/inc/helpids.h
editeng/inc/unomodel.hxx
editeng/qa/items/borderline_test.cxx
editeng/qa/lookuptree/lookuptree_test.cxx
commit 131f00d6ba02965f342c352c111889e437b51fd8
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Dec 17 16:16:09 2020 +0000
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jun 18 11:31:31 2021 +0200
add Menu::get_sensitive
Change-Id: I242ace497d7f049d9908cc6461b7eefc6d4a2b87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107889
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117255
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 0a044c67ddd8..c3d335db3f7f 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2206,6 +2206,7 @@ public:
void connect_activate(const Link<const OString&, void>& rLink) { m_aActivateHdl = rLink; }
virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
+ virtual bool get_sensitive(const OString& rIdent) const = 0;
virtual void set_label(const OString& rIdent, const OUString& rLabel) = 0;
virtual OUString get_label(const OString& rIdent) const = 0;
virtual void set_active(const OString& rIdent, bool bActive) = 0;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index feebebe60507..0a7299af56bf 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -146,6 +146,7 @@ public:
SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership);
virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) override;
virtual void set_sensitive(const OString& rIdent, bool bSensitive) override;
+ virtual bool get_sensitive(const OString& rIdent) const override;
virtual void set_active(const OString& rIdent, bool bActive) override;
virtual bool get_active(const OString& rIdent) const override;
virtual void set_label(const OString& rIdent, const OUString& rLabel) override;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index e722a0b6ca87..27dff1370ade 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -751,6 +751,10 @@ void SalInstanceMenu::set_sensitive(const OString& rIdent, bool bSensitive)
{
m_xMenu->EnableItem(rIdent, bSensitive);
}
+bool SalInstanceMenu::get_sensitive(const OString& rIdent) const
+{
+ return m_xMenu->IsItemEnabled(m_xMenu->GetItemId(rIdent));
+}
void SalInstanceMenu::set_active(const OString& rIdent, bool bActive)
{
m_xMenu->CheckItem(rIdent, bActive);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 50c06c02b044..8a630ee62055 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3622,6 +3622,11 @@ public:
gtk_widget_set_sensitive(GTK_WIDGET(m_aMap[rIdent]), bSensitive);
}
+ bool get_item_sensitive(const OString& rIdent) const
+ {
+ return gtk_widget_get_sensitive(GTK_WIDGET(m_aMap.find(rIdent)->second));
+ }
+
void set_item_active(const OString& rIdent, bool bActive)
{
disable_item_notify_events();
@@ -8251,6 +8256,11 @@ public:
set_item_sensitive(rIdent, bSensitive);
}
+ virtual bool get_sensitive(const OString& rIdent) const override
+ {
+ return get_item_sensitive(rIdent);
+ }
+
virtual void set_active(const OString& rIdent, bool bActive) override
{
set_item_active(rIdent, bActive);
More information about the Libreoffice-commits
mailing list