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 #ifndef INCLUDED_unotools_ACCELCFG_HXX 24 #define INCLUDED_unotools_ACCELCFG_HXX 25 26 #include <com/sun/star/awt/KeyEvent.hpp> 27 #include <unotools/options.hxx> 28 29 #include <rtl/ustring.hxx> 30 #include <tools/stream.hxx> 31 32 struct SvtAcceleratorConfigItem 33 { 34 sal_uInt16 nCode; 35 sal_uInt16 nModifier; 36 ::rtl::OUString aCommand; 37 }; 38 39 #include <list> 40 typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList; 41 42 class SvStream; 43 class KeyEvent; 44 class String; 45 class SvtAcceleratorConfig_Impl; 46 47 class SvtAcceleratorConfiguration: public utl::detail::Options 48 { 49 SvtAcceleratorConfig_Impl* pImp; 50 51 private: 52 53 public: 54 // get the global accelerators 55 SvtAcceleratorConfiguration(); 56 57 // get special accelerators 58 static SvtAcceleratorConfiguration* CreateFromStream( SvStream& rStream ); 59 static String GetStreamName(); 60 static SvStream* GetDefaultStream( StreamMode ); 61 62 virtual ~SvtAcceleratorConfiguration(); 63 64 // save the configuration to a stream, f.e. into a document 65 bool Commit( SvStream& rStream ); 66 67 // returns the configured URL for a KeyEvent 68 ::rtl::OUString GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent ); 69 70 // returns the whole configuration 71 const SvtAcceleratorItemList& GetItems(); 72 73 // sets a single configuration item 74 void SetCommand( const SvtAcceleratorConfigItem& rItem ); 75 76 // sets several or all configuration items 77 // if bClear=sal_False, all items not in the sequence remain unchanged 78 void SetItems( const SvtAcceleratorItemList& rItems, bool bClear ); 79 }; 80 81 #endif 82