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