diff options
Diffstat (limited to 'include/svx/sdr/contact')
-rw-r--r-- | include/svx/sdr/contact/displayinfo.hxx | 107 | ||||
-rw-r--r-- | include/svx/sdr/contact/objectcontact.hxx | 175 | ||||
-rw-r--r-- | include/svx/sdr/contact/objectcontactofpageview.hxx | 120 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewcontact.hxx | 148 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewcontactofe3dscene.hxx | 103 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx | 75 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewcontactofsdrobj.hxx | 87 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewcontactofvirtobj.hxx | 54 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewobjectcontact.hxx | 138 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx | 65 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewobjectcontactredirector.hxx | 55 |
11 files changed, 1127 insertions, 0 deletions
diff --git a/include/svx/sdr/contact/displayinfo.hxx b/include/svx/sdr/contact/displayinfo.hxx new file mode 100644 index 000000000..4c5842b45 --- /dev/null +++ b/include/svx/sdr/contact/displayinfo.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX +#define INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX + +#include <svx/svdsob.hxx> +#include <vcl/region.hxx> +#include <svx/svxdllapi.h> +#include <basegfx/range/b2irectangle.hxx> + +namespace sdr +{ + namespace contact + { + class SVXCORE_DLLPUBLIC DisplayInfo final + { + // The Layers which shall be processed (visible) + SdrLayerIDSet maProcessLayers; + + // The redraw area, in logical coordinates of OutputDevice. If Region + // is empty, everything needs to be redrawn + vcl::Region maRedrawArea; + + /// only for Writer: current page being painted + basegfx::B2IRectangle m_WriterPageFrame; + + // Internal flag to know when the control layer is painted. Default is + // false. If set to true, painting of the page, page borders and + // the rasters will be suppressed as if mbPageProcessingActive is set (see there). + // This flag is set internally from the processing mechanism to avoid double page + // painting when the control layer needs to be painted as last layer + bool mbControlLayerProcessingActive : 1; + + // Internal flag to decide if page stuff (background, border, MasterPage, grid, etc...) + // will be processed at all. This flag is user-defined and will not be changed from the + // processing mechanism. Default is true, thus set to false if PagePainting should be suppressed. + // For more granular switching page stuff painting on and off, use the according flags at the + // view (->Is*Visible()) + bool mbPageProcessingActive : 1; + + // Internal flag to remember if EnteredGroupDrawMode is active. Default is true + // since this mode starts activated and gets switched off when reaching + // the current group level. Should only be changed by instances which do + // primitive processing + bool mbGhostedDrawModeActive : 1; + + // Internal flag to know if a MasterPage is processed as SubContent of another + // page. Initialized to false, this should only be changed from the instance which + // is processing the MasterPage asSubContent and knows what it does + bool mbSubContentActive : 1; + + public: + // basic constructor. + DisplayInfo(); + + // access to ProcessLayers + void SetProcessLayers(const SdrLayerIDSet& rSet); + const SdrLayerIDSet& GetProcessLayers() const { return maProcessLayers; } + + // access to RedrawArea + void SetRedrawArea(const vcl::Region& rRegion); + const vcl::Region& GetRedrawArea() const { return maRedrawArea; } + + void SetWriterPageFrame(basegfx::B2IRectangle const& rPageFrame); + basegfx::B2IRectangle const& GetWriterPageFrame() const { return m_WriterPageFrame; } + + // Access to ControlLayerProcessingActive flag + void SetControlLayerProcessingActive(bool bDoPaint); + bool GetControlLayerProcessingActive() const { return mbControlLayerProcessingActive; } + + // Access to PageProcessingActive flag + void SetPageProcessingActive(bool bDoPaint); + bool GetPageProcessingActive() const { return mbPageProcessingActive; } + + // Save the original DrawMode from outdev + void ClearGhostedDrawMode(); + void SetGhostedDrawMode(); + bool IsGhostedDrawModeActive() const { return mbGhostedDrawModeActive; } + + // access to master page painting flag + bool GetSubContentActive() const { return mbSubContentActive; } + void SetSubContentActive(bool bNew); + }; + } // end of namespace contact +} // end of namespace sdr + + +#endif // INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/objectcontact.hxx b/include/svx/sdr/contact/objectcontact.hxx new file mode 100644 index 000000000..6d5d63a27 --- /dev/null +++ b/include/svx/sdr/contact/objectcontact.hxx @@ -0,0 +1,175 @@ +/* -*- 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_SVX_SDR_CONTACT_OBJECTCONTACT_HXX +#define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX + +#include <svx/sdr/animation/objectanimator.hxx> +#include <svx/sdr/animation/animationstate.hxx> +#include <svx/svxdllapi.h> +#include <drawinglayer/geometry/viewinformation2d.hxx> + +class SdrLayerIDSet; +namespace tools { class Rectangle; } +class SdrPageView; +class OutputDevice; + +namespace basegfx { + class B2DRange; + class B2DHomMatrix; +} + +namespace sdr::contact { + +class DisplayInfo; +class ViewContact; +class ViewObjectContactRedirector; + +class SVXCORE_DLLPUBLIC ObjectContact +{ +private: + // make ViewObjectContact a friend to exclusively allow it to use + // AddViewObjectContact/RemoveViewObjectContact + friend class ViewObjectContact; + + // All VOCs which are created using this OC, thus remembering this OC + // as a reference. All those VOCs need to be deleted when the OC goes down. + // Registering and de-registering is done in the VOC constructors/destructors. + std::vector< ViewObjectContact* > maViewObjectContactVector; + + // A new ViewObjectContact was created and shall be remembered. + void AddViewObjectContact(ViewObjectContact& rVOContact); + + // A ViewObjectContact was deleted and shall be forgotten. + void RemoveViewObjectContact(ViewObjectContact& rVOContact); + + // the primitiveAnimator which is used if this View and/or the contained primitives + // support animatedSwitchPrimitives + sdr::animation::primitiveAnimator maPrimitiveAnimator; + + // The redirector. If set it is used to pipe all supported calls + // to the redirector + ViewObjectContactRedirector* mpViewObjectContactRedirector; + + // the Primitive2DParameters containing view information + drawinglayer::geometry::ViewInformation2D maViewInformation2D; + + // flag for preview renderer + bool mbIsPreviewRenderer : 1; + +protected: + // Interface to allow derivates to travel over the registered VOC's + sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); } + ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; } + + // interface to allow derivates to set PreviewRenderer flag + void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; } + + // interface to allow derivates to set ViewInformation2D + void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; } + +public: + // basic constructor + ObjectContact(); + virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE; + + // LazyInvalidate request. This is used from the VOCs to mark that they + // got invalidated by an ActionChanged() call. An active view needs to remember + // this and take action on it. Default implementation directly calls back + // triggerLazyInvalidate() which promptly handles the request + virtual void setLazyInvalidate(ViewObjectContact& rVOC); + + // call this to support evtl. preparations for repaint. Default does nothing + virtual void PrepareProcessDisplay(); + + // Process the whole displaying + virtual void ProcessDisplay(DisplayInfo& rDisplayInfo); + + // test if visualizing of entered groups is switched on at all. Default + // implementation returns sal_False. + virtual bool DoVisualizeEnteredGroup() const; + + // get active group's (the entered group) ViewContact + virtual const ViewContact* getActiveViewContact() const; + + // Invalidate given rectangle at the window/output which is represented by + // this ObjectContact. Default does nothing. + virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const; + + // Get info about the need to visualize GluePoints. The default + // is that it is not necessary. + virtual bool AreGluePointsVisible() const; + + // method to get the primitiveAnimator + sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; } + + // check if text animation is allowed. Default is sal_true. + virtual bool IsTextAnimationAllowed() const; + + // check if graphic animation is allowed. Default is sal_true. + virtual bool IsGraphicAnimationAllowed() const; + + // access to ViewObjectContactRedirector + ViewObjectContactRedirector* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector; } + void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew); + + // print? Default is false + virtual bool isOutputToPrinter() const; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const; + + // gray display mode + virtual bool isDrawModeGray() const; + + // high contrast display mode + virtual bool isDrawModeHighContrast() const; + + // check if this is a preview renderer. Default is sal_False. + bool IsPreviewRenderer() const { return mbIsPreviewRenderer; } + + // get Primitive2DParameters for this view + const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; } + + /// access to SdrPageView. May return 0L like the default implementations do. Override as needed. + virtual SdrPageView* TryToGetSdrPageView() const; + + /// access to OutputDevice. May return 0L like the default implementations do. Override as needed. + virtual OutputDevice* TryToGetOutputDevice() const; + + // interface to support GridOffset for non-linear ViewToDevice transformation (calc) + virtual bool supportsGridOffsets() const; + virtual void calculateGridOffsetForViewOjectContact( + basegfx::B2DVector& rTarget, + const ViewObjectContact& rClient) const; + virtual void calculateGridOffsetForB2DRange( + basegfx::B2DVector& rTarget, + const basegfx::B2DRange& rB2DRange) const; + void resetAllGridOffsets(); +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/objectcontactofpageview.hxx b/include/svx/sdr/contact/objectcontactofpageview.hxx new file mode 100644 index 000000000..c3f4ef9d3 --- /dev/null +++ b/include/svx/sdr/contact/objectcontactofpageview.hxx @@ -0,0 +1,120 @@ +/* -*- 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_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX +#define INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX + +#include <svx/sdr/contact/objectcontact.hxx> +#include <vcl/idle.hxx> + +class SdrPageWindow; +class SdrPage; + +namespace sdr +{ + namespace contact + { + class SVXCORE_DLLPUBLIC ObjectContactOfPageView : public ObjectContact, public Idle + { + // the owner of this ObjectContactOfPageView. Set from constructor and not + // to be changed in any way. + SdrPageWindow& mrPageWindow; + + // Process the whole displaying, the real version + void DoProcessDisplay(DisplayInfo& rDisplayInfo); + + public: + // access to SdrPageWindow + SdrPageWindow& GetPageWindow() const { return mrPageWindow; } + + // access to SdrPage of PageView + SdrPage* GetSdrPage() const; + + // basic constructor, used from SdrPageView. + explicit ObjectContactOfPageView(SdrPageWindow& rPageWindow, + const char *pDebugName); + virtual ~ObjectContactOfPageView() override; + + // LazyInvalidate request. This is used from the VOCs to mark that they + // got invalidated by an ActionChanged() call. An active view needs to remember + // this and take action on it. Default implementation directly calls back + // triggerLazyInvalidate() which promptly handles the request + virtual void setLazyInvalidate(ViewObjectContact& rVOC) override; + + // call this to support evtl. preparations for repaint + virtual void PrepareProcessDisplay() override; + + // From baseclass Timer, the timeout call triggered by the LazyInvalidate mechanism + virtual void Invoke() final override; + + // Process the whole displaying + virtual void ProcessDisplay(DisplayInfo& rDisplayInfo) override; + + // test if visualizing of entered groups is switched on at all + virtual bool DoVisualizeEnteredGroup() const override; + + // get active group's (the entered group) ViewContact + virtual const ViewContact* getActiveViewContact() const override; + + // Invalidate given rectangle at the window/output which is represented by + // this ObjectContact. + virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const override; + + // Get info about the need to visualize GluePoints. The default + // is that it is not necessary. + virtual bool AreGluePointsVisible() const override; + + // check if text animation is allowed. + virtual bool IsTextAnimationAllowed() const override; + + // check if graphic animation is allowed. + virtual bool IsGraphicAnimationAllowed() const override; + + // print? Default is false + virtual bool isOutputToPrinter() const override; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const override; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const override; + + // gray display mode + virtual bool isDrawModeGray() const override; + + // high contrast display mode + virtual bool isDrawModeHighContrast() const override; + + // override access to SdrPageView + virtual SdrPageView* TryToGetSdrPageView() const override; + + // access to OutputDevice. May return 0L like the default implementations do. Override as needed. + virtual OutputDevice* TryToGetOutputDevice() const override; + + /** sets all UNO controls which are associated with this ObjectContact to + design or alive mode. + */ + void SetUNOControlsDesignMode( bool _bDesignMode ) const; + }; + } // end of namespace contact +} // end of namespace sdr + +#endif // INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx new file mode 100644 index 000000000..c3e9328d9 --- /dev/null +++ b/include/svx/sdr/contact/viewcontact.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX + +#include <sal/types.h> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +class SdrLayerIDSet; +class SdrPage; +class SdrObject; + +namespace sdr::contact { + +class ObjectContact; +class ViewObjectContact; + +class SVXCORE_DLLPUBLIC ViewContact +{ +private: + // make ViewObjectContact a friend to exclusively allow it to use + // AddViewObjectContact/RemoveViewObjectContact + friend class ViewObjectContact; + + // List of ViewObjectContacts. This contains all VOCs which were constructed + // with this VC. Since the VOCs remember a reference to this VC, this list needs + // to be kept and is used e.g. at destructor to destroy all VOCs. + // Registering and de-registering is done in the VOC constructors/destructors. + std::vector< ViewObjectContact* > maViewObjectContactVector; + + // Primitive2DContainer of the ViewContact. This contains all necessary information + // for the graphical visualisation and needs to be supported by all VCs which + // can be visualized. + drawinglayer::primitive2d::Primitive2DContainer mxViewIndependentPrimitive2DSequence; + + // A new ViewObjectContact was created and shall be remembered. + void AddViewObjectContact(ViewObjectContact& rVOContact); + + // A ViewObjectContact was deleted and shall be forgotten. + void RemoveViewObjectContact(ViewObjectContact& rVOContact); + + // internal tooling to delete VOCs + void deleteAllVOCs(); + +protected: + // Interface to allow derivates to travel over the registered VOC's + sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); } + ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; } + + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. Default is to create + // a standard ViewObjectContact containing the given ObjectContact and *this + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact); + + // This method is responsible for creating the graphical visualisation data derived ONLY from + // the model data. It will be stored/buffered in mxViewIndependentPrimitive2DSequence. The default implementation + // creates a yellow replacement rectangle (1000, 1000, 5000, 3000) to visualize missing + // implementations. All implementations have to provide basic geometry here, this is the central + // visualisation method and will also be used for BoundRect computations in the long run. + // This means it's always an error when the default implementation is called and thus gets + // asserted there + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const; + + // basic constructor. Since this is a base class only, it shall + // never be called directly + ViewContact(); + +public: + // basic destructor with needed cleanups + virtual ~ViewContact(); + + // get an Object-specific ViewObjectContact for a specific + // ObjectContact (->View). Always needs to return something. + ViewObjectContact& GetViewObjectContact(ObjectContact& rObjectContact); + + // Test if this ViewContact has ViewObjectContacts(excluding previews) at all. This can + // be used to test if this ViewContact is visualized ATM or not + bool HasViewObjectContacts() const; + + // Check if this primitive is animated in any OC (View) which means it has + // generated a PrimitiveAnimation in its VOC + bool isAnimatedInAnyViewObjectContact() const; + + // Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L + // and GetViewContact default pops up an assert since it's an error if + // GetObjectCount has a result != 0 and it's not overridden. + virtual sal_uInt32 GetObjectCount() const; + virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const; + virtual ViewContact* GetParentContact() const; + + // React on insertion of a child into DRawHierarchy starting + // from this object + void ActionChildInserted(ViewContact& rChild); + + // access to SdrObject. May return 0L like the default + // implementations do. Override as needed. + virtual SdrObject* TryToGetSdrObject() const; + + // React on changes of the object of this ViewContact + virtual void ActionChanged(); + + // access to the local primitive. This will ensure that the primitive is + // current in comparing the local one with a fresh created incarnation + drawinglayer::primitive2d::Primitive2DContainer const & getViewIndependentPrimitive2DContainer() const; + + // add Gluepoints (if available) + virtual drawinglayer::primitive2d::Primitive2DContainer createGluePointPrimitive2DSequence() const; + + // Allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This + // is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception + // for 3D scenes. + // We take the param by value, since, for the common case, we can just std::move into the param, and + // std::move the result out, avoiding copying. + virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer rSource) const; + + virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const; + + // delete all existing VOCs including DrawHierarchy which will invalidate all + // visualisations, too. Used mostly at object removal from DrawHierarchy to + // delete all existing VOCs by purpose, but can also be used for other purposes. + // It is always possible to delete the VOCs, these are re-created on demand + void flushViewObjectContacts(bool bWithHierarchy = true); +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofe3dscene.hxx b/include/svx/sdr/contact/viewcontactofe3dscene.hxx new file mode 100644 index 000000000..b26e272f9 --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofe3dscene.hxx @@ -0,0 +1,103 @@ +/* -*- 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_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX + +#include <svx/scene3d.hxx> +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> +#include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <drawinglayer/geometry/viewinformation3d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + +namespace basegfx { + class B3DRange; +} + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfE3dScene final : public ViewContactOfSdrObj +{ +public: + // basic constructor, used from SdrObject. + explicit ViewContactOfE3dScene(E3dScene& rScene); + + // access to SdrObject + const E3dScene& GetE3dScene() const + { + return static_cast<const E3dScene&>(GetSdrObject()); + } + + // React on changes of the object of this ViewContact + virtual void ActionChanged() override; + + // access to ViewInformation3D and ObjectTransformation + const drawinglayer::geometry::ViewInformation3D& getViewInformation3D(const ::basegfx::B3DRange& rContentRange) const; + const drawinglayer::geometry::ViewInformation3D& getViewInformation3D() const; + const basegfx::B2DHomMatrix& getObjectTransformation() const; + + // attribute providers + const drawinglayer::attribute::SdrSceneAttribute& getSdrSceneAttribute() const; + const drawinglayer::attribute::SdrLightingAttribute& getSdrLightingAttribute() const; + + // scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the + // given SdrLayerIDSet is done. + drawinglayer::primitive2d::Primitive2DContainer createScenePrimitive2DSequence(const SdrLayerIDSet* pLayerVisibility) const; + + // helpers to get the sequence of all contained 3D primitives and its range, + // regardless of layer or visibility constraints and using a neutral ViewInformation3D + drawinglayer::primitive3d::Primitive3DContainer getAllPrimitive3DContainer() const; + basegfx::B3DRange getAllContentRange3D() const; + +private: + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. Default is to create + // a standard ViewObjectContact containing the given ObjectContact and *this + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override; + + // create methods for ViewInformation3D and ObjectTransformation + void createViewInformation3D(const ::basegfx::B3DRange& rContentRange); + void createObjectTransformation(); + + // attribute creators + void createSdrSceneAttribute(); + void createSdrLightingAttribute(); + + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override; + + // the 3d transformation stack + drawinglayer::geometry::ViewInformation3D maViewInformation3D; + + // the object transformation + basegfx::B2DHomMatrix maObjectTransformation; + + // attributes + drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute; + drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx new file mode 100644 index 000000000..cb2953200 --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx @@ -0,0 +1,75 @@ +/* -*- 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_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX + +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> +#include <svx/svxdllapi.h> +#include <svx/svdomedia.hxx> +#include <tools/gen.hxx> + +namespace avmedia { class MediaItem; } + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfSdrMediaObj : public ViewContactOfSdrObj +{ + friend class ViewObjectContactOfSdrMediaObj; + +public: + + // basic constructor, used from SdrObject. + explicit ViewContactOfSdrMediaObj( SdrMediaObj& rMediaObj ); + virtual ~ViewContactOfSdrMediaObj() override; + +public: + + // access to SdrMediaObj + const SdrMediaObj& GetSdrMediaObj() const + { + return static_cast<const SdrMediaObj&>(GetSdrObject()); + } + + Size getPreferredSize() const; + + void updateMediaItem( ::avmedia::MediaItem& rItem ) const; + void executeMediaItem( const ::avmedia::MediaItem& rItem ); + +protected: + + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override; + + // get notified if some properties have changed + void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); + +protected: + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override; +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofsdrobj.hxx b/include/svx/sdr/contact/viewcontactofsdrobj.hxx new file mode 100644 index 000000000..a20dde7bb --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofsdrobj.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX + +#include <sal/types.h> +#include <svx/sdr/contact/viewcontact.hxx> +#include <svx/sdtakitm.hxx> +#include <svx/svxdllapi.h> + +class SdrObject; +class GeoStat; +class Bitmap; + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfSdrObj : public ViewContact +{ +protected: + // the owner of this ViewContact. Set from constructor and not + // to be changed in any way. + SdrObject& mrObject; + + // Remember AnimationKind of object. Used to find out if that kind + // has changed in ActionChanged() + SdrTextAniKind meRememberedAnimationKind; + + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override; + +public: + // access to SdrObject + SdrObject& GetSdrObject() const + { + return mrObject; + } + + // basic constructor, used from SdrObject. + explicit ViewContactOfSdrObj(SdrObject& rObj); + virtual ~ViewContactOfSdrObj() override; + + // Access to possible sub-hierarchy + virtual sal_uInt32 GetObjectCount() const override; + virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const override; + virtual ViewContact* GetParentContact() const override; + + // React on changes of the object of this ViewContact + virtual void ActionChanged() override; + + /// override for accessing the SdrObject + virtual SdrObject* TryToGetSdrObject() const override; + + + // primitive stuff + + // add Gluepoints (if available) + virtual drawinglayer::primitive2d::Primitive2DContainer createGluePointPrimitive2DSequence() const override; + + // allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This + // is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception + // for 3D scenes + virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer aSource) const override; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofvirtobj.hxx b/include/svx/sdr/contact/viewcontactofvirtobj.hxx new file mode 100644 index 000000000..f1374c7fb --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofvirtobj.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX + +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> + +class SdrVirtObj; + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfVirtObj : public ViewContactOfSdrObj +{ +protected: + // internal access to SdrObject. Implementation in *.cxx to avoid + // including SdrVirtObj here. + SdrVirtObj& GetVirtObj() const; + +public: + // basic constructor, used from SdrObject. + explicit ViewContactOfVirtObj(SdrVirtObj& rObj); + virtual ~ViewContactOfVirtObj() override; + + // Access to possible sub-hierarchy + virtual sal_uInt32 GetObjectCount() const override; + +protected: + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx new file mode 100644 index 000000000..9c806aa08 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontact.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX + +#include <memory> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace vcl { class Region; } + +namespace sdr::animation { + class PrimitiveAnimation; +} + +namespace sdr::contact { + +class DisplayInfo; +class ObjectContact; +class ViewContact; +class ViewObjectContactRedirector; + +class SVXCORE_DLLPUBLIC ViewObjectContact +{ +private: + // must-exist and constant contacts + ObjectContact& mrObjectContact; + ViewContact& mrViewContact; + + // This range defines the object's BoundRect + basegfx::B2DRange maObjectRange; + + // PrimitiveSequence of the ViewContact. This contains all necessary information + // for the graphical visualisation and needs to be supported by all VCs which + // can be visualized. + drawinglayer::primitive2d::Primitive2DContainer mxPrimitive2DSequence; + + // the PrimitiveAnimation if Primitive2DContainer contains animations + std::unique_ptr<sdr::animation::PrimitiveAnimation> mpPrimitiveAnimation; + + // possible on-demand calculated GridOffset for non-linear ViewToDevice transformation (calc) + basegfx::B2DVector maGridOffset; + + // This bool gets set when the object gets invalidated by ActionChanged() and + // can be used from the OC to late-invalidates + bool mbLazyInvalidate : 1; + +protected: + // make redirector a protected friend, it needs to call createPrimitives as default action + friend class ViewObjectContactRedirector; + + // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation + // and setup accordingly + void checkForPrimitive2DAnimations(); + + // This method is responsible for creating the graphical visualisation data which is + // stored/cached in the local primitive. Default gets view-independent Primitive + // from the ViewContact using ViewContact::getViewIndependentPrimitive2DContainer(), takes care of + // visibility, handles glue and ghosted. + // This method will not handle included hierarchies and not check geometric visibility. + virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + + // method for flushing Primitive2DContainer for VOC implementations + void flushPrimitive2DSequence() { mxPrimitive2DSequence.clear(); } + +public: + // basic constructor. + ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact); + virtual ~ViewObjectContact(); + + // access to ObjectContact + ObjectContact& GetObjectContact() const { return mrObjectContact; } + + // access to ViewContact + ViewContact& GetViewContact() const { return mrViewContact; } + + // get the object size range + const basegfx::B2DRange& getObjectRange() const; + + // React on changes of the object of this ViewContact + virtual void ActionChanged(); + + // LazyInvalidate handling + void triggerLazyInvalidate(); + + // Check if this primitive is animated in any OC (View) which means it has + // generated a PrimitiveAnimation + bool isAnimated() const { return (nullptr != mpPrimitiveAnimation); } + + // Take some action when new objects are inserted + void ActionChildInserted(ViewContact& rChild); + + // access to the local primitive. This will ensure that the local primitive is + // current in comparing the local one with a fresh created incarnation + // This method will not handle included hierarchies and not check visibility. + drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + + // test this VOC for visibility concerning model-view stuff like e.g. Layer + virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; + + // test this VOC for ghosted mode + virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const; + + // process this primitive: Eventually also recursively travel an existing hierarchy, + // e.g. for group objects, scenes or pages. This method will test geometrical visibility. + virtual drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; + + // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy + drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const; + + // interface to support GridOffset for non-linear ViewToDevice transformation (calc) + const basegfx::B2DVector& getGridOffset() const; + void resetGridOffset(); +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx new file mode 100644 index 000000000..07e748651 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontactofsdrobj.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX + +#include <svx/sdr/contact/viewobjectcontact.hxx> + +class SdrObject; +class SdrLayerIDSet; +class OutputDevice; + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewObjectContactOfSdrObj : public ViewObjectContact +{ + /** Test whether the primitive is visible on any layer from @c aLayers + + This should be overridden by ViewObjectContacts of SDR classes + that have subparts which can be on different layers (that is, + SdrObjGroup .-) + */ + virtual bool isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const; + +protected: + const SdrObject& getSdrObject() const; + +public: + ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact); + virtual ~ViewObjectContactOfSdrObj() override; + + virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const override; + + /** retrieves the device which a PageView belongs to, starting from its ObjectContactOfPageView + + Since #i72752#, the PaintWindow (and thus the OutputDevice) associated with a PageView is not + constant over its lifetime. Instead, during some paint operations, the PaintWindow/OutputDevice + might be temporarily patched. + + This method cares for this, by retrieving the very original OutputDevice. + */ + const OutputDevice* getPageViewOutputDevice() const; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewobjectcontactredirector.hxx b/include/svx/sdr/contact/viewobjectcontactredirector.hxx new file mode 100644 index 000000000..1dc69d238 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontactredirector.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX + +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace sdr::contact { + +class DisplayInfo; +class ViewObjectContact; + +// This class provides a mechanism to redirect the paint mechanism for all or +// single ViewObjectContacts. An own derivation may be set at single ViewContacts +// or at the ObjectContact for redirecting all. If both is used, the one at single +// objects will have priority. +class SVXCORE_DLLPUBLIC ViewObjectContactRedirector +{ +public: + // basic constructor. + ViewObjectContactRedirector(); + + // The destructor. + virtual ~ViewObjectContactRedirector(); + + // all default implementations just call the same methods at the original. To do something + // different, override the method and at least do what the method does. + virtual drawinglayer::primitive2d::Primitive2DContainer createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, + const sdr::contact::DisplayInfo& rDisplayInfo); +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |