LibreOffice Module cui (master)  1
cfgutil.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 <cfgutil.hxx>
21 
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <com/sun/star/container/XEnumerationAccess.hpp>
24 #include <com/sun/star/container/XEnumeration.hpp>
25 #include <com/sun/star/document/XScriptInvocationContext.hpp>
26 #include <com/sun/star/frame/ModuleManager.hpp>
27 #include <com/sun/star/frame/Desktop.hpp>
28 #include <com/sun/star/frame/theUICommandDescription.hpp>
29 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
30 #include <com/sun/star/script/browse/XBrowseNode.hpp>
31 #include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
32 #include <com/sun/star/script/browse/theBrowseNodeFactory.hpp>
33 #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
34 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
35 #include <com/sun/star/uno/RuntimeException.hpp>
36 #include <com/sun/star/ui/theUICategoryDescription.hpp>
37 
38 #include <basic/basmgr.hxx>
39 #include <tools/urlobj.hxx>
40 #include <strings.hrc>
41 #include <bitmaps.hlst>
42 #include <sfx2/minfitem.hxx>
47 #include <svtools/imagemgr.hxx>
48 #include <sal/log.hxx>
49 #include <osl/diagnose.h>
50 #include <dialmgr.hxx>
51 #include <tools/diagnose_ex.h>
53 #include <vcl/help.hxx>
54 #include <vcl/svapp.hxx>
55 
56 using namespace ::com::sun::star;
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::script;
59 using namespace ::com::sun::star::frame;
60 using namespace ::com::sun::star::document;
61 
63 {}
64 
65 void SfxStylesInfo_Impl::init(const OUString& rModuleName, const css::uno::Reference< css::frame::XModel >& xModel)
66 {
67  m_aModuleName = rModuleName;
68  m_xDoc = xModel;
69 }
70 
71 static const char CMDURL_STYLEPROT_ONLY[] = ".uno:StyleApply?";
72 static const char CMDURL_SPART_ONLY [] = "Style:string=";
73 static const char CMDURL_FPART_ONLY [] = "FamilyName:string=";
74 
75 static const char STYLEPROP_UINAME[] = "DisplayName";
76 
77 OUString SfxStylesInfo_Impl::generateCommand(const OUString& sFamily, const OUString& sStyle)
78 {
79  return ".uno:StyleApply?Style:string="
80  + sStyle
81  + "&FamilyName:string="
82  + sFamily;
83 }
84 
86 {
87  static const sal_Int32 LEN_STYLEPROT = strlen(CMDURL_STYLEPROT_ONLY);
88  static const sal_Int32 LEN_SPART = strlen(CMDURL_SPART_ONLY);
89  static const sal_Int32 LEN_FPART = strlen(CMDURL_FPART_ONLY);
90 
91  if (!aStyle.sCommand.startsWith(CMDURL_STYLEPROT_ONLY))
92  return false;
93 
94  aStyle.sFamily.clear();
95  aStyle.sStyle.clear();
96 
97  sal_Int32 nCmdLen = aStyle.sCommand.getLength();
98  OUString sCmdArgs = aStyle.sCommand.copy(LEN_STYLEPROT, nCmdLen-LEN_STYLEPROT);
99  sal_Int32 i = sCmdArgs.indexOf('&');
100  if (i<0)
101  return false;
102 
103  OUString sArg = sCmdArgs.copy(0, i);
104  if (sArg.startsWith(CMDURL_SPART_ONLY))
105  aStyle.sStyle = sArg.copy(LEN_SPART);
106  else if (sArg.startsWith(CMDURL_FPART_ONLY))
107  aStyle.sFamily = sArg.copy(LEN_FPART);
108 
109  sArg = sCmdArgs.copy(i+1, sCmdArgs.getLength()-i-1);
110  if (sArg.startsWith(CMDURL_SPART_ONLY))
111  aStyle.sStyle = sArg.copy(LEN_SPART);
112  else if (sArg.startsWith(CMDURL_FPART_ONLY))
113  aStyle.sFamily = sArg.copy(LEN_FPART);
114 
115  return !(aStyle.sFamily.isEmpty() || aStyle.sStyle.isEmpty());
116 }
117 
119 {
120  try
121  {
122  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY);
123 
124  css::uno::Reference< css::container::XNameAccess > xFamilies;
125  if (xModel.is())
126  xFamilies = xModel->getStyleFamilies();
127 
128  css::uno::Reference< css::container::XNameAccess > xStyleSet;
129  if (xFamilies.is())
130  xFamilies->getByName(aStyle.sFamily) >>= xStyleSet;
131 
132  css::uno::Reference< css::beans::XPropertySet > xStyle;
133  if (xStyleSet.is())
134  xStyleSet->getByName(aStyle.sStyle) >>= xStyle;
135 
136  aStyle.sLabel.clear();
137  if (xStyle.is())
138  xStyle->getPropertyValue(STYLEPROP_UINAME) >>= aStyle.sLabel;
139  }
140  catch(const css::uno::RuntimeException&)
141  { throw; }
142  catch(const css::uno::Exception&)
143  { aStyle.sLabel.clear(); }
144 
145  if (aStyle.sLabel.isEmpty())
146  {
147  aStyle.sLabel = aStyle.sCommand;
148  }
149 }
150 
151 std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyleFamilies() const
152 {
153  // It's an optional interface!
154  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY);
155  if (!xModel.is())
156  return std::vector< SfxStyleInfo_Impl >();
157 
158  css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies();
159  const css::uno::Sequence< OUString > lFamilyNames = xCont->getElementNames();
160  std::vector< SfxStyleInfo_Impl > lFamilies;
161  for (const auto& aFamily : lFamilyNames)
162  {
163  if ((aFamily == "CellStyles" && m_aModuleName != "com.sun.star.sheet.SpreadsheetDocument") ||
164  aFamily == "cell" || aFamily == "table" || aFamily == "Default")
165  continue;
166 
167  SfxStyleInfo_Impl aFamilyInfo;
168  aFamilyInfo.sFamily = aFamily;
169 
170  try
171  {
172  css::uno::Reference< css::beans::XPropertySet > xFamilyInfo;
173  xCont->getByName(aFamilyInfo.sFamily) >>= xFamilyInfo;
174  if (!xFamilyInfo.is())
175  {
176  // TODO_AS currently there is no support for an UIName property .. use internal family name instead
177  aFamilyInfo.sLabel = aFamilyInfo.sFamily;
178  }
179  else
180  xFamilyInfo->getPropertyValue(STYLEPROP_UINAME) >>= aFamilyInfo.sLabel;
181  }
182  catch(const css::uno::RuntimeException&)
183  { throw; }
184  catch(const css::uno::Exception&)
185  { return std::vector< SfxStyleInfo_Impl >(); }
186 
187  lFamilies.push_back(aFamilyInfo);
188  }
189 
190  return lFamilies;
191 }
192 
193 std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const OUString& sFamily)
194 {
195  css::uno::Sequence< OUString > lStyleNames;
196  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY_THROW);
197  css::uno::Reference< css::container::XNameAccess > xFamilies = xModel->getStyleFamilies();
198  css::uno::Reference< css::container::XNameAccess > xStyleSet;
199  try
200  {
201  xFamilies->getByName(sFamily) >>= xStyleSet;
202  lStyleNames = xStyleSet->getElementNames();
203  }
204  catch(const css::uno::RuntimeException&)
205  { throw; }
206  catch(const css::uno::Exception&)
207  { return std::vector< SfxStyleInfo_Impl >(); }
208 
209  std::vector< SfxStyleInfo_Impl > lStyles;
210  sal_Int32 c = lStyleNames.getLength();
211  sal_Int32 i = 0;
212  for (i=0; i<c; ++i)
213  {
214  SfxStyleInfo_Impl aStyleInfo;
215  aStyleInfo.sFamily = sFamily;
216  aStyleInfo.sStyle = lStyleNames[i];
217  aStyleInfo.sCommand = SfxStylesInfo_Impl::generateCommand(aStyleInfo.sFamily, aStyleInfo.sStyle);
218 
219  try
220  {
221  css::uno::Reference< css::beans::XPropertySet > xStyle;
222  xStyleSet->getByName(aStyleInfo.sStyle) >>= xStyle;
223  if (!xStyle.is())
224  continue;
225  xStyle->getPropertyValue("DisplayName") >>= aStyleInfo.sLabel;
226  }
227  catch(const css::uno::RuntimeException&)
228  { throw; }
229  catch(const css::uno::Exception&)
230  { continue; }
231 
232  lStyles.push_back(aStyleInfo);
233  }
234  return lStyles;
235 }
236 
237 OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
238 {
239  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
240  if (pData)
241  {
242  if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
243  {
244  if (bConsiderParent)
245  return Application::GetHelp()->GetHelpText(pData->sCommand, m_xTreeView.get());
246  else
247  return Application::GetHelp()->GetHelpText(pData->sCommand, static_cast<weld::Widget*>(nullptr));
248  }
249  else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
250  {
251  return pData->sHelpText;
252  }
253  }
254  return OUString();
255 }
256 
258 {
259  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
260  if (!pData)
261  return OUString();
262  return pData->sCommand;
263 }
264 
266 {
267  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
268  if (!pData)
269  return OUString();
270  if (!pData->sLabel.isEmpty())
271  return pData->sLabel;
272  return pData->sCommand;
273 }
274 
275 CuiConfigFunctionListBox::CuiConfigFunctionListBox(std::unique_ptr<weld::TreeView> xTreeView)
276  : m_xTreeView(std::move(xTreeView))
277  , m_xScratchIter(m_xTreeView->make_iterator())
278 {
279  m_xTreeView->make_sorted();
280  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
281  m_xTreeView->connect_query_tooltip(LINK(this, CuiConfigFunctionListBox, QueryTooltip));
282 }
283 
285 {
286  ClearAll();
287 }
288 
289 IMPL_LINK(CuiConfigFunctionListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
290 {
291  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
292  if (!pData)
293  return OUString();
294  OUString aLabel = CuiResId(RID_SVXSTR_COMMANDLABEL) + ": ";
295  OUString aName = CuiResId(RID_SVXSTR_COMMANDNAME) + ": ";
296  OUString aTip = CuiResId(RID_SVXSTR_COMMANDTIP) + ": ";
297  return aLabel + pData->sLabel + "\n" + aName + pData->sCommand+ "\n" + aTip + pData->sTooltip;
298 }
299 
301 /* Description
302  Deletes all entries in the FunctionListBox, all UserData and all
303  possibly existing MacroInfo.
304 */
305 {
306  sal_uInt16 nCount = aArr.size();
307  for ( sal_uInt16 i=0; i<nCount; ++i )
308  {
309  SfxGroupInfo_Impl *pData = aArr[i].get();
310 
311  if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
312  {
313  OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
314  delete pScriptURI;
315  }
316 
318  {
319  XInterface* xi = static_cast<XInterface *>(pData->pObject);
320  if (xi != nullptr)
321  {
322  xi->release();
323  }
324  }
325  }
326 
327  aArr.clear();
328  m_xTreeView->clear();
329 }
330 
332 {
333  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
334  if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
335  return *static_cast<OUString*>(pData->pObject);
336  return OUString();
337 }
338 
340 {
341  OUString m_sMyMacros;
342  OUString m_sProdMacros;
343  OUString m_sMacros;
344  OUString m_sDlgMacros;
346 
348 };
349 
351  m_sMyMacros(CuiResId(RID_SVXSTR_MYMACROS)),
352  m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
353  m_sMacros(CuiResId(RID_SVXSTR_BASICMACROS)),
354  m_sDlgMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
355  m_aStrGroupStyles(CuiResId(RID_SVXSTR_GROUP_STYLES))
356 {
357 }
358 
360 {
361  m_pStylesInfo = pStyles;
362 }
363 
364 namespace
365 {
366 
373  Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent )
374  {
375  Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY );
376  if ( !xScripts.is() )
377  {
378  Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
379  if ( xContext.is() )
380  xScripts = xContext->getScriptContainer();
381  }
382 
383  return Reference< XModel >( xScripts, UNO_QUERY );
384  }
385 
386 
387  Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame )
388  {
389  Reference< XModel > xDocument;
390 
391  // examine our associated frame
392  try
393  {
394  OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" );
395  if ( _rxFrame.is() )
396  {
397  // first try the model in the frame
398  Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW );
399  xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() );
400 
401  if ( !xDocument.is() )
402  {
403  // if there is no suitable document in the frame, try the controller
404  xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() );
405  }
406  }
407  }
408  catch( const Exception& )
409  {
410  }
411 
412  return xDocument;
413  }
414 }
415 
416 CuiConfigGroupListBox::CuiConfigGroupListBox(std::unique_ptr<weld::TreeView> xTreeView)
417  : xImp(new SvxConfigGroupBoxResource_Impl())
418  , m_pFunctionListBox(nullptr)
419  , m_pStylesInfo(nullptr)
420  , m_xTreeView(std::move(xTreeView))
421 {
422  m_xTreeView->connect_expanding(LINK(this, CuiConfigGroupListBox, ExpandingHdl));
423  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
424 }
425 
427 {
428  ClearAll();
429 }
430 
432 {
433  sal_uInt16 nCount = aArr.size();
434  for ( sal_uInt16 i=0; i<nCount; ++i )
435  {
436  SfxGroupInfo_Impl *pData = aArr[i].get();
438  {
439  XInterface* xi = static_cast<XInterface *>(pData->pObject);
440  if (xi != nullptr)
441  {
442  xi->release();
443  }
444  }
445  }
446 
447  aArr.clear();
448  m_xTreeView->clear();
449 }
450 
452 {
453  try
454  {
455  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW);
456  css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
457  sal_Int32 c1 = lGroups.getLength();
458  sal_Int32 i1 = 0;
459 
460  if ( c1 )
461  {
462  // Add All Commands category
463  aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
464  m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
465  CuiResId(RID_SVXSTR_ALLFUNCTIONS));
466  }
467 
468  for (i1=0; i1<c1; ++i1)
469  {
470  sal_Int16& rGroupID = lGroups[i1];
471  OUString sGroupID = OUString::number(rGroupID);
472  OUString sGroupName ;
473 
474  try
475  {
476  m_xModuleCategoryInfo->getByName(sGroupID) >>= sGroupName;
477  if (sGroupName.isEmpty())
478  continue;
479  }
480  catch(const css::container::NoSuchElementException&)
481  { continue; }
482 
483  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, rGroupID ) );
484  m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
485  sGroupName);
486  }
487  }
488  catch(const css::uno::RuntimeException&)
489  { throw; }
490  catch(const css::uno::Exception&)
491  {}
492 }
493 
494 void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
495  const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand)
496 {
497  try {
498  if ( xRootNode->hasChildNodes() )
499  {
500  // tdf#120362: Don't ask to enable disabled Java when filling script list
501  css::uno::ContextLayer layer(comphelper::NoEnableJavaInteractionContext());
502 
503  Sequence< Reference< browse::XBrowseNode > > children =
504  xRootNode->getChildNodes();
505  bool bIsRootNode = false;
506 
507  OUString user("user");
508  OUString share("share");
509  if ( xRootNode->getName() == "Root" )
510  {
511  bIsRootNode = true;
512  }
513 
514  //To mimic current starbasic behaviour we
515  //need to make sure that only the current document
516  //is displayed in the config tree. Tests below
517  //set the bDisplay flag to FALSE if the current
518  //node is a first level child of the Root and is NOT
519  //either the current document, user or share
520  OUString currentDocTitle;
521  Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
522  if ( xDocument.is() )
523  {
524  currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
525  }
526 
527  for ( sal_Int32 n = 0; n < children.getLength(); ++n )
528  {
529  Reference< browse::XBrowseNode >& theChild = children[n];
530  bool bDisplay = true;
531  OUString uiName = theChild->getName();
532  if ( bIsRootNode )
533  {
534  if ( ! (uiName == user || uiName == share ||
535  uiName == currentDocTitle ) )
536  {
537  bDisplay=false;
538  }
539  else
540  {
541  if ( uiName == user )
542  {
543  uiName = xImp->m_sMyMacros;
544  }
545  else if ( uiName == share )
546  {
547  uiName = xImp->m_sProdMacros;
548  }
549  }
550  }
551  if (theChild->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
552  {
553 // We call acquire on the XBrowseNode so that it does not
554 // get autodestructed and become invalid when accessed later.
555  theChild->acquire();
556 
557  bool bChildOnDemand = false;
558  if ( !bCheapChildrenOnDemand && theChild->hasChildNodes() )
559  {
560  Sequence< Reference< browse::XBrowseNode > > grandchildren =
561  theChild->getChildNodes();
562 
563  for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
564  {
565  if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
566  {
567  bChildOnDemand = true;
568  m = grandchildren.getLength();
569  }
570  }
571  }
572  else
573  {
574  /* i30923 - Would be nice if there was a better
575  * way to determine if a basic lib had children
576  * without having to ask for them (which forces
577  * the library to be loaded */
578  bChildOnDemand = true;
579  }
580 
581  OUString aImage = GetImage(theChild, m_xContext, bIsRootNode);
582 
583  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
584  0, static_cast<void *>( theChild.get())));
585 
586  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
587  m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, &aImage, bChildOnDemand, nullptr);
588  }
589  }
590  }
591  }
592  catch (RuntimeException&) {
593  // do nothing, the entry will not be displayed in the UI
594  }
595 }
596 
597 void CuiConfigGroupListBox::FillFunctionsList(const css::uno::Sequence<DispatchInformation>& xCommands)
598 {
600  for (const auto & rInfo : xCommands)
601  {
603 
604  OUString sUIName = MapCommand2UIName(rInfo.Command);
605  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
606  SfxGroupInfo_Impl* pGrpInfo = aArr.back().get();
607  pGrpInfo->sCommand = rInfo.Command;
608  pGrpInfo->sLabel = sUIName;
610  m_pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(pGrpInfo)), sUIName);
611  }
613 }
614 
615 void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
616  const css::uno::Reference< css::frame::XFrame >& xFrame,
617  const OUString& sModuleLongName,
618  bool bEventMode)
619 {
620  m_xTreeView->freeze();
621  ClearAll(); // Remove all old entries from treelist box
622 
623  m_xContext = xContext;
624  m_xFrame = xFrame;
625  if( bEventMode )
626  {
627  m_sModuleLongName = sModuleLongName;
628  m_xGlobalCategoryInfo = css::ui::theUICategoryDescription::get( m_xContext );
629  m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
630  m_xUICmdDescription = css::frame::theUICommandDescription::get( m_xContext );
631 
632  InitModule();
633  }
634 
635  SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
636  // Add Scripting Framework entries
637  Reference< browse::XBrowseNode > rootNode;
638  try
639  {
640  Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get( m_xContext );
641  rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
642  }
643  catch( const Exception& )
644  {
645  TOOLS_WARN_EXCEPTION("cui.customize", "Caught some exception whilst retrieving browse nodes from factory");
646  // TODO exception handling
647  }
648 
649 
650  if ( rootNode.is() )
651  {
652  if ( bEventMode )
653  {
654  //We call acquire on the XBrowseNode so that it does not
655  //get autodestructed and become invalid when accessed later.
656  rootNode->acquire();
657 
658  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
659  static_cast<void *>(rootNode.get())));
660  OUString aTitle(xImp->m_sDlgMacros);
661  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
662  m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, nullptr, true, nullptr);
663  }
664  else
665  {
666  //We are only showing scripts not slot APIs so skip
667  //Root node and show location nodes
668  FillScriptList(rootNode, nullptr, false);
669  }
670  }
671 
672  // add styles
673  if ( bEventMode )
674  {
675  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
676  OUString sStyle(xImp->m_aStrGroupStyles);
677  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
678  m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, nullptr, true, nullptr);
679  }
680 
681  m_xTreeView->thaw();
682  m_xTreeView->scroll_to_row(0);
683  m_xTreeView->select(0);
684 }
685 
687  const Reference< browse::XBrowseNode >& node,
688  Reference< XComponentContext > const & xCtx,
689  bool bIsRootNode)
690 {
691  OUString aImage;
692  if ( bIsRootNode )
693  {
694  if (node->getName() == "user" || node->getName() == "share" )
695  {
696  aImage = RID_CUIBMP_HARDDISK;
697  }
698  else
699  {
700  OUString factoryURL;
701  OUString nodeName = node->getName();
702  Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
703  if ( xDocumentModel.is() )
704  {
705  Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) );
706  // get the long name of the document:
707  OUString appModule( xModuleManager->identify(
708  xDocumentModel ) );
709  Sequence<beans::PropertyValue> moduleDescr;
710  Any aAny = xModuleManager->getByName(appModule);
711  if( !( aAny >>= moduleDescr ) )
712  {
713  throw RuntimeException("SFTreeListBox::Init: failed to get PropertyValue");
714  }
715  beans::PropertyValue const * pmoduleDescr =
716  moduleDescr.getConstArray();
717  for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
718  {
719  if ( pmoduleDescr[ pos ].Name == "ooSetupFactoryEmptyDocumentURL" )
720  {
721  pmoduleDescr[ pos ].Value >>= factoryURL;
722  SAL_INFO("cui.customize", "factory url for doc images is " << factoryURL);
723  break;
724  }
725  }
726  }
727  if( !factoryURL.isEmpty() )
728  {
730  }
731  else
732  {
733  aImage = RID_CUIBMP_DOC;
734  }
735  }
736  }
737  else
738  {
739  if( node->getType() == browse::BrowseNodeTypes::SCRIPT )
740  aImage = RID_CUIBMP_MACRO;
741  else
742  aImage = RID_CUIBMP_LIB;
743  }
744  return aImage;
745 }
746 
749 {
751  Reference< frame::XDesktop2 > desktop = frame::Desktop::create( xCtx );
752 
753  Reference< container::XEnumerationAccess > componentsAccess =
754  desktop->getComponents();
755  Reference< container::XEnumeration > components =
756  componentsAccess->createEnumeration();
757  while (components->hasMoreElements())
758  {
760  components->nextElement(), UNO_QUERY );
761  if ( model.is() )
762  {
763  OUString sTdocUrl =
764  ::comphelper::DocumentInfo::getDocumentTitle( model );
765  if( sTdocUrl == docName )
766  {
767  xModel = model;
768  break;
769  }
770  }
771  }
772  return xModel;
773 }
774 
775 OUString CuiConfigGroupListBox::MapCommand2UIName(const OUString& sCommand)
776 {
777  OUString sUIName;
778  try
779  {
780  css::uno::Reference< css::container::XNameAccess > xModuleConf;
781  m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
782  if (xModuleConf.is())
783  {
784  ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand));
785  sUIName = lProps.getUnpackedValueOrDefault("Name", OUString());
786  }
787  }
788  catch(const css::uno::RuntimeException&)
789  { throw; }
790  catch(css::uno::Exception&)
791  { sUIName.clear(); }
792 
793  // fallback for missing UINames !?
794  if (sUIName.isEmpty())
795  {
796  sUIName = sCommand;
797  }
798 
799  return sUIName;
800 }
801 
803 /* Description
804  A function group or a basic module has been selected.
805  All functions/macros are displayed in the functionlistbox.
806 */
807 {
808  std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
809  if (!m_xTreeView->get_selected(xIter.get()))
810  return;
811 
812  SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
815 
816  switch ( pInfo->nKind )
817  {
819  {
820  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider( m_xFrame, UNO_QUERY );
821  bool bValidIter = m_xTreeView->get_iter_first(*xIter);
822  while (bValidIter)
823  {
824  SfxGroupInfo_Impl *pCurrentInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
825  if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
826  {
827  css::uno::Sequence< css::frame::DispatchInformation > lCommands;
828  try
829  {
830  lCommands = xProvider->getConfigurableDispatchInformation( pCurrentInfo->nUniqueID );
831  FillFunctionsList( lCommands );
832  }
833  catch ( container::NoSuchElementException& )
834  {
835  }
836  }
837  bValidIter = m_xTreeView->iter_next(*xIter);
838  }
839  break;
840  }
841 
843  {
844  sal_uInt16 nGroup = pInfo->nUniqueID;
845  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
846  css::uno::Sequence< css::frame::DispatchInformation > lCommands = xProvider->getConfigurableDispatchInformation(nGroup);
847  FillFunctionsList( lCommands );
848  break;
849  }
850 
852  {
853  if (!m_xTreeView->iter_has_child(*xIter))
854  {
855  Reference< browse::XBrowseNode > rootNode(
856  static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
857 
858  try {
859  if ( rootNode->hasChildNodes() )
860  {
861  Sequence< Reference< browse::XBrowseNode > > children =
862  rootNode->getChildNodes();
863 
864  for ( sal_Int32 n = 0; n < children.getLength(); ++n )
865  {
866  if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT)
867  {
868  OUString uri, description;
869 
870  Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY );
871  if (!xPropSet.is())
872  {
873  continue;
874  }
875 
876  Any value =
877  xPropSet->getPropertyValue("URI");
878  value >>= uri;
879 
880  try
881  {
882  value = xPropSet->getPropertyValue("Description");
883  value >>= description;
884  }
885  catch (Exception &) {
886  // do nothing, the description will be empty
887  }
888 
889  OUString* pScriptURI = new OUString( uri );
890 
891  OUString aImage = GetImage(children[n], Reference< XComponentContext >(), false);
892  m_pFunctionListBox->aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
893  m_pFunctionListBox->aArr.back()->sCommand = uri;
894  m_pFunctionListBox->aArr.back()->sLabel = children[n]->getName();
895  m_pFunctionListBox->aArr.back()->sHelpText = description;
896 
897  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
898  m_pFunctionListBox->append(sId, children[n]->getName(), aImage);
899  }
900  }
901  }
902  }
903  catch (RuntimeException&) {
904  // do nothing, the entry will not be displayed in the UI
905  }
906  }
907  break;
908  }
909 
911  {
912  SfxStyleInfo_Impl* pFamily = static_cast<SfxStyleInfo_Impl*>(pInfo->pObject);
913  if (pFamily)
914  {
915  const std::vector< SfxStyleInfo_Impl > lStyles = m_pStylesInfo->getStyles(pFamily->sFamily);
916  for (auto const& lStyle : lStyles)
917  {
918  SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(lStyle);
919  m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, pStyle));
920  m_pFunctionListBox->aArr.back()->sCommand = pStyle->sCommand;
921  m_pFunctionListBox->aArr.back()->sLabel = pStyle->sLabel;
922  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
923  m_pFunctionListBox->append(sId, pStyle->sLabel);
924  }
925  }
926  break;
927  }
928 
929  default:
930  // Do nothing, the list box will stay empty
931  SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind) );
932  break;
933  }
934 
936 
939 }
940 
941 /* Description
942  A basic or a library is opened.
943 */
944 IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, bool)
945 {
946  SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
947  switch ( pInfo->nKind )
948  {
950  {
951  if (!m_xTreeView->iter_has_child(rIter))
952  {
953  Reference< browse::XBrowseNode > rootNode(
954  static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
955  FillScriptList(rootNode, &rIter, true /* i30923 */ );
956  }
957  break;
958  }
959 
961  {
962  if (!m_xTreeView->iter_has_child(rIter))
963  {
964  const std::vector<SfxStyleInfo_Impl> lStyleFamilies = m_pStylesInfo->getStyleFamilies();
965  for (auto const& lStyleFamily : lStyleFamilies)
966  {
967  SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(lStyleFamily);
968  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily ));
969  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
970  m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, nullptr, false, nullptr);
971  }
972  }
973  break;
974  }
975 
976  default:
977  OSL_FAIL( "Wrong group type!" );
978  break;
979  }
980  return true;
981 }
982 
984 {
985  SelectMacro( pItem->GetBasicManager()->GetName(),
986  pItem->GetQualifiedName() );
987 }
988 
989 void CuiConfigGroupListBox::SelectMacro( const OUString& rBasic,
990  const OUString& rMacro )
991 {
992  const OUString aBasicName(rBasic + " " + xImp->m_sMacros);
993  sal_Int32 nIdx {rMacro.lastIndexOf('.')};
994  const OUString aMethod( rMacro.copy(nIdx+1) );
995  OUString aLib;
996  OUString aModule;
997  if ( nIdx>0 )
998  {
999  // string contains at least 2 tokens
1000  nIdx = rMacro.lastIndexOf('.', nIdx);
1001  if (nIdx>=0)
1002  {
1003  // string contains at least 3 tokens
1004  aLib = rMacro.getToken( 0, '.' );
1005  aModule = rMacro.getToken( 0, '.', ++nIdx );
1006  }
1007  }
1008 
1009  std::unique_ptr<weld::TreeIter> xIter = m_xTreeView->make_iterator();
1010  if (!m_xTreeView->get_iter_first(*xIter))
1011  return;
1012 
1013  do
1014  {
1015  OUString aEntryBas = m_xTreeView->get_text(*xIter);
1016  if (aEntryBas == aBasicName)
1017  {
1018  m_xTreeView->expand_row(*xIter);
1019  std::unique_ptr<weld::TreeIter> xLibIter = m_xTreeView->make_iterator(xIter.get());
1020  if (m_xTreeView->get_iter_first(*xLibIter))
1021  {
1022  do
1023  {
1024  OUString aEntryLib = m_xTreeView->get_text(*xLibIter);
1025  if (aEntryLib == aLib)
1026  {
1027  m_xTreeView->expand_row(*xLibIter);
1028  std::unique_ptr<weld::TreeIter> xModIter = m_xTreeView->make_iterator(xLibIter.get());
1029  if (m_xTreeView->get_iter_first(*xModIter))
1030  {
1031  do
1032  {
1033  OUString aEntryMod = m_xTreeView->get_text(*xModIter);
1034  if ( aEntryMod == aModule )
1035  {
1036  m_xTreeView->expand_row(*xModIter);
1037  m_xTreeView->scroll_to_row(*xModIter);
1038  m_xTreeView->select(*xModIter);
1039  for (int i = 0, nCount = m_pFunctionListBox->n_children(); i < nCount; ++i)
1040  {
1041  OUString aEntryMethod = m_pFunctionListBox->get_text(i);
1042  if (aEntryMethod == aMethod)
1043  {
1046  return;
1047  }
1048  }
1049  }
1050  } while (m_xTreeView->iter_next_sibling(*xModIter));
1051  }
1052  }
1053  } while (m_xTreeView->iter_next_sibling(*xLibIter));
1054  }
1055  }
1056  } while (m_xTreeView->iter_next_sibling(*xIter));
1057 }
1058 
1059 /*
1060  * Implementation of SvxScriptSelectorDialog
1061  *
1062  * This dialog is used for selecting Slot API commands
1063  * and Scripting Framework Scripts.
1064  */
1065 
1067  weld::Window* pParent, bool bShowSlots, const css::uno::Reference< css::frame::XFrame >& xFrame)
1068  : GenericDialogController(pParent, "cui/ui/macroselectordialog.ui", "MacroSelectorDialog")
1069  , m_bShowSlots(bShowSlots)
1070  , m_xDialogDescription(m_xBuilder->weld_label(bShowSlots ? "helptoolbar" : "helpmacro"))
1071  , m_xCategories(new CuiConfigGroupListBox(m_xBuilder->weld_tree_view("categories")))
1072  , m_xCommands(new CuiConfigFunctionListBox(m_xBuilder->weld_tree_view("commands")))
1073  , m_xLibraryFT(m_xBuilder->weld_label("libraryft"))
1074  , m_xCategoryFT(m_xBuilder->weld_label("categoryft"))
1075  , m_xMacronameFT(m_xBuilder->weld_label("macronameft"))
1076  , m_xCommandsFT(m_xBuilder->weld_label("commandsft"))
1077  , m_xOKButton(m_xBuilder->weld_button(bShowSlots ? "add" : "ok"))
1078  , m_xCancelButton(m_xBuilder->weld_button(bShowSlots ? "close" : "cancel"))
1079  , m_xDescriptionText(m_xBuilder->weld_text_view("description"))
1080 {
1081  if (m_bShowSlots)
1082  {
1083  // If we are showing Slot API commands update labels in the UI
1084  m_xDialog->set_title(CuiResId(RID_SVXSTR_SELECTOR_ADD_COMMANDS));
1085  }
1086  m_xCancelButton->show();
1087  m_xDialogDescription->show();
1088  m_xOKButton->show();
1089 
1090  m_xLibraryFT->set_visible(!m_bShowSlots);
1091  m_xCategoryFT->set_visible(m_bShowSlots);
1092  m_xMacronameFT->set_visible(!m_bShowSlots);
1093  m_xCommandsFT->set_visible(m_bShowSlots);
1094 
1095  const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
1096  m_xCategories->SetFunctionListBox(m_xCommands.get());
1097  m_xCategories->Init(comphelper::getProcessComponentContext(), xFrame, aModuleName, bShowSlots);
1098 
1099  m_xCategories->connect_changed(
1100  LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
1101  m_xCommands->connect_changed( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
1102  m_xCommands->connect_row_activated( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
1103 
1104  m_xOKButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
1105  m_xCancelButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
1106 
1107  m_sDefaultDesc = m_xDescriptionText->get_text();
1108 
1109  // Support style commands
1110  uno::Reference<frame::XController> xController;
1111  uno::Reference<frame::XModel> xModel;
1112  if (xFrame.is())
1113  xController = xFrame->getController();
1114  if (xController.is())
1115  xModel = xController->getModel();
1116 
1117  m_aStylesInfo.init(aModuleName, xModel);
1118  m_xCategories->SetStylesInfo(&m_aStylesInfo);
1119 
1120  UpdateUI();
1121 }
1122 
1124 {
1125 }
1126 
1128 {
1129  if (&rCtrl == &m_xCategories->get_widget())
1130  {
1131  m_xCategories->GroupSelected();
1132  }
1133  UpdateUI();
1134 }
1135 
1137 {
1138  if (m_xOKButton->get_sensitive())
1139  ClickHdl(*m_xOKButton);
1140  return true;
1141 }
1142 
1143 // Check if command is selected and enable the OK button accordingly
1144 // Grab the help text for this id if available and update the description field
1145 void
1147 {
1148  OUString url = GetScriptURL();
1149  if ( !url.isEmpty() )
1150  {
1151  OUString sMessage = m_xCommands->GetHelpText();
1152  m_xDescriptionText->set_text(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
1153 
1154  m_xOKButton->set_sensitive(true);
1155  }
1156  else
1157  {
1159  m_xOKButton->set_sensitive(false);
1160  }
1161 }
1162 
1164 {
1165  if (&rButton == m_xCancelButton.get())
1166  {
1167  m_xDialog->response(RET_CANCEL);
1168  }
1169  else if (&rButton == m_xOKButton.get())
1170  {
1171  // If we are displaying Slot API commands then this the dialog is being
1172  // run from Tools/Configure and we should not close it
1173  if ( !m_bShowSlots )
1174  {
1175  m_xDialog->response(RET_OK);
1176  }
1177  else
1178  {
1179  // Select the next entry in the list if possible
1180  std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
1181  if (m_xCommands->get_selected(xIter.get()) && m_xCommands->iter_next_sibling(*xIter))
1182  m_xCommands->select(*xIter);
1183  }
1184  }
1185 }
1186 
1187 void
1189 {
1190  m_xOKButton->set_label(CuiResId(RID_SVXSTR_SELECTOR_RUN));
1191 }
1192 
1193 OUString
1195 {
1196  OUString result;
1197 
1198  std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
1199  if (m_xCommands->get_selected(xIter.get()))
1200  {
1201  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter).toInt64());
1202  if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
1203  || ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
1204  || ( pData->nKind == SfxCfgKind::GROUP_STYLES )
1205  )
1206  {
1207  result = pData->sCommand;
1208  }
1209  }
1210 
1211  return result;
1212 }
1213 
1214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< weld::Dialog > m_xDialog
std::unique_ptr< SvxConfigGroupBoxResource_Impl > xImp
Definition: cfgutil.hxx:186
css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo
Definition: cfgutil.hxx:192
OUString sMessage
std::vector< SfxStyleInfo_Impl > getStyleFamilies() const
Definition: cfgutil.cxx:151
OUString sStyle
Definition: cfgutil.hxx:41
OUString GetHelpText(bool bConsiderParent=true)
Definition: cfgutil.cxx:237
OUString sTooltip
Definition: cfgutil.hxx:95
std::unique_ptr< CuiConfigFunctionListBox > m_xCommands
Definition: cfgutil.hxx:244
bool getType(BSTR name, Type &type)
std::unique_ptr< ContentProperties > pData
void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode > &xRootNode, const weld::TreeIter *pParentEntry, bool bCheapChildrenOnDemand)
Definition: cfgutil.cxx:494
static Help * GetHelp()
OUString GetScriptURL() const
Definition: cfgutil.cxx:1194
css::uno::Reference< css::frame::XModel > m_xDoc
Definition: cfgutil.hxx:61
static const char CMDURL_FPART_ONLY[]
Definition: cfgutil.cxx:73
SfxStylesInfo_Impl * m_pStylesInfo
Definition: cfgutil.hxx:195
css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription
Definition: cfgutil.hxx:194
sal_Int64 n
void getLabel4Style(SfxStyleInfo_Impl &aStyle)
Definition: cfgutil.cxx:118
OUString Name
RET_CANCEL
css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo
Definition: cfgutil.hxx:193
OUString MapCommand2UIName(const OUString &sCommand)
Definition: cfgutil.cxx:775
Reference< XController > xController
PropertiesInfo aProperties
std::unique_ptr< weld::Button > m_xOKButton
static const char CMDURL_STYLEPROT_ONLY[]
Definition: cfgutil.cxx:71
size_t pos
int nCount
std::unique_ptr< CuiConfigGroupListBox > m_xCategories
Definition: cfgutil.hxx:243
css::uno::Reference< css::uno::XCurrentContext > NoEnableJavaInteractionContext()
int n_children() const
Definition: cfgutil.hxx:141
SfxGroupInfoArr_Impl aArr
Definition: cfgutil.hxx:188
OUString sFamily
Definition: cfgutil.hxx:40
OUString GetCurLabel() const
Definition: cfgutil.cxx:265
void Init(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XFrame > &xFrame, const OUString &sModuleLongName, bool bEventMode)
Definition: cfgutil.cxx:615
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: cfgutil.hxx:196
OUString sLabel
Definition: cfgutil.hxx:43
SfxStylesInfo_Impl m_aStylesInfo
Definition: cfgutil.hxx:239
OUString get_text(const weld::TreeIter &rIter) const
Definition: cfgutil.hxx:148
tuple model
void select(const weld::TreeIter &rIter)
Definition: cfgutil.hxx:166
virtual OUString GetHelpText(const OUString &aHelpURL, const vcl::Window *pWindow)
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
#define TOOLS_WARN_EXCEPTION(area, stream)
std::unique_ptr< weld::Label > m_xLibraryFT
Definition: cfgutil.hxx:245
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString sHelpText
Definition: cfgutil.hxx:94
std::vector< SfxStyleInfo_Impl > getStyles(const OUString &sFamily)
Definition: cfgutil.cxx:193
virtual ~SvxScriptSelectorDialog() override
Definition: cfgutil.cxx:1123
SfxCfgKind nKind
Definition: cfgutil.hxx:89
int i
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: cfgutil.hxx:190
OUString GetCurCommand() const
Definition: cfgutil.cxx:257
void scroll_to_row(int pos)
Definition: cfgutil.hxx:138
OUString GetSelectedScriptURI() const
Definition: cfgutil.cxx:331
OUString get_selected_id() const
Definition: cfgutil.hxx:159
sal_uInt16 nUniqueID
Definition: cfgutil.hxx:90
void SetStylesInfo(SfxStylesInfo_Impl *pStyles)
Definition: cfgutil.cxx:359
OUString m_sModuleLongName
Definition: cfgutil.hxx:189
OUString sCommand
Definition: cfgutil.hxx:42
void init(const OUString &rModuleName, const css::uno::Reference< css::frame::XModel > &xModel)
Definition: cfgutil.cxx:65
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
const BasicManager * GetBasicManager() const
SvxScriptSelectorDialog(weld::Window *pParent, bool bShowSlots, const css::uno::Reference< css::frame::XFrame > &xFrame)
Definition: cfgutil.cxx:1066
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
std::unique_ptr< weld::Label > m_xMacronameFT
Definition: cfgutil.hxx:247
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation > &xCommands)
Definition: cfgutil.cxx:597
SfxGroupInfoArr_Impl aArr
Definition: cfgutil.hxx:106
CuiConfigFunctionListBox(std::unique_ptr< weld::TreeView > xTreeView)
Definition: cfgutil.cxx:275
OUString GetQualifiedName() const
OUString sCommand
Definition: cfgutil.hxx:92
static css::uno::Reference< css::uno::XInterface > getDocumentModel(css::uno::Reference< css::uno::XComponentContext > const &xCtx, OUString const &docName)
Definition: cfgutil.cxx:748
std::unique_ptr< weld::Label > m_xCommandsFT
Definition: cfgutil.hxx:248
#define SAL_INFO(area, stream)
OUString aName
const OUString & GetName() const
RET_OK
IMPL_LINK_NOARG(SvxScriptSelectorDialog, FunctionDoubleClickHdl, weld::TreeView &, bool)
Definition: cfgutil.cxx:1136
Reference< XExecutableDialog > m_xDialog
OUString aLabel
static OUString GetImage(const css::uno::Reference< css::script::browse::XBrowseNode > &node, css::uno::Reference< css::uno::XComponentContext > const &xCtx, bool bIsRootNode)
Definition: cfgutil.cxx:686
Reference< XComponentContext > getProcessComponentContext()
std::unique_ptr< weld::Label > m_xDialogDescription
Definition: cfgutil.hxx:242
CuiConfigFunctionListBox * m_pFunctionListBox
Definition: cfgutil.hxx:187
Any value
const SvxPageUsage aArr[]
Definition: page.cxx:72
static bool parseStyleCommand(SfxStyleInfo_Impl &aStyle)
Definition: cfgutil.cxx:85
OUString sLabel
Definition: cfgutil.hxx:93
static OUString generateCommand(const OUString &sFamily, const OUString &sStyle)
Definition: cfgutil.cxx:77
OUString sId
OUString m_aModuleName
Definition: cfgutil.hxx:60
std::unique_ptr< weld::Button > m_xOKButton
Definition: cfgutil.hxx:249
void SelectMacro(const SfxMacroInfoItem *)
Definition: cfgutil.cxx:983
Any result
Reference< XModel > xModel
std::unique_ptr< weld::Label > m_xCategoryFT
Definition: cfgutil.hxx:246
static const char STYLEPROP_UINAME[]
Definition: cfgutil.cxx:75
static const char CMDURL_SPART_ONLY[]
Definition: cfgutil.cxx:72
std::unique_ptr< weld::Button > m_xCancelButton
Definition: cfgutil.hxx:250
CuiConfigGroupListBox(std::unique_ptr< weld::TreeView > xTreeView)
Definition: cfgutil.cxx:416
static SVT_DLLPUBLIC OUString GetFileImageId(const INetURLObject &rURL)
IMPL_LINK(CuiConfigFunctionListBox, QueryTooltip, const weld::TreeIter &, rIter, OUString)
Definition: cfgutil.cxx:289
OUString GetTooltipForCommand(const OUString &rsCommandName, const css::uno::Sequence< css::beans::PropertyValue > &rProperties, const Reference< frame::XFrame > &rxFrame)
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: cfgutil.hxx:191
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: cfgutil.hxx:108
std::unique_ptr< weld::TextView > m_xDescriptionText
Definition: cfgutil.hxx:251
void append(const OUString &rId, const OUString &rStr, const weld::TreeIter *pParent=nullptr)
Definition: cfgutil.hxx:118