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 }
282 
284 {
285  ClearAll();
286 }
287 
289 /* Description
290  Deletes all entries in the FunctionListBox, all UserData and all
291  possibly existing MacroInfo.
292 */
293 {
294  sal_uInt16 nCount = aArr.size();
295  for ( sal_uInt16 i=0; i<nCount; ++i )
296  {
297  SfxGroupInfo_Impl *pData = aArr[i].get();
298 
299  if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
300  {
301  OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
302  delete pScriptURI;
303  }
304 
306  {
307  XInterface* xi = static_cast<XInterface *>(pData->pObject);
308  if (xi != nullptr)
309  {
310  xi->release();
311  }
312  }
313  }
314 
315  aArr.clear();
316  m_xTreeView->clear();
317 }
318 
320 {
321  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
322  if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
323  return *static_cast<OUString*>(pData->pObject);
324  return OUString();
325 }
326 
328 {
329  OUString m_sMyMacros;
330  OUString m_sProdMacros;
331  OUString m_sMacros;
332  OUString m_sDlgMacros;
334 
336 };
337 
339  m_sMyMacros(CuiResId(RID_SVXSTR_MYMACROS)),
340  m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
341  m_sMacros(CuiResId(RID_SVXSTR_BASICMACROS)),
342  m_sDlgMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
343  m_aStrGroupStyles(CuiResId(RID_SVXSTR_GROUP_STYLES))
344 {
345 }
346 
348 {
349  m_pStylesInfo = pStyles;
350 }
351 
352 namespace
353 {
354 
361  Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent )
362  {
363  Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY );
364  if ( !xScripts.is() )
365  {
366  Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
367  if ( xContext.is() )
368  xScripts = xContext->getScriptContainer();
369  }
370 
371  return Reference< XModel >( xScripts, UNO_QUERY );
372  }
373 
374 
375  Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame )
376  {
377  Reference< XModel > xDocument;
378 
379  // examine our associated frame
380  try
381  {
382  OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" );
383  if ( _rxFrame.is() )
384  {
385  // first try the model in the frame
386  Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW );
387  xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() );
388 
389  if ( !xDocument.is() )
390  {
391  // if there is no suitable document in the frame, try the controller
392  xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() );
393  }
394  }
395  }
396  catch( const Exception& )
397  {
398  }
399 
400  return xDocument;
401  }
402 }
403 
404 CuiConfigGroupListBox::CuiConfigGroupListBox(std::unique_ptr<weld::TreeView> xTreeView)
405  : xImp(new SvxConfigGroupBoxResource_Impl())
406  , m_pFunctionListBox(nullptr)
407  , m_pStylesInfo(nullptr)
408  , m_xTreeView(std::move(xTreeView))
409 {
410  m_xTreeView->connect_expanding(LINK(this, CuiConfigGroupListBox, ExpandingHdl));
411  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
412 }
413 
415 {
416  ClearAll();
417 }
418 
420 {
421  sal_uInt16 nCount = aArr.size();
422  for ( sal_uInt16 i=0; i<nCount; ++i )
423  {
424  SfxGroupInfo_Impl *pData = aArr[i].get();
426  {
427  XInterface* xi = static_cast<XInterface *>(pData->pObject);
428  if (xi != nullptr)
429  {
430  xi->release();
431  }
432  }
433  }
434 
435  aArr.clear();
436  m_xTreeView->clear();
437 }
438 
440 {
441  try
442  {
443  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW);
444  css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
445  sal_Int32 c1 = lGroups.getLength();
446  sal_Int32 i1 = 0;
447 
448  if ( c1 )
449  {
450  // Add All Commands category
451  aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
452  m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
453  CuiResId(RID_SVXSTR_ALLFUNCTIONS));
454  }
455 
456  for (i1=0; i1<c1; ++i1)
457  {
458  sal_Int16& rGroupID = lGroups[i1];
459  OUString sGroupID = OUString::number(rGroupID);
460  OUString sGroupName ;
461 
462  try
463  {
464  m_xModuleCategoryInfo->getByName(sGroupID) >>= sGroupName;
465  if (sGroupName.isEmpty())
466  continue;
467  }
468  catch(const css::container::NoSuchElementException&)
469  { continue; }
470 
471  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, rGroupID ) );
472  m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
473  sGroupName);
474  }
475  }
476  catch(const css::uno::RuntimeException&)
477  { throw; }
478  catch(const css::uno::Exception&)
479  {}
480 }
481 
482 void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
483  const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand)
484 {
485  try {
486  if ( xRootNode->hasChildNodes() )
487  {
488  // tdf#120362: Don't ask to enable disabled Java when filling script list
489  css::uno::ContextLayer layer(comphelper::NoEnableJavaInteractionContext());
490 
491  Sequence< Reference< browse::XBrowseNode > > children =
492  xRootNode->getChildNodes();
493  bool bIsRootNode = false;
494 
495  OUString user("user");
496  OUString share("share");
497  if ( xRootNode->getName() == "Root" )
498  {
499  bIsRootNode = true;
500  }
501 
502  //To mimic current starbasic behaviour we
503  //need to make sure that only the current document
504  //is displayed in the config tree. Tests below
505  //set the bDisplay flag to FALSE if the current
506  //node is a first level child of the Root and is NOT
507  //either the current document, user or share
508  OUString currentDocTitle;
509  Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
510  if ( xDocument.is() )
511  {
512  currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
513  }
514 
515  for ( sal_Int32 n = 0; n < children.getLength(); ++n )
516  {
517  Reference< browse::XBrowseNode >& theChild = children[n];
518  bool bDisplay = true;
519  OUString uiName = theChild->getName();
520  if ( bIsRootNode )
521  {
522  if ( ! (theChild->getName() == user || theChild->getName() == share ||
523  theChild->getName() == currentDocTitle ) )
524  {
525  bDisplay=false;
526  }
527  else
528  {
529  if ( uiName == user )
530  {
531  uiName = xImp->m_sMyMacros;
532  }
533  else if ( uiName == share )
534  {
535  uiName = xImp->m_sProdMacros;
536  }
537  }
538  }
539  if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
540  {
541 // We call acquire on the XBrowseNode so that it does not
542 // get autodestructed and become invalid when accessed later.
543  theChild->acquire();
544 
545  bool bChildOnDemand = false;
546  if ( !bCheapChildrenOnDemand && children[n]->hasChildNodes() )
547  {
548  Sequence< Reference< browse::XBrowseNode > > grandchildren =
549  children[n]->getChildNodes();
550 
551  for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
552  {
553  if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
554  {
555  bChildOnDemand = true;
556  m = grandchildren.getLength();
557  }
558  }
559  }
560  else
561  {
562  /* i30923 - Would be nice if there was a better
563  * way to determine if a basic lib had children
564  * without having to ask for them (which forces
565  * the library to be loaded */
566  bChildOnDemand = true;
567  }
568 
569  OUString aImage = GetImage(theChild, m_xContext, bIsRootNode);
570 
571  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
572  0, static_cast<void *>( theChild.get())));
573 
574  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
575  m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, &aImage, bChildOnDemand, nullptr);
576  }
577  }
578  }
579  }
580  catch (RuntimeException&) {
581  // do nothing, the entry will not be displayed in the UI
582  }
583 }
584 
585 void CuiConfigGroupListBox::FillFunctionsList(const css::uno::Sequence<DispatchInformation>& xCommands)
586 {
588  for (const auto & rInfo : xCommands)
589  {
590  OUString sUIName = MapCommand2UIName(rInfo.Command);
591  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
592  SfxGroupInfo_Impl* pGrpInfo = aArr.back().get();
593  pGrpInfo->sCommand = rInfo.Command;
594  pGrpInfo->sLabel = sUIName;
595  m_pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(pGrpInfo)), sUIName);
596  }
598 }
599 
600 void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
601  const css::uno::Reference< css::frame::XFrame >& xFrame,
602  const OUString& sModuleLongName,
603  bool bEventMode)
604 {
605  m_xTreeView->freeze();
606  ClearAll(); // Remove all old entries from treelist box
607 
608  m_xContext = xContext;
609  m_xFrame = xFrame;
610  if( bEventMode )
611  {
612  m_sModuleLongName = sModuleLongName;
613  m_xGlobalCategoryInfo = css::ui::theUICategoryDescription::get( m_xContext );
614  m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
615  m_xUICmdDescription = css::frame::theUICommandDescription::get( m_xContext );
616 
617  InitModule();
618  }
619 
620  SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
621  // Add Scripting Framework entries
622  Reference< browse::XBrowseNode > rootNode;
623  try
624  {
625  Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get( m_xContext );
626  rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
627  }
628  catch( const Exception& )
629  {
630  TOOLS_WARN_EXCEPTION("cui.customize", "Caught some exception whilst retrieving browse nodes from factory");
631  // TODO exception handling
632  }
633 
634 
635  if ( rootNode.is() )
636  {
637  if ( bEventMode )
638  {
639  //We call acquire on the XBrowseNode so that it does not
640  //get autodestructed and become invalid when accessed later.
641  rootNode->acquire();
642 
643  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
644  static_cast<void *>(rootNode.get())));
645  OUString aTitle(xImp->m_sDlgMacros);
646  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
647  m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, nullptr, true, nullptr);
648  }
649  else
650  {
651  //We are only showing scripts not slot APIs so skip
652  //Root node and show location nodes
653  FillScriptList(rootNode, nullptr, false);
654  }
655  }
656 
657  // add styles
658  if ( bEventMode )
659  {
660  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
661  OUString sStyle(xImp->m_aStrGroupStyles);
662  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
663  m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, nullptr, true, nullptr);
664  }
665 
666  m_xTreeView->thaw();
667  m_xTreeView->scroll_to_row(0);
668  m_xTreeView->select(0);
669 }
670 
672  const Reference< browse::XBrowseNode >& node,
673  Reference< XComponentContext > const & xCtx,
674  bool bIsRootNode)
675 {
676  OUString aImage;
677  if ( bIsRootNode )
678  {
679  if (node->getName() == "user" || node->getName() == "share" )
680  {
681  aImage = RID_CUIBMP_HARDDISK;
682  }
683  else
684  {
685  OUString factoryURL;
686  OUString nodeName = node->getName();
687  Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
688  if ( xDocumentModel.is() )
689  {
690  Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) );
691  // get the long name of the document:
692  OUString appModule( xModuleManager->identify(
693  xDocumentModel ) );
694  Sequence<beans::PropertyValue> moduleDescr;
695  Any aAny = xModuleManager->getByName(appModule);
696  if( !( aAny >>= moduleDescr ) )
697  {
698  throw RuntimeException("SFTreeListBox::Init: failed to get PropertyValue");
699  }
700  beans::PropertyValue const * pmoduleDescr =
701  moduleDescr.getConstArray();
702  for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
703  {
704  if ( pmoduleDescr[ pos ].Name == "ooSetupFactoryEmptyDocumentURL" )
705  {
706  pmoduleDescr[ pos ].Value >>= factoryURL;
707  SAL_INFO("cui.customize", "factory url for doc images is " << factoryURL);
708  break;
709  }
710  }
711  }
712  if( !factoryURL.isEmpty() )
713  {
715  }
716  else
717  {
718  aImage = RID_CUIBMP_DOC;
719  }
720  }
721  }
722  else
723  {
724  if( node->getType() == browse::BrowseNodeTypes::SCRIPT )
725  aImage = RID_CUIBMP_MACRO;
726  else
727  aImage = RID_CUIBMP_LIB;
728  }
729  return aImage;
730 }
731 
734 {
736  Reference< frame::XDesktop2 > desktop = frame::Desktop::create( xCtx );
737 
738  Reference< container::XEnumerationAccess > componentsAccess =
739  desktop->getComponents();
741  componentsAccess->createEnumeration();
742  while (components->hasMoreElements())
743  {
745  components->nextElement(), UNO_QUERY );
746  if ( model.is() )
747  {
748  OUString sTdocUrl =
749  ::comphelper::DocumentInfo::getDocumentTitle( model );
750  if( sTdocUrl == docName )
751  {
752  xModel = model;
753  break;
754  }
755  }
756  }
757  return xModel;
758 }
759 
760 OUString CuiConfigGroupListBox::MapCommand2UIName(const OUString& sCommand)
761 {
762  OUString sUIName;
763  try
764  {
765  css::uno::Reference< css::container::XNameAccess > xModuleConf;
766  m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
767  if (xModuleConf.is())
768  {
769  ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand));
770  sUIName = lProps.getUnpackedValueOrDefault("Name", OUString());
771  }
772  }
773  catch(const css::uno::RuntimeException&)
774  { throw; }
775  catch(css::uno::Exception&)
776  { sUIName.clear(); }
777 
778  // fallback for missing UINames !?
779  if (sUIName.isEmpty())
780  {
781  sUIName = sCommand;
782  }
783 
784  return sUIName;
785 }
786 
788 /* Description
789  A function group or a basic module has been selected.
790  All functions/macros are displayed in the functionlistbox.
791 */
792 {
793  std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
794  if (!m_xTreeView->get_selected(xIter.get()))
795  return;
796 
797  SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
800 
801  switch ( pInfo->nKind )
802  {
804  {
805  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider( m_xFrame, UNO_QUERY );
806  bool bValidIter = m_xTreeView->get_iter_first(*xIter);
807  while (bValidIter)
808  {
809  SfxGroupInfo_Impl *pCurrentInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
810  if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
811  {
812  css::uno::Sequence< css::frame::DispatchInformation > lCommands;
813  try
814  {
815  lCommands = xProvider->getConfigurableDispatchInformation( pCurrentInfo->nUniqueID );
816  FillFunctionsList( lCommands );
817  }
818  catch ( container::NoSuchElementException& )
819  {
820  }
821  }
822  bValidIter = m_xTreeView->iter_next(*xIter);
823  }
824  break;
825  }
826 
828  {
829  sal_uInt16 nGroup = pInfo->nUniqueID;
830  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
831  css::uno::Sequence< css::frame::DispatchInformation > lCommands = xProvider->getConfigurableDispatchInformation(nGroup);
832  FillFunctionsList( lCommands );
833  break;
834  }
835 
837  {
838  if (!m_xTreeView->iter_has_child(*xIter))
839  {
840  Reference< browse::XBrowseNode > rootNode(
841  static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
842 
843  try {
844  if ( rootNode->hasChildNodes() )
845  {
846  Sequence< Reference< browse::XBrowseNode > > children =
847  rootNode->getChildNodes();
848 
849  for ( sal_Int32 n = 0; n < children.getLength(); ++n )
850  {
851  if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT)
852  {
853  OUString uri, description;
854 
855  Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY );
856  if (!xPropSet.is())
857  {
858  continue;
859  }
860 
861  Any value =
862  xPropSet->getPropertyValue("URI");
863  value >>= uri;
864 
865  try
866  {
867  value = xPropSet->getPropertyValue("Description");
868  value >>= description;
869  }
870  catch (Exception &) {
871  // do nothing, the description will be empty
872  }
873 
874  OUString* pScriptURI = new OUString( uri );
875 
876  OUString aImage = GetImage(children[n], Reference< XComponentContext >(), false);
877  m_pFunctionListBox->aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
878  m_pFunctionListBox->aArr.back()->sCommand = uri;
879  m_pFunctionListBox->aArr.back()->sLabel = children[n]->getName();
880  m_pFunctionListBox->aArr.back()->sHelpText = description;
881 
882  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
883  m_pFunctionListBox->append(sId, children[n]->getName(), aImage);
884  }
885  }
886  }
887  }
888  catch (RuntimeException&) {
889  // do nothing, the entry will not be displayed in the UI
890  }
891  }
892  break;
893  }
894 
896  {
897  SfxStyleInfo_Impl* pFamily = static_cast<SfxStyleInfo_Impl*>(pInfo->pObject);
898  if (pFamily)
899  {
900  const std::vector< SfxStyleInfo_Impl > lStyles = m_pStylesInfo->getStyles(pFamily->sFamily);
901  for (auto const& lStyle : lStyles)
902  {
903  SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(lStyle);
904  m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, pStyle));
905  m_pFunctionListBox->aArr.back()->sCommand = pStyle->sCommand;
906  m_pFunctionListBox->aArr.back()->sLabel = pStyle->sLabel;
907  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
908  m_pFunctionListBox->append(sId, pStyle->sLabel);
909  }
910  }
911  break;
912  }
913 
914  default:
915  // Do nothing, the list box will stay empty
916  SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind) );
917  break;
918  }
919 
921 
924 }
925 
926 /* Description
927  A basic or a library is opened.
928 */
929 IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, bool)
930 {
931  SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
932  switch ( pInfo->nKind )
933  {
935  {
936  if (!m_xTreeView->iter_has_child(rIter))
937  {
938  Reference< browse::XBrowseNode > rootNode(
939  static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
940  FillScriptList(rootNode, &rIter, true /* i30923 */ );
941  }
942  break;
943  }
944 
946  {
947  if (!m_xTreeView->iter_has_child(rIter))
948  {
949  const std::vector<SfxStyleInfo_Impl> lStyleFamilies = m_pStylesInfo->getStyleFamilies();
950  for (auto const& lStyleFamily : lStyleFamilies)
951  {
952  SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(lStyleFamily);
953  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily ));
954  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
955  m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, nullptr, false, nullptr);
956  }
957  }
958  break;
959  }
960 
961  default:
962  OSL_FAIL( "Wrong group type!" );
963  break;
964  }
965  return true;
966 }
967 
969 {
970  SelectMacro( pItem->GetBasicManager()->GetName(),
971  pItem->GetQualifiedName() );
972 }
973 
974 void CuiConfigGroupListBox::SelectMacro( const OUString& rBasic,
975  const OUString& rMacro )
976 {
977  const OUString aBasicName(rBasic + " " + xImp->m_sMacros);
978  sal_Int32 nIdx {rMacro.lastIndexOf('.')};
979  const OUString aMethod( rMacro.copy(nIdx+1) );
980  OUString aLib;
981  OUString aModule;
982  if ( nIdx>0 )
983  {
984  // string contains at least 2 tokens
985  nIdx = rMacro.lastIndexOf('.', nIdx);
986  if (nIdx>=0)
987  {
988  // string contains at least 3 tokens
989  aLib = rMacro.getToken( 0, '.' );
990  aModule = rMacro.getToken( 0, '.', ++nIdx );
991  }
992  }
993 
994  std::unique_ptr<weld::TreeIter> xIter = m_xTreeView->make_iterator();
995  if (!m_xTreeView->get_iter_first(*xIter))
996  return;
997 
998  do
999  {
1000  OUString aEntryBas = m_xTreeView->get_text(*xIter);
1001  if (aEntryBas == aBasicName)
1002  {
1003  m_xTreeView->expand_row(*xIter);
1004  std::unique_ptr<weld::TreeIter> xLibIter = m_xTreeView->make_iterator(xIter.get());
1005  if (m_xTreeView->get_iter_first(*xLibIter))
1006  {
1007  do
1008  {
1009  OUString aEntryLib = m_xTreeView->get_text(*xLibIter);
1010  if (aEntryLib == aLib)
1011  {
1012  m_xTreeView->expand_row(*xLibIter);
1013  std::unique_ptr<weld::TreeIter> xModIter = m_xTreeView->make_iterator(xLibIter.get());
1014  if (m_xTreeView->get_iter_first(*xModIter))
1015  {
1016  do
1017  {
1018  OUString aEntryMod = m_xTreeView->get_text(*xModIter);
1019  if ( aEntryMod == aModule )
1020  {
1021  m_xTreeView->expand_row(*xModIter);
1022  m_xTreeView->scroll_to_row(*xModIter);
1023  m_xTreeView->select(*xModIter);
1024  for (int i = 0, nCount = m_pFunctionListBox->n_children(); i < nCount; ++i)
1025  {
1026  OUString aEntryMethod = m_pFunctionListBox->get_text(i);
1027  if (aEntryMethod == aMethod)
1028  {
1031  return;
1032  }
1033  }
1034  }
1035  } while (m_xTreeView->iter_next_sibling(*xModIter));
1036  }
1037  }
1038  } while (m_xTreeView->iter_next_sibling(*xLibIter));
1039  }
1040  }
1041  } while (m_xTreeView->iter_next_sibling(*xIter));
1042 }
1043 
1044 /*
1045  * Implementation of SvxScriptSelectorDialog
1046  *
1047  * This dialog is used for selecting Slot API commands
1048  * and Scripting Framework Scripts.
1049  */
1050 
1052  weld::Window* pParent, bool bShowSlots, const css::uno::Reference< css::frame::XFrame >& xFrame)
1053  : GenericDialogController(pParent, "cui/ui/macroselectordialog.ui", "MacroSelectorDialog")
1054  , m_bShowSlots(bShowSlots)
1055  , m_xDialogDescription(m_xBuilder->weld_label(bShowSlots ? "helptoolbar" : "helpmacro"))
1056  , m_xCategories(new CuiConfigGroupListBox(m_xBuilder->weld_tree_view("categories")))
1057  , m_xCommands(new CuiConfigFunctionListBox(m_xBuilder->weld_tree_view("commands")))
1058  , m_xLibraryFT(m_xBuilder->weld_label("libraryft"))
1059  , m_xCategoryFT(m_xBuilder->weld_label("categoryft"))
1060  , m_xMacronameFT(m_xBuilder->weld_label("macronameft"))
1061  , m_xCommandsFT(m_xBuilder->weld_label("commandsft"))
1062  , m_xOKButton(m_xBuilder->weld_button(bShowSlots ? "add" : "ok"))
1063  , m_xCancelButton(m_xBuilder->weld_button(bShowSlots ? "close" : "cancel"))
1064  , m_xDescriptionText(m_xBuilder->weld_text_view("description"))
1065 {
1066  if (m_bShowSlots)
1067  {
1068  // If we are showing Slot API commands update labels in the UI
1069  m_xDialog->set_title(CuiResId(RID_SVXSTR_SELECTOR_ADD_COMMANDS));
1070  }
1071  m_xCancelButton->show();
1072  m_xDialogDescription->show();
1073  m_xOKButton->show();
1074 
1075  m_xLibraryFT->set_visible(!m_bShowSlots);
1076  m_xCategoryFT->set_visible(m_bShowSlots);
1077  m_xMacronameFT->set_visible(!m_bShowSlots);
1078  m_xCommandsFT->set_visible(m_bShowSlots);
1079 
1080  const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
1081  m_xCategories->SetFunctionListBox(m_xCommands.get());
1082  m_xCategories->Init(comphelper::getProcessComponentContext(), xFrame, aModuleName, bShowSlots);
1083 
1084  m_xCategories->connect_changed(
1085  LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
1086  m_xCommands->connect_changed( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
1087  m_xCommands->connect_row_activated( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
1088 
1089  m_xOKButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
1090  m_xCancelButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
1091 
1092  m_sDefaultDesc = m_xDescriptionText->get_text();
1093 
1094  // Support style commands
1095  uno::Reference<frame::XController> xController;
1096  uno::Reference<frame::XModel> xModel;
1097  if (xFrame.is())
1098  xController = xFrame->getController();
1099  if (xController.is())
1100  xModel = xController->getModel();
1101 
1102  m_aStylesInfo.init(aModuleName, xModel);
1103  m_xCategories->SetStylesInfo(&m_aStylesInfo);
1104 
1105  UpdateUI();
1106 }
1107 
1109 {
1110 }
1111 
1113 {
1114  if (&rCtrl == &m_xCategories->get_widget())
1115  {
1116  m_xCategories->GroupSelected();
1117  }
1118  UpdateUI();
1119 }
1120 
1122 {
1123  if (m_xOKButton->get_sensitive())
1124  ClickHdl(*m_xOKButton);
1125  return true;
1126 }
1127 
1128 // Check if command is selected and enable the OK button accordingly
1129 // Grab the help text for this id if available and update the description field
1130 void
1132 {
1133  OUString url = GetScriptURL();
1134  if ( !url.isEmpty() )
1135  {
1136  OUString sMessage = m_xCommands->GetHelpText();
1137  m_xDescriptionText->set_text(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
1138 
1139  m_xOKButton->set_sensitive(true);
1140  }
1141  else
1142  {
1144  m_xOKButton->set_sensitive(false);
1145  }
1146 }
1147 
1149 {
1150  if (&rButton == m_xCancelButton.get())
1151  {
1152  m_xDialog->response(RET_CANCEL);
1153  }
1154  else if (&rButton == m_xOKButton.get())
1155  {
1156  // If we are displaying Slot API commands then this the dialog is being
1157  // run from Tools/Configure and we should not close it
1158  if ( !m_bShowSlots )
1159  {
1160  m_xDialog->response(RET_OK);
1161  }
1162  else
1163  {
1164  // Select the next entry in the list if possible
1165  std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
1166  if (m_xCommands->get_selected(xIter.get()) && m_xCommands->iter_next_sibling(*xIter))
1167  m_xCommands->select(*xIter);
1168  }
1169  }
1170 }
1171 
1172 void
1174 {
1175  m_xOKButton->set_label(CuiResId(RID_SVXSTR_SELECTOR_RUN));
1176 }
1177 
1178 OUString
1180 {
1181  OUString result;
1182 
1183  std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
1184  if (m_xCommands->get_selected(xIter.get()))
1185  {
1186  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter).toInt64());
1187  if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
1188  || ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
1189  || ( pData->nKind == SfxCfgKind::GROUP_STYLES )
1190  )
1191  {
1192  result = pData->sCommand;
1193  }
1194  }
1195 
1196  return result;
1197 }
1198 
1199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< weld::Dialog > m_xDialog
std::unique_ptr< SvxConfigGroupBoxResource_Impl > xImp
Definition: cfgutil.hxx:183
css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo
Definition: cfgutil.hxx:189
OUString sMessage
std::vector< SfxStyleInfo_Impl > getStyleFamilies() const
Definition: cfgutil.cxx:151
IJScriptValueObject VARIANT value
OUString sStyle
Definition: cfgutil.hxx:41
OUString GetHelpText(bool bConsiderParent=true)
Definition: cfgutil.cxx:237
std::unique_ptr< CuiConfigFunctionListBox > m_xCommands
Definition: cfgutil.hxx:241
bool getType(BSTR name, Type &type)
void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode > &xRootNode, const weld::TreeIter *pParentEntry, bool bCheapChildrenOnDemand)
Definition: cfgutil.cxx:482
static Help * GetHelp()
OUString GetScriptURL() const
Definition: cfgutil.cxx:1179
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:192
css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription
Definition: cfgutil.hxx:191
void getLabel4Style(SfxStyleInfo_Impl &aStyle)
Definition: cfgutil.cxx:118
OUString Name
RET_CANCEL
css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo
Definition: cfgutil.hxx:190
OUString MapCommand2UIName(const OUString &sCommand)
Definition: cfgutil.cxx:760
Reference< XController > xController
static const char CMDURL_STYLEPROT_ONLY[]
Definition: cfgutil.cxx:71
std::unique_ptr< CuiConfigGroupListBox > m_xCategories
Definition: cfgutil.hxx:240
css::uno::Reference< css::uno::XCurrentContext > NoEnableJavaInteractionContext()
int n_children() const
Definition: cfgutil.hxx:140
SfxGroupInfoArr_Impl aArr
Definition: cfgutil.hxx:185
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:600
IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter &, rIter, bool)
Definition: cfgutil.cxx:929
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: cfgutil.hxx:193
OUString sLabel
Definition: cfgutil.hxx:43
SfxStylesInfo_Impl m_aStylesInfo
Definition: cfgutil.hxx:236
OUString get_text(const weld::TreeIter &rIter) const
Definition: cfgutil.hxx:147
tuple model
void select(const weld::TreeIter &rIter)
Definition: cfgutil.hxx:165
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:242
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:1108
SfxCfgKind nKind
Definition: cfgutil.hxx:89
MetadataImporterPluginType * result
int i
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: cfgutil.hxx:187
OUString GetCurCommand() const
Definition: cfgutil.cxx:257
void scroll_to_row(int pos)
Definition: cfgutil.hxx:137
OUString GetSelectedScriptURI() const
Definition: cfgutil.cxx:319
OUString get_selected_id() const
Definition: cfgutil.hxx:158
sal_uInt16 nUniqueID
Definition: cfgutil.hxx:90
void SetStylesInfo(SfxStylesInfo_Impl *pStyles)
Definition: cfgutil.cxx:347
OUString m_sModuleLongName
Definition: cfgutil.hxx:186
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:1051
std::unique_ptr< weld::Label > m_xMacronameFT
Definition: cfgutil.hxx:244
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation > &xCommands)
Definition: cfgutil.cxx:585
SfxGroupInfoArr_Impl aArr
Definition: cfgutil.hxx:105
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:733
std::unique_ptr< weld::Label > m_xCommandsFT
Definition: cfgutil.hxx:245
#define SAL_INFO(area, stream)
const OUString & GetName() const
RET_OK
IMPL_LINK_NOARG(SvxScriptSelectorDialog, FunctionDoubleClickHdl, weld::TreeView &, bool)
Definition: cfgutil.cxx:1121
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:671
Reference< XComponentContext > getProcessComponentContext()
std::unique_ptr< weld::Label > m_xDialogDescription
Definition: cfgutil.hxx:239
CuiConfigFunctionListBox * m_pFunctionListBox
Definition: cfgutil.hxx:184
const SvxPageUsage aArr[]
Definition: page.cxx:73
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 m_aModuleName
Definition: cfgutil.hxx:60
std::unique_ptr< weld::Button > m_xOKButton
Definition: cfgutil.hxx:246
void SelectMacro(const SfxMacroInfoItem *)
Definition: cfgutil.cxx:968
Reference< XModel > xModel
std::unique_ptr< weld::Label > m_xCategoryFT
Definition: cfgutil.hxx:243
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:247
CuiConfigGroupListBox(std::unique_ptr< weld::TreeView > xTreeView)
Definition: cfgutil.cxx:404
static SVT_DLLPUBLIC OUString GetFileImageId(const INetURLObject &rURL)
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: cfgutil.hxx:188
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: cfgutil.hxx:107
std::unique_ptr< weld::TextView > m_xDescriptionText
Definition: cfgutil.hxx:248
void append(const OUString &rId, const OUString &rStr, const weld::TreeIter *pParent=nullptr)
Definition: cfgutil.hxx:117
OUString sId