summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/bastype2.cxx12
-rw-r--r--basctl/source/basicide/bastype3.cxx2
-rw-r--r--basctl/source/inc/bastype2.hxx12
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx159
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx260
-rw-r--r--cui/source/customize/SvxToolbarConfigPage.cxx635
-rw-r--r--cui/source/customize/acccfg.cxx10
-rw-r--r--cui/source/customize/cfg.cxx567
-rw-r--r--cui/source/customize/cfgutil.cxx85
-rw-r--r--cui/source/dialogs/scriptdlg.cxx10
-rw-r--r--cui/source/inc/CommandCategoryListBox.hxx21
-rw-r--r--cui/source/inc/SvxMenuConfigPage.hxx27
-rw-r--r--cui/source/inc/SvxToolbarConfigPage.hxx52
-rw-r--r--cui/source/inc/acccfg.hxx3
-rw-r--r--cui/source/inc/cfg.hxx141
-rw-r--r--cui/source/inc/cfgutil.hxx48
-rw-r--r--cui/source/inc/scriptdlg.hxx8
-rw-r--r--cui/uiconfig/ui/menuassignpage.ui316
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in6
-rw-r--r--include/vcl/weld.hxx59
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx4
-rw-r--r--sd/source/ui/inc/sdtreelb.hxx2
-rwxr-xr-xsolenv/bin/native-code.py2
-rw-r--r--solenv/sanitizers/ui/cui.suppr4
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx2
-rw-r--r--sw/source/uibase/inc/dbtree.hxx2
-rw-r--r--uitest/writer_tests/customizeDialog.py3
-rw-r--r--vcl/inc/salframe.hxx11
-rw-r--r--vcl/inc/treeglue.hxx79
-rw-r--r--vcl/source/app/salvtables.cxx154
-rw-r--r--vcl/source/treelist/treelistbox.cxx2
-rw-r--r--vcl/source/uitest/uiobject.cxx2
-rw-r--r--vcl/source/window/builder.cxx52
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx205
-rw-r--r--vcl/win/gdi/salprn.cxx2
35 files changed, 1487 insertions, 1472 deletions
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index a5b0057803ed..129865c4087c 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -917,7 +917,7 @@ void SbTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation
m_xControl->thaw();
}
-void SbTreeListBox::ImpCreateLibEntries(weld::TreeIter& rIter, const ScriptDocument& rDocument, LibraryLocation eLocation)
+void SbTreeListBox::ImpCreateLibEntries(const weld::TreeIter& rIter, const ScriptDocument& rDocument, LibraryLocation eLocation)
{
// get a sorted list of library names
Sequence< OUString > aLibNames( rDocument.getLibraryNames() );
@@ -976,7 +976,7 @@ void SbTreeListBox::ImpCreateLibEntries(weld::TreeIter& rIter, const ScriptDocum
}
}
-void SbTreeListBox::ImpCreateLibSubEntries(weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName)
+void SbTreeListBox::ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName)
{
// modules
if ( nMode & BrowseMode::Modules )
@@ -1075,7 +1075,7 @@ void SbTreeListBox::ImpCreateLibSubEntries(weld::TreeIter& rLibRootEntry, const
}
}
-void SbTreeListBox::ImpCreateLibSubEntriesInVBAMode(weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName )
+void SbTreeListBox::ImpCreateLibSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName )
{
auto const aEntries = {
std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, IDEResId(RID_STR_DOCUMENT_OBJECTS) ),
@@ -1102,7 +1102,7 @@ void SbTreeListBox::ImpCreateLibSubEntriesInVBAMode(weld::TreeIter& rLibRootEntr
}
}
-void SbTreeListBox::ImpCreateLibSubSubEntriesInVBAMode(weld::TreeIter& rLibSubRootEntry, const ScriptDocument& rDocument, const OUString& rLibName)
+void SbTreeListBox::ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLibSubRootEntry, const ScriptDocument& rDocument, const OUString& rLibName)
{
uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
if( !xLib.is() )
@@ -1347,7 +1347,7 @@ bool SbTreeListBox::IsEntryProtected(const weld::TreeIter* pEntry)
void SbTreeListBox::AddEntry(
const OUString& rText,
const OUString& rImage,
- weld::TreeIter* pParent,
+ const weld::TreeIter* pParent,
bool bChildrenOnDemand,
std::unique_ptr<Entry>&& rUserData)
{
@@ -1357,7 +1357,7 @@ void SbTreeListBox::AddEntry(
void SbTreeListBox::SetEntryBitmaps(const weld::TreeIter& rIter, const OUString& rImage)
{
- m_xControl->set_expander_image(rIter, rImage);
+ m_xControl->set_image(rIter, rImage, -1);
}
LibraryType SbTreeListBox::GetLibraryType() const
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 69bfb2c4e200..084b7def7345 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -130,7 +130,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
}
}
-IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, weld::TreeIter&, rEntry, bool)
+IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, const weld::TreeIter&, rEntry, bool)
{
EntryDescriptor aDesc = GetEntryDescriptor(&rEntry);
const ScriptDocument& aDocument = aDesc.GetDocument();
diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx
index 4761fbb5ca9d..881bddb4fa09 100644
--- a/basctl/source/inc/bastype2.hxx
+++ b/basctl/source/inc/bastype2.hxx
@@ -259,12 +259,12 @@ private:
void SetEntryBitmaps(const weld::TreeIter& rIter, const OUString& rImage);
protected:
- DECL_LINK(RequestingChildrenHdl, weld::TreeIter&, bool);
+ DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
DECL_LINK(OpenCurrentHdl, weld::TreeView&, void);
- void ImpCreateLibEntries(weld::TreeIter& rShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation);
- void ImpCreateLibSubEntries(weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName);
- void ImpCreateLibSubEntriesInVBAMode(weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName );
- void ImpCreateLibSubSubEntriesInVBAMode(weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName);
+ void ImpCreateLibEntries(const weld::TreeIter& rShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation);
+ void ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName);
+ void ImpCreateLibSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName );
+ void ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName);
bool ImpFindEntry(weld::TreeIter& rIter, const OUString& rText);
// DocumentEventListener
@@ -300,7 +300,7 @@ public:
static ItemType ConvertType (EntryType eType);
bool IsValidEntry(weld::TreeIter& rEntry);
void AddEntry(const OUString& rText, const OUString& rImage,
- weld::TreeIter* pIter, bool bChildrenOnDemand, std::unique_ptr<Entry>&& rUserData);
+ const weld::TreeIter* pIter, bool bChildrenOnDemand, std::unique_ptr<Entry>&& rUserData);
void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); }
std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pIter = nullptr) const { return m_xControl->make_iterator(pIter); }
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 7b50dd9a8719..2f9a9a451512 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -41,18 +41,19 @@
#include <dialmgr.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
+#include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/string.hxx>
+#include <i18nlangtag/languagetag.hxx>
#include <i18nutil/searchopt.hxx>
#include <sal/log.hxx>
#include <cfg.hxx> //for SaveInData
-CommandCategoryListBox::CommandCategoryListBox(vcl::Window* pParent)
- : ListBox( pParent, WB_BORDER | WB_DROPDOWN | WB_SORT )
- , pStylesInfo( nullptr )
+CommandCategoryListBox::CommandCategoryListBox(std::unique_ptr<weld::ComboBox> xControl)
+ : pStylesInfo( nullptr )
+ , m_xControl(std::move(xControl))
{
- SetDropDownLineCount(25);
-
//Initialize search util
m_searchOptions.AlgorithmType2 = css::util::SearchAlgorithms2::ABSOLUTE;
m_searchOptions.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
@@ -60,17 +61,9 @@ CommandCategoryListBox::CommandCategoryListBox(vcl::Window* pParent)
| css::util::SearchFlags::REG_NOT_ENDOFLINE);
}
-VCL_BUILDER_FACTORY(CommandCategoryListBox);
-
CommandCategoryListBox::~CommandCategoryListBox()
{
- disposeOnce();
-}
-
-void CommandCategoryListBox::dispose()
-{
ClearAll();
- ListBox::dispose();
}
void CommandCategoryListBox::ClearAll()
@@ -99,7 +92,7 @@ void CommandCategoryListBox::ClearAll()
}
m_aGroupInfo.clear();
- Clear();
+ m_xControl->clear();
}
void CommandCategoryListBox::Init(
@@ -108,7 +101,7 @@ void CommandCategoryListBox::Init(
const OUString& sModuleLongName)
{
// User will not see incomplete UI
- SetUpdateMode(false);
+ m_xControl->freeze();
ClearAll();
m_xContext = xContext;
@@ -136,24 +129,25 @@ void CommandCategoryListBox::Init(
css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
sal_Int32 nGroupsLength = lGroups.getLength();
- sal_Int32 nEntryPos = 0;
if ( nGroupsLength > 0 )
{
// Add the category of "All commands"
- nEntryPos = InsertEntry( CuiResId(RID_SVXSTR_ALLFUNCTIONS) );
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_ALLFUNCTIONS, 0 ) );
- SetEntryData( nEntryPos, m_aGroupInfo.back().get() );
+ m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), CuiResId(RID_SVXSTR_ALLFUNCTIONS));
}
// Separate the "All commands"category from the actual categories
- AddSeparator( 0 );
+ m_xControl->append_separator();
+
+ typedef std::pair<OUString, sal_Int16> str_id;
+ std::vector<str_id> aCategories;
// Add the actual categories
for (sal_Int32 i = 0; i < nGroupsLength; ++i)
{
- sal_Int16& rGroupID = lGroups[i];
- OUString sGroupID = OUString::number(rGroupID);
+ sal_Int16 nGroupID = lGroups[i];
+ OUString sGroupID = OUString::number(nGroupID);
OUString sGroupName;
try
@@ -166,33 +160,39 @@ void CommandCategoryListBox::Init(
{
continue;
}
+ aCategories.emplace_back(std::make_pair(sGroupName, nGroupID));
+ }
+
+ auto const sort = comphelper::string::NaturalStringSorter(
+ comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetUILanguageTag().getLocale());
+
+ std::sort(aCategories.begin(), aCategories.end(),
+ [&sort](const str_id& a, const str_id& b)
+ { return sort.compare(a.first, b.first) < 0; });
- nEntryPos = InsertEntry( sGroupName );
- m_aGroupInfo.push_back(
- std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, rGroupID ) );
- SetEntryData( nEntryPos, m_aGroupInfo.back().get() );
+ // Add the actual categories
+ for (const auto &a : aCategories)
+ {
+ const OUString& rGroupName = a.first;
+ sal_Int16 nGroupID = a.second;
+ m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_FUNCTION, nGroupID));
+ m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), rGroupName);
}
// Separate regular commands from styles and macros
- AddSeparator( GetEntryCount() - 1 );
-
- // Stop sorting, and add Macros and Styles to the end of the list
- SetStyle(GetStyle() & ~WB_SORT);
+ m_xControl->append_separator();
// Add macros category
- OUString sMacros( CuiResId(RID_SVXSTR_MACROS) );
- nEntryPos = InsertEntry( sMacros );
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, nullptr) );
- SetEntryData( nEntryPos, m_aGroupInfo.back().get() );
+ m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), CuiResId(RID_SVXSTR_MACROS));
// Add styles category
- OUString sStyle( CuiResId(RID_SVXSTR_GROUP_STYLES) );
- nEntryPos = InsertEntry( sStyle );
//TODO: last param should contain user data?
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) );
- SetEntryData( nEntryPos, m_aGroupInfo.back().get() );
+ m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), CuiResId(RID_SVXSTR_GROUP_STYLES));
}
catch(const css::uno::RuntimeException&)
{ throw; }
@@ -200,13 +200,13 @@ void CommandCategoryListBox::Init(
{}
// Reveal the updated UI to user
- SetUpdateMode(true);
- SelectEntryPos(0);
+ m_xControl->thaw();
+ m_xControl->set_active(0);
}
void CommandCategoryListBox::FillFunctionsList(
const css::uno::Sequence<css::frame::DispatchInformation>& xCommands,
- const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
+ CuiConfigFunctionListBox* pFunctionListBox,
const OUString& filterTerm,
SaveInData *pCurrentSaveInData )
{
@@ -233,17 +233,15 @@ void CommandCategoryListBox::FillFunctionsList(
continue;
}
- Image aImage;
+ css::uno::Reference<css::graphic::XGraphic> xImage;
if (pCurrentSaveInData)
- aImage = pCurrentSaveInData->GetImage(rInfo.Command);
-
- SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName, aImage, aImage );
+ xImage = pCurrentSaveInData->GetImage(rInfo.Command);
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
pGrpInfo->sCommand = rInfo.Command;
pGrpInfo->sLabel = sUIName;
- pFuncEntry->SetUserData(pGrpInfo);
+ pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, xImage);
}
}
@@ -274,11 +272,11 @@ OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
return sUIName;
}
-void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
- const OUString& filterTerm , SaveInData *pCurrentSaveInData)
+void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctionListBox,
+ const OUString& filterTerm , SaveInData *pCurrentSaveInData)
{
- SfxGroupInfo_Impl *pInfo = static_cast<SfxGroupInfo_Impl*>(GetSelectedEntryData());
- pFunctionListBox->SetUpdateMode(false);
+ SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_active_id().toInt64());
+ pFunctionListBox->freeze();
pFunctionListBox->ClearAll();
switch ( pInfo->nKind )
@@ -287,12 +285,12 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
{
css::uno::Reference< css::frame::XDispatchInformationProvider >
xProvider( m_xFrame, css::uno::UNO_QUERY );
- sal_Int32 nEntryCount = GetEntryCount();
+ sal_Int32 nEntryCount = m_xControl->get_count();
for (sal_Int32 nCurPos = 0; nCurPos < nEntryCount; ++nCurPos)
{
SfxGroupInfo_Impl *pCurrentInfo =
- static_cast<SfxGroupInfo_Impl*>(GetEntryData(nCurPos));
+ reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos).toInt64());
if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
{
@@ -375,25 +373,22 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
continue;
}
- SvTreeListEntry* pMacroGroup = pFunctionListBox->InsertEntry( sUIName );
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0 ) );
- SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
- pMacroGroup->SetUserData(pGrpInfo);
- pMacroGroup->EnableChildrenOnDemand();
+ std::unique_ptr<weld::TreeIter> xMacroGroup(pFunctionListBox->append_ondemand(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName));
//Add the children and the grand children
- addChildren( pMacroGroup, childGroup, pFunctionListBox, filterTerm, pCurrentSaveInData );
+ addChildren(xMacroGroup.get(), childGroup, pFunctionListBox, filterTerm, pCurrentSaveInData);
// Remove the main group if empty
- if (!pMacroGroup->HasChildren())
+ if (!pFunctionListBox->iter_has_child(*xMacroGroup))
{
- pFunctionListBox->RemoveEntry( pMacroGroup );
+ pFunctionListBox->remove(*xMacroGroup);
}
else if (!filterTerm.isEmpty())
{
- pFunctionListBox->Expand( pMacroGroup );
+ pFunctionListBox->expand_row(*xMacroGroup);
}
}
}
@@ -412,12 +407,10 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
continue;
}
- SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry( pIt.sLabel ); // Name of the style family
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0 ) );
- SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
- pFuncEntry->SetUserData(pGrpInfo);
- pFuncEntry->EnableChildrenOnDemand();
+ // pIt.sLabel is Name of the style family
+ std::unique_ptr<weld::TreeIter> xFuncEntry(pFunctionListBox->append_ondemand(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), pIt.sLabel));
const std::vector< SfxStyleInfo_Impl > lStyles = pStylesInfo->getStyles(pIt.sFamily);
@@ -441,26 +434,24 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(pStyleIt);
- SvTreeListEntry* pSubFuncEntry = pFunctionListBox->InsertEntry(
- sUIName, pFuncEntry );
-
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(
SfxCfgKind::GROUP_STYLES, 0, pStyle ) );
m_aGroupInfo.back()->sCommand = pStyle->sCommand;
m_aGroupInfo.back()->sLabel = pStyle->sLabel;
- pSubFuncEntry->SetUserData( m_aGroupInfo.back().get() );
+
+ pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, xFuncEntry.get());
}
// Remove the style group from the list if no children
- if (!pFuncEntry->HasChildren())
+ if (!pFunctionListBox->iter_has_child(*xFuncEntry))
{
- pFunctionListBox->RemoveEntry(pFuncEntry);
+ pFunctionListBox->remove(*xFuncEntry);
}
else if (!filterTerm.isEmpty())
{
- pFunctionListBox->Expand(pFuncEntry);
+ pFunctionListBox->expand_row(*xFuncEntry);
}
}
@@ -472,10 +463,10 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
break;
}
- if ( pFunctionListBox->GetEntryCount() )
- pFunctionListBox->Select( pFunctionListBox->GetEntry( nullptr, 0 ) );
+ pFunctionListBox->thaw();
- pFunctionListBox->SetUpdateMode(true);
+ if (pFunctionListBox->n_children())
+ pFunctionListBox->select(0);
}
void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
@@ -484,8 +475,8 @@ void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
}
void CommandCategoryListBox::addChildren(
- SvTreeListEntry* parentEntry, const css::uno::Reference< css::script::browse::XBrowseNode > &parentNode,
- const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, const OUString& filterTerm , SaveInData *pCurrentSaveInData)
+ weld::TreeIter* parentEntry, const css::uno::Reference< css::script::browse::XBrowseNode > &parentNode,
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm , SaveInData *pCurrentSaveInData)
{
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
@@ -500,21 +491,17 @@ void CommandCategoryListBox::addChildren(
{
OUString sUIName = child.get()->getName();
- SvTreeListEntry* pNewEntry = pFunctionListBox->InsertEntry( sUIName, parentEntry );
-
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
0, static_cast<void *>( child.get())));
- pNewEntry->SetUserData( m_aGroupInfo.back().get() );
- pNewEntry->EnableChildrenOnDemand();
+ std::unique_ptr<weld::TreeIter> xNewEntry(pFunctionListBox->append_ondemand(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, parentEntry));
- addChildren(pNewEntry, child, pFunctionListBox, filterTerm, pCurrentSaveInData);
+ addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, pCurrentSaveInData);
// Remove the group if empty
- if (!pNewEntry->HasChildren())
- pFunctionListBox->RemoveEntry( pNewEntry );
+ if (!pFunctionListBox->iter_has_child(*xNewEntry))
+ pFunctionListBox->remove(*xNewEntry);
else
- pFunctionListBox->Expand( pNewEntry );
-
+ pFunctionListBox->expand_row(*xNewEntry);
}
else if ( child.get()->getType() == css::script::browse::BrowseNodeTypes::SCRIPT )
{
@@ -558,17 +545,15 @@ void CommandCategoryListBox::addChildren(
OUString* pScriptURI = new OUString( uri );
- Image aImage;
+ css::uno::Reference<css::graphic::XGraphic> xImage;
if (pCurrentSaveInData)
- aImage = pCurrentSaveInData->GetImage(uri);
-
- SvTreeListEntry* pNewEntry = pFunctionListBox->InsertEntry( sUIName, aImage, aImage, parentEntry );
+ xImage = pCurrentSaveInData->GetImage(uri);
m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
m_aGroupInfo.back()->sCommand = uri;
m_aGroupInfo.back()->sLabel = sUIName;
m_aGroupInfo.back()->sHelpText = description;
- pNewEntry->SetUserData( m_aGroupInfo.back().get() );
+ pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, xImage, parentEntry);
}
}
}
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index 06836f52d6ea..8e8adf5ed598 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -96,68 +96,90 @@
#include <dlgname.hxx>
-SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet, bool bIsMenuBar)
+SvxMenuConfigPage::SvxMenuConfigPage(TabPageParent pParent, const SfxItemSet& rSet, bool bIsMenuBar)
: SvxConfigPage(pParent, rSet)
- , m_bIsMenuBar( bIsMenuBar )
+ , m_bIsMenuBar(bIsMenuBar)
{
- m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this);
- m_pContentsListBox->set_grid_left_attach(0);
- m_pContentsListBox->set_grid_top_attach(0);
- m_pContentsListBox->set_hexpand(true);
- m_pContentsListBox->set_vexpand(true);
- m_pContentsListBox->Show();
-
- m_pTopLevelListBox->SetSelectHdl(
- LINK( this, SvxMenuConfigPage, SelectMenu ) );
-
- m_pContentsListBox->SetSelectHdl(
+ m_xContentsListBox.reset(new SvxMenuEntriesListBox(m_xBuilder->weld_tree_view("menucontents"), this));
+ weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
+ rTreeView.connect_size_allocate(LINK(this, SvxMenuConfigPage, MenuEntriesSizeAllocHdl));
+ Size aSize(m_xFunctions->get_size_request());
+ rTreeView.set_size_request(aSize.Width(), aSize.Height());
+ MenuEntriesSizeAllocHdl(aSize);
+ rTreeView.set_grid_left_attach(0);
+ rTreeView.set_grid_top_attach(0);
+ rTreeView.set_hexpand(true);
+ rTreeView.set_vexpand(true);
+ rTreeView.show();
+
+ rTreeView.connect_changed(
LINK( this, SvxMenuConfigPage, SelectMenuEntry ) );
- m_pGearBtn->SetSelectHdl(
- LINK( this, SvxMenuConfigPage, GearHdl ) );
+ rTreeView.connect_model_changed(LINK(this, SvxMenuConfigPage, ListModifiedHdl));
+
+ m_xGearBtn->connect_selected(LINK(this, SvxMenuConfigPage, GearHdl));
- m_pCommandCategoryListBox->SetSelectHdl(
- LINK( this, SvxMenuConfigPage, SelectCategory ) );
+ m_xCommandCategoryListBox->connect_changed(LINK(this, SvxMenuConfigPage, SelectCategory));
- m_pMoveUpButton->SetClickHdl ( LINK( this, SvxConfigPage, MoveHdl) );
- m_pMoveDownButton->SetClickHdl ( LINK( this, SvxConfigPage, MoveHdl) );
+ m_xMoveUpButton->connect_clicked( LINK( this, SvxConfigPage, MoveHdl) );
+ m_xMoveDownButton->connect_clicked( LINK( this, SvxConfigPage, MoveHdl) );
- m_pAddCommandButton->SetClickHdl( LINK( this, SvxMenuConfigPage, AddCommandHdl ) );
- m_pRemoveCommandButton->SetClickHdl( LINK( this, SvxMenuConfigPage, RemoveCommandHdl ) );
+ m_xAddCommandButton->connect_clicked( LINK( this, SvxMenuConfigPage, AddCommandHdl ) );
+ m_xRemoveCommandButton->connect_clicked( LINK( this, SvxMenuConfigPage, RemoveCommandHdl ) );
- m_pInsertBtn->SetSelectHdl(
+ m_xInsertBtn->connect_selected(
LINK( this, SvxMenuConfigPage, InsertHdl ) );
- m_pModifyBtn->SetSelectHdl(
+ m_xModifyBtn->connect_selected(
LINK( this, SvxMenuConfigPage, ModifyItemHdl ) );
- m_pResetBtn->SetClickHdl(
+ m_xResetBtn->connect_clicked(
LINK( this, SvxMenuConfigPage, ResetMenuHdl ) );
- PopupMenu* pPopup = m_pModifyBtn->GetPopupMenu();
// These operations are not possible on menus/context menus yet
- pPopup->EnableItem( pPopup->GetItemId("changeIcon"), false );
- pPopup->EnableItem( pPopup->GetItemId("resetIcon"), false );
- pPopup->EnableItem( pPopup->GetItemId("restoreItem"), false );
- pPopup->RemoveDisabledEntries();
+ m_xModifyBtn->remove_item("changeIcon");
+ m_xModifyBtn->remove_item("resetIcon");
+ m_xModifyBtn->remove_item("restoreItem");
- PopupMenu* pGearMenu = m_pGearBtn->GetPopupMenu();
- pGearMenu->EnableItem( pGearMenu->GetItemId("gear_iconAndText"), false );
- pGearMenu->EnableItem( pGearMenu->GetItemId("gear_iconOnly"), false );
- pGearMenu->EnableItem( pGearMenu->GetItemId("gear_textOnly"), false );
- pGearMenu->RemoveDisabledEntries();
+ m_xGearBtn->remove_item("gear_iconAndText");
+ m_xGearBtn->remove_item("gear_iconOnly");
+ m_xGearBtn->remove_item("gear_textOnly");
if ( !bIsMenuBar )
{
//TODO: Remove this when the gear button is implemented for context menus
- m_pGearBtn->Disable();
- m_pGearBtn->Hide();
+ m_xGearBtn->set_sensitive(false);
+ m_xGearBtn->hide();
}
else
{
// TODO: Remove this when it is possible to reset menubar menus individually
- m_pResetBtn->Disable();
+ m_xResetBtn->set_sensitive(false);
}
}
+IMPL_LINK_NOARG(SvxMenuConfigPage, ListModifiedHdl, weld::TreeView&, void)
+{
+ // regenerate with the current ordering within the list
+ SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
+ pEntries->clear();
+
+ for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
+ pEntries->push_back(reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
+
+ GetSaveInData()->SetModified();
+ GetTopLevelSelection()->SetModified();
+ UpdateButtonStates();
+}
+
+IMPL_LINK(SvxMenuConfigPage, MenuEntriesSizeAllocHdl, const Size&, rSize, void)
+{
+ weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
+ std::vector<int> aWidths;
+ int nImageColWidth = rTreeView.get_checkbox_column_width();
+ aWidths.push_back(nImageColWidth);
+ aWidths.push_back(rSize.Width() - 2 * nImageColWidth);
+ rTreeView.set_column_fixed_widths(aWidths);
+}
+
SvxMenuConfigPage::~SvxMenuConfigPage()
{
disposeOnce();
@@ -167,33 +189,31 @@ SvxMenuConfigPage::~SvxMenuConfigPage()
void SvxMenuConfigPage::Init()
{
// ensure that the UI is cleared before populating it
- m_pTopLevelListBox->Clear();
- m_pContentsListBox->Clear();
+ m_xTopLevelListBox->clear();
+ m_xContentsListBox->clear();
ReloadTopLevelListBox();
- m_pTopLevelListBox->SelectEntryPos(0);
- m_pTopLevelListBox->GetSelectHdl().Call(*m_pTopLevelListBox);
+ m_xTopLevelListBox->set_active(0);
+ SelectElement();
- m_pCommandCategoryListBox->Init(
+ m_xCommandCategoryListBox->Init(
comphelper::getProcessComponentContext(),
m_xFrame,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
- m_pCommandCategoryListBox->categorySelected( m_pFunctions, OUString(), GetSaveInData() );
+ m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), OUString(), GetSaveInData());
}
void SvxMenuConfigPage::dispose()
{
- for ( sal_Int32 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
- {
- delete static_cast<SaveInData*>(m_pSaveInListBox->GetEntryData( i ));
- }
- m_pSaveInListBox->Clear();
+ for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
+ delete reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
+ m_xSaveInListBox->clear();
SvxConfigPage::dispose();
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenuEntry, SvTreeListBox *, void )
+IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView&, void)
{
UpdateButtonStates();
}
@@ -201,31 +221,30 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenuEntry, SvTreeListBox *, void )
void SvxMenuConfigPage::UpdateButtonStates()
{
// Disable Up and Down buttons depending on current selection
- SvTreeListEntry* selection = m_pContentsListBox->GetCurEntry();
+ int selection = m_xContentsListBox->get_selected_index();
bool bIsSeparator =
- selection && static_cast<SvxConfigEntry*>(selection->GetUserData())->IsSeparator();
+ selection != -1 && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())->IsSeparator();
bool bIsValidSelection =
- !(m_pContentsListBox->GetEntryCount() == 0 || selection == nullptr);
+ !(m_xContentsListBox->n_children() == 0 || selection == -1);
- m_pMoveUpButton->Enable(
- bIsValidSelection && selection != m_pContentsListBox->First() );
- m_pMoveDownButton->Enable(
- bIsValidSelection && selection != m_pContentsListBox->Last() );
+ m_xMoveUpButton->set_sensitive(
+ bIsValidSelection && selection != 0 );
+ m_xMoveDownButton->set_sensitive(
+ bIsValidSelection && selection != m_xContentsListBox->n_children() - 1);
- m_pRemoveCommandButton->Enable( bIsValidSelection );
+ m_xRemoveCommandButton->set_sensitive( bIsValidSelection );
- m_pModifyBtn->Enable( bIsValidSelection && !bIsSeparator);
+ m_xModifyBtn->set_sensitive( bIsValidSelection && !bIsSeparator);
//Handle the gear button
if (m_bIsMenuBar)
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- PopupMenu* pGearPopup = m_pGearBtn->GetPopupMenu();
// Add option (gear_add) will always be enabled
- pGearPopup->EnableItem( "gear_delete", pMenuData->IsDeletable() );
- pGearPopup->EnableItem( "gear_rename", pMenuData->IsRenamable() );
- pGearPopup->EnableItem( "gear_move", pMenuData->IsMovable() );
+ m_xGearBtn->set_item_sensitive( "gear_delete", pMenuData->IsDeletable() );
+ m_xGearBtn->set_item_sensitive( "gear_rename", pMenuData->IsRenamable() );
+ m_xGearBtn->set_item_sensitive( "gear_move", pMenuData->IsMovable() );
}
}
@@ -246,13 +265,13 @@ void SvxMenuConfigPage::DeleteSelectedTopLevel()
void SvxMenuConfigPage::DeleteSelectedContent()
{
- SvTreeListEntry *pActEntry = m_pContentsListBox->FirstSelected();
+ int nActEntry = m_xContentsListBox->get_selected_index();
- if ( pActEntry != nullptr )
+ if (nActEntry != -1)
{
// get currently selected menu entry
SvxConfigEntry* pMenuEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
// get currently selected menu
SvxConfigEntry* pMenu = GetTopLevelSelection();
@@ -261,7 +280,7 @@ void SvxMenuConfigPage::DeleteSelectedContent()
SvxConfigPageHelper::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
// remove menu entry from UI
- m_pContentsListBox->GetModel()->Remove( pActEntry );
+ m_xContentsListBox->remove(nActEntry);
// if this is a submenu entry, redraw the menus list box
if ( pMenuEntry->IsPopup() )
@@ -281,20 +300,19 @@ short SvxMenuConfigPage::QueryReset()
{
OUString msg = CuiResId( RID_SVXSTR_CONFIRM_MENU_RESET );
- OUString saveInName = m_pSaveInListBox->GetEntry(
- m_pSaveInListBox->GetSelectedEntryPos() );
+ OUString saveInName = m_xSaveInListBox->get_active_text();
OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
label));
return xQueryBox->run();
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenu, ListBox&, void )
+void SvxMenuConfigPage::SelectElement()
{
- m_pContentsListBox->Clear();
+ m_xContentsListBox->clear();
SvxConfigEntry* pMenuData = GetTopLevelSelection();
@@ -302,22 +320,24 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenu, ListBox&, void )
{
SvxEntries* pEntries = pMenuData->GetEntries();
+ int i = 0;
for (auto const& entry : *pEntries)
{
- InsertEntryIntoUI(entry);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
+ m_xContentsListBox->insert(i, sId);
+ InsertEntryIntoUI(entry, i, 0);
+ ++i;
}
}
UpdateButtonStates();
}
-IMPL_LINK( SvxMenuConfigPage, GearHdl, MenuButton *, pButton, void )
+IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
{
- OString sIdent = pButton->GetCurItemIdent();
-
- if (sIdent == "gear_add")
+ if (rIdent == "gear_add")
{
- SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(),
+ SvxMainMenuOrganizerDialog aDialog(GetDialogFrameWeld(),
GetSaveInData()->GetEntries(), nullptr, true );
if (aDialog.run() == RET_OK)
@@ -327,20 +347,20 @@ IMPL_LINK( SvxMenuConfigPage, GearHdl, MenuButton *, pButton, void )
GetSaveInData()->SetModified();
}
}
- else if (sIdent == "gear_delete")
+ else if (rIdent == "gear_delete")
{
DeleteSelectedTopLevel();
}
- else if (sIdent == "gear_rename")
+ else if (rIdent == "gear_rename")
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
OUString sCurrentName( SvxConfigPageHelper::stripHotKey( pMenuData->GetName() ) );
OUString sDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
- SvxNameDialog aNameDialog( GetFrameWeld(), sCurrentName, sDesc );
- aNameDialog.set_help_id( HID_SVX_CONFIG_RENAME_MENU );
- aNameDialog.set_title( CuiResId( RID_SVXSTR_RENAME_MENU ) );
+ SvxNameDialog aNameDialog(GetDialogFrameWeld(), sCurrentName, sDesc);
+ aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_MENU);
+ aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU));
if ( aNameDialog.run() == RET_OK )
{
@@ -356,11 +376,11 @@ IMPL_LINK( SvxMenuConfigPage, GearHdl, MenuButton *, pButton, void )
GetSaveInData()->SetModified();
}
}
- else if (sIdent == "gear_move")
+ else if (rIdent == "gear_move")
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(),
+ SvxMainMenuOrganizerDialog aDialog(GetDialogFrameWeld(), GetSaveInData()->GetEntries(),
pMenuData, false );
if (aDialog.run() == RET_OK)
{
@@ -374,26 +394,31 @@ IMPL_LINK( SvxMenuConfigPage, GearHdl, MenuButton *, pButton, void )
else
{
//This block should never be reached
- SAL_WARN("cui.customize", "Unknown gear menu option: " << sIdent);
+ SAL_WARN("cui.customize", "Unknown gear menu option: " << rIdent);
return;
}
UpdateButtonStates();
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, SelectCategory, ListBox&, void )
+IMPL_LINK_NOARG(SvxMenuConfigPage, SelectCategory, weld::ComboBox&, void)
{
- OUString aSearchTerm( m_pSearchEdit->GetText() );
+ OUString aSearchTerm( m_xSearchEdit->get_text() );
- m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm, GetSaveInData() );
+ m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), aSearchTerm, GetSaveInData());
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, AddCommandHdl, Button *, void )
+IMPL_LINK_NOARG( SvxMenuConfigPage, AddCommandHdl, weld::Button&, void )
{
- AddFunction();
+ int nPos = AddFunction();
+ if (nPos == -1)
+ return;
+ SvxConfigEntry* pEntry =
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nPos).toInt64());
+ InsertEntryIntoUI(pEntry, nPos, 0);
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, RemoveCommandHdl, Button *, void )
+IMPL_LINK_NOARG( SvxMenuConfigPage, RemoveCommandHdl, weld::Button&, void )
{
DeleteSelectedContent();
if ( GetSaveInData()->IsModified() )
@@ -402,22 +427,21 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, RemoveCommandHdl, Button *, void )
}
}
-IMPL_LINK( SvxMenuConfigPage, InsertHdl, MenuButton *, pButton, void )
+IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
{
- OString sIdent = pButton->GetCurItemIdent();
-
- if (sIdent == "insertseparator")
+ if (rIdent == "insertseparator")
{
SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
pNewEntryData->SetUserDefined();
- InsertEntry( pNewEntryData );
+ int nPos = InsertEntry(pNewEntryData, -1);
+ InsertEntryIntoUI(pNewEntryData, nPos, 0);
}
- else if (sIdent == "insertsubmenu")
+ else if (rIdent == "insertsubmenu")
{
OUString aNewName;
OUString aDesc = CuiResId( RID_SVXSTR_SUBMENU_NAME );
- SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
+ SvxNameDialog aNameDialog(GetDialogFrameWeld(), aNewName, aDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_NAME_SUBMENU);
aNameDialog.set_title(CuiResId( RID_SVXSTR_ADD_SUBMENU));
@@ -430,10 +454,14 @@ IMPL_LINK( SvxMenuConfigPage, InsertHdl, MenuButton *, pButton, void )
pNewEntryData->SetName( aNewName );
pNewEntryData->SetUserDefined();
- InsertEntry( pNewEntryData );
+ int nPos = InsertEntry(pNewEntryData, -1);
+ InsertEntryIntoUI(pNewEntryData, nPos, 0);
ReloadTopLevelListBox();
+ m_xContentsListBox->scroll_to_row(nPos);
+ m_xContentsListBox->select(nPos);
+
GetSaveInData()->SetModified();
}
@@ -441,7 +469,7 @@ IMPL_LINK( SvxMenuConfigPage, InsertHdl, MenuButton *, pButton, void )
else
{
//This block should never be reached
- SAL_WARN("cui.customize", "Unknown insert option: " << sIdent);
+ SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
return;
}
@@ -451,22 +479,18 @@ IMPL_LINK( SvxMenuConfigPage, InsertHdl, MenuButton *, pButton, void )
}
}
-IMPL_LINK( SvxMenuConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
+IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OString&, rIdent, void)
{
- OString sIdent = pButton->GetCurItemIdent();
-
- SAL_WARN("cui.customize", "sIdent: " << sIdent);
-
- if (sIdent == "renameItem")
+ if (rIdent == "renameItem")
{
- SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
+ int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
- SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
+ SvxNameDialog aNameDialog(GetDialogFrameWeld(), aNewName, aDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_MENU_ITEM);
aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU));
@@ -475,7 +499,7 @@ IMPL_LINK( SvxMenuConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
aNewName = aNameDialog.GetName();
pEntry->SetName( aNewName );
- m_pContentsListBox->SetEntryText( pActEntry, aNewName );
+ m_xContentsListBox->set_text(nActEntry, aNewName, 1);
GetSaveInData()->SetModified();
GetTopLevelSelection()->SetModified();
@@ -484,7 +508,7 @@ IMPL_LINK( SvxMenuConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
else
{
//This block should never be reached
- SAL_WARN("cui.customize", "Unknown insert option: " << sIdent);
+ SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
return;
}
@@ -494,7 +518,7 @@ IMPL_LINK( SvxMenuConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
}
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, ResetMenuHdl, Button *, void )
+IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void)
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
@@ -504,7 +528,7 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, ResetMenuHdl, Button *, void )
return;
}
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT_MENU)));
@@ -512,20 +536,20 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, ResetMenuHdl, Button *, void )
// So we are resetting only if it is a context menu
if (!m_bIsMenuBar && xQueryBox->run() == RET_YES)
{
- sal_Int32 nPos = m_pTopLevelListBox->GetSelectedEntryPos();
+ sal_Int32 nPos = m_xTopLevelListBox->get_active();
ContextMenuSaveInData* pSaveInData = static_cast< ContextMenuSaveInData* >(GetSaveInData());
pSaveInData->ResetContextMenu(pMenuData);
// ensure that the UI is cleared before populating it
- m_pTopLevelListBox->Clear();
- m_pContentsListBox->Clear();
+ m_xTopLevelListBox->clear();
+ m_xContentsListBox->clear();
ReloadTopLevelListBox();
// Reselect the resetted menu
- m_pTopLevelListBox->SelectEntryPos(nPos);
- m_pTopLevelListBox->GetSelectHdl().Call(*m_pTopLevelListBox);
+ m_xTopLevelListBox->set_active(nPos);
+ SelectElement();
}
}
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 56c9c85c6734..252efe5bb7ba 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -96,60 +96,65 @@
#include <dlgname.hxx>
-SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
+SvxToolbarConfigPage::SvxToolbarConfigPage(TabPageParent pParent, const SfxItemSet& rSet)
: SvxConfigPage(pParent, rSet)
{
- SetHelpId( HID_SVX_CONFIG_TOOLBAR );
-
- m_pContentsListBox = VclPtr<SvxToolbarEntriesListBox>::Create(m_pEntries, this);
- m_pContentsListBox->set_grid_left_attach(0);
- m_pContentsListBox->set_grid_top_attach(0);
- m_pContentsListBox->set_hexpand(true);
- m_pContentsListBox->set_vexpand(true);
- m_pContentsListBox->Show();
-
- m_pTopLevelListBox->SetHelpId ( HID_SVX_TOPLEVELLISTBOX );
- m_pContentsListBox->SetHelpId( HID_SVX_CONFIG_TOOLBAR_CONTENTS );
- m_pSaveInListBox->SetHelpId( HID_SVX_SAVE_IN );
- m_pMoveUpButton->SetHelpId( HID_SVX_UP_TOOLBAR_ITEM );
- m_pMoveDownButton->SetHelpId( HID_SVX_DOWN_TOOLBAR_ITEM );
- m_pDescriptionField->SetHelpId ( HID_SVX_DESCFIELD );
-
- m_pTopLevelListBox->SetSelectHdl(
- LINK( this, SvxToolbarConfigPage, SelectToolbar ) );
- m_pContentsListBox->SetSelectHdl(
+ m_xContainer->set_help_id(HID_SVX_CONFIG_TOOLBAR);
+
+ m_xContentsListBox.reset(new SvxToolbarEntriesListBox(m_xBuilder->weld_tree_view("toolcontents"), this));
+ std::vector<int> aWidths;
+ weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
+ Size aSize(m_xFunctions->get_size_request());
+ rTreeView.set_size_request(aSize.Width(), aSize.Height());
+ aWidths.push_back(rTreeView.get_checkbox_column_width());
+ aWidths.push_back(rTreeView.get_checkbox_column_width());
+ rTreeView.set_column_fixed_widths(aWidths);
+ rTreeView.set_grid_left_attach(0);
+ rTreeView.set_grid_top_attach(0);
+ rTreeView.set_hexpand(true);
+ rTreeView.set_vexpand(true);
+ rTreeView.set_help_id( HID_SVX_CONFIG_TOOLBAR_CONTENTS );
+ rTreeView.show();
+
+ rTreeView.connect_changed(
LINK( this, SvxToolbarConfigPage, SelectToolbarEntry ) );
- m_pCommandCategoryListBox->SetSelectHdl(
+
+ rTreeView.connect_model_changed(LINK(this, SvxToolbarConfigPage, ListModifiedHdl));
+
+ m_xTopLevelListBox->set_help_id ( HID_SVX_TOPLEVELLISTBOX );
+ m_xSaveInListBox->set_help_id( HID_SVX_SAVE_IN );
+ m_xMoveUpButton->set_help_id( HID_SVX_UP_TOOLBAR_ITEM );
+ m_xMoveDownButton->set_help_id( HID_SVX_DOWN_TOOLBAR_ITEM );
+ m_xDescriptionField->set_help_id ( HID_SVX_DESCFIELD );
+
+ m_xCommandCategoryListBox->connect_changed(
LINK( this, SvxToolbarConfigPage, SelectCategory ) );
- m_pGearBtn->SetSelectHdl(
+ m_xGearBtn->connect_selected(
LINK( this, SvxToolbarConfigPage, GearHdl ) );
- m_pMoveUpButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) );
- m_pMoveDownButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) );
+ m_xMoveUpButton->connect_clicked( LINK( this, SvxToolbarConfigPage, MoveHdl) );
+ m_xMoveDownButton->connect_clicked( LINK( this, SvxToolbarConfigPage, MoveHdl) );
// Always enable Up and Down buttons
// added for issue i53677 by shizhoubo
- m_pMoveDownButton->Enable();
- m_pMoveUpButton->Enable();
+ m_xMoveDownButton->set_sensitive(true);
+ m_xMoveUpButton->set_sensitive(true);
- m_pAddCommandButton->SetClickHdl( LINK( this, SvxToolbarConfigPage, AddCommandHdl ) );
- m_pRemoveCommandButton->SetClickHdl( LINK( this, SvxToolbarConfigPage, RemoveCommandHdl ) );
+ m_xAddCommandButton->connect_clicked( LINK( this, SvxToolbarConfigPage, AddCommandHdl ) );
+ m_xRemoveCommandButton->connect_clicked( LINK( this, SvxToolbarConfigPage, RemoveCommandHdl ) );
- m_pInsertBtn->SetSelectHdl(
+ m_xInsertBtn->connect_selected(
LINK( this, SvxToolbarConfigPage, InsertHdl ) );
- m_pModifyBtn->SetSelectHdl(
+ m_xModifyBtn->connect_selected(
LINK( this, SvxToolbarConfigPage, ModifyItemHdl ) );
- m_pResetBtn->SetClickHdl(
+ m_xResetBtn->connect_clicked(
LINK( this, SvxToolbarConfigPage, ResetToolbarHdl ) );
// "Insert Submenu" is irrelevant to the toolbars
- PopupMenu* pPopup = m_pInsertBtn->GetPopupMenu();
- pPopup->EnableItem(OString( "insertsubmenu"), false );
- pPopup->RemoveDisabledEntries();
+ m_xInsertBtn->remove_item("insertsubmenu");
// Gear menu's "Move" action is irrelevant to the toolbars
- pPopup = m_pGearBtn->GetPopupMenu();
- pPopup->EnableItem("gear_move", false);
+ m_xGearBtn->set_item_sensitive("gear_move", false);
// default toolbar to select is standardbar unless a different one
// has been passed in
@@ -169,6 +174,23 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
}
}
+IMPL_LINK_NOARG(SvxToolbarConfigPage, ListModifiedHdl, weld::TreeView&, void)
+{
+ // regenerate with the current ordering within the list
+ SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
+ pEntries->clear();
+
+ for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
+ pEntries->push_back(reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
+
+ GetSaveInData()->SetModified();
+ GetTopLevelSelection()->SetModified();
+
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
+ if ( pToolbar )
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar( pToolbar );
+}
+
SvxToolbarConfigPage::~SvxToolbarConfigPage()
{
disposeOnce();
@@ -176,41 +198,41 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
void SvxToolbarConfigPage::dispose()
{
- for ( sal_Int32 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
+ for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
{
ToolbarSaveInData* pData =
- static_cast<ToolbarSaveInData*>(m_pSaveInListBox->GetEntryData( i ));
-
+ reinterpret_cast<ToolbarSaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
delete pData;
}
- m_pSaveInListBox->Clear();
+ m_xSaveInListBox->clear();
SvxConfigPage::dispose();
}
void SvxToolbarConfigPage::DeleteSelectedTopLevel()
{
- const sal_Int32 nSelectionPos = m_pTopLevelListBox->GetSelectedEntryPos();
+ const sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
pSaveInData->RemoveToolbar( GetTopLevelSelection() );
- if ( m_pTopLevelListBox->GetEntryCount() > 1 )
+ int nCount = m_xTopLevelListBox->get_count();
+ if (nCount > 1)
{
// select next entry after the one being deleted
// selection position is indexed from 0 so need to
// subtract one from the entry count
- if ( nSelectionPos != m_pTopLevelListBox->GetEntryCount() - 1 )
+ if (nSelectionPos != nCount - 1)
{
- m_pTopLevelListBox->SelectEntryPos( nSelectionPos + 1 );
+ m_xTopLevelListBox->set_active(nSelectionPos + 1);
}
else
{
- m_pTopLevelListBox->SelectEntryPos( nSelectionPos - 1 );
+ m_xTopLevelListBox->set_active(nSelectionPos - 1);
}
- m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
+ SelectElement();
// and now remove the entry
- m_pTopLevelListBox->RemoveEntry( nSelectionPos );
+ m_xTopLevelListBox->remove(nSelectionPos);
}
else
{
@@ -220,13 +242,13 @@ void SvxToolbarConfigPage::DeleteSelectedTopLevel()
void SvxToolbarConfigPage::DeleteSelectedContent()
{
- SvTreeListEntry *pActEntry = m_pContentsListBox->FirstSelected();
+ int nActEntry = m_xContentsListBox->get_selected_index();
- if ( pActEntry != nullptr )
+ if (nActEntry != -1)
{
// get currently selected entry
SvxConfigEntry* pEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
SvxConfigEntry* pToolbar = GetTopLevelSelection();
@@ -234,7 +256,7 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
SvxConfigPageHelper::RemoveEntry( pToolbar->GetEntries(), pEntry );
// remove toolbar entry from UI
- m_pContentsListBox->GetModel()->Remove( pActEntry );
+ m_xContentsListBox->remove(nActEntry);
// delete data for toolbar entry
delete pEntry;
@@ -245,10 +267,10 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
// if this is the last entry in the toolbar and it is a user
// defined toolbar pop up a dialog asking the user if they
// want to delete the toolbar
- if ( m_pContentsListBox->GetEntryCount() == 0 &&
+ if ( m_xContentsListBox->n_children() == 0 &&
GetTopLevelSelection()->IsDeletable() )
{
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR)));
if (xQueryBox->run() == RET_YES)
@@ -259,9 +281,9 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
}
}
-IMPL_LINK( SvxToolbarConfigPage, MoveHdl, Button *, pButton, void )
+IMPL_LINK( SvxToolbarConfigPage, MoveHdl, weld::Button&, rButton, void )
{
- MoveEntry(pButton == m_pMoveUpButton);
+ MoveEntry(&rButton == m_xMoveUpButton.get());
}
void SvxToolbarConfigPage::MoveEntry( bool bMoveUp )
@@ -282,18 +304,18 @@ void SvxToolbarConfigPage::MoveEntry( bool bMoveUp )
void SvxToolbarConfigPage::Init()
{
// ensure that the UI is cleared before populating it
- m_pTopLevelListBox->Clear();
- m_pContentsListBox->Clear();
+ m_xTopLevelListBox->clear();
+ m_xContentsListBox->clear();
ReloadTopLevelListBox();
sal_Int32 nPos = 0;
if ( !m_aURLToSelect.isEmpty() )
{
- for ( sal_Int32 i = 0 ; i < m_pTopLevelListBox->GetEntryCount(); ++i )
+ for (sal_Int32 i = 0, nCount = m_xTopLevelListBox->get_count(); i < nCount; ++i)
{
SvxConfigEntry* pData =
- static_cast<SvxConfigEntry*>(m_pTopLevelListBox->GetEntryData( i ));
+ reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(i).toInt64());
if ( pData->GetCommand().equals( m_aURLToSelect ) )
{
@@ -307,14 +329,14 @@ void SvxToolbarConfigPage::Init()
m_aURLToSelect += "standardbar";
}
- m_pTopLevelListBox->SelectEntryPos(nPos);
- m_pTopLevelListBox->GetSelectHdl().Call(*m_pTopLevelListBox);
+ m_xTopLevelListBox->set_active(nPos);
+ SelectElement();
- m_pCommandCategoryListBox->Init(
+ m_xCommandCategoryListBox->Init(
comphelper::getProcessComponentContext(),
m_xFrame,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
- m_pCommandCategoryListBox->categorySelected( m_pFunctions, OUString(), GetSaveInData() );
+ m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), OUString(), GetSaveInData());
}
SaveInData* SvxToolbarConfigPage::CreateSaveInData(
@@ -327,17 +349,16 @@ SaveInData* SvxToolbarConfigPage::CreateSaveInData(
new ToolbarSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig ));
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectToolbarEntry, SvTreeListBox *, void )
+IMPL_LINK_NOARG(SvxToolbarConfigPage, SelectToolbarEntry, weld::TreeView&, void)
{
UpdateButtonStates();
}
-IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
+IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
{
- OString sIdent = pButton->GetCurItemIdent();
SvxConfigEntry* pCurrentToolbar = GetTopLevelSelection();
- if (sIdent == "gear_add")
+ if (rIdent == "gear_add")
{
OUString prefix = CuiResId( RID_SVXSTR_NEW_TOOLBAR );
@@ -347,13 +368,13 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
OUString aNewURL =
SvxConfigPageHelper::generateCustomURL( GetSaveInData()->GetEntries() );
- SvxNewToolbarDialog aNameDialog(GetFrameWeld(), aNewName);
+ SvxNewToolbarDialog aNameDialog(GetDialogFrameWeld(), aNewName);
- // Reflect the actual m_pSaveInListBox into the new toolbar dialog
- for (sal_Int32 i = 0; i < m_pSaveInListBox->GetEntryCount(); ++i)
- aNameDialog.m_xSaveInListBox->append_text(m_pSaveInListBox->GetEntry(i));
+ // Reflect the actual m_xSaveInListBox into the new toolbar dialog
+ for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
+ aNameDialog.m_xSaveInListBox->append_text(m_xSaveInListBox->get_text(i));
- aNameDialog.m_xSaveInListBox->set_active(m_pSaveInListBox->GetSelectedEntryPos());
+ aNameDialog.m_xSaveInListBox->set_active(m_xSaveInListBox->get_active());
if (aNameDialog.run() == RET_OK)
{
@@ -363,13 +384,13 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
int nInsertPos = aNameDialog.m_xSaveInListBox->get_active();
ToolbarSaveInData* pData =
- static_cast<ToolbarSaveInData*>(
- m_pSaveInListBox->GetEntryData( nInsertPos ) );
+ reinterpret_cast<ToolbarSaveInData*>(
+ m_xSaveInListBox->get_id(nInsertPos).toInt64() );
if ( GetSaveInData() != pData )
{
- m_pSaveInListBox->SelectEntryPos( nInsertPos );
- m_pSaveInListBox->GetSelectHdl().Call(*m_pSaveInListBox);
+ m_xSaveInListBox->set_active(nInsertPos);
+ SelectSaveInLocation(*m_xSaveInListBox);
}
SvxConfigEntry* pToolbar =
@@ -380,15 +401,15 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
pData->CreateToolbar( pToolbar );
- nInsertPos = m_pTopLevelListBox->InsertEntry( pToolbar->GetName() );
- m_pTopLevelListBox->SetEntryData( nInsertPos, pToolbar );
- m_pTopLevelListBox->SelectEntryPos( nInsertPos );
- m_pTopLevelListBox->GetSelectHdl().Call(*m_pTopLevelListBox);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pToolbar)));
+ m_xTopLevelListBox->append(sId, pToolbar->GetName());
+ m_xTopLevelListBox->set_active_id(sId);
+ SelectElement();
pData->SetModified();
}
}
- else if (sIdent == "gear_delete")
+ else if (rIdent == "gear_delete")
{
if ( pCurrentToolbar && pCurrentToolbar->IsDeletable() )
{
@@ -396,20 +417,20 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
UpdateButtonStates();
}
}
- else if (sIdent == "gear_rename")
+ else if (rIdent == "gear_rename")
{
- sal_Int32 nSelectionPos = m_pTopLevelListBox->GetSelectedEntryPos();
+ sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
SvxConfigEntry* pToolbar =
- static_cast<SvxConfigEntry*>(m_pTopLevelListBox->GetEntryData( nSelectionPos ));
+ reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos).toInt64());
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
//Rename the toolbar
OUString sCurrentName( SvxConfigPageHelper::stripHotKey( pToolbar->GetName() ) );
OUString sDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
- SvxNameDialog aNameDialog( GetFrameWeld(), sCurrentName, sDesc );
- aNameDialog.set_help_id( HID_SVX_CONFIG_RENAME_TOOLBAR );
- aNameDialog.set_title( CuiResId( RID_SVXSTR_RENAME_TOOLBAR ) );
+ SvxNameDialog aNameDialog(GetDialogFrameWeld(), sCurrentName, sDesc);
+ aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_TOOLBAR);
+ aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_TOOLBAR));
if ( aNameDialog.run() == RET_OK )
{
@@ -422,14 +443,13 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
pSaveInData->ApplyToolbar( pToolbar );
// have to use remove and insert to change the name
- m_pTopLevelListBox->RemoveEntry( nSelectionPos );
- nSelectionPos =
- m_pTopLevelListBox->InsertEntry( sNewName, nSelectionPos );
- m_pTopLevelListBox->SetEntryData( nSelectionPos, pToolbar );
- m_pTopLevelListBox->SelectEntryPos( nSelectionPos );
+ m_xTopLevelListBox->remove(nSelectionPos);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pToolbar)));
+ m_xTopLevelListBox->insert(nSelectionPos, sNewName, &sId, nullptr, nullptr);
+ m_xTopLevelListBox->set_active_id(sId);
}
}
- else if (sIdent == "gear_iconOnly" || sIdent == "gear_textOnly" || sIdent == "gear_iconAndText")
+ else if (rIdent == "gear_iconOnly" || rIdent == "gear_textOnly" || rIdent == "gear_iconAndText")
{
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
@@ -440,48 +460,46 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
}
sal_Int32 nStyle = 0;
- if (sIdent == "gear_iconOnly")
+ if (rIdent == "gear_iconOnly")
nStyle = 0;
- else if (sIdent == "gear_textOnly")
+ else if (rIdent == "gear_textOnly")
nStyle = 1;
- else if (sIdent == "gear_iconAndText")
+ else if (rIdent == "gear_iconAndText")
nStyle = 2;
pCurrentToolbar->SetStyle( nStyle );
pSaveInData->SetSystemStyle( m_xFrame, pCurrentToolbar->GetCommand(), nStyle );
- m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
+ SelectElement();
}
else
{
//This block should never be reached
- SAL_WARN("cui.customize", "Unknown gear menu option: " << sIdent);
+ SAL_WARN("cui.customize", "Unknown gear menu option: " << rIdent);
return;
}
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, ListBox&, void )
+IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, weld::ComboBox&, void )
{
- OUString aSearchTerm( m_pSearchEdit->GetText() );
+ OUString aSearchTerm(m_xSearchEdit->get_text());
- m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm, GetSaveInData() );
+ m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), aSearchTerm, GetSaveInData());
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, AddCommandHdl, Button *, void )
+IMPL_LINK_NOARG( SvxToolbarConfigPage, AddCommandHdl, weld::Button&, void )
{
AddFunction();
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, RemoveCommandHdl, Button *, void )
+IMPL_LINK_NOARG( SvxToolbarConfigPage, RemoveCommandHdl, weld::Button&, void )
{
DeleteSelectedContent();
}
-IMPL_LINK( SvxToolbarConfigPage, InsertHdl, MenuButton *, pButton, void )
+IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OString&, rIdent, void)
{
- OString sIdent = pButton->GetCurItemIdent();
-
- if (sIdent == "insertseparator")
+ if (rIdent == "insertseparator")
{
// Get the currently selected toolbar
SvxConfigEntry* pToolbar = GetTopLevelSelection();
@@ -489,11 +507,8 @@ IMPL_LINK( SvxToolbarConfigPage, InsertHdl, MenuButton *, pButton, void )
SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
pNewEntryData->SetUserDefined();
- SvTreeListEntry* pNewLBEntry = InsertEntry( pNewEntryData );
-
- m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
- m_pContentsListBox->SetCheckButtonState(
- pNewLBEntry, SvButtonState::Tristate );
+ int nPos = InsertEntry(pNewEntryData, -1);
+ InsertEntryIntoUI(pNewEntryData, nPos, 1);
static_cast<ToolbarSaveInData*>( GetSaveInData())->ApplyToolbar( pToolbar );
@@ -502,35 +517,34 @@ IMPL_LINK( SvxToolbarConfigPage, InsertHdl, MenuButton *, pButton, void )
else
{
//This block should never be reached
- SAL_WARN("cui.customize", "Unknown insert option: " << sIdent);
+ SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
return;
}
}
-IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
+IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
{
bool bNeedsApply = false;
// get currently selected toolbar
SvxConfigEntry* pToolbar = GetTopLevelSelection();
- OString sIdent = pButton->GetCurItemIdent();
- if (sIdent.isEmpty() || pToolbar == nullptr)
+ if (rIdent.isEmpty() || pToolbar == nullptr)
{
- SAL_WARN("cui.customize", "No toolbar selected, or empty sIdent!");
+ SAL_WARN("cui.customize", "No toolbar selected, or empty rIdent!");
return;
}
- if (sIdent == "renameItem")
+ if (rIdent == "renameItem")
{
- SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
+ int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
- SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
+ SvxNameDialog aNameDialog(GetDialogFrameWeld(), aNewName, aDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM);
aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_TOOLBAR));
@@ -543,19 +557,15 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
else
pEntry->SetName( aNewName );
- m_pContentsListBox->SetEntryText( pActEntry, aNewName );
+ m_xContentsListBox->set_text(nActEntry, aNewName, 2);
bNeedsApply = true;
}
}
- else if (sIdent == "changeIcon")
+ else if (rIdent == "changeIcon")
{
- SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
+ int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
-
- // Position of entry within the list
- // TODO: Add a GetSelectionPos() method to the SvTreeListBox class
- sal_uInt16 nSelectionPos = m_pContentsListBox->GetModel()->GetAbsPos( pActEntry );
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
SvxIconSelectorDialog aIconDialog(GetDialogFrameWeld(),
GetSaveInData()->GetImageManager(),
@@ -575,13 +585,13 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
if ( !pEntry->GetBackupGraphic().is() )
{
- css::uno::Reference< css::graphic::XGraphic > backup;
- backup = SvxConfigPageHelper::GetGraphic(
- GetSaveInData()->GetImageManager(), aURLSeq[ 0 ] );
+ css::uno::Reference< css::graphic::XGraphic > backup =
+ SvxConfigPageHelper::GetGraphic(GetSaveInData()->GetImageManager(),
+ aURLSeq[0]);
if ( backup.is() )
{
- pEntry->SetBackupGraphic( backup );
+ pEntry->SetBackupGraphic(backup);
}
}
@@ -591,16 +601,15 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
GetSaveInData()->GetImageManager()->replaceImages(
SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
- m_pContentsListBox->GetModel()->Remove( pActEntry );
- SvTreeListEntry* pNewLBEntry =
- InsertEntryIntoUI( pEntry, nSelectionPos );
+ m_xContentsListBox->remove(nActEntry);
- m_pContentsListBox->SetCheckButtonState( pNewLBEntry,
- pEntry->IsVisible() ?
- SvButtonState::Checked : SvButtonState::Unchecked );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xContentsListBox->insert(nActEntry, sId);
+ m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible(), 0);
+ InsertEntryIntoUI(pEntry, nActEntry, 1);
- m_pContentsListBox->Select( pNewLBEntry );
- m_pContentsListBox->MakeVisible( pNewLBEntry );
+ m_xContentsListBox->select(nActEntry);
+ m_xContentsListBox->scroll_to_row(nActEntry);
GetSaveInData()->PersistChanges(
GetSaveInData()->GetImageManager() );
@@ -612,15 +621,11 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
}
}
}
- else if (sIdent == "resetIcon")
+ else if (rIdent == "resetIcon")
{
- SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
+ int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
-
- // Position of entry within the list
- // TODO: Add a GetSelectionPos() method to the SvTreeListBox class
- sal_uInt16 nSelectionPos = m_pContentsListBox->GetModel()->GetAbsPos( pActEntry );
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
css::uno::Reference< css::graphic::XGraphic > backup =
pEntry->GetBackupGraphic();
@@ -636,17 +641,15 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
GetSaveInData()->GetImageManager()->replaceImages(
SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
- m_pContentsListBox->GetModel()->Remove( pActEntry );
+ m_xContentsListBox->remove(nActEntry);
- SvTreeListEntry* pNewLBEntry =
- InsertEntryIntoUI( pEntry, nSelectionPos );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xContentsListBox->insert(nActEntry, sId);
+ m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible(), 0);
+ InsertEntryIntoUI(pEntry, nActEntry, 1);
- m_pContentsListBox->SetCheckButtonState( pNewLBEntry,
- pEntry->IsVisible() ?
- SvButtonState::Checked : SvButtonState::Unchecked );
-
- m_pContentsListBox->Select( pNewLBEntry );
- m_pContentsListBox->MakeVisible( pNewLBEntry );
+ m_xContentsListBox->select(nActEntry);
+ m_xContentsListBox->scroll_to_row(nActEntry);
// reset backup in entry
pEntry->SetBackupGraphic(
@@ -660,15 +663,11 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
SAL_WARN("cui.customize", "Error resetting image: " << e);
}
}
- else if (sIdent == "restoreItem")
+ else if (rIdent == "restoreItem")
{
- SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
+ int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry =
- static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
-
- // Position of entry within the list
- // TODO: Add a GetSelectionPos() method to the SvTreeListBox class
- sal_uInt16 nSelectionPos = m_pContentsListBox->GetModel()->GetAbsPos( pActEntry );
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
ToolbarSaveInData* pSaveInData =
static_cast<ToolbarSaveInData*>( GetSaveInData() );
@@ -679,8 +678,8 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
if ( !pEntry->GetName().equals( aSystemName ) )
{
pEntry->SetName( aSystemName );
- m_pContentsListBox->SetEntryText(
- pActEntry, SvxConfigPageHelper::stripHotKey( aSystemName ) );
+ m_xContentsListBox->set_text(
+ nActEntry, SvxConfigPageHelper::stripHotKey(aSystemName), 2);
bNeedsApply = true;
}
@@ -698,17 +697,16 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
GetSaveInData()->PersistChanges(
GetSaveInData()->GetImageManager() );
- m_pContentsListBox->RemoveEntry( pActEntry );
+ m_xContentsListBox->remove(nActEntry);
- SvTreeListEntry* pNewLBEntry =
- InsertEntryIntoUI( pEntry, nSelectionPos );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xContentsListBox->insert(nActEntry, sId);
+ m_xContentsListBox->set_toggle(nActEntry,
+ pEntry->IsVisible(), 0);
+ InsertEntryIntoUI(pEntry, nActEntry, 1);
- m_pContentsListBox->SetCheckButtonState( pNewLBEntry,
- pEntry->IsVisible() ?
- SvButtonState::Checked : SvButtonState::Unchecked );
-
- m_pContentsListBox->Select( pNewLBEntry );
- m_pContentsListBox->MakeVisible( pNewLBEntry );
+ m_xContentsListBox->select(nActEntry);
+ m_xContentsListBox->scroll_to_row(nActEntry);
bNeedsApply = true;
}
@@ -720,7 +718,7 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
else
{
//This block should never be reached
- SAL_WARN("cui.customize", "Unknown insert option: " << sIdent);
+ SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
return;
}
@@ -731,14 +729,14 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
}
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, ResetToolbarHdl, Button *, void )
+IMPL_LINK_NOARG(SvxToolbarConfigPage, ResetToolbarHdl, weld::Button&, void)
{
- sal_Int32 nSelectionPos = m_pTopLevelListBox->GetSelectedEntryPos();
+ sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
SvxConfigEntry* pToolbar =
- static_cast<SvxConfigEntry*>(m_pTopLevelListBox->GetEntryData( nSelectionPos ));
+ reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos).toInt64());
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT)));
if (xQueryBox->run() == RET_YES)
@@ -748,115 +746,103 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, ResetToolbarHdl, Button *, void )
pSaveInData->RestoreToolbar( pToolbar );
- m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
+ SelectElement();
}
}
void SvxToolbarConfigPage::UpdateButtonStates()
{
SvxConfigEntry* pToolbar = GetTopLevelSelection();
- SvTreeListEntry* selection = m_pContentsListBox->GetCurEntry();
+ int selection = m_xContentsListBox->get_selected_index();
bool bIsSeparator =
- selection && static_cast<SvxConfigEntry*>(selection->GetUserData())->IsSeparator();
+ selection != -1 && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())->IsSeparator();
bool bIsValidSelection =
- !(m_pContentsListBox->GetEntryCount() == 0 || selection == nullptr);
+ !(m_xContentsListBox->n_children() == 0 || selection == -1);
- m_pMoveUpButton->Enable( bIsValidSelection );
- m_pMoveDownButton->Enable( bIsValidSelection );
+ m_xMoveUpButton->set_sensitive( bIsValidSelection );
+ m_xMoveDownButton->set_sensitive( bIsValidSelection );
- m_pRemoveCommandButton->Enable( bIsValidSelection );
+ m_xRemoveCommandButton->set_sensitive( bIsValidSelection );
- m_pModifyBtn->Enable( bIsValidSelection && !bIsSeparator );
+ m_xModifyBtn->set_sensitive( bIsValidSelection && !bIsSeparator );
// Handle the gear button
- PopupMenu* pPopup = m_pGearBtn->GetPopupMenu();
// "gear_add" option is always enabled
- pPopup->EnableItem( "gear_delete", pToolbar && pToolbar->IsDeletable() );
- pPopup->EnableItem( "gear_rename", pToolbar && pToolbar->IsRenamable() );
+ m_xGearBtn->set_item_sensitive("gear_delete", pToolbar && pToolbar->IsDeletable());
+ m_xGearBtn->set_item_sensitive("gear_rename", pToolbar && pToolbar->IsRenamable());
}
short SvxToolbarConfigPage::QueryReset()
{
OUString msg = CuiResId( RID_SVXSTR_CONFIRM_TOOLBAR_RESET );
- OUString saveInName = m_pSaveInListBox->GetEntry(
- m_pSaveInListBox->GetSelectedEntryPos() );
+ OUString saveInName = m_xSaveInListBox->get_active_text();
OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
label));
return xQueryBox->run();
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectToolbar, ListBox&, void )
+void SvxToolbarConfigPage::SelectElement()
{
- m_pContentsListBox->Clear();
+ m_xContentsListBox->clear();
SvxConfigEntry* pToolbar = GetTopLevelSelection();
if ( pToolbar == nullptr )
{
//TODO: Disable related buttons
- m_pInsertBtn->Enable( false );
- m_pResetBtn->Enable( false );
- m_pGearBtn->Enable( false );
+ m_xInsertBtn->set_sensitive( false );
+ m_xResetBtn->set_sensitive( false );
+ m_xGearBtn->set_sensitive( false );
return;
}
else
{
- m_pInsertBtn->Enable();
- m_pResetBtn->Enable();
- m_pGearBtn->Enable();
+ m_xInsertBtn->set_sensitive(true);
+ m_xResetBtn->set_sensitive(true);
+ m_xGearBtn->set_sensitive(true);
}
- PopupMenu* pGearMenu = m_pGearBtn->GetPopupMenu();
- switch( pToolbar->GetStyle() )
+ switch (pToolbar->GetStyle())
{
case 0:
{
- pGearMenu->CheckItem( "gear_iconOnly" );
+ m_xGearBtn->set_item_active("gear_iconOnly", true);
break;
}
case 1:
{
- pGearMenu->CheckItem( "gear_textOnly" );
+ m_xGearBtn->set_item_active("gear_textOnly", true);
break;
}
case 2:
{
- pGearMenu->CheckItem( "gear_iconAndText" );
+ m_xGearBtn->set_item_active("gear_iconAndText", true);
break;
}
}
+ int i = 0;
SvxEntries* pEntries = pToolbar->GetEntries();
for (auto const& entry : *pEntries)
{
- SvTreeListEntry* pNewLBEntry = InsertEntryIntoUI(entry);
-
- if(entry->IsSeparator())
- m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
-
- if (entry->IsBinding())
- {
- m_pContentsListBox->SetCheckButtonState( pNewLBEntry,
- entry->IsVisible() ? SvButtonState::Checked : SvButtonState::Unchecked );
- }
- else
- {
- m_pContentsListBox->SetCheckButtonState(
- pNewLBEntry, SvButtonState::Tristate );
- }
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
+ m_xContentsListBox->insert(i, sId);
+ if (entry->IsBinding() && !entry->IsSeparator())
+ m_xContentsListBox->set_toggle(i, entry->IsVisible(), 0);
+ InsertEntryIntoUI(entry, i, 1);
+ ++i;
}
UpdateButtonStates();
}
-void SvxToolbarConfigPage::AddFunction(
- SvTreeListEntry* pTarget, bool bFront )
+void SvxToolbarConfigPage::AddFunction(int nTarget, bool bFront)
{
SvxConfigEntry* pToolbar = GetTopLevelSelection();
@@ -864,26 +850,22 @@ void SvxToolbarConfigPage::AddFunction(
return;
// Add the command to the contents listbox of the selected toolbar
- SvTreeListEntry* pNewLBEntry =
- SvxConfigPage::AddFunction( pTarget, bFront, true/*bAllowDuplicates*/ );
+ int nNewLBEntry =
+ SvxConfigPage::AddFunction(nTarget, bFront, true/*bAllowDuplicates*/);
- if (pNewLBEntry == nullptr)
+ if (nNewLBEntry == -1)
return;
- SvxConfigEntry* pEntry = static_cast<SvxConfigEntry*>(pNewLBEntry->GetUserData());
+ SvxConfigEntry* pEntry = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nNewLBEntry).toInt64());
- if ( pEntry->IsBinding() )
- {
- pEntry->SetVisible( true );
- m_pContentsListBox->SetCheckButtonState(
- pNewLBEntry, SvButtonState::Checked );
- }
- else
+ if ( pEntry->IsBinding() ) //TODO sep ?
{
- m_pContentsListBox->SetCheckButtonState(
- pNewLBEntry, SvButtonState::Tristate );
+ pEntry->SetVisible(true);
+ m_xContentsListBox->set_toggle(nNewLBEntry, true, 0);
}
+ InsertEntryIntoUI(pEntry, nNewLBEntry, 1);
+
// Changes are not visible on the toolbar until this point
// TODO: Figure out a way to show the changes on the toolbar, but revert if
// the dialog is closed by pressing "Cancel"
@@ -894,187 +876,56 @@ void SvxToolbarConfigPage::AddFunction(
}
}
-SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(vcl::Window* pParent, SvxToolbarConfigPage* pPg)
- : SvxMenuEntriesListBox(pParent, pPg)
- , pPage(pPg)
+SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(std::unique_ptr<weld::TreeView> xParent, SvxToolbarConfigPage* pPg)
+ : SvxMenuEntriesListBox(std::move(xParent), pPg)
{
- m_pButtonData.reset(new SvLBoxButtonData( this ));
- BuildCheckBoxButtonImages( m_pButtonData.get() );
- EnableCheckButton( m_pButtonData.get() );
+ m_xControl->connect_toggled(LINK(this, SvxToolbarEntriesListBox, CheckButtonHdl));
+ m_xControl->connect_key_press(Link<const KeyEvent&, bool>()); //acknowledge we first remove the old one
+ m_xControl->connect_key_press(LINK(this, SvxToolbarEntriesListBox, KeyInputHdl)); // then add the new one
}
SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
{
- disposeOnce();
-}
-
-void SvxToolbarEntriesListBox::dispose()
-{
- m_pButtonData.reset();
-
- pPage.clear();
- SvxMenuEntriesListBox::dispose();
}
-void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pData )
+void SvxToolbarEntriesListBox::ChangedVisibility(int nRow)
{
- // Build checkbox images according to the current application
- // settings. This is necessary to be able to have correct colors
- // in all color modes, like high contrast.
- const AllSettings& rSettings = Application::GetSettings();
-
- ScopedVclPtrInstance< VirtualDevice > pVDev;
- Size aSize( 26, 20 );
-
- pVDev->SetOutputSizePixel( aSize );
-
- Image aImage = GetSizedImage( *pVDev, aSize,
- CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Default ));
-
- // Fill button data struct with new images
- pData->SetImage(SvBmp::UNCHECKED, aImage);
- pData->SetImage(SvBmp::CHECKED, GetSizedImage( *pVDev, aSize, CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Checked )) );
- pData->SetImage(SvBmp::HICHECKED, GetSizedImage( *pVDev, aSize, CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Checked | DrawButtonFlags::Pressed )) );
- pData->SetImage(SvBmp::HIUNCHECKED, GetSizedImage( *pVDev, aSize, CheckBox::GetCheckImage( rSettings, DrawButtonFlags::Default | DrawButtonFlags::Pressed)) );
- pData->SetImage(SvBmp::TRISTATE, GetSizedImage( *pVDev, aSize, Image() ) ); // Use tristate bitmaps to have no checkbox for separator entries
- pData->SetImage(SvBmp::HITRISTATE, GetSizedImage( *pVDev, aSize, Image() ) );
-}
+ SvxConfigEntry* pEntryData =
+ reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64());
-Image SvxToolbarEntriesListBox::GetSizedImage(
- VirtualDevice& rVDev, const Size& aNewSize, const Image& aImage )
-{
- // Create new checkbox images for treelistbox. They must have a
- // decent width to have a clear column for the visibility checkbox.
-
- // Standard transparent color is light magenta as is won't be
- // used for other things
- Color aFillColor( COL_LIGHTMAGENTA );
-
- // Position image at the center of (width-2),(height) rectangle.
- // We need 2 pixels to have a bigger border to the next button image
- sal_uInt16 nPosX = std::max( static_cast<sal_uInt16>(((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), sal_uInt16(0) );
- sal_uInt16 nPosY = std::max( static_cast<sal_uInt16>(((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), sal_uInt16(0) );
- Point aPos( std::max<sal_uInt16>(nPosX, 0), std::max<sal_uInt16>(nPosY, 0) );
- rVDev.SetFillColor( aFillColor );
- rVDev.SetLineColor( aFillColor );
- rVDev.DrawRect( ::tools::Rectangle( Point(), aNewSize ));
- rVDev.DrawImage( aPos, aImage );
-
- // Draw separator line 2 pixels left from the right border
- Color aLineColor = GetDisplayBackground().GetColor().IsDark() ? COL_WHITE : COL_BLACK;
- rVDev.SetLineColor( aLineColor );
- rVDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 ));
-
- // Create new image that uses the fillcolor as transparent
- return Image(BitmapEx(rVDev.GetBitmapEx(Point(), aNewSize).GetBitmap(), aFillColor));
-}
-
-void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt )
-{
- SvTreeListBox::DataChanged( rDCEvt );
-
- if (( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) &&
- ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ))
- {
- BuildCheckBoxButtonImages( m_pButtonData.get() );
- Invalidate();
- }
-}
-
-
-void SvxToolbarEntriesListBox::ChangeVisibility( SvTreeListEntry* pEntry )
-{
- if ( pEntry != nullptr )
+ if (pEntryData->IsBinding())
{
- SvxConfigEntry* pEntryData =
- static_cast<SvxConfigEntry*>(pEntry->GetUserData());
-
- if ( pEntryData->IsBinding() )
- {
- pEntryData->SetVisible( !pEntryData->IsVisible() );
-
- SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
+ pEntryData->SetVisible(m_xControl->get_toggle(nRow, 0));
- ToolbarSaveInData* pToolbarSaveInData = static_cast<ToolbarSaveInData*>(
- pPage->GetSaveInData() );
+ SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
- pToolbarSaveInData->ApplyToolbar( pToolbar );
+ ToolbarSaveInData* pToolbarSaveInData = static_cast<ToolbarSaveInData*>(
+ pPage->GetSaveInData() );
- SetCheckButtonState( pEntry, pEntryData->IsVisible() ?
- SvButtonState::Checked : SvButtonState::Unchecked );
- }
+ pToolbarSaveInData->ApplyToolbar( pToolbar );
}
}
-void SvxToolbarEntriesListBox::CheckButtonHdl()
+IMPL_LINK(SvxToolbarEntriesListBox, CheckButtonHdl, const row_col&, rRowCol, void)
{
- ChangeVisibility( GetHdlEntry() );
+ ChangedVisibility(rRowCol.first);
}
-void SvxToolbarEntriesListBox::KeyInput( const KeyEvent& rKeyEvent )
+IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
// space key will change visibility of toolbar items
if ( rKeyEvent.GetKeyCode() == KEY_SPACE )
{
- ChangeVisibility( GetCurEntry() );
- }
- else
- {
- // pass on to superclass
- SvxMenuEntriesListBox::KeyInput( rKeyEvent );
- }
-}
-
-TriState SvxToolbarEntriesListBox::NotifyMoving(
- SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
- SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos)
-{
- TriState result = SvxMenuEntriesListBox::NotifyMoving(
- pTarget, pSource, rpNewParent, rNewChildPos );
-
- if ( result )
- {
- // Instant Apply changes to UI
- SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
- if ( pToolbar != nullptr )
+ int nRow = m_xControl->get_selected_index();
+ SvxConfigEntry* pEntryData = reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64());
+ if (pEntryData->IsBinding() && !pEntryData->IsSeparator())
{
- ToolbarSaveInData* pSaveInData =
- static_cast<ToolbarSaveInData*>( pPage->GetSaveInData() );
- pSaveInData->ApplyToolbar( pToolbar );
+ m_xControl->set_toggle(nRow, !m_xControl->get_toggle(nRow, 0), 0);
+ ChangedVisibility(nRow);
}
+ return true;
}
-
- return result;
-}
-
-TriState SvxToolbarEntriesListBox::NotifyCopying(
- SvTreeListEntry* pTarget,
- SvTreeListEntry*,
- SvTreeListEntry*&,
- sal_uLong&)
-{
-
- if ( !m_bIsInternalDrag )
- {
- // if the target is NULL then add function to the start of the list
- static_cast<SvxToolbarConfigPage*>(pPage.get())->AddFunction( pTarget, pTarget == nullptr );
-
- // Instant Apply changes to UI
- SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
- if ( pToolbar != nullptr )
- {
- ToolbarSaveInData* pSaveInData =
- static_cast<ToolbarSaveInData*>( pPage->GetSaveInData() );
- pSaveInData->ApplyToolbar( pToolbar );
- }
-
- // AddFunction already adds the listbox entry so return TRISTATE_FALSE
- // to stop another listbox entry being added
- return TRISTATE_FALSE;
- }
-
- // Copying is only allowed from external controls, not within the listbox
- return TRISTATE_FALSE;
+ return SvxMenuEntriesListBox::KeyInputHdl(rKeyEvent);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 4146be2ae20d..40f15d588721 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -887,6 +887,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(TabPageParent pParent, const
m_xOfficeButton->connect_clicked( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
m_xModuleButton->connect_clicked( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
m_xSearchEdit->connect_changed( LINK( this, SfxAcceleratorConfigPage, SearchUpdateHdl ));
+ m_xSearchEdit->connect_focus_out(LINK(this, SfxAcceleratorConfigPage, FocusOut_Impl));
// detect max keyname width
int nMaxWidth = 0;
@@ -1121,6 +1122,15 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SearchUpdateHdl, weld::Entry&, void)
m_aUpdateDataTimer.Start();
}
+IMPL_LINK_NOARG(SfxAcceleratorConfigPage, FocusOut_Impl, weld::Widget&, void)
+{
+ if (m_aUpdateDataTimer.IsActive())
+ {
+ m_aUpdateDataTimer.Stop();
+ m_aUpdateDataTimer.Invoke();
+ }
+}
+
IMPL_LINK_NOARG(SfxAcceleratorConfigPage, Load, weld::Button&, void)
{
// ask for filename, where we should load the new config data from
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index d830b2ef8f7e..8f28bb77dc64 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -101,8 +101,6 @@
#include <dlgname.hxx>
-#define ENTRY_HEIGHT 16
-
namespace uno = com::sun::star::uno;
namespace frame = com::sun::star::frame;
namespace lang = com::sun::star::lang;
@@ -178,12 +176,12 @@ SvxConfigPage::CanConfig( const OUString& aModuleId )
static VclPtr<SfxTabPage> CreateSvxMenuConfigPage( TabPageParent pParent, const SfxItemSet* rSet )
{
- return VclPtr<SvxMenuConfigPage>::Create( pParent.pParent, *rSet );
+ return VclPtr<SvxMenuConfigPage>::Create(pParent, *rSet);
}
static VclPtr<SfxTabPage> CreateSvxContextMenuConfigPage( TabPageParent pParent, const SfxItemSet* rSet )
{
- return VclPtr<SvxMenuConfigPage>::Create( pParent.pParent, *rSet, false );
+ return VclPtr<SvxMenuConfigPage>::Create(pParent, *rSet, false);
}
static VclPtr<SfxTabPage> CreateKeyboardConfigPage( TabPageParent pParent, const SfxItemSet* rSet )
@@ -193,7 +191,7 @@ static VclPtr<SfxTabPage> CreateKeyboardConfigPage( TabPageParent pParent, const
static VclPtr<SfxTabPage> CreateSvxToolbarConfigPage( TabPageParent pParent, const SfxItemSet* rSet )
{
- return VclPtr<SvxToolbarConfigPage>::Create( pParent.pParent, *rSet );
+ return VclPtr<SvxToolbarConfigPage>::Create(pParent, *rSet);
}
static VclPtr<SfxTabPage> CreateSvxEventConfigPage( TabPageParent pParent, const SfxItemSet* rSet )
@@ -325,28 +323,17 @@ SaveInData::SaveInData(
}
}
-Image SaveInData::GetImage( const OUString& rCommandURL )
+uno::Reference<graphic::XGraphic> SaveInData::GetImage(const OUString& rCommandURL)
{
- Image aImage;
-
uno::Reference< graphic::XGraphic > xGraphic =
SvxConfigPageHelper::GetGraphic( m_xImgMgr, rCommandURL );
- if ( xGraphic.is() )
- {
- aImage = Image( xGraphic );
- }
- else if ( xDefaultImgMgr != nullptr && (*xDefaultImgMgr).is() )
+ if (!xGraphic.is() && xDefaultImgMgr != nullptr && (*xDefaultImgMgr).is())
{
xGraphic = SvxConfigPageHelper::GetGraphic( (*xDefaultImgMgr), rCommandURL );
-
- if ( xGraphic.is() )
- {
- aImage = Image( xGraphic );
- }
}
- return aImage;
+ return xGraphic;
}
bool SaveInData::PersistChanges(
@@ -922,55 +909,25 @@ void ContextMenuSaveInData::ResetContextMenu( const SvxConfigEntry* pEntry )
m_pRootEntry.reset();
}
-class PopupPainter : public SvLBoxString
+void SvxMenuEntriesListBox::CreateDropDown()
{
-public:
- explicit PopupPainter(const OUString& rStr)
- : SvLBoxString(rStr)
- {
- }
-
- virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override
- {
- SvLBoxString::Paint(rPos, rOutDev, rRenderContext, pView, rEntry);
+ int nWidth = m_xControl->get_text_height();
+ m_xDropDown->SetOutputSizePixel(Size(nWidth, nWidth));
- rRenderContext.Push(PushFlags::FILLCOLOR);
+ int nSize = nWidth / 2;
+ int nHalfSize = nSize / 2;
+ int nY = nHalfSize;
+ int nX = 0;
- long nX = rOutDev.GetSizePixel().Width();
-
- ScrollBar* pVScroll = rOutDev.GetVScroll();
- if (pVScroll->IsVisible())
- {
- nX -= pVScroll->GetSizePixel().Width();
- }
+ m_xDropDown->SetFillColor(COL_BLACK);
- const SvViewDataItem* pItem = rOutDev.GetViewDataItem( &rEntry, this );
- nX -= pItem->maSize.Height();
-
- long nSize = pItem->maSize.Height() / 2;
- long nHalfSize = nSize / 2;
- long nY = rPos.Y() + nHalfSize;
-
- if (rRenderContext.GetFillColor() == COL_WHITE)
- {
- rRenderContext.SetFillColor(COL_BLACK);
- }
- else
- {
- rRenderContext.SetFillColor(COL_WHITE);
- }
-
- long n = 0;
- while (n <= nHalfSize)
- {
- rRenderContext.DrawRect(::tools::Rectangle(nX + n, nY + n, nX + n, nY + nSize - n));
- ++n;
- }
-
- rRenderContext.Pop();
+ int n = 0;
+ while (n <= nHalfSize)
+ {
+ m_xDropDown->DrawRect(::tools::Rectangle(nX + n, nY + n, nX + n, nY + nSize - n));
+ ++n;
}
-};
+}
/******************************************************************************
*
@@ -980,112 +937,21 @@ public:
* listbox
*
*****************************************************************************/
-SvxMenuEntriesListBox::SvxMenuEntriesListBox(vcl::Window* pParent, SvxConfigPage* pPg)
- : SvTreeListBox(pParent, WB_TABSTOP|WB_CLIPCHILDREN|WB_HIDESELECTION|WB_BORDER)
+SvxMenuEntriesListBox::SvxMenuEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPg)
+ : m_xControl(std::move(xControl))
+ , m_xDropDown(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT))
, pPage(pPg)
, m_bIsInternalDrag( false )
{
- SetSpaceBetweenEntries( 3 );
- SetEntryHeight( ENTRY_HEIGHT );
-
- SetHighlightRange();
- SetSelectionMode(SelectionMode::Single);
-
- SetDragDropMode( DragDropMode::CTRL_MOVE |
- DragDropMode::APP_COPY |
- DragDropMode::ENABLE_TOP |
- DragDropMode::APP_DROP);
+ CreateDropDown();
+ m_xControl->connect_key_press(LINK(this, SvxMenuEntriesListBox, KeyInputHdl));
}
SvxMenuEntriesListBox::~SvxMenuEntriesListBox()
{
- disposeOnce();
-}
-
-void SvxMenuEntriesListBox::dispose()
-{
- pPage.clear();
- SvTreeListBox::dispose();
-}
-
-// drag and drop support
-DragDropMode SvxMenuEntriesListBox::NotifyStartDrag(
- TransferDataContainer&, SvTreeListEntry* )
-{
- m_bIsInternalDrag = true;
- return GetDragDropMode();
-}
-
-void SvxMenuEntriesListBox::DragFinished( sal_Int8 )
-{
- m_bIsInternalDrag = false;
-}
-
-sal_Int8 SvxMenuEntriesListBox::AcceptDrop( const AcceptDropEvent& rEvt )
-{
- if ( m_bIsInternalDrag )
- {
- // internal copy isn't allowed!
- if ( rEvt.mnAction == DND_ACTION_COPY )
- return DND_ACTION_NONE;
- else
- return SvTreeListBox::AcceptDrop( rEvt );
- }
-
- // Always do COPY instead of MOVE if D&D comes from outside!
- AcceptDropEvent aNewAcceptDropEvent( rEvt );
- aNewAcceptDropEvent.mnAction = DND_ACTION_COPY;
- return SvTreeListBox::AcceptDrop( aNewAcceptDropEvent );
-}
-
-bool SvxMenuEntriesListBox::NotifyAcceptDrop( SvTreeListEntry* )
-{
- return true;
-}
-
-TriState SvxMenuEntriesListBox::NotifyMoving(
- SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
- SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos)
-{
- // only try to do a move if we are dragging within the list box
- if ( m_bIsInternalDrag )
- {
- if ( pPage->MoveEntryData( pSource, pTarget ) )
- {
- SvTreeListBox::NotifyMoving(
- pTarget, pSource, rpNewParent, rNewChildPos );
- return TRISTATE_TRUE;
- }
- else
- {
- return TRISTATE_FALSE;
- }
- }
- else
- {
- return NotifyCopying( pTarget, pSource, rpNewParent, rNewChildPos );
- }
-}
-
-TriState SvxMenuEntriesListBox::NotifyCopying(
- SvTreeListEntry* pTarget, SvTreeListEntry*,
- SvTreeListEntry*&, sal_uLong&)
-{
- if ( !m_bIsInternalDrag )
- {
- // if the target is NULL then add function to the start of the list
- pPage->AddFunction( pTarget, pTarget == nullptr );
-
- // AddFunction already adds the listbox entry so return TRISTATE_FALSE
- // to stop another listbox entry being added
- return TRISTATE_FALSE;
- }
-
- // Copying is only allowed from external controls, not within the listbox
- return TRISTATE_FALSE;
}
-void SvxMenuEntriesListBox::KeyInput( const KeyEvent& rKeyEvent )
+IMPL_LINK(SvxMenuEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
vcl::KeyCode keycode = rKeyEvent.GetKeyCode();
@@ -1105,9 +971,9 @@ void SvxMenuEntriesListBox::KeyInput( const KeyEvent& rKeyEvent )
}
else
{
- // pass on to superclass
- SvTreeListBox::KeyInput( rKeyEvent );
+ return false; // pass on to default handler
}
+ return true;
}
/******************************************************************************
@@ -1117,88 +983,53 @@ void SvxMenuEntriesListBox::KeyInput( const KeyEvent& rKeyEvent )
* both tabpages to add, delete, move and rename items etc.
*
*****************************************************************************/
-SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
- : SfxTabPage(pParent, "MenuAssignPage", "cui/ui/menuassignpage.ui", &rSet)
+SvxConfigPage::SvxConfigPage(TabPageParent pParent, const SfxItemSet& rSet)
+ : SfxTabPage(pParent, "cui/ui/menuassignpage.ui", "MenuAssignPage", &rSet)
+ , m_aUpdateDataTimer("UpdateDataTimer")
, bInitialised(false)
, pCurrentSaveInData(nullptr)
- , m_pContentsListBox(nullptr)
-{
- get(m_pSearchEdit, "searchEntry");
- get(m_pCommandCategoryListBox, "commandcategorylist");
- get(m_pFunctions, "functions");
-
- get(m_pAddCommandButton, "add");
- get(m_pRemoveCommandButton, "remove");
-
- get(m_pTopLevelListBox, "toplevellist");
- get(m_pGearBtn, "gearbtn");
- get(m_pMoveUpButton, "up");
- get(m_pMoveDownButton, "down");
- get(m_pSaveInListBox, "savein");
- get(m_pInsertBtn, "insert");
- get(m_pModifyBtn, "modify");
- get(m_pResetBtn, "defaultsbtn");
- get(m_pDescriptionFieldLb, "descriptionlabel");
- get(m_pDescriptionField, "desc");
- m_pDescriptionField->set_height_request(m_pDescriptionField->GetTextHeight()*2.9);
- get(m_pEntries, "entries");
- Size aSize(LogicToPixel(Size(108, 115), MapMode(MapUnit::MapAppFont)));
- m_pEntries->set_height_request(aSize.Height());
- m_pEntries->set_width_request(aSize.Width());
- m_pFunctions->set_height_request(aSize.Height());
- //TODO: Add SvxMenuEntriesListBox into the glade catalog, and use it on the
- // .ui file to get rid of the extra VCLContainer, and all these manual
- // sizing and widget creation tricks.
- m_pFunctions->set_width_request(aSize.Width() * 1.45);
- m_pFunctions->SetNodeDefaultImages();
- m_pFunctions->SetStyle( m_pFunctions->GetStyle() | WB_HASBUTTONS | WB_HASBUTTONSATROOT |
- WB_HASLINES | WB_HASLINESATROOT | WB_CLIPCHILDREN | WB_HSCROLL );
-
- // Make the middle buttons bigger
- m_pAddCommandButton->set_height_request( m_pAddCommandButton->GetOptimalSize().Height() * 1.5 );
- m_pAddCommandButton->set_width_request( m_pAddCommandButton->GetOptimalSize().Width() * 1.5 );
- m_pRemoveCommandButton->set_height_request( m_pRemoveCommandButton->GetOptimalSize().Height() * 1.5 );
- m_pRemoveCommandButton->set_width_request( m_pRemoveCommandButton->GetOptimalSize().Width() * 1.5 );
-
- m_pDescriptionField->SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() );
- m_pDescriptionField->EnableCursor( false );
- m_pDescriptionField->SetStyle( m_pDescriptionField->GetStyle() | WB_TABSTOP ); // Include in the tab sequence
-
- m_pSearchEdit->SetUpdateDataHdl ( LINK( this, SvxConfigPage, SearchUpdateHdl ));
- m_pSearchEdit->EnableUpdateData();
-
- m_pFunctions->SetDoubleClickHdl( LINK( this, SvxConfigPage, FunctionDoubleClickHdl ) );
- m_pFunctions->SetSelectHdl(
- LINK( this, SvxConfigPage, SelectFunctionHdl ) );
- m_pGearBtn->SetDropDown(PushButtonDropdownStyle::NONE);
+ , m_xSearchEdit(m_xBuilder->weld_entry("searchEntry"))
+ , m_xCommandCategoryListBox(new CommandCategoryListBox(m_xBuilder->weld_combo_box("commandcategorylist")))
+ , m_xFunctions(new CuiConfigFunctionListBox(m_xBuilder->weld_tree_view("functions")))
+ , m_xDescriptionFieldLb(m_xBuilder->weld_label("descriptionlabel"))
+ , m_xDescriptionField(m_xBuilder->weld_text_view("desc"))
+ , m_xTopLevelListBox(m_xBuilder->weld_combo_box("toplevellist"))
+ , m_xGearBtn(m_xBuilder->weld_menu_button("gearbtn"))
+ , m_xMoveUpButton(m_xBuilder->weld_button("up"))
+ , m_xMoveDownButton(m_xBuilder->weld_button("down"))
+ , m_xSaveInListBox(m_xBuilder->weld_combo_box("savein"))
+ , m_xInsertBtn(m_xBuilder->weld_menu_button("insert"))
+ , m_xModifyBtn(m_xBuilder->weld_menu_button("modify"))
+ , m_xResetBtn(m_xBuilder->weld_button("defaultsbtn"))
+ , m_xAddCommandButton(m_xBuilder->weld_button("add"))
+ , m_xRemoveCommandButton(m_xBuilder->weld_button("remove"))
+{
+ m_xTopLevelListBox->connect_changed(LINK(this, SvxMenuConfigPage, SelectElementHdl));
+
+ weld::TreeView& rTreeView = m_xFunctions->get_widget();
+ Size aSize(rTreeView.get_approximate_digit_width() * 40, rTreeView.get_height_rows(8));
+ m_xFunctions->set_size_request(aSize.Width(), aSize.Height());
+ m_xDescriptionField->set_size_request(aSize.Width(), m_xDescriptionField->get_height_rows(3));
+
+ m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SvxConfigPage, ImplUpdateDataHdl));
+ m_aUpdateDataTimer.SetDebugName( "SvxConfigPage UpdateDataTimer" );
+ m_aUpdateDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
+
+ m_xSearchEdit->connect_changed(LINK(this, SvxConfigPage, SearchUpdateHdl));
+ m_xSearchEdit->connect_focus_out(LINK(this, SvxConfigPage, FocusOut_Impl));
+
+ rTreeView.connect_row_activated(LINK(this, SvxConfigPage, FunctionDoubleClickHdl));
+ rTreeView.connect_changed(LINK(this, SvxConfigPage, SelectFunctionHdl));
}
-SvxConfigPage::~SvxConfigPage()
+IMPL_LINK_NOARG(SvxConfigPage, SelectElementHdl, weld::ComboBox&, void)
{
- disposeOnce();
+ SelectElement();
}
-void SvxConfigPage::dispose()
+SvxConfigPage::~SvxConfigPage()
{
- m_pTopLevelListBox.clear();
- m_pGearBtn.clear();
- m_pSearchEdit.clear();
- m_pCommandCategoryListBox.clear();
- m_pEntries.clear();
- m_pFunctions.clear();
- m_pAddCommandButton.clear();
- m_pRemoveCommandButton.clear();
- m_pMoveUpButton.clear();
- m_pMoveDownButton.clear();
- m_pSaveInListBox.clear();
- m_pInsertBtn.clear();
- m_pModifyBtn.clear();
- m_pResetBtn.clear();
- m_pDescriptionFieldLb.clear();
- m_pDescriptionField.clear();
-
- m_pContentsListBox.disposeAndClear();
- SfxTabPage::dispose();
+ disposeOnce();
}
void SvxConfigPage::Reset( const SfxItemSet* )
@@ -1248,9 +1079,8 @@ void SvxConfigPage::Reset( const SfxItemSet* )
if ( pModuleData != nullptr )
{
- nPos = m_pSaveInListBox->InsertEntry(
- utl::ConfigManager::getProductName() + " " + aModuleName );
- m_pSaveInListBox->SetEntryData( nPos, pModuleData );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pModuleData)));
+ m_xSaveInListBox->append(sId, utl::ConfigManager::getProductName() + " " + aModuleName);
}
// try to retrieve the document based ui configuration manager
@@ -1280,8 +1110,8 @@ void SvxConfigPage::Reset( const SfxItemSet* )
if ( !pDocData->IsReadOnly() )
{
- nPos = m_pSaveInListBox->InsertEntry( aTitle );
- m_pSaveInListBox->SetEntryData( nPos, pDocData );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDocData)));
+ m_xSaveInListBox->append(sId, aTitle);
}
}
@@ -1292,13 +1122,13 @@ void SvxConfigPage::Reset( const SfxItemSet* )
{
if ( pDocData && pDocData->HasURL( m_aURLToSelect ) )
{
- m_pSaveInListBox->SelectEntryPos( nPos );
+ m_xSaveInListBox->set_active(nPos);
pCurrentSaveInData = pDocData;
bURLToSelectFound = true;
}
else if ( pModuleData && pModuleData->HasURL( m_aURLToSelect ) )
{
- m_pSaveInListBox->SelectEntryPos( 0 );
+ m_xSaveInListBox->set_active(0);
pCurrentSaveInData = pModuleData;
bURLToSelectFound = true;
}
@@ -1310,12 +1140,12 @@ void SvxConfigPage::Reset( const SfxItemSet* )
// it the SaveIn listbox, otherwise select the module data
if ( pDocData != nullptr && pDocData->HasSettings() )
{
- m_pSaveInListBox->SelectEntryPos( nPos );
+ m_xSaveInListBox->set_active(nPos);
pCurrentSaveInData = pDocData;
}
else
{
- m_pSaveInListBox->SelectEntryPos( 0 );
+ m_xSaveInListBox->set_active(0);
pCurrentSaveInData = pModuleData;
}
}
@@ -1391,8 +1221,8 @@ void SvxConfigPage::Reset( const SfxItemSet* )
if ( pData && !pData->IsReadOnly() )
{
- nPos = m_pSaveInListBox->InsertEntry( aTitle2 );
- m_pSaveInListBox->SetEntryData( nPos, pData );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ m_xSaveInListBox->append(sId, aTitle2);
}
}
}
@@ -1400,7 +1230,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
}
}
- m_pSaveInListBox->SetSelectHdl(
+ m_xSaveInListBox->connect_changed(
LINK( this, SvxConfigPage, SelectSaveInLocation ) );
bInitialised = true;
@@ -1471,10 +1301,10 @@ OUString SvxConfigPage::GetScriptURL() const
{
OUString result;
- SvTreeListEntry *pEntry = m_pFunctions->FirstSelected();
- if ( pEntry )
+ int nEntry = m_xFunctions->get_selected_index();
+ if (nEntry != -1)
{
- SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
+ SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_id(nEntry).toInt64());
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT ) ||
( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT ) ||
( pData->nKind == SfxCfgKind::GROUP_STYLES ) )
@@ -1488,45 +1318,43 @@ OUString SvxConfigPage::GetScriptURL() const
OUString SvxConfigPage::GetSelectedDisplayName()
{
- return m_pFunctions->GetEntryText( m_pFunctions->FirstSelected() );
+ return m_xFunctions->get_selected_text();
}
bool SvxConfigPage::FillItemSet( SfxItemSet* )
{
bool result = false;
- for ( sal_Int32 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
+ for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
{
SaveInData* pData =
- static_cast<SaveInData*>(m_pSaveInListBox->GetEntryData( i ));
+ reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
result = pData->Apply();
}
return result;
}
-IMPL_LINK_NOARG( SvxConfigPage, SelectSaveInLocation, ListBox&, void )
+IMPL_LINK_NOARG(SvxConfigPage, SelectSaveInLocation, weld::ComboBox&, void)
{
- pCurrentSaveInData = static_cast<SaveInData*>(m_pSaveInListBox->GetEntryData(
- m_pSaveInListBox->GetSelectedEntryPos()));
-
+ pCurrentSaveInData = reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_active_id().toInt64());
Init();
}
void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry const * pToSelect )
{
- sal_Int32 nSelectionPos = m_pTopLevelListBox->GetSelectedEntryPos();
- m_pTopLevelListBox->Clear();
+ int nSelectionPos = m_xTopLevelListBox->get_active();
+ m_xTopLevelListBox->clear();
if ( GetSaveInData() && GetSaveInData()->GetEntries() )
{
for (auto const& entryData : *GetSaveInData()->GetEntries())
{
- const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( SvxConfigPageHelper::stripHotKey(entryData->GetName()) );
- m_pTopLevelListBox->SetEntryData( nPos, entryData );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
+ m_xTopLevelListBox->append(sId, SvxConfigPageHelper::stripHotKey(entryData->GetName()));
- if ( entryData == pToSelect )
- nSelectionPos = nPos;
+ if (entryData == pToSelect)
+ nSelectionPos = m_xTopLevelListBox->get_count() - 1;
AddSubMenusToUI( SvxConfigPageHelper::stripHotKey( entryData->GetName() ), entryData );
}
@@ -1540,11 +1368,11 @@ void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry const * pToSelect )
}
#endif
- nSelectionPos = nSelectionPos < m_pTopLevelListBox->GetEntryCount() ?
- nSelectionPos : m_pTopLevelListBox->GetEntryCount() - 1;
+ nSelectionPos = (nSelectionPos != -1 && nSelectionPos < m_xTopLevelListBox->get_count()) ?
+ nSelectionPos : m_xTopLevelListBox->get_count() - 1;
- m_pTopLevelListBox->SelectEntryPos( nSelectionPos );
- m_pTopLevelListBox->GetSelectHdl().Call( *m_pTopLevelListBox );
+ m_xTopLevelListBox->set_active(nSelectionPos);
+ SelectElement();
}
void SvxConfigPage::AddSubMenusToUI(
@@ -1556,8 +1384,8 @@ void SvxConfigPage::AddSubMenusToUI(
{
OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey(entryData->GetName());
- const sal_Int32 nPos = m_pTopLevelListBox->InsertEntry( subMenuTitle );
- m_pTopLevelListBox->SetEntryData( nPos, entryData );
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
+ m_xTopLevelListBox->append(sId, subMenuTitle);
AddSubMenusToUI( subMenuTitle, entryData );
}
@@ -1588,15 +1416,14 @@ SvxEntries* SvxConfigPage::FindParentForChild(
return nullptr;
}
-SvTreeListEntry* SvxConfigPage::AddFunction(
- SvTreeListEntry* pTarget, bool bFront, bool bAllowDuplicates )
+int SvxConfigPage::AddFunction(int nTarget, bool bFront, bool bAllowDuplicates)
{
OUString aURL = GetScriptURL();
SvxConfigEntry* pParent = GetTopLevelSelection();
if ( aURL.isEmpty() || pParent == nullptr )
{
- return nullptr;
+ return -1;
}
OUString aDisplayName;
@@ -1623,49 +1450,53 @@ SvTreeListEntry* SvxConfigPage::AddFunction(
{
if ( entry->GetCommand() == pNewEntryData->GetCommand() )
{
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetDialogFrameWeld(),
VclMessageType::Info, VclButtonsType::Ok, CuiResId(RID_SVXSTR_MNUCFG_ALREADY_INCLUDED)));
- (void)xBox->run();
+ xBox->run();
delete pNewEntryData;
- return nullptr;
+ return -1;
}
}
}
- return InsertEntry( pNewEntryData, pTarget, bFront );
+ return InsertEntry(pNewEntryData, nTarget, bFront);
}
-SvTreeListEntry* SvxConfigPage::InsertEntry(
+int SvxConfigPage::InsertEntry(
SvxConfigEntry* pNewEntryData,
- SvTreeListEntry* pTarget,
- bool bFront )
+ int nTarget,
+ bool bFront)
{
SvxConfigEntry* pTopLevelSelection = GetTopLevelSelection();
if (pTopLevelSelection == nullptr)
- return nullptr;
+ return -1;
// Grab the entries list for the currently selected menu
SvxEntries* pEntries = pTopLevelSelection->GetEntries();
- SvTreeListEntry* pNewEntry = nullptr;
- SvTreeListEntry* pCurEntry =
- pTarget != nullptr ? pTarget : m_pContentsListBox->GetCurEntry();
+ int nNewEntry = -1;
+ int nCurEntry =
+ nTarget != -1 ? nTarget : m_xContentsListBox->get_selected_index();
+
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
- if ( bFront )
+ if (bFront)
{
pEntries->insert( pEntries->begin(), pNewEntryData );
- pNewEntry = InsertEntryIntoUI( pNewEntryData, 0 );
+ m_xContentsListBox->insert(0, sId);
+ nNewEntry = 0;
}
- else if ( pCurEntry == nullptr || pCurEntry == m_pContentsListBox->Last() )
+ else if (nCurEntry == -1 || nCurEntry == m_xContentsListBox->n_children() - 1)
{
pEntries->push_back( pNewEntryData );
- pNewEntry = InsertEntryIntoUI( pNewEntryData );
+ m_xContentsListBox->insert(-1, sId);
+ nNewEntry = m_xContentsListBox->n_children() - 1;
}
else
{
SvxConfigEntry* pEntryData =
- static_cast<SvxConfigEntry*>(pCurEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nCurEntry).toInt64());
SvxEntries::iterator iter = pEntries->begin();
SvxEntries::const_iterator end = pEntries->end();
@@ -1685,82 +1516,66 @@ SvTreeListEntry* SvxConfigPage::InsertEntry(
if ( iter != end )
{
pEntries->insert( iter, pNewEntryData );
- pNewEntry = InsertEntryIntoUI( pNewEntryData, nPos );
+ m_xContentsListBox->insert(nPos, sId);
+ nNewEntry = nPos;
}
}
- if ( pNewEntry != nullptr )
+ if (nNewEntry != -1)
{
- m_pContentsListBox->Select( pNewEntry );
- m_pContentsListBox->MakeVisible( pNewEntry );
+ m_xContentsListBox->select(nNewEntry);
+ m_xContentsListBox->scroll_to_row(nNewEntry);
GetSaveInData()->SetModified();
GetTopLevelSelection()->SetModified();
}
- return pNewEntry;
+ return nNewEntry;
}
-SvTreeListEntry* SvxConfigPage::InsertEntryIntoUI(
- SvxConfigEntry* pNewEntryData, sal_uLong nPos )
+void SvxConfigPage::InsertEntryIntoUI(SvxConfigEntry* pNewEntryData, int nPos, int nStartCol)
{
- SvTreeListEntry* pNewEntry = nullptr;
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
+
+ m_xContentsListBox->set_id(nPos, sId);
if (pNewEntryData->IsSeparator())
{
- pNewEntry = m_pContentsListBox->InsertEntry(
- OUString("----------------------------------"),
- nullptr, false, nPos, pNewEntryData);
+ m_xContentsListBox->set_text(nPos, "----------------------------------", nStartCol + 1);
}
else
{
+ auto xImage = GetSaveInData()->GetImage(pNewEntryData->GetCommand());
+ if (xImage.is())
+ m_xContentsListBox->set_image(nPos, xImage, nStartCol);
OUString aName = SvxConfigPageHelper::stripHotKey( pNewEntryData->GetName() );
+ m_xContentsListBox->set_text(nPos, aName, nStartCol + 1);
+ }
- Image aImage = GetSaveInData()->GetImage(
- pNewEntryData->GetCommand());
-
- if ( !!aImage )
- {
- pNewEntry = m_pContentsListBox->InsertEntry(
- aName, aImage, aImage, nullptr, false, nPos, pNewEntryData );
- }
+ if (nStartCol == 0) // menus
+ {
+ if (pNewEntryData->IsPopup() || pNewEntryData->GetStyle() & css::ui::ItemStyle::DROP_DOWN)
+ m_xContentsListBox->set_dropdown(nPos, nStartCol + 2);
else
- {
- pNewEntry = m_pContentsListBox->InsertEntry(
- aName, nullptr, false, nPos, pNewEntryData );
- }
-
- if ( pNewEntryData->IsPopup() ||
- pNewEntryData->GetStyle() & css::ui::ItemStyle::DROP_DOWN )
- {
- // add new popup painter, it gets destructed by the entry
- pNewEntry->ReplaceItem( std::make_unique<PopupPainter>(aName), pNewEntry->ItemCount() - 1 );
- }
+ m_xContentsListBox->set_image(nPos, nullptr, nStartCol + 2);
}
-
- return pNewEntry;
}
-IMPL_LINK( SvxConfigPage, MoveHdl, Button *, pButton, void )
+IMPL_LINK(SvxConfigPage, MoveHdl, weld::Button&, rButton, void)
{
- MoveEntry(pButton == m_pMoveUpButton);
+ MoveEntry(&rButton == m_xMoveUpButton.get());
}
-IMPL_LINK_NOARG( SvxConfigPage, FunctionDoubleClickHdl, SvTreeListBox *, bool )
+IMPL_LINK_NOARG(SvxConfigPage, FunctionDoubleClickHdl, weld::TreeView&, void)
{
- if ( m_pAddCommandButton->IsEnabled() )
- {
- m_pAddCommandButton->Click();
- return false;
- }
- else
- return true;
+ if (m_xAddCommandButton->get_sensitive())
+ m_xAddCommandButton->clicked();
}
-IMPL_LINK_NOARG( SvxConfigPage, SelectFunctionHdl, SvTreeListBox *, void )
+IMPL_LINK_NOARG(SvxConfigPage, SelectFunctionHdl, weld::TreeView&, void)
{
// Store the tooltip of the description field at first run
- static const OUString sDescTooltip = m_pDescriptionField->GetQuickHelpText();
+ static const OUString sDescTooltip = m_xDescriptionField->get_tooltip_text();
// GetScriptURL() returns a non-empty string if a
// valid command is selected on the left box
@@ -1769,52 +1584,67 @@ IMPL_LINK_NOARG( SvxConfigPage, SelectFunctionHdl, SvTreeListBox *, void )
// Enable/disable Add and Remove buttons depending on current selection
if (bIsValidCommand)
{
- m_pAddCommandButton->Enable();
- m_pRemoveCommandButton->Enable();
+ m_xAddCommandButton->set_sensitive(true);
+ m_xRemoveCommandButton->set_sensitive(true);
- m_pDescriptionField->SetText( m_pFunctions->GetHelpText( false ) );
+ m_xDescriptionField->set_text(m_xFunctions->GetHelpText(false));
}
else
{
- m_pAddCommandButton->Disable();
- m_pRemoveCommandButton->Disable();
+ m_xAddCommandButton->set_sensitive(false);
+ m_xRemoveCommandButton->set_sensitive(false);
- m_pDescriptionField->SetText("");
+ m_xDescriptionField->set_text("");
}
// Disable the description field and its label if the local help is not installed
// And inform the user via tooltips
if ( !SfxHelp::IsHelpInstalled() )
{
- m_pDescriptionField->Disable();
- m_pDescriptionFieldLb->Disable();
- m_pDescriptionField->SetQuickHelpText( sDescTooltip );
- m_pDescriptionFieldLb->SetQuickHelpText( sDescTooltip );
+ m_xDescriptionField->set_sensitive(false);
+ m_xDescriptionFieldLb->set_sensitive(false);
+ m_xDescriptionField->set_tooltip_text( sDescTooltip );
+ m_xDescriptionFieldLb->set_tooltip_text( sDescTooltip );
}
else
{
- m_pDescriptionField->Enable();
- m_pDescriptionFieldLb->Enable();
- m_pDescriptionField->SetQuickHelpText("");
- m_pDescriptionFieldLb->SetQuickHelpText("");
+ m_xDescriptionField->set_sensitive(true);
+ m_xDescriptionFieldLb->set_sensitive(true);
+ m_xDescriptionField->set_tooltip_text("");
+ m_xDescriptionFieldLb->set_tooltip_text("");
}
}
-IMPL_LINK_NOARG(SvxConfigPage, SearchUpdateHdl, Edit&, void)
+IMPL_LINK_NOARG(SvxConfigPage, ImplUpdateDataHdl, Timer*, void)
+{
+ OUString aSearchTerm(m_xSearchEdit->get_text());
+ m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), aSearchTerm, GetSaveInData());
+}
+
+IMPL_LINK_NOARG(SvxConfigPage, SearchUpdateHdl, weld::Entry&, void)
{
- OUString aSearchTerm( m_pSearchEdit->GetText() );
+ m_aUpdateDataTimer.Start();
+}
- m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm, GetSaveInData() );
+IMPL_LINK_NOARG(SvxConfigPage, FocusOut_Impl, weld::Widget&, void)
+{
+ if (m_aUpdateDataTimer.IsActive())
+ {
+ m_aUpdateDataTimer.Stop();
+ m_aUpdateDataTimer.Invoke();
+ }
}
-void SvxConfigPage::MoveEntry( bool bMoveUp )
+void SvxConfigPage::MoveEntry(bool bMoveUp)
{
- SvTreeListEntry *pSourceEntry = m_pContentsListBox->FirstSelected();
- SvTreeListEntry *pTargetEntry = nullptr;
- SvTreeListEntry *pToSelect = nullptr;
+ weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
- if ( !pSourceEntry )
+ int nSourceEntry = rTreeView.get_selected_index();
+ int nTargetEntry = -1;
+ int nToSelect = -1;
+
+ if (nSourceEntry == -1)
{
return;
}
@@ -1822,31 +1652,30 @@ void SvxConfigPage::MoveEntry( bool bMoveUp )
if ( bMoveUp )
{
// Move Up is just a Move Down with the source and target reversed
- pTargetEntry = pSourceEntry;
- pSourceEntry = pTargetEntry->PrevSibling();
- pToSelect = pTargetEntry;
+ nTargetEntry = nSourceEntry;
+ nSourceEntry = nTargetEntry - 1;
+ nToSelect = nSourceEntry;
}
else
{
- pTargetEntry = pSourceEntry->NextSibling();
- pToSelect = pSourceEntry;
+ nTargetEntry = nSourceEntry + 1;
+ nToSelect = nTargetEntry;
}
- if ( MoveEntryData( pSourceEntry, pTargetEntry ) )
+ if (MoveEntryData(nSourceEntry, nTargetEntry))
{
- m_pContentsListBox->GetModel()->Move( pSourceEntry, pTargetEntry );
- m_pContentsListBox->Select( pToSelect );
- m_pContentsListBox->MakeVisible( pToSelect );
+ rTreeView.swap(nSourceEntry, nTargetEntry);
+ rTreeView.select(nToSelect);
+ rTreeView.scroll_to_row(nToSelect);
UpdateButtonStates();
}
}
-bool SvxConfigPage::MoveEntryData(
- SvTreeListEntry const * pSourceEntry, SvTreeListEntry const * pTargetEntry )
+bool SvxConfigPage::MoveEntryData(int nSourceEntry, int nTargetEntry)
{
//#i53677#
- if (nullptr == pSourceEntry || nullptr == pTargetEntry)
+ if (nSourceEntry == -1 || nTargetEntry == -1)
{
return false;
}
@@ -1855,10 +1684,10 @@ bool SvxConfigPage::MoveEntryData(
SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
SvxConfigEntry* pSourceData =
- static_cast<SvxConfigEntry*>(pSourceEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSourceEntry).toInt64());
SvxConfigEntry* pTargetData =
- static_cast<SvxConfigEntry*>(pTargetEntry->GetUserData());
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nTargetEntry).toInt64());
if ( pSourceData != nullptr && pTargetData != nullptr )
{
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 408612685283..f8de79671425 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -247,86 +247,6 @@ std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const OUString& s
return lStyles;
}
-SfxConfigFunctionListBox::SfxConfigFunctionListBox(vcl::Window* pParent, WinBits nStyle)
- : SvTreeListBox( pParent, nStyle )
-{
- SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT );
- GetModel()->SetSortMode( SortAscending );
- SetQuickSearch( true );
-}
-
-VCL_BUILDER_FACTORY_CONSTRUCTOR(SfxConfigFunctionListBox, WB_TABSTOP)
-
-SfxConfigFunctionListBox::~SfxConfigFunctionListBox()
-{
- disposeOnce();
-}
-
-void SfxConfigFunctionListBox::dispose()
-{
- ClearAll();
- SvTreeListBox::dispose();
-}
-
-void SfxConfigFunctionListBox::MouseMove( const MouseEvent& )
-{
-}
-
-void SfxConfigFunctionListBox::ClearAll()
-/* Description
- Deletes all entries in the FunctionListBox, all UserData and all
- possibly existing MacroInfo.
-*/
-{
- sal_uInt16 nCount = aArr.size();
- for ( sal_uInt16 i=0; i<nCount; ++i )
- {
- SfxGroupInfo_Impl *pData = aArr[i].get();
-
- if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
- {
- OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
- delete pScriptURI;
- }
-
- if ( pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER )
- {
- XInterface* xi = static_cast<XInterface *>(pData->pObject);
- if (xi != nullptr)
- {
- xi->release();
- }
- }
- }
-
- aArr.clear();
- Clear();
-}
-
-OUString SfxConfigFunctionListBox::GetHelpText( bool bConsiderParent )
-{
- SvTreeListEntry *pEntry = FirstSelected();
- if ( pEntry )
- {
- SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
- if ( pData )
- {
- if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
- {
- if (bConsiderParent)
- return Application::GetHelp()->GetHelpText( pData->sCommand, this );
- else
- return Application::GetHelp()->GetHelpText( pData->sCommand, static_cast<weld::Widget*>(nullptr) );
- }
- else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
- {
- return pData->sHelpText;
- }
- }
- }
- return OUString();
-}
-
OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
{
int nSelected = m_xTreeView->get_selected_index();
@@ -377,6 +297,7 @@ OUString CuiConfigFunctionListBox::GetCurLabel()
CuiConfigFunctionListBox::CuiConfigFunctionListBox(std::unique_ptr<weld::TreeView> xTreeView)
: m_xTreeView(std::move(xTreeView))
+ , m_xScratchIter(m_xTreeView->make_iterator())
{
m_xTreeView->make_sorted();
m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
@@ -599,7 +520,7 @@ void CuiConfigGroupListBox::InitModule()
}
void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
- weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand)
+ const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand)
{
try {
if ( xRootNode->hasChildNodes() )
@@ -1046,7 +967,7 @@ void CuiConfigGroupListBox::GroupSelected()
/* Description
A basic or a library is opened.
*/
-IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, weld::TreeIter&, rIter, bool)
+IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, bool)
{
SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
switch ( pInfo->nKind )
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 2de38a07edc4..a7f60dec685f 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -267,10 +267,10 @@ SvxScriptOrgDialog::getLangNodeFromRootNode( Reference< browse::XBrowseNode > co
return langNode;
}
-void SvxScriptOrgDialog::RequestSubEntries(weld::TreeIter& rRootEntry, Reference< css::script::browse::XBrowseNode > const & node,
+void SvxScriptOrgDialog::RequestSubEntries(const weld::TreeIter& rRootEntry, Reference< css::script::browse::XBrowseNode > const & node,
Reference< XModel >& model)
{
- if (! node.is() )
+ if (!node.is())
{
return;
}
@@ -300,7 +300,7 @@ void SvxScriptOrgDialog::RequestSubEntries(weld::TreeIter& rRootEntry, Reference
}
void SvxScriptOrgDialog::insertEntry(const OUString& rText, const OUString& rBitmap,
- weld::TreeIter* pParent, bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData,
+ const weld::TreeIter* pParent, bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData,
const OUString& factoryURL, bool bSelect)
{
if (rBitmap == RID_CUIBMP_DOC && !factoryURL.isEmpty())
@@ -313,7 +313,7 @@ void SvxScriptOrgDialog::insertEntry(const OUString& rText, const OUString& rBit
}
void SvxScriptOrgDialog::insertEntry(
- const OUString& rText, const OUString& rBitmap, weld::TreeIter* pParent,
+ const OUString& rText, const OUString& rBitmap, const weld::TreeIter* pParent,
bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData, bool bSelect)
{
std::unique_ptr<weld::TreeIter> xRetIter;
@@ -329,7 +329,7 @@ void SvxScriptOrgDialog::insertEntry(
}
}
-IMPL_LINK(SvxScriptOrgDialog, ExpandingHdl, weld::TreeIter&, rIter, bool)
+IMPL_LINK(SvxScriptOrgDialog, ExpandingHdl, const weld::TreeIter&, rIter, bool)
{
SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rIter).toInt64());
diff --git a/cui/source/inc/CommandCategoryListBox.hxx b/cui/source/inc/CommandCategoryListBox.hxx
index f49ff2c999e6..4af8c9acdc17 100644
--- a/cui/source/inc/CommandCategoryListBox.hxx
+++ b/cui/source/inc/CommandCategoryListBox.hxx
@@ -23,7 +23,7 @@
#include <i18nutil/searchopt.hxx>
#include "cfgutil.hxx"
-class CommandCategoryListBox : public ListBox
+class CommandCategoryListBox
{
SfxGroupInfoArr_Impl m_aGroupInfo;
OUString m_sModuleLongName;
@@ -39,10 +39,11 @@ class CommandCategoryListBox : public ListBox
SfxStylesInfo_Impl* pStylesInfo;
SfxStylesInfo_Impl m_aStylesInfo;
+ std::unique_ptr<weld::ComboBox> m_xControl;
+
public:
- CommandCategoryListBox( vcl::Window* pParent );
- virtual ~CommandCategoryListBox() override;
- virtual void dispose() override;
+ CommandCategoryListBox(std::unique_ptr<weld::ComboBox> xControl);
+ ~CommandCategoryListBox();
void ClearAll();
void Init(
@@ -51,25 +52,27 @@ public:
const OUString& sModuleLongName);
void FillFunctionsList(
const css::uno::Sequence< css::frame::DispatchInformation >& xCommands,
- const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
+ CuiConfigFunctionListBox* pFunctionListBox,
const OUString& filterTerm,
SaveInData *pCurrentSaveInData );
OUString getCommandName(const OUString& sCommand);
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+
/**
Signals that a command category has been selected.
And updates the functions list box to include
the commands in the selected category.
*/
- void categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
- const OUString& filterTerm, SaveInData* pCurrentSaveInData = nullptr );
+ void categorySelected(CuiConfigFunctionListBox* pFunctionListBox,
+ const OUString& filterTerm, SaveInData* pCurrentSaveInData = nullptr);
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
// Adds children of the given macro group to the functions list
void addChildren(
- SvTreeListEntry* parentEntry, const css::uno::Reference<com::sun::star::script::browse::XBrowseNode> &parentNode,
- const VclPtr<SfxConfigFunctionListBox> &pFunctionListBox, const OUString &filterTerm , SaveInData *pCurrentSaveInData );
+ weld::TreeIter* parentEntry, const css::uno::Reference<com::sun::star::script::browse::XBrowseNode> &parentNode,
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString &filterTerm , SaveInData *pCurrentSaveInData );
};
#endif // INCLUDED_CUI_SOURCE_INC_COMMANDCATEGORYLISTBOX_HXX
diff --git a/cui/source/inc/SvxMenuConfigPage.hxx b/cui/source/inc/SvxMenuConfigPage.hxx
index fb828a9c38a4..8ac919f2e8e8 100644
--- a/cui/source/inc/SvxMenuConfigPage.hxx
+++ b/cui/source/inc/SvxMenuConfigPage.hxx
@@ -48,19 +48,24 @@ class SvxMenuConfigPage : public SvxConfigPage
{
private:
bool m_bIsMenuBar;
- DECL_LINK( SelectMenu, ListBox&, void );
- DECL_LINK( SelectMenuEntry, SvTreeListBox *, void );
- DECL_LINK( GearHdl, MenuButton *, void );
+ DECL_LINK( SelectMenu, weld::ComboBox&, void );
+ DECL_LINK( SelectMenuEntry, weld::TreeView&, void );
- DECL_LINK( SelectCategory, ListBox&, void );
+ DECL_LINK( GearHdl, const OString&, void );
- DECL_LINK( AddCommandHdl, Button *, void );
- DECL_LINK( RemoveCommandHdl, Button *, void );
+ DECL_LINK( SelectCategory, weld::ComboBox&, void );
- DECL_LINK( InsertHdl, MenuButton *, void );
- DECL_LINK( ModifyItemHdl, MenuButton *, void );
- DECL_LINK( ResetMenuHdl, Button *, void );
+ DECL_LINK( AddCommandHdl, weld::Button&, void );
+ DECL_LINK( RemoveCommandHdl, weld::Button&, void );
+
+ DECL_LINK( InsertHdl, const OString&, void );
+ DECL_LINK( ModifyItemHdl, const OString&, void );
+ DECL_LINK( ResetMenuHdl, weld::Button&, void );
+
+ DECL_LINK( MenuEntriesSizeAllocHdl, const Size&, void );
+
+ DECL_LINK( ListModifiedHdl, weld::TreeView&, void );
void Init() override;
void UpdateButtonStates() override;
@@ -68,8 +73,10 @@ private:
void DeleteSelectedContent() override;
void DeleteSelectedTopLevel() override;
+ virtual void SelectElement() override;
+
public:
- SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet, bool bIsMenuBar = true );
+ SvxMenuConfigPage(TabPageParent pParent, const SfxItemSet& rItemSet, bool bIsMenuBar = true);
virtual ~SvxMenuConfigPage() override;
virtual void dispose() override;
diff --git a/cui/source/inc/SvxToolbarConfigPage.hxx b/cui/source/inc/SvxToolbarConfigPage.hxx
index e3de02d96ce6..9f827ba9e39d 100644
--- a/cui/source/inc/SvxToolbarConfigPage.hxx
+++ b/cui/source/inc/SvxToolbarConfigPage.hxx
@@ -48,34 +48,36 @@ class SvxToolbarConfigPage : public SvxConfigPage
{
private:
- DECL_LINK( SelectToolbar, ListBox&, void );
- DECL_LINK( SelectToolbarEntry, SvTreeListBox*, void );
- DECL_LINK( MoveHdl, Button *, void );
+ DECL_LINK( SelectToolbar, weld::ComboBox&, void );
+ DECL_LINK( SelectToolbarEntry, weld::TreeView&, void );
+ DECL_LINK( MoveHdl, weld::Button&, void );
- DECL_LINK( GearHdl, MenuButton *, void );
+ DECL_LINK( GearHdl, const OString&, void );
- DECL_LINK( SelectCategory, ListBox&, void );
+ DECL_LINK( SelectCategory, weld::ComboBox&, void );
- DECL_LINK( AddCommandHdl, Button *, void );
- DECL_LINK( RemoveCommandHdl, Button *, void );
+ DECL_LINK( AddCommandHdl, weld::Button&, void );
+ DECL_LINK( RemoveCommandHdl, weld::Button&, void );
- DECL_LINK( InsertHdl, MenuButton *, void );
- DECL_LINK( ModifyItemHdl, MenuButton *, void );
- DECL_LINK( ResetToolbarHdl, Button *, void );
+ DECL_LINK( InsertHdl, const OString&, void );
+ DECL_LINK( ModifyItemHdl, const OString&, void );
+ DECL_LINK( ResetToolbarHdl, weld::Button&, void );
+
+ DECL_LINK( ListModifiedHdl, weld::TreeView&, void );
void UpdateButtonStates() override;
short QueryReset() override;
void Init() override;
void DeleteSelectedContent() override;
void DeleteSelectedTopLevel() override;
+ virtual void SelectElement() override;
public:
- SvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
+ SvxToolbarConfigPage(TabPageParent pParent, const SfxItemSet& rItemSet);
virtual ~SvxToolbarConfigPage() override;
virtual void dispose() override;
- void AddFunction( SvTreeListEntry* pTarget = nullptr,
- bool bFront = false );
+ void AddFunction(int nTarget = -1, bool bFront = false);
void MoveEntry( bool bMoveUp ) override;
@@ -90,30 +92,16 @@ public:
class SvxToolbarEntriesListBox final : public SvxMenuEntriesListBox
{
- std::unique_ptr<SvLBoxButtonData> m_pButtonData;
- VclPtr<SvxConfigPage> pPage;
-
- void ChangeVisibility( SvTreeListEntry* pEntry );
+ void ChangedVisibility(int nRow);
- virtual void CheckButtonHdl() override;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
- void BuildCheckBoxButtonImages( SvLBoxButtonData* );
- Image GetSizedImage(
- VirtualDevice& aDev, const Size& aNewSize, const Image& aImage );
+ typedef std::pair<int, int> row_col;
+ DECL_LINK(CheckButtonHdl, const row_col&, void);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
public:
- SvxToolbarEntriesListBox(vcl::Window* pParent, SvxToolbarConfigPage* pPg);
+ SvxToolbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxToolbarConfigPage* pPg);
virtual ~SvxToolbarEntriesListBox() override;
- virtual void dispose() override;
-
- virtual TriState NotifyMoving(
- SvTreeListEntry*, SvTreeListEntry*, SvTreeListEntry*&, sal_uLong& ) override;
-
- virtual TriState NotifyCopying(
- SvTreeListEntry*, SvTreeListEntry*, SvTreeListEntry*&, sal_uLong&) override;
-
- void KeyInput( const KeyEvent& rKeyEvent ) override;
};
#endif // INCLUDED_CUI_SOURCE_INC_SVXTOOLBARCONFIGPAGE_HXX
diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx
index 917c549f85f7..539411b98966 100644
--- a/cui/source/inc/acccfg.hxx
+++ b/cui/source/inc/acccfg.hxx
@@ -41,7 +41,7 @@
#include "cfgutil.hxx"
class SfxMacroInfoItem;
-class SfxConfigFunctionListBox;
+class CuiConfigFunctionListBox;
class SfxAcceleratorConfigPage;
class SfxStringItem;
@@ -144,6 +144,7 @@ private:
DECL_LINK(Default, weld::Button&, void);
DECL_LINK(RadioHdl, weld::Button&, void);
DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(FocusOut_Impl, weld::Widget&, void);
DECL_LINK(TimeOut_Impl, Timer*, void);
DECL_LINK(LoadHdl, sfx2::FileDialogHelper *, void);
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 5734d1dc47cc..8d89aafd84ae 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -166,7 +166,7 @@ public:
css::uno::Sequence
< css::beans::PropertyValue > m_aSeparatorSeq;
- Image GetImage( const OUString& rCommandURL );
+ css::uno::Reference<css::graphic::XGraphic> GetImage(const OUString& rCommandURL);
virtual bool HasURL( const OUString& aURL ) = 0;
virtual bool HasSettings() = 0;
@@ -331,90 +331,106 @@ public:
void SetStyle( sal_Int32 style ) { nStyle = style; }
};
-class SvxMenuEntriesListBox : public SvTreeListBox
+class SvxMenuEntriesListBox
{
-private:
- VclPtr<SvxConfigPage> pPage;
-
protected:
- bool m_bIsInternalDrag;
+ std::unique_ptr<weld::TreeView> m_xControl;
+ ScopedVclPtr<VirtualDevice> m_xDropDown;
+ VclPtr<SvxConfigPage> pPage;
+ bool m_bIsInternalDrag;
public:
- SvxMenuEntriesListBox(vcl::Window*, SvxConfigPage*);
- virtual ~SvxMenuEntriesListBox() override;
- virtual void dispose() override;
-
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
-
- virtual bool NotifyAcceptDrop( SvTreeListEntry* pEntry ) override;
-
- virtual TriState NotifyMoving( SvTreeListEntry*, SvTreeListEntry*,
- SvTreeListEntry*&, sal_uLong& ) override;
-
- virtual TriState NotifyCopying( SvTreeListEntry*, SvTreeListEntry*,
- SvTreeListEntry*&, sal_uLong&) override;
+ SvxMenuEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPage);
+ virtual ~SvxMenuEntriesListBox();
+
+ int get_selected_index() const { return m_xControl->get_selected_index(); }
+ OUString get_id(int nPos) const { return m_xControl->get_id(nPos); }
+ void remove(int nPos) { m_xControl->remove(nPos); }
+ int n_children() const { return m_xControl->n_children(); }
+ void set_text(int row, const OUString& rText, int col) { m_xControl->set_text(row, rText, col); }
+ void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) { m_xControl->set_image(row, rImage, col); }
+ void set_dropdown(int row, int col) { m_xControl->set_image(row, *m_xDropDown, col); }
+ void set_id(int row, const OUString& rId) { m_xControl->set_id(row, rId); }
+ void clear() { m_xControl->clear(); } //need frees ?
+ void set_toggle(int row, bool bOn, int col) { m_xControl->set_toggle(row, bOn, col); }
+ void scroll_to_row(int pos) { m_xControl->scroll_to_row(pos); }
+ void select(int pos) { m_xControl->select(pos); }
+
+ weld::TreeView& get_widget() { return *m_xControl; }
+
+ void insert(int pos, const OUString& rId)
+ {
+ m_xControl->insert(nullptr, pos, nullptr, &rId,
+ nullptr, nullptr, nullptr, false, nullptr);
+ }
- virtual DragDropMode NotifyStartDrag(
- TransferDataContainer&, SvTreeListEntry* ) override;
+ void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pImage = nullptr)
+ {
+ m_xControl->insert(pos, rStr, &rId, pImage, nullptr);
+ }
- virtual void DragFinished( sal_Int8 ) override;
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
- void KeyInput( const KeyEvent& rKeyEvent ) override;
+ void CreateDropDown();
};
class SvxConfigPage : public SfxTabPage
{
private:
+ Timer m_aUpdateDataTimer;
bool bInitialised;
SaveInData* pCurrentSaveInData;
- DECL_LINK( SelectSaveInLocation, ListBox&, void );
- DECL_LINK( SearchUpdateHdl, Edit&, void );
+ DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
protected:
+ /// the ResourceURL to select when opening the dialog
+ OUString m_aURLToSelect;
+
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+
// Left side of the dialog where command categories and the available
// commands in them are displayed as a searchable list
- VclPtr<Edit> m_pSearchEdit;
- VclPtr<CommandCategoryListBox> m_pCommandCategoryListBox;
- VclPtr<SfxConfigFunctionListBox> m_pFunctions;
+ std::unique_ptr<weld::Entry> m_xSearchEdit;
+ std::unique_ptr<CommandCategoryListBox> m_xCommandCategoryListBox;
+ std::unique_ptr<CuiConfigFunctionListBox> m_xFunctions;
- VclPtr<FixedText> m_pDescriptionFieldLb;
- VclPtr<VclMultiLineEdit> m_pDescriptionField;
+ std::unique_ptr<weld::Label> m_xDescriptionFieldLb;
+ std::unique_ptr<weld::TextView> m_xDescriptionField;
// Right side of the dialog where the contents of the selected
// menu or toolbar are displayed
- VclPtr<ListBox> m_pTopLevelListBox;
+ std::unique_ptr<weld::ComboBox> m_xTopLevelListBox;
// Used to add and remove toolbars/menus
- VclPtr<MenuButton> m_pGearBtn;
- VclPtr<VclContainer> m_pEntries;
- VclPtr<SvTreeListBox> m_pContentsListBox;
+ std::unique_ptr<weld::MenuButton> m_xGearBtn;
+ std::unique_ptr<SvxMenuEntriesListBox> m_xContentsListBox;
- VclPtr<PushButton> m_pMoveUpButton;
- VclPtr<PushButton> m_pMoveDownButton;
+ std::unique_ptr<weld::Button> m_xMoveUpButton;
+ std::unique_ptr<weld::Button> m_xMoveDownButton;
- VclPtr<ListBox> m_pSaveInListBox;
+ std::unique_ptr<weld::ComboBox> m_xSaveInListBox;
- VclPtr<MenuButton> m_pInsertBtn;
- VclPtr<MenuButton> m_pModifyBtn;
+ std::unique_ptr<weld::MenuButton> m_xInsertBtn;
+ std::unique_ptr<weld::MenuButton> m_xModifyBtn;
// Used to reset the selected toolbar/menu/context menu
- VclPtr<PushButton> m_pResetBtn;
+ std::unique_ptr<weld::Button> m_xResetBtn;
// Middle buttons
- VclPtr<PushButton> m_pAddCommandButton;
- VclPtr<PushButton> m_pRemoveCommandButton;
-
- /// the ResourceURL to select when opening the dialog
- OUString m_aURLToSelect;
+ std::unique_ptr<weld::Button> m_xAddCommandButton;
+ std::unique_ptr<weld::Button> m_xRemoveCommandButton;
- css::uno::Reference< css::frame::XFrame > m_xFrame;
- SvxConfigPage( vcl::Window*, const SfxItemSet& );
+ SvxConfigPage(TabPageParent, const SfxItemSet&);
- DECL_LINK( MoveHdl, Button *, void );
- DECL_LINK( SelectFunctionHdl, SvTreeListBox *, void );
- DECL_LINK( FunctionDoubleClickHdl, SvTreeListBox *, bool );
+ DECL_LINK(MoveHdl, weld::Button&, void);
+ DECL_LINK(SelectFunctionHdl, weld::TreeView&, void);
+ DECL_LINK(FunctionDoubleClickHdl, weld::TreeView&, void);
+ DECL_LINK(SelectSaveInLocation, weld::ComboBox&, void);
+ DECL_LINK(SelectElementHdl, weld::ComboBox&, void);
+ DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(FocusOut_Impl, weld::Widget&, void);
virtual SaveInData* CreateSaveInData(
const css::uno::Reference< css::ui::XUIConfigurationManager >&,
@@ -426,15 +442,17 @@ protected:
virtual void UpdateButtonStates() = 0;
virtual short QueryReset() = 0;
- SvTreeListEntry* InsertEntry( SvxConfigEntry* pNewEntryData,
- SvTreeListEntry* pTarget = nullptr,
- bool bFront = false );
+ virtual void SelectElement() = 0;
+
+ int InsertEntry(SvxConfigEntry* pNewEntryData,
+ int nTarget,
+ bool bFront = false);
void AddSubMenusToUI( const OUString& rBaseTitle,
SvxConfigEntry const * pParentData );
- SvTreeListEntry* InsertEntryIntoUI ( SvxConfigEntry* pNewEntryData,
- sal_uLong nPos = TREELIST_APPEND );
+ void InsertEntryIntoUI(SvxConfigEntry* pNewEntryData,
+ int nPos, int nStartCol);
SvxEntries* FindParentForChild( SvxEntries* pParentEntries,
SvxConfigEntry* pChildData );
@@ -444,20 +462,18 @@ protected:
public:
virtual ~SvxConfigPage() override;
- virtual void dispose() override;
static bool CanConfig( const OUString& rModuleId );
SaveInData* GetSaveInData() { return pCurrentSaveInData; }
- SvTreeListEntry* AddFunction( SvTreeListEntry* pTarget = nullptr,
- bool bFront = false,
- bool bAllowDuplicates = false );
+ int AddFunction(int nTarget = -1,
+ bool bFront = false,
+ bool bAllowDuplicates = false);
virtual void MoveEntry( bool bMoveUp );
- bool MoveEntryData( SvTreeListEntry const * pSourceEntry,
- SvTreeListEntry const * pTargetEntry );
+ bool MoveEntryData(int SourceEntry, int nTargetEntry);
bool FillItemSet( SfxItemSet* ) override;
void Reset( const SfxItemSet* ) override;
@@ -467,8 +483,7 @@ public:
SvxConfigEntry* GetTopLevelSelection()
{
- return static_cast<SvxConfigEntry*>(m_pTopLevelListBox->GetEntryData(
- m_pTopLevelListBox->GetSelectedEntryPos() ));
+ return reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_active_id().toInt64());
}
/** identifies the module in the given frame. If the frame is <NULL/>, a default
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 2564933f326f..9a8eb7382514 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -104,28 +104,13 @@ struct SfxGroupInfo_Impl
typedef std::vector<std::unique_ptr<SfxGroupInfo_Impl> > SfxGroupInfoArr_Impl;
-class SfxConfigFunctionListBox : public SvTreeListBox
-{
- SfxGroupInfoArr_Impl aArr;
-
- virtual void MouseMove( const MouseEvent& rMEvt ) override;
-
-public:
- SfxConfigFunctionListBox(vcl::Window*, WinBits nStyle);
- virtual ~SfxConfigFunctionListBox() override;
- virtual void dispose() override;
-
- void ClearAll();
- using Window::GetHelpText;
- OUString GetHelpText( bool bConsiderParent = true );
-};
-
class CuiConfigFunctionListBox
{
friend class CuiConfigGroupListBox;
SfxGroupInfoArr_Impl aArr;
std::unique_ptr<weld::TreeView> m_xTreeView;
+ std::unique_ptr<weld::TreeIter> m_xScratchIter;
public:
CuiConfigFunctionListBox(std::unique_ptr<weld::TreeView> xTreeView);
@@ -134,26 +119,47 @@ public:
void connect_row_activated(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_row_activated(rLink); }
void freeze() { m_xTreeView->freeze(); }
void thaw() { m_xTreeView->thaw(); }
- void append(const OUString& rId, const OUString& rStr) { m_xTreeView->append(rId, rStr); }
- void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
+ void append(const OUString& rId, const OUString& rStr, weld::TreeIter* pParent = nullptr)
+ {
+ m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, nullptr);
+ }
+ std::unique_ptr<weld::TreeIter> append_ondemand(const OUString& rId, const OUString& rStr, weld::TreeIter* pParent = nullptr)
+ {
+ std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
+ m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, true, xIter.get());
+ return xIter;
+ }
+ void append(const OUString& rId, const OUString& rStr, const OUString& rImage, weld::TreeIter* pParent = nullptr)
+ {
+ m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, nullptr);
+ }
+ void append(const OUString& rId, const OUString& rStr, const css::uno::Reference<css::graphic::XGraphic>& rImage, weld::TreeIter* pParent = nullptr)
{
- m_xTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, nullptr);
+ m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, m_xScratchIter.get());
+ m_xTreeView->set_image(*m_xScratchIter, rImage, -1);
}
void remove(int nPos) { m_xTreeView->remove(nPos); }
+ void remove(weld::TreeIter& rIter) { m_xTreeView->remove(rIter); }
+ void expand_row(weld::TreeIter& rIter) { m_xTreeView->expand_row(rIter); }
int n_children() const { return m_xTreeView->n_children(); }
std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const { return m_xTreeView->make_iterator(pOrig); }
bool get_iter_first(weld::TreeIter& rIter) const { return m_xTreeView->get_iter_first(rIter); }
// set iter to point to next node, depth first, then sibling
bool iter_next(weld::TreeIter& rIter) const { return m_xTreeView->iter_next(rIter); }
bool iter_next_sibling(weld::TreeIter& rIter) const { return m_xTreeView->iter_next_sibling(rIter); }
+ bool iter_has_child(const weld::TreeIter& rIter) const { return m_xTreeView->iter_has_child(rIter); }
OUString get_text(const weld::TreeIter& rIter) const { return m_xTreeView->get_text(rIter); }
OUString get_text(int nPos) const { return m_xTreeView->get_text(nPos); }
OUString get_id(const weld::TreeIter& rIter) const { return m_xTreeView->get_id(rIter); }
+ OUString get_id(int nPos) const { return m_xTreeView->get_id(nPos); }
bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); }
+ OUString get_selected_text() const { return m_xTreeView->get_selected_text(); }
+ int get_selected_index() const { return m_xTreeView->get_selected_index(); }
void scroll_to_row(int nRow) { return m_xTreeView->scroll_to_row(nRow); }
void select(const weld::TreeIter& rIter) { m_xTreeView->select(rIter); }
void select(int pos) { m_xTreeView->select(pos); }
void set_size_request(int nWidth, int nHeight) { m_xTreeView->set_size_request(nWidth, nHeight); }
+ Size get_size_request() const { return m_xTreeView->get_size_request(); }
weld::TreeView& get_widget() { return *m_xTreeView; }
~CuiConfigFunctionListBox();
@@ -191,11 +197,11 @@ class CuiConfigGroupListBox
void InitModule();
void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
- weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand);
+ const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand);
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation >& xCommands);
OUString MapCommand2UIName(const OUString& sCommand);
- DECL_LINK(ExpandingHdl, weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHdl, const weld::TreeIter&, bool);
DECL_LINK(OpenCurrentHdl, weld::TreeView&, void);
public:
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 5d7a3da2bf6f..b38ae2d392e8 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -105,7 +105,7 @@ protected:
std::unique_ptr<weld::Button> m_xDelButton;
DECL_LINK( ScriptSelectHdl, weld::TreeView&, void );
- DECL_LINK( ExpandingHdl, weld::TreeIter&, bool );
+ DECL_LINK( ExpandingHdl, const weld::TreeIter&, bool );
DECL_LINK( ButtonHdl, weld::Button&, void );
static bool getBoolProperty( css::uno::Reference< css::beans::XPropertySet > const & xProps, OUString const & propName );
void CheckButtons( css::uno::Reference< css::script::browse::XBrowseNode > const & node );
@@ -124,17 +124,17 @@ protected:
void deleteTree(weld::TreeIter& rIter);
void deleteAllTree();
void insertEntry(OUString const & rText, OUString const & rBitmap,
- weld::TreeIter* pParent,
+ const weld::TreeIter* pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData,
const OUString& factoryURL, bool bSelect);
void insertEntry(OUString const & rText, OUString const & rBitmap,
- weld::TreeIter* pParent,
+ const weld::TreeIter* pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData,
bool bSelect);
- void RequestSubEntries(weld::TreeIter& rRootEntry,
+ void RequestSubEntries(const weld::TreeIter& rRootEntry,
css::uno::Reference< css::script::browse::XBrowseNode > const & node,
css::uno::Reference< css::frame::XModel>& model);
diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui
index 2ff9c0f465a0..5f184ca30633 100644
--- a/cui/uiconfig/ui/menuassignpage.ui
+++ b/cui/uiconfig/ui/menuassignpage.ui
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkMenu" id="gearmenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -83,16 +82,84 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-forward</property>
+ <property name="icon_size">3</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-back</property>
+ <property name="icon_size">3</property>
</object>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">sfx2/res/actionaction013.png</property>
+ <property name="icon_name">sfx2/res/actionaction013.png</property>
+ </object>
+ <object class="GtkMenu" id="insertmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="insertseparator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="menuassignpage|insertseparator">Insert Separator</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="insertsubmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="menuassignpage|insertsubmenu">Insert Submenu</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name expander -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkMenu" id="modifymenu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="renameItem">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="menuassignpage|renameItem">Rename...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="changeIcon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="menuassignpage|changeIcon">Change Icon...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="resetIcon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="menuassignpage|resetIcon">Reset Icon</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="restoreItem">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="menuassignpage|restoreItem">Restore Default Command</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
</object>
<object class="GtkBox" id="MenuAssignPage">
<property name="visible">True</property>
@@ -130,7 +197,7 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="desc:border">
+ <object class="GtkTextView" id="desc">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes" context="menuassignpage|desc">Local help is not installed.</property>
@@ -156,9 +223,9 @@
<property name="valign">start</property>
<property name="label" translatable="yes" context="menuassignpage|label33">D_escription</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">desc:border</property>
+ <property name="mnemonic_widget">desc</property>
<accessibility>
- <relation type="label-for" target="desc:border"/>
+ <relation type="label-for" target="desc"/>
</accessibility>
</object>
<packing>
@@ -167,14 +234,45 @@
</packing>
</child>
<child>
- <object class="cuilo-SfxConfigFunctionListBox" id="functions:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="margin_bottom">4</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="functions">
+ <property name="width_request">-1</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="enable_tree_lines">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -197,7 +295,7 @@
</packing>
</child>
<child>
- <object class="cuilo-CommandCategoryListBox" id="commandcategorylist">
+ <object class="GtkComboBoxText" id="commandcategorylist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_bottom">4</property>
@@ -216,6 +314,7 @@
<property name="valign">center</property>
<property name="label" translatable="yes" context="menuassignpage|contentslabel">Categor_y</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">commandcategorylist</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -279,6 +378,7 @@
<property name="margin_bottom">4</property>
<child>
<object class="GtkComboBoxText" id="toplevellist">
+ <property name="width_request">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -289,7 +389,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="gearbtn:gearmenu">
+ <object class="GtkMenuButton" id="gearbtn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -297,8 +397,10 @@
<property name="margin_left">1</property>
<property name="image">image7</property>
<property name="always_show_image">True</property>
+ <property name="popup">gearmenu</property>
+ <property name="use_popover">False</property>
<child internal-child="accessible">
- <object class="AtkObject" id="gearbtn:gearmenu-atkobject">
+ <object class="AtkObject" id="gearbtn-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="menuassignpage|gearbtn">Gear Menu</property>
<property name="AtkObject::accessible-description" translatable="yes" context="menuassignpage|gearbtn">Contains commands to modify or delete the selected toolbar or the top level menu, and the command to add new toolbars or top level menus.</property>
</object>
@@ -323,31 +425,98 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
+ <object class="GtkScrolledWindow">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="toolcontents">
+ <property name="width_request">-1</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="reorderable">True</property>
+ <property name="search_column">1</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkScrolledWindow">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="menucontents">
+ <property name="width_request">-1</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="reorderable">True</property>
+ <property name="search_column">1</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext5"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext6"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
</object>
<packing>
@@ -366,7 +535,7 @@
<property name="hexpand">True</property>
<property name="layout_style">start</property>
<child>
- <object class="GtkButton" id="insert:insertmenu">
+ <object class="GtkMenuButton" id="insert">
<property name="label" translatable="yes" context="menuassignpage|insert">_Insert</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -376,6 +545,12 @@
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="popup">insertmenu</property>
+ <property name="use_popover">False</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">True</property>
@@ -384,7 +559,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="modify:modifymenu">
+ <object class="GtkMenuButton" id="modify">
<property name="label" translatable="yes" context="menuassignpage|modify">_Modify</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -394,6 +569,12 @@
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="popup">modifymenu</property>
+ <property name="use_popover">False</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">True</property>
@@ -647,7 +828,7 @@
<object class="GtkSizeGroup" id="sizegrp1">
<widgets>
<widget name="grid6"/>
- <widget name="functions:border"/>
+ <widget name="functions"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="sizegrp2">
@@ -655,66 +836,9 @@
<widgets>
<widget name="commandcategorylist"/>
<widget name="toplevellist"/>
- <widget name="gearbtn:gearmenu"/>
<widget name="searchEntry"/>
<widget name="savein"/>
<widget name="functionbtn"/>
</widgets>
</object>
- <object class="GtkMenu" id="insertmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="insertseparator">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="menuassignpage|insertseparator">Insert Separator</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="insertsubmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="menuassignpage|insertsubmenu">Insert Submenu</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
- <object class="GtkMenu" id="modifymenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="renameItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="menuassignpage|renameItem">Rename...</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="changeIcon">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="menuassignpage|changeIcon">Change Icon...</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="resetIcon">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="menuassignpage|resetIcon">Reset Icon</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="restoreItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="menuassignpage|restoreItem">Restore Default Command</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
</interface>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 967ee3c27de6..a420ad7f9864 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -186,9 +186,6 @@
<glade-widget-class title="SwDBTreeList" name="swlo-SwDBTreeList"
generic-name="SwDBTreeList" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
- <glade-widget-class title="ConfigGroupFunction ListBox" name="cuilo-SfxConfigFunctionListBox"
- generic-name="ConfigGroupFunction ListBox" parent="GtkTreeView"
- icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview"
generic-name="Table Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
@@ -538,9 +535,6 @@
<glade-widget-class title="Category ListBox" name="sdlo-CategoryListBox"
generic-name="Category ListBox" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
- <glade-widget-class title="Command Category ListBox" name="cuilo-CommandCategoryListBox"
- generic-name="Command Category ListBox" parent="GtkComboBox"
- icon-name="widget-gtk-combobox"/>
<glade-widget-class title="Color Config Control" name="cuilo-ColorConfigCtrl"
generic-name="ColorConfigCtrl" parent="GtkBox"
icon-name="widget-gtk-box"/>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index f0b9a6994f87..fdd2d486b1e3 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -38,6 +38,10 @@ namespace awt
{
class XWindow;
}
+namespace graphic
+{
+class XGraphic;
+}
}
}
}
@@ -127,6 +131,7 @@ public:
virtual OUString get_accessible_description() const = 0;
virtual void set_tooltip_text(const OUString& rTip) = 0;
+ virtual OUString get_tooltip_text() const = 0;
virtual void connect_focus_in(const Link<Widget&, void>& rLink)
{
@@ -491,27 +496,30 @@ protected:
Link<int, void> m_aColumnClickedHdl;
Link<const std::pair<int, int>&, void> m_aRadioToggleHdl;
// if handler returns false, the expansion of the row is refused
- Link<TreeIter&, bool> m_aExpandingHdl;
+ Link<const TreeIter&, bool> m_aExpandingHdl;
Link<TreeView&, void> m_aVisibleRangeChangedHdl;
+ Link<TreeView&, void> m_aModelChangedHdl;
std::vector<int> m_aRadioIndexes;
void signal_changed() { m_aChangeHdl.Call(*this); }
void signal_row_activated() { m_aRowActivatedHdl.Call(*this); }
void signal_column_clicked(int nColumn) { m_aColumnClickedHdl.Call(nColumn); }
- bool signal_expanding(TreeIter& rIter)
+ bool signal_expanding(const TreeIter& rIter)
{
return !m_aExpandingHdl.IsSet() || m_aExpandingHdl.Call(rIter);
}
void signal_visible_range_changed() { m_aVisibleRangeChangedHdl.Call(*this); }
+ void signal_model_changed() { m_aModelChangedHdl.Call(*this); }
// arg is pair<row,col>
void signal_toggled(const std::pair<int, int>& rRowCol) { m_aRadioToggleHdl.Call(rRowCol); }
public:
- virtual void insert(weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
- const OUString* pIconName, VirtualDevice* pImageSurface,
- const OUString* pExpanderName, bool bChildrenOnDemand, TreeIter* pRet)
+ virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
+ const OUString* pId, const OUString* pIconName,
+ VirtualDevice* pImageSurface, const OUString* pExpanderName,
+ bool bChildrenOnDemand, TreeIter* pRet)
= 0;
void insert(int nRow, TreeIter* pRet = nullptr)
@@ -521,8 +529,6 @@ public:
void append(TreeIter* pRet = nullptr) { insert(-1, pRet); }
- virtual void set_expander_image(const weld::TreeIter& rIter, const OUString& rExpanderName) = 0;
-
void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName,
VirtualDevice* pImageSurface)
{
@@ -544,12 +550,12 @@ public:
{
insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr);
}
- void append(weld::TreeIter* pParent, const OUString& rId, const OUString& rStr,
+ void append(const weld::TreeIter* pParent, const OUString& rId, const OUString& rStr,
const OUString& rImage)
{
insert(pParent, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr);
}
- void append(weld::TreeIter* pParent, const OUString& rStr)
+ void append(const weld::TreeIter* pParent, const OUString& rStr)
{
insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr);
}
@@ -565,6 +571,7 @@ public:
m_aRadioToggleHdl = rLink;
}
void connect_column_clicked(const Link<int, void>& rLink) { m_aColumnClickedHdl = rLink; }
+ void connect_model_changed(const Link<TreeView&, void>& rLink) { m_aModelChangedHdl = rLink; }
//by index
virtual int get_selected_index() const = 0;
@@ -577,8 +584,13 @@ public:
virtual void set_id(int row, const OUString& rId) = 0;
virtual void set_toggle(int row, bool bOn, int col) = 0;
virtual bool get_toggle(int row, int col) const = 0;
- virtual void set_image(int row, const OUString& rImage, int col) = 0;
+ virtual void set_image(int row, const OUString& rImage, int col = -1) = 0;
+ virtual void set_image(int row, VirtualDevice& rImage, int col = -1) = 0;
+ virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage,
+ int col = -1)
+ = 0;
virtual void set_top_entry(int pos) = 0;
+ virtual void swap(int pos1, int pos2) = 0;
virtual std::vector<int> get_selected_rows() const = 0;
virtual void set_font_color(int pos, const Color& rColor) const = 0;
virtual void scroll_to_row(int pos) = 0;
@@ -625,15 +637,19 @@ public:
// set iter to point to next node, depth first, then sibling
virtual bool iter_next(TreeIter& rIter) const = 0;
virtual bool iter_children(TreeIter& rIter) const = 0;
- bool iter_nth_child(TreeIter& rIter, int nChild) const
+ bool iter_nth_sibling(TreeIter& rIter, int nChild) const
{
- if (!iter_children(rIter))
- return false;
bool bRet = true;
for (int i = 0; i < nChild && bRet; ++i)
- bRet = iter_next(rIter);
+ bRet = iter_next_sibling(rIter);
return bRet;
}
+ bool iter_nth_child(TreeIter& rIter, int nChild) const
+ {
+ if (!iter_children(rIter))
+ return false;
+ return iter_nth_sibling(rIter, nChild);
+ }
virtual bool iter_parent(TreeIter& rIter) const = 0;
virtual int get_iter_depth(const TreeIter& rIter) const = 0;
virtual bool iter_has_child(const TreeIter& rIter) const = 0;
@@ -641,19 +657,23 @@ public:
virtual void select(const TreeIter& rIter) = 0;
virtual void unselect(const TreeIter& rIter) = 0;
virtual bool get_row_expanded(const TreeIter& rIter) const = 0;
- virtual void expand_row(TreeIter& rIter) = 0;
- virtual void collapse_row(TreeIter& rIter) = 0;
- virtual void set_text(TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
+ virtual void expand_row(const TreeIter& rIter) = 0;
+ virtual void collapse_row(const TreeIter& rIter) = 0;
+ virtual void set_text(const TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
+ virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col = -1) = 0;
virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0;
- virtual void set_id(TreeIter& rIter, const OUString& rId) = 0;
+ virtual void set_id(const TreeIter& rIter, const OUString& rId) = 0;
virtual OUString get_id(const TreeIter& rIter) const = 0;
+ virtual void set_image(const TreeIter& rIter,
+ const css::uno::Reference<css::graphic::XGraphic>& rImage, int col)
+ = 0;
virtual void scroll_to_row(const TreeIter& rIter) = 0;
virtual bool is_selected(const TreeIter& rIter) const = 0;
virtual void selected_foreach(const std::function<void(TreeIter&)>& func) = 0;
virtual void visible_foreach(const std::function<void(TreeIter&)>& func) = 0;
- void connect_expanding(const Link<TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
+ void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
virtual void connect_visible_range_changed(const Link<TreeView&, void>& rLink)
{
@@ -791,6 +811,7 @@ public:
{
insert_item(-1, rId, rStr, nullptr, &rImage, false);
}
+ virtual void remove_item(const OString& rId) = 0;
virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index f2152e704a9d..39d648597d97 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1495,7 +1495,7 @@ SdDrawDocument* SdPageObjsTLV::GetBookmarkDoc()
/**
* Entries are inserted only by request (double click)
*/
-IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, weld::TreeIter&, rFileEntry, bool)
+IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, const weld::TreeIter&, rFileEntry, bool)
{
if (!m_xTreeView->iter_has_child(rFileEntry))
{
@@ -1560,7 +1560,7 @@ IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, weld::TreeIter&, rFileEntry, boo
}
if (m_xTreeView->iter_has_child(*xPageEntry))
{
- m_xTreeView->set_expander_image(*xPageEntry, sImgPageObjs);
+ m_xTreeView->set_image(*xPageEntry, sImgPageObjs);
}
}
nPage++;
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index fdc154ecfd30..beaa5d4b5d57 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -318,7 +318,7 @@ private:
void CloseBookmarkDoc();
- DECL_LINK(RequestingChildrenHdl, weld::TreeIter&, bool);
+ DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
DECL_LINK(SelectHdl, weld::TreeView&, void);
public:
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 4e9b5901cbe8..8bb29e18c108 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -430,7 +430,6 @@ custom_widgets = [
'ClassificationEditView',
'ColorConfigCtrl',
'ColumnEdit',
- 'CommandCategoryListBox',
'ConditionEdit',
'ContentListBox',
'ContextVBox',
@@ -487,7 +486,6 @@ custom_widgets = [
'SearchResultsBox',
'SelectionListBox',
'SentenceEditWindow',
- 'SfxConfigFunctionListBox',
'ShowNupOrderWindow',
'ShowNupOrderWindow',
'SidebarDialControl',
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index cea9c99f6379..1ee15b260d09 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -265,15 +265,11 @@ cui/uiconfig/ui/macroselectordialog.ui://GtkLabel[@id='helpmacro'] orphan-label
cui/uiconfig/ui/macroselectordialog.ui://GtkLabel[@id='helptoolbar'] orphan-label
cui/uiconfig/ui/macroselectordialog.ui://GtkLabel[@id='libraryft'] orphan-label
cui/uiconfig/ui/macroselectordialog.ui://GtkLabel[@id='categoryft'] orphan-label
-cui/uiconfig/ui/macroselectordialog.ui://cuilo-SfxConfigFunctionListBox[@id='commands:border'] no-labelled-by
cui/uiconfig/ui/macroselectordialog.ui://GtkLabel[@id='macronameft'] orphan-label
cui/uiconfig/ui/macroselectordialog.ui://GtkLabel[@id='commandsft'] orphan-label
cui/uiconfig/ui/menuassignpage.ui://GtkLabel[@id='searchlabel'] orphan-label
cui/uiconfig/ui/menuassignpage.ui://GtkTextView[@id='desc:border'] labelled-by-and-mnemonic
-cui/uiconfig/ui/menuassignpage.ui://cuilo-SfxConfigFunctionListBox[@id='functions:border'] no-labelled-by
cui/uiconfig/ui/menuassignpage.ui://GtkLabel[@id='leftfunctionlabel'] orphan-label
-cui/uiconfig/ui/menuassignpage.ui://cuilo-CommandCategoryListBox[@id='commandcategorylist'] no-labelled-by
-cui/uiconfig/ui/menuassignpage.ui://GtkLabel[@id='categorylabel'] orphan-label
cui/uiconfig/ui/menuassignpage.ui://GtkComboBoxText[@id='savein'] no-labelled-by
cui/uiconfig/ui/menuassignpage.ui://GtkComboBoxText[@id='toplevellist'] no-labelled-by
cui/uiconfig/ui/menuassignpage.ui://GtkLabel[@id='scopelabel'] orphan-label
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index 34840d85261b..3be7b4242f5e 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -546,7 +546,7 @@ void DBTreeList::AddDataSource(const OUString& rSource)
m_xTreeView->select(*xIter);
}
-IMPL_LINK(DBTreeList, RequestingChildrenHdl, weld::TreeIter&, rParent, bool)
+IMPL_LINK(DBTreeList, RequestingChildrenHdl, const weld::TreeIter&, rParent, bool)
{
if (!m_xTreeView->iter_has_child(rParent))
{
diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx
index c9634b6ed7a7..987412684063 100644
--- a/sw/source/uibase/inc/dbtree.hxx
+++ b/sw/source/uibase/inc/dbtree.hxx
@@ -74,7 +74,7 @@ class SW_DLLPUBLIC DBTreeList
DECL_DLLPRIVATE_LINK( DBCompare, const SvSortData&, sal_Int32 );
#endif
- DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, weld::TreeIter&, bool);
+ DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
SAL_DLLPRIVATE void InitTreeList();
public:
diff --git a/uitest/writer_tests/customizeDialog.py b/uitest/writer_tests/customizeDialog.py
index e6fef69cb50e..8b61613a2e31 100644
--- a/uitest/writer_tests/customizeDialog.py
+++ b/uitest/writer_tests/customizeDialog.py
@@ -44,6 +44,9 @@ class ConfigureDialog(UITestCase):
xSearch.executeAction("CLEAR", tuple())
+ # Wait for the search/filter op to be completed
+ time.sleep(1)
+
finalEntryCount = get_state_as_dict(xfunc)["Children"]
self.assertEqual(initialEntryCount, finalEntryCount)
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 70f06988db4b..b77ceafa8079 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -28,7 +28,6 @@
#include <o3tl/typed_flags_set.hxx>
#include <vcl/window.hxx>
-#include <vcl/weld.hxx>
// complete vcl::Window for SalFrame::CallCallback under -fsanitize=function
class AllSettings;
@@ -52,6 +51,15 @@ namespace o3tl {
template<> struct typed_flags<SalFrameToTop> : is_typed_flags<SalFrameToTop, 0x0f> {};
};
+namespace vcl { class KeyCode; }
+
+namespace weld
+{
+ class Window;
+}
+
+enum class FloatWinPopupFlags;
+
// SalFrame styles
enum class SalFrameStyleFlags
{
@@ -81,6 +89,7 @@ enum class SalFrameStyleFlags
// toolwindows should be painted with a smaller decoration
TOOLWINDOW = 0x40000000,
};
+
namespace o3tl {
template<> struct typed_flags<SalFrameStyleFlags> : is_typed_flags<SalFrameStyleFlags, 0x788001ff> {};
};
diff --git a/vcl/inc/treeglue.hxx b/vcl/inc/treeglue.hxx
new file mode 100644
index 000000000000..a314c7099e2a
--- /dev/null
+++ b/vcl/inc/treeglue.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include <vcl/svtabbx.hxx>
+
+//the default NotifyStartDrag is weird to me, and defaults to enabling all
+//possibilities when drag starts, while restricting it to some subset of
+//the configured drag drop mode would make more sense to me, but I'm not
+//going to change the baseclass
+
+class LclHeaderTabListBox : public SvHeaderTabListBox
+{
+public:
+ LclHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle)
+ : SvHeaderTabListBox(pParent, nWinStyle)
+ {
+ }
+
+ virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
+ {
+ return GetDragDropMode();
+ }
+};
+
+class LclTabListBox : public SvTabListBox
+{
+ Link<SvTreeListBox*, void> m_aModelChangedHdl;
+
+public:
+ LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
+ : SvTabListBox(pParent, nWinStyle)
+ {
+ }
+
+ void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
+
+ virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
+ {
+ return GetDragDropMode();
+ }
+
+ virtual void ModelHasCleared() override
+ {
+ SvTabListBox::ModelHasCleared();
+ m_aModelChangedHdl.Call(this);
+ }
+
+ virtual void ModelHasInserted(SvTreeListEntry* pEntry) override
+ {
+ SvTabListBox::ModelHasInserted(pEntry);
+ m_aModelChangedHdl.Call(this);
+ }
+
+ virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry) override
+ {
+ SvTabListBox::ModelHasInsertedTree(pEntry);
+ m_aModelChangedHdl.Call(this);
+ }
+
+ virtual void ModelHasMoved(SvTreeListEntry* pSource) override
+ {
+ SvTabListBox::ModelHasMoved(pSource);
+ m_aModelChangedHdl.Call(this);
+ }
+
+ virtual void ModelHasRemoved(SvTreeListEntry* pEntry) override
+ {
+ SvTabListBox::ModelHasRemoved(pEntry);
+ m_aModelChangedHdl.Call(this);
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 392ecb04ba81..3a9d59a8bdb2 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -32,6 +32,7 @@
#include <salmenu.hxx>
#include <svdata.hxx>
#include <messagedialog.hxx>
+#include <treeglue.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <utility>
#include <tools/helpers.hxx>
@@ -477,6 +478,11 @@ public:
m_xWidget->SetQuickHelpText(rTip);
}
+ virtual OUString get_tooltip_text() const override
+ {
+ return m_xWidget->GetQuickHelpText();
+ }
+
virtual void connect_focus_in(const Link<Widget&, void>& rLink) override
{
ensure_event_listener();
@@ -1539,6 +1545,12 @@ public:
pMenu->EnableItem(rIdent, bSensitive);
}
+ virtual void remove_item(const OString& rId) override
+ {
+ PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
+ pMenu->RemoveItem(pMenu->GetItemPos(pMenu->GetItemId(rId)));
+ }
+
virtual void set_item_active(const OString& rIdent, bool bActive) override
{
PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
@@ -2187,6 +2199,7 @@ private:
DECL_LINK(EndDragHdl, HeaderBar*, void);
DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
+ DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
public:
@@ -2203,13 +2216,21 @@ public:
m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl));
const long aTabPositions[] = { 0 };
m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
- if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+
+ if (pHeaderBox)
{
- //make the last entry fill available space
- pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE);
- pHeaderBar->SetEndDragHdl(LINK(this, SalInstanceTreeView, EndDragHdl));
- pHeaderBar->SetSelectHdl(LINK(this, SalInstanceTreeView, HeaderBarClickedHdl));
+ if (HeaderBar* pHeaderBar = pHeaderBox->GetHeaderBar())
+ {
+ //make the last entry fill available space
+ pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE);
+ pHeaderBar->SetEndDragHdl(LINK(this, SalInstanceTreeView, EndDragHdl));
+ pHeaderBar->SetSelectHdl(LINK(this, SalInstanceTreeView, HeaderBarClickedHdl));
+ }
+ }
+ else
+ {
+ static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(LINK(this, SalInstanceTreeView, ModelChangedHdl));
}
m_aCheckButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
@@ -2222,7 +2243,7 @@ public:
for (size_t i = 0; i < rWidths.size(); ++i)
aTabPositions.push_back(aTabPositions[i] + rWidths[i]);
m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), MapUnit::MapPixel);
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
for (size_t i = 0; i < rWidths.size(); ++i)
@@ -2243,7 +2264,7 @@ public:
virtual OUString get_column_title(int nColumn) const override
{
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
return pHeaderBar->GetItemText(pHeaderBar->GetItemId(nColumn));
@@ -2253,7 +2274,7 @@ public:
virtual void set_column_title(int nColumn, const OUString& rTitle) override
{
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
return pHeaderBar->SetItemText(pHeaderBar->GetItemId(nColumn), rTitle);
@@ -2262,7 +2283,7 @@ public:
virtual void show() override
{
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
pHeaderBar->Show();
@@ -2272,7 +2293,7 @@ public:
virtual void hide() override
{
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
pHeaderBar->Hide();
@@ -2280,11 +2301,12 @@ public:
SalInstanceContainer::hide();
}
- virtual void insert(weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
+ virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface,
const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet) override
{
- SalInstanceTreeIter* pVclIter = static_cast<SalInstanceTreeIter*>(pParent);
+ disable_notify_events();
+ const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent);
SvTreeListEntry* iter = pVclIter ? pVclIter->iter : nullptr;
auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
void* pUserData;
@@ -2329,6 +2351,7 @@ public:
{
m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
}
+ enable_notify_events();
}
virtual void set_font_color(int pos, const Color& rColor) const override
@@ -2375,10 +2398,20 @@ public:
pModel->Move(pEntry, nullptr, 0);
}
+ virtual void swap(int pos1, int pos2) override
+ {
+ SvTreeList* pModel = m_xTreeView->GetModel();
+ SvTreeListEntry* pEntry1 = pModel->GetEntry(nullptr, pos1);
+ SvTreeListEntry* pEntry2 = pModel->GetEntry(nullptr, pos2);
+ pModel->Move(pEntry1, pEntry2);
+ }
+
virtual void clear() override
{
+ disable_notify_events();
m_xTreeView->Clear();
m_aUserData.clear();
+ enable_notify_events();
}
virtual int n_children() const override
@@ -2579,9 +2612,14 @@ public:
m_xTreeView->ModelHasEntryInvalidated(pEntry);
}
- virtual void set_image(int pos, const OUString& rImage, int col) override
+ void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col)
{
- SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+ if (col == -1)
+ {
+ m_xTreeView->SetExpandedEntryBmp(pEntry, rImage);
+ m_xTreeView->SetCollapsedEntryBmp(pEntry, rImage);
+ return;
+ }
++col; //skip dummy/expander column
@@ -2589,10 +2627,9 @@ public:
for (int i = pEntry->ItemCount(); i < col ; ++i)
pEntry->AddItem(std::make_unique<SvLBoxString>(""));
- Image aImage(createImage(rImage));
if (static_cast<size_t>(col) == pEntry->ItemCount())
{
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(rImage, rImage, false));
SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
m_xTreeView->InitViewData(pViewData, pEntry);
}
@@ -2601,12 +2638,39 @@ public:
assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
SvLBoxItem& rItem = pEntry->GetItem(col);
assert(dynamic_cast<SvLBoxContextBmp*>(&rItem));
- static_cast<SvLBoxContextBmp&>(rItem).SetBitmap1(aImage);
- static_cast<SvLBoxContextBmp&>(rItem).SetBitmap2(aImage);
+ static_cast<SvLBoxContextBmp&>(rItem).SetBitmap1(rImage);
+ static_cast<SvLBoxContextBmp&>(rItem).SetBitmap2(rImage);
}
+ m_xTreeView->SetEntryHeight(pEntry);
m_xTreeView->ModelHasEntryInvalidated(pEntry);
+ }
+ virtual void set_image(int pos, const OUString& rImage, int col) override
+ {
+ set_image(m_xTreeView->GetEntry(nullptr, pos), createImage(rImage), col);
+ }
+
+ virtual void set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override
+ {
+ set_image(m_xTreeView->GetEntry(nullptr, pos), Image(rImage), col);
+ }
+
+ virtual void set_image(int pos, VirtualDevice& rImage, int col) override
+ {
+ set_image(m_xTreeView->GetEntry(nullptr, pos), createImage(rImage), col);
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override
+ {
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+ set_image(rVclIter.iter, Image(rImage), col);
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col) override
+ {
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+ set_image(rVclIter.iter, createImage(rImage), col);
}
const OUString* getEntryData(int index) const
@@ -2780,16 +2844,16 @@ public:
return m_xTreeView->IsExpanded(rVclIter.iter);
}
- virtual void expand_row(weld::TreeIter& rIter) override
+ virtual void expand_row(const weld::TreeIter& rIter) override
{
- SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
if (!m_xTreeView->IsExpanded(rVclIter.iter) && signal_expanding(rIter))
m_xTreeView->Expand(rVclIter.iter);
}
- virtual void collapse_row(weld::TreeIter& rIter) override
+ virtual void collapse_row(const weld::TreeIter& rIter) override
{
- SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
if (m_xTreeView->IsExpanded(rVclIter.iter))
m_xTreeView->Collapse(rVclIter.iter);
}
@@ -2804,9 +2868,9 @@ public:
return SvTabListBox::GetEntryText(rVclIter.iter, col);
}
- virtual void set_text(weld::TreeIter& rIter, const OUString& rText, int col) override
+ virtual void set_text(const weld::TreeIter& rIter, const OUString& rText, int col) override
{
- SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
set_text(rVclIter.iter, rText, col);
}
@@ -2819,18 +2883,10 @@ public:
return OUString();
}
- virtual void set_id(weld::TreeIter& rIter, const OUString& rId) override
- {
- SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
- set_id(rVclIter.iter, rId);
- }
-
- virtual void set_expander_image(const weld::TreeIter& rIter, const OUString& rImage) override
+ virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
- Image aImage(createImage(rImage));
- m_xTreeView->SetExpandedEntryBmp(rVclIter.iter, aImage);
- m_xTreeView->SetCollapsedEntryBmp(rVclIter.iter, aImage);
+ set_id(rVclIter.iter, rId);
}
virtual void set_selection_mode(SelectionMode eMode) override
@@ -2906,7 +2962,7 @@ public:
if (col == -1)
col = 0;
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
sal_uInt16 nTextId = pHeaderBar->GetItemId(col);
@@ -2929,7 +2985,7 @@ public:
if (col == -1)
col = 0;
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
sal_uInt16 nTextId = pHeaderBar->GetItemId(col);
@@ -2964,11 +3020,18 @@ public:
virtual ~SalInstanceTreeView() override
{
- SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
- if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
+ LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+ if (pHeaderBox)
{
- pHeaderBar->SetSelectHdl(Link<HeaderBar*, void>());
- pHeaderBar->SetEndDragHdl(Link<HeaderBar*, void>());
+ if (HeaderBar* pHeaderBar = pHeaderBox->GetHeaderBar())
+ {
+ pHeaderBar->SetSelectHdl(Link<HeaderBar*, void>());
+ pHeaderBar->SetEndDragHdl(Link<HeaderBar*, void>());
+ }
+ }
+ else
+ {
+ static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(Link<SvTreeListBox*, void>());
}
m_xTreeView->SetExpandingHdl(Link<SvTreeListBox*, bool>());
m_xTreeView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
@@ -3018,9 +3081,18 @@ IMPL_LINK(SalInstanceTreeView, CompareHdl, const SvSortData&, rSortData, sal_Int
IMPL_LINK_NOARG(SalInstanceTreeView, VisibleRangeChangedHdl, SvTreeListBox*, void)
{
+ if (notify_events_disabled())
+ return;
signal_visible_range_changed();
}
+IMPL_LINK_NOARG(SalInstanceTreeView, ModelChangedHdl, SvTreeListBox*, void)
+{
+ if (notify_events_disabled())
+ return;
+ signal_model_changed();
+}
+
IMPL_LINK(SalInstanceTreeView, ToggleHdl, SvLBoxButtonData*, pData, void)
{
SvTreeListEntry* pEntry = pData->GetActEntry();
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index 586b9073c2cb..f24ef9089694 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3658,7 +3658,7 @@ bool SvTreeListBox::set_property(const OString &rKey, const OUString &rValue)
else if (rKey == "reorderable")
{
if (toBool(rValue))
- SetDragDropMode(DragDropMode::CTRL_MOVE);
+ SetDragDropMode(DragDropMode::CTRL_MOVE | DragDropMode::ENABLE_TOP);
}
else
return Control::set_property(rKey, rValue);
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 37b9636f2906..b8932913cf53 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -679,7 +679,7 @@ void EditUIObject::execute(const OUString& rAction,
else if (rAction == "CLEAR")
{
mxEdit->SetText("");
- mxEdit->UpdateData();
+ mxEdit->Modify();
bHandled = true;
}
else
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 5969211017fd..9e1e0748d5ef 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -59,6 +59,7 @@
#include <desktop/crashreport.hxx>
#include <salinst.hxx>
#include <strings.hrc>
+#include <treeglue.hxx>
#include <tools/svlibrary.h>
#include <tools/diagnose_ex.h>
@@ -1595,42 +1596,6 @@ void VclBuilder::preload()
extern "C" VclBuilder::customMakeWidget lo_get_custom_widget_func(const char* name);
#endif
-namespace
-{
- //the default NotifyStartDrag is weird to me, and defaults to enabling all
- //possibilities when drag starts, while restricting it to some subset of
- //the configured drag drop mode would make more sense to me, but I'm not
- //going to change the baseclass
-
- class LclHeaderTabListBox : public SvHeaderTabListBox
- {
- public:
- LclHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle)
- : SvHeaderTabListBox(pParent, nWinStyle)
- {
- }
-
- virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
- {
- return GetDragDropMode();
- }
- };
-
- class LclTabListBox : public SvTabListBox
- {
- public:
- LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
- : SvTabListBox(pParent, nWinStyle)
- {
- }
-
- virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
- {
- return GetDragDropMode();
- }
- };
-}
-
VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &name, const OString &id,
stringmap &rMap)
{
@@ -1973,7 +1938,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
// everything over to SvHeaderTabListBox/SvTabListBox
//c) remove the users of makeSvTabListBox and makeSvTreeListBox
extractModel(id, rMap);
- WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK;
+ WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_HIDESELECTION;
if (m_bLegacy)
{
OUString sBorder = BuilderUtils::extractCustomProperty(rMap);
@@ -2022,6 +1987,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
xWindow = xBox;
xBox->SetNoAutoCurEntry(true);
xBox->SetQuickSearch(true);
+ xBox->SetSpaceBetweenEntries(3);
+ xBox->SetEntryHeight(16);
xBox->SetHighlightRange(); // select over the whole width
}
if (pRealParent != pParent)
@@ -2124,11 +2091,16 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
extractBuffer(id, rMap);
WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_NOHIDESELECTION;
- OUString sBorder = BuilderUtils::extractCustomProperty(rMap);
- if (!sBorder.isEmpty())
- nWinStyle |= WB_BORDER;
+ if (m_bLegacy)
+ {
+ OUString sBorder = BuilderUtils::extractCustomProperty(rMap);
+ if (!sBorder.isEmpty())
+ nWinStyle |= WB_BORDER;
+ }
//VclMultiLineEdit manages its own scrolling,
vcl::Window *pRealParent = prepareWidgetOwnScrolling(pParent, nWinStyle);
+ if (pRealParent != pParent)
+ nWinStyle |= WB_BORDER;
xWindow = VclPtr<VclMultiLineEdit>::Create(pRealParent, nWinStyle);
if (pRealParent != pParent)
cleanupWidgetOwnScrolling(pParent, xWindow, rMap);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f64cc790e115..3e17f6e09b27 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1702,6 +1702,12 @@ public:
gtk_widget_set_tooltip_text(m_pWidget, OUStringToOString(rTip, RTL_TEXTENCODING_UTF8).getStr());
}
+ virtual OUString get_tooltip_text() const override
+ {
+ const gchar* pStr = gtk_widget_get_tooltip_text(m_pWidget);
+ return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
+ }
+
virtual weld::Container* weld_parent() const override;
virtual OString get_buildable_name() const override
@@ -1926,22 +1932,25 @@ namespace
namespace
{
+ GdkPixbuf* load_icon_from_stream(SvMemoryStream& rStream)
+ {
+ GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new();
+ gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(rStream.GetData()),
+ rStream.TellEnd(), nullptr);
+ gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
+ GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader);
+ if (pixbuf)
+ g_object_ref(pixbuf);
+ g_object_unref(pixbuf_loader);
+ return pixbuf;
+ }
+
GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang)
{
- GdkPixbuf* pixbuf = nullptr;
auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang);
- if (xMemStm)
- {
- GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new();
- gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()),
- xMemStm->TellEnd(), nullptr);
- gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
- pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader);
- if (pixbuf)
- g_object_ref(pixbuf);
- g_object_unref(pixbuf_loader);
- }
- return pixbuf;
+ if (!xMemStm)
+ return nullptr;
+ return load_icon_from_stream(*xMemStm);
}
}
@@ -1954,7 +1963,7 @@ GdkPixbuf* load_icon_by_name(const OUString& rIconName)
namespace
{
- GdkPixbuf* load_icon_from_surface(const VirtualDevice& rDevice)
+ GdkPixbuf* getPixbuf(const VirtualDevice& rDevice)
{
Size aSize(rDevice.GetOutputSizePixel());
cairo_surface_t* surface = get_underlying_cairo_surface(rDevice);
@@ -1985,7 +1994,7 @@ namespace
}
else
{
- GdkPixbuf* pixbuf = load_icon_from_surface(rImageSurface);
+ GdkPixbuf* pixbuf = getPixbuf(rImageSurface);
pImage = gtk_image_new_from_pixbuf(pixbuf);
g_object_unref(pixbuf);
}
@@ -2102,6 +2111,13 @@ public:
gtk_menu_reorder_child(m_pMenu, pItem, pos);
}
+ void remove_item(const OString& rIdent)
+ {
+ GtkMenuItem* pMenuItem = m_aMap[rIdent];
+ remove_from_map(pMenuItem);
+ gtk_widget_destroy(GTK_WIDGET(pMenuItem));
+ }
+
void set_item_sensitive(const OString& rIdent, bool bSensitive)
{
gtk_widget_set_sensitive(GTK_WIDGET(m_aMap[rIdent]), bSensitive);
@@ -4376,7 +4392,7 @@ public:
gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
else
{
- GdkPixbuf* pixbuf = load_icon_from_surface(*pDevice);
+ GdkPixbuf* pixbuf = getPixbuf(*pDevice);
gtk_image_set_from_pixbuf(m_pImage, pixbuf);
g_object_unref(pixbuf);
}
@@ -4391,6 +4407,11 @@ public:
MenuHelper::insert_item(pos, rId, rStr, pIconName, pImageSurface, bCheck);
}
+ virtual void remove_item(const OString& rId) override
+ {
+ MenuHelper::remove_item(rId);
+ }
+
virtual void set_item_active(const OString& rIdent, bool bActive) override
{
MenuHelper::set_item_active(rIdent, bActive);
@@ -5257,6 +5278,17 @@ namespace
return pixbuf;
}
+ GdkPixbuf* getPixbuf(const css::uno::Reference<css::graphic::XGraphic>& rImage)
+ {
+ Image aImage(rImage);
+
+ std::unique_ptr<SvMemoryStream> xMemStm(new SvMemoryStream);
+ vcl::PNGWriter aWriter(aImage.GetBitmapEx());
+ aWriter.Write(*xMemStm);
+
+ return load_icon_from_stream(*xMemStm);
+ }
+
void insert_row(GtkListStore* pListStore, GtkTreeIter& iter, int pos, const OUString* pId, const OUString& rText, const OUString* pIconName, const VirtualDevice* pDevice)
{
if (!pIconName && !pDevice)
@@ -5384,6 +5416,8 @@ private:
gulong m_nRowActivatedSignalId;
gulong m_nTestExpandRowSignalId;
gulong m_nVAdjustmentChangedSignalId;
+ gulong m_nRowDeletedSignalId;
+ gulong m_nRowInsertedSignalId;
DECL_LINK(async_signal_changed, void*, void);
@@ -5406,10 +5440,10 @@ private:
pThis->signal_row_activated();
}
- void insert_row(GtkTreeIter& iter, GtkTreeIter* parent, int pos, const OUString* pId, const OUString* pText,
+ void insert_row(GtkTreeIter& iter, const GtkTreeIter* parent, int pos, const OUString* pId, const OUString* pText,
const OUString* pIconName, const VirtualDevice* pDevice, const OUString* pExpanderName)
{
- gtk_tree_store_insert_with_values(m_pTreeStore, &iter, parent, pos,
+ gtk_tree_store_insert_with_values(m_pTreeStore, &iter, const_cast<GtkTreeIter*>(parent), pos,
m_nTextCol, !pText ? nullptr : OUStringToOString(*pText, RTL_TEXTENCODING_UTF8).getStr(),
m_nIdCol, !pId ? nullptr : OUStringToOString(*pId, RTL_TEXTENCODING_UTF8).getStr(),
-1);
@@ -5480,10 +5514,10 @@ private:
return bRet;
}
- void set(GtkTreeIter& iter, int col, const OUString& rText)
+ void set(const GtkTreeIter& iter, int col, const OUString& rText)
{
OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
- gtk_tree_store_set(m_pTreeStore, &iter, col, aStr.getStr(), -1);
+ gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, aStr.getStr(), -1);
}
void set(int pos, int col, const OUString& rText)
@@ -5608,6 +5642,18 @@ private:
return m_aModelColToViewCol[modelcol];
}
+ static void signalRowDeleted(GtkTreeModel*, GtkTreePath*, GtkTreeIter*, gpointer widget)
+ {
+ GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
+ pThis->signal_model_changed();
+ }
+
+ static void signalRowInserted(GtkTreeModel*, GtkTreePath*, GtkTreeIter*, gpointer widget)
+ {
+ GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
+ pThis->signal_model_changed();
+ }
+
public:
GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, bTakeOwnership)
@@ -5661,6 +5707,10 @@ public:
{
a.second = nIndex++;
}
+
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ m_nRowDeletedSignalId = g_signal_connect(pModel, "row-deleted", G_CALLBACK(signalRowDeleted), this);
+ m_nRowInsertedSignalId = g_signal_connect(pModel, "row-inserted", G_CALLBACK(signalRowInserted), this);
}
virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override
@@ -5698,13 +5748,13 @@ public:
gtk_tree_view_column_set_title(pColumn, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr());
}
- virtual void insert(weld::TreeIter* pParent, int pos, const OUString* pText, const OUString* pId, const OUString* pIconName,
+ virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pText, const OUString* pId, const OUString* pIconName,
VirtualDevice* pImageSurface, const OUString* pExpanderName,
bool bChildrenOnDemand, weld::TreeIter* pRet) override
{
disable_notify_events();
GtkTreeIter iter;
- GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pParent);
+ const GtkInstanceTreeIter* pGtkIter = static_cast<const GtkInstanceTreeIter*>(pParent);
insert_row(iter, pGtkIter ? &pGtkIter->iter : nullptr, pos, pId, pText, pIconName, pImageSurface, pExpanderName);
if (bChildrenOnDemand)
{
@@ -5776,6 +5826,23 @@ public:
enable_notify_events();
}
+ virtual void swap(int pos1, int pos2) override
+ {
+ disable_notify_events();
+
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+
+ GtkTreeIter iter1;
+ gtk_tree_model_iter_nth_child(pModel, &iter1, nullptr, pos1);
+
+ GtkTreeIter iter2;
+ gtk_tree_model_iter_nth_child(pModel, &iter2, nullptr, pos2);
+
+ gtk_tree_store_swap(m_pTreeStore, &iter1, &iter2);
+
+ enable_notify_events();
+ }
+
virtual void clear() override
{
disable_notify_events();
@@ -6023,21 +6090,56 @@ public:
set(pos, col, bSensitive);
}
- virtual void set_image(int pos, const OUString& rImage, int col) override
+ void set_image(const GtkTreeIter& iter, int col, GdkPixbuf* pixbuf)
{
- col = get_model_col(col);
-
- GdkPixbuf* pixbuf = getPixbuf(rImage);
+ gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, pixbuf, -1);
+ if (pixbuf)
+ g_object_unref(pixbuf);
+ }
+ void set_image(int pos, GdkPixbuf* pixbuf, int col)
+ {
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
{
- gtk_tree_store_set(m_pTreeStore, &iter, col, pixbuf, -1);
+ set_image(iter, col, pixbuf);
}
+ }
- if (pixbuf)
- g_object_unref(pixbuf);
+ virtual void set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override
+ {
+ set_image(pos, getPixbuf(rImage), col);
+ }
+
+ virtual void set_image(int pos, const OUString& rImage, int col) override
+ {
+ set_image(pos, getPixbuf(rImage), col);
+ }
+
+ virtual void set_image(int pos, VirtualDevice& rImage, int col) override
+ {
+ set_image(pos, getPixbuf(rImage), col);
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override
+ {
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
+ if (col == -1)
+ col = m_nExpanderImageCol;
+ else
+ col = get_model_col(col);
+ set_image(rGtkIter.iter, col, getPixbuf(rImage));
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col) override
+ {
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
+ if (col == -1)
+ col = m_nExpanderImageCol;
+ else
+ col = get_model_col(col);
+ set_image(rGtkIter.iter, col, getPixbuf(rImage));
}
virtual OUString get_id(int pos) const override
@@ -6245,21 +6347,21 @@ public:
return ret;
}
- virtual void expand_row(weld::TreeIter& rIter) override
+ virtual void expand_row(const weld::TreeIter& rIter) override
{
- GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
- GtkTreePath* path = gtk_tree_model_get_path(pModel, &rGtkIter.iter);
+ GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
if (!gtk_tree_view_row_expanded(m_pTreeView, path))
gtk_tree_view_expand_to_path(m_pTreeView, path);
gtk_tree_path_free(path);
}
- virtual void collapse_row(weld::TreeIter& rIter) override
+ virtual void collapse_row(const weld::TreeIter& rIter) override
{
- GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
- GtkTreePath* path = gtk_tree_model_get_path(pModel, &rGtkIter.iter);
+ GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
if (gtk_tree_view_row_expanded(m_pTreeView, path))
gtk_tree_view_collapse_row(m_pTreeView, path);
gtk_tree_path_free(path);
@@ -6275,9 +6377,9 @@ public:
return get(rGtkIter.iter, col);
}
- virtual void set_text(weld::TreeIter& rIter, const OUString& rText, int col) override
+ virtual void set_text(const weld::TreeIter& rIter, const OUString& rText, int col) override
{
- GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
if (col == -1)
col = m_nTextCol;
else
@@ -6291,21 +6393,10 @@ public:
return get(rGtkIter.iter, m_nIdCol);
}
- virtual void set_id(weld::TreeIter& rIter, const OUString& rId) override
- {
- GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
- set(rGtkIter.iter, m_nIdCol, rId);
- }
-
- virtual void set_expander_image(const weld::TreeIter& rIter, const OUString& rExpanderName) override
+ virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- disable_notify_events();
- GdkPixbuf* pixbuf = getPixbuf(rExpanderName);
- gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&rGtkIter.iter), m_nExpanderImageCol, pixbuf, -1);
- if (pixbuf)
- g_object_unref(pixbuf);
- enable_notify_events();
+ set(rGtkIter.iter, m_nIdCol, rId);
}
virtual void freeze() override
@@ -6438,18 +6529,32 @@ public:
{
g_signal_handler_block(gtk_tree_view_get_selection(m_pTreeView), m_nChangedSignalId);
g_signal_handler_block(m_pTreeView, m_nRowActivatedSignalId);
+
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ g_signal_handler_block(pModel, m_nRowDeletedSignalId);
+ g_signal_handler_block(pModel, m_nRowInsertedSignalId);
+
GtkInstanceContainer::disable_notify_events();
}
virtual void enable_notify_events() override
{
GtkInstanceContainer::enable_notify_events();
+
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ g_signal_handler_unblock(pModel, m_nRowDeletedSignalId);
+ g_signal_handler_unblock(pModel, m_nRowInsertedSignalId);
+
g_signal_handler_unblock(m_pTreeView, m_nRowActivatedSignalId);
g_signal_handler_unblock(gtk_tree_view_get_selection(m_pTreeView), m_nChangedSignalId);
}
virtual ~GtkInstanceTreeView() override
{
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ g_signal_handler_disconnect(pModel, m_nRowDeletedSignalId);
+ g_signal_handler_disconnect(pModel, m_nRowInsertedSignalId);
+
if (m_nVAdjustmentChangedSignalId)
{
GtkAdjustment* pVAdjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(m_pTreeView));
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 9b4085684d81..d702be988ab1 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -31,6 +31,8 @@
#include <tools/urlobj.hxx>
+#include <vcl/weld.hxx>
+
#include <win/wincomp.hxx>
#include <win/saldata.hxx>
#include <win/salinst.h>