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 #include <uno/current_context.hxx>
56 
57 using namespace ::com::sun::star;
58 using namespace ::com::sun::star::uno;
59 using namespace ::com::sun::star::script;
60 using namespace ::com::sun::star::frame;
61 using namespace ::com::sun::star::document;
62 
64 {}
65 
66 void SfxStylesInfo_Impl::init(const OUString& rModuleName, const css::uno::Reference< css::frame::XModel >& xModel)
67 {
68  m_aModuleName = rModuleName;
69  m_xDoc = xModel;
70 }
71 
72 static const char CMDURL_STYLEPROT_ONLY[] = ".uno:StyleApply?";
73 static const char CMDURL_SPART_ONLY [] = "Style:string=";
74 static const char CMDURL_FPART_ONLY [] = "FamilyName:string=";
75 
76 static const char STYLEPROP_UINAME[] = "DisplayName";
77 
78 OUString SfxStylesInfo_Impl::generateCommand(const OUString& sFamily, const OUString& sStyle)
79 {
80  return ".uno:StyleApply?Style:string="
81  + sStyle
82  + "&FamilyName:string="
83  + sFamily;
84 }
85 
87 {
88  static const sal_Int32 LEN_STYLEPROT = strlen(CMDURL_STYLEPROT_ONLY);
89  static const sal_Int32 LEN_SPART = strlen(CMDURL_SPART_ONLY);
90  static const sal_Int32 LEN_FPART = strlen(CMDURL_FPART_ONLY);
91 
92  if (!aStyle.sCommand.startsWith(CMDURL_STYLEPROT_ONLY))
93  return false;
94 
95  aStyle.sFamily.clear();
96  aStyle.sStyle.clear();
97 
98  sal_Int32 nCmdLen = aStyle.sCommand.getLength();
99  OUString sCmdArgs = aStyle.sCommand.copy(LEN_STYLEPROT, nCmdLen-LEN_STYLEPROT);
100  sal_Int32 i = sCmdArgs.indexOf('&');
101  if (i<0)
102  return false;
103 
104  OUString sArg = sCmdArgs.copy(0, i);
105  if (sArg.startsWith(CMDURL_SPART_ONLY))
106  aStyle.sStyle = sArg.copy(LEN_SPART);
107  else if (sArg.startsWith(CMDURL_FPART_ONLY))
108  aStyle.sFamily = sArg.copy(LEN_FPART);
109 
110  sArg = sCmdArgs.copy(i+1, sCmdArgs.getLength()-i-1);
111  if (sArg.startsWith(CMDURL_SPART_ONLY))
112  aStyle.sStyle = sArg.copy(LEN_SPART);
113  else if (sArg.startsWith(CMDURL_FPART_ONLY))
114  aStyle.sFamily = sArg.copy(LEN_FPART);
115 
116  return !(aStyle.sFamily.isEmpty() || aStyle.sStyle.isEmpty());
117 }
118 
120 {
121  try
122  {
123  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY);
124 
125  css::uno::Reference< css::container::XNameAccess > xFamilies;
126  if (xModel.is())
127  xFamilies = xModel->getStyleFamilies();
128 
129  css::uno::Reference< css::container::XNameAccess > xStyleSet;
130  if (xFamilies.is())
131  xFamilies->getByName(aStyle.sFamily) >>= xStyleSet;
132 
133  css::uno::Reference< css::beans::XPropertySet > xStyle;
134  if (xStyleSet.is())
135  xStyleSet->getByName(aStyle.sStyle) >>= xStyle;
136 
137  aStyle.sLabel.clear();
138  if (xStyle.is())
139  xStyle->getPropertyValue(STYLEPROP_UINAME) >>= aStyle.sLabel;
140  }
141  catch(const css::uno::RuntimeException&)
142  { throw; }
143  catch(const css::uno::Exception&)
144  { aStyle.sLabel.clear(); }
145 
146  if (aStyle.sLabel.isEmpty())
147  {
148  aStyle.sLabel = aStyle.sCommand;
149  }
150 }
151 
152 std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyleFamilies()
153 {
154  // It's an optional interface!
155  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY);
156  if (!xModel.is())
157  return std::vector< SfxStyleInfo_Impl >();
158 
159  css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies();
160  const css::uno::Sequence< OUString > lFamilyNames = xCont->getElementNames();
161  std::vector< SfxStyleInfo_Impl > lFamilies;
162  for (const auto& aFamily : lFamilyNames)
163  {
164  if ((aFamily == "CellStyles" && m_aModuleName != "com.sun.star.sheet.SpreadsheetDocument") ||
165  aFamily == "cell" || aFamily == "table" || aFamily == "Default")
166  continue;
167 
168  SfxStyleInfo_Impl aFamilyInfo;
169  aFamilyInfo.sFamily = aFamily;
170 
171  try
172  {
173  css::uno::Reference< css::beans::XPropertySet > xFamilyInfo;
174  xCont->getByName(aFamilyInfo.sFamily) >>= xFamilyInfo;
175  if (!xFamilyInfo.is())
176  {
177  // TODO_AS currently there is no support for an UIName property .. use internal family name instead
178  aFamilyInfo.sLabel = aFamilyInfo.sFamily;
179  }
180  else
181  xFamilyInfo->getPropertyValue(STYLEPROP_UINAME) >>= aFamilyInfo.sLabel;
182  }
183  catch(const css::uno::RuntimeException&)
184  { throw; }
185  catch(const css::uno::Exception&)
186  { return std::vector< SfxStyleInfo_Impl >(); }
187 
188  lFamilies.push_back(aFamilyInfo);
189  }
190 
191  return lFamilies;
192 }
193 
194 std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const OUString& sFamily)
195 {
196  css::uno::Sequence< OUString > lStyleNames;
197  css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY_THROW);
198  css::uno::Reference< css::container::XNameAccess > xFamilies = xModel->getStyleFamilies();
199  css::uno::Reference< css::container::XNameAccess > xStyleSet;
200  try
201  {
202  xFamilies->getByName(sFamily) >>= xStyleSet;
203  lStyleNames = xStyleSet->getElementNames();
204  }
205  catch(const css::uno::RuntimeException&)
206  { throw; }
207  catch(const css::uno::Exception&)
208  { return std::vector< SfxStyleInfo_Impl >(); }
209 
210  std::vector< SfxStyleInfo_Impl > lStyles;
211  sal_Int32 c = lStyleNames.getLength();
212  sal_Int32 i = 0;
213  for (i=0; i<c; ++i)
214  {
215  SfxStyleInfo_Impl aStyleInfo;
216  aStyleInfo.sFamily = sFamily;
217  aStyleInfo.sStyle = lStyleNames[i];
218  aStyleInfo.sCommand = SfxStylesInfo_Impl::generateCommand(aStyleInfo.sFamily, aStyleInfo.sStyle);
219 
220  try
221  {
222  css::uno::Reference< css::beans::XPropertySet > xStyle;
223  xStyleSet->getByName(aStyleInfo.sStyle) >>= xStyle;
224  if (!xStyle.is())
225  continue;
226  xStyle->getPropertyValue("DisplayName") >>= aStyleInfo.sLabel;
227  }
228  catch(const css::uno::RuntimeException&)
229  { throw; }
230  catch(const css::uno::Exception&)
231  { continue; }
232 
233  lStyles.push_back(aStyleInfo);
234  }
235  return lStyles;
236 }
237 
238 OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
239 {
240  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
241  if (pData)
242  {
243  if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
244  {
245  if (bConsiderParent)
246  return Application::GetHelp()->GetHelpText(pData->sCommand, m_xTreeView.get());
247  else
248  return Application::GetHelp()->GetHelpText(pData->sCommand, static_cast<weld::Widget*>(nullptr));
249  }
250  else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
251  {
252  return pData->sHelpText;
253  }
254  }
255  return OUString();
256 }
257 
259 {
260  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
261  if (!pData)
262  return OUString();
263  return pData->sCommand;
264 }
265 
267 {
268  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
269  if (!pData)
270  return OUString();
271  if (!pData->sLabel.isEmpty())
272  return pData->sLabel;
273  return pData->sCommand;
274 }
275 
276 CuiConfigFunctionListBox::CuiConfigFunctionListBox(std::unique_ptr<weld::TreeView> xTreeView)
277  : m_xTreeView(std::move(xTreeView))
278  , m_xScratchIter(m_xTreeView->make_iterator())
279 {
280  m_xTreeView->make_sorted();
281  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
282 }
283 
285 {
286  ClearAll();
287 }
288 
290 /* Description
291  Deletes all entries in the FunctionListBox, all UserData and all
292  possibly existing MacroInfo.
293 */
294 {
295  sal_uInt16 nCount = aArr.size();
296  for ( sal_uInt16 i=0; i<nCount; ++i )
297  {
298  SfxGroupInfo_Impl *pData = aArr[i].get();
299 
300  if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
301  {
302  OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
303  delete pScriptURI;
304  }
305 
307  {
308  XInterface* xi = static_cast<XInterface *>(pData->pObject);
309  if (xi != nullptr)
310  {
311  xi->release();
312  }
313  }
314  }
315 
316  aArr.clear();
317  m_xTreeView->clear();
318 }
319 
321 {
322  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
323  if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
324  return *static_cast<OUString*>(pData->pObject);
325  return OUString();
326 }
327 
329 {
330  OUString m_sMyMacros;
331  OUString m_sProdMacros;
332  OUString m_sMacros;
333  OUString m_sDlgMacros;
335 
337 };
338 
340  m_sMyMacros(CuiResId(RID_SVXSTR_MYMACROS)),
341  m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
342  m_sMacros(CuiResId(RID_SVXSTR_BASICMACROS)),
343  m_sDlgMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
344  m_aStrGroupStyles(CuiResId(RID_SVXSTR_GROUP_STYLES))
345 {
346 }
347 
349 {
350  m_pStylesInfo = pStyles;
351 }
352 
353 namespace
354 {
355 
362  Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent )
363  {
364  Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY );
365  if ( !xScripts.is() )
366  {
367  Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
368  if ( xContext.is() )
369  xScripts = xContext->getScriptContainer();
370  }
371 
372  return Reference< XModel >( xScripts, UNO_QUERY );
373  }
374 
375 
376  Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame )
377  {
378  Reference< XModel > xDocument;
379 
380  // examine our associated frame
381  try
382  {
383  OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" );
384  if ( _rxFrame.is() )
385  {
386  // first try the model in the frame
387  Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW );
388  xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() );
389 
390  if ( !xDocument.is() )
391  {
392  // if there is no suitable document in the frame, try the controller
393  xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() );
394  }
395  }
396  }
397  catch( const Exception& )
398  {
399  }
400 
401  return xDocument;
402  }
403 }
404 
405 CuiConfigGroupListBox::CuiConfigGroupListBox(std::unique_ptr<weld::TreeView> xTreeView)
406  : xImp(new SvxConfigGroupBoxResource_Impl())
407  , m_pFunctionListBox(nullptr)
408  , m_pStylesInfo(nullptr)
409  , m_xTreeView(std::move(xTreeView))
410 {
411  m_xTreeView->connect_row_activated(LINK(this, CuiConfigGroupListBox, OpenCurrentHdl));
412  m_xTreeView->connect_expanding(LINK(this, CuiConfigGroupListBox, ExpandingHdl));
413  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
414 }
415 
417 {
418  std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
419  bool bValidIter = m_xTreeView->get_cursor(xIter.get());
420  if (!bValidIter)
421  return;
422  if (!m_xTreeView->get_row_expanded(*xIter))
423  m_xTreeView->expand_row(*xIter);
424  else
425  m_xTreeView->collapse_row(*xIter);
426 }
427 
429 {
430  ClearAll();
431 }
432 
434 {
435  sal_uInt16 nCount = aArr.size();
436  for ( sal_uInt16 i=0; i<nCount; ++i )
437  {
438  SfxGroupInfo_Impl *pData = aArr[i].get();
440  {
441  XInterface* xi = static_cast<XInterface *>(pData->pObject);
442  if (xi != nullptr)
443  {
444  xi->release();
445  }
446  }
447  }
448 
449  aArr.clear();
450  m_xTreeView->clear();
451 }
452 
454 {
455  try
456  {
457  css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW);
458  css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
459  sal_Int32 c1 = lGroups.getLength();
460  sal_Int32 i1 = 0;
461 
462  if ( c1 )
463  {
464  // Add All Commands category
465  aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
466  m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
467  CuiResId(RID_SVXSTR_ALLFUNCTIONS));
468  }
469 
470  for (i1=0; i1<c1; ++i1)
471  {
472  sal_Int16& rGroupID = lGroups[i1];
473  OUString sGroupID = OUString::number(rGroupID);
474  OUString sGroupName ;
475 
476  try
477  {
478  m_xModuleCategoryInfo->getByName(sGroupID) >>= sGroupName;
479  if (sGroupName.isEmpty())
480  continue;
481  }
482  catch(const css::container::NoSuchElementException&)
483  { continue; }
484 
485  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, rGroupID ) );
486  m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
487  sGroupName);
488  }
489  }
490  catch(const css::uno::RuntimeException&)
491  { throw; }
492  catch(const css::uno::Exception&)
493  {}
494 }
495 
496 void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
497  const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand)
498 {
499  try {
500  if ( xRootNode->hasChildNodes() )
501  {
502  // tdf#120362: Don't ask to enable disabled Java when filling script list
503  css::uno::ContextLayer layer(
504  new comphelper::NoEnableJavaInteractionContext(css::uno::getCurrentContext()));
505 
506  Sequence< Reference< browse::XBrowseNode > > children =
507  xRootNode->getChildNodes();
508  bool bIsRootNode = false;
509 
510  OUString user("user");
511  OUString share("share");
512  if ( xRootNode->getName() == "Root" )
513  {
514  bIsRootNode = true;
515  }
516 
517  //To mimic current starbasic behaviour we
518  //need to make sure that only the current document
519  //is displayed in the config tree. Tests below
520  //set the bDisplay flag to FALSE if the current
521  //node is a first level child of the Root and is NOT
522  //either the current document, user or share
523  OUString currentDocTitle;
524  Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
525  if ( xDocument.is() )
526  {
527  currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
528  }
529 
530  for ( sal_Int32 n = 0; n < children.getLength(); ++n )
531  {
532  Reference< browse::XBrowseNode >& theChild = children[n];
533  bool bDisplay = true;
534  OUString uiName = theChild->getName();
535  if ( bIsRootNode )
536  {
537  if ( ! (theChild->getName() == user || theChild->getName() == share ||
538  theChild->getName() == currentDocTitle ) )
539  {
540  bDisplay=false;
541  }
542  else
543  {
544  if ( uiName == user )
545  {
546  uiName = xImp->m_sMyMacros;
547  }
548  else if ( uiName == share )
549  {
550  uiName = xImp->m_sProdMacros;
551  }
552  }
553  }
554  if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
555  {
556 // We call acquire on the XBrowseNode so that it does not
557 // get autodestructed and become invalid when accessed later.
558  theChild->acquire();
559 
560  bool bChildOnDemand = false;
561  if ( !bCheapChildrenOnDemand && children[n]->hasChildNodes() )
562  {
563  Sequence< Reference< browse::XBrowseNode > > grandchildren =
564  children[n]->getChildNodes();
565 
566  for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
567  {
568  if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
569  {
570  bChildOnDemand = true;
571  m = grandchildren.getLength();
572  }
573  }
574  }
575  else
576  {
577  /* i30923 - Would be nice if there was a better
578  * way to determine if a basic lib had children
579  * without having to ask for them (which forces
580  * the library to be loaded */
581  bChildOnDemand = true;
582  }
583 
584  OUString aImage = GetImage(theChild, m_xContext, bIsRootNode);
585 
586  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
587  0, static_cast<void *>( theChild.get())));
588 
589  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
590  m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, &aImage, bChildOnDemand, nullptr);
591  }
592  }
593  }
594  }
595  catch (RuntimeException&) {
596  // do nothing, the entry will not be displayed in the UI
597  }
598 }
599 
600 void CuiConfigGroupListBox::FillFunctionsList(const css::uno::Sequence<DispatchInformation>& xCommands)
601 {
603  for (const auto & rInfo : xCommands)
604  {
605  OUString sUIName = MapCommand2UIName(rInfo.Command);
606  aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
607  SfxGroupInfo_Impl* pGrpInfo = aArr.back().get();
608  pGrpInfo->sCommand = rInfo.Command;
609  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();
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 }
1141 
1142 // Check if command is selected and enable the OK button accordingly
1143 // Grab the help text for this id if available and update the description field
1144 void
1146 {
1147  OUString url = GetScriptURL();
1148  if ( !url.isEmpty() )
1149  {
1150  OUString sMessage = m_xCommands->GetHelpText();
1151  m_xDescriptionText->set_text(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
1152 
1153  m_xOKButton->set_sensitive(true);
1154  }
1155  else
1156  {
1158  m_xOKButton->set_sensitive(false);
1159  }
1160 }
1161 
1163 {
1164  if (&rButton == m_xCancelButton.get())
1165  {
1166  m_xDialog->response(RET_CANCEL);
1167  }
1168  else if (&rButton == m_xOKButton.get())
1169  {
1170  // If we are displaying Slot API commands then this the dialog is being
1171  // run from Tools/Configure and we should not close it
1172  if ( !m_bShowSlots )
1173  {
1174  m_xDialog->response(RET_OK);
1175  }
1176  else
1177  {
1178  // Select the next entry in the list if possible
1179  std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
1180  if (m_xCommands->get_selected(xIter.get()) && m_xCommands->iter_next_sibling(*xIter))
1181  m_xCommands->select(*xIter);
1182  }
1183  }
1184 }
1185 
1186 void
1188 {
1189  m_xOKButton->set_label(CuiResId(RID_SVXSTR_SELECTOR_RUN));
1190 }
1191 
1192 OUString
1194 {
1195  OUString result;
1196 
1197  std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
1198  if (m_xCommands->get_selected(xIter.get()))
1199  {
1200  SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter).toInt64());
1201  if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
1202  || ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
1203  || ( pData->nKind == SfxCfgKind::GROUP_STYLES )
1204  )
1205  {
1206  result = pData->sCommand;
1207  }
1208  }
1209 
1210  return result;
1211 }
1212 
1213 /* 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
IJScriptValueObject VARIANT value
OUString sStyle
Definition: cfgutil.hxx:41
OUString GetHelpText(bool bConsiderParent=true)
Definition: cfgutil.cxx:238
std::unique_ptr< CuiConfigFunctionListBox > m_xCommands
Definition: cfgutil.hxx:242
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:496
static Help * GetHelp()
OUString GetScriptURL() const
Definition: cfgutil.cxx:1193
css::uno::Reference< css::frame::XModel > m_xDoc
Definition: cfgutil.hxx:61
static const char CMDURL_FPART_ONLY[]
Definition: cfgutil.cxx:74
SfxStylesInfo_Impl * m_pStylesInfo
Definition: cfgutil.hxx:192
css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription
Definition: cfgutil.hxx:191
OUString GetSelectedScriptURI()
Definition: cfgutil.cxx:320
void getLabel4Style(SfxStyleInfo_Impl &aStyle)
Definition: cfgutil.cxx:119
OUString Name
RET_CANCEL
css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo
Definition: cfgutil.hxx:190
OUString MapCommand2UIName(const OUString &sCommand)
Definition: cfgutil.cxx:775
Reference< XController > xController
static const char CMDURL_STYLEPROT_ONLY[]
Definition: cfgutil.cxx:72
void append(const OUString &rId, const OUString &rStr, weld::TreeIter *pParent=nullptr)
Definition: cfgutil.hxx:117
std::unique_ptr< CuiConfigGroupListBox > m_xCategories
Definition: cfgutil.hxx:241
int n_children() const
Definition: cfgutil.hxx:140
SfxGroupInfoArr_Impl aArr
Definition: cfgutil.hxx:185
std::vector< SfxStyleInfo_Impl > getStyleFamilies()
Definition: cfgutil.cxx:152
OUString sFamily
Definition: cfgutil.hxx:40
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
IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter &, rIter, bool)
Definition: cfgutil.cxx:944
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: cfgutil.hxx:193
OUString sLabel
Definition: cfgutil.hxx:43
SfxStylesInfo_Impl m_aStylesInfo
Definition: cfgutil.hxx:237
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
OUString GetCurCommand()
Definition: cfgutil.cxx:258
#define TOOLS_WARN_EXCEPTION(area, stream)
std::unique_ptr< weld::Label > m_xLibraryFT
Definition: cfgutil.hxx:243
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString sHelpText
Definition: cfgutil.hxx:94
std::vector< SfxStyleInfo_Impl > getStyles(const OUString &sFamily)
Definition: cfgutil.cxx:194
virtual ~SvxScriptSelectorDialog() override
Definition: cfgutil.cxx:1123
SfxCfgKind nKind
Definition: cfgutil.hxx:89
MetadataImporterPluginType * result
int i
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: cfgutil.hxx:187
void scroll_to_row(int pos)
Definition: cfgutil.hxx:137
OUString get_selected_id() const
Definition: cfgutil.hxx:158
sal_uInt16 nUniqueID
Definition: cfgutil.hxx:90
void SetStylesInfo(SfxStylesInfo_Impl *pStyles)
Definition: cfgutil.cxx:348
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:66
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
std::unique_ptr< weld::Label > m_xMacronameFT
Definition: cfgutil.hxx:245
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation > &xCommands)
Definition: cfgutil.cxx:600
SfxGroupInfoArr_Impl aArr
Definition: cfgutil.hxx:105
CuiConfigFunctionListBox(std::unique_ptr< weld::TreeView > xTreeView)
Definition: cfgutil.cxx:276
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:246
#define SAL_INFO(area, stream)
const OUString & GetName() const
RET_OK
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:240
CuiConfigFunctionListBox * m_pFunctionListBox
Definition: cfgutil.hxx:184
const SvxPageUsage aArr[]
Definition: page.cxx:79
static bool parseStyleCommand(SfxStyleInfo_Impl &aStyle)
Definition: cfgutil.cxx:86
OUString sLabel
Definition: cfgutil.hxx:93
IMPL_LINK_NOARG(CuiConfigGroupListBox, OpenCurrentHdl, weld::TreeView &, void)
Definition: cfgutil.cxx:416
static OUString generateCommand(const OUString &sFamily, const OUString &sStyle)
Definition: cfgutil.cxx:78
OUString m_aModuleName
Definition: cfgutil.hxx:60
std::unique_ptr< weld::Button > m_xOKButton
Definition: cfgutil.hxx:247
void SelectMacro(const SfxMacroInfoItem *)
Definition: cfgutil.cxx:983
Reference< XModel > xModel
std::unique_ptr< weld::Label > m_xCategoryFT
Definition: cfgutil.hxx:244
static const char STYLEPROP_UINAME[]
Definition: cfgutil.cxx:76
static const char CMDURL_SPART_ONLY[]
Definition: cfgutil.cxx:73
std::unique_ptr< weld::Button > m_xCancelButton
Definition: cfgutil.hxx:248
CuiConfigGroupListBox(std::unique_ptr< weld::TreeView > xTreeView)
Definition: cfgutil.cxx:405
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:249
OUString sId