diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-05-21 10:11:51 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-05-21 10:11:51 +0200 |
commit | 36bbd6d57e843d558ee89a59ea990d3afadda718 (patch) | |
tree | 0bd24ba46b24a776f7f40e3e55689804e6847cb0 /framework/source | |
parent | 9e090f35c699eb8fcec6ba0d385bd76b76c744b5 (diff) | |
parent | ff494dca2e13bfb2cc35b7d65a178e6093af9842 (diff) |
npower13_objectmodules: rebase and merge with DEV300_m78
Diffstat (limited to 'framework/source')
20 files changed, 774 insertions, 825 deletions
diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src index d9c9c558ad..c8114e7129 100644 --- a/framework/source/classes/resource.src +++ b/framework/source/classes/resource.src @@ -124,7 +124,7 @@ String STR_TOOLBAR_TITLE_ADDON String STR_STATUSBAR_LOGOTEXT { - Text [ en-US ] = "A %PRODUCTNAME product by Sun Microsystems, Inc."; + Text [ en-US ] = "A %PRODUCTNAME product by Oracle"; }; // *********************************************************************** diff --git a/framework/source/inc/loadenv/loaddispatchlistener.hxx b/framework/source/inc/loadenv/loaddispatchlistener.hxx deleted file mode 100644 index f148de9ba1..0000000000 --- a/framework/source/inc/loadenv/loaddispatchlistener.hxx +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_LOADENV_LOADDISPATCHLISTENER_HXX_ -#define __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ - -//_______________________________________________ -// includes of own project - -#include <threadhelp/threadhelpbase.hxx> -#include <threadhelp/gate.hxx> -#include <macros/xinterface.hxx> - -//_______________________________________________ -// includes of uno interface -#include <com/sun/star/frame/XDispatchResultListener.hpp> - -/* -#include <com/sun/star/frame/DispatchResultEvent.hpp> -*/ - -//_______________________________________________ -// includes of an other project - -#ifndef _OSL_CONDITN_HXX_ -#include <osl/condition.hxx> -#endif -#include <cppuhelper/weak.hxx> - -//_______________________________________________ -// namespace - -namespace framework{ - -namespace css = ::com::sun::star; - -//_______________________________________________ -// definitions - -/** @short listen for finished dispatches, where document will be loaded. - - @descr This listener can be bound to an URL - so its well known - for which load request this event was triggered. - Thats needed - but not supported by the XDispatchResultListener - notification. - Further a condition can be used to synchronize any outside code - against the occurence of this event. - - @author as96863 - */ -class LoadDispatchListener : public css::frame::XDispatchResultListener // => css.lang.XEventListener - , private ThreadHelpBase - , public ::cppu::OWeakObject -{ - //___________________________________________ - // member - - private: - - /** @short the URL which is bound to this callback. */ - ::rtl::OUString m_sURL; - - /** @short the original event, which was notified to this object. */ - css::frame::DispatchResultEvent m_aResult; - - /** @short used to let the user of this instance wait, till an - event occures. - */ - ::osl::Condition m_aUserWait; - - //___________________________________________ - // native interface - - public: - - //_______________________________________ - /** @short initialize a new instance of this class. */ - LoadDispatchListener(); - - //_______________________________________ - /** @short deinitialize an instance of this class. */ - virtual ~LoadDispatchListener(); - - //_______________________________________ - /** @short bind this listenerr to a new URL. - - @param sURL - the new URL bound to this instance. - */ - void setURL(const ::rtl::OUString & sURL); - - //_______________________________________ - /** @short let the user of this instance wait. - - @descr If the call timed out - false is returned. - Otherwise it returns true. - Then the method getResult() has to be called, - to get the origianl event. - - @param nWait_ms - the time for wait in [ms]. - If its set to 0 this call is blocked till - an event occures! - - @return TRUE if an event occured in time - FALSE otherwhise. - */ - sal_Bool wait(sal_Int32 nWait_ms); - - //_______________________________________ - /** @short returns the result of this listener operation. - - @descr If wait() (which must be called before!) returns FALSE - the return of getResult() is undefined! - - @return The result of the got listener notification. - */ - css::frame::DispatchResultEvent getResult() const; - - //___________________________________________ - // uno interface - - public: - - //_______________________________________ - // css.uno.XInterface - FWK_DECLARE_XINTERFACE - - //_______________________________________ - // css.frame.XDispatchResultListener - virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException); - - //_______________________________________ - // css.lang.XEventListener - virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) - throw(css::uno::RuntimeException); -}; - -} // namespace framework - -#endif // __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index 6f0b60a502..60c3c317e0 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -417,6 +417,7 @@ class LoadEnv : private ThreadHelpBase virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) throw(css::uno::RuntimeException); */ + //___________________________________________ // static interface @@ -455,6 +456,14 @@ class LoadEnv : private ThreadHelpBase const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor); /** TODO document me ... */ + static void initializeUIDefaults( + const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, + const bool _bUIMode, + QuietInteraction** o_ppQuiteInteraction + ); + + /** TODO document me ... */ void impl_setResult(sal_Bool bResult); /** TODO document me ... */ @@ -484,7 +493,7 @@ class LoadEnv : private ThreadHelpBase /** @short tries to detect the type and the filter of the specified content. - @descr This method actualize the available media descriptor of this instance, + @descr This method update the available media descriptor of this instance, so it contains the right type, a corresponding filter, may a valid frame loader etc. In case detection failed, this descriptor is corrected first, before a suitable exception will be thrown. diff --git a/framework/source/inc/loadenv/loadenvexception.hxx b/framework/source/inc/loadenv/loadenvexception.hxx index 7bce66a3bb..8af58d4c89 100644 --- a/framework/source/inc/loadenv/loadenvexception.hxx +++ b/framework/source/inc/loadenv/loadenvexception.hxx @@ -172,11 +172,11 @@ class LoadEnvException @param exUno the original catched uno exception. */ - LoadEnvException( sal_Int32 nID , - const css::uno::Exception& exUno) + LoadEnvException( sal_Int32 nID , + const css::uno::Any& exUno) { - m_nID = nID ; - m_exOriginal <<= exUno; + m_nID = nID ; + m_exOriginal = exUno; } //_______________________________________ diff --git a/framework/source/interaction/preventduplicateinteraction.cxx b/framework/source/interaction/preventduplicateinteraction.cxx index 1fe71b6ade..d032aa1f24 100644 --- a/framework/source/interaction/preventduplicateinteraction.cxx +++ b/framework/source/interaction/preventduplicateinteraction.cxx @@ -109,6 +109,20 @@ void PreventDuplicateInteraction::useDefaultUUIHandler() } //_________________________________________________________________________________________________________________ +css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::uno::Type& aType ) + throw (css::uno::RuntimeException) +{ + if ( aType.equals( XInteractionHandler2::static_type() ) ) + { + ::osl::ResettableMutexGuard aLock(m_aLock); + css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); + if ( !xHandler.is() ) + return css::uno::Any(); + } + return ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 >::queryInterface( aType ); +} + +//_________________________________________________________________________________________________________________ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) throw(css::uno::RuntimeException) @@ -166,6 +180,65 @@ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css //_________________________________________________________________________________________________________________ +::sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) + throw (css::uno::RuntimeException) +{ + css::uno::Any aRequest = xRequest->getRequest(); + sal_Bool bHandleIt = sal_True; + + // SAFE -> + ::osl::ResettableMutexGuard aLock(m_aLock); + + InteractionList::iterator pIt; + for ( pIt = m_lInteractionRules.begin(); + pIt != m_lInteractionRules.end() ; + ++pIt ) + { + InteractionInfo& rInfo = *pIt; + + if (aRequest.isExtractableTo(rInfo.m_aInteraction)) + { + ++rInfo.m_nCallCount; + rInfo.m_xRequest = xRequest; + bHandleIt = (rInfo.m_nCallCount <= rInfo.m_nMaxCount); + break; + } + } + + css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); + OSL_ENSURE( xHandler.is() || !m_xHandler.is(), + "PreventDuplicateInteraction::handleInteractionRequest: inconsistency!" ); + + aLock.clear(); + // <- SAFE + + if ( + (bHandleIt ) && + (xHandler.is()) + ) + { + return xHandler->handleInteractionRequest(xRequest); + } + else + { + const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations(); + sal_Int32 c = lContinuations.getLength(); + sal_Int32 i = 0; + for (i=0; i<c; ++i) + { + css::uno::Reference< css::task::XInteractionAbort > xAbort(lContinuations[i], css::uno::UNO_QUERY); + if (xAbort.is()) + { + xAbort->select(); + break; + } + } + } + return false; +} + +//_________________________________________________________________________________________________________________ + void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo) { // SAFE -> diff --git a/framework/source/interaction/quietinteraction.cxx b/framework/source/interaction/quietinteraction.cxx index 81fc2ec39c..14357a8d13 100644 --- a/framework/source/interaction/quietinteraction.cxx +++ b/framework/source/interaction/quietinteraction.cxx @@ -44,7 +44,9 @@ #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/document/XInteractionFilterSelect.hpp> +#include <com/sun/star/document/XInteractionFilterOptions.hpp> #include <com/sun/star/document/AmbigousFilterRequest.hpp> +#include <com/sun/star/document/FilterOptionsRequest.hpp> #include <com/sun/star/task/ErrorCodeRequest.hpp> #ifndef _COM_SUN_STAR_DOCUMENT_LOCKEDDOCUMENTREQUEST_HPP_ @@ -111,6 +113,7 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI css::uno::Reference< css::task::XInteractionAbort > xAbort ; css::uno::Reference< css::task::XInteractionApprove > xApprove ; css::uno::Reference< css::document::XInteractionFilterSelect > xFilter ; + css::uno::Reference< css::document::XInteractionFilterOptions > xFOptions ; sal_Int32 nCount=lContinuations.getLength(); for (sal_Int32 i=0; i<nCount; ++i) @@ -123,6 +126,9 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI if ( ! xFilter.is() ) xFilter = css::uno::Reference< css::document::XInteractionFilterSelect >( lContinuations[i], css::uno::UNO_QUERY ); + + if ( ! xFOptions.is() ) + xFOptions = css::uno::Reference< css::document::XInteractionFilterOptions >( lContinuations[i], css::uno::UNO_QUERY ); } // differ between abortable interactions (error, unknown filter ...) @@ -130,6 +136,7 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI css::task::ErrorCodeRequest aErrorCodeRequest ; css::document::AmbigousFilterRequest aAmbigousFilterRequest; css::document::LockedDocumentRequest aLockedDocumentRequest; + css::document::FilterOptionsRequest aFilterOptionsRequest; if (aRequest>>=aAmbigousFilterRequest) { @@ -163,6 +170,15 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI xAbort->select(); } else + if (aRequest>>=aFilterOptionsRequest) + { + if (xFOptions.is()) + { + // let the default filter options be used + xFOptions->select(); + } + } + else if (xAbort.is()) xAbort->select(); } diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index b4bf19996e..6d48c3c2ac 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -302,10 +302,10 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& /* SAFE { */ WriteGuard aWriteLock(m_aLock); - // actualize member + // update member m_lArguments = lArguments; - // actualize the configuration ... if possible! + // update the configuration ... if possible! if (m_eMode==E_ALIAS) { // It doesn't matter if this config object was already opened before. @@ -363,7 +363,7 @@ void JobData::setResult( const JobResult& aResult ) // overwrite the last saved result m_aLastExecutionResult = aResult; - // Don't use his informations to actualize + // Don't use his informations to update // e.g. the arguments of this job. It must be done // from outside! Here we save this information only. @@ -533,7 +533,7 @@ void JobData::disableJob() if (m_eMode!=E_EVENT) return; - // actualize the configuration + // update the configuration // It doesn't matter if this config object was already opened before. // It doesn nothing here then ... or it change the mode automaticly, if // it was opened using another one before. diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx index eb35e3700c..98b657794f 100644 --- a/framework/source/jobs/jobresult.cxx +++ b/framework/source/jobs/jobresult.cxx @@ -81,7 +81,7 @@ JobResult::JobResult() /** @short special ctor @descr It initialize this new instance with a pure job execution result - and analyze it. Doing so, we actualize our other members. + and analyze it. Doing so, we update our other members. <p> It's a list of named values, packed inside this any. @@ -133,7 +133,7 @@ JobResult::JobResult( /*IN*/ const css::uno::Any& aResult ) // That can be usefull if something will fail here ... m_eParts = E_NOPART; - // analyze the result and actualize our other members + // analyze the result and update our other members ::comphelper::SequenceAsHashMap aProtocol(aResult); if ( aProtocol.empty() ) return; diff --git a/framework/source/loadenv/loaddispatchlistener.cxx b/framework/source/loadenv/loaddispatchlistener.cxx deleted file mode 100644 index 39effc9e5a..0000000000 --- a/framework/source/loadenv/loaddispatchlistener.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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" - -//_______________________________________________ -// includes of own project -#include <loadenv/loaddispatchlistener.hxx> -#include <threadhelp/writeguard.hxx> -#include <threadhelp/readguard.hxx> - -//_______________________________________________ -// includes of uno interface -#include <com/sun/star/frame/DispatchResultState.hpp> - -//_______________________________________________ -// includes of an other project -#include <vcl/svapp.hxx> - -//_______________________________________________ -// namespace - -namespace framework{ - -// may there exist already a define .-( -#ifndef css -namespace css = ::com::sun::star; -#endif - -//_______________________________________________ -// declarations - -//----------------------------------------------- -DEFINE_XINTERFACE_2(LoadDispatchListener , - OWeakObject , - DIRECT_INTERFACE (css::frame::XDispatchResultListener ), - DERIVED_INTERFACE(css::lang::XEventListener, css::frame::XDispatchResultListener)) - -//----------------------------------------------- -LoadDispatchListener::LoadDispatchListener() - : ThreadHelpBase(&Application::GetSolarMutex()) -{ - // reset the condition object - so our user can wait there. - m_aUserWait.reset(); - // set defined state for our result value - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); -} - -//----------------------------------------------- -LoadDispatchListener::~LoadDispatchListener() -{ -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult = aEvent; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::disposing(const css::lang::EventObject&) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void LoadDispatchListener::setURL(const ::rtl::OUString & sURL) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_sURL = sURL; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- -} - -//----------------------------------------------- -sal_Bool LoadDispatchListener::wait(sal_Int32 /*nWait_ms*/) -{ - // Wait till an event occures - m_aUserWait.wait(0); - // reset the condition, so this method can be called again. - // Of course a new action has to be started outside too! - m_aUserWait.reset(); - - // TODO implement real timeout :-) - return sal_True; -} - -//----------------------------------------------- -css::frame::DispatchResultEvent LoadDispatchListener::getResult() const -{ - // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); - return m_aResult; - // <- SAFE ---------------------------------- -} - -} // namespace framework diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index c8cc2dd87f..380943b8ba 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -321,22 +321,41 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& /*TODO progress is bound to a frame ... How can we set it here? */ + // UI mode + const bool bUIMode = + ( ( m_eFeature & E_WORK_WITH_UI ) == E_WORK_WITH_UI ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False ) == sal_False ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False ); + + initializeUIDefaults( + m_xSMGR, + m_lMediaDescriptor, + bUIMode, + &m_pQuietInteraction + ); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +/*----------------------------------------------- + 22.01.2010 +-----------------------------------------------*/ +void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, + QuietInteraction** o_ppQuietInteraction ) +{ css::uno::Reference< css::task::XInteractionHandler > xInteractionHandler; sal_Int16 nMacroMode ; sal_Int16 nUpdateMode ; - // UI mode - if ( - ((m_eFeature & E_WORK_WITH_UI) == E_WORK_WITH_UI) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False) == sal_False ) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False) == sal_False ) - ) + if ( i_bUIMode ) { nMacroMode = css::document::MacroExecMode::USE_CONFIG; nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG; try { - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(m_xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(i_rSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); } catch(const css::uno::RuntimeException&) {throw;} catch(const css::uno::Exception& ) { } @@ -346,27 +365,28 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& { nMacroMode = css::document::MacroExecMode::NEVER_EXECUTE; nUpdateMode = css::document::UpdateDocMode::NO_UPDATE; - m_pQuietInteraction = new QuietInteraction(); - m_pQuietInteraction->acquire(); - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(m_pQuietInteraction), css::uno::UNO_QUERY); + QuietInteraction* pQuietInteraction = new QuietInteraction(); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(pQuietInteraction), css::uno::UNO_QUERY); + if ( o_ppQuietInteraction != NULL ) + { + *o_ppQuietInteraction = pQuietInteraction; + (*o_ppQuietInteraction)->acquire(); + } } if ( - (xInteractionHandler.is() ) && - (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == m_lMediaDescriptor.end()) + (xInteractionHandler.is() ) && + (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == io_lMediaDescriptor.end()) ) { - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; } - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; } /*----------------------------------------------- @@ -818,7 +838,7 @@ void LoadEnv::impl_detectTypeAndFilter() // Attention: Because our stl media descriptor is a copy of an uno sequence // we cant use as an in/out parameter here. Copy it before and dont forget to - // actualize structure afterwards again! + // update structure afterwards again! css::uno::Sequence< css::beans::PropertyValue > lDescriptor = m_lMediaDescriptor.getAsConstPropertyValueList(); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; @@ -1626,7 +1646,6 @@ void LoadEnv::impl_reactForLoadingState() // We dont hide already visible frames here ... css::uno::Reference< css::awt::XWindow > xWindow = m_xTargetFrame->getContainerWindow(); sal_Bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False); - sal_Bool bRecovered = (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()) != m_lMediaDescriptor.end()); sal_Bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_MINIMIZED(), sal_False); if (bMinimized) @@ -1638,7 +1657,7 @@ void LoadEnv::impl_reactForLoadingState() ((WorkWindow*)pWindow)->Minimize(); } else - if (!bHidden && !bRecovered) + if (!bHidden) { // show frame ... if it's not still visible ... // But do nothing if it's already visible! @@ -1723,9 +1742,8 @@ void LoadEnv::impl_reactForLoadingState() if (bThrow) { - css::uno::Exception aEx; - if ( aRequest >>= aEx ) - throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aEx ); + if ( aRequest.isExtractableTo( ::cppu::UnoType< css::uno::Exception >::get() ) ) + throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aRequest ); } // <- SAFE ---------------------------------- diff --git a/framework/source/loadenv/makefile.mk b/framework/source/loadenv/makefile.mk index fead332b06..c68ad8d304 100644 --- a/framework/source/loadenv/makefile.mk +++ b/framework/source/loadenv/makefile.mk @@ -38,7 +38,6 @@ ENABLE_EXCEPTIONS= TRUE SLOFILES= \ $(SLO)$/loadenv.obj \ - $(SLO)$/loaddispatchlistener.obj \ $(SLO)$/targethelper.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 9f514ae833..41dbe9b603 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -28,10 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" #include "services/autorecovery.hxx" +#include <loadenv/loadenv.hxx> //_______________________________________________ // own includes -#include <loadenv/loaddispatchlistener.hxx> #include <loadenv/targethelper.hxx> #include <pattern/frame.hxx> #include <threadhelp/readguard.hxx> @@ -47,6 +47,8 @@ // interface includes #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -67,6 +69,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentRecovery.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> @@ -75,10 +78,12 @@ // other includes #include <comphelper/configurationhelper.hxx> #include <comphelper/mediadescriptor.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <vcl/svapp.hxx> #include <unotools/pathoptions.hxx> #include <tools/link.hxx> #include <tools/string.hxx> +#include <tools/diagnose_ex.h> #include <unotools/tempfile.hxx> #include <ucbhelper/content.hxx> @@ -88,6 +93,7 @@ #include <unotools/bootstrap.hxx> #include <unotools/configmgr.hxx> #include <svl/documentlockfile.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <tools/urlobj.hxx> @@ -98,6 +104,23 @@ namespace css = ::com::sun::star; #endif +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::document::XDocumentRecovery; +using ::com::sun::star::frame::XModel2; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::frame::XLoadable; +using ::com::sun::star::frame::XStorable; +using ::com::sun::star::lang::XComponent; + namespace fpf = ::framework::pattern::frame; namespace framework @@ -131,6 +154,7 @@ static const ::rtl::OUString CFG_ENTRY_PROP_DOCUMENTSTATE = ::rtl::OUString: static const ::rtl::OUString CFG_ENTRY_PROP_FILTER = ::rtl::OUString::createFromAscii("Filter" ); static const ::rtl::OUString CFG_ENTRY_PROP_TITLE = ::rtl::OUString::createFromAscii("Title" ); static const ::rtl::OUString CFG_ENTRY_PROP_ID = ::rtl::OUString::createFromAscii("ID" ); +static const ::rtl::OUString CFG_ENTRY_PROP_VIEWNAMES = ::rtl::OUString::createFromAscii("ViewNames" ); static const ::rtl::OUString FILTER_PROP_TYPE = ::rtl::OUString::createFromAscii("Type" ); static const ::rtl::OUString FILTER_PROP_NAME = ::rtl::OUString::createFromAscii("Name" ); @@ -140,6 +164,7 @@ static const ::rtl::OUString DOCINFO_PROP_TEMPLATE = ::rtl::OUString:: // setup.xcu static const ::rtl::OUString CFG_ENTRY_PROP_EMPTYDOCUMENTURL = ::rtl::OUString::createFromAscii("ooSetupFactoryEmptyDocumentURL"); static const ::rtl::OUString CFG_ENTRY_PROP_DEFAULTFILTER = ::rtl::OUString::createFromAscii("ooSetupFactoryDefaultFilter" ); +static const ::rtl::OUString CFG_ENTRY_PROP_FACTORYSERVICE = ::rtl::OUString::createFromAscii("ooSetupFactoryDocumentService" ); static const ::rtl::OUString EVENT_ON_NEW = ::rtl::OUString::createFromAscii("OnNew" ); static const ::rtl::OUString EVENT_ON_LOAD = ::rtl::OUString::createFromAscii("OnLoad" ); @@ -619,7 +644,7 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& // dont enable AutoSave hardly ! // reload configuration to know the current state. implts_readAutoSaveConfig(); - implts_actualizeTimer(); + implts_updateTimer(); // can it happen that might be the listener was stopped ? .-) // make sure it runs always ... even if AutoSave itself was disabled temporarly. implts_startListening(); @@ -775,7 +800,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) // <- SAFE ---------------------------------- // depends on bAllowAutoSaveReactivation implicitly by looking on m_eJob=E_AUTO_SAVE! see before ... - implts_actualizeTimer(); + implts_updateTimer(); if (bAllowAutoSaveReactivation) implts_startListening(); @@ -791,7 +816,7 @@ void SAL_CALL AutoRecovery::addStatusListener(const css::uno::Reference< css::fr // container is threadsafe by using a shared mutex! m_lListener.addInterface(aURL.Complete, xListener); - // REINTRANT !? -> -------------------------------- + // REENTRANT !? -> -------------------------------- CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); // THREAD SAFE -> ---------------------------------- @@ -845,7 +870,7 @@ void SAL_CALL AutoRecovery::notifyEvent(const css::document::EventObject& aEvent else if (aEvent.EventName.equals(EVENT_ON_MODIFYCHANGED)) { - implts_actualizeModifiedState(xDocument); + implts_updateModifiedState(xDocument); } /* at least one document starts saving process => Our application code isnt ready for multiple save requests @@ -954,7 +979,7 @@ void SAL_CALL AutoRecovery::changesOccurred(const css::util::ChangesEvent& aEven // Note: This call stops the timer and starts it again. // But it checks the different timer states internaly and // may be supress the restart! - implts_actualizeTimer(); + implts_updateTimer(); } //----------------------------------------------- @@ -1096,7 +1121,7 @@ void AutoRecovery::implts_readConfig() css::uno::Reference< css::container::XHierarchicalNameAccess > xCommonRegistry(implts_openConfig(), css::uno::UNO_QUERY); - // REINTRANT -> -------------------------------- + // REENTRANT -> -------------------------------- CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_ADD_REMOVE); // THREADSAFE -> ------------------------------- @@ -1108,7 +1133,7 @@ void AutoRecovery::implts_readConfig() // <- THREADSAFE ------------------------------- aCacheLock.unlock(); - // <- REINTRANT -------------------------------- + // <- REENTRANT -------------------------------- css::uno::Any aValue; @@ -1123,7 +1148,7 @@ void AutoRecovery::implts_readConfig() sal_Int32 c = lItems.getLength(); sal_Int32 i = 0; - // REINTRANT -> -------------------------- + // REENTRANT -> -------------------------- aCacheLock.lock(LOCK_FOR_CACHE_ADD_REMOVE); for (i=0; i<c; ++i) @@ -1143,7 +1168,8 @@ void AutoRecovery::implts_readConfig() xItem->getPropertyValue(CFG_ENTRY_PROP_DOCUMENTSTATE) >>= aInfo.DocumentState; xItem->getPropertyValue(CFG_ENTRY_PROP_MODULE ) >>= aInfo.AppModule ; xItem->getPropertyValue(CFG_ENTRY_PROP_TITLE ) >>= aInfo.Title ; - implts_specifyAppModuleAndFactoryURL(aInfo); + xItem->getPropertyValue(CFG_ENTRY_PROP_VIEWNAMES ) >>= aInfo.ViewNames ; + implts_specifyAppModuleAndFactory(aInfo); implts_specifyDefaultFilterAndExtension(aInfo); if (pItems[i].indexOf(RECOVERY_ITEM_BASE_IDENTIFIER)==0) @@ -1173,10 +1199,10 @@ void AutoRecovery::implts_readConfig() } aCacheLock.unlock(); - // <- REINTRANT -------------------------- + // <- REENTRANT -------------------------- } - implts_actualizeTimer(); + implts_updateTimer(); } //----------------------------------------------- @@ -1241,17 +1267,12 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume } //----------------------------------------------- -void AutoRecovery::implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentInfo& rInfo) +void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo& rInfo) { - if ( - (!rInfo.AppModule.getLength()) && - (!rInfo.Document.is() ) - ) - { - throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("Cant find out the application module nor its factory URL, if no application module (or a suitable) document is known!"), - static_cast< css::frame::XDispatch* >(this)); - } + ENSURE_OR_THROW2( + rInfo.AppModule.getLength() || rInfo.Document.is(), + "Cant find out the application module nor its factory URL, if no application module (or a suitable) document is known!", + *this ); // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); @@ -1267,6 +1288,65 @@ void AutoRecovery::implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentI ::comphelper::SequenceAsHashMap lModuleDescription(xModuleConfig->getByName(rInfo.AppModule)); lModuleDescription[CFG_ENTRY_PROP_EMPTYDOCUMENTURL] >>= rInfo.FactoryURL; + lModuleDescription[CFG_ENTRY_PROP_FACTORYSERVICE] >>= rInfo.FactoryService; +} + +//----------------------------------------------- +void AutoRecovery::implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& i_rInfo ) +{ + ENSURE_OR_THROW2( i_rInfo.Document.is(), "need at document, at the very least", *this ); + + i_rInfo.ViewNames.realloc(0); + + // obtain list of controllers of this document + ::std::vector< ::rtl::OUString > aViewNames; + const Reference< XModel2 > xModel( i_rInfo.Document, UNO_QUERY ); + if ( xModel.is() ) + { + const Reference< XEnumeration > xEnumControllers( xModel->getControllers() ); + while ( xEnumControllers->hasMoreElements() ) + { + const Reference< XController2 > xController( xEnumControllers->nextElement(), UNO_QUERY ); + ::rtl::OUString sViewName; + if ( xController.is() ) + sViewName = xController->getViewControllerName(); + OSL_ENSURE( sViewName.getLength(), "AutoRecovery::implts_collectActiveViewNames: (no XController2 ->) no view name -> no recovery of this view!" ); + + if ( sViewName.getLength() ) + aViewNames.push_back( sViewName ); + } + } + else + { + const Reference< XController2 > xController( xModel->getCurrentController(), UNO_QUERY ); + ::rtl::OUString sViewName; + if ( xController.is() ) + sViewName = xController->getViewControllerName(); + OSL_ENSURE( sViewName.getLength(), "AutoRecovery::implts_collectActiveViewNames: (no XController2 ->) no view name -> no recovery of this view!" ); + + if ( sViewName.getLength() ) + aViewNames.push_back( sViewName ); + } + + i_rInfo.ViewNames.realloc( aViewNames.size() ); + ::std::copy( aViewNames.begin(), aViewNames.end(), i_rInfo.ViewNames.getArray() ); +} + +//----------------------------------------------- +void AutoRecovery::implts_persistAllActiveViewNames() +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + // This list will be filled with every document + AutoRecovery::TDocumentList::iterator pIt; + for ( pIt = m_lDocCache.begin(); + pIt != m_lDocCache.end() ; + ++pIt ) + { + implts_collectActiveViewNames( *pIt ); + implts_flushConfigItem( *pIt ); + } } //----------------------------------------------- @@ -1319,6 +1399,7 @@ void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rIn xSet->setPropertyValue(CFG_ENTRY_PROP_DOCUMENTSTATE, css::uno::makeAny(rInfo.DocumentState)); xSet->setPropertyValue(CFG_ENTRY_PROP_MODULE , css::uno::makeAny(rInfo.AppModule )); xSet->setPropertyValue(CFG_ENTRY_PROP_TITLE , css::uno::makeAny(rInfo.Title )); + xSet->setPropertyValue(CFG_ENTRY_PROP_VIEWNAMES , css::uno::makeAny(rInfo.ViewNames )); if (bNew) xModify->insertByName(sID, css::uno::makeAny(xSet)); @@ -1478,7 +1559,7 @@ void AutoRecovery::implts_stopModifyListeningOnDoc(AutoRecovery::TDocumentInfo& } //----------------------------------------------- -void AutoRecovery::implts_actualizeTimer() +void AutoRecovery::implts_updateTimer() { implts_stopTimer(); @@ -1569,7 +1650,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) m_eTimerType = AutoRecovery::E_POLL_TILL_AUTOSAVE_IS_ALLOWED; aWriteLock.unlock(); // <- SAFE ------------------------------ - implts_actualizeTimer(); + implts_updateTimer(); return 0; } @@ -1584,7 +1665,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) sal_Bool bUserIdle = (Application::GetLastInputInterval()>MIN_TIME_FOR_USER_IDLE); if (!bUserIdle) { - implts_actualizeTimer(); + implts_updateTimer(); return 0; } } @@ -1625,7 +1706,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) aWriteLock.unlock(); // <- SAFE ---------------------------------- - implts_actualizeTimer(); + implts_updateTimer(); } catch(const css::uno::Exception&) { @@ -1662,7 +1743,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // notification for already existing document ! // Can happen if events came in asynchronous on recovery time. // Then our cache was filled from the configuration ... but now we get some - // asynchronous events from the global event broadcaster. We must be shure that + // asynchronous events from the global event broadcaster. We must be sure that // we dont add the same document more then once. AutoRecovery::TDocumentList::iterator pIt = AutoRecovery::impl_searchDocument(m_lDocCache, xDocument); if (pIt != m_lDocCache.end()) @@ -1670,7 +1751,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // Normaly nothing must be done for this "late" notification. // But may be the modified state was changed inbetween. // Check it ... - implts_actualizeModifiedState(xDocument); + implts_updateModifiedState(xDocument); return; } @@ -1695,6 +1776,11 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame if (!xDesktop.is()) return; + // if the document doesn't support the XDocumentRecovery interface, we're not interested in it. + Reference< XDocumentRecovery > xDocRecovery( xDocument, UNO_QUERY ); + if ( !xDocRecovery.is() ) + return; + // get all needed informations of this document // We need it to update our cache or to locate already existing elements there! AutoRecovery::TDocumentInfo aNew; @@ -1714,7 +1800,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // <- SAFE ---------------------------------- // classify the used application module, which is used by this document. - implts_specifyAppModuleAndFactoryURL(aNew); + implts_specifyAppModuleAndFactory(aNew); // Hack! Check for "illegal office documents" ... as e.g. the Basic IDE // Its not realy a full featured office document. It doesnt provide an URL, any filter, a factory URL etcpp. @@ -1723,7 +1809,12 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame (!aNew.OrgURL.getLength() ) && (!aNew.FactoryURL.getLength()) ) - return; + { + OSL_ENSURE( false, "AutoRecovery::implts_registerDocument: this should not happen anymore!" ); + // nowadays, the Basic IDE should already die on the "supports XDocumentRecovery" check. And no other known + // document type fits in here ... + return; + } // By the way - get some information about the default format for saving! // and save an information about the real used filter by this document. @@ -1744,7 +1835,6 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame if (xModifyCheck->isModified()) { aNew.DocumentState |= AutoRecovery::E_MODIFIED; - aNew.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } aCacheLock.lock(LOCK_FOR_CACHE_ADD_REMOVE); @@ -1752,7 +1842,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - // create a new cache entry ... this document isnt well known. + // create a new cache entry ... this document isn't known. ++m_nIdPool; aNew.ID = m_nIdPool; LOG_ASSERT(m_nIdPool>=0, "AutoRecovery::implts_registerDocument()\nOverflow of ID pool detected.") @@ -1831,7 +1921,6 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: if (pIt != m_lDocCache.end()) { AutoRecovery::TDocumentInfo& rInfo = *pIt; - rInfo.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; /* Now we know, that this document was modified again and must be saved next time. But we dont need this information for every e.g. key input of the user. @@ -1846,7 +1935,7 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: } //----------------------------------------------- -void AutoRecovery::implts_actualizeModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument) +void AutoRecovery::implts_updateModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument) { CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); @@ -1866,12 +1955,10 @@ void AutoRecovery::implts_actualizeModifiedState(const css::uno::Reference< css: if (bModified) { rInfo.DocumentState |= AutoRecovery::E_MODIFIED; - rInfo.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } else { rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED; - rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } } @@ -1964,6 +2051,33 @@ AutoRecovery::TDocumentList::iterator AutoRecovery::impl_searchDocument( Au } //----------------------------------------------- +namespace +{ + void lcl_changeVisibility( const css::uno::Reference< css::frame::XFramesSupplier >& i_rFrames, sal_Bool i_bVisible ) + { + css::uno::Reference< css::container::XIndexAccess > xFramesContainer( i_rFrames->getFrames(), css::uno::UNO_QUERY ); + const sal_Int32 count = xFramesContainer->getCount(); + + Any aElement; + for ( sal_Int32 i=0; i < count; ++i ) + { + aElement = xFramesContainer->getByIndex(i); + // check for sub frames + css::uno::Reference< css::frame::XFramesSupplier > xFramesSupp( aElement, css::uno::UNO_QUERY ); + if ( xFramesSupp.is() ) + lcl_changeVisibility( xFramesSupp, i_bVisible ); + + css::uno::Reference< css::frame::XFrame > xFrame( aElement, css::uno::UNO_QUERY ); + if ( !xFrame.is() ) + continue; + + css::uno::Reference< css::awt::XWindow > xWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xWindow->setVisible( i_bVisible ); + } + } +} + +//----------------------------------------------- void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) { // SAFE -> ---------------------------------- @@ -1972,22 +2086,8 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFramesSupplier > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); - css::uno::Reference< css::container::XIndexAccess > xContainer(xDesktop->getFrames() , css::uno::UNO_QUERY); - sal_Int32 c = xContainer->getCount(); - sal_Int32 i = 0; - - for (i=0; i<c; ++i) - { - css::uno::Reference< css::frame::XFrame > xTask; - - xContainer->getByIndex(i) >>= xTask; - if (!xTask.is()) - continue; - - css::uno::Reference< css::awt::XWindow > xWindow = xTask->getContainerWindow(); - xWindow->setVisible(bVisible); - } + css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + lcl_changeVisibility( xDesktop, bVisible ); aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -2180,15 +2280,15 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl continue; // already auto saved during this session :-) - // This state must be reseted for all documents + // This state must be reset for all documents // if timer is started with normnal AutoSaveTimerIntervall! if ((aInfo.DocumentState & AutoRecovery::E_HANDLED) == AutoRecovery::E_HANDLED) continue; // Not modified documents are not saved. // We safe an information about the URL only! - sal_Bool bModified = ((aInfo.DocumentState & AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE ) == AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE); - if (! bModified) + Reference< XDocumentRecovery > xDocRecover( aInfo.Document, UNO_QUERY_THROW ); + if ( !xDocRecover->wasModifiedSinceLastSave() ) { aInfo.DocumentState |= AutoRecovery::E_HANDLED; continue; @@ -2333,7 +2433,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // try to save this document as a new temp file everytimes. // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. - css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW); + Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW); // safe the state about "trying to save" // ... we need it for recovery if e.g. a crash occures inside next line! @@ -2346,7 +2446,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& { try { - xStore->storeToURL(rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList()); + xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception(); @@ -2390,7 +2490,6 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& rInfo.DocumentState &= ~AutoRecovery::E_TRY_SAVE; rInfo.DocumentState |= AutoRecovery::E_HANDLED; rInfo.DocumentState |= AutoRecovery::E_SUCCEDED; - rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } else { @@ -2466,6 +2565,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa lDescriptor[::comphelper::MediaDescriptor::PROP_REFERRER()] <<= REFERRER_USER; lDescriptor[::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()] <<= ::rtl::OUString(); + // recovered documents are loaded hidden, and shown all at once, later + lDescriptor[::comphelper::MediaDescriptor::PROP_HIDDEN()] <<= true; + if (aParams.m_xProgress.is()) lDescriptor[::comphelper::MediaDescriptor::PROP_STATUSINDICATOR()] <<= aParams.m_xProgress; @@ -2531,6 +2633,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa else continue; // TODO ERROR! + LoadEnv::initializeUIDefaults( m_xSMGR, lDescriptor, true, NULL ); + // <- SAFE ------------------------------ aWriteLock.unlock(); @@ -2571,12 +2675,18 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa { ::comphelper::MediaDescriptor lPatchDescriptor(rInfo.Document->getArgs()); lPatchDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= rInfo.RealFilter; - rInfo.Document->attachResource(sURL, lPatchDescriptor.getAsConstPropertyValueList()); + rInfo.Document->attachResource(rInfo.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList()); + // do *not* use sURL here. In case this points to the recovery file, it has already been passed + // to recoverFromFile. Also, passing it here is logically wrong, as attachResource is intended + // to take the logical file URL. } css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); - sal_Bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED); - xModify->setModified(bModified); + if ( xModify.is() ) + { + sal_Bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED); + xModify->setModified(bModified); + } rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP; rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL; @@ -2589,8 +2699,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa /* Normaly we listen as XModifyListener on a document to know if a document was changed since our last AutoSave. And we deregister us in case we know this state. - But directly after one documentw as recovered ... we must start listening. - Otherwhise the first "modify" dont reach us. Because weself called setModified() + But directly after one document as recovered ... we must start listening. + Otherwhise the first "modify" doesnt reach us. Because we ourself called setModified() on the document via API. And currently we dont listen for any events (not at the GlobalEventBroadcaster nor at any document!). */ @@ -2618,60 +2728,113 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); - css::util::URL aURL; - aURL.Complete = sURL; - xParser->parseStrict(aURL); - - LoadDispatchListener* pLoadListener = new LoadDispatchListener(); - css::uno::Reference< css::frame::XDispatchResultListener > xLoadListener (static_cast< css::frame::XDispatchResultListener* >(pLoadListener), css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XFrame > xNewTarget = xDesktop->findFrame(SPECIALTARGET_BLANK, 0); - css::uno::Reference< css::frame::XDispatchProvider > xProvider (xNewTarget, css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XNotifyingDispatch > xDispatcher( - xProvider->queryDispatch(aURL, SPECIALTARGET_SELF, 0), - css::uno::UNO_QUERY_THROW); - - // load the document and listen for the state of this operation. - pLoadListener->setURL(aURL.Complete); - - // make sure the right progress is used always. - impl_establishProgress(rInfo, lDescriptor, xNewTarget); + css::uno::Reference< css::frame::XFrame > xDesktop( xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW ); + ::std::vector< Reference< XComponent > > aCleanup; try { - xDispatcher->dispatchWithNotification( - aURL, - lDescriptor.getAsConstPropertyValueList(), - xLoadListener); + // create a new document of the desired type + Reference< XModel2 > xModel( xSMGR->createInstance( rInfo.FactoryService ), UNO_QUERY_THROW ); + aCleanup.push_back( xModel.get() ); - pLoadListener->wait(0); // wait for ever! + // put the filter name into the descriptor - we're not going to involve any type detection, so + // the document might be lost without the FilterName property + lDescriptor[ ::comphelper::MediaDescriptor::PROP_FILTERNAME() ] <<= rInfo.RealFilter; - css::frame::DispatchResultEvent aResult = pLoadListener->getResult(); - if (aResult.State != css::frame::DispatchResultState::SUCCESS) + if ( sURL == rInfo.FactoryURL ) { - ::rtl::OUStringBuffer sMsg(256); - sMsg.appendAscii("Recovery of \""); - sMsg.append (aURL.Complete ); - sMsg.appendAscii("\" failed." ); - throw css::uno::Exception(sMsg.makeStringAndClear(), static_cast< css::frame::XDispatch* >(this)); + // if the document was a new, unmodified document, then there's nothing to recover, just to init + ENSURE_OR_THROW( ( rInfo.DocumentState & AutoRecovery::E_MODIFIED ) == 0, + "unexpected document state" ); + Reference< XLoadable > xModelLoad( xModel, UNO_QUERY_THROW ); + xModelLoad->initNew(); + + // TODO: remove load-process specific arguments from the descriptor, e.g. the status indicator + xModel->attachResource( sURL, lDescriptor.getAsConstPropertyValueList() ); } + else + { + // let it recover itself + Reference< XDocumentRecovery > xDocRecover( xModel, UNO_QUERY_THROW ); + xDocRecover->recoverFromFile( + sURL, + lDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_SALVAGEDFILE(), ::rtl::OUString() ), + lDescriptor.getAsConstPropertyValueList() + ); + + // No attachResource needed here. By definition (of XDocumentRecovery), the implementation is responsible + // for completely initializing the model, which includes attachResource (or equivalent), if required. + } + + // re-create all the views + ::std::vector< ::rtl::OUString > aViewsToRestore( rInfo.ViewNames.getLength() ); + if ( rInfo.ViewNames.getLength() ) + ::std::copy( rInfo.ViewNames.getConstArray(), rInfo.ViewNames.getConstArray() + rInfo.ViewNames.getLength(), aViewsToRestore.begin() ); + // if we don't have views for whatever reason, then create a default-view, at least + if ( aViewsToRestore.empty() ) + aViewsToRestore.push_back( ::rtl::OUString() ); + + for ( ::std::vector< ::rtl::OUString >::const_iterator viewName = aViewsToRestore.begin(); + viewName != aViewsToRestore.end(); + ++viewName + ) + { + // create a frame + Reference< XFrame > xTargetFrame = xDesktop->findFrame( SPECIALTARGET_BLANK, 0 ); + aCleanup.push_back( xTargetFrame.get() ); - rInfo.Document = fpf::extractFrameModel(xNewTarget); + // create a view to the document + Reference< XController2 > xController; + if ( viewName->getLength() ) + { + xController.set( xModel->createViewController( *viewName, Sequence< PropertyValue >(), xTargetFrame ), UNO_SET_THROW ); + } + else + { + xController.set( xModel->createDefaultViewController( xTargetFrame ), UNO_SET_THROW ); + } + + // introduce model/view/controller to each other + xController->attachModel( xModel.get() ); + xModel->connectController( xController.get() ); + xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( xTargetFrame ); + xModel->setCurrentController( xController.get() ); + } + + rInfo.Document = xModel.get(); } catch(const css::uno::RuntimeException&) { throw; } catch(const css::uno::Exception&) { - css::uno::Reference< css::util::XCloseable > xClose(xNewTarget, css::uno::UNO_QUERY); - xClose->close(sal_True); - xNewTarget.clear(); - throw; - } + Any aCaughtException( ::cppu::getCaughtException() ); + + // clean up + for ( ::std::vector< Reference< XComponent > >::const_iterator component = aCleanup.begin(); + component != aCleanup.end(); + ++component + ) + { + css::uno::Reference< css::util::XCloseable > xClose( *component, css::uno::UNO_QUERY ); + if ( xClose.is() ) + xClose->close( sal_True ); + else + (*component)->dispose(); + } + + // re-throw + ::rtl::OUStringBuffer sMsg(256); + sMsg.appendAscii("Recovery of \""); + sMsg.append (sURL ); + sMsg.appendAscii("\" failed." ); - // of course we must forget all references to this temp(!) progress - impl_forgetProgress(rInfo, lDescriptor, xNewTarget); + throw css::lang::WrappedTargetException( + sMsg.makeStringAndClear(), + static_cast< css::frame::XDispatch* >(this), + aCaughtException + ); + } } //----------------------------------------------- @@ -2783,7 +2946,7 @@ void AutoRecovery::implts_informListener( sal_Int32 eJ if ((eJob & AutoRecovery::E_AUTO_SAVE) == AutoRecovery::E_AUTO_SAVE) sFeature.append(CMD_DO_AUTO_SAVE); #ifdef ENABLE_WARNINGS - else + else if ( eJob != AutoRecovery::E_NO_JOB ) LOG_WARNING("AutoRecovery::implst_getJobDescription()", "Invalid job identifier detected.") #endif @@ -2842,35 +3005,18 @@ css::frame::FeatureStateEvent AutoRecovery::implst_createFeatureStateEvent( if (sEventType.equals(OPERATION_UPDATE) && pInfo) { // pack rInfo for transport via UNO - css::uno::Sequence< css::beans::NamedValue > lInfo(8); - lInfo[0].Name = CFG_ENTRY_PROP_ID; - lInfo[0].Value <<= pInfo->ID; - - lInfo[1].Name = CFG_ENTRY_PROP_ORIGINALURL; - lInfo[1].Value <<= pInfo->OrgURL; - - lInfo[2].Name = CFG_ENTRY_PROP_FACTORYURL; - lInfo[2].Value <<= pInfo->FactoryURL; - - lInfo[3].Name = CFG_ENTRY_PROP_TEMPLATEURL; - lInfo[3].Value <<= pInfo->TemplateURL; - - lInfo[4].Name = CFG_ENTRY_PROP_TEMPURL; - if (pInfo->OldTempURL.getLength()) - lInfo[4].Value <<= pInfo->OldTempURL; - else - lInfo[4].Value <<= pInfo->NewTempURL; - - lInfo[5].Name = CFG_ENTRY_PROP_MODULE; - lInfo[5].Value <<= pInfo->AppModule; - - lInfo[6].Name = CFG_ENTRY_PROP_TITLE; - lInfo[6].Value <<= pInfo->Title; + ::comphelper::NamedValueCollection aInfo; + aInfo.put( CFG_ENTRY_PROP_ID, pInfo->ID ); + aInfo.put( CFG_ENTRY_PROP_ORIGINALURL, pInfo->OrgURL ); + aInfo.put( CFG_ENTRY_PROP_FACTORYURL, pInfo->FactoryURL ); + aInfo.put( CFG_ENTRY_PROP_TEMPLATEURL, pInfo->TemplateURL ); + aInfo.put( CFG_ENTRY_PROP_TEMPURL, pInfo->OldTempURL.getLength() ? pInfo->OldTempURL : pInfo->NewTempURL ); + aInfo.put( CFG_ENTRY_PROP_MODULE, pInfo->AppModule ); + aInfo.put( CFG_ENTRY_PROP_TITLE, pInfo->Title ); + aInfo.put( CFG_ENTRY_PROP_VIEWNAMES, pInfo->ViewNames ); + aInfo.put( CFG_ENTRY_PROP_DOCUMENTSTATE, pInfo->DocumentState ); - lInfo[7].Name = CFG_ENTRY_PROP_DOCUMENTSTATE; - lInfo[7].Value <<= pInfo->DocumentState; - - aEvent.State <<= lInfo; + aEvent.State <<= aInfo.getPropertyValues(); } return aEvent; @@ -2928,6 +3074,9 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) css::uno::makeAny(sal_True), ::comphelper::ConfigurationHelper::E_STANDARD); + // for all docs, store their current view/names in the configurtion + implts_persistAllActiveViewNames(); + // The called method for saving documents runs // during normal AutoSave more then once. Because // it postpone active documents and save it later. @@ -2995,6 +3144,9 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) // Be sure to know all open documents realy .-) implts_verifyCacheAgainstDesktopDocumentList(); + // for all docs, store their current view/names in the configurtion + implts_persistAllActiveViewNames(); + // The called method for saving documents runs // during normal AutoSave more then once. Because // it postpone active documents and save it later. diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 290b4cebc4..fb28da5774 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -110,57 +110,63 @@ Size DecoToolBox::getMinSize() return maMinSize; } +#define STC_BUTTON_STYLE (WB_LEFT | WB_VCENTER | WB_FLATBUTTON | WB_BEVELBUTTON) BackingWindow::BackingWindow( Window* i_pParent ) : Window( i_pParent, FwkResId( DLG_BACKING ) ), maWelcome( this, WB_LEFT ), maProduct( this, WB_LEFT ), - maCreateText( this, WB_LEFT ), - maWriterText( this, WB_WORDBREAK | WB_VCENTER ), - maWriterButton( this, WB_CENTER | WB_BEVELBUTTON ), - maCalcText( this, WB_WORDBREAK | WB_VCENTER ), - maCalcButton( this, WB_CENTER | WB_BEVELBUTTON ), - maImpressText( this, WB_WORDBREAK | WB_VCENTER ), - maImpressButton( this, WB_CENTER | WB_BEVELBUTTON ), - maDrawText( this, WB_WORDBREAK | WB_VCENTER ), - maDrawButton( this, WB_CENTER | WB_BEVELBUTTON ), - maDBText( this, WB_WORDBREAK | WB_VCENTER ), - maDBButton( this, WB_CENTER | WB_BEVELBUTTON ), - maMathText( this, WB_WORDBREAK | WB_VCENTER ), - maMathButton( this, WB_CENTER | WB_BEVELBUTTON ), - maTemplateText( this, WB_WORDBREAK | WB_VCENTER ), - maTemplateButton( this, WB_CENTER | WB_BEVELBUTTON ), - maOpenText( this, WB_WORDBREAK | WB_VCENTER ), - maOpenButton( this, WB_CENTER | WB_BEVELBUTTON ), + maWriterButton( this, STC_BUTTON_STYLE ), + maCalcButton( this, STC_BUTTON_STYLE ), + maImpressButton( this, STC_BUTTON_STYLE ), + maOpenButton( this, STC_BUTTON_STYLE ), + maDrawButton( this, STC_BUTTON_STYLE ), + maDBButton( this, STC_BUTTON_STYLE ), + maMathButton( this, STC_BUTTON_STYLE ), + maTemplateButton( this, STC_BUTTON_STYLE ), maToolbox( this, WB_DIALOGCONTROL ), maWelcomeString( FwkResId( STR_BACKING_WELCOME ) ), maProductString( FwkResId( STR_BACKING_WELCOMEPRODUCT ) ), - maCreateString( FwkResId( STR_BACKING_CREATE ) ), maOpenString( FwkResId( STR_BACKING_FILE ) ), maTemplateString( FwkResId( STR_BACKING_TEMPLATE ) ), maButtonImageSize( 10, 10 ), mbInitControls( false ), - mpAccExec( NULL ) + mnLayoutStyle( 0 ), + mpAccExec( NULL ), + mnBtnPos( 120 ), + mnBtnTop( 150 ) { mnColumnWidth[0] = mnColumnWidth[1] = 0; + mnTextColumnWidth[0] = mnTextColumnWidth[1] = 0; - // get icon images from vcl resource and set them on the appropriate buttons - loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); - loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton ); - loadImage( FwkResId( BMP_BACKING_IMPRESS ), maImpressButton ); - loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton ); - loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton ); - loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); - loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); - loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); + try + { + Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY); + if( xConfig.is() ) + { + Sequence<Any> args(1); + PropertyValue val( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath") ), + 0, + Any(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Help/StartCenter"))), + PropertyState_DIRECT_VALUE); + args.getArray()[0] <<= val; + Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); + if( xNameAccess.is() ) + { + //throws css::container::NoSuchElementException, css::lang::WrappedTargetException + Any value( xNameAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartCenterLayoutStyle"))) ); + mnLayoutStyle = value.get<sal_Int32>(); + } + } + } + catch (Exception& ) + { + } - BitmapEx aExtImage( FwkResId( BMP_BACKING_EXT ) ); String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) ); - BitmapEx aRegImage( FwkResId( BMP_BACKING_REG ) ); String aRegHelpText( FwkResId( STR_BACKING_REGHELP ) ); - BitmapEx aInfoImage( FwkResId( BMP_BACKING_INFO ) ); String aInfoHelpText( FwkResId( STR_BACKING_INFOHELP ) ); - BitmapEx aTplRepImage( FwkResId( BMP_BACKING_TPLREP ) ); String aTplRepHelpText( FwkResId( STR_BACKING_TPLREP ) ); // clean up resource stack @@ -172,33 +178,29 @@ BackingWindow::BackingWindow( Window* i_pParent ) : SetStyle( GetStyle() | WB_DIALOGCONTROL ); - // add some breathing space for the images - maButtonImageSize.Width() += 12; - maButtonImageSize.Height() += 12; - // force tab cycling in toolbox maToolbox.SetStyle( maToolbox.GetStyle() | WB_FORCETABCYCLE ); // insert toolbox items - maToolbox.InsertItem( nItemId_TplRep, Image( aTplRepImage ) ); + maToolbox.InsertItem( nItemId_TplRep, Image() ); maToolbox.SetItemText( nItemId_TplRep, aTplRepHelpText ); maToolbox.SetQuickHelpText( nItemId_TplRep, aTplRepHelpText ); maToolbox.SetItemCommand( nItemId_TplRep, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:TemplateRepository" ) ) ); maToolbox.ShowItem( nItemId_TplRep ); - maToolbox.InsertItem( nItemId_Extensions, Image( aExtImage ) ); + maToolbox.InsertItem( nItemId_Extensions, Image() ); maToolbox.SetQuickHelpText( nItemId_Extensions, aExtHelpText ); maToolbox.SetItemText( nItemId_Extensions, aExtHelpText ); maToolbox.SetItemCommand( nItemId_Extensions, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Extensions" ) ) ); maToolbox.ShowItem( nItemId_Extensions ); - maToolbox.InsertItem( nItemId_Reg, Image( aRegImage ) ); + maToolbox.InsertItem( nItemId_Reg, Image() ); maToolbox.SetQuickHelpText( nItemId_Reg, aRegHelpText ); maToolbox.SetItemText( nItemId_Reg, aRegHelpText ); maToolbox.SetItemCommand( nItemId_Reg, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Register" ) ) ); maToolbox.ShowItem( nItemId_Reg ); - maToolbox.InsertItem( nItemId_Info, Image( aInfoImage ) ); + maToolbox.InsertItem( nItemId_Info, Image() ); maToolbox.SetItemText( nItemId_Info, aInfoHelpText ); maToolbox.SetQuickHelpText( nItemId_Info, aInfoHelpText ); maToolbox.SetItemCommand( nItemId_Info, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Info" ) ) ); @@ -221,6 +223,11 @@ BackingWindow::BackingWindow( Window* i_pParent ) : // init background initBackground(); + + // add some breathing space for the images + maButtonImageSize.Width() += 12; + maButtonImageSize.Height() += 12; + } @@ -259,7 +266,13 @@ void BackingWindow::initBackground() SetBackground( GetSettings().GetStyleSettings().GetWorkspaceGradient() ); bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode(); - maWelcomeTextColor = maLabelTextColor = bDark ? Color( COL_WHITE ) : Color( 0x26, 0x35, 0x42 ); + if( bDark ) + maWelcomeTextColor = maLabelTextColor = Color( COL_WHITE ); + else if( mnLayoutStyle == 1 ) + maWelcomeTextColor = maLabelTextColor = Color( COL_BLACK ); + else + maWelcomeTextColor = maLabelTextColor = Color( 0x26, 0x35, 0x42 ); + Color aTextBGColor( bDark ? COL_BLACK : COL_WHITE ); // select image set @@ -286,29 +299,34 @@ void BackingWindow::initBackground() maBackgroundLeft = BitmapEx( FwkResId( BMP_BACKING_BACKGROUND_LEFT ) ); maBackgroundRight = BitmapEx( FwkResId( BMP_BACKING_BACKGROUND_RIGHT ) ); } + maToolbox.SetItemImage( nItemId_Extensions, BitmapEx( FwkResId( BMP_BACKING_EXT ) ) ); + maToolbox.SetItemImage( nItemId_Reg, BitmapEx( FwkResId( BMP_BACKING_REG ) ) ); + maToolbox.SetItemImage( nItemId_Info, BitmapEx( FwkResId( BMP_BACKING_INFO ) ) ); + maToolbox.SetItemImage( nItemId_TplRep, BitmapEx( FwkResId( BMP_BACKING_TPLREP ) ) ); maWelcome.SetControlForeground( maWelcomeTextColor ); maWelcome.SetBackground(); maProduct.SetControlForeground( maWelcomeTextColor ); maProduct.SetBackground(); - maCreateText.SetControlForeground( maLabelTextColor ); - maCreateText.SetControlBackground( aTextBGColor ); - maWriterText.SetControlForeground( maLabelTextColor ); - maWriterText.SetControlBackground( aTextBGColor ); - maCalcText.SetControlForeground( maLabelTextColor ); - maCalcText.SetControlBackground( aTextBGColor ); - maImpressText.SetControlForeground( maLabelTextColor ); - maImpressText.SetControlBackground( aTextBGColor ); - maDrawText.SetControlForeground( maLabelTextColor ); - maDrawText.SetControlBackground( aTextBGColor ); - maDBText.SetControlForeground( maLabelTextColor ); - maDBText.SetControlBackground( aTextBGColor ); - maMathText.SetControlForeground( maLabelTextColor ); - maMathText.SetControlBackground( aTextBGColor ); - maTemplateText.SetControlForeground( maLabelTextColor ); - maTemplateText.SetControlBackground( aTextBGColor ); - maOpenText.SetControlForeground( maLabelTextColor ); - maOpenText.SetControlBackground( aTextBGColor ); + + if( mnLayoutStyle == 1 ) + { + if( Application::GetSettings().GetLayoutRTL() ) + mnBtnPos = maBackgroundRight.GetSizePixel().Width() + 40; + else + mnBtnPos = maBackgroundLeft.GetSizePixel().Width() + 40; + } + + // get icon images from fwk resource and set them on the appropriate buttons + loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); + loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton ); + loadImage( FwkResId( BMP_BACKING_IMPRESS ), maImpressButton ); + loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton ); + loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton ); + loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); + loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); + loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); + } void BackingWindow::initControls() @@ -344,10 +362,8 @@ void BackingWindow::initControls() nYPos += (maWelcomeSize.Height()*3)/2; - if( maControlRect.GetWidth() < nBtnPos + maWelcomeSize.Width() + 20 ) - maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + nBtnPos + 20; - - maWelcome.Show(); + if( maControlRect.GetWidth() < mnBtnPos + maWelcomeSize.Width() + 20 ) + maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + mnBtnPos + 20; nYPos += maWelcomeSize.Height(); @@ -365,10 +381,14 @@ void BackingWindow::initControls() maProductSize = Size( maProduct.GetTextWidth( maProductString ), maProduct.GetTextHeight() ); maProductSize.Width() = (maProductSize.Width() * 20)/19; - if( maControlRect.GetWidth() < maProductSize.Width() + nBtnPos + 10 ) - maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + nBtnPos + 10; + if( maControlRect.GetWidth() < maProductSize.Width() + mnBtnPos + 10 ) + maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + mnBtnPos + 10; - maProduct.Show(); + if( mnLayoutStyle == 1 ) + { + maWelcome.Show(); + maProduct.Show(); + } nYPos += (maProductSize.Height()*3)/2; @@ -376,14 +396,6 @@ void BackingWindow::initControls() maTextFont.SetSize( Size( 0, 11 ) ); maTextFont.SetWeight( WEIGHT_NORMAL ); - maCreateText.SetText( maCreateString ); - maCreateText.SetFont( maTextFont ); - maCreateText.SetControlFont( maTextFont ); - maCreateSize = Size( maCreateText.GetTextWidth( maCreateString ), maCreateText.GetTextHeight() ); - maCreateText.Show(); - - nYPos += (maCreateSize.Height()*3)/2; - // collect the URLs of the entries in the File/New menu SvtModuleOptions aModuleOptions; std::set< rtl::OUString > aFileNewAppsAvailable; @@ -423,44 +435,65 @@ void BackingWindow::initControls() } // layout the buttons - layoutButtonAndText( WRITER_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maWriterButton, maWriterText, aMnemns ); - layoutButtonAndText( CALC_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SCALC, - maCalcButton, maCalcText, aMnemns ); + layoutButton( WRITER_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maWriterButton, aMnemns ); + layoutButton( DRAW_URL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SDRAW, + maDrawButton, aMnemns ); nYPos += maButtonImageSize.Height() + 10; - layoutButtonAndText( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SIMPRESS, - maImpressButton, maImpressText, aMnemns ); - layoutButtonAndText( DRAW_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SDRAW, - maDrawButton, maDrawText, aMnemns ); + layoutButton( CALC_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SCALC, + maCalcButton, aMnemns ); + layoutButton( BASE_URL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SDATABASE, + maDBButton, aMnemns ); nYPos += maButtonImageSize.Height() + 10; - layoutButtonAndText( BASE_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SDATABASE, - maDBButton, maDBText, aMnemns ); - layoutButtonAndText( MATH_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SMATH, - maMathButton, maMathText, aMnemns ); + layoutButton( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SIMPRESS, + maImpressButton, aMnemns ); + layoutButton( MATH_URL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SMATH, + maMathButton, aMnemns ); nYPos += 3*maButtonImageSize.Height() / 2; - layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maTemplateButton, maTemplateText, aMnemns, maTemplateString ); - - nYPos += 10; - layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maOpenButton, maOpenText, aMnemns, maOpenString ); + + layoutButton( NULL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maOpenButton, aMnemns, maOpenString ); + layoutButton( NULL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maTemplateButton, aMnemns, maTemplateString ); nYPos += 10; DBG_ASSERT( nYPos < maControlRect.GetHeight(), "misformatting !" ); - if( mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20 > maControlRect.GetWidth() ) - maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20; + if( mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20 > maControlRect.GetWidth() ) + maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20; + + mnTextColumnWidth[0] = mnColumnWidth[0]; + mnTextColumnWidth[1] = mnColumnWidth[1]; + + if( mnTextColumnWidth[1] > mnTextColumnWidth[0] ) + { + mnColumnWidth[0] = mnColumnWidth[1]; + mnTextColumnWidth[0] = mnTextColumnWidth[1]; + } + else + { + mnColumnWidth[1] = mnColumnWidth[0]; + mnTextColumnWidth[1] = mnTextColumnWidth[0]; + } + if( maControlRect.GetWidth() < maControlRect.GetHeight() * 3 / 2 ) + { + maControlRect.Right() = maControlRect.Left() + maControlRect.GetHeight() * 3 / 2; + long nDelta = (maControlRect.GetWidth() - mnBtnPos - mnColumnWidth[1] - mnColumnWidth[0] - 20); + mnColumnWidth[0] += nDelta/2; + mnColumnWidth[1] += nDelta/2; + } maToolbox.SetSelectHdl( LINK( this, BackingWindow, ToolboxHdl ) ); - maToolbox.Show(); + if( mnLayoutStyle == 0 ) + maToolbox.Show(); // scale middle map to formatted width Size aMiddleSegmentSize( maControlRect.GetSize().Width() + nShadowLeft + nShadowRight, @@ -478,6 +511,8 @@ void BackingWindow::initControls() maBackgroundMiddle = BitmapEx(); Resize(); + + maWriterButton.GrabFocus(); } void BackingWindow::loadImage( const ResId& i_rId, ImageButton& i_rButton ) @@ -491,11 +526,11 @@ void BackingWindow::loadImage( const ResId& i_rId, ImageButton& i_rButton ) i_rButton.SetModeImage( aBmp ); } -void BackingWindow::layoutButtonAndText( +void BackingWindow::layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, - ImageButton& i_rBtn, FixedText& i_rText, + ImageButton& i_rBtn, MnemonicGenerator& i_rMnemns, const String& i_rStr ) @@ -510,37 +545,28 @@ void BackingWindow::layoutButtonAndText( } // setup text - i_rText.SetFont( maTextFont ); - i_rText.SetControlFont( maTextFont ); + i_rBtn.SetFont( maTextFont ); + i_rBtn.SetControlFont( maTextFont ); String aText( i_rStr.Len() ? i_rStr : SvFileInformationManager::GetDescription( INetURLObject( aURL ) ) ); i_rMnemns.CreateMnemonic( aText ); - i_rText.SetText( aText ); - - long nTextWidth = i_rText.GetTextWidth( i_rText.GetText() ); - i_rText.SetPaintTransparent( TRUE ); + i_rBtn.SetText( aText ); + + long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() ); - nTextWidth += maButtonImageSize.Width() + 30; + nTextWidth += maButtonImageSize.Width() + 8; // add some fuzz to be on the safe side if( nColumn >= 0 && nColumn < static_cast<int>(sizeof(mnColumnWidth)/sizeof(mnColumnWidth[0])) ) { if( nTextWidth > mnColumnWidth[nColumn] ) mnColumnWidth[nColumn] = nTextWidth; } + i_rBtn.SetImageAlign( IMAGEALIGN_LEFT ); // show the controls i_rBtn.Show(); - i_rText.Show(); } void BackingWindow::Paint( const Rectangle& ) { - bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode(); - - Color aBackColor( bDark ? COL_BLACK : COL_WHITE ); - - // fill control rect - SetLineColor(); - SetFillColor( aBackColor ); - DrawRect( maControlRect ); // draw bitmap if( GetSettings().GetLayoutRTL() ) @@ -584,8 +610,73 @@ long BackingWindow::Notify( NotifyEvent& rNEvt ) } const KeyEvent* pEvt = rNEvt.GetKeyEvent(); - if( pEvt && mpAccExec->execute(pEvt->GetKeyCode()) ) + const KeyCode& rKeyCode(pEvt->GetKeyCode()); + if( pEvt && mpAccExec->execute(rKeyCode) ) return 1; + // #i110344# extrawurst: specialized arrow key control + if( rKeyCode.GetModifier() == 0 ) + { + if( rKeyCode.GetCode() == KEY_RIGHT ) + { + if( maWriterButton.HasFocus() ) + maDrawButton.GrabFocus(); + else if( maCalcButton.HasFocus() ) + maDBButton.GrabFocus(); + else if( maImpressButton.HasFocus() ) + maMathButton.GrabFocus(); + else if( maOpenButton.HasFocus() ) + maTemplateButton.GrabFocus(); + return 1; + } + else if( rKeyCode.GetCode() == KEY_LEFT ) + { + if( maDrawButton.HasFocus() ) + maWriterButton.GrabFocus(); + else if( maDBButton.HasFocus() ) + maCalcButton.GrabFocus(); + else if( maMathButton.HasFocus() ) + maImpressButton.GrabFocus(); + else if( maTemplateButton.HasFocus() ) + maOpenButton.GrabFocus(); + return 1; + } + else if( rKeyCode.GetCode() == KEY_UP ) + { + // first column + if( maOpenButton.HasFocus() ) + maImpressButton.GrabFocus(); + else if( maImpressButton.HasFocus() ) + maCalcButton.GrabFocus(); + else if( maCalcButton.HasFocus() ) + maWriterButton.GrabFocus(); + // second column + else if( maTemplateButton.HasFocus() ) + maMathButton.GrabFocus(); + else if( maMathButton.HasFocus() ) + maDBButton.GrabFocus(); + else if( maDBButton.HasFocus() ) + maDrawButton.GrabFocus(); + return 1; + } + else if( rKeyCode.GetCode() == KEY_DOWN ) + { + // first column + if( maWriterButton.HasFocus() ) + maCalcButton.GrabFocus(); + else if( maCalcButton.HasFocus() ) + maImpressButton.GrabFocus(); + else if( maImpressButton.HasFocus() ) + maOpenButton.GrabFocus(); + // second column + else if( maDrawButton.HasFocus() ) + maDBButton.GrabFocus(); + else if( maDBButton.HasFocus() ) + maMathButton.GrabFocus(); + else if( maMathButton.HasFocus() ) + maTemplateButton.GrabFocus(); + return 1; + } + } } return Window::Notify( rNEvt ); } @@ -607,8 +698,10 @@ void BackingWindow::Resize() maToolbox.calcMinSize(); Size aTBSize( maToolbox.getMinSize() ); - Point aTBPos( maControlRect.Right() - aTBSize.Width() - 10, + Point aTBPos( maControlRect.Left() + mnBtnPos, maControlRect.Bottom() - aTBSize.Height() - 10 ); + if( Application::GetSettings().GetLayoutRTL() ) + aTBPos.X() = maControlRect.Right() - aTBSize.Width() - mnBtnPos; maToolbox.SetPosSizePixel( aTBPos, aTBSize ); // #i93631# squeeze controls so they fit into the box @@ -617,7 +710,6 @@ void BackingWindow::Resize() const long nWDelta = maWelcomeSize.Height(); const long nW2Delta = (maWelcomeSize.Height()*3)/2; const long nPDelta = (maProductSize.Height()*3)/2; - const long nCDelta = (maCreateSize.Height()*3)/2; const long nBDelta = maButtonImageSize.Height() + 10; const long nB2Delta = 3*maButtonImageSize.Height()/2; const long nLastDelta = maButtonImageSize.Height(); @@ -626,7 +718,6 @@ void BackingWindow::Resize() (nWDelta - nDiff) + (nW2Delta- nDiff) + (nPDelta - nDiff) + - (nCDelta - nDiff) + 3 * (nBDelta - nDiff) + (nB2Delta- nDiff) + nLastDelta @@ -637,47 +728,29 @@ void BackingWindow::Resize() long nYPos = maControlRect.Top(); nYPos += nW2Delta - nDiff; - maWelcome.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), - Size( maControlRect.GetWidth() - nBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); + maWelcome.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), + Size( maControlRect.GetWidth() - mnBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); nYPos += nWDelta - nDiff; - maProduct.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maProductSize.Height()*20)/19 ) ); + maProduct.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( maControlRect.GetWidth() - mnBtnPos - 5, (maProductSize.Height()*20)/19 ) ); nYPos += nPDelta - nDiff; - maCreateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), - Size( maControlRect.GetWidth() - nBtnPos - 5, maCreateSize.Height() ) ); + nYPos += nWDelta/2 - nDiff; + + if( mnLayoutStyle != 1 ) + nYPos = maControlRect.Top() + mnBtnTop; - nYPos += nCDelta - nDiff; - - maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maWriterText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maCalcText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), - Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); nYPos += nBDelta - nDiff; - maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maImpressText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maDrawText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), - Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maDBButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); nYPos += nBDelta - nDiff; - maDBButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maDBText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - maMathButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maMathText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), - Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maMathButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); nYPos += nB2Delta - nDiff; - maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maTemplateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += nBDelta - nDiff; - maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maOpenText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += nBDelta - nDiff; + maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); } IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) @@ -835,54 +908,6 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) return 0; } -Window* BackingWindow::GetParentLabelFor( const Window* pLabel ) const -{ - const Window* pRet = NULL; - - if( pLabel == &maWriterText ) - pRet = &maWriterButton; - else if( pLabel == &maCalcText ) - pRet = &maCalcButton; - else if( pLabel == &maImpressText ) - pRet = &maImpressButton; - else if( pLabel == &maDrawText ) - pRet = &maDrawButton; - else if( pLabel == &maDBText ) - pRet = &maDBButton; - else if( pLabel == &maMathText ) - pRet = &maMathButton; - else if( pLabel == &maTemplateText ) - pRet = &maTemplateButton; - else if( pLabel == &maOpenText ) - pRet = &maOpenButton; - - return const_cast<Window*>(pRet); -} - -Window* BackingWindow::GetParentLabeledBy( const Window* pLabeled ) const -{ - const Window *pRet = NULL; - - if( pLabeled == &maWriterButton ) - pRet = &maWriterText; - else if( pLabeled == &maCalcButton ) - pRet = &maCalcText; - else if( pLabeled == &maImpressButton ) - pRet = &maImpressText; - else if( pLabeled == &maDrawButton ) - pRet = &maDrawText; - else if( pLabeled == &maDBButton ) - pRet = &maDBText; - else if( pLabeled == &maMathButton ) - pRet = &maMathText; - else if( pLabeled == &maTemplateButton ) - pRet = &maTemplateText; - else if( pLabeled == &maOpenButton ) - pRet = &maOpenText; - - return const_cast<Window*>(pRet); -} - struct ImplDelayedDispatch { Reference< XDispatch > xDispatch; diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index c617b5321d..e1ad2ca457 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -86,24 +86,14 @@ namespace framework Size maWelcomeSize; FixedText maProduct; Size maProductSize; - FixedText maCreateText; - Size maCreateSize; - FixedText maWriterText; ImageButton maWriterButton; - FixedText maCalcText; ImageButton maCalcButton; - FixedText maImpressText; ImageButton maImpressButton; - FixedText maDrawText; + ImageButton maOpenButton; ImageButton maDrawButton; - FixedText maDBText; ImageButton maDBButton; - FixedText maMathText; ImageButton maMathButton; - FixedText maTemplateText; ImageButton maTemplateButton; - FixedText maOpenText; - ImageButton maOpenButton; DecoToolBox maToolbox; @@ -121,16 +111,18 @@ namespace framework Rectangle maControlRect; long mnColumnWidth[2]; + long mnTextColumnWidth[2]; Color maLabelTextColor; Color maWelcomeTextColor; Size maButtonImageSize; bool mbInitControls; + sal_Int32 mnLayoutStyle; svt::AcceleratorExecute* mpAccExec; - - - static const long nBtnPos = 240; + long mnBtnPos; + long mnBtnTop; + static const int nItemId_Extensions = 1; static const int nItemId_Reg = 2; static const int nItemId_Info = 3; @@ -142,12 +134,12 @@ namespace framework void loadImage( const ResId& i_rId, ImageButton& i_rButton ); - void layoutButtonAndText( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, - SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, - ImageButton& i_rBtn, FixedText& i_rText, - MnemonicGenerator& i_rMnemonicGen, - const String& i_rStr = String() - ); + void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, + SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, + ImageButton& i_rBtn, + MnemonicGenerator& i_rMnemonicGen, + const String& i_rStr = String() + ); void dispatchURL( const rtl::OUString& i_rURL, const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ), @@ -168,8 +160,6 @@ namespace framework virtual void Resize(); virtual long Notify( NotifyEvent& rNEvt ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual Window* GetParentLabelFor( const Window* pLabel ) const; - virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; virtual void GetFocus(); void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 92207c9928..08f9b171a9 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2701,21 +2701,7 @@ css::uno::Any SAL_CALL Frame::impl_getPropertyValue(const ::rtl::OUString& /*sPr break; case FRAME_PROPHANDLE_ISHIDDEN : -// aValue <<= m_bIsHidden; - { - sal_Bool bLoadedHidden = m_bIsHidden; - css::uno::Reference< css::frame::XModel > xModel; - if (m_xController.is()) - xModel = m_xController->getModel(); - if (xModel.is()) - { - ::comphelper::MediaDescriptor lDesc(xModel->getArgs()); - bLoadedHidden = lDesc.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_HIDDEN(), - (sal_Bool)sal_False); - } - aValue <<= bLoadedHidden; - } + aValue <<= m_bIsHidden; break; case FRAME_PROPHANDLE_LAYOUTMANAGER : diff --git a/framework/source/services/fwk_services.src b/framework/source/services/fwk_services.src index 1401e3c13e..fbc83db937 100644 --- a/framework/source/services/fwk_services.src +++ b/framework/source/services/fwk_services.src @@ -53,93 +53,93 @@ Window DLG_BACKING { Text [ en-US ] = "~Open a document..."; }; - Bitmap BMP_BACKING_WRITER + String STR_BACKING_EXTHELP { - File = "odt_32.png"; + Text [ en-US ] = "Add new features to %PRODUCTNAME"; }; - Bitmap BMP_BACKING_CALC + String STR_BACKING_REGHELP { - File = "ods_32.png"; + Text [ en-US ] = "Register your %PRODUCTNAME"; }; - Bitmap BMP_BACKING_IMPRESS + String STR_BACKING_INFOHELP { - File = "odp_32.png"; + Text [ en-US ] = "Get more information about %PRODUCTNAME"; }; - Bitmap BMP_BACKING_DRAW + String STR_BACKING_TPLREP { - File = "odg_32.png"; + Text [ en-US ] = "Get more templates for %PRODUCTNAME"; }; - Bitmap BMP_BACKING_DATABASE +}; + +Resource RES_BACKING_IMAGES +{ + Bitmap BMP_BACKING_BACKGROUND_LEFT { - File = "odb_32.png"; + File = "backing.png"; }; - Bitmap BMP_BACKING_FORMULA + Bitmap BMP_BACKING_BACKGROUND_MIDDLE { - File = "odf_32.png"; + File = "backing_space.png"; }; - Bitmap BMP_BACKING_OPENFILE + Bitmap BMP_BACKING_BACKGROUND_RIGHT { - File = "open_32.png"; + File = "backing_right.png"; }; - Bitmap BMP_BACKING_OPENTEMPLATE + Bitmap BMP_BACKING_BACKGROUND_RTL_LEFT { - File = "template_32.png"; + File = "backing_rtl_left.png"; }; - Bitmap BMP_BACKING_EXT + Bitmap BMP_BACKING_BACKGROUND_RTL_RIGHT { - File = "extension_plus_26.png"; + File = "backing_rtl_right.png"; }; - String STR_BACKING_EXTHELP + Bitmap BMP_BACKING_EXT { - Text [ en-US ] = "Add new features to %PRODUCTNAME"; + File = "extension.png"; }; Bitmap BMP_BACKING_REG { File = "register_32.png"; }; - String STR_BACKING_REGHELP - { - Text [ en-US ] = "Register your %PRODUCTNAME"; - }; Bitmap BMP_BACKING_INFO { File = "info_26.png"; }; - String STR_BACKING_INFOHELP - { - Text [ en-US ] = "Get more information about %PRODUCTNAME"; - }; Bitmap BMP_BACKING_TPLREP { File = "addtemplate_32.png"; }; - String STR_BACKING_TPLREP + Bitmap BMP_BACKING_WRITER { - Text [ en-US ] = "Get more templates for %PRODUCTNAME"; + File = "odt_32.png"; }; -}; - -Resource RES_BACKING_IMAGES -{ - Bitmap BMP_BACKING_BACKGROUND_LEFT + Bitmap BMP_BACKING_CALC { - File = "backing.png"; + File = "ods_32.png"; }; - Bitmap BMP_BACKING_BACKGROUND_MIDDLE + Bitmap BMP_BACKING_IMPRESS { - File = "backing_space.png"; + File = "odp_32.png"; }; - Bitmap BMP_BACKING_BACKGROUND_RIGHT + Bitmap BMP_BACKING_DRAW { - File = "backing_right.png"; + File = "odg_32.png"; }; - Bitmap BMP_BACKING_BACKGROUND_RTL_LEFT + Bitmap BMP_BACKING_DATABASE { - File = "backing_rtl_left.png"; + File = "odb_32.png"; }; - Bitmap BMP_BACKING_BACKGROUND_RTL_RIGHT + Bitmap BMP_BACKING_FORMULA { - File = "backing_rtl_right.png"; + File = "odf_32.png"; + }; + Bitmap BMP_BACKING_OPENFILE + { + File = "folder_32.png"; + }; + Bitmap BMP_BACKING_OPENTEMPLATE + { + File = "templates_32.png"; }; }; @@ -165,6 +165,54 @@ Resource RES_BACKING_IMAGES_HC { File = "backing_rtl_right_hc.png"; }; + Bitmap BMP_BACKING_EXT + { + File = "extension_hc.png"; + }; + Bitmap BMP_BACKING_REG + { + File = "register_hc.png"; + }; + Bitmap BMP_BACKING_INFO + { + File = "info_hc.png"; + }; + Bitmap BMP_BACKING_TPLREP + { + File = "template_hc.png"; + }; + Bitmap BMP_BACKING_WRITER + { + File = "odt_32_hc.png"; + }; + Bitmap BMP_BACKING_CALC + { + File = "ods_32_hc.png"; + }; + Bitmap BMP_BACKING_IMPRESS + { + File = "odp_32_hc.png"; + }; + Bitmap BMP_BACKING_DRAW + { + File = "odg_32_hc.png"; + }; + Bitmap BMP_BACKING_DATABASE + { + File = "odb_32_hc.png"; + }; + Bitmap BMP_BACKING_FORMULA + { + File = "odf_32_hc.png"; + }; + Bitmap BMP_BACKING_OPENFILE + { + File = "folder_32_hc.png"; + }; + Bitmap BMP_BACKING_OPENTEMPLATE + { + File = "templates_32_hc.png"; + }; }; Window WIN_TABWINDOW diff --git a/framework/source/uielement/rootitemcontainer.cxx b/framework/source/uielement/rootitemcontainer.cxx index c0d79b6f8b..eeeb621613 100644 --- a/framework/source/uielement/rootitemcontainer.cxx +++ b/framework/source/uielement/rootitemcontainer.cxx @@ -127,7 +127,6 @@ RootItemContainer::RootItemContainer( const Reference< XIndexAccess >& rSourceCo Reference< XPropertySet > xPropSet( rSourceContainer, UNO_QUERY ); if ( xPropSet.is() ) { - rtl::OUString aUIName; xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= m_aUIName; } } diff --git a/framework/source/xml/makefile.mk b/framework/source/xml/makefile.mk index dd40af0cbe..a4f18a555a 100644 --- a/framework/source/xml/makefile.mk +++ b/framework/source/xml/makefile.mk @@ -47,7 +47,6 @@ SLOFILES= \ $(SLO)$/statusbardocumenthandler.obj \ $(SLO)$/toolboxconfiguration.obj \ $(SLO)$/toolboxdocumenthandler.obj \ - $(SLO)$/toolboxlayoutdocumenthandler.obj \ $(SLO)$/saxnamespacefilter.obj \ $(SLO)$/xmlnamespaces.obj \ $(SLO)$/acceleratorconfigurationreader.obj \ diff --git a/framework/source/xml/toolboxconfiguration.cxx b/framework/source/xml/toolboxconfiguration.cxx index 6ef6d36b94..4ed368af21 100644 --- a/framework/source/xml/toolboxconfiguration.cxx +++ b/framework/source/xml/toolboxconfiguration.cxx @@ -30,7 +30,6 @@ #include "precompiled_framework.hxx" #include <xml/toolboxconfiguration.hxx> #include <xml/toolboxdocumenthandler.hxx> -#include <xml/toolboxlayoutdocumenthandler.hxx> #include <xml/saxnamespacefilter.hxx> #include <services.h> diff --git a/framework/source/xml/toolboxlayoutdocumenthandler.cxx b/framework/source/xml/toolboxlayoutdocumenthandler.cxx deleted file mode 100644 index 039eaffad2..0000000000 --- a/framework/source/xml/toolboxlayoutdocumenthandler.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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 <stdio.h> - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ - -#include <threadhelp/resetableguard.hxx> -#include <xml/toolboxlayoutdocumenthandler.hxx> -#include <macros/debug.hxx> -#include <xml/toolboxconfigurationdefines.hxx> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ - -#ifndef __COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> -#endif - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <vcl/svapp.hxx> -#include <vcl/toolbox.hxx> - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ |