diff options
Diffstat (limited to 'cui/source/customize/acccfg.cxx')
-rw-r--r-- | cui/source/customize/acccfg.cxx | 273 |
1 files changed, 56 insertions, 217 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 13d5bff7e580..4b955b653cd4 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -34,10 +34,10 @@ #include <dialmgr.hxx> #include <sfx2/msg.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/app.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/minfitem.hxx> +#include <sfx2/sfxresid.hxx> #include <svl/stritem.hxx> #include <sal/macros.h> @@ -109,7 +109,7 @@ static ::rtl::OUString MEDIATYPE_PROPNAME (RTL_CONSTASCII_USTRINGP static ::rtl::OUString MEDIATYPE_UICONFIG (RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.xml.ui.configuration" )); //----------------------------------------------- -static USHORT KEYCODE_ARRAY[] = +static sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1 , KEY_F2 , @@ -616,7 +616,7 @@ static USHORT KEYCODE_ARRAY[] = KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2 }; -static USHORT KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY); +static sal_uInt16 KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY); //----------------------------------------------- // seems to be needed to layout the list box, which shows all @@ -633,20 +633,20 @@ class SfxAccCfgLBoxString_Impl : public SvLBoxString { public: SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, - USHORT nFlags, + sal_uInt16 nFlags, const String& sText ); virtual ~SfxAccCfgLBoxString_Impl(); virtual void Paint(const Point& aPos , SvLBox& rDevice, - USHORT nFlags , + sal_uInt16 nFlags , SvLBoxEntry* pEntry ); }; //----------------------------------------------- SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, - USHORT nFlags, + sal_uInt16 nFlags, const String& sText ) : SvLBoxString(pEntry, nFlags, sText) { @@ -660,7 +660,7 @@ SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl() //----------------------------------------------- void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos , SvLBox& rDevice, - USHORT /*nFlags*/, + sal_uInt16 /*nFlags*/, SvLBoxEntry* pEntry ) { @@ -695,8 +695,8 @@ void SfxAccCfgTabListBox_Impl::InitEntry( SvLBoxEntry* pEntry , void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey) { KeyCode aCode1 = aKey.GetKeyCode(); - USHORT nCode1 = aCode1.GetCode(); - USHORT nMod1 = aCode1.GetModifier(); + sal_uInt16 nCode1 = aCode1.GetCode(); + sal_uInt16 nMod1 = aCode1.GetModifier(); // is it related to our list box ? if ( @@ -714,8 +714,8 @@ void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey) TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); if (pUserData) { - USHORT nCode2 = pUserData->m_aKey.GetCode(); - USHORT nMod2 = pUserData->m_aKey.GetModifier(); + sal_uInt16 nCode2 = pUserData->m_aKey.GetCode(); + sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier(); if ( (nCode1 == nCode2) && (nMod1 == nMod2 ) @@ -759,7 +759,6 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt , aResetButton (this , CUI_RES(BTN_RESET )) , aLoadAccelConfigStr ( CUI_RES( STR_LOADACCELCONFIG ) ) , aSaveAccelConfigStr ( CUI_RES( STR_SAVEACCELCONFIG ) ) - , aFilterAllStr ( CUI_RES( STR_SFX_FILTERNAME_ALL ) ) , aFilterCfgStr ( CUI_RES( STR_FILTERNAME_CFG ) ) , m_bStylesInfoInitialized(sal_False) , m_xGlobal () @@ -768,6 +767,8 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt { FreeResource(); + aFilterAllStr = String( SfxResId( STR_SFX_FILTERNAME_ALL ) ); + // install handler functions aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl )); aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl )); @@ -782,7 +783,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); // initialize Entriesbox - aEntriesBox.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); + aEntriesBox.SetStyle(aEntriesBox.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); aEntriesBox.SetSelectionMode(SINGLE_SELECTION); aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT); aEntriesBox.Resize(); // OS: Hack for right selection @@ -791,7 +792,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt // detect max keyname width long nMaxWidth = 0; - for ( USHORT i = 0; i < KEYCODE_ARRAY_SIZE; ++i ) + for ( sal_uInt16 i = 0; i < KEYCODE_ARRAY_SIZE; ++i ) { long nTmp = GetTextWidth( KeyCode( KEYCODE_ARRAY[i] ).GetName() ); if ( nTmp > nMaxWidth ) @@ -806,7 +807,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt pGroupLBox->SetFunctionListBox(pFunctionBox); // initialize KeyBox - aKeyBox.SetWindowBits(WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); + aKeyBox.SetStyle(aKeyBox.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); } //----------------------------------------------- @@ -924,9 +925,9 @@ void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceler // Insert all editable accelerators into list box. It is possible // that some accelerators are not mapped on the current system/keyboard // but we don't want to lose these mappings. - USHORT c1 = KEYCODE_ARRAY_SIZE; - USHORT i1 = 0; - USHORT nListPos = 0; + sal_uInt16 c1 = KEYCODE_ARRAY_SIZE; + sal_uInt16 i1 = 0; + sal_uInt16 nListPos = 0; for (i1=0; i1<c1; ++i1) { KeyCode aKey = KEYCODE_ARRAY[i1]; @@ -942,7 +943,7 @@ void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceler css::uno::Sequence< css::awt::KeyEvent > lKeys = xAccMgr->getAllKeyEvents(); sal_Int32 c2 = lKeys.getLength(); sal_Int32 i2 = 0; - USHORT nCol = aEntriesBox.TabCount()-1; + sal_uInt16 nCol = aEntriesBox.TabCount()-1; for (i2=0; i2<c2; ++i2) { @@ -950,7 +951,7 @@ void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceler ::rtl::OUString sCommand = xAccMgr->getCommandByKeyEvent(aAWTKey); String sLabel = GetLabel4Command(sCommand); KeyCode aKeyCode = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey); - USHORT nPos = MapKeyCodeToPos(aKeyCode); + sal_uInt16 nPos = MapKeyCodeToPos(aKeyCode); if (nPos == LISTBOX_ENTRY_NOTFOUND) continue; @@ -966,12 +967,12 @@ void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceler } // Map the VCL hardcoded key codes and mark them as not changeable - ULONG c3 = Application::GetReservedKeyCodeCount(); - ULONG i3 = 0; + sal_uLong c3 = Application::GetReservedKeyCodeCount(); + sal_uLong i3 = 0; for (i3=0; i3<c3; ++i3) { const KeyCode* pKeyCode = Application::GetReservedKeyCode(i3); - USHORT nPos = MapKeyCodeToPos(*pKeyCode); + sal_uInt16 nPos = MapKeyCodeToPos(*pKeyCode); if (nPos == LISTBOX_ENTRY_NOTFOUND) continue; @@ -1051,10 +1052,10 @@ IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG) if (xReset.is()) xReset->reset(); - aEntriesBox.SetUpdateMode(FALSE); + aEntriesBox.SetUpdateMode(sal_False); ResetConfig(); Init(m_xAct); - aEntriesBox.SetUpdateMode(TRUE); + aEntriesBox.SetUpdateMode(sal_True); aEntriesBox.Invalidate(); aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); @@ -1064,7 +1065,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG) //----------------------------------------------- IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG ) { - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); + sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); String sNewCommand = pFunctionBox->GetCurCommand(); String sLabel = pFunctionBox->GetCurLabel(); @@ -1072,7 +1073,7 @@ IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG ) sLabel = GetLabel4Command(sNewCommand); pEntry->m_sCommand = sNewCommand; - USHORT nCol = aEntriesBox.TabCount() - 1; + sal_uInt16 nCol = aEntriesBox.TabCount() - 1; aEntriesBox.SetEntryText(sLabel, nPos, nCol); ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); @@ -1083,11 +1084,11 @@ IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG ) IMPL_LINK( SfxAcceleratorConfigPage, RemoveHdl, Button *, EMPTYARG ) { // get selected entry - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); + sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); // remove function name from selected entry - USHORT nCol = aEntriesBox.TabCount() - 1; + sal_uInt16 nCol = aEntriesBox.TabCount() - 1; aEntriesBox.SetEntryText( String(), nPos, nCol ); pEntry->m_sCommand = ::rtl::OUString(); @@ -1102,17 +1103,17 @@ IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) Help::ShowBalloon( this, Point(), String() ); if ( pListBox == &aEntriesBox ) { - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); + sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); - aRemoveButton.Enable( FALSE ); - aChangeButton.Enable( FALSE ); + aRemoveButton.Enable( sal_False ); + aChangeButton.Enable( sal_False ); if (pEntry->m_bIsConfigurable) { if (pEntry->isConfigured()) - aRemoveButton.Enable( TRUE ); + aRemoveButton.Enable( sal_True ); aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); } } @@ -1120,25 +1121,25 @@ IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) { pGroupLBox->GroupSelected(); if ( !pFunctionBox->FirstSelected() ) - aChangeButton.Enable( FALSE ); + aChangeButton.Enable( sal_False ); } else if ( pListBox == pFunctionBox ) { - aRemoveButton.Enable( FALSE ); - aChangeButton.Enable( FALSE ); + aRemoveButton.Enable( sal_False ); + aChangeButton.Enable( sal_False ); // #i36994 First selected can return zero! SvLBoxEntry* pLBEntry = aEntriesBox.FirstSelected(); if ( pLBEntry != 0 ) { - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( pLBEntry ); + sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( pLBEntry ); TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); if (pEntry->m_bIsConfigurable) { if (pEntry->isConfigured()) - aRemoveButton.Enable( TRUE ); + aRemoveButton.Enable( sal_True ); aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); } @@ -1151,9 +1152,9 @@ IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand ) { TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey); - SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, TRUE, LIST_APPEND ); + SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, sal_True, LIST_APPEND ); pE1->SetUserData(pU1); - pE1->EnableChildsOnDemand( FALSE ); + pE1->EnableChildsOnDemand( sal_False ); } pIt = aEntriesBox.Next(pIt); } @@ -1164,7 +1165,7 @@ IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) // goto selected "key" entry of the key box SvLBoxEntry* pE2 = 0; TAccInfo* pU2 = 0; - USHORT nP2 = LISTBOX_ENTRY_NOTFOUND; + sal_uInt16 nP2 = LISTBOX_ENTRY_NOTFOUND; SvLBoxEntry* pE3 = 0; pE2 = aKeyBox.FirstSelected(); @@ -1198,10 +1199,10 @@ IMPL_LINK( SfxAcceleratorConfigPage, RadioHdl, RadioButton *, EMPTYARG ) if ( m_xAct.is() && ( xOld == m_xAct ) ) return 0; - aEntriesBox.SetUpdateMode( FALSE ); + aEntriesBox.SetUpdateMode( sal_False ); ResetConfig(); Init(m_xAct); - aEntriesBox.SetUpdateMode( TRUE ); + aEntriesBox.SetUpdateMode( sal_True ); aEntriesBox.Invalidate(); pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName); @@ -1270,10 +1271,10 @@ IMPL_LINK( SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, EMPTYARG // open the configuration and update our UI css::uno::Reference< css::ui::XAcceleratorConfiguration > xTempAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); - aEntriesBox.SetUpdateMode(FALSE); + aEntriesBox.SetUpdateMode(sal_False); ResetConfig(); Init(xTempAccMgr); - aEntriesBox.SetUpdateMode(TRUE); + aEntriesBox.SetUpdateMode(sal_True); aEntriesBox.Invalidate(); aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); @@ -1404,134 +1405,6 @@ IMPL_LINK( SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, EMPTYARG return 0; } -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) -{ - ::rtl::OUString aLabel; - if ( aCmdURL.getLength() ) - { - try - { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription") ) ), uno::UNO_QUERY ); - if ( xNameAccess.is() ) - { - uno::Reference< container::XNameAccess > xUICommandLabels; - const ::rtl::OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); - uno::Any a = xNameAccess->getByName( aModule ); - uno::Reference< container::XNameAccess > xUICommands; - a >>= xUICommandLabels; - rtl::OUString aStr; - uno::Sequence< beans::PropertyValue > aPropSeq; - a = xUICommandLabels->getByName( aCmdURL ); - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); ++i ) - { - if ( aPropSeq[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ) )) - { - aPropSeq[i].Value >>= aStr; - break; - } - } - } - aLabel = aStr; - } - } - catch ( uno::Exception& ) - { - } - } - - return aLabel; -} - - -//----------------------------------------------- -String SfxAcceleratorConfigPage::GetFunctionName(KeyFuncType eType) const -{ - ::rtl::OUStringBuffer sName(256); - sName.appendAscii("\""); - switch(eType) - { - case KEYFUNC_NEW : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:NewDoc") ) ) ); - break; - - case KEYFUNC_OPEN : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open") ) ) ); - break; - - case KEYFUNC_SAVE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Save") ) ) ); - break; - - case KEYFUNC_SAVEAS : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAs") ) ) ); - break; - - case KEYFUNC_PRINT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Print") ) ) ); - break; - - case KEYFUNC_CLOSE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Close") ) ) ); - break; - - case KEYFUNC_QUIT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Quit") ) ) ); - break; - - case KEYFUNC_CUT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Cut") ) ) ); - break; - - case KEYFUNC_COPY : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Copy") ) ) ); - break; - - case KEYFUNC_PASTE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Paste") ) ) ); - break; - - case KEYFUNC_UNDO : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Undo") ) ) ); - break; - - case KEYFUNC_REDO : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Redo") ) ) ); - break; - - case KEYFUNC_DELETE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Delete") ) ) ); - break; - - case KEYFUNC_REPEAT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Repeat") ) ) ); - break; - - case KEYFUNC_FIND : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Search") ) ) ); - break; - - case KEYFUNC_FINDBACKWARD : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SearchBackwards") ) ) ); - break; - - case KEYFUNC_PROPERTIES : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Options") ) ) ); - break; - - case KEYFUNC_FRONT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:ToFront") ) ) ); - break; - - default: - break; - } - sName.appendAscii("\""); - return String(sName.makeStringAndClear()); -} - //----------------------------------------------- void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTitle ) { @@ -1552,7 +1425,7 @@ void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTi } //----------------------------------------------- -BOOL SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& ) +sal_Bool SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& ) { Apply(m_xAct); try @@ -1562,9 +1435,9 @@ BOOL SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& ) catch(const css::uno::RuntimeException& exRun) { throw exRun; } catch(const css::uno::Exception&) - { return FALSE; } + { return sal_False; } - return TRUE; + return sal_True; } //----------------------------------------------- @@ -1592,7 +1465,7 @@ void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet ) RadioHdl(0); const SfxPoolItem* pMacroItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, TRUE, &pMacroItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, sal_True, &pMacroItem ) ) { m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem ); pGroupLBox->SelectMacro( m_pMacroInfoItem ); @@ -1600,62 +1473,28 @@ void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet ) else { const SfxPoolItem* pStringItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, TRUE, &pStringItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, sal_True, &pStringItem ) ) m_pStringItem = PTR_CAST( SfxStringItem, pStringItem ); const SfxPoolItem* pFontItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, TRUE, &pFontItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, sal_True, &pFontItem ) ) m_pFontItem = PTR_CAST( SfxStringItem, pFontItem ); - - if ( m_pStringItem ) - pGroupLBox->AddAndSelect( m_pStringItem, m_pFontItem ); - } -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::SelectMacro(const SfxMacroInfoItem *pItem) -{ - m_pMacroInfoItem = pItem; - pGroupLBox->SelectMacro( pItem ); -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::CopySource2Target(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xSourceAccMgr, - const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xTargetAccMgr) -{ - const css::uno::Sequence< css::awt::KeyEvent > lKeys = xSourceAccMgr->getAllKeyEvents(); - sal_Int32 c = lKeys.getLength(); - sal_Int32 i = 0; - for (i=0; i<c; ++i) - { - const css::awt::KeyEvent& rKey = lKeys[i]; - ::rtl::OUString sCommand = xSourceAccMgr->getCommandByKeyEvent(rKey); - xTargetAccMgr->setKeyEvent(rKey, sCommand); } } //----------------------------------------------- -KeyCode SfxAcceleratorConfigPage::MapPosToKeyCode(USHORT nPos) const -{ - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - KeyCode aCode(KEYCODE_ARRAY[pEntry->m_nKeyPos] & 0xFFF , - KEYCODE_ARRAY[pEntry->m_nKeyPos] & (KEY_SHIFT | KEY_MOD2)); - return aCode; -} - -//----------------------------------------------- -USHORT SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const +sal_uInt16 SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const { - USHORT nCode1 = aKey.GetCode()+aKey.GetModifier(); + sal_uInt16 nCode1 = aKey.GetCode()+aKey.GetModifier(); SvLBoxEntry* pEntry = aEntriesBox.First(); - USHORT i = 0; + sal_uInt16 i = 0; while (pEntry) { TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); if (pUserData) { - USHORT nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier(); + sal_uInt16 nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier(); if (nCode1 == nCode2) return i; } |