1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_ 25 #define __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_ 26 27 /** Attention: stl headers must(!) be included at first. Otherwise it can make trouble 28 with solaris headers ... 29 */ 30 #include <vector> 31 #include <list> 32 #include <hash_map> 33 34 //_________________________________________________________________________________________________________________ 35 // my own includes 36 //_________________________________________________________________________________________________________________ 37 #include <threadhelp/threadhelpbase.hxx> 38 #include <macros/generic.hxx> 39 #include <macros/xinterface.hxx> 40 #include <macros/xtypeprovider.hxx> 41 #include <macros/xserviceinfo.hxx> 42 #include <stdtypes.h> 43 44 //_________________________________________________________________________________________________________________ 45 // interface includes 46 //_________________________________________________________________________________________________________________ 47 #include <com/sun/star/lang/XServiceInfo.hpp> 48 #include <com/sun/star/lang/XTypeProvider.hpp> 49 #include <com/sun/star/container/XNameAccess.hpp> 50 #include <com/sun/star/frame/XModuleManager.hpp> 51 52 //_________________________________________________________________________________________________________________ 53 // other includes 54 //_________________________________________________________________________________________________________________ 55 #include <cppuhelper/implbase2.hxx> 56 #include <rtl/ustring.hxx> 57 58 namespace framework 59 { 60 class UICommandDescription : private ThreadHelpBase , // Struct for right initialization of mutex member! Must be first of baseclasses. 61 public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo , 62 com::sun::star::container::XNameAccess > 63 { 64 public: 65 UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 66 virtual ~UICommandDescription(); 67 68 // XInterface, XTypeProvider, XServiceInfo 69 DECLARE_XSERVICEINFO 70 private: 71 // XNameAccess 72 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ); 73 74 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(); 75 76 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ); 77 78 // XElementAccess 79 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(); 80 virtual sal_Bool SAL_CALL hasElements(); 81 82 public: 83 typedef ::std::hash_map< ::rtl::OUString, 84 ::rtl::OUString, 85 rtl::OUStringHash, 86 ::std::equal_to< ::rtl::OUString > > ModuleToCommandFileMap; 87 88 typedef ::std::hash_map< ::rtl::OUString, 89 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >, 90 rtl::OUStringHash, 91 ::std::equal_to< ::rtl::OUString > > UICommandsHashMap; 92 93 protected: 94 UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); 95 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName); 96 void impl_fillElements(const sal_Char* _pName); 97 sal_Bool m_bConfigRead; 98 rtl::OUString m_aPrivateResourceURL; 99 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; 100 ModuleToCommandFileMap m_aModuleToCommandFileMap; 101 UICommandsHashMap m_aUICommandsHashMap; 102 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericUICommands; 103 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; 104 }; 105 106 } // namespace framework 107 108 #endif // __FRAMEWORK_SERVICES_UICOMMANDDESCRPTION_HXX_ 109