2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-09-20 09:11:17 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 20:27:51 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
2008-04-10 20:27:51 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
2008-04-10 20:27:51 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
2008-04-10 20:27:51 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
2008-04-10 20:27:51 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
2008-04-10 20:27:51 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-09-20 09:11:17 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2010-04-16 23:00:12 +02:00
|
|
|
#include <svtools/acceleratorexecute.hxx>
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2005-03-01 18:51:32 +00:00
|
|
|
#include <com/sun/star/frame/XModuleManager.hpp>
|
2007-04-16 15:49:47 +00:00
|
|
|
#include <com/sun/star/frame/XDesktop.hpp>
|
2005-03-01 18:51:32 +00:00
|
|
|
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
|
2012-08-23 17:46:39 +02:00
|
|
|
#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
|
2005-03-01 18:51:32 +00:00
|
|
|
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
|
2007-04-16 15:49:47 +00:00
|
|
|
#include <com/sun/star/awt/XTopWindow.hpp>
|
2004-09-20 09:11:17 +00:00
|
|
|
#include <com/sun/star/awt/KeyModifier.hpp>
|
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
2006-02-07 09:24:45 +00:00
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
2012-06-01 15:15:25 +02:00
|
|
|
#include <com/sun/star/util/URLTransformer.hpp>
|
2007-04-16 15:49:47 +00:00
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
2012-06-01 15:15:25 +02:00
|
|
|
#include <comphelper/componentcontext.hxx>
|
2007-04-16 15:49:47 +00:00
|
|
|
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2010-10-16 03:20:00 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2007-04-16 15:49:47 +00:00
|
|
|
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2007-04-16 15:49:47 +00:00
|
|
|
namespace css = ::com::sun::star;
|
|
|
|
|
2004-09-20 09:11:17 +00:00
|
|
|
namespace svt
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2006-02-07 09:24:45 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
class SVT_DLLPRIVATE AsyncAccelExec
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//---------------------------------------
|
|
|
|
/** creates a new instance of this class, which can be used
|
|
|
|
one times only!
|
|
|
|
|
|
|
|
This instance can be forced to execute it's internal set request
|
|
|
|
asynchronous. After that it deletes itself !
|
|
|
|
*/
|
|
|
|
static AsyncAccelExec* createOnShotInstance(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
|
|
|
|
const css::util::URL& aURL );
|
|
|
|
|
|
|
|
void execAsync();
|
|
|
|
|
|
|
|
private:
|
|
|
|
//---------------------------------------
|
|
|
|
/** @short allow creation of instances of this class
|
|
|
|
by using our factory only!
|
|
|
|
*/
|
|
|
|
SVT_DLLPRIVATE AsyncAccelExec(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
|
|
|
|
const css::util::URL& aURL );
|
|
|
|
|
|
|
|
DECL_DLLPRIVATE_LINK(impl_ts_asyncCallback, void*);
|
|
|
|
|
|
|
|
private:
|
|
|
|
::vcl::EventPoster m_aAsyncCallback;
|
|
|
|
css::uno::Reference< css::frame::XDispatch > m_xDispatch;
|
|
|
|
css::util::URL m_aURL;
|
|
|
|
};
|
|
|
|
|
2004-09-20 09:11:17 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
AcceleratorExecute::AcceleratorExecute()
|
|
|
|
: TMutexInit ( )
|
|
|
|
, m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
2006-06-19 20:18:54 +00:00
|
|
|
AcceleratorExecute::AcceleratorExecute(const AcceleratorExecute&)
|
2004-09-20 09:11:17 +00:00
|
|
|
: TMutexInit ( )
|
|
|
|
, m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback))
|
|
|
|
{
|
|
|
|
// copy construction sint supported in real ...
|
|
|
|
// but we need this ctor to init our async callback ...
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
AcceleratorExecute::~AcceleratorExecute()
|
|
|
|
{
|
|
|
|
// does nothing real
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
AcceleratorExecute* AcceleratorExecute::createAcceleratorHelper()
|
|
|
|
{
|
|
|
|
AcceleratorExecute* pNew = new AcceleratorExecute();
|
|
|
|
return pNew;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR,
|
|
|
|
const css::uno::Reference< css::frame::XFrame >& xEnv )
|
|
|
|
{
|
|
|
|
// SAFE -> ----------------------------------
|
|
|
|
::osl::ResettableMutexGuard aLock(m_aLock);
|
|
|
|
|
|
|
|
// take over the uno service manager
|
|
|
|
m_xSMGR = xSMGR;
|
|
|
|
|
|
|
|
// specify our internal dispatch provider
|
|
|
|
// frame or desktop?! => document or global config.
|
|
|
|
sal_Bool bDesktopIsUsed = sal_False;
|
|
|
|
m_xDispatcher = css::uno::Reference< css::frame::XDispatchProvider >(xEnv, css::uno::UNO_QUERY);
|
|
|
|
if (!m_xDispatcher.is())
|
|
|
|
{
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ------------------------------
|
|
|
|
|
|
|
|
css::uno::Reference< css::frame::XDispatchProvider > xDispatcher(
|
2010-11-18 18:47:55 -05:00
|
|
|
xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))),
|
2004-09-20 09:11:17 +00:00
|
|
|
css::uno::UNO_QUERY_THROW);
|
|
|
|
|
|
|
|
// SAFE -> ------------------------------
|
|
|
|
aLock.reset();
|
|
|
|
|
|
|
|
m_xDispatcher = xDispatcher;
|
|
|
|
bDesktopIsUsed = sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ----------------------------------
|
|
|
|
|
|
|
|
// open all needed configuration objects
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg;
|
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg;
|
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg ;
|
2004-09-20 09:11:17 +00:00
|
|
|
|
|
|
|
// global cfg
|
|
|
|
xGlobalCfg = AcceleratorExecute::st_openGlobalConfig(xSMGR);
|
|
|
|
if (!bDesktopIsUsed)
|
|
|
|
{
|
|
|
|
// module cfg
|
|
|
|
xModuleCfg = AcceleratorExecute::st_openModuleConfig(xSMGR, xEnv);
|
|
|
|
|
|
|
|
// doc cfg
|
|
|
|
css::uno::Reference< css::frame::XController > xController;
|
|
|
|
css::uno::Reference< css::frame::XModel > xModel;
|
|
|
|
xController = xEnv->getController();
|
|
|
|
if (xController.is())
|
|
|
|
xModel = xController->getModel();
|
|
|
|
if (xModel.is())
|
|
|
|
xDocCfg = AcceleratorExecute::st_openDocConfig(xModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
// SAFE -> ------------------------------
|
|
|
|
aLock.reset();
|
|
|
|
|
|
|
|
m_xGlobalCfg = xGlobalCfg;
|
|
|
|
m_xModuleCfg = xModuleCfg;
|
|
|
|
m_xDocCfg = xDocCfg ;
|
|
|
|
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ----------------------------------
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
sal_Bool AcceleratorExecute::execute(const KeyCode& aVCLKey)
|
|
|
|
{
|
|
|
|
css::awt::KeyEvent aAWTKey = AcceleratorExecute::st_VCLKey2AWTKey(aVCLKey);
|
|
|
|
return execute(aAWTKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
sal_Bool AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey)
|
|
|
|
{
|
|
|
|
::rtl::OUString sCommand = impl_ts_findCommand(aAWTKey);
|
|
|
|
|
|
|
|
// No Command found? Do nothing! User isnt interested on any error handling .-)
|
2012-01-13 19:13:55 -02:00
|
|
|
if (sCommand.isEmpty())
|
2004-09-20 09:11:17 +00:00
|
|
|
return sal_False;
|
|
|
|
|
|
|
|
// SAFE -> ----------------------------------
|
|
|
|
::osl::ResettableMutexGuard aLock(m_aLock);
|
|
|
|
|
2005-01-21 16:28:51 +00:00
|
|
|
css::uno::Reference< css::frame::XDispatchProvider > xProvider = m_xDispatcher;
|
2004-09-20 09:11:17 +00:00
|
|
|
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ----------------------------------
|
|
|
|
|
2005-01-21 16:28:51 +00:00
|
|
|
// convert command in URL structure
|
|
|
|
css::uno::Reference< css::util::XURLTransformer > xParser = impl_ts_getURLParser();
|
|
|
|
css::util::URL aURL;
|
|
|
|
aURL.Complete = sCommand;
|
|
|
|
xParser->parseStrict(aURL);
|
|
|
|
|
|
|
|
// ask for dispatch object
|
|
|
|
css::uno::Reference< css::frame::XDispatch > xDispatch = xProvider->queryDispatch(aURL, ::rtl::OUString(), 0);
|
2006-07-19 16:06:13 +00:00
|
|
|
sal_Bool bRet = xDispatch.is();
|
|
|
|
if ( bRet )
|
2005-01-21 16:28:51 +00:00
|
|
|
{
|
2006-02-07 09:24:45 +00:00
|
|
|
// Note: Such instance can be used one times only and destroy itself afterwards .-)
|
|
|
|
AsyncAccelExec* pExec = AsyncAccelExec::createOnShotInstance(xDispatch, aURL);
|
|
|
|
pExec->execAsync();
|
2005-01-21 16:28:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
2004-09-20 09:11:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
css::awt::KeyEvent AcceleratorExecute::st_VCLKey2AWTKey(const KeyCode& aVCLKey)
|
|
|
|
{
|
|
|
|
css::awt::KeyEvent aAWTKey;
|
|
|
|
aAWTKey.Modifiers = 0;
|
|
|
|
aAWTKey.KeyCode = (sal_Int16)aVCLKey.GetCode();
|
|
|
|
|
|
|
|
if (aVCLKey.IsShift())
|
|
|
|
aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT;
|
|
|
|
if (aVCLKey.IsMod1())
|
|
|
|
aAWTKey.Modifiers |= css::awt::KeyModifier::MOD1;
|
|
|
|
if (aVCLKey.IsMod2())
|
|
|
|
aAWTKey.Modifiers |= css::awt::KeyModifier::MOD2;
|
2009-04-12 04:24:43 +00:00
|
|
|
if (aVCLKey.IsMod3())
|
|
|
|
aAWTKey.Modifiers |= css::awt::KeyModifier::MOD3;
|
2004-09-20 09:11:17 +00:00
|
|
|
return aAWTKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey)
|
|
|
|
{
|
|
|
|
sal_Bool bShift = ((aAWTKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT );
|
|
|
|
sal_Bool bMod1 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 );
|
|
|
|
sal_Bool bMod2 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 );
|
2009-04-12 04:24:43 +00:00
|
|
|
sal_Bool bMod3 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 );
|
2010-11-05 10:31:15 +08:00
|
|
|
sal_uInt16 nKey = (sal_uInt16)aAWTKey.KeyCode;
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2009-04-12 04:24:43 +00:00
|
|
|
return KeyCode(nKey, bShift, bMod1, bMod2, bMod3);
|
2004-09-20 09:11:17 +00:00
|
|
|
}
|
2007-07-06 09:06:05 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
::rtl::OUString AcceleratorExecute::findCommand(const css::awt::KeyEvent& aKey)
|
|
|
|
{
|
|
|
|
return impl_ts_findCommand(aKey);
|
|
|
|
}
|
2004-09-20 09:11:17 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
::rtl::OUString AcceleratorExecute::impl_ts_findCommand(const css::awt::KeyEvent& aKey)
|
|
|
|
{
|
|
|
|
// SAFE -> ----------------------------------
|
|
|
|
::osl::ResettableMutexGuard aLock(m_aLock);
|
|
|
|
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xGlobalCfg = m_xGlobalCfg;
|
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xModuleCfg = m_xModuleCfg;
|
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg = m_xDocCfg ;
|
2004-09-20 09:11:17 +00:00
|
|
|
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ----------------------------------
|
|
|
|
|
|
|
|
::rtl::OUString sCommand;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (xDocCfg.is())
|
|
|
|
sCommand = xDocCfg->getCommandByKeyEvent(aKey);
|
2012-01-13 19:13:55 -02:00
|
|
|
if (!sCommand.isEmpty())
|
2004-09-20 09:11:17 +00:00
|
|
|
return sCommand;
|
|
|
|
}
|
|
|
|
catch(const css::container::NoSuchElementException&)
|
|
|
|
{}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (xModuleCfg.is())
|
|
|
|
sCommand = xModuleCfg->getCommandByKeyEvent(aKey);
|
2012-01-13 19:13:55 -02:00
|
|
|
if (!sCommand.isEmpty())
|
2004-09-20 09:11:17 +00:00
|
|
|
return sCommand;
|
|
|
|
}
|
|
|
|
catch(const css::container::NoSuchElementException&)
|
|
|
|
{}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (xGlobalCfg.is())
|
|
|
|
sCommand = xGlobalCfg->getCommandByKeyEvent(aKey);
|
2012-01-13 19:13:55 -02:00
|
|
|
if (!sCommand.isEmpty())
|
2004-09-20 09:11:17 +00:00
|
|
|
return sCommand;
|
|
|
|
}
|
|
|
|
catch(const css::container::NoSuchElementException&)
|
|
|
|
{}
|
|
|
|
|
2008-05-30 06:33:46 +00:00
|
|
|
// fall back to functional key codes
|
|
|
|
if( aKey.Modifiers == 0 )
|
|
|
|
{
|
|
|
|
switch( aKey.KeyCode )
|
|
|
|
{
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfLine" ) );
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfLine" ) );
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfPara" ) );
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfPara" ) );
|
|
|
|
case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfWord" ) );
|
|
|
|
case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfWord" ) );
|
|
|
|
case com::sun::star::awt::Key::INSERT_LINEBREAK:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertLinebreak" ) );
|
|
|
|
case com::sun::star::awt::Key::INSERT_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToPrevWord" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToNextWord" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfPara" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfPara" ) );
|
2009-01-02 15:26:18 +00:00
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc" ) );
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc" ) );
|
2008-05-30 06:33:46 +00:00
|
|
|
case com::sun::star::awt::Key::SELECT_BACKWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharLeftSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_FORWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharRightSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:WordLeftSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:WordRightSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectWord" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_LINE:
|
2010-11-18 18:47:55 -05:00
|
|
|
return rtl::OUString();
|
2008-05-30 06:33:46 +00:00
|
|
|
case com::sun::star::awt::Key::SELECT_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectText" ) );
|
2009-01-02 15:26:18 +00:00
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfLineSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfLineSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfParaSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfParaSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfDocumentSel" ) );
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfDocumentSel" ) );
|
2008-05-30 06:33:46 +00:00
|
|
|
case com::sun::star::awt::Key::SELECT_ALL:
|
|
|
|
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectAll" ) );
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-20 09:11:17 +00:00
|
|
|
return ::rtl::OUString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openGlobalConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
|
2004-09-20 09:11:17 +00:00
|
|
|
{
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg(
|
2010-11-18 18:47:55 -05:00
|
|
|
xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.GlobalAcceleratorConfiguration" ))),
|
2004-09-20 09:11:17 +00:00
|
|
|
css::uno::UNO_QUERY_THROW);
|
|
|
|
return xAccCfg;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openModuleConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
|
2004-09-20 09:11:17 +00:00
|
|
|
const css::uno::Reference< css::frame::XFrame >& xFrame)
|
|
|
|
{
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::frame::XModuleManager > xModuleDetection(
|
2010-11-18 18:47:55 -05:00
|
|
|
xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))),
|
2004-09-20 09:11:17 +00:00
|
|
|
css::uno::UNO_QUERY_THROW);
|
|
|
|
|
|
|
|
::rtl::OUString sModule;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sModule = xModuleDetection->identify(xFrame);
|
|
|
|
}
|
2009-05-19 09:31:27 +00:00
|
|
|
catch(const css::uno::RuntimeException&rEx)
|
|
|
|
{ (void) rEx; throw; }
|
2004-09-20 09:11:17 +00:00
|
|
|
catch(const css::uno::Exception&)
|
2005-03-01 18:51:32 +00:00
|
|
|
{ return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); }
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier(
|
2012-08-23 17:46:39 +02:00
|
|
|
css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::ComponentContext(xSMGR).getUNOContext()) );
|
2004-09-20 09:11:17 +00:00
|
|
|
|
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
2009-06-16 16:15:54 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule);
|
|
|
|
xAccCfg = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
|
|
|
|
}
|
|
|
|
catch(const css::container::NoSuchElementException&)
|
|
|
|
{}
|
2004-09-20 09:11:17 +00:00
|
|
|
return xAccCfg;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
2005-03-01 18:51:32 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel)
|
2004-09-20 09:11:17 +00:00
|
|
|
{
|
2007-05-22 18:34:17 +00:00
|
|
|
css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg;
|
|
|
|
css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xUISupplier(xModel, css::uno::UNO_QUERY);
|
|
|
|
if (xUISupplier.is())
|
|
|
|
{
|
|
|
|
css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager();
|
|
|
|
xAccCfg.set(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
|
|
|
|
}
|
2004-09-20 09:11:17 +00:00
|
|
|
return xAccCfg;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_getURLParser()
|
|
|
|
{
|
|
|
|
// SAFE -> ----------------------------------
|
|
|
|
::osl::ResettableMutexGuard aLock(m_aLock);
|
|
|
|
|
|
|
|
if (m_xURLParser.is())
|
|
|
|
return m_xURLParser;
|
|
|
|
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
|
|
|
|
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ----------------------------------
|
|
|
|
|
|
|
|
css::uno::Reference< css::util::XURLTransformer > xParser(
|
2012-06-01 15:15:25 +02:00
|
|
|
css::util::URLTransformer::create( ::comphelper::ComponentContext(xSMGR).getUNOContext() ) );
|
2004-09-20 09:11:17 +00:00
|
|
|
|
|
|
|
// SAFE -> ----------------------------------
|
|
|
|
aLock.reset();
|
|
|
|
m_xURLParser = xParser;
|
|
|
|
aLock.clear();
|
|
|
|
// <- SAFE ----------------------------------
|
|
|
|
|
|
|
|
return xParser;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AcceleratorExecute, impl_ts_asyncCallback)
|
2004-09-20 09:11:17 +00:00
|
|
|
{
|
2006-02-07 09:24:45 +00:00
|
|
|
// replaced by AsyncAccelExec!
|
|
|
|
return 0;
|
|
|
|
}
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2006-02-07 09:24:45 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
AsyncAccelExec::AsyncAccelExec(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
|
|
|
|
const css::util::URL& aURL )
|
|
|
|
: m_aAsyncCallback(LINK(this, AsyncAccelExec, impl_ts_asyncCallback))
|
|
|
|
, m_xDispatch (xDispatch )
|
|
|
|
, m_aURL (aURL )
|
|
|
|
{
|
|
|
|
}
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2006-02-07 09:24:45 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
AsyncAccelExec* AsyncAccelExec::createOnShotInstance(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
|
|
|
|
const css::util::URL& aURL )
|
|
|
|
{
|
|
|
|
AsyncAccelExec* pExec = new AsyncAccelExec(xDispatch, aURL);
|
|
|
|
return pExec;
|
|
|
|
}
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2006-02-07 09:24:45 +00:00
|
|
|
//-----------------------------------------------
|
|
|
|
void AsyncAccelExec::execAsync()
|
|
|
|
{
|
|
|
|
m_aAsyncCallback.Post(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
2006-06-19 20:18:54 +00:00
|
|
|
IMPL_LINK(AsyncAccelExec, impl_ts_asyncCallback, void*,)
|
2006-02-07 09:24:45 +00:00
|
|
|
{
|
|
|
|
if (! m_xDispatch.is())
|
|
|
|
return 0;
|
2004-09-20 09:11:17 +00:00
|
|
|
|
2005-01-21 16:28:51 +00:00
|
|
|
try
|
|
|
|
{
|
2006-02-07 09:24:45 +00:00
|
|
|
m_xDispatch->dispatch(m_aURL, css::uno::Sequence< css::beans::PropertyValue >());
|
2005-01-21 16:28:51 +00:00
|
|
|
}
|
2006-02-07 09:24:45 +00:00
|
|
|
catch(const css::lang::DisposedException&)
|
|
|
|
{}
|
2009-06-03 11:26:39 +00:00
|
|
|
catch(const css::uno::RuntimeException& )
|
|
|
|
{ throw; }
|
2005-01-21 16:28:51 +00:00
|
|
|
catch(const css::uno::Exception&)
|
2006-02-07 09:24:45 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
delete this;
|
2004-09-20 09:11:17 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace svt
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|