diff options
-rw-r--r-- | desktop/source/app/app.cxx | 6 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 4 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.hxx | 2 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 50 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.hxx | 10 | ||||
-rw-r--r-- | framework/inc/dispatch/dispatchprovider.hxx | 5 | ||||
-rw-r--r-- | framework/inc/dispatch/startmoduledispatcher.hxx | 200 | ||||
-rw-r--r-- | framework/inc/dispatchcommands.h | 55 | ||||
-rw-r--r-- | framework/source/dispatch/dispatchprovider.cxx | 42 | ||||
-rw-r--r-- | framework/source/dispatch/makefile.mk | 1 | ||||
-rw-r--r-- | framework/source/dispatch/startmoduledispatcher.cxx | 244 | ||||
-rw-r--r-- | framework/util/makefile.mk | 1 | ||||
-rw-r--r-- | sfx2/source/appl/app.hrc | 1 | ||||
-rw-r--r-- | sfx2/source/appl/app.src | 5 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/shutdowniconaqua.mm | 86 | ||||
-rw-r--r-- | svx/source/editeng/editeng.cxx | 20 | ||||
-rw-r--r-- | svx/source/editeng/impedit2.cxx | 52 |
19 files changed, 725 insertions, 73 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index ac3c8fe553..5a61893f56 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1604,12 +1604,12 @@ void Desktop::Main() } catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg) { - OfficeIPCThread::BlockAllRequests(); + OfficeIPCThread::SetDowning(); FatalError( MakeStartupErrorMessage(exFilterCfg.Message) ); } catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg) { - OfficeIPCThread::BlockAllRequests(); + OfficeIPCThread::SetDowning(); FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); } @@ -2438,6 +2438,8 @@ void Desktop::OpenClients() } } } + + OfficeIPCThread::EnableRequests(); sal_Bool bShutdown( sal_False ); if ( !pArgs->IsServer() ) diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 9f94e0e8df..cf82148130 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -132,7 +132,7 @@ DispatchWatcher::~DispatchWatcher() } -sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequestsList ) +sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequestsList, bool bNoTerminate ) { Reference< XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), @@ -442,7 +442,7 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch // No more asynchronous requests? // The requests are removed from the request container after they called back to this // implementation via statusChanged!! - if ( !m_nRequestCount /*m_aRequestContainer.empty()*/ ) + if ( !m_nRequestCount && ! bNoTerminate /*m_aRequestContainer.empty()*/ ) { // We have to check if we have an open task otherwise we have to shutdown the office. Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY ); diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 4eca139905..ef62dc2614 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -108,7 +108,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame: static DispatchWatcher* GetDispatchWatcher(); // execute new dispatch request - sal_Bool executeDispatchRequests( const DispatchList& aDispatches ); + sal_Bool executeDispatchRequests( const DispatchList& aDispatches, bool bNoTerminate = false ); private: DispatchWatcher(); diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 761014ace5..9e158b7030 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -349,7 +349,7 @@ throw( TerminationVetoException, RuntimeException ) if ( OfficeIPCThread::AreRequestsPending() ) throw TerminationVetoException(); else - OfficeIPCThread::BlockAllRequests(); + OfficeIPCThread::SetDowning(); } void SAL_CALL OfficeIPCThreadController::notifyTermination( const EventObject& ) @@ -372,7 +372,7 @@ throw( RuntimeException ) return *pOfficeIPCThreadMutex; } -void OfficeIPCThread::BlockAllRequests() +void OfficeIPCThread::SetDowning() { // We have the order to block all incoming requests. Framework // wants to shutdown and we have to make sure that no loading/printing @@ -380,7 +380,29 @@ void OfficeIPCThread::BlockAllRequests() ::osl::MutexGuard aGuard( GetMutex() ); if ( pGlobalOfficeIPCThread ) - pGlobalOfficeIPCThread->mbBlockRequests = sal_True; + pGlobalOfficeIPCThread->mbDowning = true; +} + +static bool s_bInEnableRequests = false; + +void OfficeIPCThread::EnableRequests( bool i_bEnable ) +{ + // switch between just queueing the requests and executing them + ::osl::MutexGuard aGuard( GetMutex() ); + + if ( pGlobalOfficeIPCThread ) + { + s_bInEnableRequests = true; + pGlobalOfficeIPCThread->mbRequestsEnabled = i_bEnable; + if( i_bEnable ) + { + // hit the compiler over the head + ProcessDocumentsRequest aEmptyReq = ProcessDocumentsRequest( boost::optional< rtl::OUString >() ); + // trigger already queued requests + OfficeIPCThread::ExecuteCmdLineRequests( aEmptyReq ); + } + s_bInEnableRequests = false; + } } sal_Bool OfficeIPCThread::AreRequestsPending() @@ -599,7 +621,8 @@ void OfficeIPCThread::DisableOfficeIPCThread() } OfficeIPCThread::OfficeIPCThread() : - mbBlockRequests( sal_False ), + mbDowning( false ), + mbRequestsEnabled( false ), mnPendingRequests( 0 ), mpDispatchWatcher( 0 ) { @@ -679,7 +702,7 @@ void SAL_CALL OfficeIPCThread::run() // is this a termination message ? if so, terminate if(( aArguments.CompareTo( sc_aTerminationSequence, sc_nTSeqLength ) == COMPARE_EQUAL ) || - mbBlockRequests ) return; + mbDowning ) return; String aEmpty; std::auto_ptr< CommandLineArgs > aCmdLineArgs; try @@ -927,9 +950,12 @@ static void AddToDispatchList( sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest ) { - ::rtl::OUString aEmpty; - DispatchWatcher::DispatchList aDispatchList; + // protect the dispatch list + osl::ClearableMutexGuard aGuard( GetMutex() ); + + static DispatchWatcher::DispatchList aDispatchList; + rtl::OUString aEmpty; // Create dispatch list for dispatch watcher AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aOpenList, DispatchWatcher::REQUEST_OPEN, aEmpty, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aViewList, DispatchWatcher::REQUEST_VIEW, aEmpty, aRequest.aModule ); @@ -939,11 +965,13 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceOpenList, DispatchWatcher::REQUEST_FORCEOPEN, aEmpty, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceNewList, DispatchWatcher::REQUEST_FORCENEW, aEmpty, aRequest.aModule ); - osl::ClearableMutexGuard aGuard( GetMutex() ); sal_Bool bShutdown( sal_False ); if ( pGlobalOfficeIPCThread ) { + if( ! pGlobalOfficeIPCThread->AreRequestsEnabled() ) + return bShutdown; + pGlobalOfficeIPCThread->mnPendingRequests += aDispatchList.size(); if ( !pGlobalOfficeIPCThread->mpDispatchWatcher ) { @@ -951,10 +979,14 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ pGlobalOfficeIPCThread->mpDispatchWatcher->acquire(); } + // copy for execute + DispatchWatcher::DispatchList aTempList( aDispatchList ); + aDispatchList.clear(); + aGuard.clear(); // Execute dispatch requests - bShutdown = pGlobalOfficeIPCThread->mpDispatchWatcher->executeDispatchRequests( aDispatchList ); + bShutdown = pGlobalOfficeIPCThread->mpDispatchWatcher->executeDispatchRequests( aTempList, s_bInEnableRequests ); // set processed flag if (aRequest.pcProcessed != NULL) diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index fba558c214..a2949b9742 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -57,7 +57,7 @@ class SalMainPipeExchangeSignalHandler : public vos::OSignalHandler struct ProcessDocumentsRequest { ProcessDocumentsRequest(boost::optional< rtl::OUString > const & cwdUrl): - aCwdUrl(cwdUrl) {} + aCwdUrl(cwdUrl), pcProcessed( NULL ) {} boost::optional< ::rtl::OUString > aCwdUrl; ::rtl::OUString aModule; @@ -82,7 +82,8 @@ class OfficeIPCThread : public vos::OThread vos::OPipe maPipe; vos::OStreamPipe maStreamPipe; rtl::OUString maPipeIdent; - sal_Bool mbBlockRequests; + bool mbDowning; + bool mbRequestsEnabled; int mnPendingRequests; DispatchWatcher* mpDispatchWatcher; @@ -119,7 +120,8 @@ class OfficeIPCThread : public vos::OThread virtual ~OfficeIPCThread(); // controlling pipe communication during shutdown - static void BlockAllRequests(); + static void SetDowning(); + static void EnableRequests( bool i_bEnable = true ); static sal_Bool AreRequestsPending(); static void RequestsCompleted( int n = 1 ); static sal_Bool ExecuteCmdLineRequests( ProcessDocumentsRequest& ); @@ -129,6 +131,8 @@ class OfficeIPCThread : public vos::OThread static void DisableOfficeIPCThread(); // start dispatching events... static void SetReady(OfficeIPCThread* pThread = NULL); + + bool AreRequestsEnabled() const { return mbRequestsEnabled && ! mbDowning; } }; diff --git a/framework/inc/dispatch/dispatchprovider.hxx b/framework/inc/dispatch/dispatchprovider.hxx index 52d44e0230..20f0d5becc 100644 --- a/framework/inc/dispatch/dispatchprovider.hxx +++ b/framework/inc/dispatch/dispatchprovider.hxx @@ -76,8 +76,6 @@ namespace framework{ @descr We know some special dispatch objects with diffrent functionality. The can be created internaly by the following DispatchProvider. Here we define some identifier to force creation of the right one. - - @modified 20.08.2003 08:34, as96863 */ enum EDispatchHelper { @@ -87,7 +85,8 @@ enum EDispatchHelper E_CREATEDISPATCHER , E_BLANKDISPATCHER , E_SELFDISPATCHER , - E_CLOSEDISPATCHER + E_CLOSEDISPATCHER , + E_STARTMODULEDISPATCHER }; //_________________________________________________________________________________________________________________ diff --git a/framework/inc/dispatch/startmoduledispatcher.hxx b/framework/inc/dispatch/startmoduledispatcher.hxx new file mode 100644 index 0000000000..4d084f9f2b --- /dev/null +++ b/framework/inc/dispatch/startmoduledispatcher.hxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: closedispatcher.hxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <vcl/evntpost.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//----------------------------------------------- +/** + @short helper to handle all URLs related to the StartModule + */ +class StartModuleDispatcher : public css::lang::XTypeProvider + , public css::frame::XNotifyingDispatch // => XDispatch + , public css::frame::XDispatchInformationProvider + // baseclasses ... order is neccessary for right initialization! + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + //--------------------------------------- + /** @short reference to an uno service manager, + which can be used to create own needed + uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //---------------------------------------
+ /** @short our "context" frame. */
+ css::uno::WeakReference< css::frame::XFrame > m_xOwner;
+ + //---------------------------------------
+ /** @short the original queryDispatch() target. */
+ ::rtl::OUString m_sDispatchTarget;
+
+ //--------------------------------------- + /** @short list of registered status listener */ + ListenerHash m_lStatusListener; + + //------------------------------------------- + // native interface + + public: + + //--------------------------------------- + /** @short connect a new StartModuleDispatcher instance to its "owner frame".
+ + @descr Such "owner frame" is used as context for all related operations. + + @param xSMGR + an uno service manager, which is needed to create uno resource + internaly. + + @param xFrame + the frame where the corresponding dispatch was started. + + @param sTarget + the original target information used for the related queryDispatch() call. + */ + StartModuleDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame , + const ::rtl::OUString& sTarget); + + //--------------------------------------- + /** @short does nothing real. */ + virtual ~StartModuleDispatcher(); + + //------------------------------------------- + // uno interface + + public: + + //--------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //--------------------------------------- + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) throw(css::uno::RuntimeException); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatchInformationProvider + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException); + + //------------------------------------------- + // internal helper + + private: +
+ //---------------------------------------
+ /** @short check if StartModule can be shown.
+ */ + ::sal_Bool implts_isBackingModePossible();
+ + //--------------------------------------- + /** @short open the special BackingComponent (now StartModule) + + @return [bool] + TRUE if operation was successfully. + */ + ::sal_Bool implts_establishBackingMode(); + + //--------------------------------------- + /** @short notify a DispatchResultListener. + + @descr We check the listener reference before we use it. + So this method can be called everytimes! + + @parama xListener + the listener, which should be notified. + Can be null! + + @param nState + directly used as css::frame::DispatchResultState value. + + @param aResult + not used yet realy ... + */ + void implts_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener, + sal_Int16 nState , + const css::uno::Any& aResult ); + +}; // class StartModuleDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_ diff --git a/framework/inc/dispatchcommands.h b/framework/inc/dispatchcommands.h new file mode 100644 index 0000000000..714558edc8 --- /dev/null +++ b/framework/inc/dispatchcommands.h @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: targets.h,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_DISPATCHCOMMANDS_H_ +#define __FRAMEWORK_DISPATCHCOMMANDS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +
+static ::rtl::OUString CMD_UNO_SHOWSTARTMODULE = ::rtl::OUString::createFromAscii(".uno:ShowStartModule");
+static ::rtl::OUString CMD_UNO_CLOSEDOC = ::rtl::OUString::createFromAscii(".uno:CloseDoc" ); +static ::rtl::OUString CMD_UNO_CLOSEWIN = ::rtl::OUString::createFromAscii(".uno:CloseWin" ); +static ::rtl::OUString CMD_UNO_CLOSEFRAME = ::rtl::OUString::createFromAscii(".uno:CloseFrame" );
+ +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCHCOMMANDS_H_ diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index 45a410f78d..3b3790d638 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -42,11 +42,13 @@ #include <dispatch/closedispatcher.hxx> #include <dispatch/menudispatcher.hxx> #include <dispatch/helpagentdispatcher.hxx> +#include <dispatch/startmoduledispatcher.hxx> #include <pattern/window.hxx> #include <threadhelp/transactionguard.hxx> #include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/writeguard.hxx>
+#include <dispatchcommands.h> #include <protocols.h> #include <services.h> #include <targets.h> @@ -222,6 +224,24 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Disp return lDispatcher; } +//_________________________________________________________________________________________________________________
+
+::sal_Bool lcl_isCloseDispatch (const css::util::URL& aURL)
+{
+ return (
+ (aURL.Complete.equals(CMD_UNO_CLOSEDOC )) || + (aURL.Complete.equals(CMD_UNO_CLOSEWIN )) || + (aURL.Complete.equals(CMD_UNO_CLOSEFRAME))
+ ); +}
+ +//_________________________________________________________________________________________________________________
+
+::sal_Bool lcl_isStartModuleDispatch (const css::util::URL& aURL)
+{
+ return (aURL.Complete.equals(CMD_UNO_SHOWSTARTMODULE));
+}
+
//_________________________________________________________________________________________________________________ /** @@ -276,7 +296,10 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDeskt if (sTargetFrameName==SPECIALTARGET_DEFAULT) { if (implts_isLoadableContent(aURL)) - xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, xDesktop ); + xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, xDesktop );
+
+ if (lcl_isStartModuleDispatch(aURL))
+ xDispatcher = implts_getOrCreateDispatchHelper( E_STARTMODULEDISPATCHER, xDesktop );
} //----------------------------------------------------------------------------------------------------- @@ -466,14 +489,8 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame ) { // There exist a hard coded interception for special URLs. - if ( - (aURL.Complete.equalsAscii(".uno:CloseDoc" )) || - (aURL.Complete.equalsAscii(".uno:CloseWin" )) || - (aURL.Complete.equalsAscii(".uno:CloseFrame")) - ) - { + if (lcl_isCloseDispatch (aURL)) xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame ); - } if ( ! xDispatcher.is()) { @@ -737,6 +754,13 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat CloseDispatcher* pDispatcher = new CloseDispatcher( xFactory, xOwner, sTarget ); xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); } + break;
+ + case E_STARTMODULEDISPATCHER : + { + StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( xFactory, xOwner, sTarget ); + xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY ); + } break; } diff --git a/framework/source/dispatch/makefile.mk b/framework/source/dispatch/makefile.mk index 6f551252cd..352aa66bfd 100644 --- a/framework/source/dispatch/makefile.mk +++ b/framework/source/dispatch/makefile.mk @@ -60,6 +60,7 @@ SLOFILES=\ $(SLO)$/servicehandler.obj \ $(SLO)$/systemexec.obj \ $(SLO)$/windowcommanddispatch.obj \ + $(SLO)$/startmoduledispatcher.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx new file mode 100644 index 0000000000..def4f785be --- /dev/null +++ b/framework/source/dispatch/startmoduledispatcher.cxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: closedispatcher.cxx,v $ + * $Revision: 1.22 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +#include <dispatch/startmoduledispatcher.hxx>
+
+//_______________________________________________ +// my own includes + +#include <pattern/frame.hxx> +#include <threadhelp/readguard.hxx> +#include <threadhelp/writeguard.hxx> +#include <classes/framelistanalyzer.hxx>
+#include <dispatchcommands.h> +#include <targets.h> +#include <services.h> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/CommandGroup.hpp> +#include <com/sun/star/awt/XTopWindow.hpp> +#include "com/sun/star/beans/XFastPropertySet.hpp" +#include <com/sun/star/frame/XModuleManager.hpp> + +//_______________________________________________ +// includes of other projects +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> +#include <svtools/moduleoptions.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +#ifdef fpf + #error "Who uses \"fpf\" as define. It will overwrite my namespace alias ..." +#endif +namespace fpf = ::framework::pattern::frame; + +//_______________________________________________ +// declarations + +DEFINE_XINTERFACE_4(StartModuleDispatcher , + OWeakObject , + DIRECT_INTERFACE(css::lang::XTypeProvider ), + DIRECT_INTERFACE(css::frame::XNotifyingDispatch ), + DIRECT_INTERFACE(css::frame::XDispatch ), + DIRECT_INTERFACE(css::frame::XDispatchInformationProvider)) + +// Note: XStatusListener is an implementation detail. Hide it for scripting! +DEFINE_XTYPEPROVIDER_4(StartModuleDispatcher , + css::lang::XTypeProvider , + css::frame::XDispatchInformationProvider, + css::frame::XNotifyingDispatch , + css::frame::XDispatch ) + +//----------------------------------------------- +StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame , + const ::rtl::OUString& sTarget) + : ThreadHelpBase (&Application::GetSolarMutex() ) + , ::cppu::OWeakObject( ) + , m_xSMGR (xSMGR )
+ , m_xOwner (xFrame )
+ , m_sDispatchTarget (sTarget ) + , m_lStatusListener (m_aLock.getShareableOslMutex()) +{ +} + +//----------------------------------------------- +StartModuleDispatcher::~StartModuleDispatcher() +{ +} + +//----------------------------------------------- +void SAL_CALL StartModuleDispatcher::dispatch(const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) + throw(css::uno::RuntimeException) +{ + dispatchWithNotification(aURL, lArguments, css::uno::Reference< css::frame::XDispatchResultListener >()); +} + +//----------------------------------------------- +void SAL_CALL StartModuleDispatcher::dispatchWithNotification(const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& /*lArguments*/, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) + throw(css::uno::RuntimeException) +{
+ ::sal_Int16 nResult = css::frame::DispatchResultState::DONTKNOW;
+ if (aURL.Complete.equals (CMD_UNO_SHOWSTARTMODULE))
+ {
+ nResult = css::frame::DispatchResultState::FAILURE;
+ if (implts_isBackingModePossible ())
+ {
+ if (implts_establishBackingMode ())
+ nResult = css::frame::DispatchResultState::SUCCESS; + }
+ }
+
+ implts_notifyResultListener(xListener, nResult, css::uno::Any()); +} + +//----------------------------------------------- +css::uno::Sequence< ::sal_Int16 > SAL_CALL StartModuleDispatcher::getSupportedCommandGroups() + throw(css::uno::RuntimeException) +{ + return css::uno::Sequence< ::sal_Int16 >(); +} + +//----------------------------------------------- +css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL StartModuleDispatcher::getConfigurableDispatchInformation(::sal_Int16 /*nCommandGroup*/) + throw(css::uno::RuntimeException) +{ + return css::uno::Sequence< css::frame::DispatchInformation >(); +} + +//----------------------------------------------- +void SAL_CALL StartModuleDispatcher::addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/, + const css::util::URL& /*aURL*/ ) + throw(css::uno::RuntimeException) +{ +} + +//----------------------------------------------- +void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/, + const css::util::URL& /*aURL*/ ) + throw(css::uno::RuntimeException) +{ +} + +//-----------------------------------------------
+::sal_Bool StartModuleDispatcher::implts_isBackingModePossible ()
+{
+ if ( ! SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE))
+ return sal_False;
+
+ // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + aReadLock.unlock(); + // <- SAFE ---------------------------------- +
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
+ xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+
+ FrameListAnalyzer aCheck(
+ xDesktop,
+ css::uno::Reference< css::frame::XFrame >(),
+ FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT);
+
+ ::sal_Bool bIsPossible = sal_False;
+ ::sal_Int32 nVisibleFrames = aCheck.m_lOtherVisibleFrames.getLength ();
+
+ if (
+ ( ! aCheck.m_xBackingComponent.is ()) &&
+ ( nVisibleFrames < 1 )
+ )
+ {
+ bIsPossible = sal_True;
+ }
+
+ return bIsPossible; +}
+ +//----------------------------------------------- +::sal_Bool StartModuleDispatcher::implts_establishBackingMode() +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + aReadLock.unlock(); + // <- SAFE ---------------------------------- +
+ css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->findFrame (SPECIALTARGET_BLANK, 0); + css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow ();
+ + css::uno::Sequence< css::uno::Any > lArgs(1); + lArgs[0] <<= xContainerWindow;
+ + css::uno::Reference< css::frame::XController > xStartModule(
+ xSMGR->createInstanceWithArguments(SERVICENAME_STARTMODULE, lArgs),
+ css::uno::UNO_QUERY_THROW); + + css::uno::Reference< css::awt::XWindow > xComponentWindow(xStartModule, css::uno::UNO_QUERY); + xFrame->setComponent(xComponentWindow, xStartModule); + xStartModule->attachFrame(xFrame); + xContainerWindow->setVisible(sal_True); + + return sal_True; +} + +//----------------------------------------------- +void StartModuleDispatcher::implts_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener, + ::sal_Int16 nState , + const css::uno::Any& aResult ) +{ + if ( ! xListener.is()) + return; + + css::frame::DispatchResultEvent aEvent( + css::uno::Reference< css::uno::XInterface >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), + nState, + aResult); + + xListener->dispatchFinished(aEvent); +}
+ +} // namespace framework diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 7f755a9528..f9244a9031 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -332,6 +332,7 @@ SHL4OBJS= \ $(SLO)$/windowcommanddispatch.obj \ $(SLO)$/windowstateconfiguration.obj \ $(SLO)$/windowcontentfactorymanager.obj + $(SLO)$/startmoduledispatcher.obj SHL4STDLIBS= \ $(FWILIB) \ diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index 27869b0d3b..eef1f64e39 100644 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -216,6 +216,7 @@ #define STR_HELP_MENU_TEXT_COPY (RID_SFX_APP_START+144) #define STR_QUICKSTART_PRELAUNCH_UNX (RID_SFX_APP_START+146) #define STR_QUICKSTART_FILE (RID_SFX_APP_START+147) +#define STR_QUICKSTART_STARTCENTER (RID_SFX_APP_START+148) #define RID_HELP_ONSTARTUP_BOX (RID_SFX_APP_START+144) #define RID_HELP_ONSTARTUP_TEXT (RID_SFX_APP_START+145) diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index 64af7744d7..f9a1caac74 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -1029,6 +1029,11 @@ String STR_QUICKSTART_FILE Text [ en-US ] = "File"; }; +String STR_QUICKSTART_STARTCENTER +{ + Text [ en-US ] = "Startcenter"; +}; + String STR_QUERY_UPDATE_LINKS { Text [ en-US ] = "Update all links?" ; diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 12fa73f436..3acd732095 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -680,19 +680,6 @@ void SAL_CALL ShutdownIcon::initialize( const ::com::sun::star::uno::Sequence< : ShutdownIcon::getInstance()->addTerminateListener(); } #endif -#ifdef OS2 - // above win32 starts the quickstart thread, but we have - // quickstart running only when -quickstart is specified - // on command line (next boot). - // so if -quickstart was not specified, we cannot issue - // quickstart veto on shutdown. - if (bQuickstart) - { - // disable shutdown - ShutdownIcon::getInstance()->SetVeto( true ); - ShutdownIcon::getInstance()->addTerminateListener(); - } -#endif } catch(const ::com::sun::star::lang::IllegalArgumentException&) { diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index dc29cfd83f..a1c836cbea 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -44,6 +44,7 @@ typedef ::cppu::WeakComponentImplHelper4< #define DRAW_URL "private:factory/sdraw" #define MATH_URL "private:factory/smath" #define BASE_URL "private:factory/sdatabase?Interactive" +#define STARTMODULE_URL ".uno:ShowStartModule" #endif class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm index 0b57b006e3..92f0408ead 100644 --- a/sfx2/source/appl/shutdowniconaqua.mm +++ b/sfx2/source/appl/shutdowniconaqua.mm @@ -61,12 +61,13 @@ using namespace ::com::sun::star::beans; #define MI_BASE 6 #define MI_MATH 7 #define MI_TEMPLATE 8 - +#define MI_STARTMODULE 9 @interface QSMenuExecute : NSObject { } -(void)executeMenuItem: (NSMenuItem*)pItem; +-(void)dockIconClicked: (NSObject*)pSender; @end @implementation QSMenuExecute @@ -98,10 +99,20 @@ using namespace ::com::sun::star::beans; case MI_TEMPLATE: ShutdownIcon::FromTemplate(); break; + case MI_STARTMODULE: + ShutdownIcon::OpenURL( OUString( RTL_CONSTASCII_USTRINGPARAM( STARTMODULE_URL ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) ); + break; default: break; } } + +-(void)dockIconClicked: (NSObject*)pSender +{ + // start start module + ShutdownIcon::OpenURL( OUString( RTL_CONSTASCII_USTRINGPARAM( STARTMODULE_URL ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) ); +} + @end bool ShutdownIcon::IsQuickstarterInstalled() @@ -119,16 +130,13 @@ static NSString* getAutoreleasedString( const rtl::OUString& rStr ) return [[[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()] autorelease]; } -static void appendMenuItem( NSMenu* pMenu, NSMenu* pDockMenu, const rtl::OUString& rTitle, int nTag ) +static rtl::OUString getShortCut( const rtl::OUString i_rTitle ) { - if( ! rTitle.getLength() ) - return; - // create shortcut rtl::OUString aKeyEquiv; - for( sal_Int32 nIndex = 0; nIndex < rTitle.getLength(); nIndex++ ) + for( sal_Int32 nIndex = 0; nIndex < i_rTitle.getLength(); nIndex++ ) { - rtl::OUString aShortcut( rTitle.copy( nIndex, 1 ).toAsciiLowerCase() ); + rtl::OUString aShortcut( i_rTitle.copy( nIndex, 1 ).toAsciiLowerCase() ); if( aShortcuts.find( aShortcut ) == aShortcuts.end() ) { aShortcuts.insert( aShortcut ); @@ -136,25 +144,36 @@ static void appendMenuItem( NSMenu* pMenu, NSMenu* pDockMenu, const rtl::OUStrin break; } } + + return aKeyEquiv; +} + +static void appendMenuItem( NSMenu* i_pMenu, NSMenu* i_pDockMenu, const rtl::OUString& i_rTitle, int i_nTag, const rtl::OUString& i_rKeyEquiv ) +{ + if( ! i_rTitle.getLength() ) + return; - NSMenuItem* pItem = [[NSMenuItem alloc] initWithTitle: getAutoreleasedString( rTitle ) + NSMenuItem* pItem = [[NSMenuItem alloc] initWithTitle: getAutoreleasedString( i_rTitle ) action: @selector(executeMenuItem:) - keyEquivalent: (aKeyEquiv.getLength() ? getAutoreleasedString( aKeyEquiv ) : @"") + keyEquivalent: (i_rKeyEquiv.getLength() ? getAutoreleasedString( i_rKeyEquiv ) : @"") ]; - [pItem setTag: nTag]; + [pItem setTag: i_nTag]; [pItem setTarget: pExecute]; [pItem setEnabled: YES]; - [pMenu addItem: pItem]; + [i_pMenu addItem: pItem]; - // create a similar entry in the dock menu - pItem = [[NSMenuItem alloc] initWithTitle: getAutoreleasedString( rTitle ) - action: @selector(executeMenuItem:) - keyEquivalent: @"" - ]; - [pItem setTag: nTag]; - [pItem setTarget: pExecute]; - [pItem setEnabled: YES]; - [pDockMenu addItem: pItem]; + if( i_pDockMenu ) + { + // create a similar entry in the dock menu + pItem = [[NSMenuItem alloc] initWithTitle: getAutoreleasedString( i_rTitle ) + action: @selector(executeMenuItem:) + keyEquivalent: @"" + ]; + [pItem setTag: i_nTag]; + [pItem setTarget: pExecute]; + [pItem setEnabled: YES]; + [i_pDockMenu addItem: pItem]; + } } @@ -203,7 +222,7 @@ void aqua_init_systray() if ( sURL.getLength() ) aFileNewAppsAvailable.insert( sURL ); } - + // describe the menu entries for launching the applications struct MenuEntryDescriptor { @@ -220,6 +239,17 @@ void aqua_init_systray() { SvtModuleOptions::E_SMATH, MI_MATH, MATH_URL } }; + // insert entry for startcenter + if( aModuleOptions.IsModuleInstalled( SvtModuleOptions::E_SSTARTMODULE ) ) + { + appendMenuItem( pMenu, nil, pShutdownIcon->GetResString( STR_QUICKSTART_STARTCENTER ), MI_STARTMODULE, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "n" ) ) ); + if( [NSApp respondsToSelector: @selector(setDockIconClickHandler:)] ) + [NSApp performSelector:@selector(setDockIconClickHandler:) withObject: pExecute]; + else + DBG_ERROR( "setDockIconClickHandler selector failed on NSApp\n" ); + + } + // insert the menu entries for launching the applications for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) { @@ -233,18 +263,24 @@ void aqua_init_systray() // the application is installed, but the entry has been configured to *not* appear in the File/New // menu => also let not appear it in the quickstarter continue; + + rtl::OUString aKeyEquiv( getShortCut( pShutdownIcon->GetUrlDescription( sURL ) ) ); - appendMenuItem( pMenu, pDockMenu, pShutdownIcon->GetUrlDescription( sURL ), aMenuItems[i].nMenuTag ); + appendMenuItem( pMenu, pDockMenu, pShutdownIcon->GetUrlDescription( sURL ), aMenuItems[i].nMenuTag, aKeyEquiv ); } // insert the remaining menu entries - appendMenuItem( pMenu, pDockMenu, pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), MI_TEMPLATE ); - appendMenuItem( pMenu, pDockMenu, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), MI_OPEN ); + rtl::OUString aTitle( pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ) ); + rtl::OUString aKeyEquiv( getShortCut( aTitle ) ); + appendMenuItem( pMenu, pDockMenu, aTitle, MI_TEMPLATE, aKeyEquiv ); + aTitle = pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ); + aKeyEquiv = getShortCut( aTitle ); + appendMenuItem( pMenu, pDockMenu, aTitle, MI_OPEN, aKeyEquiv ); [pDefMenu setSubmenu: pMenu]; [NSApp performSelector:@selector(addFallbackMenuItem:) withObject: pDefMenu]; - if( [NSApp respondsToSelector: @selector(addFallbackMenuItem:)] ) + if( [NSApp respondsToSelector: @selector(addDockMenuItem:)] ) { [pDockSubMenu setSubmenu: pDockMenu]; // insert a separator to the dock menu diff --git a/svx/source/editeng/editeng.cxx b/svx/source/editeng/editeng.cxx index a4ee871bc5..25201dd36d 100644 --- a/svx/source/editeng/editeng.cxx +++ b/svx/source/editeng/editeng.cxx @@ -930,16 +930,22 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie case KEY_END: case KEY_PAGEUP: case KEY_PAGEDOWN: + case com::sun::star::awt::Key::MOVE_WORD_FORWARD: + case com::sun::star::awt::Key::SELECT_WORD_FORWARD: + case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: + case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE: case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: - case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: - case com::sun::star::awt::Key::MOVE_WORD_FORWARD: - case com::sun::star::awt::Key::SELECT_BACKWARD: - case com::sun::star::awt::Key::SELECT_FORWARD: - case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: - case com::sun::star::awt::Key::SELECT_WORD_FORWARD: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: { if ( !rKeyEvent.GetKeyCode().IsMod2() || ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ) { @@ -969,6 +975,8 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie case KEY_DELETE: case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: case com::sun::star::awt::Key::DELETE_WORD_FORWARD: + case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH: { if ( !bReadOnly && !rKeyEvent.GetKeyCode().IsMod2() ) { diff --git a/svx/source/editeng/impedit2.cxx b/svx/source/editeng/impedit2.cxx index ce740ad01e..7576b580e0 100644 --- a/svx/source/editeng/impedit2.cxx +++ b/svx/source/editeng/impedit2.cxx @@ -895,12 +895,38 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE break; case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: aPaM = CursorStartOfParagraph( aPaM ); + if( aPaM == aOldPaM ) + { + aPaM = CursorLeft( aPaM, i18n::CharacterIteratorMode::SKIPCELL ); + aPaM = CursorStartOfParagraph( aPaM ); + } bKeyModifySelection = false; break; case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: aPaM = CursorEndOfParagraph( aPaM ); + if( aPaM == aOldPaM ) + { + aPaM = CursorRight( aPaM, i18n::CharacterIteratorMode::SKIPCELL ); + aPaM = CursorEndOfParagraph( aPaM ); + } + bKeyModifySelection = false; + break; + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + aPaM = CursorStartOfDoc(); + bKeyModifySelection = false; + break; + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + aPaM = CursorEndOfDoc(); bKeyModifySelection = false; break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + aPaM = CursorStartOfLine( aPaM ); + bKeyModifySelection = true; + break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: + aPaM = CursorEndOfLine( aPaM ); + bKeyModifySelection = true; + break; case com::sun::star::awt::Key::SELECT_BACKWARD: aPaM = CursorLeft( aPaM, i18n::CharacterIteratorMode::SKIPCELL ); bKeyModifySelection = true; @@ -917,6 +943,32 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE aPaM = WordRight( aPaM ); bKeyModifySelection = true; break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + aPaM = CursorStartOfParagraph( aPaM ); + if( aPaM == aOldPaM ) + { + aPaM = CursorLeft( aPaM, i18n::CharacterIteratorMode::SKIPCELL ); + aPaM = CursorStartOfParagraph( aPaM ); + } + bKeyModifySelection = true; + break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + aPaM = CursorEndOfParagraph( aPaM ); + if( aPaM == aOldPaM ) + { + aPaM = CursorRight( aPaM, i18n::CharacterIteratorMode::SKIPCELL ); + aPaM = CursorEndOfParagraph( aPaM ); + } + bKeyModifySelection = true; + break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + aPaM = CursorStartOfDoc(); + bKeyModifySelection = true; + break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: + aPaM = CursorEndOfDoc(); + bKeyModifySelection = true; + break; } if ( aOldPaM != aPaM ) |