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(
104  reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
105 
109 }
110 
111 IMPL_LINK(SvxMenuConfigPage, MenuEntriesSizeAllocHdl, const Size&, rSize, void)
112 {
113  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
114  std::vector<int> aWidths;
115 
116  int nStandardImageColWidth = rTreeView.get_checkbox_column_width();
117  int nMargin = 16;
118 
119  aWidths.push_back(rSize.Width() - (nMargin + nStandardImageColWidth));
120  rTreeView.set_column_fixed_widths(aWidths);
121 }
122 
124 {
125  for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
126  delete reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
127  m_xSaveInListBox->clear();
128 }
129 
130 // Populates the Menu combo box
132 {
133  // ensure that the UI is cleared before populating it
134  m_xTopLevelListBox->clear();
135  m_xContentsListBox->clear();
136 
138 
139  m_xTopLevelListBox->set_active(0);
140  SelectElement();
141 
143  m_aModuleId);
144  m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), OUString(), GetSaveInData());
145  SelectFunctionHdl(m_xFunctions->get_widget());
146 }
147 
148 IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView&, void) { UpdateButtonStates(); }
149 
151 {
152  // Disable Up and Down buttons depending on current selection
153  int selection = m_xContentsListBox->get_selected_index();
154 
155  bool bIsSeparator
156  = selection != -1
157  && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())
158  ->IsSeparator();
159  bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && selection != -1);
160 
161  m_xMoveUpButton->set_sensitive(bIsValidSelection && selection != 0);
162  m_xMoveDownButton->set_sensitive(bIsValidSelection
163  && selection != m_xContentsListBox->n_children() - 1);
164 
165  m_xRemoveCommandButton->set_sensitive(bIsValidSelection);
166 
167  m_xModifyBtn->set_sensitive(bIsValidSelection && !bIsSeparator);
168 
169  // If there is no top level selection (menu), then everything working on the right box
170  // which contains the functions of the selected menu/toolbar needs to be disabled
171  SvxConfigEntry* pMenuData = GetTopLevelSelection();
172 
173  m_xInsertBtn->set_sensitive(pMenuData != nullptr);
174 
176 
177  m_xAddCommandButton->set_sensitive(
178  pMenuData != nullptr && !IsCommandInMenuList(selectedCmd, pMenuData->GetEntries()));
179 
180  delete selectedCmd;
181 
182  if (bIsValidSelection)
183  {
184  m_xRemoveCommandButton->set_sensitive(pMenuData != nullptr);
185  }
186 
187  //Handle the gear button
188  if (pMenuData && m_bIsMenuBar)
189  {
190  // Add option (gear_add) will always be enabled
191  m_xGearBtn->set_item_sensitive("menu_gear_delete", pMenuData->IsDeletable());
192  m_xGearBtn->set_item_sensitive("menu_gear_rename", pMenuData->IsRenamable());
193  m_xGearBtn->set_item_sensitive("menu_gear_move", pMenuData->IsMovable());
194  }
195 }
196 
198 {
199  SvxConfigEntry* pMenuData = GetTopLevelSelection();
200 
201  SvxEntries* pParentEntries = FindParentForChild(GetSaveInData()->GetEntries(), pMenuData);
202 
203  SvxConfigPageHelper::RemoveEntry(pParentEntries, pMenuData);
204  delete pMenuData;
205 
207 
209 }
210 
212 {
213  int nActEntry = m_xContentsListBox->get_selected_index();
214 
215  if (nActEntry == -1)
216  return;
217 
218  // get currently selected menu entry
219  SvxConfigEntry* pMenuEntry
220  = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
221 
222  // get currently selected menu
224 
225  // remove menu entry from the list for this menu
226  SvxConfigPageHelper::RemoveEntry(pMenu->GetEntries(), pMenuEntry);
227 
228  // remove menu entry from UI
229  m_xContentsListBox->remove(nActEntry);
230 
231  // if this is a submenu entry, redraw the menus list box
232  if (pMenuEntry->IsPopup())
233  {
235  }
236 
237  // delete data for menu entry
238  delete pMenuEntry;
239 
241  pMenu->SetModified();
242 }
243 
245 {
246  OUString msg = CuiResId(RID_SVXSTR_CONFIRM_MENU_RESET);
247 
248  OUString saveInName = m_xSaveInListBox->get_active_text();
249 
250  OUString label = SvxConfigPageHelper::replaceSaveInName(msg, saveInName);
251 
252  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
253  GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, label));
254  return xQueryBox->run();
255 }
256 
258 {
259  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
260 
261  SvxConfigEntry* pMenuData = GetTopLevelSelection();
262  if (!pMenuData)
263  rTreeView.clear();
264  else
265  {
266  SvxEntries* pEntries = pMenuData->GetEntries();
267 
268  rTreeView.bulk_insert_for_each(
269  pEntries->size(), [this, &rTreeView, pEntries](weld::TreeIter& rIter, int nIdx) {
270  auto const& entry = (*pEntries)[nIdx];
271  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
272  rTreeView.set_id(rIter, sId);
273  InsertEntryIntoUI(entry, rTreeView, rIter, true);
274  });
275  }
276 
278 }
279 
280 IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
281 {
282  if (rIdent == "menu_gear_add")
283  {
284  SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(), nullptr,
285  true);
286 
287  if (aDialog.run() == RET_OK)
288  {
289  GetSaveInData()->SetEntries(aDialog.ReleaseEntries());
290  ReloadTopLevelListBox(aDialog.GetSelectedEntry());
291  GetSaveInData()->SetModified();
292  }
293  }
294  else if (rIdent == "menu_gear_delete")
295  {
296  DeleteSelectedTopLevel();
297  }
298  else if (rIdent == "menu_gear_rename")
299  {
300  SvxConfigEntry* pMenuData = GetTopLevelSelection();
301 
302  OUString sCurrentName(SvxConfigPageHelper::stripHotKey(pMenuData->GetName()));
303  OUString sDesc = CuiResId(RID_SVXSTR_LABEL_NEW_NAME);
304 
305  SvxNameDialog aNameDialog(GetFrameWeld(), sCurrentName, sDesc);
307  aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU));
308 
309  if (aNameDialog.run() == RET_OK)
310  {
311  OUString sNewName = aNameDialog.GetName();
312 
313  if (sCurrentName == sNewName)
314  return;
315 
316  pMenuData->SetName(sNewName);
317 
318  ReloadTopLevelListBox();
319 
320  GetSaveInData()->SetModified();
321  }
322  }
323  else if (rIdent == "menu_gear_move")
324  {
325  SvxConfigEntry* pMenuData = GetTopLevelSelection();
326 
327  SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(), pMenuData,
328  false);
329  if (aDialog.run() == RET_OK)
330  {
331  GetSaveInData()->SetEntries(aDialog.ReleaseEntries());
332 
333  ReloadTopLevelListBox();
334 
335  GetSaveInData()->SetModified();
336  }
337  }
338  else
339  {
340  //This block should never be reached
341  SAL_WARN("cui.customize", "Unknown gear menu option: " << rIdent);
342  return;
343  }
344 
345  UpdateButtonStates();
346 }
347 
349 {
350  OUString aSearchTerm(m_xSearchEdit->get_text());
351 
352  m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), aSearchTerm, GetSaveInData());
353 
354  SelectFunctionHdl(m_xFunctions->get_widget());
355 }
356 
358 {
359  int nPos = AddFunction(-1, /*bAllowDuplicates*/ false);
360  if (nPos == -1)
361  return;
362  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
363  SvxConfigEntry* pEntry = reinterpret_cast<SvxConfigEntry*>(rTreeView.get_id(nPos).toInt64());
364  InsertEntryIntoUI(pEntry, rTreeView, nPos, true);
365 }
366 
368 {
369  DeleteSelectedContent();
370  if (GetSaveInData()->IsModified())
371  {
372  UpdateButtonStates();
373  }
374 }
375 
376 IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
377 {
378  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
379  if (rIdent == "insertseparator")
380  {
381  SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
382  pNewEntryData->SetUserDefined();
383  int nPos = AppendEntry(pNewEntryData, -1);
384  InsertEntryIntoUI(pNewEntryData, rTreeView, nPos, true);
385  }
386  else if (rIdent == "insertsubmenu")
387  {
388  OUString aNewName;
389  OUString aDesc = CuiResId(RID_SVXSTR_SUBMENU_NAME);
390 
391  SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
393  aNameDialog.set_title(CuiResId(RID_SVXSTR_ADD_SUBMENU));
394 
395  if (aNameDialog.run() == RET_OK)
396  {
397  aNewName = aNameDialog.GetName();
398 
399  SvxConfigEntry* pNewEntryData
400  = new SvxConfigEntry(aNewName, aNewName, true, /*bParentData*/ false);
401  pNewEntryData->SetName(aNewName);
402  pNewEntryData->SetUserDefined();
403 
404  int nPos = AppendEntry(pNewEntryData, -1);
405  InsertEntryIntoUI(pNewEntryData, rTreeView, nPos, true);
406 
407  ReloadTopLevelListBox();
408 
409  m_xContentsListBox->scroll_to_row(nPos);
410  m_xContentsListBox->select(nPos);
411 
412  GetSaveInData()->SetModified();
413  }
414  }
415  else
416  {
417  //This block should never be reached
418  SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
419  return;
420  }
421 
422  if (GetSaveInData()->IsModified())
423  {
424  UpdateButtonStates();
425  }
426 }
427 
428 IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OString&, rIdent, void)
429 {
430  if (rIdent == "renameItem")
431  {
432  int nActEntry = m_xContentsListBox->get_selected_index();
433  SvxConfigEntry* pEntry
434  = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
435 
436  OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
437  OUString aDesc = CuiResId(RID_SVXSTR_LABEL_NEW_NAME);
438 
439  SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
441  aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU));
442 
443  if (aNameDialog.run() == RET_OK)
444  {
445  aNewName = aNameDialog.GetName();
446 
447  pEntry->SetName(aNewName);
448  m_xContentsListBox->set_text(nActEntry, aNewName, 0);
449 
450  GetSaveInData()->SetModified();
451  GetTopLevelSelection()->SetModified();
452  }
453  }
454  else
455  {
456  //This block should never be reached
457  SAL_WARN("cui.customize", "Unknown insert option: " << rIdent);
458  return;
459  }
460 
461  if (GetSaveInData()->IsModified())
462  {
463  UpdateButtonStates();
464  }
465 }
466 
468 {
469  SvxConfigEntry* pMenuData = GetTopLevelSelection();
470 
471  if (pMenuData == nullptr)
472  {
473  SAL_WARN("cui.customize",
474  "RHB top level selection is null. A menu must be selected to reset!");
475  return;
476  }
477 
478  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
479  GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
480  CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT_MENU)));
481 
482  // Resetting individual top-level menus is not possible at the moment.
483  // So we are resetting only if it is a context menu
484  if (m_bIsMenuBar || xQueryBox->run() != RET_YES)
485  return;
486 
487  sal_Int32 nPos = m_xTopLevelListBox->get_active();
488  ContextMenuSaveInData* pSaveInData = static_cast<ContextMenuSaveInData*>(GetSaveInData());
489 
490  pSaveInData->ResetContextMenu(pMenuData);
491 
492  // ensure that the UI is cleared before populating it
493  m_xTopLevelListBox->clear();
494  m_xContentsListBox->clear();
495 
496  ReloadTopLevelListBox();
497 
498  // Reselect the reset menu
499  m_xTopLevelListBox->set_active(nPos);
500  SelectElement();
501 }
502 
504  const css::uno::Reference<css::ui::XUIConfigurationManager>& xCfgMgr,
505  const css::uno::Reference<css::ui::XUIConfigurationManager>& xParentCfgMgr,
506  const OUString& aModuleId, bool bDocConfig)
507 {
508  if (!m_bIsMenuBar)
509  return static_cast<SaveInData*>(
510  new ContextMenuSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
511 
512  return static_cast<SaveInData*>(
513  new MenuSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
514 }
515 
516 IMPL_LINK(SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool)
517 {
518  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
519  return false;
520 
521  weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
522 
523  // Select clicked entry
524  std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
525  if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
526  return false;
527  rTreeView.select(*xIter);
528  SelectMenuEntry(rTreeView);
529 
530  int nSelectIndex = m_xContentsListBox->get_selected_index();
531 
532  bool bIsSeparator
533  = nSelectIndex != -1
534  && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())
535  ->IsSeparator();
536  bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && nSelectIndex != -1);
537 
538  std::unique_ptr<weld::Builder> xBuilder(
539  Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
540  auto xContextMenu = xBuilder->weld_menu("menu");
541  xContextMenu->set_visible("add", false);
542  xContextMenu->set_visible("remove", bIsValidSelection);
543  xContextMenu->set_visible("rename", bIsValidSelection && !bIsSeparator);
544  xContextMenu->set_visible("changeIcon", false);
545  xContextMenu->set_visible("resetIcon", false);
546  xContextMenu->set_visible("restoreDefault", false);
547  OString sCommand(xContextMenu->popup_at_rect(
548  &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
549 
550  if (sCommand == "remove")
551  {
552  RemoveCommandHdl(*m_xRemoveCommandButton);
553  }
554  else if (sCommand == "rename")
555  {
556  ModifyItemHdl("renameItem");
557  }
558  else if (!sCommand.isEmpty())
559  SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
560  return true;
561 }
562 
563 IMPL_LINK(SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt, bool)
564 {
565  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
566  return false;
567 
568  weld::TreeView& rTreeView = m_xFunctions->get_widget();
569 
570  // Select clicked entry
571  std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
572  if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
573  return false;
574  rTreeView.select(*xIter);
575  SelectFunctionHdl(rTreeView);
576 
577  std::unique_ptr<weld::Builder> xBuilder(
578  Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
579  auto xContextMenu = xBuilder->weld_menu("menu");
580  xContextMenu->set_visible("add", true);
581  xContextMenu->set_visible("remove", false);
582  xContextMenu->set_visible("rename", false);
583  xContextMenu->set_visible("changeIcon", false);
584  xContextMenu->set_visible("resetIcon", false);
585  xContextMenu->set_visible("restoreDefault", false);
586  OString sCommand(xContextMenu->popup_at_rect(
587  &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
588 
589  if (sCommand == "add")
590  {
591  AddCommandHdl(*m_xAddCommandButton);
592  }
593  else if (!sCommand.isEmpty())
594  SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
595  return true;
596 }
597 
598 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< CuiConfigFunctionListBox > m_xFunctions
Definition: cfg.hxx:389
SvxEntries * GetEntries() const
Definition: cfg.hxx:290
std::unique_ptr< weld::Button > m_xResetBtn
Definition: cfg.hxx:416
void set_title(const OUString &rTitle)
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
const OUString & GetName() const
Definition: cfg.hxx:278
std::unique_ptr< weld::MenuButton > m_xModifyBtn
Definition: cfg.hxx:414
std::unique_ptr< CommandCategoryListBox > m_xCommandCategoryListBox
Definition: cfg.hxx:388
std::unique_ptr< SvxEntries > ReleaseEntries()
Definition: cfg.hxx:544
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:406
SvxMenuConfigPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rItemSet, bool bIsMenuBar=true)
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: cfg.hxx:383
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:499
std::unique_ptr< weld::Button > m_xRemoveCommandButton
Definition: cfg.hxx:420
bool IsPopup() const
Definition: cfg.hxx:282
#define HID_SVX_CONFIG_RENAME_MENU_ITEM
Definition: helpids.h:33
virtual void clear()=0
OUString GetName() const
Definition: dlgname.hxx:39
std::unique_ptr< SvxMenuEntriesListBox > m_xContentsListBox
Definition: cfg.hxx:405
virtual void set_id(int row, const OUString &rId)=0
void ReloadTopLevelListBox(SvxConfigEntry const *pSelection=nullptr)
Definition: cfg.cxx:1330
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:402
bool IsRenamable() const
Definition: cfg.cxx:1929
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:1381
IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView &, void)
int i
#define HID_SVX_CONFIG_NAME_SUBMENU
Definition: helpids.h:31
void SetUserDefined(bool bOn=true)
Definition: cfg.hxx:284
SvxConfigEntry * CreateCommandFromSelection(const OUString &aURL)
Definition: cfg.cxx:1405
virtual void set_hexpand(bool bExpand)=0
OUString GetScriptURL() const
Definition: cfg.cxx:1283
void set_help_id(const OString &rHelpId)
bool IsMovable() const
Definition: cfg.cxx:1919
void ResetContextMenu(const SvxConfigEntry *pEntry)
Definition: cfg.cxx:893
short QueryReset() override
std::unique_ptr< weld::MenuButton > m_xInsertBtn
Definition: cfg.hxx:413
int get_checkbox_column_width() const
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:1578
static bool IsCommandInMenuList(const SvxConfigEntry *pEntryData, const SvxEntries *pEntries)
Definition: cfg.cxx:1433
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:1924
virtual short run()
Reference< XComponentContext > getProcessComponentContext()
#define HID_SVX_CONFIG_RENAME_MENU
Definition: helpids.h:32
std::unique_ptr< weld::ComboBox > m_xSaveInListBox
Definition: cfg.hxx:411
SvxConfigEntry * GetSelectedEntry()
Definition: cfg.cxx:1880
std::unique_ptr< weld::Button > m_xMoveDownButton
Definition: cfg.hxx:409
#define SAL_WARN(area, stream)
std::unique_ptr< weld::Button > m_xMoveUpButton
Definition: cfg.hxx:408
def label(st)
OUString m_aModuleId
Definition: cfg.hxx:384
std::unique_ptr< weld::MenuButton > m_xGearBtn
Definition: cfg.hxx:404
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:480
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
void DeleteSelectedContent() override
sal_uInt16 nPos
std::unique_ptr< weld::Button > m_xAddCommandButton
Definition: cfg.hxx:419
OUString sId