diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /framework/inc/services | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'framework/inc/services')
-rw-r--r-- | framework/inc/services/desktop.hxx | 469 | ||||
-rw-r--r-- | framework/inc/services/layoutmanager.hxx | 275 | ||||
-rw-r--r-- | framework/inc/services/mediatypedetectionhelper.hxx | 88 | ||||
-rw-r--r-- | framework/inc/services/uriabbreviation.hxx | 59 |
4 files changed, 891 insertions, 0 deletions
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx new file mode 100644 index 000000000..90d2a04bd --- /dev/null +++ b/framework/inc/services/desktop.hxx @@ -0,0 +1,469 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX +#define INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX + +#include <sal/config.h> + +#include <memory> +#include <vector> + +#include <classes/framecontainer.hxx> + +#include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XTasksSupplier.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/propshlp.hxx> +#include <threadhelp/transactionmanager.hxx> +#include <unotools/cmdoptions.hxx> + +namespace framework{ + +enum ELoadState +{ + E_NOTSET , + E_SUCCESSFUL , + E_FAILED , + E_INTERACTION +}; + +/*-************************************************************************************************************ + @short implement the topframe of frame tree + @descr This is the root of the frame tree. The desktop has no window, is not visible but he is the logical + "masternode" to build the hierarchy. + + @implements XInterface + XTypeProvider + XServiceInfo + XDesktop + XComponentLoader + XTasksSupplier + XDispatchProvider + XFramesSupplier + XFrame + XComponent + XPropertySet + XFastPropertySet + XMultiPropertySet + XDispatchResultListener + XEventListener + XInteractionHandler + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +typedef cppu::WeakComponentImplHelper< + css::lang::XServiceInfo , + css::frame::XDesktop2 , + css::task::XJob, // for internal "shutdown" command + css::frame::XTasksSupplier , + css::frame::XDispatchResultListener , // => XEventListener + css::task::XInteractionHandler , + css::frame::XUntitledNumbers > Desktop_BASE; + +class Desktop final : private cppu::BaseMutex, + public Desktop_BASE, + public cppu::OPropertySetHelper +{ + // internal used types, const etcpp. + private: + + /** used temporary to know which listener was already called or not. */ + typedef ::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList; + + // public methods + public: + + // constructor / destructor + Desktop( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~Desktop( ) override; + + void constructorInit(); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XInterface + virtual void SAL_CALL acquire() throw () override + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () override + { OWeakObject::release(); } + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + /** + @interface XDesktop + + @short try to shutdown these desktop environment. + + @descr Will try to close all frames. If at least one frame could + not be closed successfully termination will be stopped. + + Registered termination listener will be taken into account + also. As special feature some of our registered listener + are well known by its UNO implementation name. They are handled + different to all other listener. + + Btw: Desktop.terminate() was designed in the past to be used + within an UI based environment. So it's allowed e.g. to + call XController.suspend() here. If UI isn't an option ... please + use XCloseable.close() at these desktop implementation. + ... if it will be supported in the future .-)) + + @seealso XTerminateListener + @seealso XTerminateListener2 + + @return true if all open frames could be closed and no listener threw + a veto exception; false otherwise. + + @onerror False will be returned. + @threadsafe yes + */ + virtual sal_Bool SAL_CALL terminate() override; + + /** + @interface XDesktop + + @short add a listener for termination events + + @descr Additional to adding normal listener these method was implemented special. + Every listener will be asked for its uno implementation name. + Some of them are well known... and the corresponding listener won't be added + to the container of "normal listener". Those listener will be set as special + member. + see e.g. member m_xSfxTerminator + + @seealso terminate() + + @param xListener + the listener for registration. + + @threadsafe yes + */ + virtual void SAL_CALL addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) override; + + /** + @interface XDesktop + + @short remove a listener from this container. + + @descr Additional to removing normal listener these method was implemented special. + Every listener will be asked for its uno implementation name. + Some of them are well known... and the corresponding listener was set as special member. + Now those special member will be reset also. + see e.g. member m_xSfxTerminator + + @seealso terminate() + + @param xListener + the listener for deregistration. + + @threadsafe yes + */ + virtual void SAL_CALL removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) override; + + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getComponents ( ) override; + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getCurrentComponent ( ) override; + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getCurrentFrame ( ) override; + + // XComponentLoader + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const OUString& sURL , + const OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override; + + // XTasksSupplier + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTasks ( ) override; + virtual css::uno::Reference< css::frame::XTask > SAL_CALL getActiveTask ( ) override; + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) override; + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lQueries ) override; + + // XDispatchProviderInterception + virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override; + virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override; + + // XFramesSupplier + virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) override; + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) override; + virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) override; + + // XFrame + // Attention: findFrame() is implemented only! Other methods make no sense for our desktop! + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) override; + virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) override; + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) override; + virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) override; + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) override; + virtual OUString SAL_CALL getName ( ) override; + virtual void SAL_CALL setName ( const OUString& sName ) override; + virtual sal_Bool SAL_CALL isTop ( ) override; + virtual void SAL_CALL activate ( ) override; + virtual void SAL_CALL deactivate ( ) override; + virtual sal_Bool SAL_CALL isActive ( ) override; + virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) override; + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) override; + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) override; + virtual void SAL_CALL contextChanged ( ) override; + virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) override; + virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + + // XDispatchResultListener + virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing ( const css::lang::EventObject& aSource ) override; + + // XInteractionHandler + virtual void SAL_CALL handle ( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) override; + + // css.frame.XUntitledNumbers + virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) override; + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) override; + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) override; + + // css.frame.XUntitledNumbers + virtual OUString SAL_CALL getUntitledPrefix() override; + + // we need this wrapped terminate()-call to terminate even the QuickStarter + // non-virtual and non-UNO for now + /// @throws css::uno::RuntimeException + bool terminateQuickstarterToo(); + + css::uno::Any SAL_CALL execute(css::uno::Sequence<css::beans::NamedValue> const & Arguments) + override; + + private: + void shutdown(); + + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) override; + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue , + sal_Int32 nHandle ) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ) override; + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) override; + + css::uno::Reference< css::lang::XComponent > impl_getFrameComponent ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; + + /** calls queryTermination() on every registered termination listener. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + * + * @param [out] lCalledListener + * every called listener will be returned here. + * Those list will be used to inform all called listener + * about cancel this termination request. + * + * @return true if no one vetoed the termination. + * + * @see impl_sendCancelTerminationEvent() + */ + bool impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener); + + /** calls cancelTermination() on every termination listener + * where queryTermination() was called before. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + * + * @param [in] lCalledListener + * every listener in this list was called within its method + * queryTermination() before. + * + * @see impl_sendQueryTerminationEvent() + */ + void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener); + + /** calls notifyTermination() on the clipboard listener + * + * The system clipboard may decide that it wants copies + * in several formats of the clipboard content requiring + * nearly all the services + * + */ + void impl_sendTerminateToClipboard(); + + /** calls notifyTermination() on every registered termination listener. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + */ + void impl_sendNotifyTerminationEvent(); + + /** try to close all open frames. + * + * Iterates over all child frames and try to close them. + * Given parameter bAllowUI enable/disable showing any UI + * (which mostly occur on calling XController->suspend()). + * + * This method doesn't stop if one frame could not be closed. + * It will ignore such frames and try all other ones. + * But it returns false in such case - true otherwise. + * + * @param bAllowUI + * enable/disable showing of UI. + * + * @return true if all frames could be closed; false otherwise. + */ + bool impl_closeFrames(bool bAllowUI); + + private: + + mutable TransactionManager m_aTransactionManager; + + /** check flag to protect against multiple terminate runs + */ + bool m_bIsTerminated; + + /** check flag to protect us against dispose before terminate! + * see dispose() for further information! + */ + bool m_bIsShutdown; + + /** when true, the call came from session manager + * the method is Desktop::terminateQuickstarterToo() + * this the only one place where set this to true + * In this case, when one frame break, not make + * question for other, the break of shutdown or logout + * can be only once. + * In Desktop::impl_closeFrames would be test and break + * the loop and reset to false + */ + bool m_bSession; + + css::uno::Reference< css::uno::XComponentContext > m_xContext; /// reference to factory, which has create this instance + FrameContainer m_aChildTaskContainer; /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!) + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer! + css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper; /// helper to dispatch something for new tasks, created by "_blank"! + ELoadState m_eLoadState; /// hold information about state of asynchron loading of component for loadComponentFromURL()! + bool m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto + std::unique_ptr<SvtCommandOptions> m_xCommandOptions; /// ref counted class to support disabling commands defined by configuration file + OUString m_sName; + OUString m_sTitle; + css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier; + + /** special terminate listener to close pipe and block external requests + * during/after termination process is/was running + */ + css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator; + + /** special terminate listener shown inside system tray (quick starter) + * Will hinder the office on shutdown ... but wish to allow closing + * of open documents. And because that's different to a normal terminate listener + * it has to be handled special .-) + */ + css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher; + + /** special terminate listener active when a macro is executing. + * Because basic runs Application::Yield internally the application may quit + * while running inside the internal basic event loop. So all the basic + * infrastructure may be deleted while the call is executing, leading to + * a variant of crashes. So this special terminate listener will + * veto the current quit attempt, stop basic execution, which will + * cause the inner event loop to quit, and on return to the outer normal + * application event loop then resend the quit attempt. + * So these implementation must be a special terminate listener too .-( + */ + css::uno::Reference< css::frame::XTerminateListener > m_xStarBasicQuitGuard; + + /** special terminate listener which loads images asynchronous for current open documents. + * Because internally it uses blocking system APIs... it can't be guaranteed that + * running jobs can be cancelled successfully if the corresponding document will be closed... + * it will not hinder those documents on closing. Instead it let all jobs running... + * but at least on terminate we have to wait for all those blocked requests. + * So these implementation must be a special terminate listener too .-( + */ + css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager; + + /** special terminate listener shutting down the SfxApplication. + * Because these desktop instance closes documents and informs listener + * only... it does not really shutdown the whole application. + * + * Btw: that wouldn't be possible by design... because Desktop.terminate() + * has to return a boolean value about success... it can't really shutdown the + * process .-) + * + * So we uses a trick: a special listener (exactly these one here) listen for notifyTermination() + * and shutdown the process asynchronous. But desktop has to make this special + * notification as really last one ... Otherwise it can happen that asynchronous + * shutdown will be faster then all other code around Desktop.terminate() .-)) + */ + css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator; + + css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator; + + std::vector<css::uno::Reference<css::frame::XTerminateListener>> m_xComponentDllListeners; + +}; // class Desktop + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx new file mode 100644 index 000000000..955b2e425 --- /dev/null +++ b/framework/inc/services/layoutmanager.hxx @@ -0,0 +1,275 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_LAYOUTMANAGER_HXX +#define INCLUDED_FRAMEWORK_INC_SERVICES_LAYOUTMANAGER_HXX + +#include <uielement/menubarmanager.hxx> +#include <uielement/uielement.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XLayoutManager2.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/XUIElementFactoryManager.hpp> +#include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/XTopWindow2.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <comphelper/propertycontainer.hxx> +#include <comphelper/uno3.hxx> +#include <vcl/timer.hxx> + +class MenuBar; +namespace framework +{ + + class ToolbarLayoutManager; + class GlobalSettings; + namespace detail + { + class InfoHelperBuilder; + } + typedef ::cppu::WeakImplHelper < css::lang::XServiceInfo + , css::frame::XLayoutManager2 + , css::awt::XWindowListener + > LayoutManager_Base; + typedef ::comphelper::OPropertyContainer LayoutManager_PBase; + class LayoutManager final : public LayoutManager_Base , + private cppu::BaseMutex, + public ::cppu::OBroadcastHelper , + public LayoutManager_PBase + { + public: + LayoutManager( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~LayoutManager() override; + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + DECLARE_XINTERFACE() + DECLARE_XTYPEPROVIDER() + virtual OUString SAL_CALL getImplementationName() override + { + return "com.sun.star.comp.framework.LayoutManager"; + } + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override + { + return cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override + { + css::uno::Sequence< OUString > aSeq { "com.sun.star.frame.LayoutManager" }; + return aSeq; + } + + // XLayoutManager + virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& Frame ) override; + virtual void SAL_CALL reset() override; + virtual css::awt::Rectangle SAL_CALL getCurrentDockingArea( ) override; + virtual css::uno::Reference< css::ui::XDockingAreaAcceptor > SAL_CALL getDockingAreaAcceptor() override; + virtual void SAL_CALL setDockingAreaAcceptor( const css::uno::Reference< css::ui::XDockingAreaAcceptor >& xDockingAreaAcceptor ) final override; + virtual void SAL_CALL createElement( const OUString& aName ) override; + virtual void SAL_CALL destroyElement( const OUString& aName ) override; + virtual sal_Bool SAL_CALL requestElement( const OUString& ResourceURL ) override; + virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL getElement( const OUString& aName ) override; + virtual css::uno::Sequence< css::uno::Reference< css::ui::XUIElement > > SAL_CALL getElements( ) override; + virtual sal_Bool SAL_CALL showElement( const OUString& aName ) override; + virtual sal_Bool SAL_CALL hideElement( const OUString& aName ) override; + virtual sal_Bool SAL_CALL dockWindow( const OUString& aName, css::ui::DockingArea DockingArea, const css::awt::Point& Pos ) override; + virtual sal_Bool SAL_CALL dockAllWindows( ::sal_Int16 nElementType ) override; + virtual sal_Bool SAL_CALL floatWindow( const OUString& aName ) override; + virtual sal_Bool SAL_CALL lockWindow( const OUString& ResourceURL ) override; + virtual sal_Bool SAL_CALL unlockWindow( const OUString& ResourceURL ) override; + virtual void SAL_CALL setElementSize( const OUString& aName, const css::awt::Size& aSize ) override; + virtual void SAL_CALL setElementPos( const OUString& aName, const css::awt::Point& aPos ) override; + virtual void SAL_CALL setElementPosSize( const OUString& aName, const css::awt::Point& aPos, const css::awt::Size& aSize ) override; + virtual sal_Bool SAL_CALL isElementVisible( const OUString& aName ) override; + virtual sal_Bool SAL_CALL isElementFloating( const OUString& aName ) override; + virtual sal_Bool SAL_CALL isElementDocked( const OUString& aName ) override; + virtual sal_Bool SAL_CALL isElementLocked( const OUString& ResourceURL ) override; + virtual css::awt::Size SAL_CALL getElementSize( const OUString& aName ) override; + virtual css::awt::Point SAL_CALL getElementPos( const OUString& aName ) override; + virtual void SAL_CALL lock( ) override; + virtual void SAL_CALL unlock( ) override; + virtual void SAL_CALL doLayout( ) override; + virtual void SAL_CALL setVisible( sal_Bool bVisible ) override; + virtual sal_Bool SAL_CALL isVisible() override; + + // XMenuBarMergingAcceptor + + virtual sal_Bool SAL_CALL setMergedMenuBar( const css::uno::Reference< css::container::XIndexAccess >& xMergedMenuBar ) override; + virtual void SAL_CALL removeMergedMenuBar( ) override; + + // XWindowListener + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) override; + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) override; + virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) override; + virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) override; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) override; + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override; + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementRemoved( const css::ui::ConfigurationEvent& Event ) override; + virtual void SAL_CALL elementReplaced( const css::ui::ConfigurationEvent& Event ) override; + + // XLayoutManagerEventBroadcaster + virtual void SAL_CALL addLayoutManagerEventListener( const css::uno::Reference< css::frame::XLayoutManagerListener >& aLayoutManagerListener ) override; + virtual void SAL_CALL removeLayoutManagerEventListener( const css::uno::Reference< css::frame::XLayoutManagerListener >& aLayoutManagerListener ) override; + + DECL_LINK( MenuBarClose, void *, void); + DECL_LINK( WindowEventListener, VclWindowEvent&, void ); + + // called from ToolbarLayoutManager + void requestLayout(); + + /// Reading of settings - shared with ToolbarLayoutManager. + static bool readWindowStateData( const OUString& rName, UIElement& rElementData, + const css::uno::Reference< css::container::XNameAccess > &rPersistentWindowState, + std::unique_ptr<GlobalSettings> &rGlobalSettings, bool &bInGlobalSettings, + const css::uno::Reference< css::uno::XComponentContext > &rComponentContext ); + + private: + DECL_LINK(AsyncLayoutHdl, Timer *, void); + + // menu bar + + void implts_createMenuBar( const OUString& rMenuBarName ); + void impl_clearUpMenuBar(); + void implts_reset( bool bAttach ); + void implts_updateMenuBarClose(); + bool implts_resetMenuBar(); + void implts_createMSCompatibleMenuBar(const OUString& rName); + + // locking + + void implts_lock(); + bool implts_unlock(); + + // query + + css::uno::Reference< css::ui::XUIElement > implts_findElement( const OUString& aName ); + + bool implts_readWindowStateData( const OUString& rName, UIElement& rElementData ); + void implts_writeWindowStateData( const OUString& rName, const UIElement& rElementData ); + void implts_destroyElements(); + void implts_toggleFloatingUIElementsVisibility( bool bActive ); + void implts_reparentChildWindows(); + css::uno::Reference< css::ui::XUIElement > implts_createDockingWindow( const OUString& aElementName ); + + bool implts_isEmbeddedLayoutManager() const; + css::uno::Reference< css::ui::XUIElement > implts_createElement( const OUString& aName ); + + // layouting methods + bool implts_resizeContainerWindow( const css::awt::Size& rContainerSize, const css::awt::Point& rComponentPos ); + ::Size implts_getContainerWindowOutputSize(); + + void implts_setDockingAreaWindowSizes(); + css::awt::Rectangle implts_calcDockingAreaSizes(); + bool implts_doLayout( bool bForceRequestBorderSpace, bool bOuterResize ); + void implts_doLayout_notify( bool bOuterResize ); + + // internal methods to control status/progress bar + ::Size implts_getStatusBarSize(); + void implts_destroyStatusBar(); + void implts_createStatusBar( const OUString& rStatusBarName ); + void implts_createProgressBar(); + void implts_destroyProgressBar(); + void implts_setStatusBarPosSize( const ::Point& rPos, const ::Size& rSize ); + bool implts_showStatusBar( bool bStoreState=false ); + bool implts_hideStatusBar( bool bStoreState=false ); + void implts_readStatusBarState( const OUString& rStatusBarName ); + bool implts_showProgressBar(); + bool implts_hideProgressBar(); + void implts_backupProgressBarWrapper(); + void implts_setOffset( const sal_Int32 nBottomOffset ); + + /// @throws css::uno::RuntimeException + void implts_setInplaceMenuBar( + const css::uno::Reference< css::container::XIndexAccess >& xMergedMenuBar ); + /// @throws css::uno::RuntimeException + void implts_resetInplaceMenuBar(); + + void implts_setVisibleState( bool bShow ); + void implts_updateUIElementsVisibleState( bool bShow ); + void implts_setCurrentUIVisibility( bool bShow ); + void implts_notifyListeners(short nEvent, const css::uno::Any& rInfoParam); + + // OPropertySetHelper + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** reference to factory, which has created this instance. */ + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xModuleCfgMgr; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocCfgMgr; + css::uno::Reference< css::awt::XWindow > m_xContainerWindow; + css::uno::Reference< css::awt::XTopWindow2 > m_xContainerTopWindow; + sal_Int32 m_nLockCount; + bool m_bInplaceMenuSet; + bool m_bMenuVisible; + bool m_bVisible; + bool m_bParentWindowVisible; + bool m_bMustDoLayout; + bool m_bAutomaticToolbars; + bool m_bHideCurrentUI; + bool m_bGlobalSettings; + bool m_bPreserveContentSize; + bool m_bMenuBarCloseButton; + css::awt::Rectangle m_aDockingArea; + css::uno::Reference< css::ui::XDockingAreaAcceptor > m_xDockingAreaAcceptor; + rtl::Reference< MenuBarManager > m_xInplaceMenuBar; + css::uno::Reference< css::ui::XUIElement > m_xMenuBar; + UIElement m_aStatusBarElement; + UIElement m_aProgressBarElement; + css::uno::Reference< css::ui::XUIElement > m_xProgressBarBackup; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; + css::uno::Reference< css::ui::XUIElementFactoryManager > m_xUIElementFactoryManager; + css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowState; + css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowStateSupplier; + std::unique_ptr<GlobalSettings> m_pGlobalSettings; + OUString m_aModuleIdentifier; + Timer m_aAsyncLayoutTimer; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener + rtl::Reference< ToolbarLayoutManager > m_xToolbarManager; + + friend class detail::InfoHelperBuilder; + }; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_SERVICES_LAYOUTMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/services/mediatypedetectionhelper.hxx b/framework/inc/services/mediatypedetectionhelper.hxx new file mode 100644 index 000000000..8dd565301 --- /dev/null +++ b/framework/inc/services/mediatypedetectionhelper.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_MEDIATYPEDETECTIONHELPER_HXX +#define INCLUDED_FRAMEWORK_INC_SERVICES_MEDIATYPEDETECTIONHELPER_HXX + +#include <macros/xserviceinfo.hxx> + +#include <com/sun/star/util/XStringMapping.hpp> + +#include <cppuhelper/implbase.hxx> + +// namespaces + +namespace framework{ + +/*-************************************************************************************************************ + @implements XInterface + XTypeProvider + XServiceInfo + XStringMapping + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class MediaTypeDetectionHelper final : public ::cppu::WeakImplHelper< css::util::XStringMapping, css::lang::XServiceInfo> +{ + + // public methods + + public: + + // constructor / destructor + + /*-**************************************************************************************************** + @short standard ctor + @descr These initialize a new instance of this class with all needed information for work. + @param "xFactory", reference to factory which has created our owner(!). We can use these to create new uno-services. + *//*-*****************************************************************************************************/ + + MediaTypeDetectionHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-**************************************************************************************************** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + *//*-*****************************************************************************************************/ + + virtual ~MediaTypeDetectionHelper() override; + + // XInterface, XTypeProvider, XServiceInfo + + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // XStringMapping + + /*-**************************************************************************************************** + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL mapStrings(css::uno::Sequence< OUString >& seqParameter) override; + +}; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_SERVICES_MEDIATYPEDETECTIONHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/services/uriabbreviation.hxx b/framework/inc/services/uriabbreviation.hxx new file mode 100644 index 000000000..a3794b63a --- /dev/null +++ b/framework/inc/services/uriabbreviation.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_URIABBREVIATION_HXX +#define INCLUDED_FRAMEWORK_INC_SERVICES_URIABBREVIATION_HXX + +#include <macros/xserviceinfo.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XStringAbbreviation.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace framework +{ + +class UriAbbreviation final : public ::cppu::WeakImplHelper< css::util::XStringAbbreviation, css::lang::XServiceInfo> +{ +public: + explicit UriAbbreviation(css::uno::Reference< css::uno::XComponentContext > const & context); + + DECLARE_XSERVICEINFO_NOFACTORY + /* Helper for registry */ + /// @throws css::uno::Exception + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + + // css::util::XStringAbbreviation: + virtual OUString SAL_CALL abbreviateString(const css::uno::Reference< css::util::XStringWidth > & xStringWidth, ::sal_Int32 nWidth, const OUString & aString) override; + +private: + UriAbbreviation(UriAbbreviation const &) = delete; + UriAbbreviation& operator =(UriAbbreviation const &) = delete; + + virtual ~UriAbbreviation() override {} +}; + +} // namespace framework + +#endif // INCLUDED_FRAMEWORK_INC_SERVICES_URIABBREVIATION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |