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