LibreOffice Module cui (master)  1
SvxMenuConfigPage.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/config.h>
21 #include <sal/log.hxx>
22 
23 #include <vcl/weld.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/commandevent.hxx>
26 
27 #include <strings.hrc>
28 #include <helpids.h>
29 
30 #include <cfg.hxx>
31 #include <SvxMenuConfigPage.hxx>
32 #include <SvxConfigPageHelper.hxx>
33 #include <dialmgr.hxx>
34 
36 
37 #include <dlgname.hxx>
38 
40  const SfxItemSet& rSet, bool bIsMenuBar)
41  : SvxConfigPage(pPage, pController, rSet)
42  , m_bIsMenuBar(bIsMenuBar)
43 {
44  m_xGearBtn = m_xBuilder->weld_menu_button("menugearbtn");
45  m_xGearBtn->show();
46  m_xContentsListBox.reset(
47  new SvxMenuEntriesListBox(m_xBuilder->weld_tree_view("menucontents"), this));
48  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
49  m_xDropTargetHelper.reset(new SvxConfigPageFunctionDropTarget(*this, rTreeView));
50  rTreeView.connect_size_allocate(LINK(this, SvxMenuConfigPage, MenuEntriesSizeAllocHdl));
51  Size aSize(m_xFunctions->get_size_request());
52  rTreeView.set_size_request(aSize.Width(), aSize.Height());
53  MenuEntriesSizeAllocHdl(aSize);
54  rTreeView.set_hexpand(true);
55  rTreeView.set_vexpand(true);
56  rTreeView.show();
57 
58  rTreeView.connect_changed(LINK(this, SvxMenuConfigPage, SelectMenuEntry));
59  rTreeView.connect_popup_menu(LINK(this, SvxMenuConfigPage, ContentContextMenuHdl));
60 
61  m_xFunctions->get_widget().connect_popup_menu(
62  LINK(this, SvxMenuConfigPage, FunctionContextMenuHdl));
63 
64  m_xGearBtn->connect_selected(LINK(this, SvxMenuConfigPage, GearHdl));
65 
66  m_xCommandCategoryListBox->connect_changed(LINK(this, SvxMenuConfigPage, SelectCategory));
67 
68  m_xMoveUpButton->connect_clicked(LINK(this, SvxConfigPage, MoveHdl));
69  m_xMoveDownButton->connect_clicked(LINK(this, SvxConfigPage, MoveHdl));
70 
71  m_xAddCommandButton->connect_clicked(LINK(this, SvxMenuConfigPage, AddCommandHdl));
72  m_xRemoveCommandButton->connect_clicked(LINK(this, SvxMenuConfigPage, RemoveCommandHdl));
73 
74  m_xInsertBtn->connect_selected(LINK(this, SvxMenuConfigPage, InsertHdl));
75  m_xModifyBtn->connect_selected(LINK(this, SvxMenuConfigPage, ModifyItemHdl));
76  m_xResetBtn->connect_clicked(LINK(this, SvxMenuConfigPage, ResetMenuHdl));
77 
78  // These operations are not possible on menus/context menus yet
79  m_xModifyBtn->remove_item("changeIcon");
80  m_xModifyBtn->remove_item("resetIcon");
81  m_xModifyBtn->remove_item("restoreItem");
82 
83  if (!bIsMenuBar)
84  {
85  //TODO: Remove this when the gear button is implemented for context menus
86  m_xGearBtn->set_sensitive(false);
87  m_xGearBtn->hide();
88  }
89  else
90  {
91  // TODO: Remove this when it is possible to reset menubar menus individually
92  m_xResetBtn->set_sensitive(false);
93  }
94 }
95 
97 {
98  // regenerate with the current ordering within the list
100  pEntries->clear();
101 
102  for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
103  pEntries->push_back(weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(i)));
104 
108 }
109 
110 IMPL_LINK(SvxMenuConfigPage, MenuEntriesSizeAllocHdl, const Size&, rSize, void)
111 {
112  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
113  std::vector<int> aWidths;
114 
115  int nStandardImageColWidth = rTreeView.get_checkbox_column_width();
116  int nMargin = 16;
117 
118  aWidths.push_back(rSize.Width() - (nMargin + nStandardImageColWidth));
119  rTreeView.set_column_fixed_widths(aWidths);
120 }
121 
123 {
124  for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
125  delete weld::fromId<SaveInData*>(m_xSaveInListBox->get_id(i));
126  m_xSaveInListBox->clear();
127 }
128 
129 // Populates the Menu combo box
131 {
132  // ensure that the UI is cleared before populating it
133  m_xTopLevelListBox->clear();
134  m_xContentsListBox->clear();
135 
137 
138  m_xTopLevelListBox->set_active(m_xTopLevelListBox->get_count() ? 0 : -1);
139  SelectElement();
140 
142  m_aModuleId);
143  m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), OUString(), GetSaveInData());
144  SelectFunctionHdl(m_xFunctions->get_widget());
145 }
146 
147 IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView&, void) { UpdateButtonStates(); }
148 
150 {
151  // Disable Up and Down buttons depending on current selection
152  int selection = m_xContentsListBox->get_selected_index();
153 
154  bool bIsSeparator
155  = selection != -1
156  && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(selection))->IsSeparator();
157  bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && selection != -1);
158 
159  m_xMoveUpButton->set_sensitive(bIsValidSelection && selection != 0);
160  m_xMoveDownButton->set_sensitive(bIsValidSelection
161  && selection != m_xContentsListBox->n_children() - 1);
162 
163  m_xRemoveCommandButton->set_sensitive(bIsValidSelection);
164 
165  m_xModifyBtn->set_sensitive(bIsValidSelection && !bIsSeparator);
166 
167  // If there is no top level selection (menu), then everything working on the right box
168  // which contains the functions of the selected menu/toolbar needs to be disabled
169  SvxConfigEntry* pMenuData = GetTopLevelSelection();
170 
171  m_xInsertBtn->set_sensitive(pMenuData != nullptr);
172 
174 
175  m_xAddCommandButton->set_sensitive(
176  pMenuData != nullptr && !IsCommandInMenuList(selectedCmd, pMenuData->GetEntries()));
177 
178  delete selectedCmd;
179 
180  if (bIsValidSelection)
181  {
182  m_xRemoveCommandButton->set_sensitive(pMenuData != nullptr);
183  }
184 
185  //Handle the gear button
186  if (pMenuData && m_bIsMenuBar)
187  {
188  // Add option (gear_add) will always be enabled
189  m_xGearBtn->set_item_sensitive("menu_gear_delete", pMenuData->IsDeletable());
190  m_xGearBtn->set_item_sensitive("menu_gear_rename", pMenuData->IsRenamable());
191  m_xGearBtn->set_item_sensitive("menu_gear_move", pMenuData->IsMovable());
192  }
193 }
194 
196 {
197  SvxConfigEntry* pMenuData = GetTopLevelSelection();
198 
199  SvxEntries* pParentEntries = FindParentForChild(GetSaveInData()->GetEntries(), pMenuData);
200 
201  SvxConfigPageHelper::RemoveEntry(pParentEntries, pMenuData);
202  delete pMenuData;
203 
205 
207 }
208 
210 {
211  int nActEntry = m_xContentsListBox->get_selected_index();
212 
213  if (nActEntry == -1)
214  return;
215 
216  // get currently selected menu entry
217  SvxConfigEntry* pMenuEntry
218  = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
219 
220  // get currently selected menu
222 
223  // remove menu entry from the list for this menu
224  SvxConfigPageHelper::RemoveEntry(pMenu->GetEntries(), pMenuEntry);
225 
226  // remove menu entry from UI
227  m_xContentsListBox->remove(nActEntry);
228 
229  // if this is a submenu entry, redraw the menus list box
230  if (pMenuEntry->IsPopup())
231  {
233  }
234 
235  // delete data for menu entry
236  delete pMenuEntry;
237 
239  pMenu->SetModified();
240 }
241 
243 {
244  OUString msg = CuiResId(RID_CUISTR_CONFIRM_MENU_RESET);
245 
246  OUString saveInName = m_xSaveInListBox->get_active_text();
247 
248  OUString label = SvxConfigPageHelper::replaceSaveInName(msg, saveInName);
249 
250  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
251  GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, label));
252  return xQueryBox->run();
253 }
254 
256 {
257  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
258 
259  SvxConfigEntry* pMenuData = GetTopLevelSelection();
260  if (!pMenuData)
261  rTreeView.clear();
262  else
263  {
264  SvxEntries* pEntries = pMenuData->GetEntries();
265 
266  rTreeView.bulk_insert_for_each(
267  pEntries->size(), [this, &rTreeView, pEntries](weld::TreeIter& rIter, int nIdx) {
268  auto const& entry = (*pEntries)[nIdx];
269  OUString sId(weld::toId(entry));
270  rTreeView.set_id(rIter, sId);
271  InsertEntryIntoUI(entry, rTreeView, rIter, true);
272  });
273  }
274 
276 }
277 
278 IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
279 {
280  if (rIdent == "menu_gear_add")
281  {
282  SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(), nullptr,
283  true);
284 
285  if (aDialog.run() == RET_OK)
286  {
287  GetSaveInData()->SetEntries(aDialog.ReleaseEntries());
288  ReloadTopLevelListBox(aDialog.GetSelectedEntry());
289  GetSaveInData()->SetModified();
290  }
291  }
292  else if (rIdent == "menu_gear_delete")
293  {
294  DeleteSelectedTopLevel();
295  }
296  else if (rIdent == "menu_gear_rename")
297  {
298  SvxConfigEntry* pMenuData = GetTopLevelSelection();
299 
300  OUString sCurrentName(SvxConfigPageHelper::stripHotKey(pMenuData->GetName()));
301  OUString sDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
302 
303  SvxNameDialog aNameDialog(GetFrameWeld(), sCurrentName, sDesc);
305  aNameDialog.set_title(CuiResId(RID_CUISTR_RENAME_MENU));
306 
307  if (aNameDialog.run() == RET_OK)
308  {
309  OUString sNewName = aNameDialog.GetName();
310 
311  if (sCurrentName == sNewName)
312  return;
313 
314  pMenuData->SetName(sNewName);
315 
316  ReloadTopLevelListBox();
317 
318  GetSaveInData()->SetModified();
319  }
320  }
321  else if (rIdent == "menu_gear_move")
322  {
323  SvxConfigEntry* pMenuData = GetTopLevelSelection();
324 
325  SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(), pMenuData,
326  false);
327  if (aDialog.run() == RET_OK)
328  {
329  GetSaveInData()->SetEntries(aDialog.ReleaseEntries());
330 
331  ReloadTopLevelListBox();
332 
333  GetSaveInData()->SetModified();
334  }
335  }
336  else
337  {
338  //This block should never be reached
339  SAL_WARN("cui.customize", "Unknown gear menu option: " << rIdent);
340  return;
341  }
342 
343  UpdateButtonStates();
344 }
345 
347 {
348  OUString aSearchTerm(m_xSearchEdit->get_text());
349 
350  m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), aSearchTerm, GetSaveInData());
351 
352  SelectFunctionHdl(m_xFunctions->get_widget());
353 }
354 
356 {
357  int nPos = AddFunction(-1, /*bAllowDuplicates*/ false);
358  if (nPos == -1)
359  return;
360  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
361  SvxConfigEntry* pEntry = weld::fromId<SvxConfigEntry*>(rTreeView.get_id(nPos));
362  InsertEntryIntoUI(pEntry, rTreeView, nPos, true);
363 }
364 
366 {
367  DeleteSelectedContent();
368  if (GetSaveInData()->IsModified())
369  {
370  UpdateButtonStates();
371  }
372 }
373 
374 IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
375 {
376  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
377  if (rIdent == "insertseparator")
378  {
379  SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
380  pNewEntryData->SetUserDefined();
381  int nPos = AppendEntry(pNewEntryData, -1);
382  InsertEntryIntoUI(pNewEntryData, rTreeView, nPos, true);
383  }
384  else if (rIdent == "insertsubmenu")
385  {
386  OUString aNewName;
387  OUString aDesc = CuiResId(RID_CUISTR_SUBMENU_NAME);
388 
389  SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
391  aNameDialog.set_title(CuiResId(RID_CUISTR_ADD_SUBMENU));
392 
393  if (aNameDialog.run() == RET_OK)
394  {
395  aNewName = aNameDialog.GetName();
396 
397  SvxConfigEntry* pNewEntryData
398  = new SvxConfigEntry(aNewName, aNewName, true, /*bParentData*/ false);
399  pNewEntryData->SetName(aNewName);
400  pNewEntryData->SetUserDefined();
401 
402  int nPos = AppendEntry(pNewEntryData, -1);
403  InsertEntryIntoUI(pNewEntryData, rTreeView, nPos, true);
404 
405  ReloadTopLevelListBox();
406 
407  m_xContentsListBox->scroll_to_row(nPos);
408  m_xContentsListBox->select(nPos);
409 
410  GetSaveInData()->SetModified();
411  }
412  }
413  else
414  {
415  //This block should never be reached
416  SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
417  return;
418  }
419 
420  if (GetSaveInData()->IsModified())
421  {
422  UpdateButtonStates();
423  }
424 }
425 
426 IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OString&, rIdent, void)
427 {
428  if (rIdent == "renameItem")
429  {
430  int nActEntry = m_xContentsListBox->get_selected_index();
431  SvxConfigEntry* pEntry
432  = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
433 
434  OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
435  OUString aDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
436 
437  SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
439  aNameDialog.set_title(CuiResId(RID_CUISTR_RENAME_MENU));
440 
441  if (aNameDialog.run() == RET_OK)
442  {
443  aNewName = aNameDialog.GetName();
444 
445  pEntry->SetName(aNewName);
446  m_xContentsListBox->set_text(nActEntry, aNewName, 0);
447 
448  GetSaveInData()->SetModified();
449  GetTopLevelSelection()->SetModified();
450  }
451  }
452  else
453  {
454  //This block should never be reached
455  SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
456  return;
457  }
458 
459  if (GetSaveInData()->IsModified())
460  {
461  UpdateButtonStates();
462  }
463 }
464 
466 {
467  SvxConfigEntry* pMenuData = GetTopLevelSelection();
468 
469  if (pMenuData == nullptr)
470  {
471  SAL_WARN("cui.customize",
472  "RHB top level selection is null. A menu must be selected to reset!");
473  return;
474  }
475 
476  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
477  GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
478  CuiResId(RID_CUISTR_CONFIRM_RESTORE_DEFAULT_MENU)));
479 
480  // Resetting individual top-level menus is not possible at the moment.
481  // So we are resetting only if it is a context menu
482  if (m_bIsMenuBar || xQueryBox->run() != RET_YES)
483  return;
484 
485  sal_Int32 nPos = m_xTopLevelListBox->get_active();
486  ContextMenuSaveInData* pSaveInData = static_cast<ContextMenuSaveInData*>(GetSaveInData());
487 
488  pSaveInData->ResetContextMenu(pMenuData);
489 
490  // ensure that the UI is cleared before populating it
491  m_xTopLevelListBox->clear();
492  m_xContentsListBox->clear();
493 
494  ReloadTopLevelListBox();
495 
496  // Reselect the reset menu
497  m_xTopLevelListBox->set_active(nPos);
498  SelectElement();
499 }
500 
502  const css::uno::Reference<css::ui::XUIConfigurationManager>& xCfgMgr,
503  const css::uno::Reference<css::ui::XUIConfigurationManager>& xParentCfgMgr,
504  const OUString& aModuleId, bool bDocConfig)
505 {
506  if (!m_bIsMenuBar)
507  return static_cast<SaveInData*>(
508  new ContextMenuSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
509 
510  return static_cast<SaveInData*>(
511  new MenuSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
512 }
513 
514 IMPL_LINK(SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool)
515 {
516  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
517  return false;
518 
519  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
520 
521  // Select clicked entry
522  std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
523  if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
524  return false;
525  rTreeView.select(*xIter);
526  SelectMenuEntry(rTreeView);
527 
528  int nSelectIndex = m_xContentsListBox->get_selected_index();
529 
530  bool bIsSeparator
531  = nSelectIndex != -1
532  && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
533  bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && nSelectIndex != -1);
534 
535  std::unique_ptr<weld::Builder> xBuilder(
536  Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
537  auto xContextMenu = xBuilder->weld_menu("menu");
538  xContextMenu->set_visible("add", false);
539  xContextMenu->set_visible("remove", bIsValidSelection);
540  xContextMenu->set_visible("rename", bIsValidSelection && !bIsSeparator);
541  xContextMenu->set_visible("changeIcon", false);
542  xContextMenu->set_visible("resetIcon", false);
543  xContextMenu->set_visible("restoreDefault", false);
544  OString sCommand(xContextMenu->popup_at_rect(
545  &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
546 
547  if (sCommand == "remove")
548  {
549  RemoveCommandHdl(*m_xRemoveCommandButton);
550  }
551  else if (sCommand == "rename")
552  {
553  ModifyItemHdl("renameItem");
554  }
555  else if (!sCommand.isEmpty())
556  SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
557  return true;
558 }
559 
560 IMPL_LINK(SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt, bool)
561 {
562  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
563  return false;
564 
565  weld::TreeView& rTreeView = m_xFunctions->get_widget();
566 
567  // Select clicked entry
568  std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
569  if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
570  return false;
571  rTreeView.select(*xIter);
572  SelectFunctionHdl(rTreeView);
573 
574  std::unique_ptr<weld::Builder> xBuilder(
575  Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
576  auto xContextMenu = xBuilder->weld_menu("menu");
577  xContextMenu->set_visible("add", true);
578  xContextMenu->set_visible("remove", false);
579  xContextMenu->set_visible("rename", false);
580  xContextMenu->set_visible("changeIcon", false);
581  xContextMenu->set_visible("resetIcon", false);
582  xContextMenu->set_visible("restoreDefault", false);
583  OString sCommand(xContextMenu->popup_at_rect(
584  &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
585 
586  if (sCommand == "add")
587  {
588  AddCommandHdl(*m_xAddCommandButton);
589  }
590  else if (!sCommand.isEmpty())
591  SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
592  return true;
593 }
594 
595 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< CuiConfigFunctionListBox > m_xFunctions
Definition: cfg.hxx:387
SvxEntries * GetEntries() const
Definition: cfg.hxx:290
std::unique_ptr< weld::Button > m_xResetBtn
Definition: cfg.hxx:414
void set_title(const OUString &rTitle)
const OUString & GetName() const
Definition: cfg.hxx:278
std::unique_ptr< weld::MenuButton > m_xModifyBtn
Definition: cfg.hxx:412
std::unique_ptr< CommandCategoryListBox > m_xCommandCategoryListBox
Definition: cfg.hxx:386
std::unique_ptr< SvxEntries > ReleaseEntries()
Definition: cfg.hxx:542
static OUString stripHotKey(const OUString &str)
void SetModified(bool bValue=true)
Definition: cfg.hxx:299
IMPL_LINK(SvxMenuConfigPage, MenuEntriesSizeAllocHdl, const Size &, rSize, void)
std::unique_ptr< SvxConfigPageFunctionDropTarget > m_xDropTargetHelper
Definition: cfg.hxx:404
SvxMenuConfigPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rItemSet, bool bIsMenuBar=true)
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: cfg.hxx:381
SaveInData * CreateSaveInData(const css::uno::Reference< css::ui::XUIConfigurationManager > &, const css::uno::Reference< css::ui::XUIConfigurationManager > &, const OUString &aModuleId, bool docConfig) override
SvxConfigEntry * GetTopLevelSelection()
Definition: cfg.hxx:497
std::unique_ptr< weld::Button > m_xRemoveCommandButton
Definition: cfg.hxx:418
bool IsPopup() const
Definition: cfg.hxx:282
virtual void clear()=0
OUString GetName() const
Definition: dlgname.hxx:39
std::unique_ptr< SvxMenuEntriesListBox > m_xContentsListBox
Definition: cfg.hxx:403
virtual void set_id(int row, const OUString &rId)=0
void ReloadTopLevelListBox(SvxConfigEntry const *pSelection=nullptr)
Definition: cfg.cxx:1336
Dialog for editing a name.
Definition: dlgname.hxx:24
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
std::vector< SvxConfigEntry * > SvxEntries
Definition: cfg.hxx:62
std::unique_ptr< weld::ComboBox > m_xTopLevelListBox
Definition: cfg.hxx:400
bool IsRenamable() const
Definition: cfg.cxx:1933
void connect_changed(const Link< TreeView &, void > &rLink)
RET_YES
virtual void show()=0
int nCount
static void RemoveEntry(SvxEntries *pEntries, SvxConfigEntry const *pChildEntry)
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
static OUString replaceSaveInName(const OUString &rMessage, std::u16string_view rSaveInName)
void SetName(const OUString &rStr)
Definition: cfg.hxx:279
virtual OUString get_id(int pos) const =0
virtual void set_vexpand(bool bExpand)=0
void Init() override
void DeleteSelectedTopLevel() override
virtual void ListModified() override
OUString CuiResId(TranslateId aKey)
Definition: cuiresmgr.cxx:23
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter *pResult, bool bDnDMode)=0
SvxEntries * FindParentForChild(SvxEntries *pParentEntries, SvxConfigEntry *pChildData)
Definition: cfg.cxx:1387
IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView &, void)
int i
void SetUserDefined(bool bOn=true)
Definition: cfg.hxx:284
SvxConfigEntry * CreateCommandFromSelection(const OUString &aURL)
Definition: cfg.cxx:1411
virtual void set_hexpand(bool bExpand)=0
OUString GetScriptURL() const
Definition: cfg.cxx:1289
void set_help_id(const OString &rHelpId)
bool IsMovable() const
Definition: cfg.cxx:1923
void ResetContextMenu(const SvxConfigEntry *pEntry)
Definition: cfg.cxx:900
short QueryReset() override
std::unique_ptr< weld::MenuButton > m_xInsertBtn
Definition: cfg.hxx:411
int get_checkbox_column_width() const
constexpr OStringLiteral HID_SVX_CONFIG_RENAME_MENU
Definition: helpids.h:39
OUString toId(const void *pValue)
virtual void select(int pos)=0
weld::Window * GetFrameWeld() const
void InsertEntryIntoUI(SvxConfigEntry *pNewEntryData, weld::TreeView &rTreeView, int nPos, bool bMenu=false)
Definition: cfg.cxx:1584
static bool IsCommandInMenuList(const SvxConfigEntry *pEntryData, const SvxEntries *pEntries)
Definition: cfg.cxx:1439
virtual void SelectElement() override
virtual void connect_size_allocate(const Link< const Size &, void > &rLink)
void SetModified(bool bValue=true)
Definition: cfg.hxx:126
void UpdateButtonStates() override
RET_OK
bool IsDeletable() const
Definition: cfg.cxx:1928
virtual short run()
Reference< XComponentContext > getProcessComponentContext()
constexpr OStringLiteral HID_SVX_CONFIG_NAME_SUBMENU
Definition: helpids.h:38
std::unique_ptr< weld::ComboBox > m_xSaveInListBox
Definition: cfg.hxx:409
SvxConfigEntry * GetSelectedEntry()
Definition: cfg.cxx:1884
std::unique_ptr< weld::Button > m_xMoveDownButton
Definition: cfg.hxx:407
#define SAL_WARN(area, stream)
constexpr OStringLiteral HID_SVX_CONFIG_RENAME_MENU_ITEM
Definition: helpids.h:41
std::unique_ptr< weld::Button > m_xMoveUpButton
Definition: cfg.hxx:406
def label(st)
OUString m_aModuleId
Definition: cfg.hxx:382
std::unique_ptr< weld::MenuButton > m_xGearBtn
Definition: cfg.hxx:402
virtual void set_size_request(int nWidth, int nHeight)=0
virtual ~SvxMenuConfigPage() override
virtual void connect_popup_menu(const Link< const CommandEvent &, bool > &rLink)
virtual void bulk_insert_for_each(int nSourceCount, const std::function< void(TreeIter &, int nSourceIndex)> &func, const weld::TreeIter *pParent=nullptr, const std::vector< int > *pFixedWidths=nullptr)=0
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
SaveInData * GetSaveInData()
Definition: cfg.hxx:478
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
void DeleteSelectedContent() override
sal_uInt16 nPos
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
std::unique_ptr< weld::Button > m_xAddCommandButton
Definition: cfg.hxx:417
OUString sId