diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sd/source/ui/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sd/source/ui/inc')
205 files changed, 21517 insertions, 0 deletions
diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx new file mode 100644 index 0000000000..a514cfc424 --- /dev/null +++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx @@ -0,0 +1,324 @@ +/* -*- 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_SD_SOURCE_UI_INC_ACCESSIBLEDOCUMENTVIEWBASE_HXX +#define INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLEDOCUMENTVIEWBASE_HXX + +#include <editeng/AccessibleContextBase.hxx> +#include <editeng/AccessibleComponentBase.hxx> +#include <editeng/AccessibleSelectionBase.hxx> +#include "AccessibleViewForwarder.hxx" +#include <svx/AccessibleShapeTreeInfo.hxx> +#include <svx/IAccessibleViewForwarderListener.hxx> + +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <tools/link.hxx> + +#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> + +#include "Window.hxx" + +namespace com::sun::star::accessibility { class XAccessible; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::awt { class XWindow; } + +class VclWindowEvent; + +namespace sd { +class ViewShell; +} + +namespace accessibility { + +/** Base class for the various document views of the Draw and + Impress applications. + + <p>The different view modes of the Draw and Impress applications + are made accessible by derived classes. When the view mode is + changed then the object representing the document view is + disposed and replaced by a new instance of the then appropriate + derived class.</p> + + <p>This base class also manages an optionally active accessible OLE + object. If you overwrite the <member>getAccessibleChildCount</member> + and <member>getAccessibleChild</member> methods then make sure to first + call the corresponding method of this class and adapt your child count + and indices accordingly. Only one active OLE object is allowed at a + time. This class does not listen for disposing calls at the moment + because it does not use the accessible OLE object directly and trusts on + getting informed through VCL window events.</p> + + <p>This class implements three kinds of listeners: + <ol><li>The property change listener is not used directly but exists as + convenience for derived classes. May be moved to those classes + instead.</li> + <li>As window listener it waits for changes of the window geometry and + forwards those as view forwarder changes.</li> + <li>As focus listener it keeps track of the focus to give this class and + derived classes the opportunity to set and remove the focus to/from + shapes.</li> + </ol> + </p> +*/ +class AccessibleDocumentViewBase + : public AccessibleContextBase, + public AccessibleComponentBase, + public AccessibleSelectionBase, + public IAccessibleViewForwarderListener, + public css::beans::XPropertyChangeListener, + public css::awt::XWindowListener, + public css::awt::XFocusListener, + public css::accessibility::XAccessibleExtendedAttributes +{ +public: + //===== internal ======================================================== + + /** Create a new object. Note that the caller has to call the + Init method directly after this constructor has finished. + @param pSdWindow + The window whose content is to be made accessible. + @param pViewShell + The view shell associated with the given window. + @param rxController + The controller from which to get the model. + @param rxParent + The accessible parent of the new object. Note that this parent does + not necessarily correspond with the parent of the given window. + */ + AccessibleDocumentViewBase ( + ::sd::Window* pSdWindow, + ::sd::ViewShell* pViewShell, + css::uno::Reference<css::frame::XController> xController, + const css::uno::Reference<css::accessibility::XAccessible>& rxParent); + + virtual ~AccessibleDocumentViewBase() override; + + /** Initialize a new object. Call this method directly after creating a + new object. It finished the initialization begun in the constructor + but which needs a fully created object. + */ + virtual void Init(); + + /** Define callback for listening to window child events of VCL. + Listen for creation or destruction of OLE objects. + */ + DECL_LINK( WindowChildEventListener, VclWindowEvent&, void ); + + //===== IAccessibleViewForwarderListener ================================ + + /** A view forwarder change is signalled for instance when any of the + window events is received. Thus, instead of overriding the four + windowResized... methods it will be sufficient in most cases just to + override this method. + */ + virtual void ViewForwarderChanged() override; + + //===== XAccessibleContext ============================================== + + virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL + getAccessibleParent() override; + + /** This implementation returns either 1 or 0 depending on whether there + is an active accessible OLE object or not. + */ + virtual sal_Int64 SAL_CALL + getAccessibleChildCount() override; + + /** This implementation either returns the active accessible OLE object + if it exists and the given index is 0 or throws an exception. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int64 nIndex) override; + + //===== XAccessibleComponent ============================================ + + virtual css::uno::Reference<css::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint (const css::awt::Point& aPoint) override; + + virtual css::awt::Rectangle SAL_CALL getBounds() override; + + virtual css::awt::Point SAL_CALL getLocation() override; + + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + + virtual css::awt::Size SAL_CALL getSize() override; + + //===== XInterface ====================================================== + + virtual css::uno::Any SAL_CALL + queryInterface (const css::uno::Type & rType) override; + + virtual void SAL_CALL + acquire() + noexcept override; + + virtual void SAL_CALL + release() + noexcept override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + virtual css::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames() override; + + //===== XTypeProvider =================================================== + + virtual css::uno::Sequence< css::uno::Type> SAL_CALL + getTypes() override; + + //===== lang::XEventListener ============================================ + + virtual void SAL_CALL + disposing (const css::lang::EventObject& rEventObject) override; + + //===== XPropertyChangeListener ========================================= + + virtual void SAL_CALL + propertyChange (const css::beans::PropertyChangeEvent& rEventObject) override; + + //===== XWindowListener ================================================= + + virtual void SAL_CALL + windowResized (const css::awt::WindowEvent& e) override; + + virtual void SAL_CALL + windowMoved (const css::awt::WindowEvent& e) override; + + virtual void SAL_CALL + windowShown (const css::lang::EventObject& e) override; + + virtual void SAL_CALL + windowHidden (const css::lang::EventObject& e) override; + + //===== XFocusListener ================================================= + + virtual void SAL_CALL focusGained (const css::awt::FocusEvent& e) override; + virtual void SAL_CALL focusLost (const css::awt::FocusEvent& e) override; + //----------------------------xAttribute---------------------------- + virtual css::uno::Any SAL_CALL getExtendedAttributes() override; + ::sd::ViewShell* mpViewShell; +private: + + // return the member maMutex; + virtual ::osl::Mutex& + implGetMutex() override; + + // return ourself as context in default case + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + implGetAccessibleContext() override; + + // return sal_False in default case + virtual bool + implIsSelected( sal_Int64 nAccessibleChildIndex ) override; + + // return nothing in default case + virtual void + implSelect( sal_Int64 nAccessibleChildIndex, bool bSelect ) override; + +protected: + /// The API window that is made accessible. + css::uno::Reference< css::awt::XWindow> + mxWindow; + + /// The controller of the window in which this view is displayed. + css::uno::Reference< css::frame::XController> + mxController; + + /// Model of the document. + css::uno::Reference < css::frame::XModel> + mxModel; + + // Bundle of information that is passed down the shape tree. + AccessibleShapeTreeInfo maShapeTreeInfo; + + /// The view forwarder passed to the children manager. + AccessibleViewForwarder maViewForwarder; + + /** Accessible OLE object. Set or removed by the + <member>SetAccessibleOLEObject</member> method. + */ + css::uno::Reference< css::accessibility::XAccessible> + mxAccessibleOLEObject; + + Link<VclWindowEvent&,void> maWindowLink; + + // This method is called from the component helper base class while + // disposing. + virtual void SAL_CALL disposing() override; + + /** Create a name string. The current name is not modified and, + therefore, no events are sent. This method is usually called once + by the <member>getAccessibleName</member> method of the base class. + @return + A name string. + */ + virtual OUString + CreateAccessibleName () override; + + /** This method is called when (after) the frame containing this + document has been activated. Can be used to send FOCUSED state + changes for the currently selected element. + + Note: Currently used as a substitute for FocusGained. Should be + renamed in the future. + */ + virtual void Activated(); + + /** This method is called when (before or after?) the frame containing + this document has been deactivated. Can be used to send FOCUSED + state changes for the currently selected element. + + Note: Currently used as a substitute for FocusLost. Should be + renamed in the future. + */ + virtual void Deactivated(); + + /** Set or remove the currently active accessible OLE object. + @param xOLEObject + If this is a valid reference then a child event is send that + informs the listeners of a new child. If there has already been + an active accessible OLE object then this is removed first and + appropriate events are sent. + + If this is an empty reference then the currently active + accessible OLE object (if there is one) is removed. + */ + void SetAccessibleOLEObject ( + const css::uno::Reference<css::accessibility::XAccessible>& xOLEObject); + +public: + void SwitchViewActivated() { Activated(); } + virtual sal_Int32 SAL_CALL getForeground( ) override; + + virtual sal_Int32 SAL_CALL getBackground( ) override; + virtual void impl_dispose(); +}; + +} // end of namespace accessibility + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx new file mode 100644 index 0000000000..924723a311 --- /dev/null +++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx @@ -0,0 +1,165 @@ +/* -*- 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 . + */ + +#pragma once + +#include "AccessibleDocumentViewBase.hxx" + +#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp> + +namespace accessibility { class AccessiblePageShape; } +namespace accessibility { class ChildrenManager; } + +namespace accessibility { + +/** This class makes draw documents in the general view modes + accessible. It passes all shapes on the current draw page to a + children manager and additionally creates a new shape that + represents the actual draw page. + + Please see the documentation of the base class for further + explanations of the individual methods. +*/ +class AccessibleDrawDocumentView final : + public AccessibleDocumentViewBase + ,public css::accessibility::XAccessibleGroupPosition +{ +public: + //===== internal ======================================================== + + AccessibleDrawDocumentView (::sd::Window* pSdWindow, + ::sd::ViewShell* pViewShell, + const css::uno::Reference<css::frame::XController>& rxController, + const css::uno::Reference<css::accessibility::XAccessible>& rxParent); + + virtual ~AccessibleDrawDocumentView() override; + + /** Complete the initialization begun in the constructor. + */ + virtual void Init() override; + + //===== IAccessibleViewForwarderListener ================================ + + virtual void ViewForwarderChanged() override; + + //===== XAccessibleContext ============================================== + + virtual sal_Int64 SAL_CALL + getAccessibleChildCount() override; + + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int64 nIndex) override; + + virtual OUString SAL_CALL + getAccessibleName() override; + + //===== lang::XEventListener ============================================ + + virtual void SAL_CALL + disposing (const css::lang::EventObject& rEventObject) override; + + //===== XPropertyChangeListener ========================================= + + virtual void SAL_CALL + propertyChange (const css::beans::PropertyChangeEvent& rEventObject) override; + //===== XInterface ====================================================== + + virtual css::uno::Any SAL_CALL + queryInterface (const css::uno::Type & rType) override; + + virtual void SAL_CALL + acquire() + noexcept override; + + virtual void SAL_CALL + release() + noexcept override; + + //===== XAccessibleGroupPosition ========================================= + virtual css::uno::Sequence< sal_Int32 > SAL_CALL + getGroupPosition( const css::uno::Any& rAny ) override; + virtual OUString SAL_CALL getObjectLink( const css::uno::Any& accoject ) override; + +private: + + //===== XServiceInfo ==================================================== + + virtual OUString SAL_CALL + getImplementationName() override; + + virtual css::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames() override; + + virtual bool + implIsSelected( sal_Int64 nAccessibleChildIndex ) override; + + /** Select or deselect the specified child or all children if the given + index has the special value ACCESSIBLE_SELECTION_CHILD_ALL. + Selecting or deselecting a child sets or resets the + <const>SELECTED</const> state and selects or deselects the UNO shape + being made accessible by the child. + @param nAccessibleChildIndex + Index of the child to select or deselect. If the parameter has + the value ACCESSIBLE_SELECTION_CHILD_ALL then all children are + selected or deselected. + @param bSelect + Indicates whether to select or deselect the specified child + reps. children. + */ + virtual void + implSelect( sal_Int64 nAccessibleChildIndex, bool bSelect ) override; + + ::sd::ViewShell* mpSdViewSh; + + /** This object manages the shapes of the represented draw page. It is + responsible to determine the visible shapes and create on demand the + accessible objects representing them. + */ + std::unique_ptr<ChildrenManager> mpChildrenManager; + + // This method is called from the component helper base class while + // disposing. + virtual void SAL_CALL disposing() override; + + /** Create a shape the represents the page as seen on the screen. + */ + rtl::Reference<AccessiblePageShape> CreateDrawPageShape(); + + /// Create an accessible name that contains the current view mode. + virtual OUString + CreateAccessibleName () override; + + /** Make sure that the currently focused shape sends a FOCUSED state + change event indicating that it has (regained) the focus. + */ + virtual void Activated() override; + + /** Make sure that the currently focused shape sends a FOCUSED state + change event indicating that it has lost the focus. + */ + virtual void Deactivated() override; + + virtual void impl_dispose() override; + + void UpdateAccessibleName(); +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleOutlineEditSource.hxx b/sd/source/ui/inc/AccessibleOutlineEditSource.hxx new file mode 100644 index 0000000000..d13d27e97c --- /dev/null +++ b/sd/source/ui/inc/AccessibleOutlineEditSource.hxx @@ -0,0 +1,90 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svl/SfxBroadcaster.hxx> +#include <svl/lstner.hxx> +#include <tools/link.hxx> +#include <editeng/unoedsrc.hxx> +#include <editeng/unoforou.hxx> +#include <editeng/unoviwou.hxx> + +class OutlinerView; +class SdrOutliner; +class SdrView; +namespace vcl { class Window; } + +namespace accessibility +{ + /** Implementation of the SvxEditSource interface in the SdOutlineView + + This class connects the SdOutlineView and its EditEngine + outliner with the AccessibleTextHelper, which provides all + necessary functionality to make the outliner text accessible + + @see SvxEditSource + @see SvxViewForwarder + */ + class AccessibleOutlineEditSource final : public SvxEditSource, public SvxViewForwarder, public SfxBroadcaster, public SfxListener + { + public: + /// Create an SvxEditSource interface for the given Outliner + AccessibleOutlineEditSource( + SdrOutliner& rOutliner, + SdrView& rView, + OutlinerView& rOutlView, + const vcl::Window& rViewWindow ); + virtual ~AccessibleOutlineEditSource() override; + + /// This method is disabled and always returns NULL + virtual std::unique_ptr<SvxEditSource> Clone() const override; + virtual SvxTextForwarder* GetTextForwarder() override; + virtual SvxViewForwarder* GetViewForwarder() override; + virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override; + virtual void UpdateData() override; + virtual SfxBroadcaster& GetBroadcaster() const override; + + // the view forwarder + virtual bool IsValid() const override; + virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; + virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + private: + AccessibleOutlineEditSource( const AccessibleOutlineEditSource& ) = delete; + AccessibleOutlineEditSource& operator=( const AccessibleOutlineEditSource& ) = delete; + + DECL_LINK( NotifyHdl, EENotify&, void ); + + SdrView& mrView; + const vcl::Window& mrWindow; + SdrOutliner* mpOutliner; + OutlinerView* mpOutlinerView; + + SvxOutlinerForwarder mTextForwarder; + SvxDrawOutlinerViewForwarder mViewForwarder; + + }; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleOutlineView.hxx b/sd/source/ui/inc/AccessibleOutlineView.hxx new file mode 100644 index 0000000000..ddff1b4652 --- /dev/null +++ b/sd/source/ui/inc/AccessibleOutlineView.hxx @@ -0,0 +1,119 @@ +/* -*- 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 . + */ + +#pragma once + +#include "AccessibleDocumentViewBase.hxx" +#include <svx/AccessibleTextHelper.hxx> + +namespace sd { class OutlineViewShell; } + +namespace accessibility { + +/** This class makes the Impress outline view accessible. + + Please see the documentation of the base class for further + explanations of the individual methods. This class is a mere + wrapper around the AccessibleTextHelper class; as basically the + Outline View is a big Outliner. +*/ +class AccessibleOutlineView final + : public AccessibleDocumentViewBase +{ +public: + AccessibleOutlineView ( + ::sd::Window* pSdWindow, + ::sd::OutlineViewShell* pViewShell, + const css::uno::Reference<css::frame::XController>& rxController, + const css::uno::Reference<css::accessibility::XAccessible>& rxParent); + + virtual ~AccessibleOutlineView() override; + + /** Complete the initialization begun in the constructor. + */ + virtual void Init() override; + + //===== IAccessibleViewForwarderListener ================================ + + virtual void ViewForwarderChanged() override; + + //===== XAccessibleContext ============================================== + + virtual sal_Int64 SAL_CALL + getAccessibleChildCount() override; + + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int64 nIndex) override; + virtual OUString SAL_CALL + getAccessibleName() override; + //===== XAccessibleEventBroadcaster ======================================== + + virtual void SAL_CALL + addAccessibleEventListener ( + const css::uno::Reference<css::accessibility::XAccessibleEventListener >& xListener) override; + + virtual void SAL_CALL + removeAccessibleEventListener ( + const css::uno::Reference<css::accessibility::XAccessibleEventListener >& xListener) override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + //===== lang::XEventListener ============================================ + + using AccessibleDocumentViewBase::disposing; + + //===== XPropertyChangeListener ========================================= + + virtual void SAL_CALL + propertyChange (const css::beans::PropertyChangeEvent& rEventObject) override; + +private: + + // overridden to detect focus changes + virtual void Activated() override; + + // overridden to detect focus changes + virtual void Deactivated() override; + + // declared, but not defined + AccessibleOutlineView( const AccessibleOutlineView& ); + AccessibleOutlineView& operator= ( const AccessibleOutlineView& ); + + // This method is called from the component helper base class while disposing. + virtual void SAL_CALL disposing() override; + + /// Create an accessible name that contains the current view mode. + virtual OUString + CreateAccessibleName () override; + + /// Invalidate text helper, updates visible children + void UpdateChildren(); + + AccessibleTextHelper maTextHelper; + +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessiblePageShape.hxx b/sd/source/ui/inc/AccessiblePageShape.hxx new file mode 100644 index 0000000000..1e7568ab00 --- /dev/null +++ b/sd/source/ui/inc/AccessiblePageShape.hxx @@ -0,0 +1,117 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/AccessibleShape.hxx> + +namespace com::sun::star::accessibility { class XAccessible; } +namespace com::sun::star::drawing { class XDrawPage; } +namespace accessibility { class AccessibleShapeTreeInfo; } + +namespace accessibility { + +/** A page shape represents the actual page as seen on the screen. +*/ +class AccessiblePageShape + : public AccessibleShape +{ +public: + //===== internal ======================================================== + + /** Create a new accessible object that makes the given shape accessible. + @param rxParent + The accessible parent object. It will be used, for example when + the <member>getIndexInParent</member> method is called. + @param rShapeTreeInfo + Bundle of information passed to this shape and all of its descendants. + @attention + Always call the <member>init</member> method after creating a + new accessible shape. This is one way to overcome the potential + problem of registering the new object with e.g. event + broadcasters. That would delete the new object if a broadcaster + would not keep a strong reference to the new object. + */ + AccessiblePageShape ( + css::uno::Reference<css::drawing::XDrawPage> xPage, + const css::uno::Reference<css::accessibility::XAccessible>& rxParent, + const AccessibleShapeTreeInfo& rShapeTreeInfo); + + virtual ~AccessiblePageShape() override; + + //===== XAccessibleContext ============================================== + + /// Returns always 0 because there can be no children. + virtual sal_Int64 SAL_CALL + getAccessibleChildCount() override; + + /** Return the specified child. + @param nIndex + Index of the requested child. + @return + Reference of the requested child which is the accessible object + of a visible shape. + @throws IndexOutOfBoundsException + Throws always an exception because there are no children. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int64 nIndex) override; + + //===== XAccessibleComponent ============================================ + + virtual css::awt::Rectangle SAL_CALL getBounds() override; + + virtual sal_Int32 SAL_CALL getForeground() override; + + virtual sal_Int32 SAL_CALL getBackground() override; + + //===== XComponent ====================================================== + + virtual void SAL_CALL + dispose() override; + + //===== XServiceInfo ==================================================== + + virtual OUString SAL_CALL + getImplementationName() override; + + virtual css::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames() override; + + using AccessibleShape::disposing; + +protected: + /** Create a base name string that contains the accessible name. + */ + virtual OUString + CreateAccessibleBaseName() override; + + virtual OUString + CreateAccessibleName() override; + +private: + css::uno::Reference<css::drawing::XDrawPage> mxPage; + + AccessiblePageShape (const AccessiblePageShape&) = delete; + AccessibleShape& operator= (const AccessiblePageShape&) = delete; +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx b/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx new file mode 100644 index 0000000000..91e573835c --- /dev/null +++ b/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx @@ -0,0 +1,60 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/AccessibleGraphicShape.hxx> + +namespace accessibility { class AccessibleShapeInfo; } +namespace accessibility { class AccessibleShapeTreeInfo; } + +namespace accessibility { + +/** This class makes Impress shapes accessible. +*/ +class AccessiblePresentationGraphicShape + : public AccessibleGraphicShape +{ +public: + //===== internal ======================================================== + AccessiblePresentationGraphicShape ( + const AccessibleShapeInfo& rShapeInfo, + const AccessibleShapeTreeInfo& rShapeTreeInfo); + virtual ~AccessiblePresentationGraphicShape() override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + //===== internal ======================================================== + + /// Create a name string that contains the accessible name. + virtual OUString + CreateAccessibleBaseName () override; + + /// Return this object's role. + virtual sal_Int16 SAL_CALL getAccessibleRole () override; +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx b/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx new file mode 100644 index 0000000000..a8ac60deb4 --- /dev/null +++ b/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx @@ -0,0 +1,57 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/AccessibleOLEShape.hxx> + +namespace accessibility { + +/** This class makes Impress shapes accessible. +*/ +class AccessiblePresentationOLEShape + : public AccessibleOLEShape +{ +public: + //===== internal ======================================================== + AccessiblePresentationOLEShape ( + const AccessibleShapeInfo& rShapeInfo, + const AccessibleShapeTreeInfo& rShapeTreeInfo); + virtual ~AccessiblePresentationOLEShape() override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + //===== internal ======================================================== + + /// Create a name string that contains the accessible name. + virtual OUString + CreateAccessibleBaseName () override; + + /// Return this object's role. + virtual sal_Int16 SAL_CALL getAccessibleRole () override; +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessiblePresentationShape.hxx b/sd/source/ui/inc/AccessiblePresentationShape.hxx new file mode 100644 index 0000000000..4a6447ae97 --- /dev/null +++ b/sd/source/ui/inc/AccessiblePresentationShape.hxx @@ -0,0 +1,61 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/AccessibleShape.hxx> + +namespace accessibility { + +/** This class makes Impress shapes accessible. +*/ +class AccessiblePresentationShape + : public AccessibleShape +{ +public: + //===== internal ======================================================== + AccessiblePresentationShape ( + const AccessibleShapeInfo& rShapeInfo, + const AccessibleShapeTreeInfo& rShapeTreeInfo); + virtual ~AccessiblePresentationShape() override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + //===== internal ======================================================== + + /// Create a name string that contains the accessible name. + virtual OUString + CreateAccessibleBaseName () override; + + OUString GetStyle() const override; + +private: + AccessiblePresentationShape (const AccessiblePresentationShape&) = delete; + + AccessiblePresentationShape& operator= (const AccessiblePresentationShape&) = delete; +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleSlideSorterObject.hxx b/sd/source/ui/inc/AccessibleSlideSorterObject.hxx new file mode 100644 index 0000000000..97bea85197 --- /dev/null +++ b/sd/source/ui/inc/AccessibleSlideSorterObject.hxx @@ -0,0 +1,189 @@ +/* -*- 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 . + */ + +#pragma once + +#include <comphelper/compbase.hxx> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +class SdPage; +namespace sd::slidesorter { class SlideSorter; } + +namespace accessibility { + +typedef comphelper::WeakComponentImplHelper< + css::accessibility::XAccessible, + css::accessibility::XAccessibleEventBroadcaster, + css::accessibility::XAccessibleContext, + css::accessibility::XAccessibleComponent, + css::lang::XServiceInfo > AccessibleSlideSorterObjectBase; + +/** This class makes page objects of the slide sorter accessible. +*/ +class AccessibleSlideSorterObject + : public AccessibleSlideSorterObjectBase +{ +public: + /** Create a new object that represents a page object in the slide + sorter. + @param rxParent + The accessible parent. + @param rSlideSorter + The slide sorter whose model manages the page. + @param nPageNumber + The number of the page in the range [0,nPageCount). + */ + AccessibleSlideSorterObject( + const css::uno::Reference<css::accessibility::XAccessible >& rxParent, + ::sd::slidesorter::SlideSorter& rSlideSorter, + sal_uInt16 nPageNumber); + virtual ~AccessibleSlideSorterObject() override; + + /** Return the page that is made accessible by the called object. + */ + SdPage* GetPage() const; + + /** The page number as given to the constructor. + */ + sal_uInt16 GetPageNumber() const { return mnPageNumber;} + + void FireAccessibleEvent ( + short nEventId, + const css::uno::Any& rOldValue, + const css::uno::Any& rNewValue); + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + //===== XAccessible ======================================================= + + virtual css::uno::Reference<css::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() override; + + //===== XAccessibleEventBroadcaster ======================================= + virtual void SAL_CALL + addAccessibleEventListener( + const css::uno::Reference<css::accessibility::XAccessibleEventListener >& rxListener) override; + + virtual void SAL_CALL + removeAccessibleEventListener( + const css::uno::Reference<css::accessibility::XAccessibleEventListener >& rxListener ) override; + + //===== XAccessibleContext ============================================== + + virtual sal_Int64 SAL_CALL + getAccessibleChildCount() override; + + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int64 nIndex) override; + + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleParent() override; + + virtual sal_Int64 SAL_CALL + getAccessibleIndexInParent() override; + + virtual sal_Int16 SAL_CALL + getAccessibleRole() override; + + virtual OUString SAL_CALL + getAccessibleDescription() override; + + virtual OUString SAL_CALL + getAccessibleName() override; + + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL + getAccessibleRelationSet() override; + + virtual sal_Int64 SAL_CALL + getAccessibleStateSet() override; + + virtual css::lang::Locale SAL_CALL + getLocale() override; + + //===== XAccessibleComponent ================================================ + + virtual sal_Bool SAL_CALL containsPoint ( + const css::awt::Point& aPoint) override; + + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint ( + const css::awt::Point& aPoint) override; + + virtual css::awt::Rectangle SAL_CALL getBounds() override; + + virtual css::awt::Point SAL_CALL getLocation() override; + + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + + virtual css::awt::Size SAL_CALL getSize() override; + + virtual void SAL_CALL grabFocus() override; + + virtual sal_Int32 SAL_CALL getForeground() override; + + virtual sal_Int32 SAL_CALL getBackground() override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + /** Return whether the specified service is supported by this class. + */ + virtual sal_Bool SAL_CALL + supportsService (const OUString& sServiceName) override; + + /** Returns a list of all supported services. + */ + virtual css::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames() override; + +private: + css::uno::Reference<css::accessibility::XAccessible> mxParent; + sal_uInt16 mnPageNumber; + ::sd::slidesorter::SlideSorter& mrSlideSorter; + sal_uInt32 mnClientId; + + /** Check whether or not the object has been disposed (or is in the + state of being disposed). If that is the case then + DisposedException is thrown to inform the (indirect) caller of the + foul deed. + + @throws css::lang::DisposedException + */ + void ThrowIfDisposed(); + + /** Check whether or not the object has been disposed (or is in the + state of being disposed). + + @return sal_True, if the object is disposed or in the course + of being disposed. Otherwise, sal_False is returned. + */ + bool IsDisposed() const; +}; + +} // end of namespace ::accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx new file mode 100644 index 0000000000..0cbaf62ed5 --- /dev/null +++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx @@ -0,0 +1,253 @@ +/* -*- 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 . + */ + +#pragma once + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> + +#include <memory> + +namespace sd::slidesorter { class SlideSorter; } + +namespace accessibility { + +class AccessibleSlideSorterObject; + +typedef ::cppu::WeakComponentImplHelper< + css::accessibility::XAccessible, + css::accessibility::XAccessibleEventBroadcaster, + css::accessibility::XAccessibleContext, + css::accessibility::XAccessibleComponent, + css::accessibility::XAccessibleSelection, + css::lang::XServiceInfo + > AccessibleSlideSorterViewBase; + +/** This class makes the SlideSorterViewShell accessible. It uses objects + of the AccessibleSlideSorterObject class to the make the page objects + accessible. +*/ +class AccessibleSlideSorterView + : public cppu::BaseMutex, + public AccessibleSlideSorterViewBase +{ +public: + AccessibleSlideSorterView( + ::sd::slidesorter::SlideSorter& rSlideSorter, + vcl::Window* pParentWindow); + + void Init(); + + virtual ~AccessibleSlideSorterView() override; + + /** This method acts like a dispose call. It sends a disposing to all + of its listeners. It may be called twice. + */ + void Destroyed(); + + void FireAccessibleEvent ( + short nEventId, + const css::uno::Any& rOldValue, + const css::uno::Any& rNewValue); + + virtual void SAL_CALL disposing() override; + + /** Return the implementation object of the specified child. + @param nIndex + Index of the child for which to return the implementation object. + */ + AccessibleSlideSorterObject* GetAccessibleChildImplementation (sal_Int32 nIndex); + + //===== XAccessible ======================================================= + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() override; + + //===== XAccessibleEventBroadcaster ======================================= + virtual void SAL_CALL + addAccessibleEventListener( + const css::uno::Reference< css::accessibility::XAccessibleEventListener >& rxListener) override; + + virtual void SAL_CALL + removeAccessibleEventListener( + const css::uno::Reference< css::accessibility::XAccessibleEventListener >& rxListener ) override; + + //===== XAccessibleContext ============================================== + + /// Return the number of currently visible children. + virtual sal_Int64 SAL_CALL + getAccessibleChildCount() override; + + /// Return the specified child or throw exception. + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int64 nIndex) override; + + /// Return a reference to the parent. + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleParent() override; + + /// Return this objects index among the parents children. + virtual sal_Int64 SAL_CALL + getAccessibleIndexInParent() override; + + /// Return this object's role. + virtual sal_Int16 SAL_CALL + getAccessibleRole() override; + + /// Return this object's description. + virtual OUString SAL_CALL + getAccessibleDescription() override; + + /// Return the object's current name. + virtual OUString SAL_CALL + getAccessibleName() override; + + /// Return NULL to indicate that an empty relation set. + virtual css::uno::Reference< + css::accessibility::XAccessibleRelationSet> SAL_CALL + getAccessibleRelationSet() override; + + /// Return the set of current states. + virtual sal_Int64 SAL_CALL getAccessibleStateSet() override; + + /** Return the parents locale or throw exception if this object has no + parent yet/anymore. + */ + virtual css::lang::Locale SAL_CALL + getLocale() override; + + //===== XAccessibleComponent ================================================ + + /** The default implementation uses the result of + <member>getBounds</member> to determine whether the given point lies + inside this object. + */ + virtual sal_Bool SAL_CALL containsPoint ( + const css::awt::Point& aPoint) override; + + /** The default implementation returns an empty reference. + */ + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint ( + const css::awt::Point& aPoint) override; + + /** The default implementation returns an empty rectangle. + */ + virtual css::awt::Rectangle SAL_CALL getBounds() override; + + /** The default implementation uses the result of + <member>getBounds</member> to determine the location. + */ + virtual css::awt::Point SAL_CALL getLocation() override; + + /** The default implementation returns an empty position, i.e. the + * result of the default constructor of <type>css::awt::Point</type>. + */ + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + + /** The default implementation uses the result of + <member>getBounds</member> to determine the size. + */ + virtual css::awt::Size SAL_CALL getSize() override; + + /** The default implementation does nothing. + */ + virtual void SAL_CALL grabFocus() override; + + /** Returns black as the default foreground color. + */ + virtual sal_Int32 SAL_CALL getForeground() override; + + /** Returns white as the default background color. + */ + virtual sal_Int32 SAL_CALL getBackground() override; + + //===== XAccessibleSelection ============================================== + + virtual void SAL_CALL + selectAccessibleChild (sal_Int64 nChildIndex) override; + + virtual sal_Bool SAL_CALL + isAccessibleChildSelected( sal_Int64 nChildIndex ) override; + + virtual void SAL_CALL + clearAccessibleSelection( ) override; + + virtual void SAL_CALL + selectAllAccessibleChildren( ) override; + + virtual sal_Int64 SAL_CALL + getSelectedAccessibleChildCount( ) override; + + virtual css::uno::Reference< + css::accessibility::XAccessible > SAL_CALL + getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + + virtual void SAL_CALL + deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + /** Return whether the specified service is supported by this class. + */ + virtual sal_Bool SAL_CALL + supportsService (const OUString& sServiceName) override; + + /** Returns a list of all supported services. + */ + virtual css::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames() override; + + void SwitchViewActivated(); +private: + class Implementation; + ::std::unique_ptr<Implementation> mpImpl; + + ::sd::slidesorter::SlideSorter& mrSlideSorter; + + sal_uInt32 mnClientId; + + VclPtr<vcl::Window> mpContentWindow; + + /** Check whether or not the object has been disposed (or is in the + state of being disposed). If that is the case then + DisposedException is thrown to inform the (indirect) caller of the + foul deed. + + @throws css::lang::DisposedException + */ + void ThrowIfDisposed(); +}; + +} // end of namespace ::accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AccessibleViewForwarder.hxx b/sd/source/ui/inc/AccessibleViewForwarder.hxx new file mode 100644 index 0000000000..c791921e6f --- /dev/null +++ b/sd/source/ui/inc/AccessibleViewForwarder.hxx @@ -0,0 +1,92 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/IAccessibleViewForwarder.hxx> + +class SdrPaintView; +class OutputDevice; + +namespace accessibility +{ +/** <p>This class provides the means to transform between internal coordinates + and screen coordinates without giving direct access to the underlying + view. It represents a certain window. A call to + <method>GetVisArea</method> returns the corresponding visible + rectangle.</p> + + @attention + Note, that modifications of the underlying view that lead to + different transformations between internal and screen coordinates or + change the validity of the forwarder have to be signaled separately. +*/ +class AccessibleViewForwarder final : public IAccessibleViewForwarder +{ +public: + //===== internal ======================================================== + + AccessibleViewForwarder(SdrPaintView* pView, const OutputDevice& rDevice); + + virtual ~AccessibleViewForwarder() override; + + //===== IAccessibleViewforwarder ======================================== + + /** Returns the area of the underlying document that is visible in the + * corresponding window. + + @return + The rectangle of the visible part of the document. + */ + virtual ::tools::Rectangle GetVisibleArea() const override; + + /** Transform the specified point from internal coordinates to an + absolute screen position. + + @param rPoint + Point in internal coordinates. + + @return + The same point but in screen coordinates relative to the upper + left corner of the (current) screen. + */ + virtual Point LogicToPixel(const Point& rPoint) const override; + + /** Transform the specified size from internal coordinates to a screen + * position. + + @param rSize + Size in internal coordinates. + + @return + The same size but in screen coordinates. + */ + virtual Size LogicToPixel(const Size& rSize) const override; + +private: + SdrPaintView* mpView; + sal_uInt16 mnWindowId; + + AccessibleViewForwarder(AccessibleViewForwarder const&) = delete; + AccessibleViewForwarder& operator=(AccessibleViewForwarder const&) = delete; +}; + +} // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/AnimationChildWindow.hxx b/sd/source/ui/inc/AnimationChildWindow.hxx new file mode 100644 index 0000000000..1223dfdbd5 --- /dev/null +++ b/sd/source/ui/inc/AnimationChildWindow.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/childwin.hxx> +#include <sal/types.h> + +namespace vcl { class Window; } +class SfxBindings; + +namespace sd { + +class AnimationChildWindow + : public SfxChildWindow +{ +public: + AnimationChildWindow( + vcl::Window*, + sal_uInt16, + SfxBindings*, + SfxChildWinInfo*); + + SFX_DECL_CHILDWINDOW_WITHID(AnimationChildWindow); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/BezierObjectBar.hxx b/sd/source/ui/inc/BezierObjectBar.hxx new file mode 100644 index 0000000000..a030576ebb --- /dev/null +++ b/sd/source/ui/inc/BezierObjectBar.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/shell.hxx> +#include <glob.hxx> + +namespace sd +{ +class View; +class ViewShell; + +class BezierObjectBar final : public SfxShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDDRAWBEZIEROBJECTBAR) + + BezierObjectBar(ViewShell* pSdViewShell, View* pSdView); + virtual ~BezierObjectBar() override; + + void GetAttrState(SfxItemSet& rSet); + void Execute(SfxRequest& rReq); + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + + View* mpView; + ViewShell* mpViewSh; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/BreakDlg.hxx b/sd/source/ui/inc/BreakDlg.hxx new file mode 100644 index 0000000000..ee2a8b15dc --- /dev/null +++ b/sd/source/ui/inc/BreakDlg.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/basedlgs.hxx> +#include <sfx2/progress.hxx> +#include <svx/svdetc.hxx> +#include <vcl/idle.hxx> + +namespace sd +{ +class DrawDocShell; +class DrawView; + +/** + * dialog to break meta files + */ +class BreakDlg : public SfxDialogController +{ +public: + BreakDlg(weld::Window* pWindow, DrawView* pDrView, DrawDocShell* pShell, + sal_uLong nSumActionCount, sal_uLong nObjCount); + + virtual short run() override; + +private: + std::unique_ptr<weld::Label> m_xFiObjInfo; + std::unique_ptr<weld::Label> m_xFiActInfo; + std::unique_ptr<weld::Label> m_xFiInsInfo; + std::unique_ptr<weld::Button> m_xBtnCancel; + + DrawView* m_pDrView; + + bool m_bCancel; + + Idle m_aUpdateIdle; + std::unique_ptr<SvdProgressInfo> m_xProgrInfo; + std::unique_ptr<SfxProgress> m_xProgress; + + DECL_LINK(CancelButtonHdl, weld::Button&, void); + DECL_LINK(UpDate, void*, bool); + DECL_LINK(InitialUpdate, Timer*, void); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/BulletAndPositionDlg.hxx b/sd/source/ui/inc/BulletAndPositionDlg.hxx new file mode 100644 index 0000000000..35a35412bc --- /dev/null +++ b/sd/source/ui/inc/BulletAndPositionDlg.hxx @@ -0,0 +1,156 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vector> +#include <memory> + +#include <editeng/numdef.hxx> +#include <editeng/svxenum.hxx> +#include <vcl/weld.hxx> +#include "View.hxx" +#include <cui/numberingpreview.hxx> + +#define MN_GALLERY_ENTRY 100 + +class ColorListBox; +class SvxNumValueSet; +class SvxNumRule; +class SvxBmpNumValueSet; +class SvxBrushItem; +class SdDrawDocument; + +namespace sd +{ +class View; +} + +/// Main class for handling the bullets, numbering format and their position. +class SvxBulletAndPositionDlg : public weld::GenericDialogController +{ + OUString m_sNumCharFmtName; + + Timer aInvalidateTimer; + + std::unique_ptr<SvxNumRule> pActNum; + std::unique_ptr<SvxNumRule> pSaveNum; + const SfxItemSet& rFirstStateSet; + + Size aInitSize[SVX_MAX_NUM]; + + bool bLastWidthModified : 1; + bool bModified : 1; + bool bInInitControl : 1; // workaround for Modify-error, is said to be corrected from 391 on + bool bLabelAlignmentPosAndSpaceModeActive; + bool bApplyToMaster; + + std::vector<OUString> aGrfNames; + vcl::Font aActBulletFont; + + sal_uInt8 nBullet; + sal_uInt16 nActNumLvl; + weld::Window* p_Window; + TypedWhichId<SvxNumBulletItem> nNumItemId; + MapUnit eCoreUnit; + + SvxNumberingPreview m_aPreviewWIN; + std::unique_ptr<weld::Widget> m_xGrid; + std::unique_ptr<weld::TreeView> m_xLevelLB; + std::unique_ptr<weld::ComboBox> m_xFmtLB; + std::unique_ptr<weld::Label> m_xPrefixFT; + std::unique_ptr<weld::Entry> m_xPrefixED; + std::unique_ptr<weld::Label> m_xSuffixFT; + std::unique_ptr<weld::Entry> m_xSuffixED; + std::unique_ptr<weld::Frame> m_xBeforeAfter; + std::unique_ptr<weld::Label> m_xBulColorFT; + std::unique_ptr<ColorListBox> m_xBulColLB; + std::unique_ptr<weld::Label> m_xBulRelSizeFT; + std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF; + std::unique_ptr<weld::Label> m_xStartFT; + std::unique_ptr<weld::SpinButton> m_xStartED; + std::unique_ptr<weld::Label> m_xBulletFT; + std::unique_ptr<weld::Button> m_xBulletPB; + std::unique_ptr<weld::MenuButton> m_xBitmapMB; + std::unique_ptr<weld::Label> m_xWidthFT; + std::unique_ptr<weld::MetricSpinButton> m_xWidthMF; + std::unique_ptr<weld::Label> m_xHeightFT; + std::unique_ptr<weld::MetricSpinButton> m_xHeightMF; + std::unique_ptr<weld::CheckButton> m_xRatioCB; + std::unique_ptr<weld::Menu> m_xGalleryMenu; + std::unique_ptr<weld::CustomWeld> m_xPreviewWIN; + std::unique_ptr<weld::Label> m_xDistBorderFT; + std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF; + std::unique_ptr<weld::CheckButton> m_xRelativeCB; + std::unique_ptr<weld::MetricSpinButton> m_xIndentMF; + std::unique_ptr<weld::Toggleable> m_xLeftTB; + std::unique_ptr<weld::Toggleable> m_xCenterTB; + std::unique_ptr<weld::Toggleable> m_xRightTB; + std::unique_ptr<weld::RadioButton> m_xSlideRB; + std::unique_ptr<weld::RadioButton> m_xSelectionRB; + std::unique_ptr<weld::Toggleable> m_xApplyToMaster; + std::unique_ptr<weld::Button> m_xReset; + + void InitControls(); + /** To switch between the numbering type + 0 - Number; + 1 - Bullet; + 2 - Bitmap; */ + void SwitchNumberType(sal_uInt8 nType); + void CheckForStartValue_Impl(sal_uInt16 nNumberingType); + + DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void); + DECL_LINK(LevelHdl_Impl, weld::TreeView&, void); + DECL_LINK(PopupActivateHdl_Impl, weld::Toggleable&, void); + DECL_LINK(GraphicHdl_Impl, const OUString&, void); + DECL_LINK(BulletHdl_Impl, weld::Button&, void); + DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void); + DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void); + DECL_LINK(SpinModifyHdl_Impl, weld::SpinButton&, void); + DECL_LINK(BulColorHdl_Impl, ColorListBox&, void); + DECL_LINK(BulRelSizeHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void); + DECL_LINK(DistanceHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(RelativeHdl_Impl, weld::Toggleable&, void); + DECL_LINK(SelectLeftAlignmentHdl_Impl, weld::Toggleable&, void); + DECL_LINK(SelectCenterAlignmentHdl_Impl, weld::Toggleable&, void); + DECL_LINK(SelectRightAlignmentHdl_Impl, weld::Toggleable&, void); + DECL_LINK(ApplyToMasterHdl_Impl, weld::Toggleable&, void); + DECL_LINK(ResetHdl_Impl, weld::Button&, void); + void EditModifyHdl_Impl(const weld::Entry*); + void InitPosAndSpaceMode(); + void SetAlignmentHdl_Impl(SvxAdjust); + +public: + SvxBulletAndPositionDlg(weld::Window* pWindow, const SfxItemSet& rSet, const ::sd::View* pView); + virtual ~SvxBulletAndPositionDlg() override; + + SfxItemSet* GetOutputItemSet(SfxItemSet* rSet); + bool IsApplyToMaster() const; + bool IsSlideScope() const; + void Reset(const SfxItemSet* rSet); + + void SetCharFmt(const OUString& rNumName) { m_sNumCharFmtName = rNumName; } + void SetMetric(FieldUnit eSet); + + void SetModified(bool bRepaint = true); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/Client.hxx b/sd/source/ui/inc/Client.hxx new file mode 100644 index 0000000000..6b999068e5 --- /dev/null +++ b/sd/source/ui/inc/Client.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/ipclient.hxx> +class SdrOle2Obj; + +namespace sd +{ +class ViewShell; + +class Client : public SfxInPlaceClient +{ + ViewShell* mpViewShell; + SdrOle2Obj* pSdrOle2Obj; + + virtual void ObjectAreaChanged() override; + virtual void RequestNewObjectArea(::tools::Rectangle&) override; + virtual void ViewChanged() override; + +public: + Client(SdrOle2Obj* pObj, ViewShell* pSdViewShell, vcl::Window* pWindow); + virtual ~Client() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ClientView.hxx b/sd/source/ui/inc/ClientView.hxx new file mode 100644 index 0000000000..7a52053bab --- /dev/null +++ b/sd/source/ui/inc/ClientView.hxx @@ -0,0 +1,43 @@ +/* -*- 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 . + */ + +#pragma once + +#include "drawview.hxx" + +namespace sd +{ +/** + * The SdClientView is used for DrawDocShell::Draw() + */ +class ClientView : public DrawView +{ +public: + ClientView(DrawDocShell* pDocSh, OutputDevice* pOutDev); + virtual ~ClientView() override; + + /* if the view should not do an Invalidate() on the windows, you have to + override the following two methods and do something different */ + virtual void InvalidateOneWin(OutputDevice& rWin) override; + virtual void InvalidateOneWin(OutputDevice& rWin, const ::tools::Rectangle& rRect) override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/CustomAnimationList.hxx b/sd/source/ui/inc/CustomAnimationList.hxx new file mode 100644 index 0000000000..fe35f5ae91 --- /dev/null +++ b/sd/source/ui/inc/CustomAnimationList.hxx @@ -0,0 +1,169 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <memory> + +#include <vcl/transfer.hxx> +#include <vcl/weld.hxx> +#include <CustomAnimationEffect.hxx> + +namespace com::sun::star::drawing { class XShape; } + +struct ImplSVEvent; + +namespace sd { + +typedef std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr; + +class ICustomAnimationListController +{ +public: + virtual void onSelect() = 0; + virtual void onDoubleClick() = 0; + virtual void onContextMenu(const OUString &rIdent) = 0; + virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) = 0; + virtual ~ICustomAnimationListController() {} +}; + +class CustomAnimationList; +class CustomAnimationListEntryItem; + +class CustomAnimationListDropTarget : public DropTargetHelper +{ +private: + CustomAnimationList& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + CustomAnimationListDropTarget(CustomAnimationList& rTreeView); +}; + +class CustomAnimationList : public ISequenceListener +{ + friend class CustomAnimationListEntryItem; + friend struct stl_append_effect_func; + +public: + explicit CustomAnimationList(std::unique_ptr<weld::TreeView> xTreeView, + std::unique_ptr<weld::Label> xLabel, + std::unique_ptr<weld::Widget> xScrolledWindow); + virtual ~CustomAnimationList(); + + // methods + + /** selects or deselects the given effect. + Selections of other effects are not changed */ + void select( const CustomAnimationEffectPtr& pEffect ); + + /** populates the list with all effects from the given MainSequence */ + void update( const MainSequencePtr& pMainSequence ); + + void update(); + + EffectSequence getSelection() const; + + // events + void onSelectionChanged(const css::uno::Any& rSelection); + + void Select(); + + virtual void notify_change() override; + + bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const; + bool isVisible( const CustomAnimationEffectPtr& pEffect ) const; + + // clears all entries from the listbox + void clear(); + + void setController( ICustomAnimationListController* pController ) + { + mpController = pController; + }; + + sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); + sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); + + void set_sensitive(bool bSensitive) { mxTreeView->set_sensitive(bSensitive); } + int get_height_rows(int nRows) { return mxTreeView->get_height_rows(nRows); } + int get_approximate_digit_width() const { return mxTreeView->get_approximate_digit_width(); } + void set_size_request(int nWidth, int nHeight) + { + mxTreeView->set_size_request(nWidth, nHeight); + mxEmptyLabel->set_size_request(nWidth, nHeight); + } + void unselect_all() { mxTreeView->unselect_all(); } + weld::TreeView& get_widget() { return *mxTreeView; } + + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(ExpandHdl, const weld::TreeIter&, bool); + DECL_LINK(PostExpandHdl, void*, void); + DECL_LINK(CollapseHdl, const weld::TreeIter&, bool); + DECL_LINK(PostCollapseHdl, void*, void); + +private: + std::unique_ptr<weld::TreeView> mxTreeView; + CustomAnimationListDropTarget maDropTargetHelper; + std::unique_ptr<weld::Label> mxEmptyLabel; + std::unique_ptr<weld::Widget> mxEmptyLabelParent; + std::vector<std::unique_ptr<CustomAnimationListEntryItem>> mxEntries; + std::vector<std::unique_ptr<weld::TreeIter>> lastSelectedEntries; + + bool mbIgnorePaint; + + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); + DECL_LINK(DragBeginHdl, bool&, bool); + DECL_STATIC_LINK(CustomAnimationList, CustomRenderHdl, weld::TreeView::render_args, void); + DECL_STATIC_LINK(CustomAnimationList, CustomGetSizeHdl, weld::TreeView::get_size_args, Size); + + void ExecuteContextMenuAction(const OUString& rSelectedPopupEntry); + + /** appends the given effect to the list*/ + void append( CustomAnimationEffectPtr pEffect ); + + ICustomAnimationListController* mpController; + + MainSequencePtr mpMainSequence; + + css::uno::Reference< css::drawing::XShape > mxLastTargetShape; + sal_Int32 mnLastGroupId; + ImplSVEvent* mnPostExpandEvent; + ImplSVEvent* mnPostCollapseEvent; + + std::unique_ptr<weld::TreeIter> mxLastParentEntry; + + // drag & drop + std::unique_ptr<weld::TreeIter> mxDndEffectDragging; + std::vector<std::unique_ptr<weld::TreeIter>> mDndEffectsSelected; +}; + +OUString getPropertyName( sal_Int32 nPropertyType ); + +OUString getShapeDescription( const css::uno::Reference< css::drawing::XShape >& xShape, bool bWithText ); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/CustomAnimationPane.hxx b/sd/source/ui/inc/CustomAnimationPane.hxx new file mode 100644 index 0000000000..9896b45f66 --- /dev/null +++ b/sd/source/ui/inc/CustomAnimationPane.hxx @@ -0,0 +1,179 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/sidebar/ILayoutableWindow.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <vcl/idle.hxx> +#include "CustomAnimationList.hxx" +#include <misc/scopelock.hxx> + +#include <vector> + +namespace com::sun::star::drawing { class XDrawPage; } +namespace com::sun::star::drawing { class XDrawView; } +namespace weld { class ComboBox; } +namespace com::sun::star::animations { class XAnimationNode; } +namespace sd::tools { class EventMultiplexerEvent; } + +enum class PathKind { NONE, CURVE, POLYGON, FREEFORM }; + +namespace sd { + +class MotionPathTag; +class SdPropertySubControl; +class STLPropertySet; +class ViewShellBase; + +typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector; + +class CustomAnimationPane : public PanelLayout + , public sfx2::sidebar::ILayoutableWindow + , public ICustomAnimationListController +{ + friend class MotionPathTag; +public: + CustomAnimationPane(weld::Widget* pParent, ViewShellBase& rBase); + virtual ~CustomAnimationPane() override; + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; + + // callbacks + void onSelectionChanged(); + void onChangeCurrentPage(); + void onAdd(); + void onRemove(); + void onChangeStart(); + void onChangeStart( sal_Int16 nNodeType ); + void onChangeSpeed(); + + // methods + void preview( const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode ); + void remove( CustomAnimationEffectPtr const & pEffect ); + + // ICustomAnimationListController + virtual void onSelect() override; + virtual void onDoubleClick() override; + virtual void onContextMenu(const OUString& rIdent) override; + virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) override; + + void addUndo(); + + double getDuration() const; + void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag ); + +private: + void initialize(); + void addListener(); + void removeListener(); + void updateControls(); + void updateMotionPathTags(); + + void showOptions(const OUString& sPage = {}); + void moveSelection( bool bUp ); + void onPreview( bool bForcePreview ); + + std::unique_ptr<STLPropertySet> createSelectionSet(); + void changeSelection( STLPropertySet const * pResultSet, STLPropertySet const * pOldSet ); + + static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect ); + static bool setProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect, const css::uno::Any& rValue ); + sal_Int32 fillAnimationLB( bool bHasText ); + PathKind getCreatePathKind() const; + void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration ); + + DECL_LINK( implControlListBoxHdl, weld::ComboBox&, void ); + DECL_LINK( implClickHdl, weld::Button&, void ); + DECL_LINK( implToggleHdl, weld::Toggleable&, void ); + DECL_LINK( implPropertyHdl, LinkParamNone*, void ); + DECL_LINK( EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); + DECL_LINK( lateInitCallback, Timer *, void ); + DECL_LINK( DurationModifiedHdl, weld::MetricSpinButton&, void ); + DECL_LINK( DelayModifiedHdl, weld::MetricSpinButton&, void ); + DECL_LINK( DelayLoseFocusHdl, weld::Widget&, void ); + DECL_LINK( UpdateAnimationLB, weld::ComboBox&, void ); + DECL_LINK( AnimationSelectHdl, weld::TreeView&, void ); + DECL_LINK( SelectionHandler, Timer*, void ); + void implControlHdl(const weld::Widget* pControl); + +private: + ViewShellBase& mrBase; + + // UI Elements + std::unique_ptr<weld::Label> mxFTAnimation; + std::unique_ptr<CustomAnimationList> mxCustomAnimationList; + std::unique_ptr<weld::Button> mxPBAddEffect; + std::unique_ptr<weld::Button> mxPBRemoveEffect; + std::unique_ptr<weld::Button> mxPBMoveUp; + std::unique_ptr<weld::Button> mxPBMoveDown; + std::unique_ptr<weld::Label> mxFTCategory; + std::unique_ptr<weld::ComboBox> mxLBCategory; + std::unique_ptr<weld::Label> mxFTEffect; + std::unique_ptr<weld::TreeView> mxLBAnimation; + std::unique_ptr<weld::Label> mxFTStart; + std::unique_ptr<weld::ComboBox> mxLBStart; + std::unique_ptr<weld::Label> mxFTProperty; + std::unique_ptr<SdPropertySubControl> mxLBSubControl; + std::unique_ptr<weld::Container> mxPlaceholderBox; + std::unique_ptr<weld::Button> mxPBPropertyMore; + std::unique_ptr<weld::Label> mxFTDuration; + std::unique_ptr<weld::MetricSpinButton> mxCBXDuration; + std::unique_ptr<weld::Label> mxFTStartDelay; + std::unique_ptr<weld::MetricSpinButton> mxMFStartDelay; + std::unique_ptr<weld::CheckButton> mxCBAutoPreview; + std::unique_ptr<weld::Button> mxPBPlay; + + Idle maIdle; + + OUString maStrModify; + OUString maStrProperty; + + sal_Int32 mnLastSelectedAnimation; + sal_Int32 mnPropertyType; + static sal_Int32 const gnMotionPathPos = 3; + sal_Int32 mnCurvePathPos; + sal_Int32 mnPolygonPathPos; + sal_Int32 mnFreeformPathPos; + + EffectSequence maListSelection; + css::uno::Any maViewSelection; + + MainSequencePtr mpMainSequence; + + css::uno::Reference< css::drawing::XDrawPage > mxCurrentPage; + css::uno::Reference< css::drawing::XDrawView > mxView; + + /** The CustomAnimationPresets is initialized either on demand or + after a short time after the construction of a new object of this + class. This timer is responsible for the later. + */ + Timer maLateInitTimer; + + MotionPathTagVector maMotionPathTags; + + ScopeLock maSelectionLock; +}; + +void fillRepeatComboBox(weld::ComboBox& rBox); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DocumentRenderer.hxx b/sd/source/ui/inc/DocumentRenderer.hxx new file mode 100644 index 0000000000..7cbeefc799 --- /dev/null +++ b/sd/source/ui/inc/DocumentRenderer.hxx @@ -0,0 +1,63 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/view/XRenderable.hpp> +#include <comphelper/compbase.hxx> +#include <memory> + +namespace sd { class ViewShellBase; } + +namespace sd { + +typedef comphelper::WeakComponentImplHelper < + css::view::XRenderable + > DocumentRendererInterfaceBase; + +class DocumentRenderer final + : public DocumentRendererInterfaceBase +{ +public: + DocumentRenderer (ViewShellBase& rBase); + virtual ~DocumentRenderer() override; + + // XRenderable + virtual sal_Int32 SAL_CALL getRendererCount ( + const css::uno::Any& aSelection, + const css::uno::Sequence<css::beans::PropertyValue >& xOptions) override; + + virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getRenderer ( + sal_Int32 nRenderer, + const css::uno::Any& rSelection, + const css::uno::Sequence<css::beans::PropertyValue>& rxOptions) override; + + virtual void SAL_CALL render ( + sal_Int32 nRenderer, + const css::uno::Any& rSelection, + const css::uno::Sequence<css::beans::PropertyValue>& rxOptions) override; + +private: + class Implementation; + std::unique_ptr<Implementation> mpImpl; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx new file mode 100644 index 0000000000..940efff5bf --- /dev/null +++ b/sd/source/ui/inc/DrawController.hxx @@ -0,0 +1,320 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sddllapi.h> +#include <cppuhelper/propshlp.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XFormLayerAccess.hpp> +#include <com/sun/star/drawing/XDrawView.hpp> +#include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase.hxx> +#include <unotools/weakref.hxx> +#include <rtl/ref.hxx> +#include <tools/gen.hxx> +#include <memory> +#include <vector> + +namespace com::sun::star::drawing { class XDrawSubController; } +namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace com::sun::star::drawing::framework { class XModuleController; } +namespace com::sun::star::drawing { class XLayer; } +namespace osl { class Mutex; } +namespace sd::framework { class ConfigurationController; } +namespace sd::framework { class ModuleController; } +class SdPage; + +namespace sd { + +typedef ::cppu::ImplInheritanceHelper < + SfxBaseController, + css::view::XSelectionSupplier, + css::lang::XServiceInfo, + css::drawing::XDrawView, + css::view::XSelectionChangeListener, + css::view::XFormLayerAccess, + css::drawing::framework::XControllerManager + > DrawControllerInterfaceBase; + +class BroadcastHelperOwner +{ +public: + explicit BroadcastHelperOwner (::osl::Mutex& rMutex) : maBroadcastHelper(rMutex) {}; + ::cppu::OBroadcastHelper maBroadcastHelper; +}; + +class ViewShellBase; + +/** The DrawController is the UNO controller for Impress and Draw. It + relies objects that implement the DrawSubController interface for view + specific behaviour. The life time of the DrawController is roughly that + of ViewShellBase but note that the DrawController can (in the case of a + reload) outlive the ViewShellBase. + + The implementation of the XControllerManager interface is not yet in its + final form. +*/ +class SD_DLLPUBLIC DrawController final + : public DrawControllerInterfaceBase, + private BroadcastHelperOwner, + public ::cppu::OPropertySetHelper +{ +public: + enum PropertyHandle { + PROPERTY_WORKAREA = 0, + PROPERTY_SUB_CONTROLLER = 1, + PROPERTY_CURRENTPAGE = 2, + PROPERTY_MASTERPAGEMODE = 3, + PROPERTY_LAYERMODE = 4, + PROPERTY_ACTIVE_LAYER = 5, + PROPERTY_ZOOMTYPE = 6, + PROPERTY_ZOOMVALUE = 7, + PROPERTY_VIEWOFFSET = 8, + PROPERTY_DRAWVIEWMODE = 9 + ,PROPERTY_UPDATEACC = 10 + ,PROPERTY_PAGE_CHANGE = 11 + }; + + /** Create a new DrawController object for the given ViewShellBase. + */ + explicit DrawController (ViewShellBase& rBase) noexcept; + + virtual ~DrawController() noexcept override; + + /** Replace the currently used sub controller with the given one. This + new sub controller is used from now on for the view (that is the + main view shell to be precise) specific tasks. Call this method + with a suitable sub controller whenever the view shell in the center + pane is exchanged. + @param pSubController + The ViewShell specific sub controller or NULL when (temporarily + while switching to another one) there is no ViewShell displayed + in the center pane. + */ + void SetSubController ( + const css::uno::Reference<css::drawing::XDrawSubController>& rxSubController); + + /** Call this method when the VisArea has changed. + */ + void FireVisAreaChanged (const ::tools::Rectangle& rVisArea) noexcept; + + /** Call this method when the selection has changed. + */ + void FireSelectionChangeListener() noexcept; + + /** Call this method when the edit mode has changed. + */ + void FireChangeEditMode (bool bMasterPageMode) noexcept; + + /** Call this method when the layer mode has changed. + */ + void FireChangeLayerMode (bool bLayerMode) noexcept; + + /** Call this method when there is a new current page. + */ + void FireSwitchCurrentPage (SdPage* pCurrentPage) noexcept; + + /** Broadcast a sidebar context change that is caused by a view + switch. + */ + void BroadcastContextChange() const; + void NotifyAccUpdate(); + void fireChangeLayer( css::uno::Reference< css::drawing::XLayer>* pCurrentLayer ) noexcept; + // change the parameter to int + //void fireSwitchCurrentPage( String pageName) throw(); + void fireSwitchCurrentPage( sal_Int32 pageIndex) noexcept; + bool IsDisposing() const { return mbDisposing; } + + /** Return a pointer to the ViewShellBase object that the DrawController + is connected to. + @return + The returned pointer is <NULL/> after a call to + ReleaseViewShellBase(). + */ + ViewShellBase* GetViewShellBase() { return mpBase;} + + /** This method is typically called from the destructor of ViewShellBase + to tell the DrawController that it and its members must not access + the ViewShellBase anymore. + After this call the DrawController is semi-disposed. + */ + void ReleaseViewShellBase(); + + DECLARE_XINTERFACE() + DECLARE_XTYPEPROVIDER() + + // XComponent + virtual void SAL_CALL dispose() 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 >& aListener ) override; + + // XController + virtual sal_Bool SAL_CALL suspend( sal_Bool Suspend ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XSelectionSupplier + virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override; + virtual css::uno::Any SAL_CALL getSelection( ) override; + virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // XFormLayerAccess + virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController( const css::uno::Reference< css::form::XForm >& Form ) override; + virtual sal_Bool SAL_CALL isFormDesignMode( ) override; + virtual void SAL_CALL setFormDesignMode( sal_Bool DesignMode ) override; + + // XControlAccess + virtual css::uno::Reference< css::awt::XControl > SAL_CALL getControl( const css::uno::Reference< css::awt::XControlModel >& xModel ) override; + + // XDrawView + virtual void SAL_CALL + setCurrentPage ( + const css::uno::Reference< + css::drawing::XDrawPage >& xPage) override; + + virtual css::uno::Reference< + css::drawing::XDrawPage > SAL_CALL + getCurrentPage() override; + + // lang::XEventListener + virtual void SAL_CALL + disposing (const css::lang::EventObject& rEventObject) override; + + // view::XSelectionChangeListener + virtual void SAL_CALL + selectionChanged (const css::lang::EventObject& rEvent) override; + + // XControllerManager + + virtual css::uno::Reference<css::drawing::framework::XConfigurationController> SAL_CALL + getConfigurationController() override; + + virtual css::uno::Reference<css::drawing::framework::XModuleController> SAL_CALL + getModuleController() override; + +private: + /** This method must return the name to index table. This table + contains all property names and types of this object. + */ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + static void FillPropertyTable ( + ::std::vector< css::beans::Property>& rProperties); + + /** + * The same as getFastPropertyValue, but return the value through + * rValue and nHandle is always valid. + */ + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle ) const override; + + /** Convert the value rValue and return the result in rConvertedValue and the + old value in rOldValue. + After this call the vetoable listeners are notified. + + @param rConvertedValue + The converted value. Only set if return is true. + @param rOldValue + The old value. Only set if return is true. + @param nHandle + The handle of the property. + @return + <TRUE/> if the value is converted successfully. + @throws IllegalArgumentException + */ + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + + /** The same as setFastPropertyValue, but no exception is thrown and nHandle + is always valid. You must not broadcast the changes in this method. + */ + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + + /** When the called object has been disposed already this method throws + a Disposed exception and does not return. + + @throws css::lang::DisposedException + */ + void ThrowIfDisposed() const; + + using cppu::OPropertySetHelper::disposing; + using cppu::OPropertySetHelper::getFastPropertyValue; + + css::uno::Reference< css::drawing::XLayer>* mpCurrentLayer; + + const css::uno::Type m_aSelectionTypeIdentifier; + + /** This pointer to the ViewShellBase can be NULL (after a call to + ReleaseViewShellBase()). + */ + ViewShellBase* mpBase; + + ::tools::Rectangle maLastVisArea; + ::unotools::WeakReference<SdPage> mpCurrentPage; + bool mbMasterPageMode; + bool mbLayerMode; + + /** This flag indicates whether the called DrawController is being + disposed or already has been disposed. + */ + bool mbDisposing; + + ::std::unique_ptr< ::cppu::IPropertyArrayHelper> mpPropertyArrayHelper; + + /** The current sub controller. May be NULL. + */ + css::uno::Reference<css::drawing::XDrawSubController> mxSubController; + + rtl::Reference<sd::framework::ConfigurationController> mxConfigurationController; + rtl::Reference<sd::framework::ModuleController> mxModuleController; + + /** Send an event to all relevant property listeners that a + property has changed its value. The fire() method of the + OPropertySetHelper is wrapped by this method to handle + exceptions thrown by called listeners. + */ + void FirePropertyChange ( + sal_Int32 nHandle, + const css::uno::Any& rNewValue, + const css::uno::Any& rOldValue); + + void ProvideFrameworkControllers(); + void DisposeFrameworkControllers(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx new file mode 100644 index 0000000000..b53debc7dc --- /dev/null +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -0,0 +1,236 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <span> + +#include <sfx2/docfac.hxx> +#include <sfx2/objsh.hxx> +#include <svl/style.hxx> + +#include <glob.hxx> +#include <pres.hxx> +#include <sddllapi.h> +#include "fupoor.hxx" + +class FontList; +class SdDrawDocument; +class SdPage; +class SfxPrinter; +struct SpellCallbackInfo; +class AbstractSvxNameDialog; +class SfxUndoManager; + +namespace sd { + +class FrameView; +class ViewShell; +class DrawViewShell; + +// DrawDocShell +class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL) + SFX_DECL_OBJECTFACTORY(); + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + DrawDocShell ( + SfxObjectCreateMode eMode, + bool bSdDataObj, + DocumentType); + + DrawDocShell ( + SfxModelFlags nModelCreationFlags, + bool bSdDataObj, + DocumentType); + + DrawDocShell ( + SdDrawDocument* pDoc, + SfxObjectCreateMode eMode, + bool bSdDataObj, + DocumentType); + virtual ~DrawDocShell() override; + + void UpdateRefDevice(); + virtual void Activate( bool bMDI ) override; + virtual void Deactivate( bool bMDI ) override; + virtual bool InitNew( const css::uno::Reference< css::embed::XStorage >& xStorage ) override; + virtual bool ImportFrom(SfxMedium &rMedium, + css::uno::Reference<css::text::XTextRange> const& xInsertPosition) + override; + virtual bool ConvertFrom( SfxMedium &rMedium ) override; + virtual bool Save() override; + virtual bool SaveAsOwnFormat( SfxMedium& rMedium ) override; + virtual bool ConvertTo( SfxMedium &rMedium ) override; + virtual bool SaveCompleted( const css::uno::Reference< css::embed::XStorage >& xStorage ) override; + + virtual bool Load( SfxMedium &rMedium ) override; + virtual bool LoadFrom( SfxMedium& rMedium ) override; + virtual bool SaveAs( SfxMedium &rMedium ) override; + + virtual ::tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override; + virtual void Draw(OutputDevice*, const JobSetup& rSetup, sal_uInt16 nAspect, bool bOutputForScreen) override; + virtual SfxUndoManager* GetUndoManager() override; + virtual Printer* GetDocumentPrinter() override; + virtual void OnDocumentPrinterChanged(Printer* pNewPrinter) override; + virtual SfxStyleSheetBasePool* GetStyleSheetPool() override; + virtual void FillClass(SvGlobalName* pClassName, SotClipboardFormatId* pFormat, OUString* pFullTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const override; + virtual void SetModified( bool = true ) override; + virtual std::shared_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, + const SfxItemSet &rSet) override; + + using SfxObjectShell::GetVisArea; + using SfxShell::GetViewShell; + + sd::ViewShell* GetViewShell() { return mpViewShell; } + ::sd::FrameView* GetFrameView(); + + SdDrawDocument* GetDoc() { return mpDoc;} + DocumentType GetDocumentType() const { return meDocType; } + + SfxPrinter* GetPrinter(bool bCreate); + void SetPrinter(SfxPrinter *pNewPrinter); + void UpdateFontList(); + + bool IsInDestruction() const { return mbInDestruction; } + + void CancelSearching(); + + void Execute( SfxRequest& rReq ); + void GetState(SfxItemSet&); + + void Connect(sd::ViewShell* pViewSh); + void Disconnect(sd::ViewShell const * pViewSh); + void UpdateTablePointers(); + + void GotoBookmark(std::u16string_view rBookmark); + + BitmapEx GetPagePreviewBitmap(SdPage* pPage); + + /** checks, if the given name is a valid new name for a slide + + <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that + queries again for a new name until it is ok or the user chose + Cancel.</p> + + @param pWin is necessary to pass to the <type>SvxNameDialog</type> in + case an invalid name was entered. + @param rName the new name that is to be set for a slide. This string + may be set to an empty string (see below). + + @return sal_True, if the new name is unique. Note that if the user entered + a default name of a not-yet-existing slide (e.g. 'Slide 17'), + sal_True is returned, but rName is set to an empty string. + */ + bool CheckPageName(weld::Window* pWin, OUString& rName ); + + void SetSlotFilter(bool bEnable = false, std::span<sal_uInt16 const> pSIDs = std::span<sal_uInt16 const>()) { mbFilterEnable = bEnable; mpFilterSIDs = pSIDs; } + void ApplySlotFilter() const; + + SfxStyleFamily GetStyleFamily() const { return mnStyleFamily; } + void SetStyleFamily( SfxStyleFamily nSF ) { mnStyleFamily = nSF; } + + /** executes the SID_OPENDOC slot to let the framework open a document + with the given URL and this document as a referer */ + void OpenBookmark( const OUString& rBookmarkURL ); + + /** checks, if the given name is a valid new name for a slide + + <p>This method does not pop up any dialog (like CheckPageName).</p> + + @param rInOutPageName the new name for a slide that is to be renamed. + This string will be set to an empty string if + bResetStringIfStandardName is true and the name is of the + form of any, possibly not-yet existing, standard slide + (e.g. 'Slide 17') + + @param bResetStringIfStandardName if true allows setting rInOutPageName + to an empty string, which returns true and implies that the + slide will later on get a new standard name (with a free + slide number). + + @return true, if the new name is unique. If bResetStringIfStandardName + is true, the return value is also true, if the slide name is + a standard name (see above) + */ + bool IsNewPageNameValid( OUString & rInOutPageName, bool bResetStringIfStandardName = false ); + + /** checks, if the given name is a *unique* name for an *existing* slide + + @param rPageName the name of an existing slide + + @return true, if the name is unique and the slide exists + */ + bool IsPageNameUnique(std::u16string_view rPagName) const; + + /** Return the reference device for the current document. When the + inherited implementation returns a device then this is passed to the + caller. Otherwise the returned value depends on the printer + independent layout mode and will usually be either a printer or a + virtual device used for screen rendering. + @return + Returns NULL when the current document has no reference device. + */ + virtual OutputDevice* GetDocumentRefDev() override; + + DECL_DLLPRIVATE_LINK( RenameSlideHdl, AbstractSvxNameDialog&, bool ); + + // ExecuteSpellPopup now handled by DrawDocShell + DECL_DLLPRIVATE_LINK( OnlineSpellCallback, SpellCallbackInfo&, void ); + + void ClearUndoBuffer(); + + std::shared_ptr<model::ColorSet> GetThemeColors() override; + +private: + static void setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage); + void Construct(bool bClipboard); + + SdDrawDocument* mpDoc; + std::unique_ptr<SfxUndoManager> mpUndoManager; + VclPtr<SfxPrinter> mpPrinter; + ::sd::ViewShell* mpViewShell; + std::unique_ptr<FontList> mpFontList; + DocumentType meDocType; + SfxStyleFamily mnStyleFamily; + std::span<sal_uInt16 const> + mpFilterSIDs; + bool mbFilterEnable; + bool mbSdDataObj; + bool mbInDestruction; + bool mbOwnPrinter; + bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor +}; + +#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED +#define SV_DECL_DRAW_DOC_SHELL_DEFINED +typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef; +#endif + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawSubController.hxx b/sd/source/ui/inc/DrawSubController.hxx new file mode 100644 index 0000000000..5748617868 --- /dev/null +++ b/sd/source/ui/inc/DrawSubController.hxx @@ -0,0 +1,41 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/XDrawSubController.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/compbase.hxx> + +namespace sd { + + class DrawSubControllerInterfaceBase : public ::comphelper::WeakComponentImplHelper< + css::drawing::XDrawSubController, + css::lang::XServiceInfo > + { + public: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override = 0; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override = 0; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override = 0; + }; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx new file mode 100644 index 0000000000..3043ba007b --- /dev/null +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -0,0 +1,505 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include "ViewShell.hxx" +#include "tools/AsynchronousCall.hxx" +#include "TabControl.hxx" +#include <glob.hxx> +#include <pres.hxx> +#include <unotools/caserotate.hxx> +#include <unotools/options.hxx> +#include <sddllapi.h> +#include <viewopt.hxx> + +namespace svx::sidebar { class SelectionChangeHandler; } +namespace com::sun::star::lang { class XEventListener; } +namespace com::sun::star::scanner { class XScannerManager2; } + +class Outliner; +class SdPage; +class SdStyleSheet; +class SdrExternalToolEdit; +class TabBar; +class SdrObject; +class SdrPageView; +class TransferableDataHelper; +class TransferableClipboardListener; +class AbstractSvxNameDialog; +class SdrLayer; +class SvxClipboardFormatItem; +struct ESelection; +class AbstractSvxObjectNameDialog; + +namespace sd { + +class DrawView; +class LayerTabBar; +class Ruler; +class AnnotationManager; +class ViewOverlayManager; + +#define CHECK_RANGE(nMin, nValue, nMax) ((nValue >= nMin) && (nValue <= nMax)) + +/** Base class of the stacked shells that provide graphical views to + Draw and Impress documents and editing functionality. In contrast + to this other stacked shells are responsible for showing an + overview over several slides or a textual + overview over the text in an Impress document (OutlineViewShell). +*/ +class SAL_DLLPUBLIC_RTTI DrawViewShell + : public ViewShell, + public SfxListener, + public utl::ConfigurationListener +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDDRAWVIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + /** Create a new stackable shell that may take some information + (e.g. the frame view) from the given previous shell. + @param ePageKind + This parameter gives the initial page kind that the new shell + will show. + @param pFrameView + The frame view that makes it possible to pass information from + one view shell to the next. + */ + DrawViewShell ( + ViewShellBase& rViewShellBase, + vcl::Window* pParentWindow, + PageKind ePageKind, + FrameView* pFrameView); + + virtual ~DrawViewShell() override; + + virtual void Init (bool bIsMainViewShell) override; + + virtual void Shutdown() override; + + void PrePaint() override; + virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override; + + /** Arrange and resize the GUI elements like rulers, sliders, and + buttons as well as the actual document view according to the size of + the enclosing window and current sizes of buttons, rulers, and + sliders. + */ + virtual void ArrangeGUIElements() override; + + void HidePage(); + + virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override; + virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) override; + virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override; + virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) override; + virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin) override; + bool IsMouseButtonDown() const { return mbMouseButtonDown; } + bool IsMouseSelecting() const { return mbMouseSelecting; } + + virtual void Resize() override; + + void ShowMousePosInfo(const ::tools::Rectangle& rRect, ::sd::Window const * pWin); + + virtual void ChangeEditMode (EditMode eMode, bool bIsLayerModeActive); + + virtual void SetZoom( ::tools::Long nZoom ) override; + virtual void SetZoomRect( const ::tools::Rectangle& rZoomRect ) override; + + void InsertURLField(const OUString& rURL, const OUString& rText, const OUString& rTarget); + void InsertURLButton(const OUString& rURL, const OUString& rText, const OUString& rTarget, + const Point* pPos); + + void SelectionHasChanged(); + void ModelHasChanged(); + virtual void Activate(bool bIsMDIActivate) override; + virtual void Deactivate(bool IsMDIActivate) override; + virtual void UIActivating( SfxInPlaceClient* ) override; + virtual void UIDeactivated( SfxInPlaceClient* ) override; + OUString GetSelectionText( bool bCompleteWords ); + bool HasSelection( bool bText ) const; + + //If we are editing a PresObjKind::Outline return the Outliner and fill rSel + //with the current selection + ::Outliner* GetOutlinerForMasterPageOutlineTextObj(ESelection &rSel); + + void ExecCtrl(SfxRequest& rReq); + void GetCtrlState(SfxItemSet& rSet); + void GetDrawAttrState(SfxItemSet& rSet); + void GetMenuState(SfxItemSet& rSet); + void GetTableMenuState(SfxItemSet& rSet); + /** Set the items of the given item set that are related to + switching the editing mode to the correct values. + <p>This function also sets the states of the mode buttons + (those at the upper right corner) accordingly.</p> + */ + void GetModeSwitchingMenuState (SfxItemSet &rSet); + void GetAttrState(SfxItemSet& rSet); + void GetSnapItemState(SfxItemSet& rSet); + + void SetPageProperties (SfxRequest& rReq); + void GetPageProperties(SfxItemSet& rSet); + void GetMarginProperties(SfxItemSet& rSet); + + void GetState (SfxItemSet& rSet); + void Execute (SfxRequest& rReq); + + void ExecStatusBar(SfxRequest& rReq); + void GetStatusBarState(SfxItemSet& rSet); + + void ExecOptionsBar(SfxRequest& rReq); + void GetOptionsBarState(SfxItemSet& rSet); + + void ExecRuler(SfxRequest& rReq); + void GetRulerState(SfxItemSet& rSet); + + void ExecFormText(SfxRequest& rReq); + void GetFormTextState(SfxItemSet& rSet); + + void ExecAnimationWin(SfxRequest& rReq); + void GetAnimationWinState(SfxItemSet& rSet); + + void ExecNavigatorWin(SfxRequest& rReq); + void GetNavigatorWinState(SfxItemSet& rSet); + + void ExecutePropPanelAttr (SfxRequest const & rReq); + void GetStatePropPanelAttr(SfxItemSet& rSet); + + void ExecEffectWin(SfxRequest& rReq); + + void Update3DWindow(); + void AssignFrom3DWindow(); + + void ExecGallery(SfxRequest const & rReq); + + void ExecBmpMask( SfxRequest const & rReq ); + void GetBmpMaskState( SfxItemSet& rSet ); + + void ExecIMap( SfxRequest const & rReq ); + void GetIMapState( SfxItemSet& rSet ); + + void FuTemporary(SfxRequest& rReq); + void FuPermanent(SfxRequest& rReq); + void FuSupport(SfxRequest& rReq); + void FuDeleteSelectedObjects(); + void FuSupportRotate(SfxRequest const & rReq); + void FuTable(SfxRequest& rReq); + + void AttrExec (SfxRequest& rReq); + void AttrState (SfxItemSet& rSet); + + void ExecGoToNextPage (SfxRequest& rReq); + void GetStateGoToNextPage (SfxItemSet& rSet); + + void ExecGoToPreviousPage (SfxRequest& rReq); + void GetStateGoToPreviousPage (SfxItemSet& rSet); + + void ExecGoToFirstPage (SfxRequest& rReq); + void GetStateGoToFirstPage (SfxItemSet& rSet); + + void ExecGoToLastPage (SfxRequest& rReq); + void GetStateGoToLastPage (SfxItemSet& rSet); + + SD_DLLPUBLIC void ExecChar(SfxRequest& rReq); + + void ExecuteAnnotation (SfxRequest const & rRequest); + void GetAnnotationState (SfxItemSet& rItemSet); + + void StartRulerDrag (const Ruler& rRuler, const MouseEvent& rMEvt); + + virtual bool PrepareClose( bool bUI = true ) override; + + PageKind GetPageKind() const { return mePageKind; } + void SetPageKind( PageKind ePageKind ) { mePageKind = ePageKind; } + const Point& GetMousePos() const { return maMousePos; } + + EditMode GetEditMode() const { return meEditMode; } + virtual SdPage* GetActualPage() override { return mpActualPage; } + + /// inherited from sd::ViewShell + virtual SdPage* getCurrentPage() const override; + + void ResetActualPage(); + void ResetActualLayer(); + bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus = true); + bool IsSwitchPageAllowed() const; + + /** + * Mark the desired page as selected (1), deselected (0), toggle (2). + * nPage refers to the page in question. + */ + bool SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect); + bool IsSelected(sal_uInt16 nPage); + + void GotoBookmark(std::u16string_view rBookmark); + //Realize multi-selection of objects, If object is marked, the + //corresponding entry is set true, else the corresponding entry is set + //false. + void FreshNavigatrTree(); + void MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin); + + virtual void ReadFrameViewData(FrameView* pView) override; + virtual void WriteFrameViewData() override; + + virtual ErrCode DoVerb(sal_Int32 nVerb) override; + virtual bool ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) override; + + void SetZoomOnPage( bool bZoom ) { mbZoomOnPage = bZoom; } + bool IsZoomOnPage() const { return mbZoomOnPage; } + static void CheckLineTo (SfxRequest& rReq); + void SetChildWindowState( SfxItemSet& rSet ); + + void UpdateIMapDlg( SdrObject* pObj ); + + void LockInput(); + void UnlockInput(); + bool IsInputLocked() const { return mnLockCount > 0; } + + sal_uInt16 GetCurPagePos() const { return maTabControl->GetCurPagePos(); } + + /** Show controls of the UI or hide them, depending on the given flag. + Do not call this method directly. Call the method at ViewShellBase + instead. + */ + virtual void ShowUIControls (bool bVisible) override; + + void ScannerEvent(); + + bool IsLayerModeActive() const { return mbIsLayerModeActive;} + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper, + ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper, + ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ) override; + + virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override; + virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override; + + virtual void VisAreaChanged(const ::tools::Rectangle& rRect) override; + + /** Create an accessible object representing the specified window. + @param pWindow + The returned object makes the document displayed in this window + accessible. + @return + Returns an <type>AccessibleDrawDocumentView</type> object. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> + CreateAccessibleDocumentView (::sd::Window* pWindow) override; + + /** Return the number of layers managed by the layer tab control. This + will usually differ from the number of layers managed by the layer + administrator. + @return + The number of layers managed by the layer tab control. The + returned value is independent of whether the layer mode is + currently active and the tab control is visible. + */ + int GetTabLayerCount() const; + + /** Return the numerical id of the currently active layer as seen by the + layer tab control. + @return + The returned id is a number between zero (inclusive) and the + number of layers as returned by the + <member>GetTabLayerCount</member> method (exclusive). + */ + int GetActiveTabLayerIndex() const; + + /** Set the active layer at the layer tab control and update the control + accordingly to reflect the change on screen. + @param nId + The id is expected to be a number between zero (inclusive) and + the number of layers as returned by the + <member>GetTabLayerCount</member> method (exclusive). Note that + Invalid values are ignored. No exception is thrown in that case. + */ + void SetActiveTabLayerIndex (int nId); + + /** Return a pointer to the tab control for pages. + */ + TabControl& GetPageTabControl() { return *maTabControl; } + + /** Return a pointer to the tab control for layers. + */ + SD_DLLPUBLIC LayerTabBar* GetLayerTabControl(); // export for unit test + + /** Renames the given slide using an SvxNameDialog + + @param nPageId the index of the page in the SdTabControl. + @param rName the new name of the slide. + + @return false, if the new name is invalid for some reason. + + <p>Implemented in <code>drviews8.cxx</code>.</p> + */ + bool RenameSlide( sal_uInt16 nPageId, const OUString & rName ); + + /** modifies the given layer with the given values */ + void ModifyLayer( SdrLayer* pLayer, const OUString& rLayerName, const OUString& rLayerTitle, const OUString& rLayerDesc, bool bIsVisible, bool bIsLocked, bool bIsPrintable ); + + virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override; + + DrawView* GetDrawView() const { return mpDrawView.get(); } + + /** Relocation to a new parent window is not supported for DrawViewShell + objects so this method always returns <FALSE/>. + */ + virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) override; + + OUString const & GetSidebarContextName() const; + + bool IsInSwitchPage() const { return mbIsInSwitchPage; } + + const SdViewOptions& GetViewOptions() const { return maViewOptions; } + //move this method to ViewShell. + //void NotifyAccUpdate(); +protected: + DECL_DLLPRIVATE_LINK( ClipboardChanged, TransferableDataHelper*, void ); + DECL_DLLPRIVATE_LINK( TabSplitHdl, TabBar *, void ); + DECL_DLLPRIVATE_LINK( NameObjectHdl, AbstractSvxObjectNameDialog&, bool ); + DECL_DLLPRIVATE_LINK( RenameSlideHdl, AbstractSvxNameDialog&, bool ); + + void DeleteActualPage(); + void DeleteActualLayer(); + + virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin) override; + virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin) override; + virtual void UpdateHRuler() override; + virtual void UpdateVRuler() override; + virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) override; + + void SetupPage( Size const &rSize, ::tools::Long nLeft, ::tools::Long nRight, ::tools::Long nUpper, ::tools::Long nLower, + bool bSize, bool bMargin, bool bScaleAll ); + + void GetMenuStateSel(SfxItemSet& rSet); + +private: + DrawViewShell(const DrawViewShell&) = delete; + DrawViewShell& operator=(const DrawViewShell&) = delete; + + void Construct (DrawDocShell* pDocSh, PageKind ePageKind); + + void ImplDestroy(); + + /** Depending on the given request create a new page or duplicate an + existing one. See ViewShell::CreateOrDuplicatePage() for more + information. + */ + virtual SdPage* CreateOrDuplicatePage ( + SfxRequest& rRequest, + PageKind ePageKind, + SdPage* pPage, + const sal_Int32 nInsertPosition = -1) override; + + void DuplicateSelectedSlides (SfxRequest& rRequest); + + virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint) override; + + /** Stop a running slide show. + */ + void StopSlideShow(); + + /** Show the context menu for snap lines and points. Because snap lines + can not be selected the index of the snap line/point for which the + popup menu is opened has to be passed to the processing slot + handlers. This can be done only by manually showing the popup menu. + @param pParent + The parent for the context menu. + @param rRect + The location at which to display the context menu. + @param rPageView + The page view is used to access the help lines. + @param nSnapLineIndex + Index of the snap line or snap point for which to show the + context menu. + */ + void ShowSnapLineContextMenu(weld::Window* pParent, const ::tools::Rectangle& rRect, + SdrPageView& rPageView, const sal_uInt16 nSnapLineIndex); + + using ViewShell::Notify; + + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, ConfigurationHints ) override; + + void ConfigureAppBackgroundColor( svtools::ColorConfig* pColorConfig = nullptr ); + + /// return true if "Edit Hyperlink" in context menu should be disabled + bool ShouldDisableEditHyperlink() const; + +private: + std::unique_ptr<DrawView> mpDrawView; + SdPage* mpActualPage; + ::tools::Rectangle maMarkRect; + Point maMousePos; + VclPtr<TabControl> maTabControl; + EditMode meEditMode; + PageKind mePageKind; + bool mbZoomOnPage; + bool mbIsRulerDrag; + sal_uLong mnLockCount; + bool mbReadOnly; + static bool mbPipette; + /** Prevents grabbing focus while loading - see tdf#83773 that introduced + the grabbing, and tdf#150773 that needs grabbing disabled on loading + */ + bool mbFirstTimeActivation = true; + /** This flag controls whether the layer mode is active, i.e. the layer + dialog is visible. + */ + bool mbIsLayerModeActive; + /** This item contains the clipboard formats of the current clipboard + content that are supported both by that content and by the + DrawViewShell. + */ + ::std::unique_ptr<SvxClipboardFormatItem> mpCurrentClipboardFormats; + /** On some occasions it is necessary to make SwitchPage calls + asynchronously. + */ + tools::AsynchronousCall maAsynchronousSwitchPageCall; + /** This flag is used to prevent nested calls to SwitchPage(). + */ + bool mbIsInSwitchPage; + RotateTransliteration m_aRotateCase; + /** Listen for selection changes and broadcast context changes for the sidebar. + */ + ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; + css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager; + css::uno::Reference< css::lang::XEventListener > mxScannerListener; + rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr; + bool mbPastePossible; + bool mbMouseButtonDown; + bool mbMouseSelecting; + ::std::unique_ptr< AnnotationManager > mpAnnotationManager; + ::std::unique_ptr< ViewOverlayManager > mpViewOverlayManager; + std::vector<std::unique_ptr<SdrExternalToolEdit>> m_ExternalEdits; + SdViewOptions maViewOptions; +}; + + /// Merge the background properties together and deposit the result in rMergeAttr + void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool bMasterPage, SfxItemSet& rMergedAttr); + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/EventMultiplexer.hxx b/sd/source/ui/inc/EventMultiplexer.hxx new file mode 100644 index 0000000000..d6d79d11b2 --- /dev/null +++ b/sd/source/ui/inc/EventMultiplexer.hxx @@ -0,0 +1,172 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <rtl/ref.hxx> + +template <typename Arg, typename Ret> class Link; + +namespace sd +{ +class ViewShellBase; +} + +enum class EventMultiplexerEventId +{ + /** The EventMultiplexer itself is being disposed. Called for a live + EventMultiplexer. Removing a listener as response is not necessary, + though. + */ + Disposing, + + /** The selection in the center pane has changed. + */ + EditViewSelection, + + /** The selection in the slide sorter has changed, regardless of whether + the slide sorter is displayed in the left pane or the center pane. + */ + SlideSortedSelection, + + /** The current page has changed. + */ + CurrentPageChanged, + + /** The current MainViewShell (the ViewShell displayed in the center + pane) has been removed. + */ + MainViewRemoved, + + /** A new ViewShell has been made the MainViewShell. + */ + MainViewAdded, + + /** A new ViewShell is being displayed in one of the panes. Note that + for the ViewShell in the center pane both this event type and + EventId::MainViewAdded is broadcasted. + */ + ViewAdded, + + /** Edit mode was (or is being) switched to normal mode. Find + EventId::EditModeMaster below. + */ + EditModeNormal, + + /** One or more pages have been inserted into or deleted from the model. + */ + PageOrder, + + /** Text editing in one of the shapes in the MainViewShell has started. + */ + BeginTextEdit, + + /** Text editing in one of the shapes in the MainViewShell has ended. + */ + EndTextEdit, + + /** A UNO controller has been attached to the UNO frame. + */ + ControllerAttached, + + /** A UNO controller has been detached to the UNO frame. + */ + ControllerDetached, + + /** The state of a shape has changed. The page is available in the user data. + */ + ShapeChanged, + + /** A shape has been inserted to a page. The page is available in the + user data. + */ + ShapeInserted, + + /** A shape has been removed from a page. The page is available in the + user data. + */ + ShapeRemoved, + + /** A configuration update has been completed. + */ + ConfigurationUpdated, + + /** Edit mode was (or is being) switched to master mode. + */ + EditModeMaster, +}; + +namespace sd::tools +{ +class EventMultiplexerEvent +{ +public: + EventMultiplexerEventId meEventId; + const void* mpUserData; + + EventMultiplexerEvent(EventMultiplexerEventId eEventId, const void* pUserData); +}; + +/** This convenience class makes it easy to listen to various events that + originally are broadcasted via different channels. + + There is usually one EventMultiplexer instance per ViewShellBase(). + Call the laters GetEventMultiplexer() method to get access to that + instance. +*/ +class EventMultiplexer +{ +public: + /** Create new EventMultiplexer for the given ViewShellBase object. + */ + EventMultiplexer(ViewShellBase& rBase); + ~EventMultiplexer(); + + /** Add an event listener that will be informed about the specified + event types. + @param rCallback + The callback to call as soon as one of the event specified by + aEventTypeSet is received by the EventMultiplexer. + */ + void AddEventListener(const Link<EventMultiplexerEvent&, void>& rCallback); + + /** Remove an event listener for the specified event types. + */ + void RemoveEventListener(const Link<EventMultiplexerEvent&, void>& rCallback); + + /** This method is used for out-of-line events. An event of the + specified type will be sent to all listeners that are registered for + that type. + @param eEventId + The type of the event. + @param pUserData + Some data sent to the listeners along with the event. + */ + void MultiplexEvent(EventMultiplexerEventId eEventId, void const* pUserData); + +private: + class Implementation; + rtl::Reference<Implementation> mpImpl; +}; + +} // end of namespace ::sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/FormShellManager.hxx b/sd/source/ui/inc/FormShellManager.hxx new file mode 100644 index 0000000000..08e31b98ff --- /dev/null +++ b/sd/source/ui/inc/FormShellManager.hxx @@ -0,0 +1,142 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShellManager.hxx" + +#include <tools/link.hxx> +#include <svl/lstner.hxx> +#include <vcl/vclptr.hxx> + +class VclWindowEvent; +class FmFormShell; +namespace vcl +{ +class Window; +} + +namespace sd::tools +{ +class EventMultiplexerEvent; +} + +namespace sd +{ +class ViewShellBase; + +/** This simple class is responsible for putting the form shell above or + below the main view shell on the shell stack maintained by the ObjectBarManager. + + The form shell is moved above the view shell when the form shell is + activated, i.e. the FormControlActivated handler is called. + + It is moved below the view shell when the main window of the + main view shell is focused. + + The form shell is created and destroyed by the ViewShellManager by using + a factory object provided by the FormShellManager. +*/ +class FormShellManager final : public SfxListener +{ +public: + FormShellManager(ViewShellBase& rBase); + virtual ~FormShellManager() override; + + /** Typically called by a ShellFactory. It tells the + FormShellManager which form shell to manage. + @param pFormShell + This may be <NULL/> to disconnect the ViewShellManager from the + form shell. + */ + void SetFormShell(FmFormShell* pFormShell); + + /** Return the form shell last set with SetFormShell(). + @return + The result may be <NULL/> when the SetFormShell() method has not + yet been called or was last called with <NULL/>. + */ + FmFormShell* GetFormShell() { return mpFormShell; } + +private: + ViewShellBase& mrBase; + + /** Ownership of the form shell lies with the ViewShellManager. This + reference is kept so that the FormShellManager can detect when a new + form shell is passed to SetFormShell(). + */ + FmFormShell* mpFormShell; + + /** Remember whether the form shell is currently above or below the main + view shell. + */ + bool mbFormShellAboveViewShell; + + /** The factory is remembered so that it removed from the + ViewShellManager when the FormShellManager is destroyed. + */ + ViewShellManager::SharedShellFactory mpSubShellFactory; + + bool mbIsMainViewChangePending; + + VclPtr<vcl::Window> mpMainViewShellWindow; + + /** Register at window of center pane and at the form shell that + represents the form tool bar. The former informs this manager about + the deselection of the form shell. The later informs about its + selection. + */ + void RegisterAtCenterPane(); + + /** Unregister the listeners that were registered in + RegisterAtCenterPane(). + */ + void UnregisterAtCenterPane(); + + /** This call back is called by the application window (among others) + when the window gets the focus. In this case the form shell is + moved to the bottom of the shell stack. + */ + DECL_LINK(WindowEventHandler, VclWindowEvent&, void); + + /** This call back is called when view in the center pane is replaced. + When this happens then we unregister at the window of the old and + register at the window of the new shell. + */ + DECL_LINK(ConfigurationUpdateHandler, ::sd::tools::EventMultiplexerEvent&, void); + + /** This call back is called by the form shell when it gets the focus. + In this case the form shell is moved to the top of the shell stack. + */ + DECL_LINK(FormControlActivated, LinkParamNone*, void); + + /** This method is called by the form shell when that is destroyed. It + acts as a last resort against referencing a dead form shell. With + the factory working properly this method should not be necessary + (and may be removed in the future.) + */ + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + + /** dtor body */ + void ImplDestroy(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/FrameView.hxx b/sd/source/ui/inc/FrameView.hxx new file mode 100644 index 0000000000..f2e839a81b --- /dev/null +++ b/sd/source/ui/inc/FrameView.hxx @@ -0,0 +1,213 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShell.hxx" +#include <svx/svdview.hxx> +#include <pres.hxx> + +class SdDrawDocument; +class SdOptions; + +namespace sd { + +/** + * View for MDIFrame + */ +class SD_DLLPUBLIC FrameView final + : public SdrView +{ +public: + FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView = nullptr ); + FrameView(const FrameView& rFrameView); + virtual ~FrameView() override; + + void Connect(); + void Disconnect(); + + void Update(SdOptions const * pOptions); + + void SetStandardHelpLines(const SdrHelpLineList& rHelpLines) + { maStandardHelpLines = rHelpLines; } + const SdrHelpLineList& GetStandardHelpLines() const { return maStandardHelpLines; } + void SetNotesHelpLines(const SdrHelpLineList& rHelpLines) + { maNotesHelpLines = rHelpLines; } + const SdrHelpLineList& GetNotesHelpLines() const { return maNotesHelpLines; } + void SetHandoutHelpLines(const SdrHelpLineList& rHelpLines) + { maHandoutHelpLines = rHelpLines; } + const SdrHelpLineList& GetHandoutHelpLines() const { return maHandoutHelpLines; } + + void SetVisibleLayers(const SdrLayerIDSet& rVisibleLayers) + { maVisibleLayers = rVisibleLayers; } + const SdrLayerIDSet& GetVisibleLayers() const { return maVisibleLayers; } + + void SetLockedLayers(const SdrLayerIDSet& rLockedLayers) + { maLockedLayers = rLockedLayers; } + const SdrLayerIDSet& GetLockedLayers() const { return maLockedLayers; } + + void SetPrintableLayers(const SdrLayerIDSet& rPrintableLayers) + { maPrintableLayers = rPrintableLayers; } + const SdrLayerIDSet& GetPrintableLayers() const { return maPrintableLayers; } + + void SetRuler(const bool bRulerOn) + { mbRuler = bRulerOn; } + bool HasRuler() const { return mbRuler; } + + void SetNoColors(const bool bNoCol) + { mbNoColors = bNoCol; } + bool IsNoColors() const { return mbNoColors; } + + void SetNoAttribs(const bool bNoAttr) + { mbNoAttribs = bNoAttr; } + bool IsNoAttribs() const { return mbNoAttribs; } + + void SetVisArea(const ::tools::Rectangle& rVisArea) + { maVisArea = rVisArea; } + const ::tools::Rectangle& GetVisArea() const { return maVisArea; } + + void SetPageKind(PageKind eKind) { mePageKind = eKind; } + PageKind GetPageKind() const { return mePageKind; } + + /** is used in FrameView::ReadUserDataSequence() only to store the + page kind that was selected while last saving this document */ + void SetPageKindOnLoad(PageKind eKind) { mePageKindOnLoad = eKind; } + + /** can be used to get the page kind that was selected on last save of this document */ + PageKind GetPageKindOnLoad() const { return mePageKindOnLoad; } + + void SetSelectedPage (sal_uInt16 nPage); + sal_uInt16 GetSelectedPage () const { return mnSelectedPage;} + + /** is used in FrameView::ReadUserDataSequence() only to store the + page that was selected while last saving this document */ + void SetSelectedPageOnLoad (sal_uInt16 nPage) { mnSelectedPageOnLoad = nPage; } + + /** can be used to get the page that was selected on last save of this document */ + sal_uInt16 GetSelectedPageOnLoad () const { return mnSelectedPageOnLoad; } + + void SetViewShEditMode(EditMode eMode); + EditMode GetViewShEditMode () const; + + /** Remember the edit mode of the main view shell at the time when the + document is loaded. + */ + void SetViewShEditModeOnLoad (const EditMode eMode); + + /** Return the value of the edit mode as it was when the document was + loaded. + */ + EditMode GetViewShEditModeOnLoad() const { return meEditModeOnLoad;} + + void SetLayerMode(bool bMode) + { mbLayerMode = bMode; } + bool IsLayerMode() const { return mbLayerMode; } + + void SetQuickEdit(bool bQEdit) + { mbQuickEdit = bQEdit; } + bool IsQuickEdit() const { return mbQuickEdit; } + + void SetDoubleClickTextEdit( bool bOn ) { mbDoubleClickTextEdit = bOn; } + bool IsDoubleClickTextEdit() const { return mbDoubleClickTextEdit; } + + void SetClickChangeRotation( bool bOn ) { mbClickChangeRotation = bOn; } + bool IsClickChangeRotation() const { return mbClickChangeRotation; } + + /** Remember the type of the view shell that was (or soon will be) + previously associated with this frame view. + @param eType + The type of the previous view shell or ViewShell::ST_NONE to + indicate that there is no previous view shell. + */ + void SetPreviousViewShellType (ViewShell::ShellType eType); + + /** Return the type of the view shell previously associated with this + frame view. + */ + ViewShell::ShellType GetPreviousViewShellType() const { return mePreviousViewShellType;} + + /** Remember the type of the view shell at the time when the document is + loaded or, rather, when the ViewShellBase is constructed. + */ + void SetViewShellTypeOnLoad (ViewShell::ShellType eType); + + ViewShell::ShellType GetViewShellTypeOnLoad() const { return meViewShellTypeOnLoad;} + + void SetPresentationViewShellId(sal_uInt16 nId) + { mnPresViewShellId = nId; } + sal_uInt16 GetPresentationViewShellId() const { return mnPresViewShellId; } + + void SetSlidesPerRow(sal_uInt16 nSlides) { mnSlidesPerRow = nSlides; } + sal_uInt16 GetSlidesPerRow() const { return mnSlidesPerRow; } + + void SetDrawMode(DrawModeFlags nNewDrawMode) { mnDrawMode = nNewDrawMode; }; + DrawModeFlags GetDrawMode() const { return mnDrawMode; }; + + void SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes); + bool IsNavigatorShowingAllShapes() const { return mbIsNavigatorShowingAllShapes;} + + void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ); + void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ); + +private: + sal_uInt16 mnRefCount; + bool mbRuler; + SdrLayerIDSet maVisibleLayers; + SdrLayerIDSet maLockedLayers; + SdrLayerIDSet maPrintableLayers; + SdrHelpLineList maStandardHelpLines; + SdrHelpLineList maNotesHelpLines; + SdrHelpLineList maHandoutHelpLines; + bool mbNoColors; ///< structuring mode + bool mbNoAttribs; ///< structuring mode + ::tools::Rectangle maVisArea; ///< visible area + PageKind mePageKind; ///< kind of page (standard, notes, handout) + sal_uInt16 mnSelectedPage; + PageKind mePageKindOnLoad; + sal_uInt16 mnSelectedPageOnLoad; + EditMode mePageEditMode; ///< edit mode in drawing mode (Page/MasterPage) + // EditMode meStandardEditMode; ///< edit mode in drawing mode (Page/MasterPage) + // EditMode meNotesEditMode; ///< edit mode in notes mode (Page/MasterPage) + // EditMode meHandoutEditMode; ///< edit mode in handout mode (Page/MasterPage) + EditMode meEditModeOnLoad; + bool mbLayerMode; ///< layer on/off + bool mbQuickEdit; ///< QuickEdit on/off + bool mbDoubleClickTextEdit; ///< text mode after double click + bool mbClickChangeRotation; ///< single click switches between selection/rotation mode + sal_uInt16 mnPresViewShellId; ///< ViewShell from which the presentation was started + sal_uInt16 mnSlidesPerRow; ///< slides per row on the slide-desk + DrawModeFlags mnDrawMode; ///< draw mode for the normal window + /** Remember whether the navigator shows all shapes (<TRUE/>) or only + the names ones (<FALSE/>). Not persistent. + */ + bool mbIsNavigatorShowingAllShapes; + + /** The type of the previous view shell. The (default) value + ViewShell::ST_NONE indicates that there was no previous view shell. + Note that this value is used only temporarily and is not saved or + restored. + */ + ViewShell::ShellType mePreviousViewShellType; + + ViewShell::ShellType meViewShellTypeOnLoad; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/GraphicDocShell.hxx b/sd/source/ui/inc/GraphicDocShell.hxx new file mode 100644 index 0000000000..64e7ed9061 --- /dev/null +++ b/sd/source/ui/inc/GraphicDocShell.hxx @@ -0,0 +1,54 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/docfac.hxx> +#include <sfx2/objsh.hxx> +#include "DrawDocShell.hxx" +#include <glob.hxx> +#include <sddllapi.h> + +namespace sd +{ +/** + * document shell for draw documents + */ +class SD_DLLPUBLIC GraphicDocShell final : public DrawDocShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDGRAPHICDOCSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SFX_DECL_OBJECTFACTORY(); + + GraphicDocShell(SfxObjectCreateMode eMode); + + GraphicDocShell(SfxModelFlags nModelCreationFlags); + + virtual ~GraphicDocShell() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/GraphicObjectBar.hxx b/sd/source/ui/inc/GraphicObjectBar.hxx new file mode 100644 index 0000000000..7d53a86d2b --- /dev/null +++ b/sd/source/ui/inc/GraphicObjectBar.hxx @@ -0,0 +1,54 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/shell.hxx> +#include <glob.hxx> + +namespace sd { + +class View; +class ViewShell; + +class GraphicObjectBar final + : public SfxShell +{ +public: + SFX_DECL_INTERFACE( SD_IF_SDDRAWGRAFOBJECTBAR ) + + GraphicObjectBar (const ViewShell* pSdViewShell, ::sd::View* pSdView); + virtual ~GraphicObjectBar() override; + + void GetAttrState( SfxItemSet& rSet ); + void Execute( SfxRequest& rReq ); + + void GetFilterState( SfxItemSet& rSet ); + void ExecuteFilter( SfxRequest const & rReq ); + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + + ::sd::View* mpView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/GraphicViewShell.hxx b/sd/source/ui/inc/GraphicViewShell.hxx new file mode 100644 index 0000000000..d730c2dd98 --- /dev/null +++ b/sd/source/ui/inc/GraphicViewShell.hxx @@ -0,0 +1,72 @@ +/* -*- 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 . + */ + +#pragma once + +#include "DrawViewShell.hxx" + +namespace vcl +{ +class Window; +} + +namespace sd +{ +/** View shell of the Draw application. + + <p>This class is an example of how not to do it: specialization by + inheritance. A graphic view shell is similar to a draw view shell + but lacks some of its features. Thus is should be at most a base + class of DrawViewShell. There even is special case code in + ViewShell that turns off some of the features for GraphicViewShell + instances.</p> +*/ +class SAL_DLLPUBLIC_RTTI GraphicViewShell final : public DrawViewShell +{ +public: + SFX_DECL_VIEWFACTORY(GraphicViewShell); + SFX_DECL_INTERFACE(SD_IF_SDGRAPHICVIEWSHELL) + + /** Create a new view shell for the Draw application. + @param rViewShellBase + The new object will be stacked on this view shell base. + @param pFrameView + The frame view that makes it possible to pass information from + one view shell to the next. + */ + GraphicViewShell(ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, + FrameView* pFrameView); + + virtual ~GraphicViewShell() override; + + /** Override this method in order to have the layer mode always active. + */ + virtual void ChangeEditMode(EditMode eMode, bool bIsLayerModeActive) override; + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + + void ConstructGraphicViewShell(); + virtual void ArrangeGUIElements() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/GraphicViewShellBase.hxx b/sd/source/ui/inc/GraphicViewShellBase.hxx new file mode 100644 index 0000000000..a53afb3825 --- /dev/null +++ b/sd/source/ui/inc/GraphicViewShellBase.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShellBase.hxx" + +namespace sd +{ +/** This class exists to be able to register another factory that + creates the view shell for the Draw application. +*/ +class GraphicViewShellBase final : public ViewShellBase +{ +public: + SFX_DECL_VIEWFACTORY(GraphicViewShellBase); + + /** This constructor is used by the view factory of the SFX + macros. + */ + GraphicViewShellBase(SfxViewFrame& rFrame, SfxViewShell* pOldShell); + virtual ~GraphicViewShellBase() override; + + /** Callback function for general slot calls. + */ + virtual void Execute(SfxRequest& rRequest) override; + +protected: + virtual void InitializeFramework() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ImpressViewShellBase.hxx b/sd/source/ui/inc/ImpressViewShellBase.hxx new file mode 100644 index 0000000000..402013fa7f --- /dev/null +++ b/sd/source/ui/inc/ImpressViewShellBase.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShellBase.hxx" + +namespace sd +{ +/** This class implements a few features that exist only for the Impress + application. +*/ +class ImpressViewShellBase : public ViewShellBase +{ +public: + SFX_DECL_VIEWFACTORY(ImpressViewShellBase); + + /** This constructor is used by the view factory of the SFX + macros. + */ + ImpressViewShellBase(SfxViewFrame& rFrame, SfxViewShell* pOldShell); + virtual ~ImpressViewShellBase() override; + + /** Callback function for general slot calls. + */ + virtual void Execute(SfxRequest& rRequest) override; + +protected: + virtual void InitializeFramework() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/LayerTabBar.hxx b/sd/source/ui/inc/LayerTabBar.hxx new file mode 100644 index 0000000000..297a9302d5 --- /dev/null +++ b/sd/source/ui/inc/LayerTabBar.hxx @@ -0,0 +1,108 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <string_view> + +#include <svtools/tabbar.hxx> +#include <vcl/transfer.hxx> +#include <sddllapi.h> + +namespace sd { + +/** + * TabBar for layer administration + */ +class DrawViewShell; + +class SAL_DLLPUBLIC_RTTI LayerTabBar final + : public TabBar, + public DropTargetHelper +{ +public: + LayerTabBar ( + DrawViewShell* pDrViewSh, + vcl::Window* pParent); + virtual void dispose() override; + virtual ~LayerTabBar() override; + + /** Inform all listeners of this control that the current layer has been + activated. Call this method after switching the current layer and is + not done elsewhere (like when using ctrl + page up/down keys). + */ + void SendActivatePageEvent(); + + /** Inform all listeners of this control that the current layer has been + deactivated. Call this method before switching the current layer + and is not done elsewhere (like when using ctrl page up/down keys). + */ + void SendDeactivatePageEvent(); + + // Expects not-localized, real layer name in rText. Generates a localized layer name + // that will be displayed on the tab of the LayerTabBar and writes the real name + // to maAuxiliaryText. In case you want no entry in maAuxiliaryText, use method from TabBar. + virtual void InsertPage( sal_uInt16 nPageId, const OUString& rText, + TabBarPageBits nBits = TabBarPageBits::NONE, + sal_uInt16 nPos = TabBar::APPEND ) override; + virtual void SetPageText( sal_uInt16 nPageId, const OUString& rText ) override; + + // Returns the real layer name if exists and empty OUString otherwise. + OUString GetLayerName(sal_uInt16 nPageId) const; + + // Used e.g. in DeleteActualLayer() to test whether deleting is allowed. + static bool IsRealNameOfStandardLayer(std::u16string_view rName); + + // Used e.g. in validity test of user entered names + static bool IsLocalizedNameOfStandardLayer(std::u16string_view rName); + + // In case rName is one of the sUNO_LayerName_*, it generates a localized name, + // otherwise it returns value of rName. + static OUString convertToLocalizedName(const OUString& rName); + + // TabBar + virtual void Select() override; + virtual void DoubleClick() override; + + SD_DLLPUBLIC virtual void MouseButtonDown(const MouseEvent& rMEvt) override; // export for unit test + + virtual void Command(const CommandEvent& rCEvt) override; + + virtual bool StartRenaming() override; + virtual TabBarAllowRenamingReturnCode AllowRenaming() override; + virtual void EndRenaming() override; + + virtual void ActivatePage() override; + + // DropTargetHelper + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +private: + DrawViewShell* pDrViewSh; + + // Expects not-localized, real layer name in rText and writes it to maAuxiliaryText. + void SetLayerName( sal_uInt16 nPageId, const OUString& rText ); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/MasterPageObserver.hxx b/sd/source/ui/inc/MasterPageObserver.hxx new file mode 100644 index 0000000000..9ece9f9a98 --- /dev/null +++ b/sd/source/ui/inc/MasterPageObserver.hxx @@ -0,0 +1,119 @@ +/* -*- 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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <tools/link.hxx> +#include "tools/SdGlobalResourceContainer.hxx" +#include <memory> +#include <set> + +namespace osl +{ +class Mutex; +} + +class SdDrawDocument; + +namespace sd +{ +class MasterPageObserverEvent; + +/** This singleton observes all registered documents for changes in the used + master pages and in turn informs its listeners about it. One such + listener is the master page selector control in the tool panel that + shows the recently used master pages. +*/ +class MasterPageObserver final : public SdGlobalResource +{ +public: + typedef ::std::set<OUString> MasterPageNameSet; + + /** Return the single instance of this class. + */ + static MasterPageObserver& Instance(); + + /** The master page observer will listen to events of this document and + detect changes of the use of master pages. + */ + void RegisterDocument(SdDrawDocument& rDocument); + + /** The master page observer will stop to listen to events of this + document. + */ + void UnregisterDocument(SdDrawDocument& rDocument); + + /** Add a listener that is informed of master pages that are newly + assigned to slides or become unassigned. + @param rEventListener + The event listener to call for future events. Call + RemoveEventListener() before the listener is destroyed. + */ + void AddEventListener(const Link<MasterPageObserverEvent&, void>& rEventListener); + + /** Remove the given listener from the list of listeners. + @param rEventListener + After this method returns the given listener is not called back + from this object. Passing a listener that has not + been registered before is safe and is silently ignored. + */ + void RemoveEventListener(const Link<MasterPageObserverEvent&, void>& rEventListener); + +private: + class Implementation; + ::std::unique_ptr<Implementation> mpImpl; + + MasterPageObserver(); + virtual ~MasterPageObserver() override; + + MasterPageObserver(const MasterPageObserver&) = delete; + + MasterPageObserver& operator=(const MasterPageObserver&) = delete; +}; + +/** Objects of this class are sent to listeners of the MasterPageObserver + singleton when the list of master pages of one document has changed. +*/ +class MasterPageObserverEvent +{ +public: + enum EventType + { + /// Master page already exists when document is registered. + ET_MASTER_PAGE_EXISTS, + /// Master page has been added to a document. + ET_MASTER_PAGE_ADDED, + /// Master page has been removed from to a document. + ET_MASTER_PAGE_REMOVED + }; + + EventType meType; + const OUString& mrMasterPageName; + + MasterPageObserverEvent(EventType eType, const OUString& rMasterPageName) + : meType(eType) + , mrMasterPageName(rMasterPageName) + { + } +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/MediaObjectBar.hxx b/sd/source/ui/inc/MediaObjectBar.hxx new file mode 100644 index 0000000000..b7c56ef00f --- /dev/null +++ b/sd/source/ui/inc/MediaObjectBar.hxx @@ -0,0 +1,56 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/shell.hxx> +#include <glob.hxx> + +class SfxInterface; +class SfxItemSet; +class SfxModule; +class SfxRequest; + +namespace sd { + +class View; +class ViewShell; + +class MediaObjectBar final + : public SfxShell +{ +public: + SFX_DECL_INTERFACE( SD_IF_SDDRAWMEDIAOBJECTBAR ) + + MediaObjectBar (const ViewShell* pSdViewShell, ::sd::View* pSdView); + virtual ~MediaObjectBar() override; + + void GetState( SfxItemSet& rSet ); + void Execute( SfxRequest const & rReq ); + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + + ::sd::View* mpView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/NavigatorChildWindow.hxx b/sd/source/ui/inc/NavigatorChildWindow.hxx new file mode 100644 index 0000000000..4199cab677 --- /dev/null +++ b/sd/source/ui/inc/NavigatorChildWindow.hxx @@ -0,0 +1,40 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/childwin.hxx> +#include <sfx2/navigat.hxx> + +namespace vcl { class Window; } +class SfxBindings; + +namespace sd { + +class SdNavigatorWrapper final : public SfxNavigatorWrapper +{ +public: + SdNavigatorWrapper(vcl::Window *pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo); + SFX_DECL_CHILDWINDOW(SdNavigatorWrapper); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/OutlineBulletDlg.hxx b/sd/source/ui/inc/OutlineBulletDlg.hxx new file mode 100644 index 0000000000..88f401e617 --- /dev/null +++ b/sd/source/ui/inc/OutlineBulletDlg.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> + +namespace sd +{ +class View; + +/** + * Bullet-Tab-Dialog + */ +class OutlineBulletDlg : public SfxTabDialogController +{ +public: + OutlineBulletDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView); + virtual ~OutlineBulletDlg() override; + + const SfxItemSet* GetBulletOutputItemSet() const; + +protected: + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; + +private: + SfxItemSet m_aInputSet; + std::unique_ptr<SfxItemSet> m_xOutputSet; + bool m_bTitle; + ::sd::View* m_pSdView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx new file mode 100644 index 0000000000..43dadf0386 --- /dev/null +++ b/sd/source/ui/inc/OutlineView.hxx @@ -0,0 +1,230 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include <vcl/image.hxx> +#include <vcl/vclevent.hxx> +#include <editeng/lrspitem.hxx> +#include <o3tl/deleter.hxx> +#include "View.hxx" + +class SdPage; +class SdrPage; +class SdrTextObj; +class SfxProgress; +struct PasteOrDropInfos; +class EditView; + +namespace sd::tools { + class EventMultiplexerEvent; +} + +namespace sd { + +class DrawDocShell; +class OutlineViewShell; +class OutlineViewModelChangeGuard; + +const int MAX_OUTLINERVIEWS = 4; + +/** + * Derivative of ::sd::View for the outline mode +|* +\************************************************************************/ + +class OutlineView final + : public ::sd::View +{ + friend class OutlineViewModelChangeGuard; +public: + OutlineView (DrawDocShell& rDocSh, + vcl::Window* pWindow, + OutlineViewShell& rOutlineViewSh); + virtual ~OutlineView() override; + + /** This method is called by the view shell that owns the view to tell + the view that it can safely connect to the application. + This method must not be called before the view shell is on the shell + stack. + */ + void ConnectToApplication(); + void DisconnectFromApplication(); + + + static SdrTextObj* GetTitleTextObject(SdrPage const * pPage); + static SdrTextObj* GetOutlineTextObject(SdrPage const * pPage); + + static SdrTextObj* CreateTitleTextObject(SdPage* pPage); + static SdrTextObj* CreateOutlineTextObject(SdPage* pPage); + + virtual void AddDeviceToPaintView(OutputDevice& rDev, vcl::Window* pWindow) override; + virtual void DeleteDeviceFromPaintView(OutputDevice& rDev) override; + + OutlinerView* GetViewByWindow(vcl::Window const * pWin) const; + SdOutliner& GetOutliner() { return mrOutliner; } + + Paragraph* GetPrevTitle(const Paragraph* pPara); + Paragraph* GetNextTitle(const Paragraph* pPara); + SdPage* GetActualPage(); + SdPage* GetPageForParagraph( Paragraph* pPara ); + Paragraph* GetParagraphForPage( ::Outliner const & rOutl, SdPage const * pPage ); + + /** selects the paragraph for the given page at the outliner view*/ + void SetActualPage( SdPage const * pActual ); + + void Paint (const ::tools::Rectangle& rRect, ::sd::Window const * pWin); + + // Callbacks for LINKs + DECL_LINK( ParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void ); + DECL_LINK( ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void ); + DECL_LINK( DepthChangedHdl, ::Outliner::DepthChangeHdlParam, void ); + DECL_LINK( StatusEventHdl, EditStatus&, void ); + DECL_LINK( BeginMovingHdl, ::Outliner *, void ); + DECL_LINK( EndMovingHdl, ::Outliner *, void ); + DECL_LINK( RemovingPagesHdl, OutlinerView *, bool ); + DECL_LINK( IndentingPagesHdl, OutlinerView *, bool ); + DECL_LINK( BeginDropHdl, EditView*, void ); + DECL_LINK( EndDropHdl, EditView*, void ); + DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo*, void ); + + sal_uLong GetPaperWidth() const { return mnPaperWidth;} + + void PrepareClose(); + + virtual void GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const override; + virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false) override; + + void FillOutliner(); + void SetLinks(); + void ResetLinks() const; + + SfxStyleSheet* GetStyleSheet() const override; + + void SetSelectedPages(); + + virtual sal_Int8 AcceptDrop ( + const AcceptDropEvent& rEvt, + DropTargetHelper& rTargetHelper, + SdrLayerID nLayer) override; + virtual sal_Int8 ExecuteDrop ( + const ExecuteDropEvent& rEvt, + ::sd::Window* pTargetWindow, + sal_uInt16 nPage, + SdrLayerID nLayer) override; + + // Re-implement GetScriptType for this view to get correct results + virtual SvtScriptType GetScriptType() const override; + + /** After this method has been called with <TRUE/> following changes of + the current page are ignored in that the corresponding text is not + selected. + This is used to suppress unwanted side effects between selection and + cursor position. + */ + void IgnoreCurrentPageChanges (bool bIgnore); + + /** creates and inserts an empty slide for the given paragraph. */ + SdPage* InsertSlideForParagraph( Paragraph* pPara ); + + void UpdateParagraph( sal_Int32 nPara ); + +protected: + virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override; + virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override; + +private: + /** call this method before you do anything that can modify the outliner + and or the drawing document model. It will create needed undo actions */ + void BeginModelChange(); + + /** call this method after BeginModelChange(), when all possible model + changes are done. */ + void EndModelChange(); + + /** merge edit engine undo actions if possible */ + void TryToMergeUndoActions(); + + /** updates all changes in the outliner model to the draw model */ + void UpdateDocument(); + + OutlineViewShell& mrOutlineViewShell; + SdOutliner& mrOutliner; + std::unique_ptr<OutlinerView> mpOutlinerViews[MAX_OUTLINERVIEWS]; + + std::vector<Paragraph*> maOldParaOrder; + std::vector<Paragraph*> maSelectedParas; + + sal_Int32 mnPagesToProcess; // for the progress bar + sal_Int32 mnPagesProcessed; + + bool mbFirstPaint; + + sal_uLong mnPaperWidth; + + std::unique_ptr<SfxProgress> mpProgress; + + /** stores the last used document color. + this is changed in onUpdateStyleSettings() + */ + Color maDocColor; + + /** updates the high contrast settings and document color if they changed. + @param bForceUpdate forces the method to set all style settings + */ + void onUpdateStyleSettings( bool bForceUpdate ); + + /** this link is called from the vcl application when the stylesettings + change. Its only purpose is to call onUpdateStyleSettings() then. + */ + DECL_LINK( AppEventListenerHdl, VclSimpleEvent&, void ); + + DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent&, void); + + /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */ + std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> maDragAndDropModelGuard; + + SvxLRSpaceItem maLRSpaceItem; + Image maSlideImage; +}; + +// calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor +class OutlineViewPageChangesGuard +{ +public: + OutlineViewPageChangesGuard( OutlineView* pView ); + ~OutlineViewPageChangesGuard(); +private: + OutlineView* mpView; +}; + +// calls BeginModelChange() on c'tor and EndModelChange() on d'tor +class OutlineViewModelChangeGuard +{ +public: + OutlineViewModelChangeGuard( OutlineView& rView ); + ~OutlineViewModelChangeGuard() COVERITY_NOEXCEPT_FALSE; +private: + OutlineView& mrView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx new file mode 100644 index 0000000000..ec12e888a4 --- /dev/null +++ b/sd/source/ui/inc/OutlineViewShell.hxx @@ -0,0 +1,163 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShell.hxx" +#include <glob.hxx> + +class SdPage; +class TransferableDataHelper; +class TransferableClipboardListener; + +namespace sd { class OutlineView; } + +namespace sd { + +/** Show a textual overview of the text contents of all slides. +*/ +class OutlineViewShell final + : public ViewShell +{ +public: + + SFX_DECL_VIEWFACTORY(OutlineViewShell); + SFX_DECL_INTERFACE(SD_IF_SDOUTLINEVIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + /** Create a new view shell for the outline mode. + @param rViewShellBase + The new object will be stacked on this view shell base. + @param pFrameView + The frame view that makes it possible to pass information from + one view shell to the next. + */ + OutlineViewShell ( + SfxViewFrame* pFrame, + ViewShellBase& rViewShellBase, + vcl::Window* pParentWindow, + FrameView* pFrameView); + + virtual ~OutlineViewShell() override; + + virtual void Shutdown() override; + + virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override; + + /** Arrange and resize the GUI elements like rulers, sliders, and + buttons as well as the actual document view according to the size of + the enclosing window and current sizes of buttons, rulers, and + sliders. + */ + virtual void ArrangeGUIElements() override; + + virtual bool PrepareClose( bool bUI = true ) override; + + virtual void VirtHScrollHdl(ScrollAdaptor* pHScroll) override; + virtual void VirtVScrollHdl(ScrollAdaptor* pVHScroll) override; + + virtual void Activate( bool IsMDIActivate ) override; + virtual void Deactivate( bool IsMDIActivate ) override; + + virtual SdPage* GetActualPage() override; + + /// inherited from sd::ViewShell + virtual SdPage* getCurrentPage() const override; + + void ExecCtrl(SfxRequest &rReq); + void GetCtrlState(SfxItemSet &rSet); + // FIXME non-virtual override??? + void GetMenuState(SfxItemSet &rSet); + void GetAttrState(SfxItemSet &rSet); + void GetState (SfxItemSet& rSet); + + static void ExecStatusBar(SfxRequest& rReq); + void GetStatusBarState(SfxItemSet& rSet); + + void FuTemporary(SfxRequest &rReq); + void FuTemporaryModify(SfxRequest &rReq); + void FuPermanent(SfxRequest &rReq); + void FuSupport(SfxRequest &rReq); + + virtual void SetZoom(::tools::Long nZoom) override; + virtual void SetZoomRect(const ::tools::Rectangle& rZoomRect) override; + + void Execute(SfxRequest& rReq); + + virtual void ReadFrameViewData(FrameView* pView) override; + virtual void WriteFrameViewData() override; + + virtual void Command( const CommandEvent& rCEvt, ::sd::Window* pWin ) override; + virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override; + virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override; + + ErrCode ReadRtf(SvStream& rInput); + + virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override; + virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override; + + /** this method is called when the visible area of the view from this viewshell is changed */ + virtual void VisAreaChanged(const ::tools::Rectangle& rRect) override; + + /** Create an accessible object representing the specified window. + @param pWindow + The returned object makes the document displayed in this window + accessible. + @return + Returns an <type>AccessibleDrawDocumentView</type> object. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> + CreateAccessibleDocumentView (::sd::Window* pWindow) override; + + /** Update the preview to show the specified page. + */ + virtual void UpdatePreview (SdPage* pPage) override; + + virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override; + + /** Make the given page the new current page. This method + notifies the controller and adapts the selection of the + model. + @param pPage + The new current page. Pass NULL when there is no current page. + */ + void SetCurrentPage (SdPage* pPage); + + void UpdateTitleObject( SdPage* pPage, Paragraph const * pPara ); + void UpdateOutlineObject( SdPage* pPage, Paragraph* pPara ); + +private: + OUString m_StrOldPageName; + std::unique_ptr<OutlineView> pOlView; + SdPage* pLastPage; // For efficient processing of the preview + rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr; + bool bPastePossible; + bool mbInitialized; + + void Construct(); + DECL_LINK( ClipboardChanged, TransferableDataHelper*, void ); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/OutlineViewShellBase.hxx b/sd/source/ui/inc/OutlineViewShellBase.hxx new file mode 100644 index 0000000000..1abffb914d --- /dev/null +++ b/sd/source/ui/inc/OutlineViewShellBase.hxx @@ -0,0 +1,43 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ImpressViewShellBase.hxx" + +namespace sd +{ +/** This class exists to be able to register a factory that + creates an outline view shell as default. +*/ +class OutlineViewShellBase final : public ImpressViewShellBase +{ +public: + SFX_DECL_VIEWFACTORY(OutlineViewShellBase); + + /** This constructor is used by the view factory of the SFX + macros. + */ + OutlineViewShellBase(SfxViewFrame& rFrame, SfxViewShell* pOldShell); + virtual ~OutlineViewShellBase() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx new file mode 100644 index 0000000000..84b11e47b6 --- /dev/null +++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx @@ -0,0 +1,239 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/svditer.hxx> +#include <OutlinerIterator.hxx> +#include <optional> + +class SdDrawDocument; +class SdPage; + +namespace sd { + +class ViewShell; + +namespace outliner { + +/** Base class for the polymorphic implementation class of the + <type>Iterator</type> class. The iterators based on this class are + basically uni directional iterators. Their direction can, however, be + reversed at any point of their life time. +*/ +class IteratorImplBase +{ +public: + /** The constructor stores the given arguments to be used by the derived + classes. + @param pDocument + The document provides the information to be iterated on. + @param pViewShellWeak + Some information has to be taken from the view shell. + @param bDirectionIsForward + This flag defines the iteration direction. When <TRUE/> then + the direction is forwards otherwise it is backwards. + */ + IteratorImplBase (SdDrawDocument* pDocument, + const std::weak_ptr<ViewShell>& rpViewShellWeak, + bool bDirectionIsForward); + IteratorImplBase (SdDrawDocument* pDocument, + std::weak_ptr<ViewShell> pViewShellWeak, + bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode); + virtual ~IteratorImplBase(); + + /** Advance to the next text of the current object or to the next object. + This takes the iteration direction into + account. The new object pointed to can be retrieved (among other + information) by calling the <member>GetPosition</member> method. + */ + virtual void GotoNextText() = 0; + /** Return an object that describes the current object. + @return + The returned object describes the current object pointed to by + the iterator. See the description of + <type>IteratorPosition</type> for details on the available + information. + */ + virtual const IteratorPosition& GetPosition(); + /** Create an exact copy of this object. No argument should be + specified when called from the outside. It then creates an object + first and passes that to the inherited <member>Clone()</member> + methods to fill in class specific information. + @return + Returns a copy of this object. When this method is called with + an argument then this value will be returned. + */ + virtual IteratorImplBase* Clone (IteratorImplBase* pObject=nullptr) const; + /** Test the equality of the this object and the given iterator. Two + iterators are taken to be equal when they point to the same object. + Iteration direction is not taken into account. + @param rIterator + The iterator to compare to. + @return + When both iterators are equal <TRUE/> is returned, <FALSE/> otherwise. + */ + virtual bool operator== (const IteratorImplBase& rIterator) const; + /** This method is used by the equality operator. It is part of a "multimethod" pattern. + @param rIterator + The iterator to compare to. + @return + Returns <TRUE/> when both iterators point to the same object. + */ + virtual bool IsEqualSelection(const IteratorImplBase& rIterator) const; + /** Reverse the direction of iteration. The current object stays the same. + */ + virtual void Reverse(); + +protected: + /// The current position as returned by <member>GetPosition()</member>. + IteratorPosition maPosition; + /// The document on whose data the iterator operates. + SdDrawDocument* mpDocument; + /// Necessary secondary source of information. + std::weak_ptr<ViewShell> mpViewShellWeak; + /// Specifies the search direction. + bool mbDirectionIsForward; +}; + +/** Iterator all objects that belong to the current mark list + a.k.a. selection. It is assumed that all marked objects belong to the + same page. It is further assumed that the mark list does not change + while an iterator is alive. It is therefore the responsibility of an + iterator's owner to handle the case of a changed mark list. + + <p>For documentation of the methods please refer to the base class + <type>IteratorImplBase</type>.</p> +*/ +class SelectionIteratorImpl final + : public IteratorImplBase +{ +public: + SelectionIteratorImpl ( + const ::std::vector< ::unotools::WeakReference<SdrObject> >& rObjectList, + sal_Int32 nObjectIndex, + SdDrawDocument* pDocument, + const std::weak_ptr<ViewShell>& rpViewShellWeak, + bool bDirectionIsForward); + SelectionIteratorImpl (const SelectionIteratorImpl& rObject); + virtual ~SelectionIteratorImpl() override; + + virtual void GotoNextText() override; + virtual const IteratorPosition& GetPosition() override; + virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override; + virtual bool operator== (const IteratorImplBase& rIterator) const override; + +private: + const ::std::vector<::unotools::WeakReference<SdrObject>>& mrObjectList; + sal_Int32 mnObjectIndex; + + /** Compare the given iterator with this object. This method handles + only the case that the given iterator is an instance of this class. + @param rIterator + The iterator to compare to. + @return + Returns <TRUE/> when both iterators point to the same object. + */ + virtual bool IsEqualSelection(const IteratorImplBase& rIterator) const override; + + IteratorImplBase& operator= (const IteratorImplBase& rIterator); +}; + +/** Iterator for iteration over all objects in a single view. On reaching + the last object on the last page (or the first object on the first page) + the view is *not* switched. Further calls to the + <member>GotoNextObject()</member> method will be ignored. + + <p>For documentation of the methods please refer to the base class + <type>IteratorImplBase</type>.</p> +*/ +class ViewIteratorImpl : public IteratorImplBase +{ +public: + ViewIteratorImpl ( + sal_Int32 nPageIndex, + SdDrawDocument* pDocument, + const std::weak_ptr<ViewShell>& rpViewShellWeak, + bool bDirectionIsForward); + ViewIteratorImpl ( + sal_Int32 nPageIndex, + SdDrawDocument* pDocument, + const std::weak_ptr<ViewShell>& rpViewShellWeak, + bool bDirectionIsForward, + PageKind ePageKind, + EditMode eEditMode); + virtual ~ViewIteratorImpl() override; + + virtual void GotoNextText() override; + virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override; + virtual void Reverse() override; + +protected: + /** Set up page pointer and object list iterator for the specified + page. + @param nPageIndex + Index of the new page. It may lie outside the valid range for + page indices. + */ + void SetPage (sal_Int32 nPageIndex); + +private: + /// Indicates whether a page changed occurred on switching to current page. + bool mbPageChangeOccurred; + /// Pointer to the page associated with the current page index. May be NULL. + SdPage* mpPage; + /// Iterator of all objects on the current page. + std::optional<SdrObjListIter> moObjectIterator; + + // Don't use this operator. + ViewIteratorImpl& operator= (const ViewIteratorImpl&) = delete; +}; + +/** Iterator for iteration over all objects in all views. It automatically + switches views when reaching the end/beginning of a view. + + <p>For documentation of the methods please refer to the base class + <type>IteratorImplBase</type>.</p> +*/ +class DocumentIteratorImpl final : public ViewIteratorImpl +{ +public: + DocumentIteratorImpl ( + sal_Int32 nPageIndex, + PageKind ePageKind, + EditMode eEditMode, + SdDrawDocument* pDocument, + const std::weak_ptr<ViewShell>& rpViewShellWeak, + bool bDirectionIsForward); + virtual ~DocumentIteratorImpl() override; + + virtual void GotoNextText() override; + virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override; + +private: + /// Number of pages in the view that is specified by <member>maPosition</member>. + sal_Int32 mnPageCount; + + // Don't use this operator. + DocumentIteratorImpl& operator= (const DocumentIteratorImpl& ) = delete; +}; + +} } // end of namespace ::sd::outliner + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx new file mode 100644 index 0000000000..f96ede468b --- /dev/null +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -0,0 +1,65 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/childwin.hxx> +#include <unotools/resmgr.hxx> + +namespace sd { + +/// Base class of Impress and Draw left sidebars/panes. +class PaneChildWindow + : public SfxChildWindow +{ +public: + PaneChildWindow ( + vcl::Window* pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo, + TranslateId pTitleBarResId); + virtual ~PaneChildWindow() override; +}; + +/// The slide-sorter sidebar (on the left) in Impress. +class LeftPaneImpressChildWindow final + : public PaneChildWindow +{ +public: + LeftPaneImpressChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW_WITHID(LeftPaneImpressChildWindow); +}; + +/// The pages sidebar (on the left) in Draw. +class LeftPaneDrawChildWindow final + : public PaneChildWindow +{ +public: + LeftPaneDrawChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW_WITHID(LeftPaneDrawChildWindow); +}; + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/PaneShells.hxx b/sd/source/ui/inc/PaneShells.hxx new file mode 100644 index 0000000000..73f24909c2 --- /dev/null +++ b/sd/source/ui/inc/PaneShells.hxx @@ -0,0 +1,63 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/shell.hxx> +#include <glob.hxx> + +namespace sd +{ +/** Shell that displays the left pane for Impress. The shell does not do + anything else and has especially no slots. +*/ +class LeftImpressPaneShell final : public SfxShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDLEFTIMPRESSPANESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + LeftImpressPaneShell(); + virtual ~LeftImpressPaneShell() override; +}; + +/** Shell that displays the left pane for Draw. The shell does not do + anything else and has especially no slots. +*/ +class LeftDrawPaneShell final : public SfxShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDLEFTDRAWPANESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + LeftDrawPaneShell(); + virtual ~LeftDrawPaneShell() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/PresentationViewShell.hxx b/sd/source/ui/inc/PresentationViewShell.hxx new file mode 100644 index 0000000000..0272829d41 --- /dev/null +++ b/sd/source/ui/inc/PresentationViewShell.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#pragma once + +#include "DrawViewShell.hxx" + +namespace sd +{ +/** This view shell is responsible for showing the presentation of an + Impress document. +*/ +class PresentationViewShell final : public DrawViewShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDPRESVIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + PresentationViewShell(ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, + FrameView* pFrameView); + virtual ~PresentationViewShell() override; + + /** This method is used by a simple class that passes some + arguments from the creator of the new view shell to the new view + shell object by waiting for its asynchronous creation. + @param pFrameView + The frame view that is typically used by the creating object and + that shall be shared by the created view shell. + */ + void FinishInitialization(FrameView* pFrameView); + + virtual void Resize() override; + +protected: + virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin) override; + virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin) override; + +private: + ::tools::Rectangle maOldVisArea; + ImplSVEvent* mnAbortSlideShowEvent; + + virtual void Activate(bool bIsMDIActivate) override; + virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override; + + DECL_LINK(AbortSlideShowHdl, void*, void); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/PresentationViewShellBase.hxx b/sd/source/ui/inc/PresentationViewShellBase.hxx new file mode 100644 index 0000000000..9892edb150 --- /dev/null +++ b/sd/source/ui/inc/PresentationViewShellBase.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShellBase.hxx" + +namespace sd +{ +/** This class exists to be able to register another factory that + creates the view shell for the presentation. +*/ +class PresentationViewShellBase final : public ViewShellBase +{ +public: + SFX_DECL_VIEWFACTORY(PresentationViewShellBase); + + /** This constructor is used by the view factory of the SFX + macros. + */ + PresentationViewShellBase(SfxViewFrame& rFrame, SfxViewShell* pOldShell); + virtual ~PresentationViewShellBase() override; + +protected: + virtual void InitializeFramework() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/PreviewRenderer.hxx b/sd/source/ui/inc/PreviewRenderer.hxx new file mode 100644 index 0000000000..9082201476 --- /dev/null +++ b/sd/source/ui/inc/PreviewRenderer.hxx @@ -0,0 +1,141 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/image.hxx> +#include <memory> + +#include <svl/lstner.hxx> + +class SdPage; +class VirtualDevice; + +namespace sd { + +class DrawDocShell; +class DrawView; + +class PreviewRenderer final + : public SfxListener +{ +public: + /** Create a new preview renderer that takes some of its initial values + from the given output device. + @param bPaintFrame + When <TRUE/> (the default) then a frame is painted around the + preview. This makes the actual preview smaller. + */ + PreviewRenderer(const bool bPaintFrame = true); + + virtual ~PreviewRenderer() override; + + /** Render a page with the given pixel size. + Use this version when only the width of the preview is known to the + caller. The height is then calculated according to the aspect + ratio of the given page. + @param pPage + The page to render. + @param nWidth + The width of the preview in device coordinates. + The high contrast mode of the application is + ignored and the preview is rendered in normal mode. + */ + Image RenderPage ( + const SdPage* pPage, + const sal_Int32 nWidth); + + /** Render a page with the given pixel size. + @param pPage + The page to render. + @param aPreviewPixelSize + The size in device coordinates of the preview. + @param bObeyHighContrastMode + When <FALSE/> then the high contrast mode of the application is + ignored and the preview is rendered in normal mode. When + <TRUE/> and high contrast mode is active then the preview is + rendered in high contrast mode. + @param bDisplayPresentationObjects + When <FALSE/> then the PresObj place holders are not displayed + in the returned preview. + */ + Image RenderPage ( + const SdPage* pPage, + const Size aPreviewPixelSize, + const bool bObeyHighContrastMode, + const bool bDisplayPresentationObjects = true); + + /** Render an image that contains the given substitution text instead of a + slide preview. + @param aPreviewPixelSize + The size in device coordinates of the image. + */ + Image RenderSubstitution ( + const Size& rPreviewPixelSize, + const OUString& sSubstitutionText); + + /** Scale the given bitmap by keeping its aspect ratio to the desired + width. Add a frame to it afterwards. + */ + Image ScaleBitmap ( + const BitmapEx& rBitmap, + int nWidth); + +protected: + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + +private: + ScopedVclPtr<VirtualDevice> mpPreviewDevice; + ::std::unique_ptr<DrawView> mpView; + DrawDocShell* mpDocShellOfView; + const Color maFrameColor; + const bool mbHasFrame; + static const int snSubstitutionTextSize; + // Width of the frame that is painted around the preview. + static const int snFrameWidth; + + bool Initialize ( + const SdPage* pPage, + const Size& rPixelSize, + const bool bObeyHighContrastMode); + void PaintPage ( + const SdPage* pPage, + const bool bDisplayPresentationObjects); + void PaintSubstitutionText (const OUString& rSubstitutionText); + void PaintFrame(); + + /** Set up the map mode so that the given page is renderer into a bitmap + with the specified width. + @param rPage + The page for which the preview is created. + @param rPixelSize + The size of the resulting preview bitmap. Note that this size + includes the frame. The actual preview is smaller accordingly. + */ + void SetupOutputSize (const SdPage& rPage, const Size& rPixelSize); + + /** When mpView is empty then create a new view and initialize it. + Otherwise just initialize it. + */ + void ProvideView (DrawDocShell* pDocShell); +}; + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/RemoteServer.hxx b/sd/source/ui/inc/RemoteServer.hxx new file mode 100644 index 0000000000..70eed9aa8d --- /dev/null +++ b/sd/source/ui/inc/RemoteServer.hxx @@ -0,0 +1,98 @@ +/* -*- 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/. + */ +#pragma once + +#include <memory> +#include <utility> +#include <vector> + +#include <osl/socket_decl.hxx> +#include <salhelper/thread.hxx> + +#include <sddllapi.h> + +namespace osl { class Mutex; } +namespace com::sun::star::presentation { class XSlideShowController; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +/** +* The port for use for the main communication between LibO and remote control app. +*/ +#define PORT 1599 + +namespace sd +{ + class BufferedStreamSocket; + class Communicator; + + struct ClientInfo + { + OUString mName; + + bool mbIsAlreadyAuthorised; + + ClientInfo( OUString aName, + const bool bIsAlreadyAuthorised ) : + mName(std::move( aName )), + mbIsAlreadyAuthorised( bIsAlreadyAuthorised ) {} + + virtual ~ClientInfo() {}; + }; + + struct ClientInfoInternal; + + class RemoteServer final + { + public: + // For slideshowimpl to inform us. + static void presentationStarted( const css::uno::Reference< + css::presentation::XSlideShowController > &rController ); + static void presentationStopped(); + + /// ensure that discoverability (eg. for Bluetooth) is enabled + SD_DLLPUBLIC static void ensureDiscoverable(); + /// restore the state of discoverability from before ensureDiscoverable + SD_DLLPUBLIC static void restoreDiscoverable(); + + // For the communicator + static void removeCommunicator( Communicator const * pCommunicator ); + //private: + // these are public because 3 classes and a function need access + static ::osl::Mutex sDataMutex; + static ::std::vector<Communicator*> sCommunicators; + }; + + class IPRemoteServer final : public salhelper::Thread + { + public: + // Internal setup + static void setup(); + + // For the control dialog + SD_DLLPUBLIC static std::vector<std::shared_ptr<ClientInfo>> getClients(); + SD_DLLPUBLIC static bool connectClient(const std::shared_ptr<ClientInfo>& pClient, + std::u16string_view aPin); + SD_DLLPUBLIC static void deauthoriseClient(const std::shared_ptr<ClientInfo>& pClient); + + void execute() override; + void handleAcceptedConnection( BufferedStreamSocket *pSocket ) ; + + private: + IPRemoteServer(); + virtual ~IPRemoteServer() override; + + osl::AcceptorSocket mSocket; + ::std::vector<std::shared_ptr<ClientInfoInternal>> mAvailableClients; + + friend class RemoteServer; + static IPRemoteServer *spServer; + }; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/Ruler.hxx b/sd/source/ui/inc/Ruler.hxx new file mode 100644 index 0000000000..5cf1d18bb5 --- /dev/null +++ b/sd/source/ui/inc/Ruler.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/ruler.hxx> + +namespace sd { + +class DrawViewShell; +class RulerCtrlItem; +class Window; + +class Ruler final + : public SvxRuler +{ +public: + Ruler ( + DrawViewShell& rViewSh, + vcl::Window* pParent, + ::sd::Window* pWin, + SvxRulerSupportFlags nRulerFlags, + SfxBindings& rBindings, + WinBits nWinStyle); + virtual ~Ruler() override; + virtual void dispose() override; + + void SetNullOffset(const Point& rOffset); + + bool IsHorizontal() const { return bHorz; } + + using ::Ruler::SetNullOffset; + +private: + DrawViewShell* pDrViewShell; + std::unique_ptr<RulerCtrlItem> pCtrlItem; + bool bHorz; + + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + virtual void Command(const CommandEvent& rCEvt) override; + virtual void ExtraDown() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SdUnoDrawView.hxx b/sd/source/ui/inc/SdUnoDrawView.hxx new file mode 100644 index 0000000000..ad14dabe52 --- /dev/null +++ b/sd/source/ui/inc/SdUnoDrawView.hxx @@ -0,0 +1,113 @@ +/* -*- 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 . + */ + +#pragma once + +#include "DrawSubController.hxx" + +class SdXImpressDocument; +namespace com::sun::star::drawing { class XLayer; } + +namespace sd { + +class DrawViewShell; +class View; + +/** This class implements the DrawViewShell specific part of the controller. +*/ +class SdUnoDrawView final : public DrawSubControllerInterfaceBase +{ +public: + SdUnoDrawView ( + DrawViewShell& rViewShell, + View& rView) noexcept; + virtual ~SdUnoDrawView() noexcept override; + + // XSelectionSupplier + + virtual sal_Bool SAL_CALL select ( + const css::uno::Any& aSelection) override; + + virtual css::uno::Any SAL_CALL getSelection() override; + + virtual void SAL_CALL addSelectionChangeListener ( + const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) override; + + virtual void SAL_CALL removeSelectionChangeListener ( + const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) override; + + // XDrawView + + virtual void SAL_CALL setCurrentPage ( + const css::uno::Reference<css::drawing::XDrawPage >& xPage) override; + + virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override; + + // XFastPropertySet + + virtual void SAL_CALL setFastPropertyValue ( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + + virtual css::uno::Any SAL_CALL getFastPropertyValue ( + sal_Int32 nHandle) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /** Return a reference to the active layer object. + @return + The returned value may be empty when the internal state of this + view is not valid (like during destruction.) + */ + css::uno::Reference< css::drawing::XLayer> getActiveLayer() const; + +private: + bool getMasterPageMode() const noexcept; + void setMasterPageMode(bool MasterPageMode_) noexcept; + bool getLayerMode() const noexcept; + void setLayerMode(bool LayerMode_) noexcept; + /** Make the specified object the active layer. + @param rxLayer + The new layer object. + @throws css::uno::RuntimeException + */ + void setActiveLayer (const css::uno::Reference< css::drawing::XLayer>& rxLayer); + + void SetZoom( sal_Int16 nZoom ); + sal_Int16 GetZoom() const; + + void SetViewOffset(const css::awt::Point& rWinPos ); + css::awt::Point GetViewOffset() const; + + void SetZoomType( sal_Int16 nType ); + + css::uno::Any getDrawViewMode() const; + + SdXImpressDocument* GetModel() const noexcept; + + DrawViewShell& mrDrawViewShell; + sd::View& mrView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SdUnoOutlineView.hxx b/sd/source/ui/inc/SdUnoOutlineView.hxx new file mode 100644 index 0000000000..cfad20ac58 --- /dev/null +++ b/sd/source/ui/inc/SdUnoOutlineView.hxx @@ -0,0 +1,77 @@ +/* -*- 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 . + */ + +#pragma once + +#include "DrawSubController.hxx" + +namespace sd { + +class OutlineViewShell; + +/** This class implements the OutlineViewShell specific part of the controller. +*/ +class SdUnoOutlineView final + : public DrawSubControllerInterfaceBase +{ +public: + SdUnoOutlineView (OutlineViewShell& rViewShell) noexcept; + virtual ~SdUnoOutlineView() noexcept override; + + // XSelectionSupplier + + virtual sal_Bool SAL_CALL select ( + const css::uno::Any& aSelection) override; + + virtual css::uno::Any SAL_CALL getSelection() override; + + virtual void SAL_CALL addSelectionChangeListener ( + const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) override; + + virtual void SAL_CALL removeSelectionChangeListener ( + const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) override; + + // XDrawView + + virtual void SAL_CALL setCurrentPage ( + const css::uno::Reference<css::drawing::XDrawPage >& xPage) override; + + virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override; + + // XFastPropertySet + + virtual void SAL_CALL setFastPropertyValue ( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + + virtual css::uno::Any SAL_CALL getFastPropertyValue ( + sal_Int32 nHandle) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + +private: + OutlineViewShell& mrOutlineViewShell; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SdUnoSlideView.hxx b/sd/source/ui/inc/SdUnoSlideView.hxx new file mode 100644 index 0000000000..f9f4655adc --- /dev/null +++ b/sd/source/ui/inc/SdUnoSlideView.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#pragma once + +#include "DrawSubController.hxx" + +namespace sd::slidesorter { class SlideSorter; } +namespace com::sun::star::drawing { class XDrawPage; } + +namespace sd { + +/** This class implements the SlideSorter specific part of the + controller. + */ +class SdUnoSlideView final + : public DrawSubControllerInterfaceBase +{ +public: + SdUnoSlideView ( + slidesorter::SlideSorter& rSlideSorter) noexcept; + virtual ~SdUnoSlideView() noexcept override; + + // XSelectionSupplier + + virtual sal_Bool SAL_CALL select (const css::uno::Any& aSelection) override; + + virtual css::uno::Any SAL_CALL getSelection() override; + + virtual void SAL_CALL addSelectionChangeListener ( + const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) override; + + virtual void SAL_CALL removeSelectionChangeListener ( + const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) override; + + // XDrawView + + virtual void SAL_CALL setCurrentPage ( + const css::uno::Reference< css::drawing::XDrawPage >& xPage) override; + + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL + getCurrentPage() override; + + // XFastPropertySet + + virtual void SAL_CALL setFastPropertyValue ( + sal_Int32 nHandle, + const css::uno::Any& rValue) override; + + virtual css::uno::Any SAL_CALL getFastPropertyValue ( + sal_Int32 nHandle) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + +private: + slidesorter::SlideSorter& mrSlideSorter; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ShellFactory.hxx b/sd/source/ui/inc/ShellFactory.hxx new file mode 100644 index 0000000000..fc05c41aba --- /dev/null +++ b/sd/source/ui/inc/ShellFactory.hxx @@ -0,0 +1,52 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/toolbarids.hxx> + +namespace sd +{ +typedef ToolbarId ShellId; + +template <class ShellType> class ShellFactory +{ +public: + /** This abstract virtual class needs a destructor so that the + destructors of derived classes are called. + */ + virtual ~ShellFactory(){}; + + /** Create a new instance of a view shell for the given id that will + be stacked onto the given view shell base. + @return + Return the new view shell or NULL when a creation is not + possible. + */ + virtual ShellType* CreateShell(ShellId nId) = 0; + + /** Tell the factory that a shell is no longer in use. It may destroy + it or put it for future use in a cache. + */ + virtual void ReleaseShell(ShellType* pShell) = 0; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx new file mode 100644 index 0000000000..cbd15bd6ac --- /dev/null +++ b/sd/source/ui/inc/SlideSorter.hxx @@ -0,0 +1,208 @@ +/* -*- 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 . + */ + +#pragma once + +#include <cppuhelper/weakref.hxx> +#include <svtools/scrolladaptor.hxx> +#include <sddllapi.h> +#include <memory> + +namespace vcl { class Window; } +namespace com::sun::star::frame { class XController; } +namespace rtl { template <class reference_type> class Reference; } + +namespace sd { +class ViewShell; +class ViewShellBase; +class Window; +class FuPoor; +} + +namespace sd::slidesorter::model { class SlideSorterModel; } + +namespace sd::slidesorter::view { + class SlideSorterView; + class Theme; +} + +namespace sd::slidesorter::controller { + class SlideSorterController; + class SlotManager; + class Properties; +} + +namespace sd::slidesorter { + +/** Show previews for all the slides in a document and allow the user to + insert or delete slides and modify the order of the slides. + + This class is a facade for the model, view, and controller classes. + It is a hub that allows access to the various parts of a slide sorter. + + Note that this class is not in its final state. +*/ +class SlideSorter final +{ + friend class controller::SlotManager; +public: + ~SlideSorter(); + + /// Forbid copy construction and copy assignment + SlideSorter(const SlideSorter&) = delete; + SlideSorter& operator=(const SlideSorter&) = delete; + + /** Create a new slide sorter that is strongly coupled to the given view + shell. Use this function for a slide sorter in the left pane. + @param rViewShell + Typically a SlideSorterViewShell object. + @param rpContentWindow + Typically the content window of the ViewShell. + @param rpHorizontalScrollBar + Typically the horizontal scroll bar of the ViewShell. + @param rpVerticalScrollBar + Typically the vertical scroll bar of the ViewShell. + */ + static std::shared_ptr<SlideSorter> CreateSlideSorter ( + ViewShell& rViewShell, + sd::Window* pContentWindow, + ScrollAdaptor* pHorizontalScrollBar, + ScrollAdaptor* pVerticalScrollBar); + + /** Return the control of the vertical scroll bar. + */ + const VclPtr<ScrollAdaptor>& GetVerticalScrollBar() const { return mpVerticalScrollBar;} + + /** Return the control of the horizontal scroll bar. + */ + const VclPtr<ScrollAdaptor>& GetHorizontalScrollBar() const { return mpHorizontalScrollBar;} + + /** Return the content window. This is a sibling and is geometrically + enclosed by the scroll bars. + */ + const VclPtr<sd::Window>& GetContentWindow() const { return mpContentWindow;} + + model::SlideSorterModel& GetModel() const; + + view::SlideSorterView& GetView() const; + + // Exported for unit test + SD_DLLPUBLIC controller::SlideSorterController& GetController() const; + + /** Return the view shell that was given at construction. + @return + May be empty. + */ + ViewShell* GetViewShell() const { return mpViewShell;} + + /** Return the XController object of the main view. + */ + css::uno::Reference<css::frame::XController> + GetXController() const; + + /** Return the ViewShellBase object. + @return + May be empty. + */ + ViewShellBase* GetViewShellBase() const { return mpViewShellBase;} + + /** Place and size the controls and windows. You may want to call this + method when something has changed that for instance affects the + visibility state of the scroll bars. + */ + void ArrangeGUIElements ( + const Point& rOffset, + const Size& rSize); + + void RelocateToWindow (vcl::Window* pWindow); + + /** Set the current function at the view shell or, when it is not + present, set it at the content window. This method supports the use + of functions even when there is no SlideSorterViewShell. + */ + void SetCurrentFunction (const rtl::Reference<FuPoor>& rpFunction); + + /** Return a collection of properties that are used throughout the slide + sorter. + */ + std::shared_ptr<controller::Properties> const & GetProperties() const; + + /** Return the active theme which gives access to colors and fonts. + */ + std::shared_ptr<view::Theme> const & GetTheme() const; + +private: + /** This virtual method makes it possible to create a specialization of + the slide sorter view shell that works with its own implementation + of model, view, and controller. The default implementation simply + calls the CreateModel(), CreateView(), and CreateController() + methods in this order. + */ + void CreateModelViewController(); + + /** Create the model for the view shell. When called from the default + implementation of CreateModelViewController() then neither view nor + controller do exist. Test their pointers when in doubt. + */ + model::SlideSorterModel* CreateModel(); + + std::unique_ptr<controller::SlideSorterController> mpSlideSorterController; + std::unique_ptr<model::SlideSorterModel> mpSlideSorterModel; + std::unique_ptr<view::SlideSorterView> mpSlideSorterView; + css::uno::WeakReference<css::frame::XController> mxControllerWeak; + ViewShell* mpViewShell; + ViewShellBase* mpViewShellBase; + VclPtr<sd::Window> mpContentWindow; + VclPtr<ScrollAdaptor> mpHorizontalScrollBar; + VclPtr<ScrollAdaptor> mpVerticalScrollBar; + + /** Some slide sorter wide properties that are used in different + classes. + */ + std::shared_ptr<controller::Properties> mpProperties; + std::shared_ptr<view::Theme> mpTheme; + + SlideSorter ( + ViewShell& rViewShell, + sd::Window* pContentWindow, + ScrollAdaptor* pHorizontalScrollBar, + ScrollAdaptor* pVerticalScrollBar); + + void Init(); + /** Create the controls for the slide sorter. This are the tab bar + for switching the edit mode, the scroll bar, and the actual + slide sorter view window. + This method is usually called exactly one time from the + constructor. + */ + void SetupControls(); + + /** This method is usually called exactly one time from the + constructor. + */ + void SetupListeners(); + + /** Release the listeners that have been installed in SetupListeners(). + */ + void ReleaseListeners(); +}; + +} // end of namespace ::sd::slidesorter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx new file mode 100644 index 0000000000..64808d4343 --- /dev/null +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -0,0 +1,232 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShell.hxx" +#include <glob.hxx> +#include <sfx2/shell.hxx> +#include <sddllapi.h> +#include <memory> +#include <vector> + +namespace sd::slidesorter::controller { class SlotManager; } + +namespace sd::slidesorter { + +class SlideSorter; + +class SAL_DLLPUBLIC_RTTI SlideSorterViewShell final + : public ViewShell +{ + friend class controller::SlotManager; + +public: + SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + static std::shared_ptr<SlideSorterViewShell> Create( + SfxViewFrame* pFrame, + ViewShellBase& rViewShellBase, + vcl::Window* pParentWindow, + FrameView* pFrameView); + + virtual ~SlideSorterViewShell() override; + + /** Late initialization that has to be called after a new instance has + completed its construction. + */ + virtual void Init (bool bIsMainViewShell) override; + + /** Return a slide sorter that is currently displayed in one of the + panes that belong to the given ViewShellBase object. + When there is only one slide sorter visible then that one is + returned. When two (or more) are visible then the one in the center + pane is returned. When no slidesorter is visible then NULL is + returned. + */ + // Exported for unit test + SD_DLLPUBLIC static SlideSorterViewShell* GetSlideSorter(ViewShellBase& rBase); + + virtual SdPage* GetActualPage() override; + + /// inherited from sd::ViewShell + virtual SdPage* getCurrentPage() const override; + + void ExecCtrl (SfxRequest& rRequest); + void GetCtrlState (SfxItemSet &rSet); + void FuSupport (SfxRequest& rRequest); + void FuTemporary (SfxRequest& rRequest); + void GetStatusBarState (SfxItemSet& rSet); + void FuPermanent (SfxRequest& rRequest); + void GetAttrState (SfxItemSet& rSet); + static void ExecStatusBar (SfxRequest& rRequest); + virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow) override; + void GetMenuState (SfxItemSet &rSet); + void GetClipboardState (SfxItemSet &rSet); + + virtual void ReadFrameViewData (FrameView* pView) override; + virtual void WriteFrameViewData() override; + + /** Set the zoom factor. The given value is clipped against an upper + bound. + @param nZoom + An integer percent value, i.e. nZoom/100 is the actual zoom + factor. + */ + virtual void SetZoom (::tools::Long nZoom) override; + virtual void SetZoomRect (const ::tools::Rectangle& rZoomRect) override; + + /** This is a callback method used by the active window to delegate its + Paint() call to. This view shell itself delegates it to the view. + */ + virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override; + + /** Place and size the controls and windows. You may want to call this + method when something has changed that for instance affects the + visibility state of the scroll bars. + */ + virtual void ArrangeGUIElements() override; + + virtual void Activate (bool IsMDIActivate) override; + virtual void Deactivate (bool IsMDIActivate) override; + + /** Move slides up and down. Mainly uno commands. */ + void ExecMovePageUp (SfxRequest& rReq); + void GetStateMovePageUp (SfxItemSet& rSet); + + void ExecMovePageDown (SfxRequest& rReq); + void GetStateMovePageDown (SfxItemSet& rSet); + + void ExecMovePageFirst (SfxRequest& rReq); + void GetStateMovePageFirst (SfxItemSet& rSet); + + void ExecMovePageLast (SfxRequest& rReq); + void GetStateMovePageLast (SfxItemSet& rSet); + + + //===== Drag and Drop ===================================================== + + void StartDrag ( + const Point& rDragPt, + vcl::Window* pWindow ); + virtual sal_Int8 AcceptDrop ( + const AcceptDropEvent& rEvt, + DropTargetHelper& rTargetHelper, + ::sd::Window* pTargetWindow, + sal_uInt16 nPage, + SdrLayerID nLayer ) override; + virtual sal_Int8 ExecuteDrop ( + const ExecuteDropEvent& rEvt, + DropTargetHelper& rTargetHelper, + ::sd::Window* pTargetWindow, + sal_uInt16 nPage, + SdrLayerID nLayer) override; + + typedef ::std::vector<SdPage*> PageSelection; + + /** Return the set of selected pages. + */ + std::shared_ptr<PageSelection> GetPageSelection() const; + + void SetPageSelection (const std::shared_ptr<PageSelection>& rSelection); + + /** Add a listener that is called when the selection of the slide sorter + changes. + @param rListener + When this method is called multiple times for the same listener + the second and all following calls are ignored. Each listener + is added only once. + */ + void AddSelectionChangeListener (const Link<LinkParamNone*,void>& rListener); + + /** Remove a listener that was called when the selection of the slide + sorter changes. + @param rListener + It is safe to pass a listener that was not added are has been + removed previously. Such calls are ignored. + */ + void RemoveSelectionChangeListener (const Link<LinkParamNone*,void>& rListener); + + virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override; + + /** Create an accessible object representing the specified window. + @param pWindow + The returned object makes the document displayed in this window + accessible. + @return + Returns an <type>AccessibleSlideSorterView</type> object. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> + CreateAccessibleDocumentView (::sd::Window* pWindow) override; + // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase + virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc ) override; + + // Exported for unit test + SD_DLLPUBLIC SlideSorter& GetSlideSorter() const; + + /** Try to relocate all toplevel window elements to the given parent + window. + */ + virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) override; + +private: + + /** Override this method to handle a missing tool bar correctly. + This is the case when the slide sorter is not the main view shell. + */ + virtual SfxUndoManager* ImpGetUndoManager() const override; + + std::shared_ptr<SlideSorter> mpSlideSorter; + bool mbIsArrangeGUIElementsPending; + + SlideSorterViewShell ( + SfxViewFrame* pFrame, + ViewShellBase& rViewShellBase, + vcl::Window* pParentWindow, + FrameView* pFrameView); + void Initialize(); + + /** This method overwrites the one from our base class: We do our own + scroll bar and the base class call is thus unnecessary. It simply + calls UpdateScrollBars(false). + */ + virtual void UpdateScrollBars() override; + + void PostMoveSlidesActions(const std::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection); + + void MainViewEndEditAndUnmarkAll(); + + /** Select the same pages in the document as are selected in the + SlideSorterViewShell + + return the page numbers of the first and last selected pages + */ + std::pair<sal_uInt16, sal_uInt16> SyncPageSelectionToDocument(const std::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection); +}; + +typedef std::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection; + +} // end of namespace ::sd::slidesorter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SlideSorterViewShellBase.hxx b/sd/source/ui/inc/SlideSorterViewShellBase.hxx new file mode 100644 index 0000000000..38bf649198 --- /dev/null +++ b/sd/source/ui/inc/SlideSorterViewShellBase.hxx @@ -0,0 +1,43 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ImpressViewShellBase.hxx" + +namespace sd +{ +/** This class exists to be able to register a factory that creates a + slide sorter view shell as default. +*/ +class SlideSorterViewShellBase final : public ImpressViewShellBase +{ +public: + SFX_DECL_VIEWFACTORY(SlideSorterViewShellBase); + + /** This constructor is used by the view factory of the SFX + macros. + */ + SlideSorterViewShellBase(SfxViewFrame& rFrame, SfxViewShell* pOldShell); + virtual ~SlideSorterViewShellBase() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx new file mode 100644 index 0000000000..2672bfa630 --- /dev/null +++ b/sd/source/ui/inc/SlideTransitionPane.hxx @@ -0,0 +1,135 @@ +/* -*- 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 . + */ +#pragma once + +#include "SlideSorterViewShell.hxx" + +#include <svtools/valueset.hxx> +#include <sfx2/sidebar/ILayoutableWindow.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <vcl/weld.hxx> + +#include <vector> +#include <map> + +class SdDrawDocument; + +namespace com::sun::star::drawing { class XDrawView; } +namespace com::sun::star::frame { class XModel; } +namespace sd::tools { class EventMultiplexerEvent; } + +namespace sd +{ + +class TransitionPane; +class ViewShellBase; + +namespace impl +{ + struct TransitionEffect; +} + +class SlideTransitionPane final : public PanelLayout + , public sfx2::sidebar::ILayoutableWindow +{ +public: + explicit SlideTransitionPane( + weld::Widget* pParent, + ViewShellBase & rBase); + virtual ~SlideTransitionPane() override; + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; + + void onSelectionChanged(); + void onChangeCurrentPage(); + +private: + void updateControls(); + void updateControlState(); + void updateVariants(size_t nPresetOffset); + + void updateSoundList(); + void openSoundFileDialog(); + + impl::TransitionEffect getTransitionEffectFromControls() const; + + void applyToSelectedPages(bool bPreview); + void playCurrentEffect(); + + void addListener(); + void removeListener(); + + ::sd::slidesorter::SharedPageSelection getSelectedPages() const; + + void Initialize(SdDrawDocument* pDoc); + + DECL_LINK( ApplyToAllButtonClicked, weld::Button&, void ); + DECL_LINK( PlayButtonClicked, weld::Button&, void ); + DECL_LINK( AutoPreviewClicked, weld::Toggleable&, void ); + + DECL_LINK( TransitionSelected, ValueSet*, void ); + DECL_LINK( AdvanceSlideRadioButtonToggled, weld::Toggleable&, void ); + DECL_LINK( AdvanceTimeModified, weld::MetricSpinButton&, void ); + DECL_LINK( VariantListBoxSelected, weld::ComboBox&, void ); + DECL_LINK( DurationModifiedHdl, weld::MetricSpinButton&, void ); + DECL_LINK( DurationLoseFocusHdl, weld::Widget&, void ); + DECL_LINK( SoundListBoxSelected, weld::ComboBox&, void ); + DECL_LINK( LoopSoundBoxChecked, weld::Toggleable&, void ); + DECL_LINK( EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); + DECL_LINK(LateInitCallback, Timer *, void); + + ViewShellBase & mrBase; + SdDrawDocument * mpDrawDoc; + + std::unique_ptr<TransitionPane> mxVS_TRANSITION_ICONS; + std::unique_ptr<weld::CustomWeld> mxVS_TRANSITION_ICONSWin; + std::unique_ptr<weld::ComboBox> mxLB_VARIANT; + std::unique_ptr<weld::MetricSpinButton> mxCBX_duration; + std::unique_ptr<weld::Label> mxFT_SOUND; + std::unique_ptr<weld::ComboBox> mxLB_SOUND; + std::unique_ptr<weld::CheckButton> mxCB_LOOP_SOUND; + std::unique_ptr<weld::RadioButton> mxRB_ADVANCE_ON_MOUSE; + std::unique_ptr<weld::RadioButton> mxRB_ADVANCE_AUTO; + std::unique_ptr<weld::MetricSpinButton> mxMF_ADVANCE_AUTO_AFTER; + std::unique_ptr<weld::Button> mxPB_APPLY_TO_ALL; + std::unique_ptr<weld::Button> mxPB_PLAY; + std::unique_ptr<weld::CheckButton> mxCB_AUTO_PREVIEW; + + css::uno::Reference< css::drawing::XDrawView > mxView; + css::uno::Reference< css::frame::XModel > mxModel; + + bool mbHasSelection; + bool mbUpdatingControls; + bool mbIsMainViewChangePending; + + std::vector<OUString> maSoundList; + mutable OUString maCurrentSoundFile; + + // How many variants each transition set has + std::map< OUString, int > m_aNumVariants; + + Timer maLateInitTimer; +}; + +} // namespace sd + +// INCLUDED_SD_SOURCE_UI_ANIMATIONS_SLIDETRANSITIONPANE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SpellDialogChildWindow.hxx b/sd/source/ui/inc/SpellDialogChildWindow.hxx new file mode 100644 index 0000000000..3d2163a7e0 --- /dev/null +++ b/sd/source/ui/inc/SpellDialogChildWindow.hxx @@ -0,0 +1,86 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svx/SpellDialogChildWindow.hxx> +#include <svl/lstner.hxx> + +class SdOutliner; + +namespace sd +{ +/** This derivation of the svx::SpellDialogChildWindow base class + provides Draw and Impress specific implementations of + GetNextWrongSentence() and ApplyChangedSentence(). +*/ +class SpellDialogChildWindow final : public svx::SpellDialogChildWindow, public SfxListener +{ +public: + SpellDialogChildWindow(vcl::Window* pParent, sal_uInt16 nId, SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + virtual ~SpellDialogChildWindow() override; + + /** This method makes the one from the base class public so that + it can be called from the view shell when one is created. + */ + void InvalidateSpellDialog(); + + // SfxListener + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + + SFX_DECL_CHILDWINDOW_WITHID(SpellDialogChildWindow); + +private: + /** Iterate over the sentences in all text shapes and stop at the + next sentence with spelling errors. While doing so the view + mode may be changed and text shapes are set into edit mode. + */ + virtual svx::SpellPortions GetNextWrongSentence(bool bRecheck) override; + + /** This method is responsible for merging corrections made in the + spelling dialog back into the document. + */ + virtual void ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + + /** This outliner is used to do the main work of iterating over a + document and finding sentences with spelling errors. + */ + SdOutliner* mpSdOutliner; + + /** When this flag is <TRUE/> then eventually we have to destroy + the outliner in mpSdOutliner. + */ + bool mbOwnOutliner; + + /** Provide an outliner in the mpSdOutliner data member. When the + view shell has changed since the last call this include the + deletion/release of formerly created/obtained one prior to + construction/obtaining of a new one. + */ + void ProvideOutliner(); + + void EndSpellingAndClearOutliner(); +}; + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx new file mode 100644 index 0000000000..5e5eba7bbf --- /dev/null +++ b/sd/source/ui/inc/TabControl.hxx @@ -0,0 +1,107 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svtools/tabbar.hxx> +#include <vcl/transfer.hxx> + +namespace sd { + +/** + * TabControl-Class for page switch + */ + +class DrawViewShell; + +class TabControl final + : public TabBar, + public DragSourceHelper, + public DropTargetHelper +{ +public: + TabControl (DrawViewShell* pDrViewSh, vcl::Window* pParent); + virtual void dispose() override; + virtual ~TabControl() override; + + /** Inform all listeners of this control that the current page has been + activated. Call this method after switching the current page and is + not done elsewhere (like when using page up/down keys). + */ + void SendActivatePageEvent(); + + /** Inform all listeners of this control that the current page has been + deactivated. Call this method before switching the current page and + is not done elsewhere (like when using page up/down keys). + */ + void SendDeactivatePageEvent(); + +private: + DrawViewShell* pDrViewSh; + bool bInternalMove; + + // TabBar + virtual void Select() override; + virtual void DoubleClick() override; + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Command(const CommandEvent& rCEvt) override; + + virtual bool StartRenaming() override; + virtual TabBarAllowRenamingReturnCode AllowRenaming() override; + virtual void EndRenaming() override; + + virtual void ActivatePage() override; + virtual bool DeactivatePage() override; + + // DragSourceHelper + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; + + // DropTargetHelper + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + + // nested class to implement the TransferableHelper + class TabControlTransferable final : public TransferableHelper + { + public: + explicit TabControlTransferable( TabControl& rParent ) : + mrParent( rParent ) {} + private: + + TabControl& mrParent; + + virtual ~TabControlTransferable() override; + + virtual void AddSupportedFormats() override; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; + virtual void DragFinished( sal_Int8 nDropAction ) override; + + }; + + friend class TabControl::TabControlTransferable; + + void DragFinished(); + + using TabBar::StartDrag; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/TableDesignPane.hxx b/sd/source/ui/inc/TableDesignPane.hxx new file mode 100644 index 0000000000..33fe87006f --- /dev/null +++ b/sd/source/ui/inc/TableDesignPane.hxx @@ -0,0 +1,133 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svtools/valueset.hxx> +#include <sfx2/sidebar/ILayoutableWindow.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <vcl/weld.hxx> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::container { class XIndexAccess; class XNameContainer; } +namespace com::sun::star::drawing { class XDrawView; } + +namespace sd +{ + +namespace tools { +class EventMultiplexerEvent; +} + +class ViewShellBase; + +enum TableCheckBox : sal_uInt16 +{ + CB_HEADER_ROW = 0, + CB_TOTAL_ROW = 1, + CB_BANDED_ROWS = 2, + CB_FIRST_COLUMN = 3, + CB_LAST_COLUMN = 4, + CB_BANDED_COLUMNS = 5, + CB_COUNT = CB_BANDED_COLUMNS + 1 +}; + +class TableValueSet final : public ValueSet +{ +private: + bool m_bModal; + Link<const Point*, void> maContextMenuHandler; +public: + TableValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow); + virtual bool Command(const CommandEvent& rEvent) override; + virtual void Resize() override; + virtual void StyleUpdated() override; + void updateSettings(); + void setModal(bool bModal) { m_bModal = bModal; } + void SetContextMenuHandler(const Link<const Point*, void>& rLink) { maContextMenuHandler = rLink; } + static constexpr int getMaxRowCount() { return 3; } +}; + +class TableDesignWidget final +{ +public: + TableDesignWidget(weld::Builder& rBuilder, ViewShellBase& rBase); + ~TableDesignWidget(); + + // callbacks + void onSelectionChanged(); + + void ApplyOptions(); + void ApplyStyle(); + void InsertStyle(); + void CloneStyle(); + void ResetStyle(); + void DeleteStyle(); + void EditStyle(const OUString& rCommand); + +private: + void addListener(); + void removeListener(); + void updateControls(); + void selectStyle(std::u16string_view rStyle); + void endTextEditForStyle(const css::uno::Reference<css::uno::XInterface>& rStyle); + void setDocumentModified(); + + void FillDesignPreviewControl(); + + DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void); + DECL_LINK(implContextMenuHandler, const Point*, void); + DECL_LINK(implValueSetHdl, ValueSet*, void); + DECL_LINK(implCheckBoxHdl, weld::Toggleable&, void); + + ViewShellBase& mrBase; + + std::unique_ptr<weld::Menu> m_xMenu; + std::unique_ptr<TableValueSet> m_xValueSet; + std::unique_ptr<weld::CustomWeld> m_xValueSetWin; + std::unique_ptr<weld::CheckButton> m_aCheckBoxes[CB_COUNT]; + + css::uno::Reference< css::beans::XPropertySet > mxSelectedTable; + css::uno::Reference< css::drawing::XDrawView > mxView; + css::uno::Reference< css::container::XIndexAccess > mxTableFamily; + css::uno::Reference< css::container::XNameContainer > mxCellFamily; +}; + +class TableDesignPane final : public PanelLayout + , public sfx2::sidebar::ILayoutableWindow +{ +private: + std::unique_ptr<TableDesignWidget> m_xImpl; +public: + TableDesignPane( weld::Widget* pParent, ViewShellBase& rBase ) + : PanelLayout(pParent, "TableDesignPanel", + "modules/simpress/ui/tabledesignpanel.ui") + , m_xImpl(new TableDesignWidget(*m_xBuilder, rBase)) + { + } + virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 /*nWidth*/) override + { + sal_Int32 nMinimumHeight = get_preferred_size().Height(); + return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight); + } +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/TemplateScanner.hxx b/sd/source/ui/inc/TemplateScanner.hxx new file mode 100644 index 0000000000..7924cc294c --- /dev/null +++ b/sd/source/ui/inc/TemplateScanner.hxx @@ -0,0 +1,176 @@ +/* -*- 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 . + */ + +#pragma once + +#include "tools/AsynchronousTask.hxx" +#include <ucbhelper/content.hxx> +#include <com/sun/star/uno/Reference.h> + +#include <memory> +#include <utility> +#include <vector> + +namespace com::sun::star::ucb +{ +class XContent; +class XCommandEnvironment; +} + +namespace com::sun::star::sdbc +{ +class XResultSet; +} + +namespace sd +{ +/** Representation of a template or layout file. +*/ +class TemplateEntry +{ +public: + TemplateEntry(OUString sTitle, OUString sPath) + : msTitle(std::move(sTitle)) + , msPath(std::move(sPath)) + { + } + + OUString msTitle; + OUString msPath; +}; + +/** This class scans the template folders for impress templates. There are + two ways to use this class. + 1. The old and deprecated way is to call Scan() to scan all templates + and collect the supported ones in a tree structure. This structure is + returned by GetFolderList(). + 2. The new way implements the AsynchronousTask interface. Call + RunNextStep() as long HasNextStep() returns <TRUE/>. After every step + GetLastAddedEntry() returns the template that was scanned (and has a + supported format) last. When a step does not add a new template then + the value of the previous step is returned. +*/ +class TemplateScanner final : public ::sd::tools::AsynchronousTask +{ +public: + /** Create a new template scanner and prepare but do not execute the scanning. + */ + TemplateScanner(); + + /** The destructor deletes any remaining entries of the local list of + templates. + */ + virtual ~TemplateScanner(); + + /** Implementation of the AsynchronousTask interface method. + */ + virtual void RunNextStep() override; + + /** Implementation of the AsynchronousTask interface method. + */ + virtual bool HasNextStep() override; + + /** Return the TemplateDir object that was last added to + mpTemplateEntries. + @return + <nullptr/> is returned either before the template scanning is + started or after it has ended. + */ + const TemplateEntry* GetLastAddedEntry() const + { + return mpTemplateEntries.empty() ? nullptr : mpTemplateEntries.back().get(); + } + +private: + /** The current state determines which step will be executed next by + RunNextStep(). + */ + enum State + { + INITIALIZE_SCANNING, + INITIALIZE_FOLDER_SCANNING, + GATHER_FOLDER_LIST, + SCAN_FOLDER, + INITIALIZE_ENTRY_SCAN, + SCAN_ENTRY, + DONE, + ERROR + }; + State meState; + + ::ucbhelper::Content maFolderContent; + ::std::vector<std::unique_ptr<TemplateEntry>> mpTemplateEntries; + + /** The folders that are collected by GatherFolderList(). + */ + class FolderDescriptorList; + std::unique_ptr<FolderDescriptorList> mpFolderDescriptors; + + /** Set of state variables used by the methods + InitializeFolderScanning(), GatherFolderList(), ScanFolder(), + InitializeEntryScanning(), and ScanEntry(). + */ + css::uno::Reference<css::ucb::XContent> mxTemplateRoot; + css::uno::Reference<css::ucb::XCommandEnvironment> mxFolderEnvironment; + css::uno::Reference<css::ucb::XCommandEnvironment> mxEntryEnvironment; + css::uno::Reference<css::sdbc::XResultSet> mxFolderResultSet; + css::uno::Reference<css::sdbc::XResultSet> mxEntryResultSet; + + /** Obtain the root folder of the template folder hierarchy. The result + is stored in mxTemplateRoot for later use. + */ + State GetTemplateRoot(); + + /** Initialize the scanning of folders. This is called exactly once. + @return + Returns one of the two states ERROR or GATHER_FOLDER_LIST. + */ + State InitializeFolderScanning(); + + /** Collect all available top-level folders in an ordered list which can + then be processed by ScanFolder(). + @return + Returns one of the two states ERROR or SCAN_FOLDER. + */ + State GatherFolderList(); + + /** From the list of top-level folders collected by GatherFolderList() + the one with highest priority is processed. + @return + Returns one of the states ERROR, DONE, or INITIALIZE_ENTRY_SCAN. + */ + State ScanFolder(); + + /** Initialize the scanning of entries of a top-level folder. + @return + Returns one of the states ERROR or SCAN_ENTRY. + */ + State InitializeEntryScanning(); + + /** Scan one entry. When this entry matches the recognized template + types it is appended to the result set. + @return + Returns one of the states ERROR, SCAN_ENTRY, or SCAN_FOLDER. + */ + State ScanEntry(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/TextObjectBar.hxx b/sd/source/ui/inc/TextObjectBar.hxx new file mode 100644 index 0000000000..61394834fb --- /dev/null +++ b/sd/source/ui/inc/TextObjectBar.hxx @@ -0,0 +1,58 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/shell.hxx> +#include <glob.hxx> + +namespace sd { + +class View; +class ViewShell; + +class TextObjectBar final + : public SfxShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDDRAWTEXTOBJECTBAR) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + TextObjectBar ( + ViewShell* pSdViewShell, + SfxItemPool& rItemPool, + ::sd::View* pSdView); + virtual ~TextObjectBar() override; + + void GetAttrState( SfxItemSet& rSet ); + void GetCharState( SfxItemSet& rSet ); + void Execute( SfxRequest &rReq ); + +private: + ViewShell* mpViewShell; + ::sd::View* mpView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ToolBarManager.hxx b/sd/source/ui/inc/ToolBarManager.hxx new file mode 100644 index 0000000000..da5325cf69 --- /dev/null +++ b/sd/source/ui/inc/ToolBarManager.hxx @@ -0,0 +1,274 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ShellFactory.hxx" +#include <rtl/ustring.hxx> + +#include <sal/types.h> +#include <memory> +#include <utility> + +class SdrView; +namespace sd { class ViewShell; } +namespace sd::tools { class EventMultiplexer; } + +namespace sd { + +class ViewShellBase; +class ViewShellManager; + +/** Manage the set of visible tool bars (and object bars). Usually they + belong to the current view in the center pane. + + Tool bars are managed in groups. Each group can be set, reset, or + modified independently of the others. This allows for instance to + replace the toolbars associated with the current function independently + from those associated with the main view. + + The ToolBarManager has two high level methods which contain the + knowledge about which tool bars to show in a specific context. + When the view in the center pane changes then MainViewShellChanged() + sets up the tool bars for the new view. On changes of the selection the + SelectionHasChanged() method shows the tool bars for the new context. + + The update of the actually visible tool bars to the set currently + required by the main view shell and its functions is divided into two + parts, PreUpdate() and PostUpdate(). This are to be called before + respectively after the update of the view shell stack. The reason for + this is to save time by not updating tool bars that will not be visible + in a short time on a view shell switch. +*/ +class ToolBarManager + : public std::enable_shared_from_this<ToolBarManager> +{ +public: + /** Use this method instead of the constructor to create new objects of + this class. + */ + static std::shared_ptr<ToolBarManager> Create ( + ViewShellBase& rBase, + const std::shared_ptr<tools::EventMultiplexer>& rpMultiplexer, + const std::shared_ptr<ViewShellManager>& rpViewShellManager); + + ~ToolBarManager(); + + /** Call this method prior to the destructor to prevent the + ToolBarManager from accessing the ViewShellManager or the + XLayoutManager when those are possibly not well and alive anymore + (like during the destruction of the ViewShellBase.) + */ + void Shutdown(); + + /** When the view in the center pane changes then this method sets up + the initial set of tool bars for the new view. + The ToolBarManager listens for view switching itself and then calls + MainViewShellChanged(). Calling this method from the outside should + not be necessary. + @param nShellType + The type of the new main view shell. + */ + void MainViewShellChanged (); + void MainViewShellChanged (const ViewShell& rMainViewShell); + + /** Call this method when the selection has changed to update the more + temporary tool bars (those in the ToolBarGroup::Function group.) + */ + void SelectionHasChanged ( + const ViewShell& rViewShell, + const SdrView& rView); + + /** The set of tool bars that are handled by this manager class. + */ + constexpr static OUString msToolBar = u"toolbar"_ustr; // Draw_Toolbox_Sd, 23011 + constexpr static OUString msOptionsToolBar = u"optionsbar"_ustr; + // Draw_Options_Toolbox, 23020 + constexpr static OUString msCommonTaskToolBar = u"commontaskbar"_ustr; + // Draw_CommonTask_Toolbox, 23021 + constexpr static OUString msViewerToolBar = u"viewerbar"_ustr; // Draw_Viewer_Toolbox, 23023 + constexpr static OUString msSlideSorterToolBar = u"slideviewtoolbar"_ustr; + // Slide_Toolbox, 23012 + constexpr static OUString msSlideSorterObjectBar = u"slideviewobjectbar"_ustr; + // Slide_Obj_Toolbox, 23014 + constexpr static OUString msOutlineToolBar = u"outlinetoolbar"_ustr; // Outline_Toolbox, 23017 + constexpr static OUString msMasterViewToolBar = u"masterviewtoolbar"_ustr; + // SID_MASTERPAGE, 27053 + constexpr static OUString msDrawingObjectToolBar = u"drawingobjectbar"_ustr; + // Draw_Obj_Toolbox, 23013 + constexpr static OUString msGluePointsToolBar = u"gluepointsobjectbar"_ustr; + // Gluepoints_Toolbox, 23019 + constexpr static OUString msTextObjectBar = u"textobjectbar"_ustr; + // Draw_Text_Toolbox_Sd, 23016 + constexpr static OUString msBezierObjectBar = u"bezierobjectbar"_ustr; + // Bezier_Toolbox_Sd, 23015 + constexpr static OUString msGraphicObjectBar = u"graphicobjectbar"_ustr; + // Draw_Graf_Toolbox, 23030 + constexpr static OUString msMediaObjectBar = u"mediaobjectbar"_ustr; + // Draw_Media_Toolbox, 23031 + constexpr static OUString msTableObjectBar = u"tableobjectbar"_ustr; + // Draw_Table_Toolbox, 23018 + + /** The set of tool bar groups. + */ + enum class ToolBarGroup { + Permanent, + Function, + CommonTask, + MasterMode, + LAST = MasterMode + }; + + /** Reset the set of visible object bars in the specified group. Tool + bars in other groups are not affected. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + @param eGroup + Only the tool bars in this group are rest. + */ + void ResetToolBars (ToolBarGroup eGroup); + + /** Reset all tool bars, regardless of the group they belong to. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + */ + void ResetAllToolBars(); + + /** Add the tool bar with the given name to the specified group of tool + bars. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + @param eGroup + The new tool bar is added to this group. + @param rsToolBarName + The base name of the tool bar. A proper prefix (like + private:resource/toolbar/) is added. The name may be one of the + ones defined above. Other names are allowed as well. + */ + void AddToolBar ( + ToolBarGroup eGroup, + const OUString& rsToolBarName); + + /** Add the tool bar shell to the shell stack. This method basically + forwards the call to the ViewShellManager. + For some tool bar shells additional tool bars are made visible. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + @param eGroup + The group is used for the actual tool bars. + @param nToolBarId + Id of the tool bar shell. + */ + void AddToolBarShell ( + ToolBarGroup eGroup, + ShellId nToolBarId); + + /** Remove the tool bar with the given name from the specified group. + If the tool bar is not visible then nothing happens. + If the tool bar is a member of another group then nothing happens + either. + */ + void RemoveToolBar ( + ToolBarGroup eGroup, + const OUString& rsToolBarName); + + /** This is basically a shortcut for ResetToolBars(),AddToolBar(). The + main difference is, that all sub shells of the specified parent + shell are deactivated as well. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + @param eGroup + The new tool bar is added to this group. + @param rsToolBarName + The base name of the tool bar. A proper prefix (like + private:resource/toolbar/) is added. The name may be one of the + ones defined above. Other names are allowed as well. + */ + void SetToolBar ( + ToolBarGroup eGroup, + const OUString& rsToolBarName); + + /** This is basically a shortcut for ResetToolBars(),AddToolBar(). The + main difference is, that all sub shells of the specified parent + shell are deactivated as well. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + @param rParentShell + When this shell is not the main view then the method returns + immediately. + @param eGroup + The group is currently not used. + @param nToolBarId + Id of the tool bar shell. + */ + void SetToolBarShell ( + ToolBarGroup eGroup, + ShellId nToolBarId); + + void PreUpdate(); + + /** Request an update of the active tool bars. The update is made + asynchronously. + */ + void RequestUpdate(); + + /** This is a hint for the ToolBarManager to improve the performance + when it updates its tool bars when its own lock is released. Taking + control of the release of the update lock of the ViewShellManager + avoids some shell stack modifications and tool bar updates. + */ + void LockViewShellManager(); + + /** Use this class to prevent the visible tool bars from being updated + (and thus causing repaints and GUI rearrangements) when several tool + bar operations are made in a row. + */ + class UpdateLock { public: + UpdateLock(std::shared_ptr<ToolBarManager> pManager) + : mpManager(std::move(pManager)) { mpManager->LockUpdate(); } + ~UpdateLock() COVERITY_NOEXCEPT_FALSE { mpManager->UnlockUpdate(); } + private: + std::shared_ptr<ToolBarManager> mpManager; + }; + friend class UpdateLock; + + void ToolBarsDestroyed(); + +private: + class Implementation; + std::unique_ptr<Implementation> mpImpl; + + /** The ViewShellBase is used to get the XLayoutManager and to determine + the plug in mode. + */ + ToolBarManager(); + + void LockUpdate(); + void UnlockUpdate(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/UndoThemeChange.hxx b/sd/source/ui/inc/UndoThemeChange.hxx new file mode 100644 index 0000000000..798f2adb50 --- /dev/null +++ b/sd/source/ui/inc/UndoThemeChange.hxx @@ -0,0 +1,39 @@ +/* -*- 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/. + */ + +#pragma once + +#include <memory> +#include <sdundo.hxx> +#include <svx/svdpage.hxx> +#include <docmodel/theme/Theme.hxx> + +class SdDrawDocument; + +namespace sd +{ +class UndoThemeChange : public SdUndoAction +{ +private: + SdrPage* mpMasterPage; + std::shared_ptr<model::ColorSet> mpOldColorSet; + std::shared_ptr<model::ColorSet> mpNewColorSet; + +public: + UndoThemeChange(SdDrawDocument* pDocument, SdrPage* pMasterPage, + std::shared_ptr<model::ColorSet> const& pOldColorSet, + std::shared_ptr<model::ColorSet> const& pNewColorSet); + + virtual void Undo() override; + virtual void Redo() override; +}; + +} // namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx new file mode 100644 index 0000000000..342bf7b625 --- /dev/null +++ b/sd/source/ui/inc/View.hxx @@ -0,0 +1,300 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include <pres.hxx> +#include <tools/gen.hxx> +#include <vcl/transfer.hxx> +#include <svx/fmview.hxx> +#include <svx/svdpage.hxx> +#include <vcl/idle.hxx> + +#include "smarttag.hxx" +#include "fusearch.hxx" + +class SdDrawDocument; +class SdPage; +class SdrOle2Obj; +class SdrGrafObj; +class SdrMediaObj; +class OutputDevice; +class ImageMap; +class Graphic; +class SdrOutliner; + +namespace avmedia { class PlayerListener; } + +namespace sd { + +class DrawDocShell; +class ViewShell; +class Window; +class ViewClipboard; + +//For master view we want to force that master +//textboxes have readonly text, because the +//text is the auto-generated click-here-to-edit +//and it doesn't help to change it +class OutlinerMasterViewFilter +{ +private: + SdrOutliner *m_pOutl; + bool m_bReadOnly; +public: + OutlinerMasterViewFilter() + : m_pOutl(nullptr) + , m_bReadOnly(false) + { + } + void Start(SdrOutliner *pOutl); + void End(); +}; + +class SearchContext +{ +private: + rtl::Reference<FuSearch> maFunctionSearch; + +public: + rtl::Reference<FuSearch>& getFunctionSearch() + { + return maFunctionSearch; + } + + void setSearchFunction(rtl::Reference<FuSearch> const & xFunction) + { + resetSearchFunction(); + maFunctionSearch = xFunction; + } + + void resetSearchFunction() + { + if (maFunctionSearch.is()) + maFunctionSearch->Dispose(); + } +}; + +class SAL_DLLPUBLIC_RTTI View : public FmFormView +{ +public: + + View ( + SdDrawDocument& rDrawDoc, + OutputDevice* pOutDev, + ViewShell* pViewSh=nullptr); + virtual ~View() override; + + void CompleteRedraw( OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override; + + virtual void GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const; + virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false); + virtual void MarkListHasChanged() override; + void SelectAll(); + void DoCut(); + void DoCopy(); + void DoPaste(::sd::Window* pWindow=nullptr); + virtual void DoConnect(SdrOle2Obj* pOleObj) override; + virtual bool SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr = false); + void StartDrag( const Point& rStartPos, vcl::Window* pWindow ); + virtual void DragFinished( sal_Int8 nDropAction ); + virtual sal_Int8 AcceptDrop ( + const AcceptDropEvent& rEvt, + DropTargetHelper& rTargetHelper, + SdrLayerID nLayer); + virtual sal_Int8 ExecuteDrop ( + const ExecuteDropEvent& rEvt, + ::sd::Window* pTargetWindow, + sal_uInt16 nPage, + SdrLayerID nLayer); + + css::uno::Reference<css::datatransfer::XTransferable> + CreateClipboardDataObject (); + css::uno::Reference<css::datatransfer::XTransferable> + CreateDragDataObject (::sd::View*, vcl::Window& rWindow, + const Point& rDragPos); + css::uno::Reference<css::datatransfer::XTransferable> + CreateSelectionDataObject (::sd::View*); + + // update clipboard to what is selected + void UpdateSelectionClipboard(); + + // release content of clipboard, if we own the content + void ClearSelectionClipboard(); + + DrawDocShell* GetDocSh() const { return mpDocSh; } + inline SdDrawDocument& GetDoc() const; + ViewShell* GetViewShell() const { return mpViewSh; } + SfxViewShell* GetSfxViewShell() const override; + + // Create a local UndoManager + std::unique_ptr<SdrUndoManager> createLocalTextUndoManager() override; + + virtual bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = nullptr, vcl::Window* pWin = nullptr, bool bIsNewObj = false, + SdrOutliner* pGivenOutliner = nullptr, OutlinerView* pGivenOutlinerView = nullptr, + bool bDontDeleteOutliner = false, bool bOnlyOneView = false, bool bGrabFocus = true) override; + + virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally = false) override; + + bool RestoreDefaultText( SdrTextObj* pTextObj ); + + bool InsertData( const TransferableDataHelper& rDataHelper, + const Point& rPos, sal_Int8& rDnDAction, bool bDrag, + SotClipboardFormatId nFormat = SotClipboardFormatId::NONE, + sal_uInt16 nPage = SDRPAGE_NOTFOUND, SdrLayerID nLayer = SDRLAYER_NOTFOUND ); + /** gets the metafile from the given transferable helper and insert it as a graphic shape. + @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is + present, then is inserted as a single graphic. + */ + bool InsertMetaFile( const TransferableDataHelper& rDataHelper, + const Point& rInsertPos, + ImageMap const * pImageMap, bool bOptimize ); + SdrGrafObj* InsertGraphic( const Graphic& rGraphic, + sal_Int8& rAction, const Point& rPos, + SdrObject* pSelectedObj, ImageMap const * pImageMap ); + void InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction, + const Point& rPos, const Size& rSize, + bool const bLink ); + SdrMediaObj* InsertMediaObj(const OUString& rURL, sal_Int8& rAction, + const Point& rPos, const Size& rSize ); + + bool PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ); + + bool IsPresObjSelected(bool bOnPage = true, bool bOnMasterPage = true, bool bCheckPresObjListOnly = false, bool bCheckLayoutOnly = false) const; + + void SetMarkedOriginalSize(); + + bool IsMorphingAllowed() const; + bool IsVectorizeAllowed() const; + + virtual SfxStyleSheet* GetStyleSheet() const; + + /** return parameter: + pExchangeList == NULL -> all names are unique + bNameOK == false -> cancel by user + nType == 0 -> pages + nType == 1 -> objects + nType == 2 -> pages and objects */ + + bool GetExchangeList( std::vector<OUString> &rExchangeList, + std::vector<OUString> &rBookmarkList, + const sal_uInt16 nType ); + + virtual void onAccessibilityOptionsChanged() override; + + /** returns true if we have an undo manager and there is an open list undo action */ + bool isRecordingUndo() const; + + virtual void AddCustomHdl() override; + + SmartTagSet& getSmartTags() { return maSmartTags; } + void updateHandles(); + + virtual SdrViewContext GetContext() const override; + virtual bool HasMarkablePoints() const override; + virtual sal_Int32 GetMarkablePointCount() const override; + virtual bool HasMarkedPoints() const override; + virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark=false) override; + virtual void CheckPossibilities() override; + virtual bool MarkPoints(const ::tools::Rectangle* pRect, bool bUnmark) override; + using SdrMarkView::MarkPoints; + + bool ShouldToggleOn( + const bool bBulletOnOffMode, + const bool bNormalBullet); + + /** change the bullets/numbering of the marked objects + + @param bToggle + true: just toggle the current bullets/numbering on --> off resp. off --> on + + @param bHandleBullets + true: handle bullets + false: handle numbering + + @param pNumRule + numbering rule which needs to be applied. can be 0. + */ + void ChangeMarkedObjectsBulletsNumbering( + const bool bToggle, + const bool bHandleBullets, + const SvxNumRule* pNumRule); + + void SetPossibilitiesDirty() { m_bPossibilitiesDirty = true; } + void SetMoveAllowed( bool bSet ) { m_bMoveAllowed = bSet; } + void SetMoveProtected( bool bSet ) { m_bMoveProtect = bSet; } + void SetResizeFreeAllowed( bool bSet ) { m_bResizeFreeAllowed = bSet; } + void SetResizePropAllowed( bool bSet ) { m_bResizePropAllowed = bSet; } + void SetResizeProtected( bool bSet ) { m_bResizeProtect = bSet; } + + SdrObject* GetEmptyPresentationObject( PresObjKind eKind ); + SdPage* GetPage(); + SdrObject* GetSelectedSingleObject(SdPage const * pPage); + void SetAuthor(const OUString& rAuthor) { m_sAuthor = rAuthor; } + const OUString& GetAuthor() const { return m_sAuthor; } + + SearchContext& getSearchContext() { return maSearchContext; } +protected: + DECL_DLLPRIVATE_LINK( OnParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void ); + DECL_DLLPRIVATE_LINK( OnParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void ); + + virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override; + virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override; + + SdDrawDocument& mrDoc; + DrawDocShell* mpDocSh; + ViewShell* mpViewSh; + std::unique_ptr<SdrMarkList> mpDragSrcMarkList; + SdrObject* mpDropMarkerObj; + std::unique_ptr<SdrDropMarkerOverlay> mpDropMarker; + sal_uInt16 mnDragSrcPgNum; + Point maDropPos; + ::std::vector<OUString> maDropFileVector; + sal_Int8 mnAction; + Idle maDropErrorIdle; + Idle maDropInsertFileIdle; + rtl::Reference<avmedia::PlayerListener> mxDropMediaSizeListener; + sal_uInt16 mnLockRedrawSmph; + bool mbIsDropAllowed; + + DECL_DLLPRIVATE_LINK( DropErrorHdl, Timer*, void ); + DECL_DLLPRIVATE_LINK( DropInsertFileHdl, Timer*, void ); + DECL_DLLPRIVATE_LINK( ExecuteNavigatorDrop, void*, void ); + + void ImplClearDrawDropMarker(); + + SmartTagSet maSmartTags; + +private: + ::std::unique_ptr<ViewClipboard> mpClipboard; + OutlinerMasterViewFilter maMasterViewFilter; + SearchContext maSearchContext; + + OUString m_sAuthor; +}; + +SdDrawDocument& View::GetDoc() const +{ + return mrDoc; +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewClipboard.hxx b/sd/source/ui/inc/ViewClipboard.hxx new file mode 100644 index 0000000000..d39fdb8f0b --- /dev/null +++ b/sd/source/ui/inc/ViewClipboard.hxx @@ -0,0 +1,78 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/types.h> + +class SdPage; +class SdTransferable; + +namespace sd +{ +class View; + +/** Handle clipboard related tasks for the draw view. +*/ +class ViewClipboard +{ + ::sd::View& mrView; + +public: + ViewClipboard(::sd::View& rView); + virtual ~ViewClipboard(); + + /** Handle the drop of a drag-and-drop action where the transferable + contains a set of pages. + */ + void HandlePageDrop(const SdTransferable& rTransferable); + +protected: + /** Return the first master page of the given transferable. When the + bookmark list of the transferable contains at least one non-master + page then NULL is returned. + */ + static SdPage* GetFirstMasterPage(const SdTransferable& rTransferable); + + /** Assign the (first) master page of the given transferable to the + (...) slide. + */ + void AssignMasterPage(const SdTransferable& rTransferable, SdPage const* pMasterPage); + + /** Return an index of a page after which the pages of the transferable + are to be inserted into the target document. + */ + virtual sal_uInt16 DetermineInsertPosition(); + + /** Insert the slides in the given transferable behind the last selected + slide or, when the selection is empty, behind the last slide. + @param rTransferable + This transferable defines which pages to insert. + @param nInsertPosition + The pages of the transferable will be inserted behind the page + with this index. + @return + Returns the number of inserted slides. + */ + sal_uInt16 InsertSlides(const SdTransferable& rTransferable, sal_uInt16 nInsertPosition); +}; + +} // end of namespace ::sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx new file mode 100644 index 0000000000..d9fd8564ed --- /dev/null +++ b/sd/source/ui/inc/ViewShell.hxx @@ -0,0 +1,559 @@ +/* -*- 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 . + */ + +#pragma once + +#include <rtl/ref.hxx> + +#include <sfx2/viewsh.hxx> +#include <svl/typedwhich.hxx> +#include <svtools/scrolladaptor.hxx> +#include <vcl/prntypes.hxx> +#include <o3tl/deleter.hxx> +#include <pres.hxx> +#include "View.hxx" +#include "fupoor.hxx" +#include <sddllapi.h> + +#include <memory> + +class SdPage; +class SvxRuler; +class SdrOle2Obj; // for the ones, who have undefined parts of SVDRAW +class SdDrawDocument; +class SvxNumBulletItem; + +namespace weld +{ + class Window; +} + +namespace com::sun::star::drawing { class XDrawSubController; } + +namespace sd { + +class DrawDocShell; +class FrameView; +class LayerTabBar; +class ViewShellBase; +class Window; +class WindowUpdater; +class ZoomList; + +#undef OUTPUT_DRAWMODE_COLOR +#undef OUTPUT_DRAWMODE_CONTRAST + +const DrawModeFlags OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default; +const DrawModeFlags OUTPUT_DRAWMODE_GRAYSCALE + = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill + | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap + | DrawModeFlags::GrayGradient; +const DrawModeFlags OUTPUT_DRAWMODE_BLACKWHITE + = DrawModeFlags::BlackLine | DrawModeFlags::BlackText + | DrawModeFlags::WhiteFill | DrawModeFlags::GrayBitmap + | DrawModeFlags::WhiteGradient; +const DrawModeFlags OUTPUT_DRAWMODE_CONTRAST + = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill + | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient; + +/** Base class of the stacked shell hierarchy. + + <p>Despite its name this class is not a descendant of SfxViewShell + but of SfxShell. Its name expresses the fact that it acts like a + view shell. Being a stacked shell rather than being an actual view shell + there can be several instances of this class that + <ul> + <li>all are based on the same view shell and thus show the same + document and share common view functionality and</li> + <li>are all visible at the same time and live in the same + frame.</li> + <ul></p> + + <p>This class replaces the former ViewShell class.</p> +*/ +class SAL_DLLPUBLIC_RTTI ViewShell + : public SfxShell +{ +public: + enum ShellType { + ST_NONE, + ST_DRAW, // The Draw application. + ST_IMPRESS, // Main view of the Impress application. + ST_NOTES, + ST_HANDOUT, + ST_OUTLINE, + ST_SLIDE_SORTER, + ST_PRESENTATION, + ST_SIDEBAR + }; + static const int MAX_HSPLIT_CNT = 1; + static const int MAX_VSPLIT_CNT = 1; + static const int MIN_SCROLLBAR_SIZE = 50; + + + ViewShell ( + vcl::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~ViewShell() override; + + /** The Init method has to be called from the outside directly + after a new object of this class has been created. It can be + used for that part of the initialisation that can be run only + after the creation of the new object is finished. This + includes registration as listener at event broadcasters. + + Derived classes should call this method at the head of their + Init() methods. + @param bIsMainViewShell + This flag tells the Init() method whether the new ViewShell will + be the main view shell. + */ + virtual void Init (bool bIsMainViewShell); + + /** The Exit() method has to be called before the destructor so that the + view shell is still a valid object and can safely call methods that + rely on that. + */ + void Exit(); + + void Cancel(); + + /** Return the window that is the parent of all controls of this view + shell. This may or may not be the window of the frame. + */ + vcl::Window* GetParentWindow() const { return mpParentWindow; } + + sd::Window* GetContentWindow() const; + + ::sd::View* GetView() const { return mpView; } + inline SdrView* GetDrawView() const; + SD_DLLPUBLIC DrawDocShell* GetDocSh() const; + + SdDrawDocument* GetDoc() const; + + SD_DLLPUBLIC SfxViewFrame* GetViewFrame() const; + + /** The active window is usually the mpContentWindow. When there is a + show running then the active window is a ShowWindow. + */ + ::sd::Window* GetActiveWindow() const { return mpActiveWindow;} + SD_DLLPUBLIC weld::Window* GetFrameWeld() const; + + /** Set the active window. When the shell is displayed in the center + pane then the window of the ViewShellBase is also set to the given + window. + */ + void SetActiveWindow (::sd::Window* pWindow); + + /** Return the rectangle that encloses all windows of the view. That + excludes the controls in the frame like rulers, scroll bars, tab + bar, and buttons. + @return + The rectangle is returned in screen coordinates, i.e. pixel + values relative to the upper left corner of the screen?. + */ + const ::tools::Rectangle& GetAllWindowRect(); + + // Mouse- & Key-Events + virtual void PrePaint(); + virtual void Paint (const ::tools::Rectangle& rRect, ::sd::Window* pWin); + virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin); + virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin); + virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin); + virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin); + virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin); + bool RequestHelp( const HelpEvent& rEvt ); + bool Notify( NotifyEvent const & rNEvt, ::sd::Window* pWin ); + + bool HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin); + + void SetUIUnit(FieldUnit eUnit); + void SetDefTabHRuler( sal_uInt16 nDefTab ); + + const SvxNumBulletItem* GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId); + + bool HasRuler() const { return mbHasRulers;} + void SetRuler(bool bRuler); + // Hides horizontal, vertical scrollbar as well as scrollbox + void SetScrollBarsVisible(bool bVisible); + + /** Set internal values of all scroll bars that determine thumb size and + position. The external values like size and position of the scroll + bar controls are not modified. + */ + virtual void UpdateScrollBars(); + void Scroll(::tools::Long nX, ::tools::Long nY); + void ScrollLines(::tools::Long nX, ::tools::Long nY); + virtual void SetZoom(::tools::Long nZoom); + ::tools::Long GetZoom() const; + virtual void SetZoomRect(const ::tools::Rectangle& rZoomRect); + void InitWindows(const Point& rViewOrigin, const Size& rViewSize, + const Point& rWinPos, bool bUpdate = false); + void InvalidateWindows(); + /** This method is still used by the OutlineViewShell to update the + model according to the content of the outline view. This in turn + updates the previews in the slide sorter. + */ + virtual void UpdatePreview (SdPage* pPage); + + void DrawMarkRect(const ::tools::Rectangle& rRect) const; + + void ExecReq( SfxRequest &rReq ); + + ZoomList* GetZoomList() { return mpZoomList.get();} + + FrameView* GetFrameView() { return mpFrameView; } + /** Setting a frame view triggers ReadFrameViewData() for the new + frame. + @param pFrameView + The new frame view that replaces the old one. + */ + void SetFrameView (FrameView* pFrameView); + virtual void ReadFrameViewData(FrameView* pView); + virtual void WriteFrameViewData(); + void WriteUserData(); + void ReadUserData(); + + virtual bool ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb); + + /** @returns + current or selected page or 0. This method + will fail in master page mode. + + @deprecated, please use getCurrentPage(); + */ + virtual SdPage* GetActualPage() = 0; + + /** @returns + current or selected page or 0. + */ + virtual SdPage* getCurrentPage() const = 0; + + const rtl::Reference<FuPoor>& GetOldFunction() const { return mxOldFunction; } + bool HasOldFunction() const { return mxOldFunction.is(); } + const rtl::Reference<FuPoor>& GetCurrentFunction() const { return mxCurrentFunction; } + bool HasCurrentFunction( sal_uInt16 nSID ) { return mxCurrentFunction.is() && (mxCurrentFunction->GetSlotID() == nSID ); } + bool HasCurrentFunction() const { return mxCurrentFunction.is(); } + + void SetCurrentFunction(const rtl::Reference<FuPoor>& xFunction); + void SetOldFunction(const rtl::Reference<FuPoor>& xFunction); + void DeactivateCurrentFunction( bool bPermanent = false ); + + void SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize, + ::tools::Long nLeft, ::tools::Long nRight, ::tools::Long nUpper, ::tools::Long nLower, + bool bScaleAll, Orientation eOrient, sal_uInt16 nPaperBin, + bool bBackgroundFullSize ); + + void SetStartShowWithDialog( bool bIn ) { mbStartShowWithDialog = bIn; } + bool IsStartShowWithDialog() const { return mbStartShowWithDialog; } + + sal_uInt16 GetPrintedHandoutPageNum() const { return mnPrintedHandoutPageNum; } + void SetPrintedHandoutPageNum (sal_uInt16 nPageNumber) {mnPrintedHandoutPageNum=nPageNumber; } + + sal_uInt16 GetPrintedHandoutPageCount() const { return mnPrintedHandoutPageCount; } + void SetPrintedHandoutPageCount (sal_uInt16 nPageCount) {mnPrintedHandoutPageCount=nPageCount; } + + virtual bool PrepareClose( bool bUI = true ); + + void GetMenuState(SfxItemSet& rSet); + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper, + ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper, + ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ); + + virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ); + virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ); + + /** this method is called when the visible area of the view from this viewshell is changed */ + virtual void VisAreaChanged(const ::tools::Rectangle& rRect); + + /** Create an accessible object representing the specified window. + Override this method to provide view mode specific objects. The + default implementation returns an empty reference. + @param pWindow + Make the document displayed in this window accessible. + @return + This default implementation returns an empty reference. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> + CreateAccessibleDocumentView (::sd::Window* pWindow); + + virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc ); + void SwitchActiveViewFireFocus( ); + // Move these two methods from DrawViewShell to enable slide show view + void NotifyAccUpdate(); + void fireSwitchCurrentPage(sal_Int32 pageIndex); + void SetWinViewPos(const Point& rWinPos); + Point const & GetWinViewPos() const; + Point const & GetViewOrigin() const; + + /** Return the window updater of this view shell. + @return + In rare circumstances the returned pointer may be <null/>, + i.e. when no memory is available anymore. + */ + ::sd::WindowUpdater* GetWindowUpdater() const; + + /** Return the border that is drawn around the actual document view. + The border contains typically rulers and scroll bars. + */ + SvBorder GetBorder(); + + /** Notify the view shell that its parent window has been resized. + The ViewShell places and resizes its UI elements accordingly. + The new size can be obtained from the parent window. + */ + virtual void Resize(); + + /** Set position and size of the GUI elements that are controlled by + the view shell like rulers and scroll bars as well as the actual + document view according to the position and size that were given + with the last Resize() call. + */ + virtual void ArrangeGUIElements(); + + // virtual void OuterResizePixel(const Point &rPos, const Size &rSize); + // virtual void InnerResizePixel(const Point &rPos, const Size &rSize); + + // Exported for unit test + SD_DLLPUBLIC ViewShellBase& GetViewShellBase() const; + + /** Return <TRUE/> when the called view shell is the main sub shell of + its ViewShellBase object, i.e. is display in the center pane. This + convenience function is equivalent to comparing the this pointer to + the result of ViewShellBase::GetViewShell(PT_CENTER). + */ + bool IsMainViewShell() const; + + /** Set or reset the flag that indicates whether the called shell is the + one displayed in the center pane. By default this flag is set to + <FALSE/>. For the main view shell it thus has to be set to <TRUE/>. + */ + void SetIsMainViewShell (bool bIsMainViewShell); + + /** Return a sub controller that implements the view shell specific + part of the DrawController. + */ + virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() = 0; + + /** Return the type of the shell. + */ + SD_DLLPUBLIC ShellType GetShellType() const; //Export for unit test + + /** This method is more or less an alias to Deactivate(). It is called + before an object of this class is taken from the stack of view + shells. + + <p>When this method is not called before a view shell is taken from + a stack then the Deactivate() call from the SFX as a response to + RemoveSubShell() comes too late when the view shell is not on the + stack anymore.</p> + */ + virtual void Shutdown(); + + /** This function is called from the underlying ViewShellBase + object to handle a verb execution request. + */ + virtual ErrCode DoVerb(sal_Int32 nVerb); + + virtual void UIActivating( SfxInPlaceClient* ); + virtual void UIDeactivated( SfxInPlaceClient* ); + + /** Show controls of the UI or hide them, depending on the given flag. + As a result the border is adapted. + */ + virtual void ShowUIControls (bool bVisible); + bool IsPageFlipMode() const; + + /** Set the given window as new parent window. This is not possible for + all views, so the return value tells the caller if the relocation + was successful. + */ + virtual bool RelocateToParentWindow (vcl::Window* pParentWindow); + + /** Depending on the given request create a new page or duplicate an + existing one. A new page is created behind the given slide. + @param rRequest + The request as passed to an Execute() method. Its arguments are + evaluated. Its slot id determines whether to create or + duplicate a slide. + @param pPage + This page is either duplicated or becomes the predecessor of the + new slide. If NULL a duplication request is ignored. A new + slide is inserted as first slide. + @param nInsertPosition + When -1 (the default) then insert after pPage. Otherwise insert + before the given index (of a standard page). + @return + The new slide is returned. If for some reason a new page can + not be created then NULL is returned. + */ + virtual SdPage* CreateOrDuplicatePage ( + SfxRequest& rRequest, + PageKind ePageKind, + SdPage* pPage, + const sal_Int32 nInsertPosition = -1); + + /// Allows adjusting the point or mark of the selection to a document coordinate. + void SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark); + /// Gets the current selection + css::uno::Reference<css::datatransfer::XTransferable> GetSelectionTransferable() const; + /// Allows starting or ending a graphic move or resize action. + void SetGraphicMm100Position(bool bStart, const Point& rPosition); + + class Implementation; + +protected: + /** must be called in the beginning of each subclass d'tor. + disposes and clears both current and old function. */ + void DisposeFunctions(); + + friend class ViewShellBase; + + /** Window inside the rulers and scroll bars that shows a view of the + document. + */ + + VclPtr<sd::Window> mpContentWindow; + + /// Horizontal scroll bar for the current slide is displayed when needed. + VclPtr<ScrollAdaptor> mpHorizontalScrollBar; + /// Vertical scroll bar for whole document is always visible. + VclPtr<ScrollAdaptor> mpVerticalScrollBar; + /// Horizontal ruler is not shown by default. + VclPtr<SvxRuler> mpHorizontalRuler; + /// Vertical ruler is not shown by default. + VclPtr<SvxRuler> mpVerticalRuler; + /// Layer tab bar. + VclPtr<LayerTabBar> mpLayerTabBar; + + /// This flag controls whether the rulers are visible. + bool mbHasRulers; + + /// The active window. + VclPtr< ::sd::Window> mpActiveWindow; + ::sd::View* mpView; + FrameView* mpFrameView; + + rtl::Reference<FuPoor> mxCurrentFunction; + rtl::Reference<FuPoor> mxOldFunction; + std::unique_ptr<ZoomList> mpZoomList; + double mfLastZoomScale; + double mfAccumulatedZoom = 0; + + Point maViewPos; + Size maViewSize; + Size maScrBarWH; + + bool mbStartShowWithDialog; // presentation is started by dialog + sal_uInt16 mnPrintedHandoutPageNum; // Page number of the handout page that is to be printed. + sal_uInt16 mnPrintedHandoutPageCount; // Page count of the handout pages that are to be printed. + + //af bool bPrintDirectSelected; // Print only selected objects in direct print + //afString sPageRange; // pagerange if selected objects in direct print + + /** Area covered by all windows, i.e. the area of the parent window + without the controls at the borders like rulers, scroll bars, tab + bar, buttons. + This rectangle may be set in window coordinates (i.e. pixel values + relative to the parent window). It is transformed by every call to + GetAllWindowRectangle() into screen coordinates (relative to the + upper left corner of the screen. + */ + ::tools::Rectangle maAllWindowRectangle; + + /// The type of the shell. Returned by GetShellType(). + ShellType meShellType; + + std::unique_ptr<Implementation, o3tl::default_delete<Implementation>> mpImpl; + + // Support methods for centralized UNDO/REDO + virtual SfxUndoManager* ImpGetUndoManager() const; + void ImpGetUndoStrings(SfxItemSet &rSet) const; + void ImpGetRedoStrings(SfxItemSet &rSet) const; + void ImpSidUndo(SfxRequest& rReq); + void ImpSidRedo(SfxRequest& rReq); + + DECL_DLLPRIVATE_LINK( HScrollHdl, weld::Scrollbar&, void ); + DECL_DLLPRIVATE_LINK( VScrollHdl, weld::Scrollbar&, void ); + + // virtual scroll handler, here, derivative classes can add themselves here + virtual void VirtHScrollHdl(ScrollAdaptor* pHScroll); + virtual void VirtVScrollHdl(ScrollAdaptor* pVScroll); + + // virtual functions ruler handling + virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin); + virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin); + virtual void UpdateHRuler(); + virtual void UpdateVRuler(); + + virtual void Activate(bool IsMDIActivate) override; + virtual void Deactivate(bool IsMDIActivate) override; + + virtual void SetZoomFactor( const Fraction &rZoomX, + const Fraction &rZoomY ); + + /** + This must be called after the ctor, but before anything else. + It's the part of construction that is dependent + on showing the top-level window. + + Showing a window with a11y enabled causes various callbacks + to be triggered. + + Due to the "virtual methods are not virtual during constructors" + problem, this is a disaster to call from the ctor + + i.e. construct calls Show, and if a11y is enabled this + reenters the not-fully constructed object and calls + CreateAccessibleDocumentView, so if construct is called + from the ctor then if a derived class is constructed the base-case + CreateAccessibleDocumentView is used, not the derived + CreateAccessibleDocumentView. i.e. run smoketest under a11y with + debugging assertions enabled + */ + void doShow(); + +private: + VclPtr<vcl::Window> mpParentWindow; + /** This window updater is used to keep all relevant windows up to date + with reference to the digit language used to display digits in text + shapes. + */ + ::std::unique_ptr< ::sd::WindowUpdater> mpWindowUpdater; + + /** Code common to all constructors. It generally is a bad idea + to call this function from outside a constructor. + */ + void construct(); + + /** Create the rulers. + */ + void SetupRulers(); +}; + +SdrView* ViewShell::GetDrawView() const +{ + return static_cast<SdrView*>(mpView); +} + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx new file mode 100644 index 0000000000..acdd244c70 --- /dev/null +++ b/sd/source/ui/inc/ViewShellBase.hxx @@ -0,0 +1,252 @@ +/* -*- 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 . + */ + +#pragma once + +#include <glob.hxx> +#include <sfx2/viewsh.hxx> +#include <memory> + +class SdDrawDocument; +class SfxRequest; + +namespace sd::tools { +class EventMultiplexer; +} + +namespace sd { + +class DrawController; +class DrawDocShell; +class FormShellManager; +class ToolBarManager; +class ViewShell; +class ViewShellManager; +class ViewTabBar; + +/** SfxViewShell descendant that the stacked Draw/Impress shells are + based on. + + <p>The "base" part of the name does not mean that this is a base + class of some class hierarchy. It rather is the base of the + stacked shells.</p> + + <p>This class starts as a new and relatively small class. Over + time as much code as possible should be moved from the stacked + shells to this class.</p> +*/ +class ViewShellBase + : public SfxViewShell +{ +public: + SFX_DECL_INTERFACE(SD_IF_SDVIEWSHELLBASE) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + /** This constructor is used by the view factory of the SFX macros. + Note that LateInit() has to be called after the constructor + terminates and before doing anything else. + */ + ViewShellBase ( + SfxViewFrame& rFrame, + SfxViewShell* pOldShell); + + virtual ~ViewShellBase() override; + + /** This method is part of the object construction. It HAS to be called + after the constructor has created a new object. + */ + void LateInit (const OUString& rsDefaultView); + + std::shared_ptr<ViewShellManager> const & GetViewShellManager() const; + + /** Return the main view shell stacked on the called ViewShellBase + object. This is usually the view shell displayed in the center + pane. + */ + std::shared_ptr<ViewShell> GetMainViewShell() const; + + /** When given a view frame this static method returns the + corresponding sd::ViewShellBase object. + @return + When the SfxViewShell of the given frame is not a + ViewShellBase object then NULL is returned. + */ + static ViewShellBase* GetViewShellBase (SfxViewFrame const * pFrame); + + DrawDocShell* GetDocShell() const { return mpDocShell;} + SdDrawDocument* GetDocument() const { return mpDocument;} + + /** Callback function for general slot calls. At the moment these are + slots for switching the pane docking windows on and off. + */ + virtual void Execute (SfxRequest& rRequest); + + /** Callback function for retrieving item values related to certain + slots. This is the companion of Execute() and handles the slots + concerned with showing the pane docking windows. + */ + void GetState (SfxItemSet& rSet); + + /* override these from SfxViewShell */ + virtual OUString GetSelectionText(bool = false, bool bOnlyASample = false) override; + virtual bool HasSelection(bool = true ) const override; + + SvBorder GetBorder (bool bOuterResize); + virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize, bool inplaceEditModeChange) override; + virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize) override; + + /** This call is forwarded to the main sub-shell. + */ + virtual ErrCode DoVerb(sal_Int32 nVerb) override; + + /** Return a new renderer that can be used for example for printing the + document. + */ + virtual css::uno::Reference<css::view::XRenderable> GetRenderable() override; + + /// Forwarded to the print manager. + virtual SfxPrinter* GetPrinter (bool bCreate = false) override; + + /// Forwarded to the print manager. + virtual sal_uInt16 SetPrinter ( + SfxPrinter* pNewPrinter, + SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL) override; + + /// Forward methods to main sub shell. + virtual void WriteUserDataSequence ( + css::uno::Sequence< css::beans::PropertyValue >&) override; + + /** Pass the given properties to the main view shell. After that we + ensure that the right view shell type is displayed in the center + pane. + */ + virtual void ReadUserDataSequence ( + const css::uno::Sequence< css::beans::PropertyValue >&) override; + + virtual void UIActivating( SfxInPlaceClient* ) override; + virtual void UIDeactivated( SfxInPlaceClient* ) override; + virtual void Activate (bool IsMDIActivate) override; + using SfxViewShell::Deactivate; + virtual void SetZoomFactor ( + const Fraction &rZoomX, + const Fraction &rZoomY) override; + virtual bool PrepareClose (bool bUI = true) override; + virtual void WriteUserData (OUString&, bool bBrowse = false) override; + virtual void ReadUserData (const OUString&, bool bBrowse = false) override; + virtual SdrView* GetDrawView() const override; + + /** When <TRUE/> is given, then the mouse shape is set to hour glass (or + whatever the busy shape looks like on the system.) + */ + void SetBusyState (bool bBusy); + + /** Call this method when the controls of this view shell or the + embedded sub shell need to be rearranged. This is necessary + e.g. when the border has been modified (UpdateBorder() calls this + method). + + This method is like ResizePixel() with no arguments. + */ + void Rearrange(); + + /** Update the border that is set with SfxViewShell::SetBorderPixel(). + This is done by adding the border used by the ViewShellBase itself + with the border used by the main view shell. + + @param bForce if true the borders are also updated if old border + and new border are same. + */ + void UpdateBorder ( bool bForce = false ); + + /** With this method the UI controls can be turned on or off. It is + used by the FuSlideShow to hide the UI controls while showing a + non-full-screen or in-window presentation in the center pane. + */ + void ShowUIControls (bool bVisible); + + /** Return an event multiplexer. It is a single class that forwards + events from various sources. This method must not be called before + LateInit() has terminated. + */ + std::shared_ptr<tools::EventMultiplexer> const & GetEventMultiplexer() const; + + /** returns the complete area of the current view relative to the frame + window + */ + const ::tools::Rectangle& getClientRectangle() const; + + std::shared_ptr<ToolBarManager> const & GetToolBarManager() const; + std::shared_ptr<FormShellManager> const & GetFormShellManager() const; + + DrawController* GetDrawController() const; + + void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar); + + /** Return the window that is used by the main view shell to display its + view and other UI elements, like scroll bars and rulers. Ownership + of that window remains with the called ViewShellBase object. + */ + vcl::Window* GetViewWindow(); + + /** returns the ui descriptive name for the given uno slot. The result is taken from the configuration + and not cached, so do not use it excessive (f.e. in status updates) */ + OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) const; + /// See SfxViewShell::getPart(). + int getPart() const override; + /// See SfxViewShell::getEditMode(). + int getEditMode() const override; + /// See SfxViewShell::setEditMode(). + void setEditMode(int nMode); + /// See SfxViewShell::NotifyCursor(). + void NotifyCursor(SfxViewShell* pViewShell) const override; + /// See SfxViewShell::GetColorConfigColor(). + ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const override; + + void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea = rArea; } + virtual ::tools::Rectangle getLOKVisibleArea() const override { return maLOKVisibleArea; } + +protected: + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + + virtual void InitializeFramework(); + +private: + class Implementation; + std::unique_ptr<Implementation> mpImpl; + DrawDocShell* mpDocShell; + SdDrawDocument* mpDocument; + ::tools::Rectangle maLOKVisibleArea; + + /** Determine from the properties of the document shell the initial type + of the view shell in the center pane. We use this method to avoid + starting with the wrong type. When ReadUserDataSequence() is called + we check that the right type is active and change again if that is + not the case because something went wrong. + */ + OUString GetInitialViewShellType() const; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewShellHint.hxx b/sd/source/ui/inc/ViewShellHint.hxx new file mode 100644 index 0000000000..05a0c83286 --- /dev/null +++ b/sd/source/ui/inc/ViewShellHint.hxx @@ -0,0 +1,57 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svl/hint.hxx> + +namespace sd +{ +/** Local derivation of the SfxHint class that defines some hint ids that + are used by the ViewShell class and its descendants. +*/ +class ViewShellHint final : public SfxHint +{ +public: + enum HintId + { + // Indicate that a page resize is about to begin. + HINT_PAGE_RESIZE_START, + // Indicate that a page resize has been completed. + HINT_PAGE_RESIZE_END, + // Indicate that an edit mode change is about to begin. + HINT_CHANGE_EDIT_MODE_START, + // Indicate that an edit mode change has been completed. + HINT_CHANGE_EDIT_MODE_END, + + HINT_COMPLEX_MODEL_CHANGE_START, + HINT_COMPLEX_MODEL_CHANGE_END + }; + + ViewShellHint(HintId nHintId); + + HintId GetHintId() const { return meHintId; } + +private: + HintId meHintId; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewShellImplementation.hxx b/sd/source/ui/inc/ViewShellImplementation.hxx new file mode 100644 index 0000000000..b4a02c3d54 --- /dev/null +++ b/sd/source/ui/inc/ViewShellImplementation.hxx @@ -0,0 +1,150 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ViewShell.hxx" +#include "ViewShellManager.hxx" +#include "ToolBarManager.hxx" +#include <o3tl/deleter.hxx> +#include <memory> + +class SvxIMapDlg; + +namespace sd +{ +/** This class contains (will contain) the implementation of methods that + have not be accessible from the outside. +*/ +class ViewShell::Implementation +{ +public: + bool mbIsMainViewShell; + /// Set to true when the ViewShell::Init() method has been called. + bool mbIsInitialized; + /** Set to true while ViewShell::ArrangeGUIElements() is being + executed. It is used as guard against recursive execution. + */ + bool mbArrangeActive; + + /** Remember a link to the sub shell factory, so that it can be + unregistered at the ViewShellManager when a ViewShell is deleted. + */ + ViewShellManager::SharedShellFactory mpSubShellFactory; + + /** This update lock for the ToolBarManager exists in order to avoid + problems with tool bars being displayed while the mouse button is + pressed. With docked tool bars this can lead to a size change of + the view. This would change the relative mouse coordinates and thus + interpret every mouse click as move command. + */ + class ToolBarManagerLock + { + public: + /** Create a new instance. This allows the mpSelf member to be set + automatically. + */ + static std::shared_ptr<ToolBarManagerLock> + Create(const std::shared_ptr<ToolBarManager>& rpManager); + /** Release the lock. When the UI is captured + (Application::IsUICaptured() returns <TRUE/>) then the lock is + released later asynchronously. + @param bForce + When this flag is <TRUE/> then the lock is released even + when IsUICaptured() returns <TRUE/>. + */ + void Release(bool bForce = false); + DECL_DLLPRIVATE_LINK(TimeoutCallback, Timer*, void); + + private: + ::std::unique_ptr<ToolBarManager::UpdateLock, + o3tl::default_delete<ToolBarManager::UpdateLock>> + mpLock; + /** The timer is used both as a safe guard to unlock the update lock + when Release() is not called explicitly. It is also used to + defer the release of the lock to a time when the UI is not + captured. + */ + Timer maTimer; + /** The shared_ptr to this allows the ToolBarManagerLock to control + its own lifetime. This, of course, does work only when no one + holds another shared_ptr longer than only temporary. + */ + std::shared_ptr<ToolBarManagerLock> mpSelf; + ToolBarManagerLock(const std::shared_ptr<sd::ToolBarManager>& rpManager); + ~ToolBarManagerLock(); + + class Deleter; + friend class Deleter; + }; + // The member is not a unique_ptr because it takes over its own life time + // control. + std::weak_ptr<ToolBarManagerLock> mpUpdateLockForMouse; + + Implementation(ViewShell& rViewShell); + ~Implementation() COVERITY_NOEXCEPT_FALSE; + + /** Process the SID_MODIFY slot. + */ + void ProcessModifyPageSlot(SfxRequest& rRequest, SdPage* pCurrentPage, PageKind ePageKind); + + /** Assign the given layout to the given page. This method is at the + moment merely a front end for ProcessModifyPageSlot. + @param pPage + If a NULL pointer is given then this call is ignored. + */ + void AssignLayout(SfxRequest const& rRequest, PageKind ePageKind); + + /** Determine the view id of the view shell. This corresponds to the + view id stored in the SfxViewFrame class. + + We can not use the view of that class because with the introduction + of the multi pane GUI we do not switch the SfxViewShell anymore when + switching the view in the center pane. The view id of the + SfxViewFrame is thus not modified and we can not set it from the + outside. + + The view id is still needed for the SFX to determine on start up + (e.g. after loading a document) which ViewShellBase sub class to + use. These sub classes--like OutlineViewShellBase--exist only to be + used by the SFX as factories. They only set the initial pane + configuration, nothing more. + + So what we do here in essence is to return one of the + ViewShellFactoryIds that can be used to select the factory that + creates the ViewShellBase subclass with the initial pane + configuration that has in the center pane a view shell of the same + type as mrViewShell. + */ + SfxInterfaceId GetViewId() const; + + /** Return a pointer to the image map dialog that is displayed in some + child window. + @return + Returns <NULL/> when the image map dialog is not available. + */ + static SvxIMapDlg* GetImageMapDialog(); + +private: + ViewShell& mrViewShell; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewShellManager.hxx b/sd/source/ui/inc/ViewShellManager.hxx new file mode 100644 index 0000000000..c4011c52d5 --- /dev/null +++ b/sd/source/ui/inc/ViewShellManager.hxx @@ -0,0 +1,196 @@ +/* -*- 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 . + */ + +#pragma once + +#include "ShellFactory.hxx" +#include <o3tl/deleter.hxx> +#include <memory> +#include <utility> + +class FmFormShell; +class SfxShell; + +namespace sd +{ +class ViewShell; +class ViewShellBase; + +/** The ViewShellManager has the responsibility to manage the view shells + and sub shells on the SFX shell stack. They form a two level hierarchy + (the underlying ViewShellBase, the only true SfxViewShell descendant, + forms a third level.) On the first level there are the view shells + (what formerly was called view shell, anyway; nowadays they are derived + from SfxShell) and shells for panes. On the second level there are sub + shells (also derived from SfxShell) that usually are tool bars. + + <p>On the SFX shell stack the regular sub shells are placed above their + view shells. The FormShell is a special case. With the SetFormShell() + method it can be placed directly above or below one of the view + shells.</p> + + <p>Shells managed by this class are created by factories or are given + directly to Activate... methods. For the sub shells there is one + factory for every view shell. Factories are added or removed via the + (Add|Remove)SubShellFactory() methods. The FormShell is managed with the + factory of its view shell.</p> +*/ +class ViewShellManager +{ +public: + typedef std::shared_ptr<ShellFactory<SfxShell>> SharedShellFactory; + + ViewShellManager(ViewShellBase& rBase); + + /** Before the destructor is called the method Shutdown() has to have + been called. + */ + ~ViewShellManager(); + + /** Tell a ViewShellManager object to prepare to be deleted, i.e. to + destroy all of its resources and to ignore all following calls. + Use this when the owner of the view shell manager is about being + destroyed but the view shell manager itself can not yet be deleted. + */ + void Shutdown(); + + /** Set the factory for sub shells of the specified view shell. + */ + void AddSubShellFactory(ViewShell const* pViewShell, const SharedShellFactory& rpFactory); + void RemoveSubShellFactory(ViewShell const* pViewShell, const SharedShellFactory& rpFactory); + + /** Activate the given view shell. + */ + void ActivateViewShell(ViewShell* pViewShell); + + /** Activate the given shell which is not a view shell. For view shells + use the ActivateViewShell() method. + */ + void ActivateShell(SfxShell* pShell); + + /** Deactivate the specified shell, i.e. take it and all of its + object bars from the shell stack. + @param pShell + The shell to deactivate. + */ + void DeactivateViewShell(const ViewShell* pShell); + + /** Deactivate the specified shell. The shell is not destroyed. + */ + void DeactivateShell(const SfxShell* pShell); + + /** Associate the form shell with a view shell and their relative + position. This method does not change the shell stack, it just + stores the given values for the next shell stack update. + @param pParentShell + The view shell of the form shell. + @param pFormShell + The form shell. + @param bAbove + When <TRUE/> then the form shell will be placed directly above + pViewShell on the SFX shell stack. Otherwise the form shell is + placed directly below the view shell. + */ + void SetFormShell(const ViewShell* pParentShell, FmFormShell* pFormShell, bool bAbove); + + /** Activate the specified shell as sub shell for the given view shell. + The sub shell factory associated with the view shell is used to + create the sub shell. + @param rParentShell + The new sub shell will be placed above this view shell. + @param nId + This id is used only with the factory registered for the parent + view shell. + */ + void ActivateSubShell(const ViewShell& rParentShell, ShellId nId); + + /** Deactivate the specified sub shell. + */ + void DeactivateSubShell(const ViewShell& rParentShell, ShellId nId); + + /** Send all sub shells of the specified view shell an Invalidate() + call. This does not modify the shell stack. + */ + void InvalidateAllSubShells(ViewShell const* pViewShell); + + /** Move the specified view shell to the top most position on the stack + of view shells in relation to the other view shells. After this the + only shells that are higher on the stack are its object bars. + + Call this method after a focus change to bring a view mode view + shell and is associated tool bar shells to the top of the + stack. + + The mbKeepMainViewShellOnTop flag is not obeyed. + + @param nId + The id of the shell to move to the top. + */ + void MoveToTop(const ViewShell& rShell); + + /** Return the first, i.e. top most, view shell that has been activated + under the given id. + @param nId + The id of the shell for which to return a pointer. + @return + When the specified shell is currently not active then NULL is + returned. + */ + SfxShell* GetShell(ShellId nId) const; + + /** Return the top-most shell on the SFX shell stack regardless of + whether that is a view shell or a sub shell. + */ + SfxShell* GetTopShell() const; + + /** Return the top-most active view shell on the internal shell stack. + */ + SfxShell* GetTopViewShell() const; + + /** Use this class to safely lock updates of the view shell stack. + */ + class UpdateLock + { + public: + UpdateLock(std::shared_ptr<ViewShellManager> pManager) + : mpManager(std::move(pManager)) + { + mpManager->LockUpdate(); + } + ~UpdateLock() COVERITY_NOEXCEPT_FALSE { mpManager->UnlockUpdate(); } + + private: + std::shared_ptr<ViewShellManager> mpManager; + }; + friend class UpdateLock; + +private: + class Implementation; + std::unique_ptr<ViewShellManager::Implementation, + o3tl::default_delete<ViewShellManager::Implementation>> + mpImpl; + bool mbValid; + + void LockUpdate(); + void UnlockUpdate(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx new file mode 100644 index 0000000000..c9e11994af --- /dev/null +++ b/sd/source/ui/inc/ViewTabBar.hxx @@ -0,0 +1,177 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/TabBarButton.hpp> +#include <com/sun/star/drawing/framework/XTabBar.hpp> +#include <com/sun/star/drawing/framework/XToolBar.hpp> +#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp> +#include <comphelper/compbase.hxx> +#include <vcl/InterimItemWindow.hxx> + +#include <vector> + +namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace com::sun::star::drawing::framework { class XResourceId; } +namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; } +namespace com::sun::star::frame { class XController; } +namespace vcl { class Window; } + +namespace sd { + class DrawController; + class ViewShellBase; + class ViewTabBar; +} + +namespace sd { + +class TabBarControl final : public InterimItemWindow +{ +public: + TabBarControl(vcl::Window* pParentWindow, ::rtl::Reference<ViewTabBar> pViewTabBar); + virtual void dispose() override; + virtual ~TabBarControl() override; + weld::Notebook& GetNotebook() { return *mxTabControl; } + int GetAllocatedWidth() const { return mnAllocatedWidth; } +private: + std::unique_ptr<weld::Notebook> mxTabControl; + ::rtl::Reference<ViewTabBar> mpViewTabBar; + int mnAllocatedWidth; + + DECL_LINK(ActivatePageHdl, const OUString&, void); + DECL_LINK(NotebookSizeAllocHdl, const Size&, void); +}; + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XToolBar, + css::drawing::framework::XTabBar, + css::drawing::framework::XConfigurationChangeListener + > ViewTabBarInterfaceBase; + +/** Tab control for switching between views in the center pane. +*/ +class ViewTabBar final + : public ViewTabBarInterfaceBase +{ +public: + ViewTabBar ( + const css::uno::Reference< css::drawing::framework::XResourceId>& rxViewTabBarId, + const rtl::Reference< ::sd::DrawController>& rxController); + virtual ~ViewTabBar() override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + const VclPtr<TabBarControl>& GetTabControl() const { return mpTabControl; } + + bool ActivatePage(size_t nIndex); + + //----- drawing::framework::XConfigurationChangeListener ------------------ + + virtual void SAL_CALL + notifyConfigurationChange ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) override; + + //----- XEventListener ---------------------------------------------------- + + virtual void SAL_CALL disposing( + const css::lang::EventObject& rEvent) override; + + //----- XTabBar ----------------------------------------------------------- + + virtual void + SAL_CALL addTabBarButtonAfter ( + const css::drawing::framework::TabBarButton& rButton, + const css::drawing::framework::TabBarButton& rAnchor) override; + + virtual void + SAL_CALL appendTabBarButton ( + const css::drawing::framework::TabBarButton& rButton) override; + + virtual void + SAL_CALL removeTabBarButton ( + const css::drawing::framework::TabBarButton& rButton) override; + + virtual sal_Bool + SAL_CALL hasTabBarButton ( + const css::drawing::framework::TabBarButton& rButton) override; + + virtual css::uno::Sequence<css::drawing::framework::TabBarButton> + SAL_CALL getTabBarButtons() override; + + //----- XResource --------------------------------------------------------- + + virtual css::uno::Reference< + css::drawing::framework::XResourceId> SAL_CALL getResourceId() override; + + virtual sal_Bool SAL_CALL isAnchorOnly() override; + + /** The returned value is calculated as the difference between the + total height of the control and the height of its first tab page. + This can be considered a hack. + This procedure works only when the control is visible. Calling this + method when the control is not visible results in returning a + default value. + To be on the safe side wait for this control to become visible and + the call this method again. + */ + int GetHeight() const; + + void UpdateActiveButton(); + + void AddTabBarButton ( + const css::drawing::framework::TabBarButton& rButton, + const css::drawing::framework::TabBarButton& rAnchor); + void AddTabBarButton ( + const css::drawing::framework::TabBarButton& rButton); + void RemoveTabBarButton ( + const css::drawing::framework::TabBarButton& rButton); + bool HasTabBarButton ( + const css::drawing::framework::TabBarButton& rButton); + css::uno::Sequence<css::drawing::framework::TabBarButton> + GetTabBarButtons(); + +private: + VclPtr<TabBarControl> mpTabControl; + rtl::Reference<::sd::DrawController> mxController; + css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController; + typedef ::std::vector<css::drawing::framework::TabBarButton> TabBarButtonList; + TabBarButtonList maTabBarButtons; + css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId; + ViewShellBase* mpViewShellBase; + int mnNoteBookWidthPadding; + + void AddTabBarButton ( + const css::drawing::framework::TabBarButton& rButton, + sal_Int32 nPosition); + void UpdateTabBarButtons(); + + /** This method is called from the constructor to get the window for an + anchor ResourceId and pass it to our base class. It has to be + static because it must not access any of the, not yet initialized + members. + */ + static vcl::Window* GetAnchorWindow( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewTabBarId, + const rtl::Reference<::sd::DrawController>& rxController); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx new file mode 100644 index 0000000000..9763f24e88 --- /dev/null +++ b/sd/source/ui/inc/Window.hxx @@ -0,0 +1,207 @@ +/* -*- 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 . + */ + +#pragma once + +#include <tools/gen.hxx> +#include <tools/long.hxx> +#include <vcl/DocWindow.hxx> +#include <vcl/transfer.hxx> + +class OutlinerView; + +namespace sd +{ +class ViewShell; + +/** An SdWindow contains the actual working area of ViewShell. + + <p>The zoom factor used by this class controls how much the page and the + shapes on it are scaled down (<100%) or up (>100%) when displayed on the + output device represented by the <type>OutputDevice</type>base class. A + zoom factor of 100% would result (with a correctly set DPI value for an + output device) in a one to one mapping of the internal coordinates that + are stored in 100th of mm. The zoom factor is stored in the map mode + member of the <type>OutputDevice</type> base class. It is calculated to + be an integer percent value. +*/ +class Window : public vcl::DocWindow, public ::DropTargetHelper +{ +public: + Window(vcl::Window* pParent); + virtual ~Window() override; + virtual void dispose() override; + + void SetViewShell(ViewShell* pViewSh); + ViewShell* GetViewShell(); + + /** Set the zoom factor to the specified value and center the display + area around the zoom center. + @param nZoom + The zoom factor is given as integral percent value. + */ + void SetZoomIntegral(::tools::Long nZoom); + + /** This internally used method performs the actual adaptation of the + window's map mode to the specified zoom factor. + @param nZoom + The zoom factor is given as integral percent value. + @return + When the given zoom factor lies outside the valid range enclosed + by the minimal zoom factor previously calculated by + <member>CalcMinZoom</member> and a constant upper value it is + forced into that interval. Therefore the returned value is a + valid zoom factor. + */ + ::tools::Long SetZoomFactor(::tools::Long nZoom); + + /** This method is called when the whole page shall be displayed in the + window. Position and zoom factor are set so that the given + rectangle is displayed as large as possible in the window while at + the same time maintaining the rectangle's aspect ratio and adding a + small space at all its four sides (about 3% of width and height). + The map mode is adapted accordingly. + @param rZoomRect + The rectangle is expected to be given relative to the upper left + corner of the window in logical coordinates (100th of mm). + @return + The new zoom factor is returned as integral percent value. + */ + ::tools::Long SetZoomRect(const ::tools::Rectangle& rZoomRect); + + ::tools::Long GetZoomForRect(const ::tools::Rectangle& rZoomRect); + + void SetMinZoomAutoCalc(bool bAuto); + + /** Calculate the minimal zoom factor as the value at which the + application area would completely fill the window. All values set + manually or programmatically are set to this value if they are + smaller. If the currently used zoom factor is smaller than the minimal zoom + factor than set the minimal zoom factor as the new current zoom + factor. + + <p>This calculation is performed only when the + <member>bMinZoomAutoCalc</member> is set (to <TRUE/>).</p> + */ + void CalcMinZoom(); + void SetMinZoom(::tools::Long nMin); + ::tools::Long GetMinZoom() const { return mnMinZoom; } + void SetMaxZoom(::tools::Long nMax); + ::tools::Long GetMaxZoom() const { return mnMaxZoom; } + + ::tools::Long GetZoom() const; + + const Point& GetWinViewPos() const { return maWinPos; } + const Point& GetViewOrigin() const { return maViewOrigin; } + const Size& GetViewSize() const { return maViewSize; } + void SetWinViewPos(const Point& rPnt); + void SetViewOrigin(const Point& rPnt); + void SetViewSize(const Size& rSize); + void SetCenterAllowed(bool bIsAllowed); + + /** Calculate origin of the map mode according to the size of the view + and window (its size in model coordinates; that takes the zoom + factor into account), and the bCenterAllowed flag. When it is not + set then nothing is changed. When in any direction the window is + larger than the view or the value of aWinPos in this direction is -1 + then the window is centered in this direction. + */ + void UpdateMapOrigin(bool bInvalidate = true); + + void UpdateMapMode(); + + double GetVisibleX() const; // interface for ScrollBars + double GetVisibleY() const; + void SetVisibleXY(double fX, double fY); + double GetVisibleWidth() const; + double GetVisibleHeight() const; + Point GetVisibleCenter(); + double GetScrlLineWidth() const; + double GetScrlLineHeight() const; + double GetScrlPageWidth() const; + double GetScrlPageHeight() const; + void GrabFocus(); + virtual void DataChanged(const DataChangedEvent& rDCEvt) override; + + // DropTargetHelper + virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override; + virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override; + + /** The DropScroll() method is used by AcceptDrop() to scroll the + content of the window while dragging and dropping. With this method + you can control whether DropScroll() shall be used. + */ + void SetUseDropScroll(bool bUseDropScroll); + void DropScroll(const Point& rMousePos); + virtual void KeyInput(const KeyEvent& rKEvt) override; + +private: + OutlinerView* GetOutlinerView() const; + +protected: + Point maWinPos; + Point maViewOrigin; + Size maViewSize; + Size maPrevSize; // contains previous window size in logical coords + sal_uInt16 mnMinZoom; + sal_uInt16 mnMaxZoom; + + /** This flag tells whether to re-calculate the minimal zoom factor + depending on the current zoom factor. Its default value is now false. + */ + bool mbMinZoomAutoCalc; + bool mbCenterAllowed; + ::tools::Long mnTicks; + + ViewShell* mpViewShell; + bool mbUseDropScroll; + + virtual void Resize() override; + virtual void PrePaint(vcl::RenderContext& rRenderContext) override; + virtual void Paint(vcl::RenderContext& rRenderContext, + const ::tools::Rectangle& rRect) override; + virtual void MouseMove(const MouseEvent& rMEvt) override; + virtual void MouseButtonUp(const MouseEvent& rMEvt) override; + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + virtual void Command(const CommandEvent& rCEvt) override; + virtual void RequestHelp(const HelpEvent& rEvt) override; + virtual void LoseFocus() override; + virtual bool EventNotify(NotifyEvent& rNEvt) override; + + /** Create an accessibility object that makes this window accessible. + + @return + The returned reference is empty if an accessible object could + not be created. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + OUString GetSurroundingText() const override; + Selection GetSurroundingTextSelection() const override; + bool DeleteSurroundingText(const Selection& rSelection) override; + + /// @see Window::LogicInvalidate(). + void LogicInvalidate(const ::tools::Rectangle* pRectangle) override; + + FactoryFunction GetUITestFactory() const override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/WindowUpdater.hxx b/sd/source/ui/inc/WindowUpdater.hxx new file mode 100644 index 0000000000..f57d889b4f --- /dev/null +++ b/sd/source/ui/inc/WindowUpdater.hxx @@ -0,0 +1,124 @@ +/* -*- 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 . + */ + +#pragma once + +#include <svl/ctloptions.hxx> +#include <vcl/vclptr.hxx> + +#include <vector> + +namespace vcl +{ +class Window; +} +class OutputDevice; +class SdDrawDocument; + +namespace sd +{ +/** The purpose of the <type>WindowUpdater</type> is to update output + devices to take care of modified global values. These values are + monitored for changes. At the moment this is + the digit language that defines the glyphs to use to render digits. + Other values may be added in the future. + + <p>The methods of this class have not been included into the + <type>ViewShell</type> class in order to not clutter its interface any + further. This class accesses some of <type>ViewShell</type> data + members directly and thus is declared as its friend.</p> + + <p>Windows that are to be kept up-to-date have to be registered via the + <member>RegisterWindow()</member> method. When a document is given then + this document is reformatted when the monitored option changes.</p> +*/ +class WindowUpdater final : public utl::ConfigurationListener +{ +public: + explicit WindowUpdater(); + virtual ~WindowUpdater() noexcept override; + + /** Add the given device to the list of devices which will be updated + when one of the monitored values changes. + @param pWindow + This device is added to the device list if it is not <null/> and + when it is not already a member of that list. + */ + void RegisterWindow(vcl::Window* pWindow); + + /** Remove the given device from the list of devices which will be updated + when one of the monitored values changes. + @param pWindow + This device is removed from the device list when it is a member + of that list. + */ + void UnregisterWindow(vcl::Window* pWindow); + + /** Set the document so that it is reformatted when one of the monitored + values changes. + @param pDocument + When <null/> is given document reformatting will not take + place in the future. + */ + void SetDocument(SdDrawDocument* pDocument); + + /** Update the given output device and update all text objects of the + view shell if not told otherwise. + @param pWindow + The device to update. When the given pointer is NULL then + nothing is done. + */ + static void Update(OutputDevice* pDevice); + + /** Callback that waits for notifications of a + <type>SvtCTLOptions</type> object. + */ + virtual void ConfigurationChanged(utl::ConfigurationBroadcaster*, + ConfigurationHints nHint) override; + +private: + /// Options to monitor for changes. + SvtCTLOptions maCTLOptions; + + /// The document rendered in the output devices. + SdDrawDocument* mpDocument; + + WindowUpdater(const WindowUpdater& rUpdater) = delete; + + WindowUpdater operator=(const WindowUpdater& rUpdater) = delete; + + /** Type and data member for a list of devices that have to be kept + up-to-date. + */ + typedef ::std::vector<VclPtr<vcl::Window>> tWindowList; + tWindowList maWindowList; + + /** The central method of this class. Update the given output device. + It is the task of the caller to initiate a reformatting of the + document that is rendered on this device to reflect the changes. + @param pWindow + The output device to update. When it is <null/> then the call + is ignored. + */ + static void UpdateWindow(OutputDevice* pDevice); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx new file mode 100644 index 0000000000..b44a5fb3dc --- /dev/null +++ b/sd/source/ui/inc/animobjs.hxx @@ -0,0 +1,163 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/dockwin.hxx> +#include <tools/fract.hxx> +#include <sfx2/ctrlitem.hxx> +#include <sfx2/progress.hxx> +#include <misc/scopelock.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> +#include <vcl/weldutils.hxx> + +class SdDrawDocument; + +namespace sd { + +class AnimationControllerItem; +class View; + +enum BitmapAdjustment +{ + BA_LEFT_UP, + BA_LEFT, + BA_LEFT_DOWN, + BA_UP, + BA_CENTER, + BA_DOWN, + BA_RIGHT_UP, + BA_RIGHT, + BA_RIGHT_DOWN +}; + +class SdDisplay : public weld::CustomWidgetController +{ +private: + BitmapEx aBitmapEx; + Fraction aScale; + +public: + SdDisplay(); + virtual ~SdDisplay() override; + + virtual void Paint( vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect ) override; + + void SetBitmapEx( BitmapEx const * pBmpEx ); + void SetScale( const Fraction& rFrac ); + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; +}; + +class AnimationWindow : public SfxDockingWindow +{ + friend class AnimationChildWindow; + friend class AnimationControllerItem; + +public: + AnimationWindow(SfxBindings* pBindings, SfxChildWindow *pCW, vcl::Window* pParent); + virtual ~AnimationWindow() override; + virtual void dispose() override; + + void AddObj( ::sd::View& rView ); + void CreateAnimObj( ::sd::View& rView ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + +protected: + virtual bool Close() override; + virtual void Resize() override; + +private: + std::unique_ptr<SdDisplay> m_xCtlDisplay; + std::unique_ptr<weld::CustomWeld> m_xCtlDisplayWin; + std::unique_ptr<weld::Button> m_xBtnFirst; + std::unique_ptr<weld::Button> m_xBtnReverse; + std::unique_ptr<weld::Button> m_xBtnStop; + std::unique_ptr<weld::Button> m_xBtnPlay; + std::unique_ptr<weld::Button> m_xBtnLast; + std::unique_ptr<weld::SpinButton> m_xNumFldBitmap; + std::unique_ptr<weld::FormattedSpinButton> m_xTimeField; + std::unique_ptr<weld::TimeFormatter> m_xFormatter; + std::unique_ptr<weld::ComboBox> m_xLbLoopCount; + std::unique_ptr<weld::Button> m_xBtnGetOneObject; + std::unique_ptr<weld::Button> m_xBtnGetAllObjects; + std::unique_ptr<weld::Button> m_xBtnRemoveBitmap; + std::unique_ptr<weld::Button> m_xBtnRemoveAll; + std::unique_ptr<weld::Label> m_xFiCount; + + std::unique_ptr<weld::RadioButton> m_xRbtGroup; + std::unique_ptr<weld::RadioButton> m_xRbtBitmap; + std::unique_ptr<weld::Label> m_xFtAdjustment; + std::unique_ptr<weld::ComboBox> m_xLbAdjustment; + std::unique_ptr<weld::Button> m_xBtnCreateGroup; + std::unique_ptr<weld::Button> m_xBtnHelp; + + ::std::vector< ::std::pair<BitmapEx, ::tools::Time> > m_FrameList; + static const size_t EMPTY_FRAMELIST; + size_t m_nCurrentFrame; + std::unique_ptr<SdDrawDocument> pMyDoc; + + bool bMovie; + bool bAllObjects; + + std::unique_ptr<AnimationControllerItem> pControllerItem; + + ScopeLock maPlayLock; + + DECL_LINK( ClickFirstHdl, weld::Button&, void ); + DECL_LINK( ClickStopHdl, weld::Button&, void ); + DECL_LINK( ClickPlayHdl, weld::Button&, void ); + DECL_LINK( ClickLastHdl, weld::Button&, void ); + DECL_LINK( ClickGetObjectHdl, weld::Button&, void ); + DECL_LINK( ClickRemoveBitmapHdl, weld::Button&, void ); + DECL_LINK( ClickRbtHdl, weld::Toggleable&, void ); + DECL_LINK( ClickHelpHdl, weld::Button&, void ); + DECL_LINK( ClickCreateGroupHdl, weld::Button&, void ); + DECL_LINK( ModifyBitmapHdl, weld::SpinButton&, void ); + DECL_LINK( ModifyTimeHdl, weld::FormattedSpinButton&, void ); + + void UpdateControl(bool bDisableCtrls = false); + void ResetAttrs(); + void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime, + SfxProgress* pStbMgr ) const; + Fraction GetScale(); +}; + +/** + * ControllerItem for Animator + */ +class AnimationControllerItem : public SfxControllerItem +{ + +public: + AnimationControllerItem( sal_uInt16, AnimationWindow*, SfxBindings* ); + +protected: + virtual void StateChangedAtToolBoxControl( sal_uInt16 nSId, SfxItemState eState, + const SfxPoolItem* pState ) override; +private: + VclPtr<AnimationWindow> pAnimationWin; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/annotationmanager.hxx b/sd/source/ui/inc/annotationmanager.hxx new file mode 100644 index 0000000000..6f47efd1fc --- /dev/null +++ b/sd/source/ui/inc/annotationmanager.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include <rtl/ref.hxx> + +class SfxRequest; +class SfxItemSet; + +namespace sd +{ +class ViewShellBase; +class AnnotationManagerImpl; + +class AnnotationManager +{ +public: + AnnotationManager(ViewShellBase& rViewShellBase); + ~AnnotationManager(); + + void ExecuteAnnotation(SfxRequest const& rRequest); + void GetAnnotationState(SfxItemSet& rItemSet); + +private: + ::rtl::Reference<AnnotationManagerImpl> mxImpl; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/bulmaper.hxx b/sd/source/ui/inc/bulmaper.hxx new file mode 100644 index 0000000000..3de99d2626 --- /dev/null +++ b/sd/source/ui/inc/bulmaper.hxx @@ -0,0 +1,37 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sddllapi.h> + +class SfxItemSet; +class SvxNumRule; + +class SD_DLLPUBLIC SdBulletMapper +{ +public: + /* #i35937# + static void PreMapNumBulletForDialog( SfxItemSet& rSet ); + static void PostMapNumBulletForDialog( SfxItemSet& rSet ); +*/ + static void MapFontsInNumRule(SvxNumRule& aNumRule, const SfxItemSet& rSet); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx new file mode 100644 index 0000000000..7d82747435 --- /dev/null +++ b/sd/source/ui/inc/copydlg.hxx @@ -0,0 +1,67 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/basedlgs.hxx> +#include <tools/fract.hxx> + +class ColorListBox; + +namespace sd +{ +class View; + +/** + * dialog to adjust screen + */ +class CopyDlg : public SfxDialogController +{ +public: + CopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); + virtual ~CopyDlg() override; + + void GetAttr(SfxItemSet& rOutAttrs); + void Reset(); + +private: + const SfxItemSet& mrOutAttrs; + Fraction maUIScale; + ::sd::View* mpView; + + std::unique_ptr<weld::SpinButton> m_xNumFldCopies; + std::unique_ptr<weld::Button> m_xBtnSetViewData; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldMoveX; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldMoveY; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldWidth; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldHeight; + std::unique_ptr<weld::Label> m_xFtEndColor; + std::unique_ptr<weld::Button> m_xBtnSetDefault; + std::unique_ptr<ColorListBox> m_xLbStartColor; + std::unique_ptr<ColorListBox> m_xLbEndColor; + + DECL_LINK(SelectColorHdl, ColorListBox&, void); + DECL_LINK(SetViewData, weld::Button&, void); + DECL_LINK(SetDefault, weld::Button&, void); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/createtableobjectbar.hxx b/sd/source/ui/inc/createtableobjectbar.hxx new file mode 100644 index 0000000000..8fc21f19fc --- /dev/null +++ b/sd/source/ui/inc/createtableobjectbar.hxx @@ -0,0 +1,37 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +class SfxShell; + +namespace sd +{ +class View; +class ViewShell; +} + +namespace sd::ui::table +{ +SfxShell* CreateTableObjectBar(ViewShell& rShell, ::sd::View* pView); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx new file mode 100644 index 0000000000..c6547cc918 --- /dev/null +++ b/sd/source/ui/inc/custsdlg.hxx @@ -0,0 +1,87 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> +#include <vcl/weldutils.hxx> + +class SdDrawDocument; +class SdCustomShow; +class SdCustomShowList; + +class SdCustomShowDlg : public weld::GenericDialogController +{ +private: + SdDrawDocument& rDoc; + SdCustomShowList* pCustomShowList; + + std::unique_ptr<weld::TreeView> m_xLbCustomShows; + std::unique_ptr<weld::Button> m_xBtnNew; + std::unique_ptr<weld::Button> m_xBtnEdit; + std::unique_ptr<weld::Button> m_xBtnRemove; + std::unique_ptr<weld::Button> m_xBtnCopy; + std::unique_ptr<weld::Button> m_xBtnStartShow; + + void CheckState(); + + DECL_LINK( ClickButtonHdl, weld::Button&, void ); + DECL_LINK( SelectListBoxHdl, weld::TreeView&, void ); + DECL_LINK( StartShowHdl, weld::Button&, void ); + void SelectHdl(void const *); + +public: + SdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc); + virtual ~SdCustomShowDlg() override; + bool IsCustomShow() const; +}; + +class SdDefineCustomShowDlg : public weld::GenericDialogController +{ +private: + SdDrawDocument& rDoc; + std::unique_ptr<SdCustomShow>& rpCustomShow; + bool bModified; + OUString aOldName; + + std::unique_ptr<weld::Entry> m_xEdtName; + std::unique_ptr<weld::TreeView> m_xLbPages; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnRemove; + std::unique_ptr<weld::TreeView> m_xLbCustomPages; + std::unique_ptr<weld::ReorderingDropTarget> m_xDropTargetHelper; + std::unique_ptr<weld::Button> m_xBtnOK; + + void CheckState(); + void CheckCustomShow(); + + DECL_LINK( ClickButtonHdl, weld::Button&, void ); + DECL_LINK( ClickButtonEditHdl, weld::Entry&, void ); + DECL_LINK( ClickButtonHdl3, weld::TreeView&, void ); + DECL_LINK( ClickButtonHdl4, weld::TreeView&, void ); + DECL_LINK( OKHdl, weld::Button&, void ); + void ClickButtonHdl2(void const *); + +public: + + SdDefineCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc, std::unique_ptr<SdCustomShow>& rpCS); + virtual ~SdDefineCustomShowDlg() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx new file mode 100644 index 0000000000..375e5401c9 --- /dev/null +++ b/sd/source/ui/inc/diactrl.hxx @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/InterimItemWindow.hxx> +#include <sfx2/tbxctrl.hxx> + +namespace com::sun::star::frame +{ +class XFrame; +} +class SfxUInt16Item; + +// SdPagesField: + +class SdPagesField final : public InterimItemWindow +{ +private: + std::unique_ptr<weld::SpinButton> m_xWidget; + css::uno::Reference<css::frame::XFrame> m_xFrame; + + DECL_LINK(ModifyHdl, weld::SpinButton&, void); + DECL_STATIC_LINK(SdPagesField, OutputHdl, weld::SpinButton&, void); + DECL_LINK(spin_button_input, int* result, bool); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + +public: + SdPagesField(vcl::Window* pParent, css::uno::Reference<css::frame::XFrame> xFrame); + virtual void dispose() override; + void set_sensitive(bool bSensitive); + virtual ~SdPagesField() override; + + void UpdatePagesField(const SfxUInt16Item* pItem); +}; + +// SdTbxCtlDiaPages: + +class SdTbxCtlDiaPages : public SfxToolBoxControl +{ +public: + virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; + + SFX_DECL_TOOLBOX_CONTROL(); + + SdTbxCtlDiaPages(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); + virtual ~SdTbxCtlDiaPages() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/dlg_char.hxx b/sd/source/ui/inc/dlg_char.hxx new file mode 100644 index 0000000000..dd12c321eb --- /dev/null +++ b/sd/source/ui/inc/dlg_char.hxx @@ -0,0 +1,41 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> + +class SfxItemSet; +class SfxObjectShell; + +/** + * Character-Tab-Dialog + */ +class SdCharDlg : public SfxTabDialogController +{ +private: + const SfxObjectShell& rDocShell; + + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; + +public: + SdCharDlg(weld::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/dlgfield.hxx b/sd/source/ui/inc/dlgfield.hxx new file mode 100644 index 0000000000..40cadc9f40 --- /dev/null +++ b/sd/source/ui/inc/dlgfield.hxx @@ -0,0 +1,56 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> +#include <memory> +#include <svl/itemset.hxx> + +class SvxFieldData; +class SvxLanguageBox; + +/** + * dialog to adjust field-commands + */ +class SdModifyFieldDlg : public weld::GenericDialogController +{ +private: + SfxItemSet m_aInputSet; + const SvxFieldData* m_pField; + + std::unique_ptr<weld::RadioButton> m_xRbtFix; + std::unique_ptr<weld::RadioButton> m_xRbtVar; + std::unique_ptr<SvxLanguageBox> m_xLbLanguage; + std::unique_ptr<weld::ComboBox> m_xLbFormat; + + void FillFormatList(); + void FillControls(); + + DECL_LINK(LanguageChangeHdl, weld::ComboBox&, void); + +public: + SdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, SfxItemSet aSet); + virtual ~SdModifyFieldDlg() override; + + SvxFieldData* GetField(); + SfxItemSet GetItemSet() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/dlgpage.hxx b/sd/source/ui/inc/dlgpage.hxx new file mode 100644 index 0000000000..aadb5f28e1 --- /dev/null +++ b/sd/source/ui/inc/dlgpage.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> +#include <svx/xtable.hxx> + +class SfxObjectShell; +enum class ChangeType; + +/** + * Page configuration-tab-dialog + */ +class SdPageDlg : public SfxTabDialogController +{ +private: + bool mbIsImpressDoc; + + XColorListRef mpColorList; + XGradientListRef mpGradientList; + XHatchListRef mpHatchingList; + XBitmapListRef mpBitmapList; + XPatternListRef mpPatternList; +public: + + SdPageDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage, bool bIsImpressDoc); + + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/dlgsnap.hxx b/sd/source/ui/inc/dlgsnap.hxx new file mode 100644 index 0000000000..97fe09ccbb --- /dev/null +++ b/sd/source/ui/inc/dlgsnap.hxx @@ -0,0 +1,66 @@ +/* -*- 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 . + */ + +#pragma once + +#include <tools/fract.hxx> +#include <vcl/weld.hxx> + +/************************************************************************/ + +class SfxItemSet; +namespace sd { + class View; +} + +/** + * dialog to adjust snap- lines and points + */ +class SdSnapLineDlg : public weld::GenericDialogController +{ +private: + int nXValue; + int nYValue; + Fraction aUIScale; + + std::unique_ptr<weld::Label> m_xFtX; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldX; + std::unique_ptr<weld::Label> m_xFtY; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldY; + std::unique_ptr<weld::Widget> m_xRadioGroup; + std::unique_ptr<weld::RadioButton> m_xRbPoint; + std::unique_ptr<weld::RadioButton> m_xRbVert; + std::unique_ptr<weld::RadioButton> m_xRbHorz; + std::unique_ptr<weld::Button> m_xBtnDelete; + + DECL_LINK(ClickHdl, weld::Button&, void); + DECL_LINK(ToggleHdl, weld::Toggleable&, void); + +public: + SdSnapLineDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View const * pView); + virtual ~SdSnapLineDlg() override; + + void GetAttr(SfxItemSet& rOutAttrs); + + void HideRadioGroup(); + void HideDeleteBtn() { m_xBtnDelete->hide(); } + void SetInputFields(bool bEnableX, bool bEnableY); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/drawview.hxx b/sd/source/ui/inc/drawview.hxx new file mode 100644 index 0000000000..daa5cc026f --- /dev/null +++ b/sd/source/ui/inc/drawview.hxx @@ -0,0 +1,72 @@ +/* -*- 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 . + */ + +#pragma once + +#include "View.hxx" + +#include <sddllapi.h> + +namespace sd { + +class DrawDocShell; +class DrawViewShell; + +/** + * Derivative of ::sd::View; contains also a pointer to the document + */ +class SD_DLLPUBLIC DrawView : public ::sd::View +{ +public: + + DrawView ( + DrawDocShell* pDocSh, + OutputDevice* pOutDev, + DrawViewShell* pShell); + virtual ~DrawView() override; + + virtual void MarkListHasChanged() override; + void CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override; + + virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false) override; + void SetMasterAttributes(SdrObject* pObject, const SdPage& rPage, SfxItemSet rSet, SfxStyleSheetBasePool* pStShPool, bool& bOk, bool bMaster, bool bSlide); + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + + void BlockPageOrderChangedHint(bool bBlock); + + bool SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr = false) override; + + virtual void MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin) override; + virtual void HideSdrPage() override; // SdrPageView* pPV); + + virtual void DeleteMarked() override; // from SdrView +protected: + virtual void ModelHasChanged() override; + +private: + DrawDocShell* mpDocShell; + DrawViewShell* mpDrawViewShell; + + sal_uInt16 mnPOCHSmph; ///< for blocking PageOrderChangedHint +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/filedlg.hxx b/sd/source/ui/inc/filedlg.hxx new file mode 100644 index 0000000000..c2c373a550 --- /dev/null +++ b/sd/source/ui/inc/filedlg.hxx @@ -0,0 +1,57 @@ +/* -*- 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 . + */ + +#pragma once + +#include <comphelper/errcode.hxx> +#include <vcl/weld.hxx> + +#include <memory> + +#include <sddllapi.h> + +class SdFileDialog_Imp; + +/******************************************************************************/ + +/** + The class SdOpenSoundFileDialog wraps the FileDialogHelper, displaying the + FILEOPEN_PLAY dialog template and performing the 'preview' functionality + (playing the selected sound file). The interface is a downstripped version + of the aforementioned class, with similar semantics. + */ +class SD_DLLPUBLIC SdOpenSoundFileDialog +{ + const std::unique_ptr<SdFileDialog_Imp> mpImpl; + + SdOpenSoundFileDialog(const SdOpenSoundFileDialog&) = delete; + SdOpenSoundFileDialog& operator=(const SdOpenSoundFileDialog&) = delete; + +public: + SdOpenSoundFileDialog(weld::Window* pParent); + ~SdOpenSoundFileDialog(); + + ErrCode Execute(); + OUString GetPath() const; + void SetPath(const OUString& rPath); + // WIP, please don't remove, dear Clang plugins + bool IsInsertAsLinkSelected() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/Configuration.hxx b/sd/source/ui/inc/framework/Configuration.hxx new file mode 100644 index 0000000000..1b245e47af --- /dev/null +++ b/sd/source/ui/inc/framework/Configuration.hxx @@ -0,0 +1,174 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XConfiguration.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <comphelper/compbase.hxx> + +#include <memory> + +namespace com::sun::star::util { class XCloneable; } +namespace com::sun::star::drawing::framework { class XConfigurationControllerBroadcaster; } + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XConfiguration, + css::container::XNamed + > ConfigurationInterfaceBase; + +/** A configuration describes the resources of an application like panes, + views, and tool bars and their relationships that are currently active + or are requested to be activated. Resources are specified by URLs rather + than references so that not only the current configuration but also a + requested configuration can be represented. + + A resource URL describes the type of a resource, not its actual + instance. For resources, like panes, that are unique with respect to an + application frame, that does not mean much of a difference. For other + resources like views, that may have more than one instance per + application frame, this is different. To identify them unambiguously a + second URL, one of a unique resource, is necessary. This second URL is + called the anchor of the first. The two types of resources are called + unique and linked respectively. + + Direct manipulation of a configuration object is not advised with the + exception of the configuration controller and objects that implement the + XConfigurationChangeOperation interface. +*/ +class Configuration final + : public ConfigurationInterfaceBase +{ +public: + /** Create a new configuration with a broadcaster that is used to send + events about requested configuration changes. + @param rxBroadcaster + This broadcaster is typically the same as the one used by the + ConfigurationController. + @param bBroadcastRequestEvents + When this is <TRUE/> then modifications to the configuration + trigger the broadcasting of "ResourceActivationRequestEvent" and + "ResourceDeactivationRequestEvent". When this flag is <FALSE/> + then events with type "ResourceActivationEvent" and + "ResourceDeactivationEvent" are broadcasted. + */ + Configuration (const css::uno::Reference<css::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster, + bool bBroadcastRequestEvents); + virtual ~Configuration() override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + // XConfiguration + + virtual void SAL_CALL addResource ( + const css::uno::Reference<css::drawing::framework::XResourceId>& + rxResourceId) override; + + virtual void SAL_CALL removeResource( + const css::uno::Reference<css::drawing::framework::XResourceId>& + rxResourceId) override; + + virtual css::uno::Sequence< css::uno::Reference< + css::drawing::framework::XResourceId> > SAL_CALL getResources ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId, + const OUString& rsResourceURLPrefix, + css::drawing::framework::AnchorBindingMode eMode) override; + + virtual sal_Bool SAL_CALL hasResource ( + const css::uno::Reference<css::drawing::framework::XResourceId>& + rxResourceId) override; + + // XCloneable + + virtual css::uno::Reference<css::util::XCloneable> + SAL_CALL createClone() override; + + // XNamed + + /** Return a human readable string representation. This is used for + debugging purposes. + */ + virtual OUString SAL_CALL getName() override; + + /** This call is ignored because the XNamed interface is (mis)used to + give access to a human readable name for debugging purposes. + */ + virtual void SAL_CALL setName (const OUString& rName) override; + +private: + class ResourceContainer; + /** The resource container holds the URLs of unique resource and of + resource linked to unique resources. + */ + std::unique_ptr<ResourceContainer> mpResourceContainer; + + /** The broadcaster used for notifying listeners of requests for + configuration changes. + */ + css::uno::Reference<css::drawing::framework::XConfigurationControllerBroadcaster> + mxBroadcaster; + + bool mbBroadcastRequestEvents; + + /** This private variant of the constructor is used for cloning a + Configuration object. + @param rResourceContainer + The new Configuration is created with a copy of the elements in + this container. + */ + Configuration (const css::uno::Reference<css::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster, + bool bBroadcastRequestEvents, + const ResourceContainer& rResourceContainer); + + /** Send an event to all interested listeners that a resource has been + added or removed. The event is sent to the listeners via the + ConfigurationController. + @param rxResourceId + The resource that is added to or removed from the configuration. + @param bActivation + This specifies whether an activation or deactivation is + broadcasted. The mbBroadcastRequestEvents member is also taken + into account when the actual event type field is determined. + */ + void PostEvent ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + const bool bActivation); + + /** When the called object has already been disposed this method throws + an exception and does not return. + + @throws css::lang::DisposedException + */ + void ThrowIfDisposed() const; +}; + +/** Return whether the two given configurations contain the same resource + ids. The order of resource ids is ignored. Empty references are + treated like empty configurations. +*/ +bool AreConfigurationsEquivalent ( + const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration1, + const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration2); + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx new file mode 100644 index 0000000000..3cff9d4039 --- /dev/null +++ b/sd/source/ui/inc/framework/ConfigurationController.hxx @@ -0,0 +1,177 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <rtl/ref.hxx> + +#include <memory> + + +namespace com::sun::star::drawing::framework { class XConfiguration; } +namespace com::sun::star::drawing::framework { class XConfigurationChangeRequest; } +namespace com::sun::star::drawing::framework { class XResourceId; } +namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; } +namespace com::sun::star::frame { class XController; } +namespace sd { class DrawController; } + +namespace sd::framework { + +typedef ::cppu::WeakComponentImplHelper < + css::drawing::framework::XConfigurationController + > ConfigurationControllerInterfaceBase; + +/** The configuration controller is responsible for maintaining the current + configuration. + + @see css::drawing::framework::XConfigurationController + for an extended documentation. +*/ +class ConfigurationController final + : private cppu::BaseMutex, + public ConfigurationControllerInterfaceBase +{ +public: + ConfigurationController(const rtl::Reference<::sd::DrawController>& rxController); + virtual ~ConfigurationController() noexcept override; + ConfigurationController(const ConfigurationController&) = delete; + ConfigurationController& operator=(const ConfigurationController&) = delete; + + virtual void SAL_CALL disposing() override; + + void ProcessEvent(); + + /** Normally the requested changes of the configuration are executed + asynchronously. However, there is at least one situation (searching + with the Outliner) where the surrounding code does not cope with + this. So, instead of calling Reschedule until the global event loop + executes the configuration update, this method does (almost) the + same without the reschedules. + + Do not use this method until there is absolutely no other way. + */ + void RequestSynchronousUpdate(); + + // XConfigurationController + + virtual void SAL_CALL lock() override; + + virtual void SAL_CALL unlock() override; + + virtual void SAL_CALL requestResourceActivation ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + css::drawing::framework::ResourceActivationMode eMode) override; + + virtual void SAL_CALL requestResourceDeactivation ( + const css::uno::Reference<css::drawing::framework::XResourceId>& + rxResourceId) override; + + virtual css::uno::Reference<css::drawing::framework::XResource> + SAL_CALL getResource ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId) override; + + virtual void SAL_CALL update() override; + + virtual css::uno::Reference< + css::drawing::framework::XConfiguration> + SAL_CALL getRequestedConfiguration() override; + + virtual css::uno::Reference< + css::drawing::framework::XConfiguration> + SAL_CALL getCurrentConfiguration() override; + + virtual void SAL_CALL restoreConfiguration ( + const css::uno::Reference<css::drawing::framework::XConfiguration>& + rxConfiguration) override; + + // XConfigurationControllerBroadcaster + + virtual void SAL_CALL addConfigurationChangeListener ( + const css::uno::Reference< + css::drawing::framework::XConfigurationChangeListener>& rxListener, + const OUString& rsEventType, + const css::uno::Any& rUserData) override; + + virtual void SAL_CALL removeConfigurationChangeListener ( + const css::uno::Reference< + css::drawing::framework::XConfigurationChangeListener>& rxListener) override; + + virtual void SAL_CALL notifyEvent ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) override; + + // XConfigurationRequestQueue + + virtual sal_Bool SAL_CALL hasPendingRequests() override; + + virtual void SAL_CALL postChangeRequest ( + const css::uno::Reference< + css::drawing::framework::XConfigurationChangeRequest>& rxRequest) override; + + // XResourceFactoryManager + + virtual void SAL_CALL addResourceFactory( + const OUString& sResourceURL, + const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) override; + + virtual void SAL_CALL removeResourceFactoryForURL( + const OUString& sResourceURL) override; + + virtual void SAL_CALL removeResourceFactoryForReference( + const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) override; + + virtual css::uno::Reference<css::drawing::framework::XResourceFactory> + SAL_CALL getResourceFactory ( + const OUString& sResourceURL) override; + + /** Use this class instead of calling lock() and unlock() directly in + order to be exception safe. + */ + class Lock + { + public: + Lock (const css::uno::Reference< + css::drawing::framework::XConfigurationController>& rxController); + ~Lock(); + private: + css::uno::Reference< + css::drawing::framework::XConfigurationController> mxController; + }; + +private: + class Implementation; + std::unique_ptr<Implementation> mpImplementation; + bool mbIsDisposed; + + /** When the called object has already been disposed this method throws + an exception and does not return. + + @throws css::lang::DisposedException + @throws css::uno::RuntimeException + */ + void ThrowIfDisposed () const; +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/DrawModule.hxx b/sd/source/ui/inc/framework/DrawModule.hxx new file mode 100644 index 0000000000..8190919986 --- /dev/null +++ b/sd/source/ui/inc/framework/DrawModule.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/types.h> +#include <rtl/ref.hxx> + +namespace com::sun::star::frame +{ +class XController; +} +namespace com::sun::star::uno +{ +template <typename> class Reference; +} +namespace sd +{ +class DrawController; +} + +namespace sd::framework +{ +/** The task of this module is to instantiate all modules that belong to the + Draw application. +*/ +class DrawModule +{ +public: + static void Initialize(rtl::Reference<sd::DrawController> const& rxController); +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx new file mode 100644 index 0000000000..e5fe6f78cd --- /dev/null +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -0,0 +1,342 @@ +/* -*- 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 . + */ + +#pragma once + +#include <ViewShell.hxx> + +#include <tools/SdGlobalResourceContainer.hxx> + +#include <functional> +#include <map> +#include <memory> +#include <mutex> + +namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace com::sun::star::drawing::framework { class XResourceId; } +namespace com::sun::star::drawing::framework { class XView; } +namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; } + +namespace sd { +class ViewShellBase; +} + + +namespace sd::framework { + +/** The FrameworkHelper is a convenience class that simplifies the + access to the drawing framework. + It has three main tasks: + 1. Provide frequently used strings of resource URLs and event names. + 2. Provide shortcuts for accessing the sd framework. + 3. Ease the migration to the drawing framework. + + Note that a FrameworkHelper disposes itself when one of the resource + controllers called by it throws a DisposedException. +*/ +class FrameworkHelper final + : public std::enable_shared_from_this<FrameworkHelper>, + public SdGlobalResource +{ +public: + // URLs of frequently used panes. + static constexpr OUString msPaneURLPrefix = u"private:resource/pane/"_ustr; + static const OUString msCenterPaneURL; + static const OUString msFullScreenPaneURL; + static const OUString msLeftImpressPaneURL; + static const OUString msLeftDrawPaneURL; + + // URLs of frequently used views. + static constexpr OUString msViewURLPrefix = u"private:resource/view/"_ustr; + static const OUString msImpressViewURL; + static const OUString msDrawViewURL; + static const OUString msOutlineViewURL; + static const OUString msNotesViewURL; + static const OUString msHandoutViewURL; + static const OUString msSlideSorterURL; + static const OUString msPresentationViewURL; + static const OUString msSidebarViewURL; + + // URLs of frequently used tool bars. + static constexpr OUString msToolBarURLPrefix = u"private:resource/toolbar/"_ustr; + static const OUString msViewTabBarURL; + + // Names of frequently used events. + static constexpr OUString msResourceActivationRequestEvent + = u"ResourceActivationRequested"_ustr; + static constexpr OUString msResourceDeactivationRequestEvent + = u"ResourceDeactivationRequest"_ustr; + static constexpr OUString msResourceActivationEvent = u"ResourceActivation"_ustr; + static constexpr OUString msResourceDeactivationEvent = u"ResourceDeactivation"_ustr; + static constexpr OUString msResourceDeactivationEndEvent = u"ResourceDeactivationEnd"_ustr; + static constexpr OUString msConfigurationUpdateStartEvent = u"ConfigurationUpdateStart"_ustr; + static constexpr OUString msConfigurationUpdateEndEvent = u"ConfigurationUpdateEnd"_ustr; + + /** Return the FrameworkHelper object that is associated with the given + ViewShellBase. If such an object does not yet exist, a new one is + created. + */ + static ::std::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase); + + /** Mark the FrameworkHelper object for the given ViewShellBase as + disposed. A following ReleaseInstance() call will destroy the + FrameworkHelper object. + + Do not call this method. It is an internally used method that can + not be made private. + */ + static void DisposeInstance (const ViewShellBase& rBase); + + /** Destroy the FrameworkHelper object for the given ViewShellBase. + + Do not call this method. It is an internally used method that can + not be made private. + */ + static void ReleaseInstance (const ViewShellBase& rBase); + + /** Return an identifier for the given view URL. This identifier can be + used in a switch statement. See GetViewURL() for a mapping in the + opposite direction. + */ + static ViewShell::ShellType GetViewId (const OUString& rsViewURL); + + /** Return a view URL for the given identifier. See GetViewId() for a + mapping in the opposite direction. + */ + static OUString GetViewURL (ViewShell::ShellType eType); + + /** Return a ViewShell pointer for the given XView reference. This + assumes that the given reference is implemented by the + ViewShellWrapper class that supports the XTunnel interface. + @return + When the ViewShell pointer can not be inferred from the given + reference then an empty pointer is returned. + */ + static ::std::shared_ptr<ViewShell> GetViewShell ( + const css::uno::Reference<css::drawing::framework::XView>& rxView); + + typedef ::std::function<bool (const css::drawing::framework::ConfigurationChangeEvent&)> + ConfigurationChangeEventFilter; + typedef ::std::function<void (bool bEventSeen)> Callback; + typedef ::std::function< + void ( + const css::uno::Reference< + css::drawing::framework::XResourceId>&) + > ResourceFunctor; + + /** Test whether the called FrameworkHelper object is valid. + @return + When the object has already been disposed then <FALSE/> is returned. + */ + bool IsValid() const; + + /** Return a pointer to the view shell that is displayed in the + specified pane. See GetView() for a variant that returns a + reference to XView instead of a ViewShell pointer. + @return + An empty pointer is returned when for example the specified pane + does not exist or is not visible or does not show a view or one + of the involved objects does not support XUnoTunnel (where + necessary). + */ + ::std::shared_ptr<ViewShell> GetViewShell (const OUString& rsPaneURL); + + /** Return a reference to the view that is displayed in the specified + pane. See GetViewShell () for a variant that returns a ViewShell + pointer instead of a reference to XView. + @param rxPaneOrViewId + When this ResourceId specifies a view then that view is + returned. When it belongs to a pane then one view in that pane + is returned. + @return + An empty reference is returned when for example the specified pane + does not exist or is not visible or does not show a view or one + of the involved objects does not support XTunnel (where + necessary). + */ + css::uno::Reference<css::drawing::framework::XView> GetView ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneOrViewId); + + /** Request the specified view to be displayed in the specified pane. + When the pane is not visible its creation is also requested. The + update that creates the actual view object is done asynchronously. + @param rsResourceURL + The resource URL of the view to show. + @param rsAnchorURL + The URL of the pane in which to show the view. + @return + The resource id of the requested view is returned. With that + the caller can, for example, call RunOnResourceActivation() to + do some initialization after the requested view becomes active. + */ + css::uno::Reference<css::drawing::framework::XResourceId> RequestView ( + const OUString& rsResourceURL, + const OUString& rsAnchorURL); + + /** Process a slot call that requests a view shell change. + */ + void HandleModeChangeSlot ( + sal_uInt16 nSlotId, + SfxRequest const & rRequest); + + /** Run the given callback when the specified event is notified by the + ConfigurationManager. When there are no pending requests and + therefore no events would be notified (in the foreseeable future) + then the callback is called immediately. + The callback is called with a flag that tells the callback whether + the event it waits for has been sent. + */ + void RunOnConfigurationEvent( + const OUString& rsEventType, + const Callback& rCallback); + + /** Run the given callback when the specified resource has been + activated. When the resource is active already when this method is + called then rCallback is called before this method returns. + @param rxResourceId + Wait for the activation of this resource before calling + rCallback. + @param rCallback + The callback to be called when the resource is activated. + + */ + void RunOnResourceActivation( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + const Callback& rCallback); + + /** Normally the requested changes of the configuration are executed + asynchronously. However, there is at least one situation (searching + with the Outliner) where the surrounding code does not cope with + this. So, instead of calling Reschedule until the global event loop + executes the configuration update, this method does (almost) the + same without the reschedules. + + Do not use this method until there is absolutely no other way. + */ + void RequestSynchronousUpdate(); + + /** Block until the specified event is notified by the configuration + controller. When the configuration controller is not processing any + requests the method returns immediately. + */ + void WaitForEvent (const OUString& rsEventName) const; + + /** This is a short cut for WaitForEvent(msConfigurationUpdateEndEvent). + Call this method to execute the pending requests. + */ + void WaitForUpdate() const; + + /** Explicit request for an update of the current configuration. Call + this method when one of the resources managed by the sd framework + has been activated or deactivated from the outside, i.e. not by the + framework itself. An example for this is a click on the closer + button of one of the side panes. + */ + void UpdateConfiguration(); + + /** Return a string representation of the given XResourceId object. + */ + static OUString ResourceIdToString ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxResourceId); + + /** Create a new XResourceId object for the given resource URL. + */ + static css::uno::Reference< + css::drawing::framework::XResourceId> + CreateResourceId ( + const OUString& rsResourceURL); + + /** Create a new XResourceId object for the given resource URL and a + single anchor URL. + */ + static css::uno::Reference< + css::drawing::framework::XResourceId> + CreateResourceId ( + const OUString& rsResourceURL, + const OUString& rsAnchorURL); + + /** Create a new XResourceId object for the given resource URL. + */ + static css::uno::Reference< + css::drawing::framework::XResourceId> + CreateResourceId ( + const OUString& rsResourceURL, + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxAnchor); + + const css::uno::Reference<css::drawing::framework::XConfigurationController>& + GetConfigurationController() const { return mxConfigurationController;} + +private: + typedef ::std::map< + const ViewShellBase*, + ::std::shared_ptr<FrameworkHelper> > InstanceMap; + /** The instance map holds (at least) one FrameworkHelper instance for + every ViewShellBase object. + */ + static InstanceMap maInstanceMap; + class ViewURLMap; + static ViewURLMap maViewURLMap; + static std::mutex maInstanceMapMutex; + + ViewShellBase& mrBase; + css::uno::Reference<css::drawing::framework::XConfigurationController> + mxConfigurationController; + + class DisposeListener; + friend class DisposeListener; + css::uno::Reference<css::lang::XComponent> + mxDisposeListener; + + FrameworkHelper (ViewShellBase& rBase); + FrameworkHelper (const FrameworkHelper& rHelper) = delete; + virtual ~FrameworkHelper() override; + class Deleter; friend class Deleter; + FrameworkHelper& operator= (const FrameworkHelper& rHelper) = delete; + + void Initialize(); + + void Dispose(); + + /** Run the given callback when an event of the specified type is + received from the ConfigurationController or when the + ConfigurationController has no pending change requests. + @param rsEventType + Run rCallback only on this event. + @param rFilter + This filter has to return <TRUE/> in order for rCallback to be + called. + @param rCallback + The callback functor to be called. + */ + void RunOnEvent( + const OUString& rsEventType, + const ConfigurationChangeEventFilter& rFilter, + const Callback& rCallback) const; + + /** This disposing method is forwarded from the inner DisposeListener class. + */ + void disposing (const css::lang::EventObject& rEventObject); +}; + +} // end of namespace sd::framework + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/ImpressModule.hxx b/sd/source/ui/inc/framework/ImpressModule.hxx new file mode 100644 index 0000000000..fc4e2b8397 --- /dev/null +++ b/sd/source/ui/inc/framework/ImpressModule.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/types.h> +#include <rtl/ref.hxx> + +namespace com::sun::star::frame +{ +class XController; +} +namespace com::sun::star::uno +{ +template <class interface_type> class Reference; +} +namespace sd +{ +class DrawController; +} + +namespace sd::framework +{ +/** The task of this module is to instantiate all modules that belong to the + Impress application. +*/ +class ImpressModule +{ +public: + static void Initialize(rtl::Reference<sd::DrawController> const& rxController); +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx new file mode 100644 index 0000000000..ea1de664cc --- /dev/null +++ b/sd/source/ui/inc/framework/ModuleController.hxx @@ -0,0 +1,91 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XModuleController.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <comphelper/compbase.hxx> +#include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> + +#include <unordered_map> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::uno { class XComponentContext; } +namespace sd { class DrawController; } + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XModuleController + > ModuleControllerInterfaceBase; + +/** The ModuleController has two tasks: + + 1. It reads the + org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories + configuration data that maps from resource URLs to service names of + factories that can create resources for the URLs. When the + configuration controller wants to create a resource for which it does + not have a factory, it asks the ModuleController to provide one. The + ModuleController looks up the service name registered for the URL of the + resource and instantiates this service. The service is expected to + register on its creation a factory for the resource in question. + + 2. The ModuleController instantiates PresentationFactoryProvider. + This service + can then register as listeners at the ConfigurationController or do + whatever they like. +*/ +class ModuleController final + : public ModuleControllerInterfaceBase +{ +public: + /// @throws std::exception + ModuleController(const rtl::Reference<::sd::DrawController>& rxController); + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + // XModuleController + + virtual void SAL_CALL requestResource(const OUString& rsResourceURL) override; + +private: + rtl::Reference<::sd::DrawController> mxController; + + std::unordered_map<OUString, OUString> maResourceToFactoryMap; + std::unordered_map<OUString, css::uno::WeakReference<css::uno::XInterface>> maLoadedFactories; + + ModuleController (const ModuleController&) = delete; + virtual ~ModuleController() noexcept override; + + /** Called for every entry in the ResourceFactories configuration entry. + */ + void ProcessFactory (const OUString& ServiceName, ::std::vector<OUString> aURLs); + + /** Instantiate startup services. This method is called once when a new + ModuleController object is created. + */ + void InstantiateStartupServices(); +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx new file mode 100644 index 0000000000..51b7a5ed09 --- /dev/null +++ b/sd/source/ui/inc/framework/Pane.hxx @@ -0,0 +1,133 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XPane.hpp> +#include <com/sun/star/drawing/framework/XPane2.hpp> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> + +namespace sd::framework { + +typedef ::cppu::WeakComponentImplHelper < + css::drawing::framework::XPane, + css::drawing::framework::XPane2 + > PaneInterfaceBase; + +/** A pane is a wrapper for a window and possibly for a tab bar (for view + switching). Panes are unique resources. + + This class has two responsibilities: + 1. It implements the XPane interface. This is the most important + interface of this class for API based views (of which there not that + many yet) because it gives access to the XWindow. + 2. It gives access to the underlying VCL Window. + This is necessary at the moment and in the + foreseeable future because many parts of the Draw and Impress views rely + on direct access on the Window class. +*/ +class Pane + : protected cppu::BaseMutex, + public PaneInterfaceBase +{ +public: + /** Create a new Pane object that wraps the given window. + @param rsPaneURL + The URL that is used by the configuration to identify the pane. + The given URL has to be valid. + @param pWindow + The VCL Window (usually this really is an sd::Window) that is + wrapped by the new Pane object. The given pointer must not be + NULL. + */ + Pane ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, + vcl::Window* pWindow) + noexcept; + virtual ~Pane() override; + + virtual void SAL_CALL disposing() override; + + /** This method is typically used to obtain + a Window pointer from an XPane object. + */ + virtual vcl::Window* GetWindow(); + + //----- XPane ------------------------------------------------------------- + + /** For a UNO API based implementation of a view this may the most + important method of this class because the view is only interested + in the window of the pane. + */ + virtual css::uno::Reference<css::awt::XWindow> + SAL_CALL getWindow() override; + + virtual css::uno::Reference<css::rendering::XCanvas> + SAL_CALL getCanvas() override; + + //----- XPane2 ------------------------------------------------------------- + + virtual sal_Bool SAL_CALL isVisible() override; + + virtual void SAL_CALL setVisible (sal_Bool bIsVisible) override; + + virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible() override; + + virtual void SAL_CALL setAccessible ( + const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible) override; + + //----- XResource --------------------------------------------------------- + + virtual css::uno::Reference<css::drawing::framework::XResourceId> + SAL_CALL getResourceId() override; + + /** For the typical pane it makes no sense to be displayed without a + view. Therefore this default implementation returns always <TRUE/>. + */ + virtual sal_Bool SAL_CALL isAnchorOnly() override; + +protected: + css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId; + VclPtr<vcl::Window> mpWindow; + css::uno::Reference<css::awt::XWindow> mxWindow; + css::uno::Reference<css::rendering::XCanvas> mxCanvas; + + /** Override this method, not getCanvas(), when you want to provide a + different canvas. + + @throws css::uno::RuntimeException + */ + virtual css::uno::Reference<css::rendering::XCanvas> + CreateCanvas(); + + /** Throw DisposedException when the object has already been disposed or + is currently being disposed. Otherwise this method returns + normally. + + @throws css::lang::DisposedException + */ + void ThrowIfDisposed() const; +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/PresentationFactory.hxx b/sd/source/ui/inc/framework/PresentationFactory.hxx new file mode 100644 index 0000000000..fe984c401f --- /dev/null +++ b/sd/source/ui/inc/framework/PresentationFactory.hxx @@ -0,0 +1,81 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XResourceFactory.hpp> +#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp> +#include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> + +namespace com::sun::star::frame { class XController; } +namespace sd { class DrawController; } + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XResourceFactory, + css::drawing::framework::XConfigurationChangeListener + > PresentationFactoryInterfaceBase; + +/** This factory creates a marker view whose existence in a configuration + indicates that a slideshow is running (in another but associated + application window). +*/ +class PresentationFactory final + : public PresentationFactoryInterfaceBase +{ +public: + PresentationFactory ( + const rtl::Reference<::sd::DrawController>& rxController); + virtual ~PresentationFactory() override; + + static void install(const rtl::Reference<::sd::DrawController>& rxController); + + // XResourceFactory + + virtual css::uno::Reference<css::drawing::framework::XResource> + SAL_CALL createResource ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxViewId) override; + + virtual void SAL_CALL releaseResource ( + const css::uno::Reference<css::drawing::framework::XResource>& xView) override; + + // XConfigurationChangeListener + + virtual void SAL_CALL notifyConfigurationChange ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) override; + + // lang::XEventListener + + using WeakComponentImplHelperBase::disposing; + virtual void SAL_CALL disposing ( + const css::lang::EventObject& rEventObject) override; + +private: + rtl::Reference<::sd::DrawController> mxController; + + /// @throws css::lang::DisposedException + void ThrowIfDisposed() const; +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/PresentationModule.hxx b/sd/source/ui/inc/framework/PresentationModule.hxx new file mode 100644 index 0000000000..437534f707 --- /dev/null +++ b/sd/source/ui/inc/framework/PresentationModule.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/types.h> +#include <rtl/ref.hxx> + +namespace com::sun::star::frame +{ +class XController; +} +namespace com::sun::star::uno +{ +template <class interface_type> class Reference; +} +namespace sd +{ +class DrawController; +} + +namespace sd::framework +{ +/** The task of this module is to instantiate all modules that belong to the + fullscreen presentation. +*/ +class PresentationModule +{ +public: + static void Initialize(rtl::Reference<sd::DrawController> const& rxController); +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/ResourceId.hxx b/sd/source/ui/inc/framework/ResourceId.hxx new file mode 100644 index 0000000000..2ce3271d04 --- /dev/null +++ b/sd/source/ui/inc/framework/ResourceId.hxx @@ -0,0 +1,213 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <vector> + +#include <com/sun/star/drawing/framework/XResourceId.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> + +#include <memory> + +namespace com::sun::star::util { class XURLTransformer; } +namespace com::sun::star::uno { template <class interface_type> class WeakReference; } + +namespace sd::framework { + +typedef ::cppu::WeakImplHelper < + css::drawing::framework::XResourceId, + css::lang::XInitialization, + css::lang::XServiceInfo + > ResourceIdInterfaceBase; + +/** Implementation of the css::drawing::framework::ResourceId + service and the css::drawing::framework::XResourceId + interface. +*/ +class ResourceId final + : public ResourceIdInterfaceBase +{ +public: + /** Create a new, empty resource id. + */ + ResourceId(); + + /** Create a new resource id that is described by the given URLs. + @param rsResourceURLs + The first URL specifies the type of resource. The other URLs + describe its anchor. + The set of URLs may be empty. The result is then the same as + returned by ResourceId() default constructor. + */ + ResourceId (std::vector<OUString>&& rsResourceURLs); + + /** Create a new resource id that has an empty anchor. + @param rsResourceURL + When this resource URL is empty then the resulting ResourceId + object is identical to when the ResourceId() default constructor + had been called. + */ + ResourceId ( + const OUString& rsResourceURL); + + /** Create a new resource id for the given resource type and an anchor + that is specified by a single URL. This constructor can be used for + example for views that are bound to panes. + @param rsResourceURL + The URL of the actual resource. + @param rsAnchorURL + The single URL of the anchor. + */ + ResourceId ( + const OUString& rsResourceURL, + const OUString& rsAnchorURL); + + /** Create a new resource id with an anchor that consists of a sequence + of URLs that is extended by a further URL. + @param rsResourceURL + The URL of the actual resource. + @param rsFirstAnchorURL + This URL extends the anchor given by rAnchorURLs. + @param rAnchorURLs + An anchor as it is returned by XResourceId::getAnchorURLs(). + */ + ResourceId ( + const OUString& rsResourceURL, + const OUString& rsFirstAnchorURL, + const css::uno::Sequence<OUString>& rAnchorURLs); + + virtual ~ResourceId() override; + + //===== XResourceId ======================================================= + + virtual OUString SAL_CALL + getResourceURL() override; + + virtual css::util::URL SAL_CALL + getFullResourceURL() override; + + virtual sal_Bool SAL_CALL + hasAnchor() override; + + virtual css::uno::Reference< + css::drawing::framework::XResourceId> SAL_CALL + getAnchor() override; + + virtual css::uno::Sequence<OUString> SAL_CALL + getAnchorURLs() override; + + virtual OUString SAL_CALL + getResourceTypePrefix() override; + + virtual sal_Int16 SAL_CALL + compareTo (const css::uno::Reference< + css::drawing::framework::XResourceId>& rxResourceId) override; + + virtual sal_Bool SAL_CALL + isBoundTo ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxResourceId, + css::drawing::framework::AnchorBindingMode eMode) override; + + virtual sal_Bool SAL_CALL + isBoundToURL ( + const OUString& rsAnchorURL, + css::drawing::framework::AnchorBindingMode eMode) override; + + virtual css::uno::Reference< + css::drawing::framework::XResourceId> SAL_CALL + clone() override; + + //===== XInitialization =================================================== + + void SAL_CALL initialize ( + const css::uno::Sequence<css::uno::Any>& aArguments) override; + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + +private: + /** The set of URLs that consist of the resource URL at index 0 and the + anchor URLs and indices 1 and above. + */ + std::vector<OUString> maResourceURLs; + + std::unique_ptr<css::util::URL> mpURL; + + static css::uno::WeakReference<css::util::XURLTransformer> mxURLTransformerWeak; + + /** Compare the called ResourceId object to the given ResourceId object. + This uses the implementation of both objects to speed up the + comparison. + */ + sal_Int16 CompareToLocalImplementation (const ResourceId& rId) const; + + /** Compare the called ResourceId object to the given XResourceId object + reference. The comparison is done via the UNO interface. Namely, + it uses the getResourceURL() and the getAnchorURLs() methods to get + access to the URLs of the given object. + */ + sal_Int16 CompareToExternalImplementation (const css::uno::Reference< + css::drawing::framework::XResourceId>& rxId) const; + + /** Return whether the called ResourceId object is bound to the anchor + consisting of the URLs given by psFirstAnchorURL and paAnchorURLs. + @param psFirstAnchorURL + Optional first URL of the anchor. This can be missing or present + independently of paAnchorURLs. + @param paAnchorURLs + Optional set of additional anchor URLs. This can be missing or + present independently of psFirstAnchorURL. + @param eMode + This specifies whether the called resource has to be directly + bound to the given anchor in order to return <TRUE/> or whether + it can be bound indirectly, too. + */ + bool IsBoundToAnchor ( + const OUString* psFirstAnchorURL, + const css::uno::Sequence<OUString>* paAnchorURLs, + css::drawing::framework::AnchorBindingMode eMode) const; + + /** Return whether the called ResourceId object is bound to the anchor + consisting of the URLs in rResourceURLs. + @param rResourceURLs + A possibly empty list of anchor URLs. + @param eMode + This specifies whether the called resource has to be directly + bound to the given anchor in order to return <TRUE/> or whether + it can be bound indirectly, too. + */ + bool IsBoundToAnchor ( + const ::std::vector<OUString>& rResourceURLs, + css::drawing::framework::AnchorBindingMode eMode) const; + + void ParseResourceURL(); +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx new file mode 100644 index 0000000000..fc944623a7 --- /dev/null +++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx @@ -0,0 +1,123 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XView.hpp> +#include <com/sun/star/drawing/framework/XRelocatableResource.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <comphelper/compbase.hxx> + +#include <memory> + +namespace sd { class ViewShell; } +namespace sd::slidesorter { class SlideSorterViewShell; } +namespace com::sun::star::awt { class XWindow; } + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < css::awt::XWindowListener + , css::view::XSelectionSupplier + , css::drawing::framework::XRelocatableResource + , css::drawing::framework::XView + > ViewShellWrapperInterfaceBase; + +/** This class wraps ViewShell objects and makes them look like an XView. + Most importantly it provides access to the ViewShell implementation. + Then it forwards size changes of the pane window to the view shell. +*/ +class ViewShellWrapper final : public ViewShellWrapperInterfaceBase +{ +public: + /** Create a new ViewShellWrapper object that wraps the given ViewShell + object. + @param pViewShell + The ViewShell object to wrap. + @param rsViewURL + URL of the view type of the wrapped view shell. + @param rxWindow + This window reference is optional. When a valid reference is + given then size changes of the referenced window are forwarded + to the ViewShell object. + */ + ViewShellWrapper ( + const ::std::shared_ptr<ViewShell>& pViewShell, + const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, + const css::uno::Reference<css::awt::XWindow>& rxWindow); + virtual ~ViewShellWrapper() override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + + /** This method is typically used + to obtain a pointer to the wrapped ViewShell object for a given + XView object. + */ + const ::std::shared_ptr<ViewShell>& GetViewShell() const { return mpViewShell;} + + // XResource + + virtual css::uno::Reference<css::drawing::framework::XResourceId> + SAL_CALL getResourceId() override; + + virtual sal_Bool SAL_CALL isAnchorOnly() override; + + // XSelectionSupplier + + virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override; + virtual css::uno::Any SAL_CALL getSelection() override; + virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + + // XRelocatableResource + + virtual sal_Bool SAL_CALL relocateToAnchor ( + const css::uno::Reference< + css::drawing::framework::XResource>& xResource) override; + + // XWindowListener + + virtual void SAL_CALL windowResized( + const css::awt::WindowEvent& rEvent) override; + + virtual void SAL_CALL windowMoved( + const css::awt::WindowEvent& rEvent) override; + + virtual void SAL_CALL windowShown( + const css::lang::EventObject& rEvent) override; + + virtual void SAL_CALL windowHidden( + const css::lang::EventObject& rEvent) override; + + // XEventListener + + virtual void SAL_CALL disposing( + const css::lang::EventObject& rEvent) override; + +private: + ::std::shared_ptr< ViewShell > mpViewShell; + ::std::shared_ptr< ::sd::slidesorter::SlideSorterViewShell > mpSlideSorterViewShell; + const css::uno::Reference< css::drawing::framework::XResourceId > mxViewId; + css::uno::Reference<css::awt::XWindow > mxWindow; +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx new file mode 100644 index 0000000000..fb1ac2cf82 --- /dev/null +++ b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx @@ -0,0 +1,127 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XResourceFactory.hpp> +#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <comphelper/compbase.hxx> +#include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> + +#include <memory> + +namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace sd { +class DrawController; +class ViewShellBase; +} + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XResourceFactory, + css::drawing::framework::XConfigurationChangeListener + > BasicPaneFactoryInterfaceBase; + +/** This factory provides the frequently used standard panes + private:resource/pane/CenterPane + private:resource/pane/FullScreenPane + private:resource/pane/LeftImpressPane + private:resource/pane/LeftDrawPane + There are two left panes because this is (seems to be) the only way to + show different titles for the left pane in Draw and Impress. +*/ +class BasicPaneFactory final + : public BasicPaneFactoryInterfaceBase +{ +public: + explicit BasicPaneFactory ( + const css::uno::Reference<css::uno::XComponentContext>& rxContext, + const rtl::Reference<::sd::DrawController>& rxController); + virtual ~BasicPaneFactory() override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + // XResourceFactory + + virtual css::uno::Reference<css::drawing::framework::XResource> + SAL_CALL createResource ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId) override; + + virtual void SAL_CALL + releaseResource ( + const css::uno::Reference<css::drawing::framework::XResource>& rxPane) override; + + // XConfigurationChangeListener + + virtual void SAL_CALL notifyConfigurationChange ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) override; + + // lang::XEventListener + + virtual void SAL_CALL disposing ( + const css::lang::EventObject& rEventObject) override; + +private: + css::uno::Reference<css::uno::XComponentContext> mxComponentContext; + css::uno::WeakReference<css::drawing::framework::XConfigurationController> + mxConfigurationControllerWeak; + ViewShellBase* mpViewShellBase; + class PaneDescriptor; + class PaneContainer; + std::unique_ptr<PaneContainer> mpPaneContainer; + + /** Create a new instance of FrameWindowPane. + @param rPaneId + There is only one frame window so this id is just checked to + have the correct value. + */ + css::uno::Reference<css::drawing::framework::XResource> + CreateFrameWindowPane ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId); + + /** Create a new pane that represents the center pane in full screen + mode. + */ + css::uno::Reference<css::drawing::framework::XResource> + CreateFullScreenPane ( + const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext, + const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId); + + /** Create a new instance of ChildWindowPane. + @param rPaneId + The ResourceURL member defines which side pane to create. + */ + css::uno::Reference<css::drawing::framework::XResource> + CreateChildWindowPane ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxPaneId, + const PaneDescriptor& rDescriptor); + + /// @throws css::lang::DisposedException + void ThrowIfDisposed() const; +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx b/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx new file mode 100644 index 0000000000..804d8711d5 --- /dev/null +++ b/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/drawing/framework/XResourceFactory.hpp> +#include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::drawing::framework { class XResourceId; } +namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace sd { class DrawController; } + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XResourceFactory, + css::lang::XEventListener + > BasicToolBarFactoryInterfaceBase; + +/** This factory provides some of the frequently used tool bars: + private:resource/toolbar/ViewTabBar +*/ +class BasicToolBarFactory final + : public BasicToolBarFactoryInterfaceBase +{ +public: + BasicToolBarFactory (const rtl::Reference<::sd::DrawController>& rxController); + virtual ~BasicToolBarFactory() override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + // ToolBarFactory + + virtual css::uno::Reference<css::drawing::framework::XResource> SAL_CALL + createResource ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxToolBarId) override; + + virtual void SAL_CALL + releaseResource ( + const css::uno::Reference<css::drawing::framework::XResource>& + rxToolBar) override; + + // lang::XEventListener + + virtual void SAL_CALL disposing ( + const css::lang::EventObject& rEventObject) override; + +private: + css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController; + rtl::Reference<::sd::DrawController> mxController; + + void Shutdown(); + + /// @throws css::lang::DisposedException + void ThrowIfDisposed() const; +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx new file mode 100644 index 0000000000..47a2aea5b8 --- /dev/null +++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx @@ -0,0 +1,125 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/drawing/framework/XResourceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> + +#include <vcl/vclptr.hxx> +#include <memory> + +namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace com::sun::star::drawing::framework { class XPane; } + +namespace sd { +class DrawController; +class ViewShell; +class ViewShellBase; +class FrameView; +} +class SfxViewFrame; +namespace vcl { class Window; } + +namespace sd::framework { + +typedef comphelper::WeakComponentImplHelper < + css::drawing::framework::XResourceFactory + > BasicViewFactoryInterfaceBase; + +/** Factory for the frequently used standard views of the drawing framework: + private:resource/view/ + private:resource/view/ImpressView + private:resource/view/GraphicView + private:resource/view/OutlineView + private:resource/view/NotesView + private:resource/view/HandoutView + private:resource/view/SlideSorter + private:resource/view/PresentationView + private:resource/view/TaskPane + For some views in some panes this class also acts as a cache. +*/ +class BasicViewFactory final + : public BasicViewFactoryInterfaceBase +{ +public: + BasicViewFactory(const rtl::Reference<::sd::DrawController>& rxController); + virtual ~BasicViewFactory() override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + // XViewFactory + + virtual css::uno::Reference<css::drawing::framework::XResource> + SAL_CALL createResource ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) override; + + virtual void SAL_CALL releaseResource ( + const css::uno::Reference<css::drawing::framework::XResource>& xView) override; + +private: + css::uno::Reference<css::drawing::framework::XConfigurationController> + mxConfigurationController; + class ViewDescriptor; + class ViewShellContainer; + std::unique_ptr<ViewShellContainer> mpViewShellContainer; + ViewShellBase* mpBase; + FrameView* mpFrameView; + + class ViewCache; + ScopedVclPtr<vcl::Window> mpWindow; + std::shared_ptr<ViewCache> mpViewCache; + + css::uno::Reference<css::drawing::framework::XPane> mxLocalPane; + + std::shared_ptr<ViewDescriptor> CreateView ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, + SfxViewFrame& rFrame, + vcl::Window& rWindow, + const css::uno::Reference<css::drawing::framework::XPane>& rxPane, + FrameView* pFrameView, + const bool bIsCenterView); + + std::shared_ptr<ViewShell> CreateViewShell ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, + SfxViewFrame& rFrame, + vcl::Window& rWindow, + FrameView* pFrameView); + + void ActivateCenterView ( + const std::shared_ptr<ViewDescriptor>& rpDescriptor); + + void ReleaseView ( + const std::shared_ptr<ViewDescriptor>& rpDescriptor, + bool bDoNotCache); + + bool IsCacheable ( + const std::shared_ptr<ViewDescriptor>& rpDescriptor); + + std::shared_ptr<ViewDescriptor> GetViewFromCache ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, + const css::uno::Reference<css::drawing::framework::XPane>& rxPane); +}; + +} // end of namespace sd::framework + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuarea.hxx b/sd/source/ui/inc/fuarea.hxx new file mode 100644 index 0000000000..67115bd346 --- /dev/null +++ b/sd/source/ui/inc/fuarea.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuArea final : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + virtual void Activate() override; + virtual void Deactivate() override; + +private: + FuArea ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + virtual void DoExecute( SfxRequest& rReq ) override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fubullet.hxx b/sd/source/ui/inc/fubullet.hxx new file mode 100644 index 0000000000..2864e0e9fe --- /dev/null +++ b/sd/source/ui/inc/fubullet.hxx @@ -0,0 +1,54 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SfxItemSet; +class SfxViewFrame; + +namespace sd { + +class ViewShell; + +class FuBullet final : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + + static void GetSlotState( SfxItemSet& rSet, ViewShell const * pViewShell, SfxViewFrame* pViewFrame ); + +private: + FuBullet ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + void InsertSpecialCharacter( SfxRequest const & rReq ); + void InsertFormattingMark( sal_Unicode cMark ); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuchar.hxx b/sd/source/ui/inc/fuchar.hxx new file mode 100644 index 0000000000..27de223d73 --- /dev/null +++ b/sd/source/ui/inc/fuchar.hxx @@ -0,0 +1,49 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuChar final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + virtual void DoExecute( SfxRequest& rReq ) override; + + virtual void Activate() override; + virtual void Deactivate() override; + +private: + FuChar ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fucon3d.hxx b/sd/source/ui/inc/fucon3d.hxx new file mode 100644 index 0000000000..92c30d039b --- /dev/null +++ b/sd/source/ui/inc/fucon3d.hxx @@ -0,0 +1,61 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fuconstr.hxx" + +class E3dCompoundObject; +class E3dScene; +class SdDrawDocument; +class SfxRequest; + +namespace sd { + +class FuConstruct3dObject final + : public FuConstruct +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + +private: + FuConstruct3dObject ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + void ImpPrepareBasic3DShape(E3dCompoundObject const * p3DObj, E3dScene *pScene); + rtl::Reference<E3dCompoundObject> ImpCreateBasic3DShape(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconarc.hxx b/sd/source/ui/inc/fuconarc.hxx new file mode 100644 index 0000000000..263c56220c --- /dev/null +++ b/sd/source/ui/inc/fuconarc.hxx @@ -0,0 +1,54 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fuconstr.hxx" + +namespace sd { + +class FuConstructArc final + : public FuConstruct +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + +private: + FuConstructArc ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconbez.hxx b/sd/source/ui/inc/fuconbez.hxx new file mode 100644 index 0000000000..7827470b82 --- /dev/null +++ b/sd/source/ui/inc/fuconbez.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/uno/Any.hxx> +#include "fuconstr.hxx" + +class SdDrawDocument; + +namespace sd { + +class FuConstructBezierPolygon final + : public FuConstruct +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + virtual void SelectionHasChanged() override; + + void SetEditMode(sal_uInt16 nMode); + sal_uInt16 GetEditMode() const { return nEditMode; } + + /** + * set attribute for the object to be created + */ + void SetAttributes(SfxItemSet& rAttr, SdrObject* pObj); + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + +private: + FuConstructBezierPolygon ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + sal_uInt16 nEditMode; + css::uno::Any maTargets; // used for creating a path for custom animations + + //Extra attributes coming from parameters + sal_uInt16 mnTransparence; // Default: 0 + OUString msColor; // Default: "" + sal_uInt16 mnWidth; // Default: 0 + OUString msShapeName; // Default: "" +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconcs.hxx b/sd/source/ui/inc/fuconcs.hxx new file mode 100644 index 0000000000..cf63c214ed --- /dev/null +++ b/sd/source/ui/inc/fuconcs.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fuconstr.hxx" +#include <rtl/ustring.hxx> + +class SdDrawDocument; + +namespace sd { + +class FuConstructCustomShape final + : public FuConstruct +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + + void SetAttributes( SdrObject* pObj ); + const OUString& GetShapeType() const; + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + + // #i33136# + virtual bool doConstructOrthogonal() const override; + +private: + FuConstructCustomShape ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + OUString aCustomShape; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconnct.hxx b/sd/source/ui/inc/fuconnct.hxx new file mode 100644 index 0000000000..f8000e5bc7 --- /dev/null +++ b/sd/source/ui/inc/fuconnct.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuConnectionDlg + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuConnectionDlg ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconrec.hxx b/sd/source/ui/inc/fuconrec.hxx new file mode 100644 index 0000000000..a5230c5937 --- /dev/null +++ b/sd/source/ui/inc/fuconrec.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fuconstr.hxx" + +class SdDrawDocument; +class SfxItemSet; + +namespace sd { + +/** + * draw rectangle + */ +class FuConstructRectangle final + : public FuConstruct +{ +private: + //Extra attributes coming from parameters + sal_uInt16 mnFillTransparence; // Default: 0 + OUString msFillColor; // Default: "" + sal_uInt16 mnLineStyle; // Default: SAL_MAX_UINT16 + OUString msShapeName; // Default: "" + +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + void SetAttributes(SfxItemSet& rAttr, SdrObject* pObj); + void SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj); + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + +private: + FuConstructRectangle ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconstr.hxx b/sd/source/ui/inc/fuconstr.hxx new file mode 100644 index 0000000000..fd61046a14 --- /dev/null +++ b/sd/source/ui/inc/fuconstr.hxx @@ -0,0 +1,67 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fudraw.hxx" + +class SdrObject; +class SfxItemSet; + +namespace sd { + +class FuConstruct : public FuDraw +{ +public: + + // Mouse Events + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + virtual void SelectionHasChanged() override { bSelectionChanged = true; } + + // Without a preceding MouseButtonDown, a MouseButtonUp event should probably be ignored + bool IsIgnoreUnexpectedMouseButtonUp(); + + // SJ: setting stylesheet, the use of a filled or unfilled style + // is determined by the member nSlotId : + void SetStyleSheet(SfxItemSet& rAttr, SdrObject* pObj); + + // SJ: setting stylesheet, the use of a filled or unfilled style + // is determined by the parameters bUseFillStyle and bUseNoFillStyle : + void SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj, + const bool bUseFillStyle, const bool bUseNoFillStyle ); + +protected: + FuConstruct (ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +private: + bool bSelectionChanged; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuconuno.hxx b/sd/source/ui/inc/fuconuno.hxx new file mode 100644 index 0000000000..e31ff0a6b4 --- /dev/null +++ b/sd/source/ui/inc/fuconuno.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fuconstr.hxx" +#include <rtl/ustring.hxx> + +enum class SdrInventor : sal_uInt32; + +namespace sd { + +/** + * draw control + */ +class FuConstructUnoControl final + : public FuConstruct +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + +private: + FuConstructUnoControl( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + OUString aOldLayer; + SdrInventor nInventor; + SdrObjKind nIdentifier; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fucopy.hxx b/sd/source/ui/inc/fucopy.hxx new file mode 100644 index 0000000000..f751f42577 --- /dev/null +++ b/sd/source/ui/inc/fucopy.hxx @@ -0,0 +1,47 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuCopy final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuCopy ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fucushow.hxx b/sd/source/ui/inc/fucushow.hxx new file mode 100644 index 0000000000..005aea2181 --- /dev/null +++ b/sd/source/ui/inc/fucushow.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuCustomShowDlg + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuCustomShowDlg ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fudraw.hxx b/sd/source/ui/inc/fudraw.hxx new file mode 100644 index 0000000000..e1d25a5211 --- /dev/null +++ b/sd/source/ui/inc/fudraw.hxx @@ -0,0 +1,85 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +struct SdrViewEvent; +class SdrObject; + +namespace sd { + +/** + * Base class for all Draw specific functions + */ +class FuDraw + : public FuPoor +{ +public: + + virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + virtual bool RequestHelp(const HelpEvent& rHEvt) override; + + virtual void Activate() override; + + virtual void ForcePointer(const MouseEvent* pMEvt = nullptr); + + virtual void DoubleClick(const MouseEvent& rMEvt); + + bool SetPointer(const SdrObject* pObj, const Point& rPos); + bool SetHelpText(const SdrObject* pObj, const Point& rPos, const SdrViewEvent& rVEvt); + + void SetPermanent(bool bSet) { bPermanent = bSet; } + + /** is called when the current function should be aborted. <p> + This is used when a function gets a KEY_ESCAPE but can also + be called directly. + + @returns true if an active function was aborted + */ + virtual bool cancel() override; + +protected: + FuDraw (ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + virtual ~FuDraw() override; + + PointerStyle aNewPointer; + PointerStyle aOldPointer; + bool bMBDown; + bool bDragHelpLine; + sal_uInt16 nHelpLine; + bool bPermanent; + +private: + void DoModifiers(const MouseEvent& rMEvt, bool bSnapModPressed); + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fudspord.hxx b/sd/source/ui/inc/fudspord.hxx new file mode 100644 index 0000000000..2c6089442e --- /dev/null +++ b/sd/source/ui/inc/fudspord.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SdrDropMarkerOverlay; +class SdrObject; + +namespace sd { + +class FuDisplayOrder final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + // Mouse- & Key-Events + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + virtual void Deactivate() override; + +private: + virtual ~FuDisplayOrder() override; + void implClearOverlay(); + + PointerStyle maPtr; + SdrObject* mpRefObj; + std::unique_ptr<SdrDropMarkerOverlay> mpOverlay; + + FuDisplayOrder ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuediglu.hxx b/sd/source/ui/inc/fuediglu.hxx new file mode 100644 index 0000000000..19c32cefd1 --- /dev/null +++ b/sd/source/ui/inc/fuediglu.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fudraw.hxx" + +namespace sd { + +class FuEditGluePoints final + : public FuDraw +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + virtual bool Command(const CommandEvent& rCEvt) override; + virtual void ReceiveRequest(SfxRequest& rReq) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the position and draw the new insert point + virtual void ForcePointer(const MouseEvent* pMEvt = nullptr) override; + +private: + bool bBeginInsertPoint; + Point oldPoint; + + FuEditGluePoints ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + virtual ~FuEditGluePoints() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuexecuteinteraction.hxx b/sd/source/ui/inc/fuexecuteinteraction.hxx new file mode 100644 index 0000000000..9b1d095e69 --- /dev/null +++ b/sd/source/ui/inc/fuexecuteinteraction.hxx @@ -0,0 +1,44 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +#include <com/sun/star/media/XPlayer.hpp> + +namespace sd +{ +class FuExecuteInteraction final : public FuPoor +{ +public: + static rtl::Reference<FuPoor> Create(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, + SdDrawDocument* pDoc, SfxRequest& rReq); + virtual void DoExecute(SfxRequest& rReq) override; + +private: + FuExecuteInteraction(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, + SdDrawDocument* pDoc, SfxRequest& rReq); + + css::uno::Reference<css::media::XPlayer> mxPlayer; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuexpand.hxx b/sd/source/ui/inc/fuexpand.hxx new file mode 100644 index 0000000000..c710bd29c8 --- /dev/null +++ b/sd/source/ui/inc/fuexpand.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuExpandPage final + : public FuPoor +{ + public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuExpandPage ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuformatpaintbrush.hxx b/sd/source/ui/inc/fuformatpaintbrush.hxx new file mode 100644 index 0000000000..5c819372d7 --- /dev/null +++ b/sd/source/ui/inc/fuformatpaintbrush.hxx @@ -0,0 +1,61 @@ +/* -*- 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 . + */ + +#pragma once + +#include "futext.hxx" + +namespace sd { + +class DrawViewShell; + +class FuFormatPaintBrush final : public FuText +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + virtual bool KeyInput(const KeyEvent& rKEvt) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + static void GetMenuState( DrawViewShell const & rDrawViewShell, SfxItemSet &rSet ); + +private: + FuFormatPaintBrush ( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq); + + void DoExecute( SfxRequest& rReq ) override; + + bool HasContentForThisType( SdrInventor nObjectInventor, SdrObjKind nObjectIdentifier ) const; + void Paste( bool, bool ); + + void implcancel(); + + std::shared_ptr<SfxItemSet> mxItemSet; + bool mbPermanent; + bool mbOldIsQuickTextEditMode; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuhhconv.hxx b/sd/source/ui/inc/fuhhconv.hxx new file mode 100644 index 0000000000..a009b3023e --- /dev/null +++ b/sd/source/ui/inc/fuhhconv.hxx @@ -0,0 +1,58 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SdOutliner; + +namespace sd { + +class FuHangulHanjaConversion final : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + void StartConversion( LanguageType nSourceLanguage, LanguageType nTargetLanguage, + const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive ); + + void StartChineseConversion(); + + void ConvertStyles( LanguageType nTargetLanguage, const vcl::Font *pTargetFont ); + +private: + virtual ~FuHangulHanjaConversion() override; + + SdOutliner* pSdOutliner; + bool bOwnOutliner; + + FuHangulHanjaConversion ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq ); + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuinsert.hxx b/sd/source/ui/inc/fuinsert.hxx new file mode 100644 index 0000000000..d14ce69277 --- /dev/null +++ b/sd/source/ui/inc/fuinsert.hxx @@ -0,0 +1,112 @@ +/* -*- 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 . + */ + +#pragma once + +#include <config_features.h> +#include "fupoor.hxx" + +namespace sd { + +class FuInsertGraphic final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, + ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, + bool replaceExistingImage); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuInsertGraphic ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq, + bool replaceExistingImage); + + bool mbReplaceExistingImage; +}; + +/************************************************************************/ + +class FuInsertClipboard final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuInsertClipboard ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +/************************************************************************/ + +class FuInsertOLE final + : public FuPoor +{ + public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuInsertOLE ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +/************************************************************************/ + +class FuInsertAVMedia final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuInsertAVMedia ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + +#if HAVE_FEATURE_AVMEDIA + void InsertMediaURL(const OUString& rURL, const Size& rPrefSize, bool bLink); +#endif +}; +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuinsfil.hxx b/sd/source/ui/inc/fuinsfil.hxx new file mode 100644 index 0000000000..4dfec6603f --- /dev/null +++ b/sd/source/ui/inc/fuinsfil.hxx @@ -0,0 +1,60 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" +#include <vector> +#include <rtl/ustring.hxx> + +class SfxMedium; + +namespace sd { + +class FuInsertFile final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + + static void GetSupportedFilterVector( ::std::vector< OUString >& rFilterVector ); + +private: + FuInsertFile ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + OUString aLayoutName; ///< layout name of the currently inserted page + OUString aFilterName; ///< chosen file filter + OUString aFile; ///< chosen file name + + void InsTextOrRTFinOlMode(SfxMedium* pMedium); + bool InsSDDinOlMode(SfxMedium* pMedium); + void InsTextOrRTFinDrMode(SfxMedium* pMedium); + bool InsSDDinDrMode(SfxMedium* pMedium); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuline.hxx b/sd/source/ui/inc/fuline.hxx new file mode 100644 index 0000000000..db3d305376 --- /dev/null +++ b/sd/source/ui/inc/fuline.hxx @@ -0,0 +1,49 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuLine final + : public FuPoor +{ +public: + + virtual void Activate() override; + virtual void Deactivate() override; + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuLine ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fulinend.hxx b/sd/source/ui/inc/fulinend.hxx new file mode 100644 index 0000000000..775b4c14af --- /dev/null +++ b/sd/source/ui/inc/fulinend.hxx @@ -0,0 +1,49 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuLineEnd final + : public FuPoor +{ +public: + + virtual void Activate() override; + virtual void Deactivate() override; + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuLineEnd ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fulink.hxx b/sd/source/ui/inc/fulink.hxx new file mode 100644 index 0000000000..63e320208d --- /dev/null +++ b/sd/source/ui/inc/fulink.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuLink final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuLink ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq ); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fumeasur.hxx b/sd/source/ui/inc/fumeasur.hxx new file mode 100644 index 0000000000..dfa9ce9d3a --- /dev/null +++ b/sd/source/ui/inc/fumeasur.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuMeasureDlg final + : public FuPoor +{ + public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuMeasureDlg ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fumorph.hxx b/sd/source/ui/inc/fumorph.hxx new file mode 100644 index 0000000000..86c60cc068 --- /dev/null +++ b/sd/source/ui/inc/fumorph.hxx @@ -0,0 +1,90 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" +#include <basegfx/polygon/b2dpolypolygon.hxx> + +#include <vector> + +namespace basegfx { + class B2DPolygon; + class B2DPoint; +} + +namespace sd { + +class FuMorph final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + typedef ::std::vector< ::basegfx::B2DPolyPolygon > B2DPolyPolygonList_impl; + + FuMorph ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + void ImpInsertPolygons( + B2DPolyPolygonList_impl& rPolyPolyList3D, + bool bAttributeFade, + const SdrObject* pObj1, + const SdrObject* pObj2 + ); + + static ::basegfx::B2DPolyPolygon ImpCreateMorphedPolygon( + const ::basegfx::B2DPolyPolygon& rPolyPolyStart, + const ::basegfx::B2DPolyPolygon& rPolyPolyEnd, + double fMorphingFactor + ); + + static void ImpMorphPolygons( + const ::basegfx::B2DPolyPolygon& rPolyPoly1, + const ::basegfx::B2DPolyPolygon& rPolyPoly2, + const sal_uInt16 nSteps, + B2DPolyPolygonList_impl& rPolyPolyList3D + ); + + static void ImpAddPolys( + ::basegfx::B2DPolyPolygon& rSmaller, + const ::basegfx::B2DPolyPolygon& rBigger + ); + + static void ImpEqualizePolyPointCount( + ::basegfx::B2DPolygon& rSmall, + const ::basegfx::B2DPolygon& rBig + ); + + static sal_uInt32 ImpGetNearestIndex( + const ::basegfx::B2DPolygon& rPoly, + const ::basegfx::B2DPoint& rPos + ); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/funavig.hxx b/sd/source/ui/inc/funavig.hxx new file mode 100644 index 0000000000..a802b2f8bd --- /dev/null +++ b/sd/source/ui/inc/funavig.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuNavigation final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuNavigation ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuoaprms.hxx b/sd/source/ui/inc/fuoaprms.hxx new file mode 100644 index 0000000000..3e5432a4e0 --- /dev/null +++ b/sd/source/ui/inc/fuoaprms.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuObjectAnimationParameters final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuObjectAnimationParameters ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx new file mode 100644 index 0000000000..e10ab6b237 --- /dev/null +++ b/sd/source/ui/inc/fuolbull.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SdDrawDocument; +class SfxRequest; +class SfxItemSet; +class SfxPoolItem; +class SvxNumBulletItem; + +namespace sd { + +class View; +class ViewShell; + +/** + * bullet functions in outline mode + */ + +class FuBulletAndPosition final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuBulletAndPosition ( + ViewShell* pViewShell, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + void SetCurrentBulletsNumbering(SfxRequest& rReq); + + const SvxNumBulletItem* GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuoltext.hxx b/sd/source/ui/inc/fuoltext.hxx new file mode 100644 index 0000000000..288bcf190c --- /dev/null +++ b/sd/source/ui/inc/fuoltext.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SdDrawDocument; +class SfxRequest; + +namespace sd { + +class View; +class ViewShell; +class OutlineView; +class OutlineViewShell; + +/** + * text functions in outline mode + */ +class FuOutlineText final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + virtual bool Command(const CommandEvent& rCEvt) override; + + virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void DoCut() override; + virtual void DoCopy() override; + virtual void DoPaste() override; + virtual void DoPasteUnformatted() override; + + /** Call this method when the text in the outliner (may) has changed. + It will invalidate some slots of the view frame and update the + preview in the slide sorter. + */ + void UpdateForKeyPress (const KeyEvent& rEvent); + +private: + FuOutlineText ( + ViewShell* pViewShell, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + OutlineViewShell* pOutlineViewShell; + OutlineView* pOutlineView; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fupage.hxx b/sd/source/ui/inc/fupage.hxx new file mode 100644 index 0000000000..f3b30f3109 --- /dev/null +++ b/sd/source/ui/inc/fupage.hxx @@ -0,0 +1,73 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include "fupoor.hxx" +#include <vcl/weld.hxx> + +class SfxItemSet; +class SdBackgroundObjUndoAction; +class SdPage; + +namespace sd { +class DrawViewShell; + +class FuPage final + : public FuPoor +{ + public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + + virtual void Activate() override; + virtual void Deactivate() override; + + const SfxItemSet* ExecuteDialog(weld::Window* pParent, const SfxRequest& rReq); + +protected: + virtual ~FuPage() override; + +private: + FuPage ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq ); + + void ApplyItemSet( const SfxItemSet* pArgs ); + + SfxRequest& mrReq; + const SfxItemSet* mpArgs; + std::unique_ptr<SdBackgroundObjUndoAction> + mpBackgroundObjUndoAction; + Size maSize; + bool mbPageBckgrdDeleted; + bool mbMasterPage; + bool mbDisplayBackgroundTabPage; + SdPage* mpPage; + DrawViewShell* mpDrawViewShell; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuparagr.hxx b/sd/source/ui/inc/fuparagr.hxx new file mode 100644 index 0000000000..2c6908b6b6 --- /dev/null +++ b/sd/source/ui/inc/fuparagr.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuParagraph final + : public FuPoor +{ +public: + + virtual void Activate() override; + virtual void Deactivate() override; + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuParagraph ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx new file mode 100644 index 0000000000..e0103a111d --- /dev/null +++ b/sd/source/ui/inc/fupoor.hxx @@ -0,0 +1,179 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/timer.hxx> +#include <tools/link.hxx> +#include <tools/gen.hxx> +#include <vcl/vclptr.hxx> +#include <svx/svdobj.hxx> + +#include <helper/simplereferencecomponent.hxx> + +class SdDrawDocument; +class SfxRequest; +class CommandEvent; +class HelpEvent; +class KeyEvent; +class MouseEvent; + +namespace sd { + +class DrawDocShell; +class View; +class ViewShell; +class Window; + +/** + * Base class for all functions + */ +class FuPoor : public SimpleReferenceComponent +{ +public: + static const int HITPIX = 2; // hit tolerance in pixel + static const int HITLOG = 53; // hit tolerance in mm100 + static const int DRGLOG = 53; // minimal drag move in mm100 + + + virtual void DoExecute( SfxRequest& rReq ); + + void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; } + sal_uInt16 GetMouseButtonCode() const { return mnCode; } + + DrawDocShell* GetDocSh() { return mpDocSh; } + + virtual void DoCut(); + virtual void DoCopy(); + virtual void DoPaste(); + virtual void DoPasteUnformatted(); + + // mouse & key events; return value = sal_True: event has been handled + virtual bool KeyInput(const KeyEvent& rKEvt); + virtual bool MouseMove(const MouseEvent& ); + virtual bool MouseButtonUp(const MouseEvent& rMEvt); + + // moved from inline to *.cxx + virtual bool MouseButtonDown(const MouseEvent& rMEvt); + + virtual bool Command(const CommandEvent& rCEvt); + virtual bool RequestHelp(const HelpEvent& rHEvt); + virtual void ReceiveRequest(SfxRequest& rReq); + + virtual void Activate(); ///< activates the function + virtual void Deactivate(); ///< deactivates the function + + void SetWindow(::sd::Window* pWin); + + virtual void SelectionHasChanged(); + + sal_uInt16 GetSlotID() const { return nSlotId; } + + void StartDelayToScrollTimer (); + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle); + + /** is called when the current function should be aborted. <p> + This is used when a function gets a KEY_ESCAPE but can also + be called directly. + + @returns true if an active function was aborted + */ + virtual bool cancel(); + + // #i33136# + /** Decide if the object to be created should be created + orthogonal. Default implementation uses nSlotID + to decide. May be overridden to use other criteria + for this decision + + @returns true if the to be created object should be orthogonal. + */ + virtual bool doConstructOrthogonal() const; + +protected: + /** + @param pViewSh + May be NULL. + */ + FuPoor (ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + virtual ~FuPoor() override; + + DECL_LINK( DelayHdl, Timer *, void ); + + static void ImpForceQuadratic(::tools::Rectangle& rRect); + + /** Switch to another layer. The layer to switch to is specified by an + offset relative to the active layer. With respect to the layer bar + control at the lower left of the document window positive values + move to the right and negative values move to the left. + + <p>Switching the layer is independent of the view's layer mode. The + layers are switched even when the layer mode is turned off and the + layer control is not visible.</p> + @param nOffset + If the offset is positive skip that many layers in selecting the + next layer. If it is negative then select a previous one. An + offset or zero does not change the current layer. If the + resulting index lies outside the valid range of indices then it + is set to either the minimal or maximal valid index, whichever + is nearer. + */ + void SwitchLayer (sal_Int32 nOffset); + + ::sd::View* mpView; + ViewShell* mpViewShell; + VclPtr< ::sd::Window> mpWindow; + DrawDocShell* mpDocSh; + SdDrawDocument* mpDoc; + + sal_uInt16 nSlotId; + + Timer aScrollTimer; ///< for auto-scrolling + DECL_LINK( ScrollHdl, Timer *, void ); + void ForceScroll(const Point& aPixPos); + + Timer aDragTimer; ///< for Drag&Drop + DECL_LINK(DragHdl, Timer *, void); + bool bIsInDragMode; + Point aMDPos; ///< position of MouseButtonDown + + /// Flag to prevent auto-scrolling until one drags from outside into the window + bool bNoScrollUntilInside; + + /// timer to delay scrolling (~ 1 sec) when dragging out of the window + Timer aDelayToScrollTimer; + bool bScrollable; + bool bDelayActive; + bool bFirstMouseMove; + + /// member to hold state of the mouse buttons for creation of own MouseEvents (like in ScrollHdl) + +private: + sal_uInt16 mnCode; + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuprlout.hxx b/sd/source/ui/inc/fuprlout.hxx new file mode 100644 index 0000000000..1473eac53f --- /dev/null +++ b/sd/source/ui/inc/fuprlout.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SdDrawDocument; +class SfxRequest; + +namespace sd { + +class View; +class ViewShell; + +class FuPresentationLayout final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuPresentationLayout ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuprobjs.hxx b/sd/source/ui/inc/fuprobjs.hxx new file mode 100644 index 0000000000..bf0748d794 --- /dev/null +++ b/sd/source/ui/inc/fuprobjs.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SdDrawDocument; +class SfxRequest; + +namespace sd { + +class View; +class ViewShell; + +class FuPresentationObjects final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuPresentationObjects ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuscale.hxx b/sd/source/ui/inc/fuscale.hxx new file mode 100644 index 0000000000..64a606e4aa --- /dev/null +++ b/sd/source/ui/inc/fuscale.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuScale final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuScale ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fusearch.hxx b/sd/source/ui/inc/fusearch.hxx new file mode 100644 index 0000000000..7088dd776a --- /dev/null +++ b/sd/source/ui/inc/fusearch.hxx @@ -0,0 +1,56 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +class SvxSearchItem; +class SdOutliner; + +namespace sd { + +class FuSearch final : public FuPoor +{ +public: + + static FuSearch* createPtr(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq); + + virtual void DoExecute( SfxRequest& rReq ) override; + + void SearchAndReplace( const SvxSearchItem* pSearchItem ); + +private: + virtual ~FuSearch() override; + + SdOutliner* m_pSdOutliner; + bool m_bOwnOutliner; + + FuSearch ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fusel.hxx b/sd/source/ui/inc/fusel.hxx new file mode 100644 index 0000000000..3896a6d42f --- /dev/null +++ b/sd/source/ui/inc/fusel.hxx @@ -0,0 +1,104 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fudraw.hxx" + +namespace com::sun::star::media { class XPlayer; } + +class SdrHdl; +class SdrObject; + +namespace sd { + +class FuSelection final + : public FuDraw +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + + // Mouse- & Key-Events + virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; + + virtual void SelectionHasChanged() override; + + void SetEditMode(sal_uInt16 nMode); + sal_uInt16 GetEditMode() const { return nEditMode; } + + bool HandleImageMapClick(const SdrObject* pObj, const Point& rPos); + + /** is called when the current function should be aborted. <p> + This is used when a function gets a KEY_ESCAPE but can also + be called directly. + + @returns true if an active function was aborted + */ + virtual bool cancel() override; + + //let mouse cursor move + virtual void ForcePointer(const MouseEvent* pMEvt = nullptr) override; + +private: + FuSelection (ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + + virtual ~FuSelection() override; + + bool bTempRotation; + bool bSelectionChanged; + SdrHdl* pHdl; + bool bSuppressChangesOfSelection; + bool bMirrorSide0; + sal_uInt16 nEditMode; + + /** This pointer stores a candidate for assigning a style in the water + can mode between mouse button down and mouse button up. + */ + SdrObject* pWaterCanCandidate; + + /** Find the object under the given test point without selecting it. + @param rTestPoint + The coordinates at which to search for a shape. + @return + The shape at the test point. When there is no shape at this + position then NULL is returned. + */ + SdrObject* pickObject (const Point& rTestPoint); + //Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, + //and SHIFT+ENTER key to decide the position and draw the new insert point + bool bBeginInsertPoint; + Point oldPoint; + //let mouse cursor move + bool bMovedToCenterPoint; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fusldlg.hxx b/sd/source/ui/inc/fusldlg.hxx new file mode 100644 index 0000000000..57427cf69b --- /dev/null +++ b/sd/source/ui/inc/fusldlg.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuSlideShowDlg final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuSlideShowDlg ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fusnapln.hxx b/sd/source/ui/inc/fusnapln.hxx new file mode 100644 index 0000000000..cdddeec8d2 --- /dev/null +++ b/sd/source/ui/inc/fusnapln.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuSnapLine final + : public FuPoor +{ +public: + + virtual void Activate() override; + virtual void Deactivate() override; + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuSnapLine ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fusumry.hxx b/sd/source/ui/inc/fusumry.hxx new file mode 100644 index 0000000000..78ac3f00d8 --- /dev/null +++ b/sd/source/ui/inc/fusumry.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuSummaryPage final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuSummaryPage ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/futempl.hxx b/sd/source/ui/inc/futempl.hxx new file mode 100644 index 0000000000..df7ece35c6 --- /dev/null +++ b/sd/source/ui/inc/futempl.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuTemplate final + : public FuPoor +{ +public: + + virtual void Activate() override; + virtual void Deactivate() override; + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuTemplate ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/futext.hxx b/sd/source/ui/inc/futext.hxx new file mode 100644 index 0000000000..4ef6cc75df --- /dev/null +++ b/sd/source/ui/inc/futext.hxx @@ -0,0 +1,96 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fuconstr.hxx" +#include <svx/svdotext.hxx> +#include <unotools/weakref.hxx> + +class FontList; +class OutlinerView; + +namespace sd { + +/** + * Base class for text functions + */ +class FuText + : public FuConstruct +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + + virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + virtual bool RequestHelp(const HelpEvent& rHEvt) override; + virtual void ReceiveRequest(SfxRequest& rReq) override; + virtual void DoubleClick(const MouseEvent& rMEvt) override; + + virtual void Activate() override; ///< activates the function + virtual void Deactivate() override; ///< deactivates the function + + void SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag); + void DeleteDefaultText(); + SdrTextObj* GetTextObj() { return mxTextObj.get().get(); } + + virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; + + /** is called when the current function should be aborted. <p> + This is used when a function gets a KEY_ESCAPE but can also + be called directly. + + @returns true if an active function was aborted + */ + virtual bool cancel() override; + + static void ChangeFontSize( bool, OutlinerView*, const FontList*, ::sd::View* ); + + void InvalidateBindings(); + + +protected: + FuText (ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); + +private: + virtual void disposing() override; + + ::unotools::WeakReference<SdrTextObj> + mxTextObj; + bool bFirstObjCreated; + bool bJustEndedEdit; + + SfxRequest& rRequest; + + void ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj); + void ImpSetAttributesFitToSize(SdrTextObj* pTxtObj); + void ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/futhes.hxx b/sd/source/ui/inc/futhes.hxx new file mode 100644 index 0000000000..2310ae0e05 --- /dev/null +++ b/sd/source/ui/inc/futhes.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuThesaurus final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuThesaurus ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/futransf.hxx b/sd/source/ui/inc/futransf.hxx new file mode 100644 index 0000000000..08571108fc --- /dev/null +++ b/sd/source/ui/inc/futransf.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuTransform final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuTransform ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/futxtatt.hxx b/sd/source/ui/inc/futxtatt.hxx new file mode 100644 index 0000000000..e62d82be40 --- /dev/null +++ b/sd/source/ui/inc/futxtatt.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuTextAttrDlg final + : public FuPoor +{ + public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + FuTextAttrDlg ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuvect.hxx b/sd/source/ui/inc/fuvect.hxx new file mode 100644 index 0000000000..b408098f2b --- /dev/null +++ b/sd/source/ui/inc/fuvect.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +class FuVectorize final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + virtual void DoExecute( SfxRequest& rReq ) override; + +private: + + FuVectorize ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuzoom.hxx b/sd/source/ui/inc/fuzoom.hxx new file mode 100644 index 0000000000..54c352dd31 --- /dev/null +++ b/sd/source/ui/inc/fuzoom.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#pragma once + +#include "fupoor.hxx" + +namespace sd { + +extern const sal_uInt16 SidArrayZoom[]; + +class FuZoom final + : public FuPoor +{ +public: + + static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); + + // Mouse- & Key-Events + virtual bool MouseMove(const MouseEvent& rMEvt) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate() override; ///< activates the function + virtual void Deactivate() override; ///< deactivates the function + +private: + virtual ~FuZoom() override; + + Point aBeginPosPix; + Point aBeginPos; + Point aEndPos; + ::tools::Rectangle aZoomRect; + bool bVisible; + bool bStartDrag; + PointerStyle aPtr; + + FuZoom ( + ViewShell* pViewSh, + ::sd::Window* pWin, + ::sd::View* pView, + SdDrawDocument* pDoc, + SfxRequest& rReq); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx new file mode 100644 index 0000000000..626d721586 --- /dev/null +++ b/sd/source/ui/inc/gluectrl.hxx @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/InterimItemWindow.hxx> +#include <sfx2/tbxctrl.hxx> + +enum class SdrEscapeDirection; + +/** + * GluePointEscDirLB + */ +class GlueEscDirLB final : public InterimItemWindow +{ +private: + css::uno::Reference<css::frame::XFrame> m_xFrame; + std::unique_ptr<weld::ComboBox> m_xWidget; + + DECL_LINK(SelectHdl, weld::ComboBox&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + +public: + GlueEscDirLB(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame); + virtual void dispose() override; + virtual ~GlueEscDirLB() override; + + void set_active(int nPos) { m_xWidget->set_active(nPos); } + void set_sensitive(bool bSensitive); + + void Fill(); +}; + +/** + * Toolbox controller for glue-point escape direction + */ +class SdTbxCtlGlueEscDir final : public SfxToolBoxControl +{ +private: + static sal_uInt16 GetEscDirPos(SdrEscapeDirection nEscDir); + +public: + virtual void StateChangedAtToolBoxControl(sal_uInt16 nSId, SfxItemState eState, + const SfxPoolItem* pState) override; + virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; + + SFX_DECL_TOOLBOX_CONTROL(); + + SdTbxCtlGlueEscDir(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/headerfooterdlg.hxx b/sd/source/ui/inc/headerfooterdlg.hxx new file mode 100644 index 0000000000..0b96d0348b --- /dev/null +++ b/sd/source/ui/inc/headerfooterdlg.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/weld.hxx> + +#include <sdpage.hxx> + +class SdUndoGroup; + +namespace sd +{ +class ViewShell; + +class HeaderFooterTabPage; + +class HeaderFooterDialog : public weld::GenericDialogController +{ +private: + DECL_LINK( ActivatePageHdl, const OUString&, void ); + DECL_LINK( ClickApplyToAllHdl, weld::Button&, void ); + DECL_LINK( ClickApplyHdl, weld::Button&, void ); + DECL_LINK( ClickCancelHdl, weld::Button&, void ); + + HeaderFooterSettings maSlideSettings; + HeaderFooterSettings maNotesHandoutSettings; + + SdDrawDocument* mpDoc; + SdPage* mpCurrentPage; + ViewShell* mpViewShell; + + std::unique_ptr<weld::Notebook> mxTabCtrl; + std::unique_ptr<weld::Button> mxPBApplyToAll; + std::unique_ptr<weld::Button> mxPBApply; + std::unique_ptr<weld::Button> mxPBCancel; + std::unique_ptr<HeaderFooterTabPage> mxSlideTabPage; + std::unique_ptr<HeaderFooterTabPage> mxNotesHandoutsTabPage; + + void apply( bool bToAll, bool bForceSlides ); + void change( SdUndoGroup* pUndoGroup, SdPage* pPage, const HeaderFooterSettings& rNewSettings ); + +public: + HeaderFooterDialog(ViewShell* pViewShell, weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage); + virtual ~HeaderFooterDialog() override; + + void ApplyToAll(); + void Apply(); + + virtual short run() override; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/ins_paste.hxx b/sd/source/ui/inc/ins_paste.hxx new file mode 100644 index 0000000000..5031d09b03 --- /dev/null +++ b/sd/source/ui/inc/ins_paste.hxx @@ -0,0 +1,37 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> + +// SdInsertPasteDlg +class SdInsertPasteDlg : public weld::GenericDialogController +{ +private: + std::unique_ptr<weld::RadioButton> m_xRbBefore; + std::unique_ptr<weld::RadioButton> m_xRbAfter; + +public: + SdInsertPasteDlg(weld::Window* pWindow); + virtual ~SdInsertPasteDlg() override; + bool IsInsertBefore() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx new file mode 100644 index 0000000000..d906a10f77 --- /dev/null +++ b/sd/source/ui/inc/inspagob.hxx @@ -0,0 +1,57 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> + +class SdDrawDocument; +class SdPageObjsTLV; +class SfxMedium; + +class SdInsertPagesObjsDlg : public weld::GenericDialogController +{ +private: + SfxMedium* m_pMedium; + const SdDrawDocument* m_pDoc; + const OUString& m_rName; + + std::unique_ptr<SdPageObjsTLV> m_xLbTree; + std::unique_ptr<weld::CheckButton> m_xCbxLink; + std::unique_ptr<weld::CheckButton> m_xCbxMasters; + + void Reset(); + DECL_LINK(SelectObjectHdl, weld::TreeView&, void); + +public: + SdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc, + SfxMedium* pSfxMedium, const OUString& rFileName); + virtual ~SdInsertPagesObjsDlg() override; + + /** returns the list + nType == 0 -> pages + nType == 1 -> objects */ + + std::vector<OUString> GetList ( const sal_uInt16 nType ) ; + + bool IsLink() const; + bool IsRemoveUnnecessaryMasterPages() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/layeroptionsdlg.hxx b/sd/source/ui/inc/layeroptionsdlg.hxx new file mode 100644 index 0000000000..300994937c --- /dev/null +++ b/sd/source/ui/inc/layeroptionsdlg.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sddllapi.h> + +#include <vcl/weld.hxx> + +class SfxItemSet; + +class SD_DLLPUBLIC SdInsertLayerDlg : public weld::GenericDialogController +{ +private: + std::unique_ptr<weld::Entry> m_xEdtName; + std::unique_ptr<weld::Entry> m_xEdtTitle; + std::unique_ptr<weld::TextView> m_xEdtDesc; + std::unique_ptr<weld::CheckButton> m_xCbxVisible; + std::unique_ptr<weld::CheckButton> m_xCbxPrintable; + std::unique_ptr<weld::CheckButton> m_xCbxLocked; + std::unique_ptr<weld::Widget> m_xNameFrame; + +public: + + SdInsertLayerDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, + bool bDeletable, const OUString& rStr); + virtual ~SdInsertLayerDlg() override; + + void GetAttr( SfxItemSet& rOutAttrs ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/masterlayoutdlg.hxx b/sd/source/ui/inc/masterlayoutdlg.hxx new file mode 100644 index 0000000000..0acbb18d7b --- /dev/null +++ b/sd/source/ui/inc/masterlayoutdlg.hxx @@ -0,0 +1,61 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/weld.hxx> + +#include <pres.hxx> + +class SdDrawDocument; +class SdPage; + +namespace sd +{ + +class MasterLayoutDialog : public weld::GenericDialogController +{ +private: + SdDrawDocument* mpDoc; + SdPage* mpCurrentPage; + + std::unique_ptr<weld::CheckButton> mxCBDate; + std::unique_ptr<weld::CheckButton> mxCBPageNumber; + std::unique_ptr<weld::CheckButton> mxCBSlideNumber; + std::unique_ptr<weld::CheckButton> mxCBHeader; + std::unique_ptr<weld::CheckButton> mxCBFooter; + + bool mbOldHeader; + bool mbOldFooter; + bool mbOldDate; + bool mbOldPageNumber; + + void applyChanges(); + void remove( PresObjKind eKind ); + void create( PresObjKind eKind ); + +public: + MasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage); + virtual ~MasterLayoutDialog() override; + + virtual short run() override; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/morphdlg.hxx b/sd/source/ui/inc/morphdlg.hxx new file mode 100644 index 0000000000..77b20d718d --- /dev/null +++ b/sd/source/ui/inc/morphdlg.hxx @@ -0,0 +1,49 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> + +class SdrObject; + +namespace sd { + +class MorphDlg : public weld::GenericDialogController +{ +public: + MorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2); + virtual ~MorphDlg() override; + + void SaveSettings() const; + sal_uInt16 GetFadeSteps() const { return static_cast<sal_uInt16>(m_xMtfSteps->get_value()); } + bool IsAttributeFade() const { return m_xCbxAttributes->get_active(); } + bool IsOrientationFade() const { return m_xCbxOrientation->get_active(); } + +private: + std::unique_ptr<weld::SpinButton> m_xMtfSteps; + std::unique_ptr<weld::CheckButton> m_xCbxAttributes; + std::unique_ptr<weld::CheckButton> m_xCbxOrientation; + + void LoadSettings(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx new file mode 100644 index 0000000000..3e8ff9c28d --- /dev/null +++ b/sd/source/ui/inc/navigatr.hxx @@ -0,0 +1,209 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/ctrlitem.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <sfx2/navigat.hxx> +#include "sdtreelb.hxx" +#include <pres.hxx> + +// forward +namespace vcl { class Window; } + +namespace sd { +class DrawDocShell; +class SdNavigatorFloat; +} +class Menu; +class SdNavigatorControllerItem; +class SdPageNameControllerItem; + +enum class NavState { + NONE = 0x000000, + TableUpdate = 0x000100, + BtnFirstEnabled = 0x001000, + BtnFirstDisabled = 0x002000, + BtnPrevEnabled = 0x004000, + BtnPrevDisabled = 0x008000, + BtnLastEnabled = 0x010000, + BtnLastDisabled = 0x020000, + BtnNextEnabled = 0x040000, + BtnNextDisabled = 0x080000, +}; +namespace o3tl { + template<> struct typed_flags<NavState> : is_typed_flags<NavState, 0x0ff100> {}; +} + +class NavDocInfo +{ +public: + NavDocInfo() + : bName(false) + , bActive(false) + , mpDocShell(nullptr) + { + } + + bool HasName() const { return bName; } + bool IsActive() const { return bActive; } + + void SetName( bool bOn ) { bName = bOn; } + void SetActive( bool bOn ) { bActive = bOn; } + + ::sd::DrawDocShell* GetDrawDocShell() {return mpDocShell;} + +private: + friend class SdNavigatorWin; + bool bName : 1; + bool bActive : 1; + ::sd::DrawDocShell* mpDocShell; +}; + +namespace sd { + +class SdNavigatorFloat final : public SfxNavigator +{ +private: + std::unique_ptr<SdNavigatorWin> m_xNavWin; + bool m_bSetInitialFocusOnActivate; + +public: + SdNavigatorFloat(SfxBindings* _pBindings, SfxChildWindow* pMgr, + vcl::Window* pParent, SfxChildWinInfo* pInfo); + void InitTreeLB(const SdDrawDocument* pDoc); + void FreshTree(const SdDrawDocument* pDoc); + virtual void Activate() override; + virtual void dispose() override; + virtual ~SdNavigatorFloat() override; +}; + +} + +class SD_DLLPUBLIC SdNavigatorWin : public PanelLayout +{ +public: + typedef ::std::function<void ()> UpdateRequestFunctor; + + /** Create a new instance of the navigator. + @param bUseActiveUpdate + When <TRUE/>, the default, then the SdNavigatorWin object + will make a SID_NAVIGATOR_INIT call whenever it thinks an + update is necessary. When <FALSE/> the navigator will + rely on others to trigger updates. + */ + SdNavigatorWin(weld::Widget* pParent, SfxBindings* pBindings, SfxNavigator* pNavigatorDlg); + void SetUpdateRequestFunctor(const UpdateRequestFunctor& rUpdateRequest); + virtual ~SdNavigatorWin() override; + + void InitTreeLB( const SdDrawDocument* pDoc ); + void RefreshDocumentLB( const OUString* pDocName = nullptr ); + void FirstFocus(); + + bool InsertFile(const OUString& rFileName); + + NavigatorDragType GetNavigatorDragType(); + SdPageObjsTLV& GetObjects(); + +private: + friend class SdNavigatorFloat; + friend class SdNavigatorControllerItem; + friend class SdPageNameControllerItem; + + std::unique_ptr<weld::Toolbar> mxToolbox; + std::unique_ptr<SdPageObjsTLV> mxTlbObjects; + std::unique_ptr<weld::ComboBox> mxLbDocs; + std::unique_ptr<weld::Menu> mxDragModeMenu; + std::unique_ptr<weld::Menu> mxShapeMenu; + + VclPtr<SfxNavigator> mxNavigatorDlg; + + bool mbDocImported; + OUString maDropFileName; + NavigatorDragType meDragType; + std::vector<NavDocInfo> maDocList; + SfxBindings* mpBindings; + std::unique_ptr<SdNavigatorControllerItem> mpNavigatorCtrlItem; + std::unique_ptr<SdPageNameControllerItem> mpPageNameCtrlItem; + + /** This flag controls whether all shapes or only the named shapes are + shown. + */ + // bool mbShowAllShapes; + + static OUString GetDragTypeSdBmpId(NavigatorDragType eDT); + NavDocInfo* GetDocInfo(); + + DECL_DLLPRIVATE_LINK( SelectToolboxHdl, const OUString&, void ); + DECL_DLLPRIVATE_LINK( DropdownClickToolBoxHdl, const OUString&, void ); + DECL_DLLPRIVATE_LINK( ClickObjectHdl, weld::TreeView&, bool ); + DECL_DLLPRIVATE_LINK( SelectDocumentHdl, weld::ComboBox&, void ); + DECL_DLLPRIVATE_LINK( MenuSelectHdl, const OUString&, void ); + DECL_DLLPRIVATE_LINK( ShapeFilterCallback, const OUString&, void ); + DECL_DLLPRIVATE_LINK( KeyInputHdl, const KeyEvent&, bool ); + DECL_DLLPRIVATE_STATIC_LINK(SdNavigatorWin, MouseReleaseHdl, const MouseEvent&, bool); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + + void SetDragImage(); + + void ExecuteContextMenuAction(std::u16string_view rSelectedPopupEntry); + +public: + //when object is marked , fresh the corresponding entry tree . + void FreshTree ( const SdDrawDocument* pDoc ); + + virtual weld::Window* GetFrameWeld() const override; +}; + +/** + * ControllerItem for Navigator + */ +class SdNavigatorControllerItem final : public SfxControllerItem +{ +public: + SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + SdNavigatorWin::UpdateRequestFunctor aUpdateRequest); + +protected: + virtual void StateChangedAtToolBoxControl( sal_uInt16 nSId, SfxItemState eState, + const SfxPoolItem* pState ) override; + +private: + SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; +}; + +/** + * ControllerItem for Navigator to show the page in the TreeLB + */ +class SdPageNameControllerItem final : public SfxControllerItem +{ +public: + SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*); + +protected: + virtual void StateChangedAtToolBoxControl( sal_uInt16 nSId, SfxItemState eState, + const SfxPoolItem* pState ) override; + +private: + SdNavigatorWin* pNavigatorWin; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx new file mode 100644 index 0000000000..3a71f53186 --- /dev/null +++ b/sd/source/ui/inc/optsitem.hxx @@ -0,0 +1,575 @@ +/* -*- 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 . + */ + +#pragma once + +#include <unotools/configitem.hxx> +#include <sfx2/module.hxx> +#include <svx/optgrid.hxx> +#include <tools/degree.hxx> +#include <sddllapi.h> +#include <memory> + +class SdOptions; + +namespace sd { +class FrameView; +} + +class SdOptionsGeneric; + +class SD_DLLPUBLIC SdOptionsItem final : public ::utl::ConfigItem +{ + +private: + + const SdOptionsGeneric& mrParent; + + virtual void ImplCommit() override; + +public: + + SdOptionsItem( const SdOptionsGeneric& rParent, const OUString& rSubTree ); + virtual ~SdOptionsItem() override; + + SdOptionsItem(SdOptionsItem const &) = default; + SdOptionsItem(SdOptionsItem &&) = default; + SdOptionsItem & operator =(SdOptionsItem const &) = delete; // due to ConfigItem + SdOptionsItem & operator =(SdOptionsItem &&) = delete; // due to ConfigItem + + virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; + + css::uno::Sequence< css::uno::Any > GetProperties( const css::uno::Sequence< OUString >& rNames ); + bool PutProperties( const css::uno::Sequence< OUString >& rNames, + const css::uno::Sequence< css::uno::Any>& rValues ); + using ConfigItem::SetModified; +}; + +class SD_DLLPUBLIC SdOptionsGeneric +{ +friend class SdOptionsItem; + +private: + + OUString maSubTree; + std::unique_ptr<SdOptionsItem> + mpCfgItem; + bool mbImpress; + bool mbInit : 1; + bool mbEnableModify : 1; + + SAL_DLLPRIVATE void Commit( SdOptionsItem& rCfgItem ) const; + SAL_DLLPRIVATE css::uno::Sequence< OUString > GetPropertyNames() const; + +protected: + + void Init() const; + void OptionsChanged() { if( mpCfgItem && mbEnableModify ) mpCfgItem->SetModified(); } + +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const = 0; + virtual bool ReadData( const css::uno::Any* pValues ) = 0; + virtual bool WriteData( css::uno::Any* pValues ) const = 0; + +public: + + SdOptionsGeneric(bool bImpress, const OUString& rSubTree); + SdOptionsGeneric(SdOptionsGeneric const &); + virtual ~SdOptionsGeneric(); + + SdOptionsGeneric& operator=( SdOptionsGeneric const & ); + + bool IsImpress() const { return mbImpress; } + + void EnableModify( bool bModify ) { mbEnableModify = bModify; } + + void Store(); + + static bool isMetricSystem(); +}; + +class SD_DLLPUBLIC SdOptionsLayout : public SdOptionsGeneric +{ +private: + + bool bRuler; // Layout/Display/Ruler + bool bMoveOutline; // Layout/Display/Contour + bool bDragStripes; // Layout/Display/Guide + bool bHandlesBezier; // Layout/Display/Bezier + bool bHelplines; // Layout/Display/Helpline + sal_uInt16 nMetric; // Layout/Other/MeasureUnit + sal_uInt16 nDefTab; // Layout/Other/TabStop + +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + SdOptionsLayout(bool bImpress, bool bUseConfig); + + bool operator==( const SdOptionsLayout& rOpt ) const; + + bool IsRulerVisible() const { Init(); return bRuler; } + bool IsMoveOutline() const { Init(); return bMoveOutline; } + bool IsDragStripes() const { Init(); return bDragStripes; } + bool IsHandlesBezier() const { Init(); return bHandlesBezier; } + bool IsHelplines() const { Init(); return bHelplines; } + sal_uInt16 GetMetric() const { Init(); return( ( 0xffff == nMetric ) ? static_cast<sal_uInt16>(SfxModule::GetCurrentFieldUnit()) : nMetric ); } + sal_uInt16 GetDefTab() const { Init(); return nDefTab; } + + void SetRulerVisible( bool bOn ) { if( bRuler != bOn ) { OptionsChanged(); bRuler = bOn; } } + void SetMoveOutline( bool bOn ) { if( bMoveOutline != bOn ) { OptionsChanged(); bMoveOutline = bOn; } } + void SetDragStripes( bool bOn ) { if( bDragStripes != bOn ) { OptionsChanged(); bDragStripes = bOn; } } + void SetHandlesBezier( bool bOn ) { if( bHandlesBezier != bOn ) { OptionsChanged(); bHandlesBezier = bOn; } } + void SetHelplines( bool bOn ) { if( bHelplines != bOn ) { OptionsChanged(); bHelplines = bOn; } } + void SetMetric( sal_uInt16 nInMetric ) { if( nMetric != nInMetric ) { OptionsChanged(); nMetric = nInMetric; } } + void SetDefTab( sal_uInt16 nTab ) { if( nDefTab != nTab ) { OptionsChanged(); nDefTab = nTab; } } +}; + +class SD_DLLPUBLIC SdOptionsLayoutItem final : public SfxPoolItem +{ +public: + + explicit SdOptionsLayoutItem(); + SdOptionsLayoutItem( SdOptions const * pOpts, ::sd::FrameView const * pView ); + + virtual SdOptionsLayoutItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void SetOptions( SdOptions* pOpts ) const; + + SdOptionsLayout& GetOptionsLayout() { return maOptionsLayout; } +private: + SdOptionsLayout maOptionsLayout; +}; + +class SdOptionsContents : public SdOptionsGeneric +{ +private: +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + + SdOptionsContents(bool bImpress); + + bool operator==( const SdOptionsContents& rOpt ) const; +}; + +class SD_DLLPUBLIC SdOptionsMisc : public SdOptionsGeneric +{ +private: + + sal_Int32 nDefaultObjectSizeWidth; + sal_Int32 nDefaultObjectSizeHeight; + + bool bStartWithTemplate : 1; // Misc/NewDoc/AutoPilot + bool bMarkedHitMovesAlways : 1; // Misc/ObjectMoveable + bool bMoveOnlyDragging : 1; // Currently, not in use !!! + bool bCrookNoContortion : 1; // Misc/NoDistort + bool bQuickEdit : 1; // Misc/TextObject/QuickEditing + bool bMasterPageCache : 1; // Misc/BackgroundCache + bool bDragWithCopy : 1; // Misc/CopyWhileMoving + bool bPickThrough : 1; // Misc/TextObject/Selectable + bool bDoubleClickTextEdit : 1; // Misc/DclickTextedit + bool bClickChangeRotation : 1; // Misc/RotateClick + bool bSolidDragging : 1; // Misc/ModifyWithAttributes + bool bSummationOfParagraphs : 1; // misc/SummationOfParagraphs + bool bTabBarVisible : 1; // Misc/TabBarVisible + bool bShowUndoDeleteWarning : 1; // Misc/ShowUndoDeleteWarning + // #i75315# + bool bSlideshowRespectZOrder : 1; // Misc/SlideshowRespectZOrder + bool bShowComments : 1; // Misc/ShowComments + + bool bPreviewNewEffects; + bool bPreviewChangedEffects; + bool bPreviewTransitions; + + sal_Int32 mnDisplay; + + sal_Int32 mnPenColor; + double mnPenWidth; + + /** This value controls the device to use for formatting documents. + The currently supported values are 0 for the current printer or 1 + for the printer independent virtual device the can be retrieved from + the modules. + */ + sal_uInt16 mnPrinterIndependentLayout; // Misc/Compatibility/PrinterIndependentLayout + + /// Minimum mouse move distance for it to register as a drag action + sal_Int32 mnDragThresholdPixels; // Misc/DragThresholdPixels +// Misc + +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + + SdOptionsMisc(bool bImpress, bool bUseConfig); + + bool operator==( const SdOptionsMisc& rOpt ) const; + + bool IsStartWithTemplate() const { Init(); return bStartWithTemplate; } + bool IsMarkedHitMovesAlways() const { Init(); return bMarkedHitMovesAlways; } + bool IsMoveOnlyDragging() const { Init(); return bMoveOnlyDragging; } + bool IsCrookNoContortion() const { Init(); return bCrookNoContortion; } + bool IsQuickEdit() const { Init(); return bQuickEdit; } + bool IsMasterPagePaintCaching() const { Init(); return bMasterPageCache; } + bool IsDragWithCopy() const { Init(); return bDragWithCopy; } + bool IsPickThrough() const { Init(); return bPickThrough; } + bool IsDoubleClickTextEdit() const { Init(); return bDoubleClickTextEdit; } + bool IsClickChangeRotation() const { Init(); return bClickChangeRotation; } + bool IsSolidDragging() const { Init(); return bSolidDragging; } + bool IsSummationOfParagraphs() const { Init(); return bSummationOfParagraphs; }; + bool IsTabBarVisible() const { Init(); return bTabBarVisible; }; + + /** Return the currently selected printer independent layout mode. + @return + Returns 1 for printer independent layout enabled and 0 when it + is disabled. Other values are reserved for future use. + */ + sal_uInt16 GetPrinterIndependentLayout() const { Init(); return mnPrinterIndependentLayout; }; + bool IsShowUndoDeleteWarning() const { Init(); return bShowUndoDeleteWarning; } + bool IsSlideshowRespectZOrder() const { Init(); return bSlideshowRespectZOrder; } + sal_Int32 GetDefaultObjectSizeWidth() const { Init(); return nDefaultObjectSizeWidth; } + sal_Int32 GetDefaultObjectSizeHeight() const { Init(); return nDefaultObjectSizeHeight; } + + bool IsPreviewNewEffects() const { Init(); return bPreviewNewEffects; } + bool IsPreviewChangedEffects() const { Init(); return bPreviewChangedEffects; } + bool IsPreviewTransitions() const { Init(); return bPreviewTransitions; } + + sal_Int32 GetDisplay() const; + void SetDisplay( sal_Int32 nDisplay ); + + sal_Int32 GetPresentationPenColor() const { Init(); return mnPenColor; } + void SetPresentationPenColor( sal_Int32 nPenColor ) { if( mnPenColor != nPenColor ) { OptionsChanged(); mnPenColor = nPenColor; } } + + double GetPresentationPenWidth() const { Init(); return mnPenWidth; } + void SetPresentationPenWidth( double nPenWidth ) { if( mnPenWidth != nPenWidth ) { OptionsChanged(); mnPenWidth = nPenWidth; } } + + sal_Int32 GetDragThresholdPixels() const; + void SetDragThreshold(sal_Int32 nDragThresholdPixels); + + void SetStartWithTemplate( bool bOn ) { if( bStartWithTemplate != bOn ) { OptionsChanged(); bStartWithTemplate = bOn; } } + void SetMarkedHitMovesAlways( bool bOn ) { if( bMarkedHitMovesAlways != bOn ) { OptionsChanged(); bMarkedHitMovesAlways = bOn; } } + void SetMoveOnlyDragging( bool bOn ) { if( bMoveOnlyDragging != bOn ) { OptionsChanged(); bMoveOnlyDragging = bOn; } } + void SetCrookNoContortion( bool bOn ) { if( bCrookNoContortion != bOn ) { OptionsChanged(); bCrookNoContortion = bOn; } } + void SetQuickEdit( bool bOn ) { if( bQuickEdit != bOn ) { OptionsChanged(); bQuickEdit = bOn; } } + void SetMasterPagePaintCaching( bool bOn ) { if( bMasterPageCache != bOn ) { OptionsChanged(); bMasterPageCache = bOn; } } + void SetDragWithCopy( bool bOn ) { if( bDragWithCopy != bOn ) { OptionsChanged(); bDragWithCopy = bOn; } } + void SetPickThrough( bool bOn ) { if( bPickThrough != bOn ) { OptionsChanged(); bPickThrough = bOn; } } + void SetDoubleClickTextEdit( bool bOn ) { if( bDoubleClickTextEdit != bOn ) { OptionsChanged(); bDoubleClickTextEdit = bOn; } } + void SetClickChangeRotation( bool bOn ) { if( bClickChangeRotation != bOn ) { OptionsChanged(); bClickChangeRotation = bOn; } } + void SetSummationOfParagraphs( bool bOn ){ if ( bOn != bSummationOfParagraphs ) { OptionsChanged(); bSummationOfParagraphs = bOn; } } + void SetTabBarVisible( bool bOn ){ if ( bOn != bTabBarVisible ) { OptionsChanged(); bTabBarVisible = bOn; } } + /** Set the printer independent layout mode. + @param nOn + The default value is to switch printer independent layout on, + hence the parameters name. Use 0 for turning it off. Other + values are reserved for future use. + */ + void SetPrinterIndependentLayout (sal_uInt16 nOn ){ if ( nOn != mnPrinterIndependentLayout ) { OptionsChanged(); mnPrinterIndependentLayout = nOn; } } + void SetSolidDragging( bool bOn ) { if( bSolidDragging != bOn ) { OptionsChanged(); bSolidDragging = bOn; } } + void SetShowUndoDeleteWarning( bool bOn ) { if( bShowUndoDeleteWarning != bOn ) { OptionsChanged(); bShowUndoDeleteWarning = bOn; } } + void SetSlideshowRespectZOrder( bool bOn ) { if( bSlideshowRespectZOrder != bOn ) { OptionsChanged(); bSlideshowRespectZOrder = bOn; } } + void SetDefaultObjectSizeWidth( sal_Int32 nWidth ) { if( nDefaultObjectSizeWidth != nWidth ) { OptionsChanged(); nDefaultObjectSizeWidth = nWidth; } } + void SetDefaultObjectSizeHeight( sal_Int32 nHeight ) { if( nDefaultObjectSizeHeight != nHeight ) { OptionsChanged(); nDefaultObjectSizeHeight = nHeight; } } + + void SetPreviewNewEffects( bool bOn ) { if( bPreviewNewEffects != bOn ) { OptionsChanged(); bPreviewNewEffects = bOn; } } + void SetPreviewChangedEffects( bool bOn ) { if( bPreviewChangedEffects != bOn ) { OptionsChanged(); bPreviewChangedEffects = bOn; } } + void SetPreviewTransitions( bool bOn ) { if( bPreviewTransitions != bOn ) { OptionsChanged(); bPreviewTransitions = bOn; } } + + bool IsShowComments() const { Init(); return bShowComments; } + void SetShowComments( bool bShow ) { if( bShowComments != bShow ) { OptionsChanged(); bShowComments = bShow; } } +}; + +class SD_DLLPUBLIC SdOptionsMiscItem final : public SfxPoolItem +{ +public: + + explicit SdOptionsMiscItem(); + SdOptionsMiscItem( SdOptions const * pOpts, ::sd::FrameView const * pView ); + + virtual SdOptionsMiscItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void SetOptions( SdOptions* pOpts ) const; + + SdOptionsMisc& GetOptionsMisc() { return maOptionsMisc; } + const SdOptionsMisc& GetOptionsMisc() const { return maOptionsMisc; } +private: + SdOptionsMisc maOptionsMisc; +}; + +class SD_DLLPUBLIC SdOptionsSnap : public SdOptionsGeneric +{ +private: + + bool bSnapHelplines : 1; // Snap/Object/SnapLine + bool bSnapBorder : 1; // Snap/Object/PageMargin + bool bSnapFrame : 1; // Snap/Object/ObjectFrame + bool bSnapPoints : 1; // Snap/Object/ObjectPoint + bool bOrtho : 1; // Snap/Position/CreatingMoving + bool bBigOrtho : 1; // Snap/Position/ExtendEdges + bool bRotate : 1; // Snap/Position/Rotating + sal_Int16 nSnapArea; // Snap/Object/Range + Degree100 nAngle; // Snap/Position/RotatingValue + Degree100 nBezAngle; // Snap/Position/PointReduction + +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + + SdOptionsSnap(bool bImpress, bool bUseConfig); + + bool operator==( const SdOptionsSnap& rOpt ) const; + + bool IsSnapHelplines() const { Init(); return bSnapHelplines; } + bool IsSnapBorder() const { Init(); return bSnapBorder; } + bool IsSnapFrame() const { Init(); return bSnapFrame; } + bool IsSnapPoints() const { Init(); return bSnapPoints; } + bool IsOrtho() const { Init(); return bOrtho; } + bool IsBigOrtho() const { Init(); return bBigOrtho; } + bool IsRotate() const { Init(); return bRotate; } + sal_Int16 GetSnapArea() const { Init(); return nSnapArea; } + Degree100 GetAngle() const { Init(); return nAngle; } + Degree100 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; } + + void SetSnapHelplines( bool bOn ) { if( bSnapHelplines != bOn ) { OptionsChanged(); bSnapHelplines = bOn; } } + void SetSnapBorder( bool bOn ) { if( bSnapBorder != bOn ) { OptionsChanged(); bSnapBorder = bOn; } } + void SetSnapFrame( bool bOn ) { if( bSnapFrame != bOn ) { OptionsChanged(); bSnapFrame = bOn; } } + void SetSnapPoints( bool bOn ) { if( bSnapPoints != bOn ) { OptionsChanged(); bSnapPoints = bOn; } } + void SetOrtho( bool bOn ) { if( bOrtho != bOn ) { OptionsChanged(); bOrtho = bOn; } } + void SetBigOrtho( bool bOn ) { if( bBigOrtho != bOn ) { OptionsChanged(); bBigOrtho = bOn; } } + void SetRotate( bool bOn ) { if( bRotate != bOn ) { OptionsChanged(); bRotate = bOn; } } + void SetSnapArea( sal_Int16 nIn ) { if( nSnapArea != nIn ) { OptionsChanged(); nSnapArea = nIn; } } + void SetAngle( Degree100 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } } + void SetEliminatePolyPointLimitAngle( Degree100 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } } +}; + +class SD_DLLPUBLIC SdOptionsSnapItem final : public SfxPoolItem +{ +public: + + explicit SdOptionsSnapItem(); + SdOptionsSnapItem( SdOptions const * pOpts, ::sd::FrameView const * pView ); + + virtual SdOptionsSnapItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void SetOptions( SdOptions* pOpts ) const; + + SdOptionsSnap& GetOptionsSnap() { return maOptionsSnap; } +private: + SdOptionsSnap maOptionsSnap; +}; + +class SdOptionsZoom : public SdOptionsGeneric +{ +private: + + sal_Int32 nX; // Zoom/ScaleX + sal_Int32 nY; // Zoom/ScaleY + +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + + explicit SdOptionsZoom(bool bImpress); + + void GetScale( sal_Int32& rX, sal_Int32& rY ) const { Init(); rX = nX; rY = nY; } + void SetScale( sal_Int32 nInX, sal_Int32 nInY ) { if( nX != nInX || nY != nInY ) { OptionsChanged(); nX = nInX; nY = nInY; } } +}; + +class SdOptionsGrid : public SdOptionsGeneric, public SvxOptionsGrid +{ +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + + explicit SdOptionsGrid(bool bImpress); + virtual ~SdOptionsGrid() override; + + void SetDefaults(); + + sal_uInt32 GetFieldDrawX() const { Init(); return SvxOptionsGrid::GetFieldDrawX(); } + sal_uInt32 GetFieldDivisionX() const { Init(); return SvxOptionsGrid::GetFieldDivisionX(); } + sal_uInt32 GetFieldDrawY() const { Init(); return SvxOptionsGrid::GetFieldDrawY(); } + sal_uInt32 GetFieldDivisionY() const { Init(); return SvxOptionsGrid::GetFieldDivisionY(); } + bool IsUseGridSnap() const { Init(); return SvxOptionsGrid::GetUseGridSnap(); } + bool IsSynchronize() const { Init(); return SvxOptionsGrid::GetSynchronize(); } + bool IsGridVisible() const { Init(); return SvxOptionsGrid::GetGridVisible(); } + bool IsEqualGrid() const { Init(); return SvxOptionsGrid::GetEqualGrid(); } + + void SetFieldDrawX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDrawX() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDrawX( nSet ); } } + void SetFieldDivisionX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDivisionX() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDivisionX( nSet ); } } + void SetFieldDrawY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDrawY() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDrawY( nSet ); } } + void SetFieldDivisionY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDivisionY() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDivisionY( nSet ); } } + void SetUseGridSnap( bool bSet ) { if( bSet != SvxOptionsGrid::GetUseGridSnap() ) { OptionsChanged(); SvxOptionsGrid::SetUseGridSnap( bSet ); } } + void SetSynchronize( bool bSet ) { if( bSet != SvxOptionsGrid::GetSynchronize() ) { OptionsChanged(); SvxOptionsGrid::SetSynchronize( bSet ); } } + void SetGridVisible( bool bSet ) { if( bSet != SvxOptionsGrid::GetGridVisible() ) { OptionsChanged(); SvxOptionsGrid::SetGridVisible( bSet ); } } + void SetEqualGrid( bool bSet ) { if( bSet != SvxOptionsGrid::GetEqualGrid() ) { OptionsChanged(); SvxOptionsGrid::SetEqualGrid( bSet ); } } +}; + +class SdOptionsGridItem final : public SvxGridItem +{ + +public: + explicit SdOptionsGridItem( SdOptions const * pOpts ); + + void SetOptions( SdOptions* pOpts ) const; +}; + +class SD_DLLPUBLIC SdOptionsPrint : public SdOptionsGeneric +{ +private: + + bool bDraw : 1; // Print/Content/Drawing + bool bNotes : 1; // Print/Content/Note + bool bHandout : 1; // Print/Content/Handout + bool bOutline : 1; // Print/Content/Outline + bool bDate : 1; // Print/Other/Date + bool bTime : 1; // Print/Other/Time + bool bPagename : 1; // Print/Other/PageName + bool bHiddenPages : 1; // Print/Other/HiddenPage + bool bPagesize : 1; // Print/Page/PageSize + bool bPagetile : 1; // Print/Page/PageTile + bool bWarningPrinter : 1; // These flags you get + bool bWarningSize : 1; // from the common options, + bool bWarningOrientation : 1; // currently org.openoffice.Office.Common.xml (class OfaMiscCfg ; sfx2/misccfg.hxx ) + bool bBooklet : 1; // Print/Page/Booklet + bool bFront : 1; // Print/Page/BookletFront + bool bBack : 1; // Print/Page/BookletFront + bool bCutPage : 1; // NOT persistent !!! + bool bPaperbin : 1; // Print/Other/FromPrinterSetup + bool mbHandoutHorizontal : 1; // Order Page previews on Handout Pages horizontal + sal_uInt16 mnHandoutPages; // Number of page previews on handout page (only 1/2/4/6/9 are supported) + sal_uInt16 nQuality; // Print/Other/Quality + +protected: + + virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; + virtual bool ReadData( const css::uno::Any* pValues ) override; + virtual bool WriteData( css::uno::Any* pValues ) const override; + +public: + + SdOptionsPrint(bool bImpress, bool bUseConfig); + + bool operator==( const SdOptionsPrint& rOpt ) const; + + bool IsDraw() const { Init(); return bDraw; } + bool IsNotes() const { Init(); return bNotes; } + bool IsHandout() const { Init(); return bHandout; } + bool IsOutline() const { Init(); return bOutline; } + bool IsDate() const { Init(); return bDate; } + bool IsTime() const { Init(); return bTime; } + bool IsPagename() const { Init(); return bPagename; } + bool IsHiddenPages() const { Init(); return bHiddenPages; } + bool IsPagesize() const { Init(); return bPagesize; } + bool IsPagetile() const { Init(); return bPagetile; } + bool IsWarningPrinter() const { Init(); return bWarningPrinter; } + bool IsWarningSize() const { Init(); return bWarningSize; } + bool IsWarningOrientation() const { Init(); return bWarningOrientation; } + bool IsBooklet() const { Init(); return bBooklet; } + bool IsFrontPage() const { Init(); return bFront; } + bool IsBackPage() const { Init(); return bBack; } + bool IsCutPage() const { Init(); return bCutPage; } + bool IsPaperbin() const { Init(); return bPaperbin; } + sal_uInt16 GetOutputQuality() const { Init(); return nQuality; } + bool IsHandoutHorizontal() const { Init(); return mbHandoutHorizontal; } + sal_uInt16 GetHandoutPages() const { Init(); return mnHandoutPages; } + + void SetDraw( bool bOn ) { if( bDraw != bOn ) { OptionsChanged(); bDraw = bOn; } } + void SetNotes( bool bOn ) { if( bNotes != bOn ) { OptionsChanged(); bNotes = bOn; } } + void SetHandout( bool bOn ) { if( bHandout != bOn ) { OptionsChanged(); bHandout = bOn; } } + void SetOutline( bool bOn ) { if( bOutline != bOn ) { OptionsChanged(); bOutline = bOn; } } + void SetDate( bool bOn ) { if( bDate != bOn ) { OptionsChanged(); bDate = bOn; } } + void SetTime( bool bOn ) { if( bTime != bOn ) { OptionsChanged(); bTime = bOn; } } + void SetPagename( bool bOn ) { if( bPagename != bOn ) { OptionsChanged(); bPagename = bOn; } } + void SetHiddenPages( bool bOn ) { if( bHiddenPages != bOn ) { OptionsChanged(); bHiddenPages = bOn; } } + void SetPagesize( bool bOn ) { if( bPagesize != bOn ) { OptionsChanged(); bPagesize = bOn; } } + void SetPagetile( bool bOn ) { if( bPagetile != bOn ) { OptionsChanged(); bPagetile = bOn; } } + void SetWarningPrinter( bool bOn ) { if( bWarningPrinter != bOn ) { OptionsChanged(); bWarningPrinter = bOn; } } + void SetWarningSize( bool bOn ) { if( bWarningSize != bOn ) { OptionsChanged(); bWarningSize = bOn; } } + void SetWarningOrientation( bool bOn) { if( bWarningOrientation != bOn ) { OptionsChanged(); bWarningOrientation = bOn; } } + void SetBooklet( bool bOn ) { if( bBooklet != bOn ) { OptionsChanged(); bBooklet = bOn; } } + void SetFrontPage( bool bOn ) { if( bFront != bOn ) { OptionsChanged(); bFront = bOn; } } + void SetBackPage( bool bOn ) { if( bBack != bOn ) { OptionsChanged(); bBack = bOn; } } + void SetCutPage( bool bOn ) { if( bCutPage != bOn ) { OptionsChanged(); bCutPage = bOn; } } + void SetPaperbin( bool bOn ) { if( bPaperbin != bOn ) { OptionsChanged(); bPaperbin = bOn; } } + void SetOutputQuality( sal_uInt16 nInQuality ) { if( nQuality != nInQuality ) { OptionsChanged(); nQuality = nInQuality; } } + void SetHandoutHorizontal( bool bHandoutHorizontal ) { if( mbHandoutHorizontal != bHandoutHorizontal ) { OptionsChanged(); mbHandoutHorizontal = bHandoutHorizontal; } } + void SetHandoutPages( sal_uInt16 nHandoutPages ) { if( nHandoutPages != mnHandoutPages ) { OptionsChanged(); mnHandoutPages = nHandoutPages; } } +}; + +class SD_DLLPUBLIC SdOptionsPrintItem final : public SfxPoolItem +{ +public: + + explicit SdOptionsPrintItem(); + explicit SdOptionsPrintItem( SdOptions const * pOpts ); + + virtual SdOptionsPrintItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void SetOptions( SdOptions* pOpts ) const; + + SdOptionsPrint& GetOptionsPrint() { return maOptionsPrint; } + const SdOptionsPrint& GetOptionsPrint() const { return maOptionsPrint; } +private: + SdOptionsPrint maOptionsPrint; +}; + +class SdOptions final : public SdOptionsLayout, public SdOptionsContents, + public SdOptionsMisc, public SdOptionsSnap, + public SdOptionsZoom, public SdOptionsGrid, + public SdOptionsPrint +{ +public: + + explicit SdOptions(bool bImpress); + virtual ~SdOptions() override; + + void StoreConfig(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/paragr.hxx b/sd/source/ui/inc/paragr.hxx new file mode 100644 index 0000000000..cbdfda1019 --- /dev/null +++ b/sd/source/ui/inc/paragr.hxx @@ -0,0 +1,36 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> + +/** + * Paragraph-Tab-Dialog + */ +class SdParagraphDlg : public SfxTabDialogController +{ +private: + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; + +public: + SdParagraphDlg(weld::Window* pParent, const SfxItemSet* pAttr); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/pgjump.hxx b/sd/source/ui/inc/pgjump.hxx new file mode 100644 index 0000000000..c4d434caa2 --- /dev/null +++ b/sd/source/ui/inc/pgjump.hxx @@ -0,0 +1,31 @@ +/* -*- 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 . + */ + +#pragma once + +enum PageJump +{ + PAGE_NONE, + PAGE_FIRST, + PAGE_PREVIOUS, + PAGE_NEXT, + PAGE_LAST +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx new file mode 100644 index 0000000000..0d626bc234 --- /dev/null +++ b/sd/source/ui/inc/present.hxx @@ -0,0 +1,100 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> +#include <vcl/weldutils.hxx> + +class SfxItemSet; +class SdCustomShowList; + +/** + * Dialog to define optionsm_xnd to start the presentation + */ +class SdStartPresentationDlg : public weld::GenericDialogController +{ +private: + SdCustomShowList* pCustomShowList; + const SfxItemSet& rOutAttrs; + sal_Int32 mnMonitors; + + std::unique_ptr<weld::RadioButton> m_xRbtAll; + std::unique_ptr<weld::RadioButton> m_xRbtAtDia; + std::unique_ptr<weld::RadioButton> m_xRbtCustomshow; + std::unique_ptr<weld::ComboBox> m_xLbDias; + std::unique_ptr<weld::ComboBox> m_xLbCustomshow; + + std::unique_ptr<weld::RadioButton> m_xRbtStandard; + std::unique_ptr<weld::RadioButton> m_xRbtWindow; + std::unique_ptr<weld::RadioButton> m_xRbtAuto; + std::unique_ptr<weld::FormattedSpinButton> m_xTmfPause; + std::unique_ptr<weld::TimeFormatter> m_xFormatter; + std::unique_ptr<weld::CheckButton> m_xCbxAutoLogo; + + std::unique_ptr<weld::CheckButton> m_xCbxManuel; + std::unique_ptr<weld::CheckButton> m_xCbxMousepointer; + std::unique_ptr<weld::CheckButton> m_xCbxPen; + std::unique_ptr<weld::CheckButton> m_xCbxAnimationAllowed; + std::unique_ptr<weld::CheckButton> m_xCbxChangePage; + std::unique_ptr<weld::CheckButton> m_xCbxAlwaysOnTop; + std::unique_ptr<weld::CheckButton> m_xCbxShowNavigationButton; + std::unique_ptr<weld::ComboBox> m_xLbNavigationButtonsSize; + std::unique_ptr<weld::Label> m_xFtNavigationButtonsSize; + std::unique_ptr<weld::Frame> m_xFrameEnableRemote; + std::unique_ptr<weld::CheckButton> m_xCbxEnableRemote; + std::unique_ptr<weld::CheckButton> m_xCbxEnableRemoteInsecure; + + std::unique_ptr<weld::ComboBox> m_xLbConsole; + + std::unique_ptr<weld::Label> m_xFtMonitor; + std::unique_ptr<weld::ComboBox> m_xLBMonitor; + + std::unique_ptr<weld::Label> m_xMonitor; + std::unique_ptr<weld::Label> m_xAllMonitors; + std::unique_ptr<weld::Label> m_xMonitorExternal; + std::unique_ptr<weld::Label> m_xExternal; + + DECL_LINK(ChangeRemoteHdl, weld::Toggleable&, void); + DECL_LINK(ChangeRangeHdl, weld::Toggleable&, void); + DECL_LINK(ClickWindowPresentationHdl, weld::Toggleable&, void); + void ChangePause(); + DECL_LINK(ChangePauseHdl, weld::FormattedSpinButton&, void); + + void InitMonitorSettings(); + enum DisplayType { + EXTERNAL_IS_NUMBER, + MONITOR_NORMAL, + MONITOR_IS_EXTERNAL, + }; + sal_Int32 InsertDisplayEntry(const OUString &aName, + sal_Int32 nDisplay); + OUString GetDisplayName( sal_Int32 nDisplay, + DisplayType eType ); +public: + SdStartPresentationDlg(weld::Window* pWindow, + const SfxItemSet& rInAttrs, + const std::vector<OUString> &rPageNames, + SdCustomShowList* pCSList); + virtual ~SdStartPresentationDlg() override; + virtual short run() override; + void GetAttr( SfxItemSet& rOutAttrs ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx new file mode 100644 index 0000000000..ea1ef022b8 --- /dev/null +++ b/sd/source/ui/inc/prltempl.hxx @@ -0,0 +1,64 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> +#include <svx/xtable.hxx> + +#include <prlayout.hxx> + +class SfxObjectShell; +class SfxStyleSheetBase; +class SfxStyleSheetBasePool; + +/** + * Template-Tab-Dialog + */ +class SdPresLayoutTemplateDlg final : public SfxTabDialogController +{ +private: + const SfxObjectShell* mpDocShell; + + XColorListRef pColorTab; + XGradientListRef pGradientList; + XHatchListRef pHatchingList; + XBitmapListRef pBitmapList; + XPatternListRef pPatternList; + XDashListRef pDashList; + XLineEndListRef pLineEndList; + + PresentationObjects ePO; + + virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override; + + // for mapping with the new SvxNumBulletItem + SfxItemSet aInputSet; + std::unique_ptr<SfxItemSet> pOutSet; + + sal_uInt16 GetOutlineLevel() const; + +public: + SdPresLayoutTemplateDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, bool bBackground, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool); + virtual ~SdPresLayoutTemplateDlg() override; + + const SfxItemSet* GetOutputItemSet() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/prntopts.hxx b/sd/source/ui/inc/prntopts.hxx new file mode 100644 index 0000000000..2c391ae328 --- /dev/null +++ b/sd/source/ui/inc/prntopts.hxx @@ -0,0 +1,83 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> + +class SdPrintOptions final : public SfxTabPage +{ + friend class SdModule; + +private: + bool m_bDrawMode; + + std::unique_ptr<weld::Frame> m_xFrmContent; + std::unique_ptr<weld::CheckButton> m_xCbxDraw; + std::unique_ptr<weld::CheckButton> m_xCbxNotes; + std::unique_ptr<weld::CheckButton> m_xCbxHandout; + std::unique_ptr<weld::CheckButton> m_xCbxOutline; + std::unique_ptr<weld::RadioButton> m_xRbtColor; + std::unique_ptr<weld::RadioButton> m_xRbtGrayscale; + std::unique_ptr<weld::RadioButton> m_xRbtBlackWhite; + std::unique_ptr<weld::Widget> m_xRbQualityImg; + std::unique_ptr<weld::CheckButton> m_xCbxPagename; + std::unique_ptr<weld::Widget> m_xCbxPagenameImg; + std::unique_ptr<weld::CheckButton> m_xCbxDate; + std::unique_ptr<weld::Widget> m_xCbxDateImg; + std::unique_ptr<weld::CheckButton> m_xCbxTime; + std::unique_ptr<weld::Widget> m_xCbxTimeImg; + std::unique_ptr<weld::CheckButton> m_xCbxHiddenPages; + std::unique_ptr<weld::Widget> m_xCbxHiddenPagesImg; + std::unique_ptr<weld::RadioButton> m_xRbtDefault; + std::unique_ptr<weld::RadioButton> m_xRbtPagesize; + std::unique_ptr<weld::RadioButton> m_xRbtPagetile; + std::unique_ptr<weld::RadioButton> m_xRbtBooklet; + std::unique_ptr<weld::Widget> m_xGridPageOpt; + std::unique_ptr<weld::Widget> m_xRbtPageOptImg; + std::unique_ptr<weld::CheckButton> m_xCbxFront; + std::unique_ptr<weld::Widget> m_xCbxFrontImg; + std::unique_ptr<weld::CheckButton> m_xCbxBack; + std::unique_ptr<weld::Widget> m_xCbxBackImg; + std::unique_ptr<weld::CheckButton> m_xCbxPaperbin; + std::unique_ptr<weld::Widget> m_xCbxPaperbinImg; + + DECL_LINK(ClickCheckboxHdl, weld::Toggleable&, void); + DECL_LINK(ClickBookletHdl, weld::Toggleable&, void); + + void updateControls(); + +public: + SdPrintOptions(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rInAttrs); + virtual ~SdPrintOptions() override; + + static std::unique_ptr<SfxTabPage> + Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*); + + virtual OUString GetAllStrings() override; + + virtual bool FillItemSet(SfxItemSet*) override; + virtual void Reset(const SfxItemSet*) override; + + void SetDrawMode(); + virtual void PageCreated(const SfxAllItemSet& aSet) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/registerinterfaces.hxx b/sd/source/ui/inc/registerinterfaces.hxx new file mode 100644 index 0000000000..5a8be7dc07 --- /dev/null +++ b/sd/source/ui/inc/registerinterfaces.hxx @@ -0,0 +1,30 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> +#include <sfx2/module.hxx> + +namespace sd::ui::table +{ +void RegisterInterfaces(const SfxModule* pMod); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/scalectrl.hxx b/sd/source/ui/inc/scalectrl.hxx new file mode 100644 index 0000000000..2a0ed5b28e --- /dev/null +++ b/sd/source/ui/inc/scalectrl.hxx @@ -0,0 +1,39 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/stbitem.hxx> + +class SdScaleControl final : public SfxStatusBarControl +{ +public: + SdScaleControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb); + virtual ~SdScaleControl() override; + + virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + + SFX_DECL_STATUSBAR_CONTROL(); + +private: + virtual void Command(const CommandEvent& rCEvt) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/sdpopup.hxx b/sd/source/ui/inc/sdpopup.hxx new file mode 100644 index 0000000000..0eccc914d4 --- /dev/null +++ b/sd/source/ui/inc/sdpopup.hxx @@ -0,0 +1,47 @@ +/* -*- 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 . + */ + +#pragma once + +#include <i18nlangtag/lang.h> +#include <vcl/weld.hxx> + +class SvxFieldData; + +/** + * PopupMenu for editing field-commands + */ +class SdFieldPopup +{ +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Menu> m_xPopup; + const SvxFieldData* m_pField; + + void Fill( LanguageType eLanguage ); + +public: + SdFieldPopup(const SvxFieldData* pInField, LanguageType eLanguage); + void Execute(weld::Window* pParent, const tools::Rectangle& rRect); + ~SdFieldPopup(); + + SvxFieldData* GetField(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/sdpreslt.hxx b/sd/source/ui/inc/sdpreslt.hxx new file mode 100644 index 0000000000..2e87b66840 --- /dev/null +++ b/sd/source/ui/inc/sdpreslt.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vector> + +#include <vcl/weld.hxx> + +class SfxItemSet; +class ValueSet; +namespace weld { class CustomWeld; } + +namespace sd { +class DrawDocShell; +} + +class SdPresLayoutDlg final + : public weld::GenericDialogController +{ +public: + SdPresLayoutDlg( + ::sd::DrawDocShell* pDocShell, + weld::Window* pWindow, + const SfxItemSet& rInAttrs); + virtual ~SdPresLayoutDlg() override; + + void GetAttr(SfxItemSet& rOutAttrs); + + DECL_LINK(ClickLayoutHdl, ValueSet*, void); + DECL_LINK(ClickLoadHdl, weld::Button&, void); + +private: + ::sd::DrawDocShell* mpDocSh; + + const SfxItemSet& mrOutAttrs; + + std::vector<OUString> maLayoutNames; + + OUString maName; ///< layout name or file name + tools::Long mnLayoutCount; ///< number of master pages in the document + const OUString maStrNone; + + std::unique_ptr<weld::CheckButton> m_xCbxMasterPage; + std::unique_ptr<weld::CheckButton> m_xCbxCheckMasters; + std::unique_ptr<weld::Button> m_xBtnLoad; + std::unique_ptr<ValueSet> m_xVS; + std::unique_ptr<weld::CustomWeld> m_xVSWin; + std::unique_ptr<weld::Label> m_xLabel; + + void FillValueSet(); + void Reset(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx new file mode 100644 index 0000000000..1f6026b557 --- /dev/null +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -0,0 +1,455 @@ +/* -*- 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 . + */ + +#pragma once + +#include <pres.hxx> +#include <sddllapi.h> +#include <vcl/weld.hxx> +#include <svl/urlbmk.hxx> +#include <tools/ref.hxx> +#include "sdxfer.hxx" +#include <memory> +#include <vector> + +class SdrView; +class SdDrawDocument; +class SfxMedium; +class SfxViewFrame; +class SdNavigatorWin; +class SdrObject; +class SdrObjList; +class SdPage; +struct ImplSVEvent; + +namespace sd { +class ViewShell; + +class DrawDocShell; +#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED +#define SV_DECL_DRAW_DOC_SHELL_DEFINED +typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef; +#endif +} +namespace svt { + class AcceleratorExecute; +} + +class SdPageObjsTLVDropTarget final : public DropTargetHelper +{ +private: + weld::TreeView& m_rTreeView; + SdrView* m_pSdrView; + bool m_bOrderFrontToBack = false; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + SdPageObjsTLVDropTarget(weld::TreeView& rTreeView); + + void SetDrawView(SdrView* pSdrView) { m_pSdrView = pSdrView; } + void SetOrderFrontToBack(bool bSet) { m_bOrderFrontToBack = bSet; } +}; + +class SD_DLLPUBLIC SdPageObjsTLV +{ +private: + static bool SAL_DLLPRIVATE bIsInDrag; ///< static, in the case the navigator is deleted in ExecuteDrag + + std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; + std::unique_ptr<SdPageObjsTLVDropTarget> m_xDropTargetHelper; + std::unique_ptr<::svt::AcceleratorExecute> m_xAccel; + SdNavigatorWin* m_pNavigator; + const SdDrawDocument* m_pDoc; + SdDrawDocument* m_pBookmarkDoc; + SfxMedium* m_pMedium; + SfxMedium* m_pOwnMedium; + bool m_bLinkableSelected; + bool m_bShowAllShapes; + bool m_bOrderFrontToBack; + + /** This flag controls whether to show all pages. + */ + bool m_bShowAllPages; + + /** + * If changing the selection should also result in navigating to the + * relevant shape. + */ + bool m_bSelectionHandlerNavigates; + + /** + * If navigation should not only select the relevant shape but also change + * focus to it. + */ + bool m_bNavigationGrabsFocus; + + bool m_bMouseReleased = true; // hack for x11 inplace editing + bool m_bEditing = false; + + SelectionMode m_eSelectionMode; + + ImplSVEvent* m_nSelectEventId; + ImplSVEvent* m_nRowActivateEventId; + + OUString m_aDocName; + ::sd::DrawDocShellRef m_xBookmarkDocShRef; ///< for the loading of bookmarks + Link<weld::TreeView&, void> m_aChangeHdl; + Link<weld::TreeView&, bool> m_aRowActivatedHdl; + Link<const KeyEvent&, bool> m_aKeyPressHdl; + Link<const MouseEvent&, bool> m_aMouseReleaseHdl; + Link<const CommandEvent&, bool> m_aPopupMenuHdl; + + /** Return the name of the object. When the object has no user supplied + name and the bCreate flag is <TRUE/> then a name is created + automatically. Additionally the mbShowAllShapes flag is taken into + account when there is no user supplied name. When this flag is + <FALSE/> then no name is created. + @param pObject + When this is NULL then an empty string is returned, regardless + of the value of bCreate. + @param bCreate + This flag controls for objects without user supplied name + whether a name is created. When a name is created then this + name is not stored in the object. + */ + OUString GetObjectName ( + const SdrObject* pObject, + const bool bCreate = true) const; + + void CloseBookmarkDoc(); + + DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool); + DECL_DLLPRIVATE_LINK(SelectHdl, weld::TreeView&, void); + DECL_DLLPRIVATE_LINK(AsyncSelectHdl, void*, void); + DECL_DLLPRIVATE_LINK(RowActivatedHdl, weld::TreeView&, bool); + DECL_DLLPRIVATE_LINK(AsyncRowActivatedHdl, void*, void); + DECL_DLLPRIVATE_LINK(DragBeginHdl, bool&, bool); + DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool); + + DECL_LINK(EditingEntryHdl, const weld::TreeIter&, bool); + typedef std::pair<const weld::TreeIter&, OUString> IterString; + DECL_LINK(EditedEntryHdl, const IterString&, bool); + DECL_LINK(EditEntryAgain, void*, void); + + DECL_LINK(CommandHdl, const CommandEvent&, bool); + + /** Determine whether the specified page belongs to the current show + which is either the standard show or a custom show. + @param pPage + Pointer to the page for which to check whether it belongs to the + show. + @return + Returns <FALSE/> if there is no custom show or if the current + show does not contain the specified page at least once. + */ + bool PageBelongsToCurrentShow (const SdPage* pPage) const; + + bool DoDrag(); + static void OnDragFinished(); + + // DragSourceHelper + bool StartDrag(); + +public: + + SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeview); + ~SdPageObjsTLV(); + + bool IsEditingActive() const {return m_bEditing;} + + void set_sensitive(bool bSensitive) + { + m_xTreeView->set_sensitive(bSensitive); + } + + void hide() + { + m_xTreeView->hide(); + } + + void show() + { + m_xTreeView->show(); + } + + void grab_focus() + { + m_xTreeView->grab_focus(); + } + + void set_size_request(int nWidth, int nHeight) + { + m_xTreeView->set_size_request(nWidth, nHeight); + } + + float get_approximate_digit_width() const + { + return m_xTreeView->get_approximate_digit_width(); + } + + DECL_LINK(MousePressHdl, const MouseEvent&, bool); + DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool); + + void Select(); + + int get_height_rows(int nRows) const + { + return m_xTreeView->get_height_rows(nRows); + } + + void set_selection_mode(SelectionMode eMode) + { + m_eSelectionMode = eMode; + m_xTreeView->set_selection_mode(eMode); + } + + SelectionMode get_selection_mode() const + { + return m_eSelectionMode; + } + + void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) + { + m_aRowActivatedHdl = rLink; + } + + void connect_key_press(const Link<const KeyEvent&, bool>& rLink) + { + m_aKeyPressHdl = rLink; + } + + void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink) + { + m_aMouseReleaseHdl = rLink; + } + + void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink) + { + m_aPopupMenuHdl = rLink; + } + + bool HasSelectedChildren(std::u16string_view rName); + bool SelectEntry(std::u16string_view rName); + void SelectEntry(const SdrObject* pObj); + + OUString get_selected_text() const + { + return m_xTreeView->get_selected_text(); + } + + bool get_selected() const + { + return m_xTreeView->get_selected(nullptr); + } + + int count_selected_rows() const + { + return m_xTreeView->count_selected_rows(); + } + + void connect_changed(const Link<weld::TreeView&, void>& rLink) + { + m_aChangeHdl = rLink; + } + + bool is_selected(const weld::TreeIter& rIter) const + { + return m_xTreeView->is_selected(rIter); + } + + bool get_iter_first(weld::TreeIter& rIter) const + { + return m_xTreeView->get_iter_first(rIter); + } + + weld::TreeView& get_treeview() + { + return *m_xTreeView; + } + + std::unique_ptr<weld::TreeIter> make_iterator() + { + return m_xTreeView->make_iterator(); + } + + bool get_visible() const + { + return m_xTreeView->get_visible(); + } + + void unselect_all() + { + m_xTreeView->unselect_all(); + } + + OUString get_cursor_text() const + { + std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator()); + if (m_xTreeView->get_cursor(xIter.get())) + return m_xTreeView->get_text(*xIter); + return OUString(); + } + + OUString get_cursor_id() const + { + std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator()); + if (m_xTreeView->get_cursor(xIter.get())) + return m_xTreeView->get_id(*xIter); + return OUString(); + } + + void SetViewFrame(const SfxViewFrame* pViewFrame); + + void Fill(const SdDrawDocument*, bool bAllPages, const OUString& rDocName); + void Fill(const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName); + + void SetShowAllShapes (const bool bShowAllShapes, const bool bFill); + bool GetShowAllShapes() const { return m_bShowAllShapes; } + + void SetOrderFrontToBack (const bool bOrderFrontToBack); + bool GetOrderFrontToBack() const { return m_bOrderFrontToBack; } + + bool IsNavigationGrabsFocus() const { return m_bNavigationGrabsFocus; } + bool IsEqualToDoc(const SdDrawDocument* pInDoc); + /// Visits rList recursively and tries to advance rEntry accordingly. + bool IsEqualToShapeList(std::unique_ptr<weld::TreeIter>& rEntry, const SdrObjList& rList, + std::u16string_view rListName); + + static bool IsInDrag(); + + /** Return the view shell that is linked to the given doc shell. + Call this method when the there is a chance that the doc shell + has been disconnected from the view shell (but not the other + way round.) + @return + May return <NULL/> when the link between view shell and + doc shell has been severed. + */ + static ::sd::ViewShell* GetViewShellForDocShell (::sd::DrawDocShell &rDocShell); + + /** Add one list box entry for the parent of the given shapes and one child entry for + each of the given shapes. + @param rList + The container of shapes that are to be inserted. + @param pShape + The parent shape or NULL when the parent is a page. + @param rsName + The name to be displayed for the new parent node. + @param bIsExcluded + Some pages can be excluded (from the show?). + @param pParentEntry + The parent entry of the new parent entry. + */ + void AddShapeList ( + const SdrObjList& rList, + const SdrObject* pShape, + const OUString& rsName, + const bool bIsExcluded, + const weld::TreeIter* pParentEntry); + + /** Add the given object to a transferable object so that the object can + be dragged and dropped without having a name. + */ + void AddShapeToTransferable ( + SdTransferable& rTransferable, + const SdrObject& rObject) const; + + /** return selected entries + nDepth == 0 -> pages + nDepth == 1 -> objects */ + + std::vector<OUString> GetSelectEntryList(const int nDepth) const; + + std::vector<OUString> GetSelectedEntryIds() const; + + SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = nullptr); + + bool IsLinkableSelected() const { return m_bLinkableSelected; } + + void InsertEntry(const OUString &rName, const OUString &rExpander) + { + m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, rExpander); + } + + void InsertEntry(const weld::TreeIter* pParent, const OUString& rId, const OUString &rName, const OUString &rExpander, weld::TreeIter* pEntry = nullptr) + { + if (pParent) + m_xTreeView->insert(pParent, m_bOrderFrontToBack ? 0 : -1, &rName, &rId, nullptr, + nullptr, false, m_xScratchIter.get()); + else + // always append page/slide entry + m_xTreeView->insert(nullptr, -1, &rName, &rId, nullptr, nullptr, false, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, rExpander); + if (pEntry) + m_xTreeView->copy_iterator(*m_xScratchIter, *pEntry); + } + + //Mark Current Entry + void SetSdNavigator(SdNavigatorWin* pNavigator); + + void clear() + { + m_xTreeView->clear(); + } + + // nested class to implement the TransferableHelper + class SAL_DLLPRIVATE SdPageObjsTransferable final : public SdTransferable + { + public: + SdPageObjsTransferable( + INetBookmark aBookmark, + ::sd::DrawDocShell& rDocShell, + NavigatorDragType eDragType ); + ::sd::DrawDocShell& GetDocShell() const { return mrDocShell;} + NavigatorDragType GetDragType() const { return meDragType;} + + static SdPageObjsTransferable* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) noexcept; + /** Return a temporary transferable data flavor that is used + internally in the navigator for reordering entries. Its + lifetime ends with the office application. + */ + static SotClipboardFormatId GetListBoxDropFormatId(); + + private: + /** Temporary drop flavor id that is used internally in the + navigator. + */ + static SotClipboardFormatId mnListBoxDropFormatId; + + INetBookmark const maBookmark; + ::sd::DrawDocShell& mrDocShell; + NavigatorDragType const meDragType; + virtual ~SdPageObjsTransferable() override; + + virtual void AddSupportedFormats() override; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; + virtual void DragFinished( sal_Int8 nDropAction ) override; + }; + + friend class SdPageObjsTLV::SdPageObjsTransferable; + +private: + rtl::Reference<SdPageObjsTransferable> m_xHelper; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/sdundogr.hxx b/sd/source/ui/inc/sdundogr.hxx new file mode 100644 index 0000000000..466182faf4 --- /dev/null +++ b/sd/source/ui/inc/sdundogr.hxx @@ -0,0 +1,46 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sdundo.hxx> +#include <sddllapi.h> + +#include <memory> +#include <vector> + +class SD_DLLPUBLIC SdUndoGroup final : public SdUndoAction +{ + std::vector<std::unique_ptr<SdUndoAction>> aCtn; +public: + SdUndoGroup(SdDrawDocument* pSdDrawDocument) + : SdUndoAction(pSdDrawDocument) + {} + virtual ~SdUndoGroup() override; + + virtual bool Merge( SfxUndoAction* pNextAction ) override; + + virtual void Undo() override; + virtual void Redo() override; + + void AddAction(SdUndoAction* pAction); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx new file mode 100644 index 0000000000..d6d382870d --- /dev/null +++ b/sd/source/ui/inc/sdxfer.hxx @@ -0,0 +1,145 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/graph.hxx> +#include <vcl/transfer.hxx> +#include <vcl/vclptr.hxx> +#include <sfx2/objsh.hxx> +#include <svl/lstner.hxx> +#include <svl/urlbmk.hxx> + +// SdTransferable +class SdDrawDocument; +class SdrObject; +class ImageMap; +class VirtualDevice; + +namespace sd { +class DrawDocShell; +class View; +} + +class SAL_DLLPUBLIC_RTTI SdTransferable : public TransferDataContainer, public SfxListener +{ +public: + + SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, bool bInitOnGetData ); + virtual ~SdTransferable() override; + + void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; } + const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; } + + void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = const_cast<SdDrawDocument*>(pWorkDoc); } + const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; } + + void SetView(const ::sd::View* pView); + const ::sd::View* GetView() const { return mpSdView; } + + void SetObjectDescriptor( std::unique_ptr<TransferableObjectDescriptor> pObjDesc ); + + void SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; } + const Point& GetStartPos() const { return maStartPos; } + + void SetInternalMove( bool bSet ) { mbInternalMove = bSet; } + bool IsInternalMove() const { return mbInternalMove; } + + bool HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); } + + void SetPageBookmarks( std::vector<OUString>&& rPageBookmarks, bool bPersistent ); + bool IsPageTransferable() const { return mbPageTransferable; } + bool HasPageBookmarks() const { return( mpPageDocShell && ( !maPageBookmarks.empty() ) ); } + const std::vector<OUString>& GetPageBookmarks() const { return maPageBookmarks; } + ::sd::DrawDocShell* GetPageDocShell() const { return mpPageDocShell; } + + bool SetTableRTF( SdDrawDocument* ); + + static SdTransferable* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) noexcept; + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + virtual void DragFinished( sal_Int8 nDropAction ) override; + SdDrawDocument* GetSourceDoc() const { return mpSourceDoc;} + + /** User data objects can be used to store information temporarily + at the transferable. The slide sorter uses this to store + previews of the slides that are referenced by the + transferable. + */ + class UserData {public:virtual~UserData(){}}; + + /** Add a user data object. When it was added before (and not + removed) then this call is ignored. + */ + void AddUserData (const std::shared_ptr<UserData>& rpData); + + /** Return the number of user data objects. + */ + sal_Int32 GetUserDataCount() const; + + /** Return the specified user data object. When the index is not + valid, ie not in the range [0,count) then an empty pointer is + returned. + */ + std::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const; + +protected: + + virtual void AddSupportedFormats() override; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; + virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; + virtual void ObjectReleased() override final; + +private: + + SfxObjectShellRef maDocShellRef; + ::sd::DrawDocShell* mpPageDocShell; + std::vector<OUString> maPageBookmarks; + std::unique_ptr<TransferableDataHelper> mpOLEDataHelper; + std::unique_ptr<TransferableObjectDescriptor> mpObjDesc; + const ::sd::View* mpSdView; + ::sd::View* mpSdViewIntern; + SdDrawDocument* mpSdDrawDocument; + SdDrawDocument* mpSdDrawDocumentIntern; + SdDrawDocument* mpSourceDoc; + VclPtr<VirtualDevice> mpVDev; + std::optional<INetBookmark> moBookmark; + std::optional<Graphic> moGraphic; + std::unique_ptr<ImageMap> mpImageMap; + ::tools::Rectangle maVisArea; + Point maStartPos; + bool mbInternalMove : 1; + bool mbOwnDocument : 1; + bool mbOwnView : 1; + bool mbLateInit : 1; + bool mbPageTransferable : 1; + bool mbPageTransferablePersistent : 1; + ::std::vector<std::shared_ptr<UserData> > maUserData; + + SdTransferable( const SdTransferable& ) = delete; + SdTransferable& operator=( const SdTransferable& ) = delete; + + void CreateObjectReplacement( SdrObject* pObj ); + void CreateData(); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx new file mode 100644 index 0000000000..afbfee6846 --- /dev/null +++ b/sd/source/ui/inc/slideshow.hxx @@ -0,0 +1,216 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/presentation/XPresentation2.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <rtl/ref.hxx> + +#include <tools/link.hxx> + +#include <comphelper/compbase.hxx> + +#include <editeng/unoipset.hxx> + +#include <memory> +#include <sddllapi.h> + +namespace com::sun::star { + namespace drawing { + class XDrawPage; + } + namespace animations { + class XAnimationNode; + } +} +class SdDrawDocument; +class KeyEvent; +class OutputDevice; +class Size; +namespace vcl { class Window; } +class SfxRequest; +class WorkWindow; +class CommandGestureSwipeData; +class CommandGestureLongPressData; +struct ImplSVEvent; + +// TODO: Remove +#define PAGE_NO_END 65535 + +/* Definition of SlideShow class */ + +namespace sd +{ + +class SlideshowImpl; +class View; +class ViewShell; +class ViewShellBase; +struct PresentationSettingsEx; +class FrameView; + +enum AnimationMode +{ + ANIMATIONMODE_SHOW, + ANIMATIONMODE_PREVIEW +}; + +typedef comphelper::WeakComponentImplHelper< css::presentation::XPresentation2, css::lang::XServiceInfo > SlideshowBase; + +class SlideShow final : public SlideshowBase +{ +public: + /// used by the model to create a slideshow for it + static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc ); + + // static helper api + static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument const * pDocument ); + static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument const & rDocument ); + static rtl::Reference< SlideShow > GetSlideShow( ViewShellBase const & rBase ); + + static css::uno::Reference< css::presentation::XSlideShowController > GetSlideShowController(ViewShellBase const & rBase ); + + static bool StartPreview( ViewShellBase const & rBase, + const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage, + const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode ); + + static void Stop( ViewShellBase const & rBase ); + + /// returns true if there is a running presentation for the given ViewShellBase + static bool IsRunning( ViewShellBase const & rBase ); + + /// returns true if there is a running presentation inside the given ViewShell + /// returns false even if there is a running presentation but in another ViewShell + static bool IsRunning( const ViewShell& rViewShell ); + + // helper api + + void startPreview( + const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage, + const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode ); + + // uno api + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XPresentation + virtual void SAL_CALL start( ) override; + virtual void SAL_CALL end() override; + virtual void SAL_CALL rehearseTimings( ) override; + + // XPresentation2 + virtual void SAL_CALL startWithArguments(const css::uno::Sequence< css::beans::PropertyValue >& Arguments) override; + virtual sal_Bool SAL_CALL isRunning( ) override; + virtual css::uno::Reference< css::presentation::XSlideShowController > SAL_CALL getController( ) override; + + // legacy api + + // actions + void jumpToPageNumber( sal_Int32 nPage ); // a.k.a. FuSlideShow::JumpToPage() + void jumpToPageIndex( sal_Int32 nIndex ); + void jumpToBookmark( const OUString& sBookmark ); // a.k.a. FuSlideShow::JumpToBookmark() + + /** sets or clears the pause state of the running slideshow. + !!!! This should only be called by the SdShowWindow !!!!*/ + void pause( bool bPause ); + bool swipe(const CommandGestureSwipeData &rSwipeData); + bool longpress(const CommandGestureLongPressData& rLongPressData); + + // settings + bool isFullScreen() const; // a.k.a. FuSlideShow::IsFullScreen() + OutputDevice* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow() + int getAnimationMode() const; // a.k.a. FuSlideShow::GetAnimationMode() + sal_Int32 getCurrentPageNumber() const; // a.k.a. FuSlideShow::GetCurrentPage() + + // events + void resize( const Size &rSize ); + // return false if the activate failed. callers should call end in response to failure + bool activate(ViewShellBase& rBase); + void deactivate(); + void paint(); + + bool keyInput(const KeyEvent& rKEvt); + + bool dependsOn( ViewShellBase const * pViewShellBase ); + + static sal_Int32 GetDisplay(); + + bool IsExitAfterPresenting() const; + void SetExitAfterPresenting(bool bExit); + +private: + SlideShow( SdDrawDocument* pDoc ); + + DECL_LINK( StartInPlacePresentationConfigurationHdl, void *, void ); + void StartInPlacePresentationConfigurationCallback(); + + void StartInPlacePresentation(); + void StartFullscreenPresentation(); + + /// @throws css::uno::RuntimeException + void ThrowIfDisposed() const; + + void CreateController( ViewShell* pViewSh, ::sd::View* pView, vcl::Window* pParentWindow ); + WorkWindow *GetWorkWindow(); + + SlideShow(const SlideShow&) = delete; + SlideShow& operator=( const SlideShow& ) = delete; + + SvxItemPropertySet maPropSet; + + rtl::Reference< SlideshowImpl > mxController; + /** This flag is used together with mxController.is() to prevent + multiple instances of the slide show for one document. The flag + covers the time before mxController is set. + */ + bool mbIsInStartup; + SdDrawDocument* mpDoc; + + std::shared_ptr< PresentationSettingsEx > mxCurrentSettings; + + ViewShellBase* mpCurrentViewShellBase; + ViewShellBase* mpFullScreenViewShellBase; + FrameView* mpFullScreenFrameView; + ImplSVEvent * mnInPlaceConfigEvent; +}; + +namespace slideshowhelp +{ + SD_DLLPUBLIC void ShowSlideShow(SfxRequest const& rReq, SdDrawDocument& rDoc); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/smarttag.hxx b/sd/source/ui/inc/smarttag.hxx new file mode 100644 index 0000000000..2157abb130 --- /dev/null +++ b/sd/source/ui/inc/smarttag.hxx @@ -0,0 +1,170 @@ +/* -*- 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 . + */ + +#pragma once + +#include <helper/simplereferencecomponent.hxx> +#include <rtl/ref.hxx> +#include <set> +#include <svx/svdhdl.hxx> +#include <svx/svdview.hxx> + +class KeyEvent; +class MouseEvent; + +namespace sd +{ +class View; +class SmartHdl; + +/** a smart tag represents a visual user interface element on the documents edit view + that is not part of the document. It uses derivations from SmartHdl for its visuals. + A SmartTag adds himself to the given view if created. It removes himself if it + is disposed before the view is disposed. + + Derive from this class to implement your own smart tag. +*/ +class SmartTag : public SimpleReferenceComponent +{ + friend class SmartTagSet; + +public: + explicit SmartTag(::sd::View& rView); + virtual ~SmartTag() override; + + /** returns true if the SmartTag consumes this event. */ + virtual bool MouseButtonDown(const MouseEvent&, SmartHdl&); + + /** returns true if the SmartTag consumes this event. */ + virtual bool KeyInput(const KeyEvent& rKEvt); + + /** returns true if the SmartTag consumes this event. */ + virtual bool Command(const CommandEvent& rCEvt); + + /** returns true if this smart tag is currently selected */ + bool isSelected() const { return mbSelected; } + + ::sd::View& getView() const { return mrView; } + +protected: + virtual sal_Int32 GetMarkablePointCount() const; + virtual sal_Int32 GetMarkedPointCount() const; + virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark); + virtual void CheckPossibilities(); + virtual bool MarkPoints(const ::tools::Rectangle* pRect, bool bUnmark); + + virtual void addCustomHandles(SdrHdlList& rHandlerList); + virtual void select(); + virtual void deselect(); + virtual bool getContext(SdrViewContext& rContext); + + virtual void disposing() override; + + ::sd::View& mrView; + bool mbSelected; + +private: + SmartTag(const SmartTag&) = delete; + SmartTag& operator=(const SmartTag&) = delete; +}; + +typedef rtl::Reference<SmartTag> SmartTagReference; + +/** class to administrate the available smart tags for a single view. */ +class SmartTagSet +{ + friend class SmartTag; + +public: + explicit SmartTagSet(::sd::View& rView); + ~SmartTagSet(); + + /** selects the given smart tag and updates all handles */ + void select(const SmartTagReference& xTag); + + /** deselects the current selected smart tag and updates all handles */ + void deselect(); + + /** returns the currently selected tag or an empty reference. */ + const SmartTagReference& getSelected() const { return mxSelectedTag; } + + /** returns true if a SmartTag consumes this event. */ + bool MouseButtonDown(const MouseEvent&); + + /** returns true if a SmartTag consumes this event. */ + bool KeyInput(const KeyEvent& rKEvt); + + /** returns true if a SmartTag consumes this event. */ + bool Command(const CommandEvent& rCEvt); + + /** disposes all smart tags and clears the set */ + void Dispose(); + + /** adds the handles from all smart tags to the given list */ + void addCustomHandles(SdrHdlList& rHandlerList); + + /** returns true if the currently selected smart tag has + a special context, returned in rContext. */ + bool getContext(SdrViewContext& rContext) const; + + // support point editing + bool HasMarkablePoints() const; + sal_uLong GetMarkablePointCount() const; + bool HasMarkedPoints() const; + sal_uLong GetMarkedPointCount() const; + bool MarkPoint(SdrHdl& rHdl, bool bUnmark); + bool MarkPoints(const ::tools::Rectangle* pRect, bool bUnmark); + + void CheckPossibilities(); + +private: + SmartTagSet(const SmartTagSet&) = delete; + SmartTagSet& operator=(const SmartTagSet&) = delete; + + /** adds a new smart tag to this set */ + void add(const SmartTagReference& xTag); + + /** removes the given smart tag from this set */ + void remove(const SmartTagReference& xTag); + + std::set<SmartTagReference> maSet; + + ::sd::View& mrView; + SmartTagReference mxSelectedTag; + SmartTagReference mxMouseOverTag; +}; + +/** a derivation from this handle is the visual representation for a smart tag. + One smart tag can have more than one handle. +*/ +class SmartHdl : public SdrHdl +{ +public: + SmartHdl(SmartTagReference xTag, SdrObject* pObject, const Point& rPnt, SdrHdlKind eNewKind); + SmartHdl(SmartTagReference xTag, const Point& rPnt, SdrHdlKind eNewKind); + + const SmartTagReference& getTag() const { return mxSmartTag; } + +private: + SmartTagReference mxSmartTag; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tablefunction.hxx b/sd/source/ui/inc/tablefunction.hxx new file mode 100644 index 0000000000..fe32f16b51 --- /dev/null +++ b/sd/source/ui/inc/tablefunction.hxx @@ -0,0 +1,32 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> + +#include <tools/stream.hxx> +#include <drawdoc.hxx> + +namespace sd +{ +void CreateTableFromRTF(SvStream& rStream, SdDrawDocument* pModel); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tabtempl.hxx b/sd/source/ui/inc/tabtempl.hxx new file mode 100644 index 0000000000..4e24fb9929 --- /dev/null +++ b/sd/source/ui/inc/tabtempl.hxx @@ -0,0 +1,57 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/styledlg.hxx> +#include <svx/xtable.hxx> + +class SdrModel; +class SfxObjectShell; +class SdrView; + +/** + * Template-Tab-Dialog + */ +class SdTabTemplateDlg final : public SfxStyleDialogController +{ +private: + const SfxObjectShell& rDocShell; + SdrView* pSdrView; + + XColorListRef pColorList; + XGradientListRef pGradientList; + XHatchListRef pHatchingList; + XBitmapListRef pBitmapList; + XPatternListRef pPatternList; + XDashListRef pDashList; + XLineEndListRef pLineEndList; + + virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override; + virtual void RefreshInputSet() override; + +public: + SdTabTemplateDlg(weld::Window* pParent, + const SfxObjectShell* pDocShell, + SfxStyleSheetBase& rStyleBase, + SdrModel const * pModel, + SdrView* pView); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/titledockwin.hxx b/sd/source/ui/inc/titledockwin.hxx new file mode 100644 index 0000000000..5a880e2687 --- /dev/null +++ b/sd/source/ui/inc/titledockwin.hxx @@ -0,0 +1,116 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/dockwin.hxx> +#include <tools/svborder.hxx> +#include <vcl/vclptr.hxx> + +class ToolBox; + +namespace sd +{ + class TitledDockingWindow final : public SfxDockingWindow + { + public: + /** Create a new docking window. + @param pBindings + Used, among others, to determine the ViewShellBase and + PaneManager that manage the new docking window. + @param pChildWindow + This child window is the logical container for the new docking + window. + @param pParent + The parent window of the new docking window. + @param rsTitle + the initial title + */ + TitledDockingWindow( + SfxBindings* i_pBindings, + SfxChildWindow* i_pChildWindow, + vcl::Window* i_pParent, + const OUString& rsTitle + ); + + virtual ~TitledDockingWindow() override; + virtual void dispose() override; + + /** returns the content window, which is to be used as parent window for any content to be displayed + in the docking window. + */ + vcl::Window& GetContentWindow() { return *m_aContentWindow; } + const vcl::Window& GetContentWindow() const { return *m_aContentWindow; } + + /** Return the border that is painted around the inner window as + decoration. + */ + const SvBorder& GetDecorationBorder() const { return m_aBorder; } + + /** When docked the given range is passed to the parent SplitWindow. + */ + void SetValidSizeRange (const Range& rValidSizeRange); + + enum Orientation { HorizontalOrientation, VerticalOrientation, UnknownOrientation }; + /** When the TitledDockingWindow is docked and managed by a split window + it can derive its orientation from the orientation of the split + window and return either HorizontalOrientation or + VerticalOrientation. + Otherwise UnknownOrientation is returned. + */ + Orientation GetOrientation() const; + + void SetTitle(const OUString& i_rText); + + private: + // Window overridables + virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& i_rArea) override; + virtual void Resize() override; + virtual void StateChanged( StateChangedType i_nType ) override; + virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent ) override; + virtual void SetText( const OUString& i_rText ) override; + virtual void MouseButtonDown (const MouseEvent& rEvent) override; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + /** internal version of ResetToolBox + */ + void impl_resetToolBox(); + + DECL_LINK(OnToolboxItemSelected, ToolBox*, void); + + void impl_layout(); + + OUString m_sTitle; + VclPtr<ToolBox> m_aToolbox; + VclPtr<Window> m_aContentWindow; + + /** The border that is painted around the inner window. The bevel + shadow lines are part of the border, so where the border is 0 no + such line is painted. + */ + SvBorder m_aBorder; + + /** Height of the title bar. Calculated in impl_layout(). + */ + int m_nTitleBarHeight; + + }; + +} // namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tmplctrl.hxx b/sd/source/ui/inc/tmplctrl.hxx new file mode 100644 index 0000000000..bdf6eed86d --- /dev/null +++ b/sd/source/ui/inc/tmplctrl.hxx @@ -0,0 +1,40 @@ +/* -*- 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 . + */ +#pragma once + +#include <sfx2/stbitem.hxx> + +class SdTemplateControl final : public SfxStatusBarControl +{ +public: + SdTemplateControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb ); + virtual ~SdTemplateControl() override; + + virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; + virtual void Paint( const UserDrawEvent& rEvt ) override; + + SFX_DECL_STATUSBAR_CONTROL(); + +private: + virtual void Command( const CommandEvent& rCEvt ) override; + + OUString msTemplate; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/AsynchronousCall.hxx b/sd/source/ui/inc/tools/AsynchronousCall.hxx new file mode 100644 index 0000000000..fa4c180207 --- /dev/null +++ b/sd/source/ui/inc/tools/AsynchronousCall.hxx @@ -0,0 +1,77 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/timer.hxx> + +#include <memory> +#include <functional> + +namespace sd::tools +{ +/** Store a function object and execute it asynchronous. + + The features of this class are: + a) It provides a wrapper around a VCL Timer so that generic function + objects can be used. + b) When more than one function objects are posted to be executed later + then the pending ones are erased and only the last one will actually be + executed. + + Use this class like this: + aInstanceOfAsynchronousCall.Post( + ::std::bind( + ::std::mem_fun(&DrawViewShell::SwitchPage), + pDrawViewShell, + 11)); +*/ +class AsynchronousCall +{ +public: + /** Create a new asynchronous call. Each object of this class processes + one (semantical) type of call. + */ + AsynchronousCall(); + + ~AsynchronousCall(); + + /** Post a function object that is to be executed asynchronously. When + this method is called while the current function object has not been + executed then the latter is destroyed and only the given function + object will be executed. + @param rFunction + The function object that may be called asynchronously in the + near future. + */ + typedef ::std::function<void()> AsynchronousFunction; + void Post(const AsynchronousFunction& rFunction); + +private: + Timer maTimer; + /** The function object that will be executed when the TimerCallback + function is called the next time. This pointer may be NULL. + */ + ::std::unique_ptr<AsynchronousFunction> mpFunction; + DECL_LINK(TimerCallback, Timer*, void); +}; + +} // end of namespace ::sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/AsynchronousTask.hxx b/sd/source/ui/inc/tools/AsynchronousTask.hxx new file mode 100644 index 0000000000..6964234392 --- /dev/null +++ b/sd/source/ui/inc/tools/AsynchronousTask.hxx @@ -0,0 +1,49 @@ +/* -*- 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 . + */ + +#pragma once + +namespace sd::tools +{ +/** Interface for the asynchronous execution of a task. This interface + allows a controller to run the task either timer based with a fixed + amount of time between the steps or thread based one step right after + the other. +*/ +class AsynchronousTask +{ +public: + /** Run the next step of the task. After HasNextStep() returns false + this method should ignore further calls. + */ + virtual void RunNextStep() = 0; + + /** Return <TRUE/> when there is at least one more step to execute. + When the task has been executed completely then <FALSE/> is + returned. + */ + virtual bool HasNextStep() = 0; + +protected: + ~AsynchronousTask() {} +}; + +} // end of namespace ::sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/ConfigurationAccess.hxx b/sd/source/ui/inc/tools/ConfigurationAccess.hxx new file mode 100644 index 0000000000..97b5e92dc0 --- /dev/null +++ b/sd/source/ui/inc/tools/ConfigurationAccess.hxx @@ -0,0 +1,106 @@ +/* -*- 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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/XInterface.hpp> + +#include <vector> +#include <functional> + +namespace com::sun::star::container { class XHierarchicalNameAccess; } +namespace com::sun::star::container { class XNameAccess; } +namespace com::sun::star::lang { class XMultiServiceFactory; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace sd::tools { + +/** This class gives access to the configuration. Create an object of this + class for one node of the configuration. This will be the root node. + Its children are then accessible through the new ConfigurationAccess + object. +*/ +class ConfigurationAccess +{ +public: + enum WriteMode { READ_WRITE, READ_ONLY }; + + /** Create a new object to access the configuration entries below the + given root. + @param rsRootName + Name of the root. + @param eMode + This flag specifies whether to give read-write or read-only + access. + */ + ConfigurationAccess( + const OUString& rsRootName, + const WriteMode eMode); + + /** Return a configuration node below the root of the called object. + @param rsPathToNode + The relative path from the root (as given the constructor) to + the node. + @return + The type of the returned node varies with the requested node. + It is empty when the node was not found. + */ + css::uno::Any GetConfigurationNode ( + const OUString& rsPathToNode); + + /** Return a configuration node below the given node. + @param rxNode + The node that acts as root to the given relative path. + @param rsPathToNode + The relative path from the given node to the requested node. + @return + The type of the returned node varies with the requested node. + It is empty when the node was not found. + */ + static css::uno::Any GetConfigurationNode ( + const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode, + const OUString& rsPathToNode); + + /** Write any changes that have been made back to the configuration. + This call is ignored when the called ConfigurationAccess object was + not create with read-write mode. + */ + void CommitChanges(); + + /** This functor is typically called for every item in a set. Its two + parameters are the name of key item (often of no further interest) + and the value of the item. + */ + typedef ::std::function<void ( + const OUString&, + const std::vector<css::uno::Any>&) > Functor; + +private: + css::uno::Reference<css::uno::XInterface> mxRoot; + + void Initialize ( + const css::uno::Reference<css::lang::XMultiServiceFactory>& rxProvider, + const OUString& rsRootName, + const WriteMode eMode); +}; + +} // end of namespace sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/GraphicSizeCheck.hxx b/sd/source/ui/inc/tools/GraphicSizeCheck.hxx new file mode 100644 index 0000000000..44f78e4eb1 --- /dev/null +++ b/sd/source/ui/inc/tools/GraphicSizeCheck.hxx @@ -0,0 +1,116 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <memory> +#include <drawdoc.hxx> +#include <svx/GenericCheckDialog.hxx> +#include <svx/svdograf.hxx> + +namespace sd +{ +/** + * Class responsible to check if a graphic object violates the size + * constraints and store the results. + */ +class GraphicSizeViolation final +{ +private: + SdrGrafObj* m_pGraphicObject; + + sal_Int32 m_nLowDPILimit = 0; + sal_Int32 m_nHighDPILimit = 0; + + sal_Int32 m_nDPIX = 0; + sal_Int32 m_nDPIY = 0; + +public: + GraphicSizeViolation(sal_Int32 nDPI, SdrGrafObj* pGraphicObject); + bool check(); + + const OUString& getGraphicName(); + + SdrGrafObj* getObject() const { return m_pGraphicObject; } + + bool isDPITooLow() { return m_nDPIX < m_nLowDPILimit || m_nDPIY < m_nLowDPILimit; } + + bool isDPITooHigh() { return m_nDPIX > m_nHighDPILimit || m_nDPIY > m_nHighDPILimit; } + + sal_Int32 getDPIX() { return m_nDPIX; } + + sal_Int32 getDPIY() { return m_nDPIY; } +}; + +/** + * Run the graphic size checks for all the graphic objects in the DOM + * and store a list of violations. + */ +class GraphicSizeCheck final +{ +private: + SdDrawDocument* m_pDocument; + std::vector<std::unique_ptr<GraphicSizeViolation>> m_aGraphicSizeViolationList; + +public: + GraphicSizeCheck(SdDrawDocument* pDocument) + : m_pDocument(pDocument) + { + } + + void check(); + + std::vector<std::unique_ptr<GraphicSizeViolation>>& getViolationList() + { + return m_aGraphicSizeViolationList; + } +}; + +/** The UI part of the GraphicSizeViolation used by GenericCheckDialog */ +class GraphicSizeCheckGUIEntry : public svx::CheckData +{ +private: + SdDrawDocument* m_pDocument; + std::unique_ptr<GraphicSizeViolation> m_pViolation; + +public: + GraphicSizeCheckGUIEntry(SdDrawDocument* pDocument, + std::unique_ptr<GraphicSizeViolation>&& pViolation) + : m_pDocument(pDocument) + , m_pViolation(std::move(pViolation)) + { + } + + OUString getText() override; + + bool canMarkObject() override { return true; } + + void markObject() override; + + bool hasProperties() override { return true; } + + void runProperties() override; +}; + +/** + * The UI part presenting the graphic size check results, which is + * used by GenericCheckDialog + */ +class GraphicSizeCheckGUIResult : public svx::CheckDataCollection +{ +public: + GraphicSizeCheckGUIResult(SdDrawDocument* m_pDocument); + + OUString getTitle() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/IconCache.hxx b/sd/source/ui/inc/tools/IconCache.hxx new file mode 100644 index 0000000000..fef994764f --- /dev/null +++ b/sd/source/ui/inc/tools/IconCache.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include <tools/SdGlobalResourceContainer.hxx> +#include <vcl/image.hxx> + +namespace sd +{ +/** This simple class stores frequently used icons so that the classes that + use the icons do not have to store them in every one of their + instances. + + Icons are addressed over their resource id and are loaded on demand. + + This cache acts like a singleton with a lifetime equal to that of the sd + module. +*/ +class IconCache final : public SdGlobalResource +{ +public: + /** The lifetime of the returned reference is limited to that of the sd + module. + */ + static IconCache& Instance(); + + /** Return the icon with the given resource id. + @return + The returned Image may be empty when there is no icon for the + given id or an error occurred. Should not happen under normal + circumstances. + */ + Image GetIcon(const OUString& rResourceId); + +private: + class Implementation; + ::std::unique_ptr<Implementation> mpImpl; + + /** The constructor creates the one instance of the cache and registers + it at the SdGlobalResourceContainer to limit is lifetime to that of + the sd module. + */ + IconCache(); + + /** This destructor is called by SdGlobalResourceContainer. + */ + virtual ~IconCache() override; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/IdleDetection.hxx b/sd/source/ui/inc/tools/IdleDetection.hxx new file mode 100644 index 0000000000..decf5ff262 --- /dev/null +++ b/sd/source/ui/inc/tools/IdleDetection.hxx @@ -0,0 +1,89 @@ +/* -*- 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 . + */ + +#pragma once + +#include <o3tl/typed_flags_set.hxx> + +namespace vcl { class Window; } + +namespace sd::tools { + enum class IdleState { + /** When GetIdleState() returns this value, then the system is idle. + */ + Idle = 0x0000, + + /** There are system event pending. + */ + SystemEventPending = 0x0001, + + /** A full screen slide show is running and is active. In contrast + there may be a full screen show be running in an inactive window, + i.e. in the background. + */ + FullScreenShowActive = 0x0002, + + /** A slide show is running in a window. + */ + WindowShowActive = 0x0004, + + /** A window is being painted. + */ + WindowPainting = 0x0008, + }; +} // end of namespace ::sd::tools +namespace o3tl { + template<> struct typed_flags<::sd::tools::IdleState> : is_typed_flags<::sd::tools::IdleState, 0x0f> {}; +} + +namespace sd::tools { + +/** Detect whether the system is idle and some time consuming operation may + be carried out. This class distinguishes between different states of + idle-ness. +*/ +class IdleDetection +{ +public: + /** Determine whether the system is idle. + @param pWindow + When a valid Window pointer is given then it is checked + whether the window is currently being painting. + @return + This method either returns IdleState::Idle or a combination of + IdleStates values or-ed together that describe what the system + is currently doing so that the caller can decide what to do. + */ + static IdleState GetIdleState (const vcl::Window* pWindow); + +private: + /** Check whether there are input events pending. + */ + static IdleState CheckInputPending(); + + /** Check whether a slide show is running full screen or in a window. + */ + static IdleState CheckSlideShowRunning(); + + static IdleState CheckWindowPainting (const vcl::Window& rWindow); +}; + +} // end of namespace ::sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx b/sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx new file mode 100644 index 0000000000..a582ffa72e --- /dev/null +++ b/sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx @@ -0,0 +1,105 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include <sal/types.h> +#include <o3tl/deleter.hxx> + +namespace com::sun::star::uno +{ +template <class interface_type> class Reference; +} +namespace com::sun::star::uno +{ +class XInterface; +} + +namespace sd +{ +class SdGlobalResource +{ +public: + virtual ~SdGlobalResource() COVERITY_NOEXCEPT_FALSE{}; +}; + +/** The purpose of this container is to hold references to resources that + are globally available to all interested objects and to destroy them + when the sd module is destroyed. Examples for resources can be + containers of bitmaps or the container of master pages used by the + MasterPagesSelector objects in the task panel. + + It works like a singleton in that there is one instance per sd module. + Resources can be added (by themselves or their owners) to the + container. The main task of the container is the destruction of all + resources that have been added to it. + + As you may note, there is no method to get a resource from the + container. It is the task of the resource to provide other means of + access to it. + + The reason for this design is not to have to change the SdModule + destructor every time when there is a new resource. This is done by + reversing the dependency between module and resource: the resource knows + about the module--this container class to be more precisely--and tells + it to destroy the resource when the sd module is at the end of its + lifetime. +*/ +class SdGlobalResourceContainer final +{ +public: + static SdGlobalResourceContainer& Instance(); + + /** Add a resource to the container. The ownership of the resource is + transferred to the container. The resource is destroyed when the + container is destroyed, i.e. when the sd module is destroyed. + + When in doubt, use the shared_ptr variant of this method. + */ + void AddResource(::std::unique_ptr<SdGlobalResource> pResource); + + /** Add a resource to the container. By using a shared_ptr and + releasing it only when the SgGlobalResourceContainer is destroyed + the given resource is kept alive at least that long. When at the + time of the destruction of SgGlobalResourceContainer no other + references exist the resource is destroyed as well. + */ + void AddResource(const std::shared_ptr<SdGlobalResource>& pResource); + + /** Add a resource that is implemented as UNO object. Destruction + (when the sd modules is unloaded) is done by a) calling dispose() + when the XComponent is supported and by b) releasing the reference. + */ + void AddResource(const css::uno::Reference<css::uno::XInterface>& rxResource); + +private: + friend class SdGlobalResourceContainerInstance; + friend struct o3tl::default_delete<SdGlobalResourceContainer>; + + class Implementation; + ::std::unique_ptr<Implementation> mpImpl; + + SdGlobalResourceContainer(); + ~SdGlobalResourceContainer(); +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/SlotStateListener.hxx b/sd/source/ui/inc/tools/SlotStateListener.hxx new file mode 100644 index 0000000000..54a2e463d3 --- /dev/null +++ b/sd/source/ui/inc/tools/SlotStateListener.hxx @@ -0,0 +1,138 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/frame/XStatusListener.hpp> +#include <comphelper/compbase.hxx> +#include <tools/link.hxx> +#include <cppuhelper/weakref.hxx> + +namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XDispatchProvider; } +namespace com::sun::star::frame { class XStatusListener; } +namespace com::sun::star::frame { struct FeatureStateEvent; } + +namespace sd::tools { + +typedef comphelper::WeakComponentImplHelper< + css::frame::XStatusListener + > SlotStateListenerInterfaceBase; + +/** Listen for state changes of slots. This class has been created in order + to be informed when the support for vertical writing changes but it can + be used to relay state changes of other slots as well. +*/ +class SlotStateListener final + : public SlotStateListenerInterfaceBase +{ +public: + /** This convenience version of the constructor takes all parameters + that are necessary to observe a single slot. See descriptions of + the SetCallback(), ConnectToFrame(), and ObserveSlot() methods for + explanations about the parameters. + */ + SlotStateListener ( + Link<const OUString&,void> const & rCallback, + const css::uno::Reference<css::frame::XDispatchProvider>& rxDispatchProvider, + const OUString& rSlotName); + + /** The constructor de-registers all remaining listeners. Usually a prior + dispose() call should have done that already. + */ + virtual ~SlotStateListener() override; + + /** Set the callback to the given value. Whenever one of the observed + slots changes its state this callback is informed about it. + Changing the callback does not release the listeners. + @throws DisposedException + */ + void SetCallback (const Link<const OUString&,void>& rCallback); + + /** Set the frame whose slots shall be observed. When an object of this + class is already observing slots of another frame then these + listeners are released first. + @throws DisposedException + */ + void ConnectToDispatchProvider ( + const css::uno::Reference<css::frame::XDispatchProvider>& rxDispatchProvider); + + /** Observe the slot specified by the given name. Note that + ConnectToFrame() has to have been called earlier. + @param rSlotName + The name of the slot to observe. An example is + ".uno:VerticalTextState". + @throws DisposedException + */ + void ObserveSlot (const OUString& rSlotName); + + //===== frame::XStatusListener ========================================== + + /** Called by slot state change broadcasters. In turn the callback is + informed about the state change. + @throws DisposedException + */ + virtual void SAL_CALL + statusChanged ( + const css::frame::FeatureStateEvent& rState) override; + + //===== lang::XEventListener ============================================ + + virtual void SAL_CALL + disposing(const css::lang::EventObject& rEvent) override; + +private: + /** This method is called by the WeakComponentImplHelper base class in + reaction to a XComponent::dispose() call. It releases all currently + active listeners. + */ + virtual void disposing(std::unique_lock<std::mutex>&) override; + + Link<const OUString&,void> maCallback; + + /** Remember the URLs that describe slots whose state changes we are + listening to. + */ + std::vector<css::util::URL> maRegisteredURLList; + + css::uno::WeakReference<css::frame::XDispatchProvider> mxDispatchProviderWeak; + + /** Deregister all currently active state change listeners. + */ + void ReleaseListeners(); + + /** @throws css::lang::DisposedException when the object has already been + disposed. + */ + void ThrowIfDisposed(); + + /** Transform the given string into a URL object. + */ + static css::util::URL MakeURL (const OUString& rSlotName); + + /** Return an XDispatch object for the given URL. + */ + css::uno::Reference<css::frame::XDispatch> + GetDispatch ( + const css::util::URL& rURL) const; +}; + +} // end of namespace ::sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx b/sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx new file mode 100644 index 0000000000..4084e7e8fe --- /dev/null +++ b/sd/source/ui/inc/tools/TimerBasedTaskExecution.hxx @@ -0,0 +1,89 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/timer.hxx> + +#include <memory> + +namespace sd::tools { + +class AsynchronousTask; + +/** Execute an AsynchronousTask timer based, i.e. every + nMillisecondsBetweenSteps milliseconds as much steps are executed as fit + into a nMaxTimePerStep millisecond interval. + + When a task is executed completely, i.e. HasNextStep() returns <FALSE/>, + the TimerBasedTaskExecution destroys itself. This, of course, works + only if the creating instance does not hold a shared_ptr to that object. +*/ +class TimerBasedTaskExecution +{ +public: + /** Create a new object of this class. + @param rpTask + The AsynchronousTask that is to be executed. + @param nMillisecondsBetweenSteps + Wait at least this long between the execution of steps. Note + that more than one step may be executed in succession. + @param nMaxTimePerStep + The maximal time for executing steps without yielding control. + */ + static std::shared_ptr<TimerBasedTaskExecution> Create ( + const std::shared_ptr<AsynchronousTask>& rpTask, + sal_uInt32 nMillisecondsBetweenSteps, + sal_uInt32 nMaxTimePerStep); + + /** Stop the execution of the task and release the shared pointer to + itself so that it will eventually be destroyed. + */ + void Release(); + + /** Convenience method that calls Release() on the given task. It + checks the given weak_ptr for being expired and catches bad_weak_ptr + exceptions. + */ + static void ReleaseTask (const std::weak_ptr<TimerBasedTaskExecution>& rpTask); + +private: + std::shared_ptr<AsynchronousTask> mpTask; + Timer maTimer; + /** This shared_ptr to this is used to destroy a TimerBasedTaskExecution + object when its task has been executed completely. + */ + std::shared_ptr<TimerBasedTaskExecution> mpSelf; + sal_uInt32 mnMaxTimePerStep; + + TimerBasedTaskExecution ( + std::shared_ptr<AsynchronousTask> pTask, + sal_uInt32 nMillisecondsBetweenSteps, + sal_uInt32 nMaxTimePerStep); + ~TimerBasedTaskExecution(); + + class Deleter; + friend class Deleter; + + DECL_LINK(TimerCallback, Timer *, void); +}; + +} // end of namespace ::sd::tools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx new file mode 100644 index 0000000000..893192d256 --- /dev/null +++ b/sd/source/ui/inc/tpaction.hxx @@ -0,0 +1,104 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/presentation/ClickAction.hpp> +#include <sfx2/tabdlg.hxx> +#include <sfx2/basedlgs.hxx> +#include <svx/xtable.hxx> +#include <unotools/resmgr.hxx> +#include "sdtreelb.hxx" + +#include <vector> + +namespace sd { + class View; +} +class SdDrawDocument; + +/** + * Effect-SingleTab-Dialog + */ +class SdActionDlg final : public SfxSingleTabDialogController +{ +public: + SdActionDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View const * pView); +}; + +/** + * Interaction-Tab-Page + */ +class SdTPAction final : public SfxTabPage +{ +private: + const ::sd::View* mpView; + SdDrawDocument* mpDoc; + XColorListRef pColList; + + bool bTreeUpdated; + std::vector<css::presentation::ClickAction> maCurrentActions; + OUString aLastFile; + ::std::vector< tools::Long > aVerbVector; + + std::unique_ptr<weld::ComboBox> m_xLbAction; + std::unique_ptr<weld::Label> m_xFtTree; // jump destination controls + std::unique_ptr<SdPageObjsTLV> m_xLbTree; + std::unique_ptr<SdPageObjsTLV> m_xLbTreeDocument; + std::unique_ptr<weld::TreeView> m_xLbOLEAction; + std::unique_ptr<weld::Frame> m_xFrame; + std::unique_ptr<weld::Entry> m_xEdtSound; + std::unique_ptr<weld::Entry> m_xEdtBookmark; + std::unique_ptr<weld::Entry> m_xEdtDocument; + std::unique_ptr<weld::Entry> m_xEdtProgram; + std::unique_ptr<weld::Entry> m_xEdtMacro; + std::unique_ptr<weld::Button> m_xBtnSearch; + std::unique_ptr<weld::Button> m_xBtnSeek; + + DECL_LINK( ClickSearchHdl, weld::Button&, void ); + DECL_LINK( ClickActionHdl, weld::ComboBox&, void ); + DECL_LINK( SelectTreeHdl, weld::TreeView&, void ); + DECL_LINK( CheckFileHdl, weld::Widget&, void ); + + void UpdateTree(); + void OpenFileDialog(); + css::presentation::ClickAction GetActualClickAction(); + void SetActualClickAction( css::presentation::ClickAction eCA ); + void SetEditText( OUString const & rStr ); + OUString GetEditText( bool bURL = false ); +public: + SD_DLLPUBLIC static TranslateId GetClickActionSdResId(css::presentation::ClickAction eCA); + + SdTPAction(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); + virtual ~SdTPAction() override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& ); + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet * ) override; + + virtual void ActivatePage( const SfxItemSet& rSet ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + + void Construct(); + + void SetView( const ::sd::View* pSdView ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx new file mode 100644 index 0000000000..e1065eb28b --- /dev/null +++ b/sd/source/ui/inc/tpoption.hxx @@ -0,0 +1,159 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> +#include <svx/optgrid.hxx> + +/** + * Option-Tab-Page: Snap + */ +class SdTpOptionsSnap final : public SvxGridTabPage +{ +public: + SdTpOptionsSnap(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); + virtual ~SdTpOptionsSnap() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet * ) override; +}; + +/** + * Option-Tab-Page: Contents + */ +class SdTpOptionsContents final : public SfxTabPage +{ +private: + bool m_bDrawMode; + std::unique_ptr<weld::CheckButton> m_xCbxRuler; + std::unique_ptr<weld::Widget> m_xCbxRulerImg; + std::unique_ptr<weld::CheckButton> m_xCbxDragStripes; + std::unique_ptr<weld::Widget> m_xCbxDragStripesImg; + std::unique_ptr<weld::CheckButton> m_xCbxHandlesBezier; + std::unique_ptr<weld::Widget> m_xCbxHandlesBezierImg; + std::unique_ptr<weld::CheckButton> m_xCbxMoveOutline; + std::unique_ptr<weld::Widget> m_xCbxMoveOutlineImg; + +public: + SdTpOptionsContents(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); + virtual ~SdTpOptionsContents() override; + + virtual OUString GetAllStrings() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet * ) override; + + virtual void PageCreated(const SfxAllItemSet& aSet) override; + + void SetDrawMode() { m_bDrawMode = true; } +}; + +/** + * Option-Tab-Page: View + */ + +class SdTpOptionsMisc final : public SfxTabPage +{ + friend class SdModule; + +private: + sal_uInt32 nWidth; + sal_uInt32 nHeight; + OUString aInfo1; + OUString aInfo2; + + bool m_bDrawMode; + MapUnit ePoolUnit; + + std::unique_ptr<weld::CheckButton> m_xCbxQuickEdit; + std::unique_ptr<weld::Widget> m_xCbxQuickEditImg; + std::unique_ptr<weld::CheckButton> m_xCbxPickThrough; + std::unique_ptr<weld::Widget> m_xCbxPickThroughImg; + + std::unique_ptr<weld::Frame> m_xNewDocumentFrame; + std::unique_ptr<weld::CheckButton> m_xCbxStartWithTemplate; + std::unique_ptr<weld::Widget> m_xCbxStartWithTemplateImg; + + std::unique_ptr<weld::CheckButton> m_xCbxMasterPageCache; + std::unique_ptr<weld::Widget> m_xCbxMasterPageCacheImg; + std::unique_ptr<weld::CheckButton> m_xCbxCopy; + std::unique_ptr<weld::Widget> m_xCbxCopyImg; + std::unique_ptr<weld::CheckButton> m_xCbxMarkedHitMovesAlways; + std::unique_ptr<weld::Widget> m_xCbxMarkedHitMovesAlwaysImg; + + std::unique_ptr<weld::ComboBox> m_xLbMetric; + std::unique_ptr<weld::Widget> m_xLbMetricImg; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldTabstop; + std::unique_ptr<weld::Widget> m_xMtrFldTabstopImg; + + std::unique_ptr<weld::CheckButton> m_xCbxCompatibility; + std::unique_ptr<weld::Widget> m_xCbxCompatibilityImg; + + //Scale + std::unique_ptr<weld::Frame> m_xScaleFrame; + std::unique_ptr<weld::ComboBox> m_xCbScale; + std::unique_ptr<weld::Widget> m_xCbScaleImg; + std::unique_ptr<weld::Label> m_xNewDocLb; + std::unique_ptr<weld::Label> m_xFiInfo1; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldOriginalWidth; + std::unique_ptr<weld::Label> m_xWidthLb; + std::unique_ptr<weld::Label> m_xHeightLb; + std::unique_ptr<weld::Label> m_xFiInfo2; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldOriginalHeight; + std::unique_ptr<weld::CheckButton> m_xCbxDistort; + std::unique_ptr<weld::Widget> m_xCbxDistortImg; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldInfo1; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldInfo2; + + static OUString GetScale( sal_Int32 nX, sal_Int32 nY ); + static bool SetScale( std::u16string_view aScale, sal_Int32& rX, sal_Int32& rY ); + + DECL_LINK( SelectMetricHdl_Impl, weld::ComboBox&, void ); + + /** Enable or disable the controls in the compatibility section of the + 'general' tab page depending on whether there is at least one + document. + */ + void UpdateCompatibilityControls(); + + virtual void ActivatePage( const SfxItemSet& rSet ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + +public: + SdTpOptionsMisc(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); + virtual ~SdTpOptionsMisc() override; + + virtual OUString GetAllStrings() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet * ) override; + + /** Hide Impress specific controls, make Draw specific controls visible + and arrange the visible controls. Do not call this method more than once. + */ + void SetDrawMode(); + + virtual void PageCreated(const SfxAllItemSet& aSet) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/uiobject.hxx b/sd/source/ui/inc/uiobject.hxx new file mode 100644 index 0000000000..06cb6105fa --- /dev/null +++ b/sd/source/ui/inc/uiobject.hxx @@ -0,0 +1,35 @@ +/* -*- 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/. + */ + +#include <memory> +#include <vcl/uitest/uiobject.hxx> +#include "Window.hxx" + +class ImpressWindowUIObject final : public WindowUIObject +{ +public: + ImpressWindowUIObject(const VclPtr<sd::Window>& xWindow); + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, const StringMap& rParameters) override; + + virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override; + + virtual std::set<OUString> get_children() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +private: + virtual OUString get_name() const override; + + VclPtr<sd::Window> mxWindow; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unchss.hxx b/sd/source/ui/inc/unchss.hxx new file mode 100644 index 0000000000..7c3845f8bd --- /dev/null +++ b/sd/source/ui/inc/unchss.hxx @@ -0,0 +1,47 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> + +#include <svl/itemset.hxx> + +#include <sdundo.hxx> + +class SfxItemSet; +class SfxStyleSheet; +class SdDrawDocument; + +class StyleSheetUndoAction final : public SdUndoAction +{ + SfxStyleSheet* mpStyleSheet; + + std::unique_ptr<SfxItemSet> mpNewSet; + std::unique_ptr<SfxItemSet> mpOldSet; + +public: + StyleSheetUndoAction(SdDrawDocument* pTheDoc, SfxStyleSheet* pTheStyleSheet, + const SfxItemSet* pTheNewItemSet); + + virtual void Undo() override; + virtual void Redo() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/undoback.hxx b/sd/source/ui/inc/undoback.hxx new file mode 100644 index 0000000000..afbb13eca4 --- /dev/null +++ b/sd/source/ui/inc/undoback.hxx @@ -0,0 +1,58 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> + +#include <sdundo.hxx> + +#include <svl/itemset.hxx> + +class SdDrawDocument; +class SdPage; +class SfxItemSet; +class SfxPoolItem; + +class SdBackgroundObjUndoAction final : public SdUndoAction +{ +private: + + SdPage& mrPage; + std::unique_ptr<SfxItemSet> mpItemSet; + std::unique_ptr<SfxPoolItem> mpFillBitmapItem; + bool mbHasFillBitmap; + + void ImplRestoreBackgroundObj(); + void saveFillBitmap(SfxItemSet &rItemSet); + void restoreFillBitmap(SfxItemSet &rItemSet); + +public: + SdBackgroundObjUndoAction( + SdDrawDocument& rDoc, + SdPage& rPage, + const SfxItemSet& rItemSet); + + virtual void Undo() override; + virtual void Redo() override; + + virtual SdUndoAction* Clone() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/undoheaderfooter.hxx b/sd/source/ui/inc/undoheaderfooter.hxx new file mode 100644 index 0000000000..a6928a63c2 --- /dev/null +++ b/sd/source/ui/inc/undoheaderfooter.hxx @@ -0,0 +1,45 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sdundo.hxx> +#include <sdpage.hxx> +#include <sddllapi.h> + +class SdDrawDocument; + +/************************************************************************/ + +class SD_DLLPUBLIC SdHeaderFooterUndoAction final : public SdUndoAction +{ + SdPage* mpPage; + + const sd::HeaderFooterSettings maOldSettings; + const sd::HeaderFooterSettings maNewSettings; + +public: + SdHeaderFooterUndoAction( SdDrawDocument* pDoc, SdPage* pPage, sd::HeaderFooterSettings aNewSettings ); + virtual ~SdHeaderFooterUndoAction() override; + + virtual void Undo() override; + virtual void Redo() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/undolayer.hxx b/sd/source/ui/inc/undolayer.hxx new file mode 100644 index 0000000000..7b0d33d9ae --- /dev/null +++ b/sd/source/ui/inc/undolayer.hxx @@ -0,0 +1,56 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sdundo.hxx> + +class SdDrawDocument; +class SdrLayer; + +/************************************************************************/ + +class SdLayerModifyUndoAction final : public SdUndoAction +{ + +public: + SdLayerModifyUndoAction( SdDrawDocument* _pDoc, SdrLayer* pLayer, + OUString aOldLayerName, OUString aOldLayerTitle, OUString aOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable, + OUString aNewLayerName, OUString aNewLayerTitle, OUString aNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable ); + + virtual void Undo() override; + virtual void Redo() override; + +private: + SdrLayer* mpLayer; + OUString maOldLayerName; + OUString maOldLayerTitle; + OUString maOldLayerDesc; + bool mbOldIsVisible; + bool mbOldIsLocked; + bool mbOldIsPrintable; + OUString maNewLayerName; + OUString maNewLayerTitle; + OUString maNewLayerDesc; + bool mbNewIsVisible; + bool mbNewIsLocked; + bool mbNewIsPrintable; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/undopage.hxx b/sd/source/ui/inc/undopage.hxx new file mode 100644 index 0000000000..87d5b5b217 --- /dev/null +++ b/sd/source/ui/inc/undopage.hxx @@ -0,0 +1,161 @@ +/* -*- 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 . + */ + +#pragma once + +#include <tools/gen.hxx> +#include <vcl/prntypes.hxx> + +#include <sdundo.hxx> + +class SdDrawDocument; +class SdPage; + +/************************************************************************/ + +class SdPageFormatUndoAction final : public SdUndoAction +{ + SdPage* mpPage; + + Size maOldSize; + sal_Int32 mnOldLeft; + sal_Int32 mnOldRight; + sal_Int32 mnOldUpper; + sal_Int32 mnOldLower; + Orientation meOldOrientation; + sal_uInt16 mnOldPaperBin; + bool mbOldFullSize; + + Size maNewSize; + sal_Int32 mnNewLeft; + sal_Int32 mnNewRight; + sal_Int32 mnNewUpper; + sal_Int32 mnNewLower; + bool mbNewScale; + Orientation meNewOrientation; + sal_uInt16 mnNewPaperBin; + bool mbNewFullSize; + +public: + SdPageFormatUndoAction( SdDrawDocument* pDoc, + SdPage* pThePage, + const Size& rOldSz, + sal_Int32 nOldLft, + sal_Int32 nOldRgt, + sal_Int32 nOldUpr, + sal_Int32 nOldLwr, + Orientation eOldOrient, + sal_uInt16 nOPaperBin, + bool bOFullSize, + + const Size& rNewSz, + sal_Int32 nNewLft, + sal_Int32 nNewRgt, + sal_Int32 nNewUpr, + sal_Int32 nNewLwr, + bool bNewScl, + Orientation eNewOrient, + sal_uInt16 nNPaperBin, + bool bNFullSize + ) : + SdUndoAction(pDoc), + mpPage (pThePage), + maOldSize (rOldSz), + mnOldLeft (nOldLft), + mnOldRight (nOldRgt), + mnOldUpper (nOldUpr), + mnOldLower (nOldLwr), + meOldOrientation(eOldOrient), + mnOldPaperBin (nOPaperBin), + mbOldFullSize (bOFullSize), + + maNewSize (rNewSz), + mnNewLeft (nNewLft), + mnNewRight (nNewRgt), + mnNewUpper (nNewUpr), + mnNewLower (nNewLwr), + mbNewScale (bNewScl), + meNewOrientation(eNewOrient), + mnNewPaperBin (nNPaperBin), + mbNewFullSize (bNFullSize) + + {} + virtual ~SdPageFormatUndoAction() override; + + virtual void Undo() override; + virtual void Redo() override; +}; + +/************************************************************************/ + +class SdPageLRUndoAction final : public SdUndoAction +{ + SdPage* mpPage; + + sal_Int32 mnOldLeft; + sal_Int32 mnOldRight; + sal_Int32 mnNewLeft; + sal_Int32 mnNewRight; + +public: + SdPageLRUndoAction( SdDrawDocument* pDoc, SdPage* pThePage, + sal_Int32 nOldLft, sal_Int32 nOldRgt, + sal_Int32 nNewLft, sal_Int32 nNewRgt ) : + SdUndoAction(pDoc), + mpPage (pThePage), + mnOldLeft (nOldLft), + mnOldRight (nOldRgt), + mnNewLeft (nNewLft), + mnNewRight (nNewRgt) + {} + virtual ~SdPageLRUndoAction() override; + + virtual void Undo() override; + virtual void Redo() override; +}; + +/************************************************************************/ + +class SdPageULUndoAction final : public SdUndoAction +{ + SdPage* mpPage; + + sal_Int32 mnOldUpper; + sal_Int32 mnOldLower; + sal_Int32 mnNewUpper; + sal_Int32 mnNewLower; + +public: + SdPageULUndoAction( SdDrawDocument* pDoc, SdPage* pThePage, + sal_Int32 nOldUpr, sal_Int32 nOldLwr, + sal_Int32 nNewUpr, sal_Int32 nNewLwr ) : + SdUndoAction(pDoc), + mpPage (pThePage), + mnOldUpper (nOldUpr), + mnOldLower (nOldLwr), + mnNewUpper (nNewUpr), + mnNewLower (nNewLwr) + {} + virtual ~SdPageULUndoAction() override; + + virtual void Undo() override; + virtual void Redo() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unmodpg.hxx b/sd/source/ui/inc/unmodpg.hxx new file mode 100644 index 0000000000..02920c27ab --- /dev/null +++ b/sd/source/ui/inc/unmodpg.hxx @@ -0,0 +1,102 @@ +/* -*- 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 . + */ + +#pragma once + +#include <model/SlsPageDescriptor.hxx> +#include <model/SlsSharedPageDescriptor.hxx> + +#include <xmloff/autolayout.hxx> + +#include <sdundo.hxx> + +class SdDrawDocument; +class SdPage; + +class ModifyPageUndoAction final : public SdUndoAction +{ + SdPage* mpPage; + OUString maOldName; + OUString maNewName; + AutoLayout meOldAutoLayout; + AutoLayout meNewAutoLayout; + bool mbOldBckgrndVisible; + bool mbNewBckgrndVisible; + bool mbOldBckgrndObjsVisible; + bool mbNewBckgrndObjsVisible; + +public: + ModifyPageUndoAction( + SdDrawDocument* pTheDoc, + SdPage* pThePage, + const OUString& aTheNewName, + AutoLayout eTheNewAutoLayout, + bool bTheNewBckgrndVisible, + bool bTheNewBckgrndObjsVisible); + + virtual ~ModifyPageUndoAction() override; + virtual void Undo() override; + virtual void Redo() override; +}; + +class ChangeSlideExclusionStateUndoAction final : public SdUndoAction +{ +public: + ChangeSlideExclusionStateUndoAction(SdDrawDocument* pDocument, + const sd::slidesorter::model::PageDescriptor::State eState, + const bool bOldStateValue); + + ChangeSlideExclusionStateUndoAction( + SdDrawDocument* pDocument, const sd::slidesorter::model::SharedPageDescriptor& rpDescriptor, + const sd::slidesorter::model::PageDescriptor::State eState, const bool bOldStateValue); + + virtual void Undo() override; + virtual void Redo() override; + + virtual OUString GetComment() const override; + + void AddPageDescriptor(const sd::slidesorter::model::SharedPageDescriptor& rpDescriptor); + +private: + sd::slidesorter::model::PageDescriptor::State meState; + bool mbOldStateValue; + std::vector<sd::slidesorter::model::SharedPageDescriptor> mrpDescriptors; + const OUString maComment; +}; + +class RenameLayoutTemplateUndoAction final : public SdUndoAction +{ +public: + RenameLayoutTemplateUndoAction( + SdDrawDocument* pDocument, + OUString aOldLayoutName, + OUString aNewLayoutName); + + virtual void Undo() override; + virtual void Redo() override; + + virtual OUString GetComment() const override; + +private: + OUString maOldName; + OUString maNewName; + const OUString maComment; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unmovss.hxx b/sd/source/ui/inc/unmovss.hxx new file mode 100644 index 0000000000..93e87cd407 --- /dev/null +++ b/sd/source/ui/inc/unmovss.hxx @@ -0,0 +1,44 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sdundo.hxx> +#include <stlsheet.hxx> +#include <vector> + +class SdDrawDocument; + +class SdMoveStyleSheetsUndoAction final : public SdUndoAction +{ + StyleSheetCopyResultVector maStyles; + std::vector< SdStyleSheetVector > maListOfChildLists; + bool mbMySheets; + +public: + SdMoveStyleSheetsUndoAction(SdDrawDocument* pTheDoc, StyleSheetCopyResultVector& rTheStyles, bool bInserted); + + virtual ~SdMoveStyleSheetsUndoAction() override; + virtual void Undo() override; + virtual void Redo() override; + + virtual OUString GetComment() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unoaprms.hxx b/sd/source/ui/inc/unoaprms.hxx new file mode 100644 index 0000000000..9ad3276684 --- /dev/null +++ b/sd/source/ui/inc/unoaprms.hxx @@ -0,0 +1,148 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/presentation/AnimationEffect.hpp> +#include <com/sun/star/presentation/AnimationSpeed.hpp> +#include <com/sun/star/presentation/ClickAction.hpp> +#include <sdundo.hxx> +#include <tools/color.hxx> + +class SdDrawDocument; +class SdrObject; + +class SdAnimationPrmsUndoAction final : public SdUndoAction +{ + SdrObject* pObject; + bool bOldActive; + bool bNewActive; + bool bOldDimPrevious; + bool bNewDimPrevious; + bool bOldDimHide; + bool bNewDimHide; + bool bOldSoundOn; + bool bNewSoundOn; + bool bOldSecondSoundOn; + bool bNewSecondSoundOn; + bool bOldPlayFull; + bool bNewPlayFull; + bool bOldSecondPlayFull; + bool bNewSecondPlayFull; + css::presentation::AnimationEffect eOldEffect; + css::presentation::AnimationEffect eNewEffect; + css::presentation::AnimationEffect eOldTextEffect; + css::presentation::AnimationEffect eNewTextEffect; + css::presentation::AnimationSpeed eOldSpeed; + css::presentation::AnimationSpeed eNewSpeed; + css::presentation::AnimationEffect eOldSecondEffect; + css::presentation::AnimationEffect eNewSecondEffect; + css::presentation::AnimationSpeed eOldSecondSpeed; + css::presentation::AnimationSpeed eNewSecondSpeed; + Color aOldDimColor; + Color aNewDimColor; + OUString aOldSoundFile; + OUString aNewSoundFile; + css::presentation::ClickAction eOldClickAction; + css::presentation::ClickAction eNewClickAction; + OUString aOldBookmark; + OUString aNewBookmark; + sal_uInt16 nOldVerb; + sal_uInt16 nNewVerb; + + bool bInfoCreated; + +public: + SdAnimationPrmsUndoAction(SdDrawDocument* pTheDoc, SdrObject* pObj, + bool bCreated) + : SdUndoAction(pTheDoc) + , pObject(pObj) + , bOldActive(false) + , bNewActive(false) + , bOldDimPrevious(false) + , bNewDimPrevious(false) + , bOldDimHide(false) + , bNewDimHide(false) + , bOldSoundOn(false) + , bNewSoundOn(false) + , bOldSecondSoundOn(false) + , bNewSecondSoundOn(false) + , bOldPlayFull(false) + , bNewPlayFull(false) + , bOldSecondPlayFull(false) + , bNewSecondPlayFull(false) + , eOldEffect(css::presentation::AnimationEffect_NONE) + , eNewEffect(css::presentation::AnimationEffect_NONE) + , eOldTextEffect(css::presentation::AnimationEffect_NONE) + , eNewTextEffect(css::presentation::AnimationEffect_NONE) + , eOldSpeed(css::presentation::AnimationSpeed_SLOW) + , eNewSpeed(css::presentation::AnimationSpeed_SLOW) + , eOldSecondEffect(css::presentation::AnimationEffect_NONE) + , eNewSecondEffect(css::presentation::AnimationEffect_NONE) + , eOldSecondSpeed(css::presentation::AnimationSpeed_SLOW) + , eNewSecondSpeed(css::presentation::AnimationSpeed_SLOW) + , eOldClickAction(css::presentation::ClickAction_NONE) + , eNewClickAction(css::presentation::ClickAction_NONE) + , nOldVerb(0) + , nNewVerb(0) + , bInfoCreated(bCreated) + { + } + + void SetActive(bool bTheOldActive, bool bTheNewActive) + { bOldActive = bTheOldActive; bNewActive = bTheNewActive; } + void SetEffect(css::presentation::AnimationEffect eTheOldEffect, css::presentation::AnimationEffect eTheNewEffect) + { eOldEffect = eTheOldEffect; eNewEffect = eTheNewEffect; } + void SetTextEffect(css::presentation::AnimationEffect eTheOldEffect, css::presentation::AnimationEffect eTheNewEffect) + { eOldTextEffect = eTheOldEffect; eNewTextEffect = eTheNewEffect; } + void SetSpeed(css::presentation::AnimationSpeed eTheOldSpeed, css::presentation::AnimationSpeed eTheNewSpeed) + { eOldSpeed = eTheOldSpeed; eNewSpeed = eTheNewSpeed; } + void SetDim(bool bTheOldDim, bool bTheNewDim) + { bOldDimPrevious = bTheOldDim; bNewDimPrevious = bTheNewDim; } + void SetDimColor(Color aTheOldDimColor, Color aTheNewDimColor) + { aOldDimColor = aTheOldDimColor; aNewDimColor = aTheNewDimColor; } + void SetDimHide(bool bTheOldDimHide, bool bTheNewDimHide) + { bOldDimHide = bTheOldDimHide; bNewDimHide = bTheNewDimHide; } + void SetSoundOn(bool bTheOldSoundOn, bool bTheNewSoundOn) + { bOldSoundOn = bTheOldSoundOn; bNewSoundOn = bTheNewSoundOn; } + void SetSound(const OUString& aTheOldSound, const OUString& aTheNewSound) + { aOldSoundFile = aTheOldSound; aNewSoundFile = aTheNewSound; } + void SetPlayFull(bool bTheOldPlayFull, bool bTheNewPlayFull) + { bOldPlayFull = bTheOldPlayFull; bNewPlayFull = bTheNewPlayFull; } + void SetClickAction(css::presentation::ClickAction eTheOldAction, css::presentation::ClickAction eTheNewAction) + { eOldClickAction = eTheOldAction; eNewClickAction = eTheNewAction; } + void SetBookmark(const OUString& aTheOldBookmark, const OUString& aTheNewBookmark) + { aOldBookmark = aTheOldBookmark; aNewBookmark = aTheNewBookmark; } + void SetVerb(sal_uInt16 nTheOldVerb, sal_uInt16 nTheNewVerb) + { nOldVerb = nTheOldVerb; nNewVerb = nTheNewVerb; } + void SetSecondEffect(css::presentation::AnimationEffect eTheOldEffect, css::presentation::AnimationEffect eTheNewEffect) + { eOldSecondEffect = eTheOldEffect; eNewSecondEffect = eTheNewEffect; } + void SetSecondSpeed(css::presentation::AnimationSpeed eTheOldSpeed, css::presentation::AnimationSpeed eTheNewSpeed) + { eOldSecondSpeed = eTheOldSpeed; eNewSecondSpeed = eTheNewSpeed; } + void SetSecondSoundOn(bool bTheOldSoundOn, bool bTheNewSoundOn) + { bOldSecondSoundOn = bTheOldSoundOn; bNewSecondSoundOn = bTheNewSoundOn; } + void SetSecondPlayFull(bool bTheOldPlayFull, bool bTheNewPlayFull) + { bOldSecondPlayFull = bTheOldPlayFull; bNewSecondPlayFull = bTheNewPlayFull; } + + virtual ~SdAnimationPrmsUndoAction() override; + virtual void Undo() override; + virtual void Redo() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unokywds.hxx b/sd/source/ui/inc/unokywds.hxx new file mode 100644 index 0000000000..a298e93b7c --- /dev/null +++ b/sd/source/ui/inc/unokywds.hxx @@ -0,0 +1,115 @@ +/* -*- 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 . + */ + +#pragma once + +#include <sal/config.h> +#include <rtl/ustring.hxx> + +// SdUnoPseudoStyleFamily +inline constexpr OUString sUNO_PseudoSheet_Background = u"background"_ustr; + +// SdLayer +inline constexpr OUString sUNO_LayerName_background = u"background"_ustr; +inline constexpr OUString sUNO_LayerName_background_objects = u"backgroundobjects"_ustr; +inline constexpr OUString sUNO_LayerName_layout = u"layout"_ustr; +inline constexpr OUString sUNO_LayerName_controls = u"controls"_ustr; +inline constexpr OUString sUNO_LayerName_measurelines = u"measurelines"_ustr; + +// services +inline constexpr OUString sUNO_Service_FillProperties = u"com.sun.star.drawing.FillProperties"_ustr; +inline constexpr OUString sUNO_Service_PageBackground = u"com.sun.star.drawing.PageBackground"_ustr; +inline constexpr OUString sUNO_Service_ImageMapRectangleObject + = u"com.sun.star.image.ImageMapRectangleObject"_ustr; +inline constexpr OUString sUNO_Service_ImageMapCircleObject + = u"com.sun.star.image.ImageMapCircleObject"_ustr; +inline constexpr OUString sUNO_Service_ImageMapPolygonObject + = u"com.sun.star.image.ImageMapPolygonObject"_ustr; + +// properties +inline constexpr OUString sUNO_Prop_ForbiddenCharacters = u"ForbiddenCharacters"_ustr; +inline constexpr OUString sUNO_Prop_MapUnit = u"MapUnit"_ustr; +inline constexpr OUString sUNO_Prop_VisibleArea = u"VisibleArea"_ustr; +inline constexpr OUString sUNO_Prop_TabStop = u"TabStop"_ustr; +inline constexpr OUString sUNO_Prop_CharLocale = u"CharLocale"_ustr; +inline constexpr OUString sUNO_Prop_AutomContFocus = u"AutomaticControlFocus"_ustr; +inline constexpr OUString sUNO_Prop_ApplyFrmDsgnMode = u"ApplyFormDesignMode"_ustr; +inline constexpr OUString sUNO_Prop_IsBackgroundVisible = u"IsBackgroundVisible"_ustr; +inline constexpr OUString sUNO_Prop_IsBackgroundObjectsVisible = u"IsBackgroundObjectsVisible"_ustr; +inline constexpr OUString sUNO_Prop_UserDefinedAttributes = u"UserDefinedAttributes"_ustr; +inline constexpr OUString sUNO_Prop_BookmarkURL = u"BookmarkURL"_ustr; +inline constexpr OUString sUNO_Prop_RuntimeUID = u"RuntimeUID"_ustr; +inline constexpr OUString sUNO_Prop_HasValidSignatures = u"HasValidSignatures"_ustr; +inline constexpr OUString sUNO_Prop_InteropGrabBag = u"InteropGrabBag"_ustr; +inline constexpr OUString sUNO_Prop_Theme = u"Theme"_ustr; + +// view settings +inline constexpr OUString sUNO_View_ViewId = u"ViewId"_ustr; +inline constexpr OUString sUNO_View_SnapLinesDrawing = u"SnapLinesDrawing"_ustr; +inline constexpr OUString sUNO_View_SnapLinesNotes = u"SnapLinesNotes"_ustr; +inline constexpr OUString sUNO_View_SnapLinesHandout = u"SnapLinesHandout"_ustr; +inline constexpr OUString sUNO_View_RulerIsVisible = u"RulerIsVisible"_ustr; +inline constexpr OUString sUNO_View_PageKind = u"PageKind"_ustr; +inline constexpr OUString sUNO_View_SelectedPage = u"SelectedPage"_ustr; +inline constexpr OUString sUNO_View_IsLayerMode = u"IsLayerMode"_ustr; +inline constexpr OUString sUNO_View_IsDoubleClickTextEdit = u"IsDoubleClickTextEdit"_ustr; +inline constexpr OUString sUNO_View_IsClickChangeRotation = u"IsClickChangeRotation"_ustr; +inline constexpr OUString sUNO_View_SlidesPerRow = u"SlidesPerRow"_ustr; +inline constexpr OUString sUNO_View_EditMode = u"EditMode"_ustr; +inline const char sUNO_View_EditModeStandard[] = "EditModeStandard"; // To be deprecated +// inline const char sUNO_View_EditModeNotes[] = "EditModeNotes"; +// inline const char sUNO_View_EditModeHandout[] = "EditModeHandout"; + +inline constexpr OUString sUNO_View_GridIsVisible = u"GridIsVisible"_ustr; +inline constexpr OUString sUNO_View_GridIsFront = u"GridIsFront"_ustr; +inline constexpr OUString sUNO_View_IsSnapToGrid = u"IsSnapToGrid"_ustr; +inline constexpr OUString sUNO_View_IsSnapToPageMargins = u"IsSnapToPageMargins"_ustr; +inline constexpr OUString sUNO_View_IsSnapToSnapLines = u"IsSnapToSnapLines"_ustr; +inline constexpr OUString sUNO_View_IsSnapToObjectFrame = u"IsSnapToObjectFrame"_ustr; +inline constexpr OUString sUNO_View_IsSnapToObjectPoints = u"IsSnapToObjectPoints"_ustr; +inline constexpr OUString sUNO_View_IsPlusHandlesAlwaysVisible = u"IsPlusHandlesAlwaysVisible"_ustr; +inline constexpr OUString sUNO_View_IsFrameDragSingles = u"IsFrameDragSingles"_ustr; +inline constexpr OUString sUNO_View_EliminatePolyPointLimitAngle + = u"EliminatePolyPointLimitAngle"_ustr; +inline constexpr OUString sUNO_View_IsEliminatePolyPoints = u"IsEliminatePolyPoints"_ustr; +inline const char sUNO_View_ActiveLayer[] = "ActiveLayer"; +inline constexpr OUString sUNO_View_NoAttribs = u"NoAttribs"_ustr; +inline constexpr OUString sUNO_View_NoColors = u"NoColors"_ustr; +inline constexpr OUString sUNO_View_GridCoarseWidth = u"GridCoarseWidth"_ustr; +inline constexpr OUString sUNO_View_GridCoarseHeight = u"GridCoarseHeight"_ustr; +inline constexpr OUString sUNO_View_GridFineWidth = u"GridFineWidth"_ustr; +inline constexpr OUString sUNO_View_GridFineHeight = u"GridFineHeight"_ustr; +inline constexpr OUString sUNO_View_IsAngleSnapEnabled = u"IsAngleSnapEnabled"_ustr; +inline constexpr OUString sUNO_View_SnapAngle = u"SnapAngle"_ustr; +inline constexpr OUString sUNO_View_GridSnapWidthXNumerator = u"GridSnapWidthXNumerator"_ustr; +inline constexpr OUString sUNO_View_GridSnapWidthXDenominator = u"GridSnapWidthXDenominator"_ustr; +inline constexpr OUString sUNO_View_GridSnapWidthYNumerator = u"GridSnapWidthYNumerator"_ustr; +inline constexpr OUString sUNO_View_GridSnapWidthYDenominator = u"GridSnapWidthYDenominator"_ustr; +inline constexpr OUString sUNO_View_VisibleLayers = u"VisibleLayers"_ustr; +inline constexpr OUString sUNO_View_PrintableLayers = u"PrintableLayers"_ustr; +inline constexpr OUString sUNO_View_LockedLayers = u"LockedLayers"_ustr; + +inline constexpr OUString sUNO_View_VisibleAreaTop = u"VisibleAreaTop"_ustr; +inline constexpr OUString sUNO_View_VisibleAreaLeft = u"VisibleAreaLeft"_ustr; +inline constexpr OUString sUNO_View_VisibleAreaWidth = u"VisibleAreaWidth"_ustr; +inline constexpr OUString sUNO_View_VisibleAreaHeight = u"VisibleAreaHeight"_ustr; + +inline constexpr OUString sUNO_View_ZoomOnPage = u"ZoomOnPage"_ustr; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx new file mode 100644 index 0000000000..e0fa051d88 --- /dev/null +++ b/sd/source/ui/inc/unomodel.hxx @@ -0,0 +1,486 @@ +/* -*- 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 . + */ +#pragma once + +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPageDuplicator.hpp> +#include <com/sun/star/drawing/XLayerSupplier.hpp> +#include <com/sun/star/drawing/XMasterPagesSupplier.hpp> +#include <com/sun/star/presentation/XPresentationSupplier.hpp> +#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/ucb/XAnyCompareFactory.hpp> +#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp> +#include <com/sun/star/view/XRenderable.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <rtl/ref.hxx> + +#include <sfx2/sfxbasemodel.hxx> +#include <svx/fmdmod.hxx> + +#include <vcl/ITiledRenderable.hxx> + +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/weakref.hxx> +#include <sddllapi.h> + +namespace com::sun::star::container { class XNameContainer; } +namespace com::sun::star::i18n { class XForbiddenCharacters; } +namespace com::sun::star::presentation { class XPresentation; } + +class SdDrawDocument; +class SdPage; +class SvxItemPropertySet; + +namespace sd { +class DrawDocShell; +class DrawViewShell; +} + +extern OUString getPageApiName( SdPage const * pPage ); +extern OUString getPageApiNameFromUiName( const OUString& rUIName ); + +class SD_DLLPUBLIC SdXImpressDocument final : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other + public SvxFmMSFactory, + public css::drawing::XDrawPageDuplicator, + public css::drawing::XLayerSupplier, + public css::drawing::XMasterPagesSupplier, + public css::drawing::XDrawPagesSupplier, + public css::presentation::XPresentationSupplier, + public css::presentation::XCustomPresentationSupplier, + public css::document::XLinkTargetSupplier, + public css::beans::XPropertySet, + public css::style::XStyleFamiliesSupplier, + public css::lang::XServiceInfo, + public css::ucb::XAnyCompareFactory, + public css::presentation::XHandoutMasterSupplier, + public css::view::XRenderable, + public vcl::ITiledRenderable +{ + friend class SdDrawPagesAccess; + friend class SdMasterPagesAccess; + friend class SdLayerManager; + +private: + ::sd::DrawDocShell* mpDocShell; + SdDrawDocument* mpDoc; + bool mbDisposed; + + css::uno::Reference<css::uno::XInterface> create( + OUString const & aServiceSpecifier, OUString const & referer); + + /// @throws css::uno::RuntimeException + SdPage* InsertSdPage( sal_uInt16 nPage, bool bDuplicate ); + + const bool mbImpressDoc; + bool mbClipBoard; + + css::uno::WeakReference< css::drawing::XDrawPages > mxDrawPagesAccess; + css::uno::WeakReference< css::drawing::XDrawPages > mxMasterPagesAccess; + css::uno::WeakReference< css::container::XNameAccess > mxLayerManager; + css::uno::WeakReference< css::container::XNameContainer > mxCustomPresentationAccess; + css::uno::WeakReference< css::i18n::XForbiddenCharacters > mxForbiddenCharacters; + css::uno::Reference< css::container::XNameAccess > mxLinks; + + css::uno::Reference< css::uno::XInterface > mxDashTable; + css::uno::Reference< css::uno::XInterface > mxGradientTable; + css::uno::Reference< css::uno::XInterface > mxHatchTable; + css::uno::Reference< css::uno::XInterface > mxBitmapTable; + css::uno::Reference< css::uno::XInterface > mxTransGradientTable; + css::uno::Reference< css::uno::XInterface > mxMarkerTable; + css::uno::Reference< css::uno::XInterface > mxDrawingPool; + + const SvxItemPropertySet* mpPropSet; + + css::uno::Sequence< css::uno::Type > maTypeSequence; + + OUString maBuildId; + + bool mbPaintTextEdit; + + void initializeDocument(); + + sd::DrawViewShell* GetViewShell(); + + /** abstract SdrModel provider */ + virtual SdrModel& getSdrModelFromUnoModel() const override; + +public: + SdXImpressDocument(::sd::DrawDocShell* pShell, bool bClipBoard); + SdXImpressDocument(SdDrawDocument* pDoc, bool bClipBoard); + virtual ~SdXImpressDocument() noexcept override; + + static rtl::Reference< SdXImpressDocument > GetModel( SdDrawDocument const & rDoc ); + + // internal + bool operator==( const SdXImpressDocument& rModel ) const { return mpDoc == rModel.mpDoc; } + bool operator!=( const SdXImpressDocument& rModel ) const { return mpDoc != rModel.mpDoc; } + + ::sd::DrawDocShell* GetDocShell() const { return mpDocShell; } + SdDrawDocument* GetDoc() const { return mpDoc; } + bool IsImpressDocument() const { return mbImpressDoc; } + + void SetModified() noexcept; + + css::uno::Reference< css::i18n::XForbiddenCharacters > getForbiddenCharsTable(); + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + UNO3_GETIMPLEMENTATION_DECL(SdXImpressDocument) + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XModel + virtual void SAL_CALL lockControllers( ) override; + virtual void SAL_CALL unlockControllers( ) override; + virtual sal_Bool SAL_CALL hasControllersLocked( ) override; + virtual css::uno::Reference < css::container::XIndexAccess > SAL_CALL getViewData() override; + virtual void SAL_CALL setViewData( const css::uno::Reference < css::container::XIndexAccess >& aData ) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + // XDrawPageDuplicator + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL duplicate( const css::uno::Reference< css::drawing::XDrawPage >& xPage ) override; + + // XDrawPagesSupplier + virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages( ) override; + + // XMasterPagesSupplier + virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getMasterPages( ) override; + + // XLayerManagerSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLayerManager( ) override; + + // XCustomPresentationSupplier + virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getCustomPresentations( ) override; + + // XHandoutMasterSupplier + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getHandoutMasterPage( ) override; + + // XPresentationSupplier + virtual css::uno::Reference< css::presentation::XPresentation > SAL_CALL getPresentation( ) override; + + // XMultiServiceFactory ( SvxFmMSFactory ) + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override; + virtual css::uno::Reference<css::uno::XInterface> SAL_CALL + createInstanceWithArguments( + OUString const & ServiceSpecifier, + css::uno::Sequence<css::uno::Any> const & Arguments) override; + virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XLinkTargetSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks( ) override; + + // XStyleFamiliesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies( ) override; + + // XAnyCompareFactory + virtual css::uno::Reference< css::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const OUString& PropertyName ) override; + + // XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override; + virtual void SAL_CALL render( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override; + + // ITiledRenderable + virtual void paintTile( VirtualDevice& rDevice, + int nOutputWidth, + int nOutputHeight, + int nTilePosX, + int nTilePosY, + tools::Long nTileWidth, + tools::Long nTileHeight ) override; + virtual Size getDocumentSize() override; + virtual void setPart( int nPart, bool bAllowChangeFocus = true ) override; + virtual int getPart() override; + virtual int getParts() override; + virtual OUString getPartName( int nPart ) override; + virtual OUString getPartHash( int nPart ) override; + virtual VclPtr<vcl::Window> getDocWindow() override; + bool isMasterViewMode(); + + /// @see vcl::ITiledRenderable::setPartMode(). + virtual void setPartMode( int nPartMode ) override; + /// @see vcl::ITiledRenderable::getEditMode(). + virtual int getEditMode() override; + /// @see vcl::ITiledRenderable::setEditMode(). + virtual void setEditMode(int) override; + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). + virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) override; + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override; + /// @see vcl::ITiledRenderable::postMouseEvent(). + virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override; + /// @see vcl::ITiledRenderable::setTextSelection(). + virtual void setTextSelection(int nType, int nX, int nY) override; + /// @see vcl::ITiledRenderable::getSelection(). + virtual css::uno::Reference<css::datatransfer::XTransferable> getSelection() override; + /// @see vcl::ITiledRenderable::setGraphicSelection(). + virtual void setGraphicSelection(int nType, int nX, int nY) override; + /// @see lok::Document::resetSelection(). + virtual void resetSelection() override; + /// @see vcl::ITiledRenderable::setClientVisibleArea(). + virtual void setClientVisibleArea(const tools::Rectangle& rRectangle) override; + /// @see vcl::ITiledRenderable::setClipboard(). + virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override; + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; + /// @see vcl::ITiledRenderable::getPointer(). + virtual PointerStyle getPointer() override; + /// @see vcl::ITiledRenderable::getPostIts(). + virtual void getPostIts(tools::JsonWriter& /*rJsonWriter*/) override; + /// @see vcl::ITiledRenderable::selectPart(). + virtual void selectPart(int nPart, int nSelect) override; + /// @see vcl::ITiledRenderable::moveSelectedParts(). + virtual void moveSelectedParts(int nPosition, bool bDuplicate) override; + /// @see vcl::ITiledRenderable::getPartInfo(). + virtual OUString getPartInfo(int nPart) override; + /// @see vcl::ITiledRenderable::isDisposed(). + virtual bool isDisposed() const override + { + return mbDisposed; + } + /// @see vcl::ITiledRenderable::setPaintTextEdit(). + virtual void setPaintTextEdit(bool bPaint) override { mbPaintTextEdit = bPaint; } + + /// @see vcl::ITiledRenderable::getViewRenderState(). + OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override; + + // XComponent + + /** This dispose implementation releases the resources held by the + called object and forwards the call to its base class. + When close() has not yet been called then this is done first. As a + consequence the implementation has to cope with being called twice + and still has to forward the second call to the base class. + See also comments of issue 27847. + */ + virtual void SAL_CALL dispose() override; +}; + +/*********************************************************************** +* * +***********************************************************************/ + +class SdDrawPagesAccess final : public ::cppu::WeakImplHelper< css::drawing::XDrawPages, css::container::XNameAccess, css::lang::XServiceInfo, css::lang::XComponent > +{ +private: + SdXImpressDocument* mpModel; + +public: + SdDrawPagesAccess( SdXImpressDocument& rMyModel ) noexcept; + virtual ~SdDrawPagesAccess() noexcept override; + + // XDrawPages + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) override; + virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XDrawPage >& xPage ) override; + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override ; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XComponent + virtual void SAL_CALL dispose( ) 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 >& aListener ) override; +}; + +/*********************************************************************** +* * +***********************************************************************/ + +class SdMasterPagesAccess final : public ::cppu::WeakImplHelper< css::drawing::XDrawPages, css::lang::XServiceInfo, css::lang::XComponent > +{ +private: + SdXImpressDocument* mpModel; + +public: + SdMasterPagesAccess( SdXImpressDocument& rMyModel ) noexcept; + virtual ~SdMasterPagesAccess() noexcept override; + + // XDrawPages + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) override; + virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XDrawPage >& xPage ) override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override ; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XComponent + virtual void SAL_CALL dispose( ) 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 >& aListener ) override; +}; + +/*********************************************************************** +* * +***********************************************************************/ + +enum SdLinkTargetType +{ + Page = 0, + Notes, + Handout, + MasterPage, + Count +}; + +class SdDocLinkTargets final : public ::cppu::WeakImplHelper< css::container::XNameAccess, + css::lang::XServiceInfo , css::lang::XComponent > +{ +private: + SdXImpressDocument* mpModel; + OUString aNames[SdLinkTargetType::Count]; + +public: + SdDocLinkTargets(SdXImpressDocument& rMyModel); + virtual ~SdDocLinkTargets() noexcept override; + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XComponent + virtual void SAL_CALL dispose( ) 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 >& aListener ) override; +}; + +class SdDocLinkTargetType final : public ::cppu::WeakImplHelper< css::document::XLinkTargetSupplier, + css::beans::XPropertySet, + css::lang::XServiceInfo > +{ + SdXImpressDocument* mpModel; + sal_uInt16 mnType; + OUString maName; + +public: + SdDocLinkTargetType(SdXImpressDocument* pModel, sal_uInt16 nT); + + // css::document::XLinkTargetSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override; + + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, + const css::uno::Any& aValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override; + virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener > & xListener) override; + virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener > & aListener) override; + virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) override; + virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) override; +}; + +class SdDocLinkTarget final : public ::cppu::WeakImplHelper< css::container::XNameAccess, + css::lang::XServiceInfo > +{ +private: + SdXImpressDocument* mpModel; + sal_uInt16 mnType; + +public: + SdDocLinkTarget( SdXImpressDocument* pModel, sal_uInt16 nT ); + + // css::container::XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& aName) override; + virtual css::uno::Sequence< OUString> SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override; + + // internal + /// @throws std::exception + SdPage* FindPage( std::u16string_view rName ) const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unopage.hxx b/sd/source/ui/inc/unopage.hxx new file mode 100644 index 0000000000..14b4975b2c --- /dev/null +++ b/sd/source/ui/inc/unopage.hxx @@ -0,0 +1,302 @@ +/* -*- 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 . + */ +#pragma once + +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/drawing/XMasterPageTarget.hpp> +#include <com/sun/star/drawing/XShapeCombiner.hpp> +#include <com/sun/star/drawing/XShapeBinder.hpp> +#include <com/sun/star/presentation/XPresentationPage.hpp> +#include <com/sun/star/animations/XAnimationNodeSupplier.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/office/XAnnotationAccess.hpp> + +#include <svx/unopage.hxx> + +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> + +#include "unosrch.hxx" +#include <sdpage.hxx> + +class SdrObject; +class SdXImpressDocument; + +class SdGenericDrawPage : public SvxDrawPage, + public SdUnoSearchReplaceShape, + public css::drawing::XShapeCombiner, + public css::drawing::XShapeBinder, + public css::container::XNamed, + public css::beans::XPropertySet, + public css::beans::XMultiPropertySet, + public css::animations::XAnimationNodeSupplier, + public css::office::XAnnotationAccess, + public css::document::XLinkTargetSupplier +{ +private: + SdXImpressDocument* mpDocModel; + SdrModel* mpSdrModel; + bool mbIsImpressDocument; + sal_Int16 mnTempPageNumber; // for printing handouts + css::uno::Any mSlideLayout; // import slide layout pptx + const SvxItemPropertySet* mpPropSet; + + void UpdateModel(); + +protected: + friend class SdXImpressDocument; + + /// @throws css::lang::IllegalArgumentException + virtual void setBackground( const css::uno::Any& rValue ); + /// @throws std::exception + virtual void getBackground( css::uno::Any& rValue ); + + OUString getBookmarkURL() const; + void setBookmarkURL( std::u16string_view rURL ); + + void SetLeftBorder( sal_Int32 nValue ); + void SetRightBorder( sal_Int32 nValue ); + void SetUpperBorder( sal_Int32 nValue ); + void SetLowerBorder( sal_Int32 nValue ); + + void SetWidth( sal_Int32 nWidth ); + void SetHeight( sal_Int32 nHeight ); + + bool IsImpressDocument() const; + + virtual void disposing() noexcept override; + + css::uno::Any getNavigationOrder(); + void setNavigationOrder( const css::uno::Any& rValue ); + + /// @throws css::uno::RuntimeException + void throwIfDisposed() const; + +public: + SdGenericDrawPage(SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet); + virtual ~SdGenericDrawPage() noexcept override; + + // internal + bool isValid() const { return (SvxDrawPage::mpPage != nullptr) && (mpModel != nullptr); } + + SdPage* GetPage() const { return static_cast<SdPage*>(SvxDrawPage::mpPage); } + SdXImpressDocument* GetModel() const; + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // this is called whenever a SdrObject must be created for an empty api shape wrapper + virtual rtl::Reference<SdrObject> CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + + // SvxDrawPage + virtual css::uno::Reference<css::drawing::XShape> CreateShape(SdrObject *pObj) const override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + + // XShapeCombiner + virtual css::uno::Reference< css::drawing::XShape > SAL_CALL combine( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override; + virtual void SAL_CALL split( const css::uno::Reference< css::drawing::XShape >& xGroup ) override; + + // XShapeBinder + virtual css::uno::Reference< css::drawing::XShape > SAL_CALL bind( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override; + virtual void SAL_CALL unbind( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + // XLinkTargetSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks( ) override; + + // XServiceInfo + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAnimationNodeSupplier + virtual css::uno::Reference< css::animations::XAnimationNode > SAL_CALL getAnimationNode( ) override; + + // XAnnotationAccess: + virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() override; + virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) override; + virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() override; +}; + +/*********************************************************************** +* * +***********************************************************************/ + +class SdDrawPage final : public css::drawing::XMasterPageTarget, + public css::presentation::XPresentationPage, + public SdGenericDrawPage +{ +private: + css::uno::Sequence< css::uno::Type > maTypeSequence; + + virtual void setBackground( const css::uno::Any& rValue ) override; + virtual void getBackground( css::uno::Any& rValue ) override; +public: + SdDrawPage(SdXImpressDocument* pModel, SdPage* pInPage); + virtual ~SdDrawPage() noexcept override; + + UNO3_GETIMPLEMENTATION_DECL( SdDrawPage ) + + static OUString getPageApiName( SdPage const * pPage ); + static OUString getPageApiNameFromUiName( const OUString& rUIName ); + static OUString getUiNameFromPageApiName( const OUString& rApiName ); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XMasterPageTarget + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getMasterPage( ) override; + virtual void SAL_CALL setMasterPage( const css::uno::Reference< css::drawing::XDrawPage >& xMasterPage ) override; + + // XPresentationPage + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override; + + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override ; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XShapes + virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override; +}; + +/*********************************************************************** +* * +***********************************************************************/ + +class SdMasterPage final : public css::presentation::XPresentationPage, + public SdGenericDrawPage +{ +private: + css::uno::Sequence< css::uno::Type > maTypeSequence; + + virtual void setBackground( const css::uno::Any& rValue ) override; + virtual void getBackground( css::uno::Any& rValue ) override; + +public: + SdMasterPage(SdXImpressDocument* pModel, SdPage* pInPage); + virtual ~SdMasterPage() noexcept override; + + UNO3_GETIMPLEMENTATION_DECL(SdMasterPage) + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override ; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XPresentationPage + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override; + + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + + // XShapes + virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override; +}; + +/*********************************************************************** +* * +***********************************************************************/ + +class SdPageLinkTargets final : public ::cppu::WeakImplHelper< css::container::XNameAccess, + css::lang::XServiceInfo > +{ +private: + css::uno::Reference< css::drawing::XDrawPage > mxPage; + SdGenericDrawPage* mpUnoPage; + +public: + SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) noexcept; + virtual ~SdPageLinkTargets() noexcept override; + + // internal + SdrObject* FindObject( std::u16string_view rName ) const noexcept; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; +}; + +OUString getUiNameFromPageApiNameImpl( const OUString& rApiName ); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unoprnms.hxx b/sd/source/ui/inc/unoprnms.hxx new file mode 100644 index 0000000000..1d3a905525 --- /dev/null +++ b/sd/source/ui/inc/unoprnms.hxx @@ -0,0 +1,73 @@ +/* -*- 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 . + */ +#pragma once + + +#define UNO_NAME_PAGE_BACKGROUND "Background" +#define UNO_NAME_PAGE_LEFT "BorderLeft" +#define UNO_NAME_PAGE_RIGHT "BorderRight" +#define UNO_NAME_PAGE_TOP "BorderTop" +#define UNO_NAME_PAGE_BOTTOM "BorderBottom" +#define UNO_NAME_PAGE_CHANGE "Change" +#define UNO_NAME_PAGE_DURATION "Duration" +#define UNO_NAME_PAGE_EFFECT "Effect" +#define UNO_NAME_PAGE_HEIGHT "Height" +#define UNO_NAME_PAGE_LAYOUT "Layout" +#define UNO_NAME_PAGE_NUMBER "Number" +#define UNO_NAME_PAGE_ORIENTATION "Orientation" +#define UNO_NAME_PAGE_SPEED "Speed" +#define UNO_NAME_PAGE_TRANSITION_DURATION "TransitionDuration" +#define UNO_NAME_PAGE_WIDTH "Width" +#define UNO_NAME_PAGE_PREVIEW "Preview" +#define UNO_NAME_PAGE_PREVIEWBITMAP "PreviewBitmap" +#define UNO_NAME_PAGE_PREVIEWMETAFILE "PreviewMetafile" +#define UNO_NAME_PAGE_VISIBLE "Visible" + +#define UNO_NAME_OBJ_BOOKMARK "Bookmark" +#define UNO_NAME_OBJ_DIMCOLOR "DimColor" +#define UNO_NAME_OBJ_DIMHIDE "DimHide" +#define UNO_NAME_OBJ_DIMPREV "DimPrevious" +#define UNO_NAME_OBJ_EFFECT "Effect" +#define UNO_NAME_OBJ_ISEMPTYPRESOBJ "IsEmptyPresentationObject" +#define UNO_NAME_OBJ_ISPRESOBJ "IsPresentationObject" +#define UNO_NAME_OBJ_CLICKACTION "OnClick" +#define UNO_NAME_OBJ_PLAYFULL "PlayFull" +#define UNO_NAME_OBJ_PRESORDER "PresentationOrder" +#define UNO_NAME_OBJ_SOUNDFILE "Sound" +#define UNO_NAME_OBJ_SOUNDON "SoundOn" +#define UNO_NAME_OBJ_SPEED "Speed" +#define UNO_NAME_OBJ_TEXTEFFECT "TextEffect" +#define UNO_NAME_OBJ_BLUESCREEN "TransparentColor" +#define UNO_NAME_OBJ_VERB "Verb" +#define UNO_NAME_OBJ_STYLE "Style" +#define UNO_NAME_OBJ_MASTERDEPENDENT "IsPlaceholderDependent" +#define UNO_NAME_OBJ_ANIMATIONPATH "AnimationPath" +#define UNO_NAME_OBJ_LEGACYFRAGMENT "LegacyFragment" + +#define UNO_NAME_LAYER_LOCKED "IsLocked" +#define UNO_NAME_LAYER_PRINTABLE "IsPrintable" +#define UNO_NAME_LAYER_VISIBLE "IsVisible" +#define UNO_NAME_LAYER_NAME "Name" + + +#define UNO_NAME_SEARCH_BACKWARDS "SearchBackwards" +#define UNO_NAME_SEARCH_CASE "SearchCaseSensitive" +#define UNO_NAME_SEARCH_WORDS "SearchWords" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unosrch.hxx b/sd/source/ui/inc/unosrch.hxx new file mode 100644 index 0000000000..104fd27474 --- /dev/null +++ b/sd/source/ui/inc/unosrch.hxx @@ -0,0 +1,131 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include <com/sun/star/util/XReplaceable.hpp> +#include <com/sun/star/util/XReplaceDescriptor.hpp> + +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <editeng/editdata.hxx> + +namespace com::sun::star::drawing { class XDrawPage; } +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::text { class XTextRange; } +namespace com::sun::star::util { class XSearchDescriptor; } + +class SvxItemPropertySet; +class SdUnoSearchReplaceDescriptor; + +/** this class implements a search or replace operation on a given page or a given sdrobj */ +class SdUnoSearchReplaceShape : public css::util::XReplaceable +{ + css::drawing::XDrawPage* mpPage; + +protected: + css::uno::Reference< css::text::XTextRange > Search( const css::uno::Reference< css::text::XTextRange >& xText, SdUnoSearchReplaceDescriptor* pDescr ); + bool Search( const OUString& rText, sal_Int32& nStartPos, sal_Int32& nEndPos, SdUnoSearchReplaceDescriptor* pDescr ) noexcept; + static ESelection GetSelection( const css::uno::Reference< css::text::XTextRange >& xTextRange ) noexcept; + static css::uno::Reference< css::drawing::XShape > GetShape( const css::uno::Reference< css::text::XTextRange >& xTextRange ) noexcept; + css::uno::Reference< css::drawing::XShape > GetNextShape( const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XShape >& xCurrentShape ) noexcept; + css::uno::Reference< css::drawing::XShape > GetCurrentShape() const noexcept; + +public: + // danger, this c'tor is only usable if the given shape or page is derived + // from this class!!! + SdUnoSearchReplaceShape( css::drawing::XDrawPage* xPage ) noexcept; + virtual ~SdUnoSearchReplaceShape() noexcept; + + // XReplaceable + virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor( ) override; + virtual sal_Int32 SAL_CALL replaceAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override; + + // XSearchable + virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL createSearchDescriptor( ) override; + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL findAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findFirst( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findNext( const css::uno::Reference< css::uno::XInterface >& xStartAt, const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override; +}; + +/* ================================================================= */ + +/** this class holds the parameters and status of a search or replace operation performed + by class SdUnoSearchReplaceShape */ + +class SdUnoSearchReplaceDescriptor final : public ::cppu::WeakImplHelper< css::util::XReplaceDescriptor > // public css::util::XSearchDescriptor, css::beans::XPropertySet +{ + std::unique_ptr<SvxItemPropertySet> mpPropSet; + + bool mbBackwards; + bool mbCaseSensitive; + bool mbWords; + + OUString maSearchStr; + OUString maReplaceStr; + +public: + /// @throws css::uno::RuntimeException + SdUnoSearchReplaceDescriptor(); + virtual ~SdUnoSearchReplaceDescriptor() noexcept override; + + bool IsCaseSensitive() const { return mbCaseSensitive; } + bool IsWords() const { return mbWords; } + + // XSearchDescriptor + virtual OUString SAL_CALL getSearchString( ) override; + virtual void SAL_CALL setSearchString( const OUString& aString ) override; + + // XReplaceDescriptor + virtual OUString SAL_CALL getReplaceString( ) override; + virtual void SAL_CALL setReplaceString( const OUString& aReplaceString ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; +}; + +/* ================================================================= */ + +/** this class holds a sequence that is a result from a find all and + lets people access it through the XIndexAccess Interface. */ +class SdUnoFindAllAccess final : public ::cppu::WeakImplHelper< css::container::XIndexAccess > // public css::container::XElementAccess +{ + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > maSequence; + +public: + SdUnoFindAllAccess( css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > const & rSequence ) noexcept; + virtual ~SdUnoFindAllAccess() noexcept override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override ; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/unprlout.hxx b/sd/source/ui/inc/unprlout.hxx new file mode 100644 index 0000000000..8d75204f19 --- /dev/null +++ b/sd/source/ui/inc/unprlout.hxx @@ -0,0 +1,55 @@ +/* -*- 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 . + */ + +#pragma once + +#include <xmloff/autolayout.hxx> + +#include <sdundo.hxx> + +class SdDrawDocument; +class SdPage; + +class SdPresentationLayoutUndoAction final : public SdUndoAction +{ + OUString aOldLayoutName; + OUString aNewLayoutName; + AutoLayout eOldAutoLayout; + AutoLayout eNewAutoLayout; + bool bSetAutoLayout; // sal_True: change AutoLayout + SdPage* pPage; + OUString aComment; + +public: + SdPresentationLayoutUndoAction(SdDrawDocument* pTheDoc, + const OUString& aTheOldLayoutName, + const OUString& aTheNewLayoutName, + AutoLayout eTheOldAutoLayout, + AutoLayout eTheNewAutoLayout, + bool bSet, + SdPage* pThePage); + + virtual ~SdPresentationLayoutUndoAction() override; + virtual void Undo() override; + virtual void Redo() override; + + virtual OUString GetComment() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx new file mode 100644 index 0000000000..ac7a1bfd49 --- /dev/null +++ b/sd/source/ui/inc/vectdlg.hxx @@ -0,0 +1,81 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> +#include <svx/graphctl.hxx> + +namespace sd { +class DrawDocShell; +} + +/****************************************************************************** +|* +|* SdVectorizeDlg +|* +\******************************************************************************/ + +class SdVectorizeDlg final : public weld::GenericDialogController +{ + ::sd::DrawDocShell* m_pDocSh; + Bitmap aBmp; + Bitmap aPreviewBmp; + GDIMetaFile aMtf; + + GraphCtrl m_aBmpWin; + GraphCtrl m_aMtfWin; + + std::unique_ptr<weld::SpinButton> m_xNmLayers; + std::unique_ptr<weld::MetricSpinButton> m_xMtReduce; + std::unique_ptr<weld::Label> m_xFtFillHoles; + std::unique_ptr<weld::MetricSpinButton> m_xMtFillHoles; + std::unique_ptr<weld::CheckButton> m_xCbFillHoles; + std::unique_ptr<weld::CustomWeld> m_xBmpWin; + std::unique_ptr<weld::CustomWeld> m_xMtfWin; + std::unique_ptr<weld::ProgressBar> m_xPrgs; + std::unique_ptr<weld::Button> m_xBtnOK; + std::unique_ptr<weld::Button> m_xBtnPreview; + + void LoadSettings(); + void SaveSettings() const; + void InitPreviewBmp(); + + static ::tools::Rectangle GetRect( const Size& rDispSize, const Size& rBmpSize ); + Bitmap GetPreparedBitmap( Bitmap const & rBmp, Fraction& rScale ); + void Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf ); + static void AddTile( BitmapReadAccess const * pRAcc, GDIMetaFile& rMtf, + tools::Long nPosX, tools::Long nPosY, tools::Long nWidth, tools::Long nHeight ); + + DECL_LINK( ProgressHdl, tools::Long, void ); + DECL_LINK( ClickPreviewHdl, weld::Button&, void ); + DECL_LINK( ClickOKHdl, weld::Button&, void ); + DECL_LINK( ToggleHdl, weld::Toggleable&, void ); + DECL_LINK( ModifyHdl, weld::SpinButton&, void ); + DECL_LINK( MetricModifyHdl, weld::MetricSpinButton&, void ); + +public: + + SdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell); + virtual ~SdVectorizeDlg() override; + + const GDIMetaFile& GetGDIMetaFile() const { return aMtf; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/view/viewoverlaymanager.hxx b/sd/source/ui/inc/view/viewoverlaymanager.hxx new file mode 100644 index 0000000000..3a5c98deb3 --- /dev/null +++ b/sd/source/ui/inc/view/viewoverlaymanager.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ + +#pragma once + +#include <rtl/ref.hxx> +#include <tools/link.hxx> +#include <svl/lstner.hxx> + +#include <vector> + +namespace sd +{ +class SmartTag; +} +namespace sd::tools +{ +class EventMultiplexerEvent; +} +namespace sd +{ +class ViewShellBase; +} +struct ImplSVEvent; + +namespace sd +{ +typedef std::vector<rtl::Reference<SmartTag>> ViewTagVector; + +class ViewOverlayManager final : public SfxListener +{ +public: + ViewOverlayManager(ViewShellBase& rViewShellBase); + virtual ~ViewOverlayManager() override; + + void onZoomChanged(); + void UpdateTags(); + + DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void); + DECL_LINK(UpdateTagsHdl, void*, void); + + bool CreateTags(); + bool DisposeTags(); + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + +private: + ViewShellBase& mrBase; + ImplSVEvent* mnUpdateTagsEvent; + + ViewTagVector maTagVector; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/zoomlist.hxx b/sd/source/ui/inc/zoomlist.hxx new file mode 100644 index 0000000000..b7f7da79d0 --- /dev/null +++ b/sd/source/ui/inc/zoomlist.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include <vector> + +#include <tools/gen.hxx> + +namespace sd +{ +class ViewShell; + +class ZoomList +{ +public: + ZoomList(ViewShell* pViewShell); + + void InsertZoomRect(const ::tools::Rectangle& rRect); + ::tools::Rectangle const& GetNextZoomRect(); + ::tools::Rectangle const& GetPreviousZoomRect(); + bool IsNextPossible() const; + bool IsPreviousPossible() const; + +private: + ViewShell* mpViewShell; + sal_uInt32 mnCurPos; + + std::vector<::tools::Rectangle> maRectangles; +}; + +} // end of namespace sd + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |