/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include namespace vcl { struct MnemonicEngine_Data { IMnemonicEntryList& rEntryList; explicit MnemonicEngine_Data( IMnemonicEntryList& _rEntryList ) :rEntryList( _rEntryList ) { } }; namespace { const void* lcl_getEntryForMnemonic( IMnemonicEntryList const & _rEntryList, sal_Unicode _cMnemonic, bool& _rbAmbiguous ) { _rbAmbiguous = false; const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); OUString sEntryText; const void* pSearchEntry = _rEntryList.FirstSearchEntry( sEntryText ); const void* pFirstFoundEntry = nullptr; bool bCheckingAmbiguity = false; const void* pStartedWith = pSearchEntry; while ( pSearchEntry ) { if ( rI18nHelper.MatchMnemonic( sEntryText, _cMnemonic ) ) { if ( bCheckingAmbiguity ) { // that's the second (at least) entry with this mnemonic _rbAmbiguous = true; return pFirstFoundEntry; } pFirstFoundEntry = pSearchEntry; bCheckingAmbiguity = true; } pSearchEntry = _rEntryList.NextSearchEntry( pSearchEntry, sEntryText ); if ( pSearchEntry == pStartedWith ) break; } return pFirstFoundEntry; } } MnemonicEngine::MnemonicEngine( IMnemonicEntryList& _rEntryList ) :m_pData( new MnemonicEngine_Data( _rEntryList ) ) { } bool MnemonicEngine::HandleKeyEvent( const KeyEvent& _rKEvt ) { bool bAccelKey = _rKEvt.GetKeyCode().IsMod2(); if ( !bAccelKey ) return false; sal_Unicode cChar = _rKEvt.GetCharCode(); bool bAmbiguous = false; const void* pEntry = lcl_getEntryForMnemonic( m_pData->rEntryList, cChar, bAmbiguous ); if ( !pEntry ) return false; m_pData->rEntryList.SelectSearchEntry( pEntry ); if ( !bAmbiguous ) m_pData->rEntryList.ExecuteSearchEntry( pEntry ); // handled return true; } MnemonicEngine::~MnemonicEngine() { } } // namespace vcl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ alue='distro/collabora/cp-5.3-desktop'>distro/collabora/cp-5.3-desktop LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-11-19tdf#42949 Fix IWYU warnings in include/vcl/[ab]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: If18c80fc64e55d797953e24e40e5d5e62bd9c625 Reviewed-on: https://gerrit.libreoffice.org/63453 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-18Simplify containers iterations in svx/source/[s-u]*Arkadiy Illarionov
Use range-based loop or replace with STL functions Change-Id: I2ec3e58cc46c9286ef863c732912ca7a729bab62 Reviewed-on: https://gerrit.libreoffice.org/63522 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-15loplugin:staticmethods in vclNoel Grandin
Change-Id: I00333677db711761510a35dfae5ce70d61fb9491 Reviewed-on: https://gerrit.libreoffice.org/63397 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-20return weld widgets by std::unique_ptr from builderNoel Grandin
Change-Id: I20c007b13dae2d1155034711ad1ad48bfdfd0ba8 Reviewed-on: https://gerrit.libreoffice.org/59288 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-20weld SvxColorTabPageCaolán McNamara
Change-Id: I5dc6f949edcb34aa110dfa9415e2ac886d0dfa4c Reviewed-on: https://gerrit.libreoffice.org/56111 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-05-28weld ScTabBgColorDlgCaolán McNamara
Change-Id: I864382bc55dead850c13faae9958fb660fd4f156 Reviewed-on: https://gerrit.libreoffice.org/54809 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-21loplugin:changetoolsgen in svxNoel Grandin
and fix the regex in the plugin for matching += operator Change-Id: I26b3e3fac1d4ef3e756cc9431b983b5f27ee76d6 Reviewed-on: https://gerrit.libreoffice.org/50037 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-17tdf#106458 Color widget should have same number of rowsMaxim Monastirsky
... across different platforms/themes, so the standard palette will always fit without a scrollbar. For this, we must not hardcode some arbitrary fixed size, but calculate the size based on the number of rows of the standard palette. Change-Id: Ica1d615b43b350aece6b2c29a73337439dd05ac6
2017-02-14Convert WindowType to scoped enumNoel Grandin
Change-Id: I85cfe02f28729e13f2c0dd3d91cd89e6f3e3b6a9 Reviewed-on: https://gerrit.libreoffice.org/34219 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-08tdf#91222 VclBuilder constructor cleanupmelikeyurtoglu
Change-Id: I2f7e2fd8b9ae45e1aa45cf97750a6107ed9f3036 Signed-off-by: melikeyurtoglu <aysemelikeyurtoglu@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/30673 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-03-01loplugin:unuseddefaultparam in svx (part1)Noel Grandin
Change-Id: I0fc8d00447491e8474508952c21d07aa22b6f055
2015-05-12Switch VclBuilder constructors to use VclPtr.Michael Meeks
Change-Id: Id35a86eb52bbde6ca09a5e61a0b1a79b23be8faf
2015-05-11Revert "Switch VclBuilder constructors to use VclPtr."Michael Meeks
Behaves oddly; not ready yet. This reverts commit 9f016bd69422bdfb4cf7c4f5e57356eb98db2d8c. Change-Id: I30d746eac29d1dbe78d3072b10d2e22c051e3f4e
2015-05-11Switch VclBuilder constructors to use VclPtr.Michael Meeks
Change-Id: Id35a86eb52bbde6ca09a5e61a0b1a79b23be8faf
2015-05-11tdf#91052 - more macros for 'make' constructors.Michael Meeks
Change-Id: Iece86485c52041b66cde91d7fbc772db16d90a93
2015-04-23loplugin:staticmethodsNoel Grandin
Change-Id: I6207b475127099872c6f3764331006688129b673
2015-02-14related tdf#89004 move to std:set instead of std::vectorUrsache Vladimir
Conflicts: sc/source/core/data/document10.cxx sw/source/core/doc/docfmt.cxx Change-Id: I1312f476607ea3a78b162a7e59323b0a142f6629
2014-12-22callcatcher: update unused codeCaolán McNamara
Change-Id: I62e49fbf27364bd244099a9bb247452d5a691119
2014-11-07Fix fdo#84574 - COLOR PICKER: Palette color list should have scrollbarJuergen Funk
Change-Id: Ib927d3e1b1349f9a1b5f575180d217fe31f1f11f Reviewed-on: https://gerrit.libreoffice.org/12296 Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com> Tested-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
2014-10-28Rename loadColorVector to addEntriesForColorVectorMaxim Monastirsky
So it will be similar to addEntriesForXColorList Change-Id: Ie352e0cf05fa6875ed76e69478131a57293b39a1
2014-09-29cppcheck: Prefer prefix ++/-- operators for non-primitive typesJulien Nabet
Change-Id: I01999bc1283024bc4a1c380fd765a64b2da8a16a
2014-09-23fdo#82577: Handle WindowNoel Grandin
Put the VCL Window class in the vcl namespace. Avoids clash with the X11 Window typedef. Change-Id: Ib1beb7ab4ad75562a42aeb252732a073d25eff1a
2014-09-17Add loading .soc palettesKrisztian Pinter
Change-Id: Ie0d084a70d9b135658840bb7529f2099a702d280
2014-09-17Add PaletteManager, refactor palette codeKrisztian Pinter
Change-Id: I7e30fc895834318514b51bc648d32aa6d297bfae
2014-09-17Add GIMP palette loading codeKrisztian Pinter
Change-Id: Ie0d0787342bc806a1848cb904114f0ca16c9df69
2014-09-17Code cleanupKrisztian Pinter
Change-Id: Ib452a5cd716ef243e04f498d2fa23d0d389865c0
2014-09-17Add ability to switch between default and document colorsKrisztian Pinter
Change-Id: Ice8d58028a531b37d2c03fdc3e55eea850c53d44