LibreOffice Module framework (master) 1
uicommanddescription.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 <sal/config.h>
21
22#include <string_view>
23
25
26#include <properties.h>
27
28#include <helper/mischelper.hxx>
29
30#include <com/sun/star/beans/PropertyValue.hpp>
31#include <com/sun/star/frame/ModuleManager.hpp>
32#include <com/sun/star/configuration/theDefaultProvider.hpp>
33#include <com/sun/star/container/XNameAccess.hpp>
34#include <com/sun/star/container/XContainer.hpp>
35
39
40#include <vcl/mnemonic.hxx>
44#include <comphelper/string.hxx>
45
46using namespace com::sun::star::uno;
47using namespace com::sun::star::lang;
48using namespace com::sun::star::beans;
49using namespace com::sun::star::configuration;
50using namespace com::sun::star::container;
51using namespace ::com::sun::star::frame;
52
53// Namespace
54
55const char CONFIGURATION_ROOT_ACCESS[] = "/org.openoffice.Office.UI.";
56
57// Special resource URLs to retrieve additional information
58constexpr OUStringLiteral PRIVATE_RESOURCE_URL = u"private:";
59
60const sal_Int32 COMMAND_PROPERTY_IMAGE = 1;
61const sal_Int32 COMMAND_PROPERTY_ROTATE = 2;
62const sal_Int32 COMMAND_PROPERTY_MIRROR = 4;
63
64namespace framework
65{
66
67// Configuration access class for PopupMenuControllerFactory implementation
68
69namespace {
70
71class ConfigurationAccess_UICommand : // Order is necessary for right initialization!
72 public ::cppu::WeakImplHelper<XNameAccess,XContainerListener>
73{
74 std::mutex m_aMutex;
75 public:
76 ConfigurationAccess_UICommand( std::u16string_view aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XComponentContext >& rxContext );
77 virtual ~ConfigurationAccess_UICommand() override;
78
79 // XNameAccess
80 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
81
82 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
83
84 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
85
86 // XElementAccess
87 virtual css::uno::Type SAL_CALL getElementType() override;
88
89 virtual sal_Bool SAL_CALL hasElements() override;
90
91 // container.XContainerListener
92 virtual void SAL_CALL elementInserted( const ContainerEvent& aEvent ) override;
93 virtual void SAL_CALL elementRemoved ( const ContainerEvent& aEvent ) override;
94 virtual void SAL_CALL elementReplaced( const ContainerEvent& aEvent ) override;
95
96 // lang.XEventListener
97 virtual void SAL_CALL disposing( const EventObject& aEvent ) override;
98
99 protected:
100 css::uno::Any getByNameImpl( const OUString& aName );
101
102 struct CmdToInfoMap
103 {
104 CmdToInfoMap() : bPopup( false ),
105 bCommandNameCreated( false ),
106 bIsExperimental( false ),
107 nProperties( 0 ) {}
108
109 OUString aLabel;
111 OUString aCommandName;
112 OUString aPopupLabel;
114 OUString aTargetURL;
115 bool bPopup : 1,
118 sal_Int32 nProperties;
119 };
120
121 Any getSequenceFromCache( const OUString& aCommandURL );
122 Any getInfoFromCommand( const OUString& rCommandURL );
123 void fillInfoFromResult( CmdToInfoMap& rCmdInfo, const OUString& aLabel );
124 Sequence< OUString > getAllCommands();
125 void fillCache();
126 void addGenericInfoToCache();
127 void impl_fill(const Reference< XNameAccess >& _xConfigAccess,bool _bPopup,
128 std::vector< OUString >& aImageCommandVector,
129 std::vector< OUString >& aImageRotateVector,
130 std::vector< OUString >& aImageMirrorVector);
131
132 private:
133 typedef std::unordered_map< OUString,
134 CmdToInfoMap > CommandToInfoCache;
135
136 void initializeConfigAccess();
137
150 CommandToInfoCache m_aCmdInfoCache;
154};
155
156}
157
158
159// XInterface, XTypeProvider
160
161ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( std::u16string_view aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XComponentContext>& rxContext ) :
162 // Create configuration hierarchical access name
164 OUString::Concat(CONFIGURATION_ROOT_ACCESS) + aModuleName + "/UserInterface/Commands"),
166 OUString::Concat(CONFIGURATION_ROOT_ACCESS) + aModuleName + "/UserInterface/Popups"),
167 m_aPropProperties( "Properties" ),
168 m_xGenericUICommands( rGenericUICommands ),
169 m_xConfigProvider( theDefaultProvider::get( rxContext ) ),
171 m_bCacheFilled( false ),
173{
174}
175
176ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand()
177{
178 // SAFE
179 std::unique_lock g(m_aMutex);
180 Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
181 if ( xContainer.is() )
182 xContainer->removeContainerListener(m_xConfigListener);
183 xContainer.set( m_xConfigAccessPopups, UNO_QUERY );
184 if ( xContainer.is() )
185 xContainer->removeContainerListener(m_xConfigAccessListener);
186}
187
188// XNameAccess
189Any ConfigurationAccess_UICommand::getByNameImpl( const OUString& rCommandURL )
190{
191 std::unique_lock g(m_aMutex);
193 {
194 initializeConfigAccess();
196 fillCache();
197 }
198
199 if ( rCommandURL.startsWith( PRIVATE_RESOURCE_URL ) )
200 {
201 // special keys to retrieve information about a set of commands
202 // SAFE
203 addGenericInfoToCache();
204
205 if ( rCommandURL.equalsIgnoreAsciiCase( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST ))
206 return Any( m_aCommandImageList );
207 else if ( rCommandURL.equalsIgnoreAsciiCase( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST ))
209 else if ( rCommandURL.equalsIgnoreAsciiCase( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST ))
211 else
212 return Any();
213 }
214 else
215 {
216 // SAFE
217 return getInfoFromCommand( rCommandURL );
218 }
219}
220
221Any SAL_CALL ConfigurationAccess_UICommand::getByName( const OUString& rCommandURL )
222{
223 Any aRet( getByNameImpl( rCommandURL ) );
224 if( !aRet.hasValue() )
225 throw NoSuchElementException();
226
227 return aRet;
228}
229
230Sequence< OUString > SAL_CALL ConfigurationAccess_UICommand::getElementNames()
231{
232 return getAllCommands();
233}
234
235sal_Bool SAL_CALL ConfigurationAccess_UICommand::hasByName( const OUString& rCommandURL )
236{
237 return getByNameImpl( rCommandURL ).hasValue();
238}
239
240// XElementAccess
241Type SAL_CALL ConfigurationAccess_UICommand::getElementType()
242{
244}
245
246sal_Bool SAL_CALL ConfigurationAccess_UICommand::hasElements()
247{
248 // There must are global commands!
249 return true;
250}
251
252void ConfigurationAccess_UICommand::fillInfoFromResult( CmdToInfoMap& rCmdInfo, const OUString& aLabel )
253{
254 OUString aStr(aLabel.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName()));
255 rCmdInfo.aLabel = aStr;
256 aStr = comphelper::string::stripEnd(aStr, '.'); // Remove "..." from string
257 rCmdInfo.aCommandName = MnemonicGenerator::EraseAllMnemonicChars(aStr);
258 rCmdInfo.bCommandNameCreated = true;
259}
260
261Any ConfigurationAccess_UICommand::getSequenceFromCache( const OUString& aCommandURL )
262{
263 CommandToInfoCache::iterator pIter = m_aCmdInfoCache.find( aCommandURL );
264 if ( pIter != m_aCmdInfoCache.end() )
265 {
266 if ( !pIter->second.bCommandNameCreated )
267 fillInfoFromResult( pIter->second, pIter->second.aLabel );
268
269 static constexpr OUStringLiteral sLabel = u"Label";
270 static constexpr OUStringLiteral sName = u"Name";
271 static constexpr OUStringLiteral sPopup = u"Popup";
272 static constexpr OUStringLiteral sPopupLabel = u"PopupLabel";
273 static constexpr OUStringLiteral sTooltipLabel = u"TooltipLabel";
274 static constexpr OUStringLiteral sTargetURL = u"TargetURL";
275 static constexpr OUStringLiteral sIsExperimental = u"IsExperimental";
277 comphelper::makePropertyValue(sLabel, !pIter->second.aContextLabel.isEmpty()
278 ? Any(pIter->second.aContextLabel)
279 : Any(pIter->second.aLabel)),
280 comphelper::makePropertyValue(sName, pIter->second.aCommandName),
281 comphelper::makePropertyValue(sPopup, pIter->second.bPopup),
282 comphelper::makePropertyValue(m_aPropProperties, pIter->second.nProperties),
283 comphelper::makePropertyValue(sPopupLabel, pIter->second.aPopupLabel),
284 comphelper::makePropertyValue(sTooltipLabel, pIter->second.aTooltipLabel),
285 comphelper::makePropertyValue(sTargetURL, pIter->second.aTargetURL),
286 comphelper::makePropertyValue(sIsExperimental, pIter->second.bIsExperimental)
287 };
288 return Any( aPropSeq );
289 }
290
291 return Any();
292}
293void ConfigurationAccess_UICommand::impl_fill(const Reference< XNameAccess >& _xConfigAccess,bool _bPopup,
294 std::vector< OUString >& aImageCommandVector,
295 std::vector< OUString >& aImageRotateVector,
296 std::vector< OUString >& aImageMirrorVector)
297{
298 if ( !_xConfigAccess.is() )
299 return;
300
301 Sequence< OUString> aNameSeq = _xConfigAccess->getElementNames();
302 const sal_Int32 nCount = aNameSeq.getLength();
303 for ( sal_Int32 i = 0; i < nCount; i++ )
304 {
305 try
306 {
307 Reference< XNameAccess > xNameAccess(_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
308 if ( xNameAccess.is() )
309 {
310 CmdToInfoMap aCmdToInfo;
311
312 aCmdToInfo.bPopup = _bPopup;
313 xNameAccess->getByName( "Label" ) >>= aCmdToInfo.aLabel;
314 xNameAccess->getByName( "ContextLabel" ) >>= aCmdToInfo.aContextLabel;
315 xNameAccess->getByName( "PopupLabel" ) >>= aCmdToInfo.aPopupLabel;
316 xNameAccess->getByName( "TooltipLabel" ) >>= aCmdToInfo.aTooltipLabel;
317 xNameAccess->getByName( "TargetURL" ) >>= aCmdToInfo.aTargetURL;
318 xNameAccess->getByName( "IsExperimental" ) >>= aCmdToInfo.bIsExperimental;
319 xNameAccess->getByName( m_aPropProperties ) >>= aCmdToInfo.nProperties;
320
321 m_aCmdInfoCache.emplace( aNameSeq[i], aCmdToInfo );
322
323 if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_IMAGE )
324 aImageCommandVector.push_back( aNameSeq[i] );
325 if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_ROTATE )
326 aImageRotateVector.push_back( aNameSeq[i] );
327 if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_MIRROR )
328 aImageMirrorVector.push_back( aNameSeq[i] );
329 }
330 }
331 catch (const css::lang::WrappedTargetException&)
332 {
333 }
334 catch (const css::container::NoSuchElementException&)
335 {
336 }
337 }
338}
339void ConfigurationAccess_UICommand::fillCache()
340{
341
342 if ( m_bCacheFilled )
343 return;
344
345 std::vector< OUString > aImageCommandVector;
346 std::vector< OUString > aImageRotateVector;
347 std::vector< OUString > aImageMirrorVector;
348
349 impl_fill(m_xConfigAccess,false,aImageCommandVector,aImageRotateVector,aImageMirrorVector);
350 impl_fill(m_xConfigAccessPopups,true,aImageCommandVector,aImageRotateVector,aImageMirrorVector);
351 // Create cached sequences for fast retrieving
355
356 m_bCacheFilled = true;
357}
358
359void ConfigurationAccess_UICommand::addGenericInfoToCache()
360{
362 return;
363
364 Sequence< OUString > aCommandNameSeq;
365 try
366 {
367 if ( m_xGenericUICommands->getByName(
369 m_aCommandRotateImageList = comphelper::concatSequences< OUString >( m_aCommandRotateImageList, aCommandNameSeq );
370 }
371 catch (const RuntimeException&)
372 {
373 throw;
374 }
375 catch (const Exception&)
376 {
377 }
378
379 try
380 {
381 if ( m_xGenericUICommands->getByName(
383 m_aCommandMirrorImageList = comphelper::concatSequences< OUString >( m_aCommandMirrorImageList, aCommandNameSeq );
384 }
385 catch (const RuntimeException&)
386 {
387 throw;
388 }
389 catch (const Exception&)
390 {
391 }
392
394}
395
396Any ConfigurationAccess_UICommand::getInfoFromCommand( const OUString& rCommandURL )
397{
398 Any a;
399
400 try
401 {
402 a = getSequenceFromCache( rCommandURL );
403 if ( !a.hasValue() )
404 {
405 // First try to ask our global commands configuration access. It also caches maybe
406 // we find the entry in its cache first.
407 if ( m_xGenericUICommands.is() && m_xGenericUICommands->hasByName( rCommandURL ) )
408 {
409 try
410 {
411 return m_xGenericUICommands->getByName( rCommandURL );
412 }
413 catch (const css::lang::WrappedTargetException&)
414 {
415 }
416 catch (const css::container::NoSuchElementException&)
417 {
418 }
419 }
420 }
421 }
422 catch (const css::container::NoSuchElementException&)
423 {
424 }
425 catch (const css::lang::WrappedTargetException&)
426 {
427 }
428
429 return a;
430}
431
432Sequence< OUString > ConfigurationAccess_UICommand::getAllCommands()
433{
434 // SAFE
435 std::unique_lock g(m_aMutex);
436
438 {
439 initializeConfigAccess();
441 fillCache();
442 }
443
444 if ( m_xConfigAccess.is() )
445 {
446 try
447 {
448 Sequence< OUString > aNameSeq = m_xConfigAccess->getElementNames();
449
450 if ( m_xGenericUICommands.is() )
451 {
452 // Create concat list of supported user interface commands of the module
453 Sequence< OUString > aGenericNameSeq = m_xGenericUICommands->getElementNames();
454 sal_uInt32 nCount1 = aNameSeq.getLength();
455 sal_uInt32 nCount2 = aGenericNameSeq.getLength();
456
457 aNameSeq.realloc( nCount1 + nCount2 );
458 OUString* pNameSeq = aNameSeq.getArray();
459 const OUString* pGenericSeq = aGenericNameSeq.getConstArray();
460 for ( sal_uInt32 i = 0; i < nCount2; i++ )
461 pNameSeq[nCount1+i] = pGenericSeq[i];
462 }
463
464 return aNameSeq;
465 }
466 catch (const css::container::NoSuchElementException&)
467 {
468 }
469 catch (const css::lang::WrappedTargetException&)
470 {
471 }
472 }
473
474 return Sequence< OUString >();
475}
476
477void ConfigurationAccess_UICommand::initializeConfigAccess()
478{
479 try
480 {
482 {
483 {"nodepath", Any(m_aConfigCmdAccess)}
484 }));
485 m_xConfigAccess.set( m_xConfigProvider->createInstanceWithArguments(
486 "com.sun.star.configuration.ConfigurationAccess", aArgs ),UNO_QUERY );
487 if ( m_xConfigAccess.is() )
488 {
489 // Add as container listener
490 Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
491 if ( xContainer.is() )
492 {
493 m_xConfigListener = new WeakContainerListener(this);
494 xContainer->addContainerListener(m_xConfigListener);
495 }
496 }
497
499 {
500 {"nodepath", Any(m_aConfigPopupAccess)}
501 }));
502 m_xConfigAccessPopups.set( m_xConfigProvider->createInstanceWithArguments(
503 "com.sun.star.configuration.ConfigurationAccess", aArgs2 ),UNO_QUERY );
504 if ( m_xConfigAccessPopups.is() )
505 {
506 // Add as container listener
507 Reference< XContainer > xContainer( m_xConfigAccessPopups, UNO_QUERY );
508 if ( xContainer.is() )
509 {
510 m_xConfigAccessListener = new WeakContainerListener(this);
511 xContainer->addContainerListener(m_xConfigAccessListener);
512 }
513 }
514 }
515 catch (const WrappedTargetException&)
516 {
517 }
518 catch (const Exception&)
519 {
520 }
521}
522
523// container.XContainerListener
524void SAL_CALL ConfigurationAccess_UICommand::elementInserted( const ContainerEvent& )
525{
526 std::unique_lock g(m_aMutex);
527 m_bCacheFilled = false;
528 fillCache();
529}
530
531void SAL_CALL ConfigurationAccess_UICommand::elementRemoved( const ContainerEvent& )
532{
533 std::unique_lock g(m_aMutex);
534 m_bCacheFilled = false;
535 fillCache();
536}
537
538void SAL_CALL ConfigurationAccess_UICommand::elementReplaced( const ContainerEvent& )
539{
540 std::unique_lock g(m_aMutex);
541 m_bCacheFilled = false;
542 fillCache();
543}
544
545// lang.XEventListener
546void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEvent )
547{
548 // SAFE
549 // remove our reference to the config access
550 std::unique_lock g(m_aMutex);
551
552 Reference< XInterface > xIfac1( aEvent.Source, UNO_QUERY );
553 Reference< XInterface > xIfac2( m_xConfigAccess, UNO_QUERY );
554 if ( xIfac1 == xIfac2 )
555 m_xConfigAccess.clear();
556 else
557 {
558 xIfac1.set( m_xConfigAccessPopups, UNO_QUERY );
559 if ( xIfac1 == xIfac2 )
560 m_xConfigAccessPopups.clear();
561 }
562}
563
564void UICommandDescription::ensureGenericUICommandsForLanguage(const LanguageTag& rLanguage)
565{
566 auto xGenericUICommands = m_xGenericUICommands.find(rLanguage);
567 if (xGenericUICommands == m_xGenericUICommands.end())
568 {
570 m_xGenericUICommands[rLanguage] = new ConfigurationAccess_UICommand( u"GenericCommands", xEmpty, m_xContext );
571 }
572}
573
574UICommandDescription::UICommandDescription(const Reference< XComponentContext >& rxContext)
575 : m_aPrivateResourceURL(PRIVATE_RESOURCE_URL)
576 , m_xContext(rxContext)
577{
578 SvtSysLocale aSysLocale;
579 const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag();
580
581 ensureGenericUICommandsForLanguage(rCurrentLanguage);
582
583 impl_fillElements("ooSetupFactoryCommandConfigRef");
584
585 // insert generic commands
586 auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
587 UICommandsHashMap::iterator pIter = rMap.find( "GenericCommands" );
588 if ( pIter != rMap.end() )
589 pIter->second = m_xGenericUICommands[rCurrentLanguage];
590}
591
593 : m_xContext(rxContext)
594{
595}
596
598{
599 std::unique_lock g(m_aMutex);
601 m_aUICommandsHashMap.clear();
602 m_xGenericUICommands.clear();
603}
605{
606 m_xModuleManager.set( ModuleManager::create( m_xContext ) );
607 const Sequence< OUString > aElementNames = m_xModuleManager->getElementNames();
608
609 SvtSysLocale aSysLocale;
610
611 for ( OUString const & aModuleIdentifier : aElementNames )
612 {
614 if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq )
615 {
616 OUString aCommandStr;
617 for ( PropertyValue const & prop : std::as_const(aSeq) )
618 {
619 if ( prop.Name.equalsAscii(_pName) )
620 {
621 prop.Value >>= aCommandStr;
622 break;
623 }
624 }
625
626 // Create first mapping ModuleIdentifier ==> Command File
627 m_aModuleToCommandFileMap.emplace( aModuleIdentifier, aCommandStr );
628
629 // Create second mapping Command File ==> commands instance
630 const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag();
631 auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
632 UICommandsHashMap::iterator pIter = rMap.find( aCommandStr );
633 if ( pIter == rMap.end() )
634 rMap.emplace( aCommandStr, Reference< XNameAccess >() );
635 }
636 } // for ( sal_Int32 i = 0; i < aElementNames.(); i++ )
637}
638
639Any SAL_CALL UICommandDescription::getByName( const OUString& aName )
640{
641 SvtSysLocale aSysLocale;
642 const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag();
643 Any a;
644
645 std::unique_lock g(m_aMutex);
646
647 ModuleToCommandFileMap::const_iterator pM2CIter = m_aModuleToCommandFileMap.find( aName );
648 if ( pM2CIter != m_aModuleToCommandFileMap.end() )
649 {
650 OUString aCommandFile( pM2CIter->second );
651 auto pMapIter = m_aUICommandsHashMap.find( rCurrentLanguage );
652 if ( pMapIter == m_aUICommandsHashMap.end() )
653 impl_fillElements("ooSetupFactoryCommandConfigRef");
654
655 auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
656 UICommandsHashMap::iterator pIter = rMap.find( aCommandFile );
657 if ( pIter != rMap.end() )
658 {
659 if ( pIter->second.is() )
660 a <<= pIter->second;
661 else
662 {
663 ensureGenericUICommandsForLanguage(rCurrentLanguage);
664
665 Reference< XNameAccess > xUICommands = new ConfigurationAccess_UICommand( aCommandFile,
666 m_xGenericUICommands[rCurrentLanguage],
667 m_xContext );
668 pIter->second = xUICommands;
669 a <<= xUICommands;
670 }
671 }
672 }
673 else if ( !m_aPrivateResourceURL.isEmpty() && aName.startsWith( m_aPrivateResourceURL ) )
674 {
675 ensureGenericUICommandsForLanguage(rCurrentLanguage);
676
677 // special keys to retrieve information about a set of commands
678 return m_xGenericUICommands[rCurrentLanguage]->getByName( aName );
679 }
680 else
681 {
682 throw NoSuchElementException();
683 }
684
685 return a;
686}
687
689{
690 std::unique_lock g(m_aMutex);
691
693}
694
695sal_Bool SAL_CALL UICommandDescription::hasByName( const OUString& aName )
696{
697 std::unique_lock g(m_aMutex);
698
699 ModuleToCommandFileMap::const_iterator pIter = m_aModuleToCommandFileMap.find( aName );
700 return ( pIter != m_aModuleToCommandFileMap.end() );
701}
702
703// XElementAccess
705{
707}
708
710{
711 // generic UI commands are always available!
712 return true;
713}
714
715} // namespace framework
716
717extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
719 css::uno::XComponentContext *context,
720 css::uno::Sequence<css::uno::Any> const &)
721{
722 return cppu::acquire(new framework::UICommandDescription(context));
723}
724
725/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
static OUString EraseAllMnemonicChars(const OUString &rStr)
const LanguageTag & GetUILanguageTag() const
css::uno::Type const & get()
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual sal_Bool SAL_CALL hasElements() override
ModuleToCommandFileMap m_aModuleToCommandFileMap
UICommandDescription(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
std::map< LanguageTag, css::uno::Reference< css::container::XNameAccess > > m_xGenericUICommands
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager
void impl_fillElements(const char *_pName)
std::map< LanguageTag, UICommandsHashMap > m_aUICommandsHashMap
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
void ensureGenericUICommandsForLanguage(const LanguageTag &rLanguage)
static OUString getProductName()
int nCount
float u
OUString sName
css::uno::Reference< css::uno::XComponentContext > m_xContext
OUString aName
uno_Any a
void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
DECL_LISTENERMULTIPLEXER_END void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
Sequence< sal_Int8 > aSeq
aStr
OString stripEnd(const OString &rIn, char c)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
Type
constexpr OUStringLiteral UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST
properties for "UICommandDescription" class
Definition: properties.h:65
constexpr OUStringLiteral UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST
Definition: properties.h:67
constexpr OUStringLiteral UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST
Definition: properties.h:66
int i
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
unsigned char sal_Bool
OUString aCommandName
Reference< XMultiServiceFactory > m_xConfigProvider
Sequence< OUString > m_aCommandMirrorImageList
Reference< XNameAccess > m_xConfigAccessPopups
CommandToInfoCache m_aCmdInfoCache
Sequence< OUString > m_aCommandImageList
const sal_Int32 COMMAND_PROPERTY_ROTATE
std::mutex m_aMutex
OUString aTargetURL
Reference< XContainerListener > m_xConfigAccessListener
Reference< XNameAccess > m_xGenericUICommands
bool m_bGenericDataRetrieved
const char CONFIGURATION_ROOT_ACCESS[]
OUString m_aConfigPopupAccess
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_UICommandDescription_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Reference< XContainerListener > m_xConfigListener
OUString m_aPropProperties
sal_Int32 nProperties
bool bIsExperimental
OUString aLabel
Sequence< OUString > m_aCommandRotateImageList
bool m_bConfigAccessInitialized
OUString m_aConfigCmdAccess
Reference< XNameAccess > m_xConfigAccess
OUString aTooltipLabel
bool m_bCacheFilled
OUString aContextLabel
const sal_Int32 COMMAND_PROPERTY_IMAGE
constexpr OUStringLiteral PRIVATE_RESOURCE_URL
const sal_Int32 COMMAND_PROPERTY_MIRROR
bool bPopup
OUString aPopupLabel
bool bCommandNameCreated