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 /include/svx/sdr | |
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 'include/svx/sdr')
29 files changed, 2918 insertions, 0 deletions
diff --git a/include/svx/sdr/animation/animationstate.hxx b/include/svx/sdr/animation/animationstate.hxx new file mode 100644 index 0000000000..a2e079725d --- /dev/null +++ b/include/svx/sdr/animation/animationstate.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 . + */ + +#ifndef INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX +#define INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX + +#include <sal/types.h> +#include <svx/sdr/animation/scheduler.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + +namespace sdr::contact { class ViewObjectContact; } + +namespace sdr::animation + { + class PrimitiveAnimation final : public Event + { + // the animated VOC + sdr::contact::ViewObjectContact& mrVOContact; + + // the vector of animated primitives + drawinglayer::primitive2d::Primitive2DContainer maAnimatedPrimitives; + + // local helpers + double getSmallestNextTime(double fCurrentTime); + void prepareNextEvent(); + + public: + // basic constructor. + PrimitiveAnimation(sdr::contact::ViewObjectContact& rVOContact, drawinglayer::primitive2d::Primitive2DContainer&& rAnimatedPrimitives); + + // destructor + virtual ~PrimitiveAnimation() override; + + // execute event, from base class Event + virtual void Trigger(sal_uInt32 nTime) override; + }; + +} // end of namespace sdr::animation + +#endif // INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/animation/objectanimator.hxx b/include/svx/sdr/animation/objectanimator.hxx new file mode 100644 index 0000000000..a0e199932b --- /dev/null +++ b/include/svx/sdr/animation/objectanimator.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 . + */ + +#ifndef INCLUDED_SVX_SDR_ANIMATION_OBJECTANIMATOR_HXX +#define INCLUDED_SVX_SDR_ANIMATION_OBJECTANIMATOR_HXX + +#include <config_options.h> +#include <svx/sdr/animation/scheduler.hxx> + + +namespace sdr::animation +{ + class primitiveAnimator final : public Scheduler + { + public: + // basic constructor and destructor + primitiveAnimator(); + UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) virtual ~primitiveAnimator() override; + }; +} // end of namespace sdr::animation + + +#endif // INCLUDED_SVX_SDR_ANIMATION_OBJECTANIMATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/animation/scheduler.hxx b/include/svx/sdr/animation/scheduler.hxx new file mode 100644 index 0000000000..312083b684 --- /dev/null +++ b/include/svx/sdr/animation/scheduler.hxx @@ -0,0 +1,99 @@ +/* -*- 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_ANIMATION_SCHEDULER_HXX +#define INCLUDED_SVX_SDR_ANIMATION_SCHEDULER_HXX + +#include <sal/types.h> +#include <vcl/timer.hxx> +#include <svx/svxdllapi.h> +#include <vector> + + +namespace sdr::animation + { + + class SVXCORE_DLLPUBLIC Event + { + // time of event in ms + sal_uInt32 mnTime; + + public: + // constructor/destructor + SAL_DLLPRIVATE explicit Event(); + virtual ~Event(); + + // get/set time + SAL_DLLPRIVATE sal_uInt32 GetTime() const { return mnTime; } + void SetTime(sal_uInt32 nNew); + + // execute event + virtual void Trigger(sal_uInt32 nTime) = 0; + }; + + class SVXCORE_DLLPUBLIC Scheduler : public Timer + { + // time in ms + sal_uInt32 mnTime; + + // next delta time + sal_uInt32 mnDeltaTime; + + // list of events, sorted by time + std::vector<Event*> mvEvents; + + // Flag which remembers if this timer is paused. Default + // is false. + bool mbIsPaused; + + public: + // constructor/destructor + SAL_DLLPRIVATE Scheduler(); + virtual ~Scheduler() override; + + // From baseclass Timer, the timeout call + virtual void Invoke() override; + + // get time + SAL_DLLPRIVATE sal_uInt32 GetTime() const { return mnTime; } + + // #i38135# + SAL_DLLPRIVATE void SetTime(sal_uInt32 nTime); + + // execute all ripe events, removes executed ones from the scheduler + SAL_DLLPRIVATE void triggerEvents(); + + // re-start or stop timer according to event list + SAL_DLLPRIVATE void checkTimeout(); + + // insert/remove events, wrapper to EventList methods + void InsertEvent(Event& rNew); + SAL_DLLPRIVATE void RemoveEvent(Event* pOld); + + // get/set pause + SAL_DLLPRIVATE bool IsPaused() const { return mbIsPaused; } + SAL_DLLPRIVATE void SetPaused(bool bNew); + }; + +} // end of namespace sdr::animation + + +#endif // INCLUDED_SVX_SDR_ANIMATION_SCHEDULER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx new file mode 100644 index 0000000000..c9bb786a80 --- /dev/null +++ b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SVX_SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX +#define INCLUDED_SVX_SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX + +#include <svx/svxdllapi.h> +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> +#include <svl/itemset.hxx> +#include <optional> + +////////////////////////////////////////////////////////////////////////////// + +class Color; + +namespace drawinglayer::attribute + { + class SVXCORE_DLLPUBLIC SdrAllFillAttributesHelper + { + private: + basegfx::B2DRange maLastPaintRange; + basegfx::B2DRange maLastDefineRange; + std::optional<drawinglayer::attribute::SdrFillAttribute> maFillAttribute; + std::optional<drawinglayer::attribute::FillGradientAttribute> maFillGradientAttribute; + drawinglayer::primitive2d::Primitive2DContainer maPrimitives; + + void createPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange); + + public: + SdrAllFillAttributesHelper(const Color& rColor); + SdrAllFillAttributesHelper(const SfxItemSet& rSet); + ~SdrAllFillAttributesHelper(); + + bool isUsed() const; + bool hasSdrFillAttribute() const { return bool(maFillAttribute); } + bool isTransparent() const; + + const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const; + const drawinglayer::attribute::FillGradientAttribute& getFillGradientAttribute() const; + const drawinglayer::primitive2d::Primitive2DContainer& getPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange) const; + + // get average fill color; tries to calculate a 'medium' color + // which e.g. may be used as comparison to decide if other + // colors are visible + basegfx::BColor getAverageColor(const basegfx::BColor& rFallback) const; + + // return if a repaint of this content needs a complete repaint. This + // is e.g. not needed for no fill or color fill (a partial repaint + // will do the trick), but necessary for everything that is not top-left + // oriented + bool needCompleteRepaint() const; + }; + +} // end of namespace drawinglayer::attribute + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer::attribute +{ + typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +} // end of namespace drawinglayer::attribute + +////////////////////////////////////////////////////////////////////////////// + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/displayinfo.hxx b/include/svx/sdr/contact/displayinfo.hxx new file mode 100644 index 0000000000..b2229042a9 --- /dev/null +++ b/include/svx/sdr/contact/displayinfo.hxx @@ -0,0 +1,94 @@ +/* -*- 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::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 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; } + + // 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 sdr::contact + + +#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 0000000000..8d2dc8c6ad --- /dev/null +++ b/include/svx/sdr/contact/objectcontact.hxx @@ -0,0 +1,187 @@ +/* -*- 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 vcl { + class PDFExtOutDevData; +} + +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; + + // display page decoration? Default is true + virtual bool isPageDecorationActive() const; + + // display mster page content (ViewContactOfMasterPage)? Default is true + virtual bool isMasterPageActive() const; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const; + virtual bool isExportTaggedPDF() const; + virtual ::vcl::PDFExtOutDevData const* GetPDFExtOutDevData() 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 calculateGridOffsetForViewObjectContact( + 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 0000000000..bc99975f43 --- /dev/null +++ b/include/svx/sdr/contact/objectcontactofpageview.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 . + */ + +#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::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; + + // display page decoration? Default is true + virtual bool isPageDecorationActive() const override; + + // display mster page content (ViewContactOfMasterPage)? Default is true + virtual bool isMasterPageActive() const override; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const override; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const override; + virtual bool isExportTaggedPDF() const override; + virtual ::vcl::PDFExtOutDevData const* GetPDFExtOutDevData() 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 sdr::contact + +#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 0000000000..7b6d0f3ab2 --- /dev/null +++ b/include/svx/sdr/contact/viewcontact.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 . + */ + +#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/Primitive2DContainer.hxx> + +class SdrLayerIDSet; +class SdrPage; +class SdrObject; + +namespace sdr::contact +{ +class DisplayInfo; +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 void createViewIndependentPrimitive2DSequence( + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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 + void getViewIndependentPrimitive2DContainer( + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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); + + // helper around getPrimitive2DSequenceHierarchy to enable a given implementation + // to optimize getting a Primitive2DSequenceHierarchy for a child of index a + virtual void getPrimitive2DSequenceHierarchyOfIndex( + sal_uInt32 a, DisplayInfo& rDisplayInfo, ObjectContact& rObjectContact, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor); +}; +} + +#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 0000000000..82de5435ee --- /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 void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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 0000000000..4490818a00 --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx @@ -0,0 +1,74 @@ +/* -*- 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 final : 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); + +private: + // 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); + + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual void createViewIndependentPrimitive2DSequence( + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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 0000000000..788c8058d9 --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofsdrobj.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 . + */ + +#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/svxdllapi.h> + +class SdrObject; + +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; + + // 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 0000000000..3054e63f39 --- /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 void createViewIndependentPrimitive2DSequence( + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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 0000000000..12195a0faa --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontact.hxx @@ -0,0 +1,147 @@ +/* -*- 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/Primitive2DContainer.hxx> + +namespace vcl { class Region; } + +namespace sdr::animation { + class PrimitiveAnimation; +} +namespace drawinglayer::primitive2d { class Primitive2DDecompositionVisitor; } + +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; + + // used to detect ActionChanged() during primitive construction + int mnActionChangedCount; + + // 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 void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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; + + void createStructureTag(drawinglayer::primitive2d::Primitive2DContainer & rNewPrimitiveSequence) const; + + /// check if getPrimitive2DSequence() should create tag + virtual bool isExportPDFTags() 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 void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const; + + // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy + void getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) 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 0000000000..0ea6f307a2 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontactofsdrobj.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 . + */ + +#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; + + static bool isObjectVisibleOnAnyLayer(const SdrObject& rObject, const SdrLayerIDSet& rLayers); +}; +} + +#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 0000000000..100d2ad878 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontactredirector.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 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX + +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/Primitive2DVisitor.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 void createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, + const sdr::contact::DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor); +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx new file mode 100644 index 0000000000..cf1b411366 --- /dev/null +++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.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 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/bitmapex.hxx> + + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayAnimatedBitmapEx final : public OverlayObjectWithBasePosition + { + // the Bitmaps + BitmapEx maBitmapEx1; + BitmapEx maBitmapEx2; + + // position of the basePosition inside the Bitmaps, in pixels + sal_uInt16 mnCenterX1; + sal_uInt16 mnCenterY1; + sal_uInt16 mnCenterX2; + sal_uInt16 mnCenterY2; + + // #i53216# added CursorBlinkTime (in ms) + sal_uInt32 mnBlinkTime; + + // optional shear and rotation + double mfShearX; + double mfRotation; + + // Flag to remember which state to draw. Inited with false (0) + bool mbOverlayState : 1; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + OverlayAnimatedBitmapEx( + const basegfx::B2DPoint& rBasePos, + const BitmapEx& rBitmapEx1, + const BitmapEx& rBitmapEx2, + sal_uInt64 nBlinkTime, + sal_uInt16 nCenX1 = 0, + sal_uInt16 nCenY1 = 0, + sal_uInt16 nCenX2 = 0, + sal_uInt16 nCenY2 = 0, + double fShearX = 0.0, + double fRotation = 0.0); + virtual ~OverlayAnimatedBitmapEx() override; + + // execute event from base class sdr::animation::Event. Default + // implementation does nothing and does not create a new event. + virtual void Trigger(sal_uInt32 nTime) override; + + // get shearX and rotation + double getShearX() const { return mfShearX; } + double getRotation() const { return mfRotation; } + }; +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaybitmapex.hxx b/include/svx/sdr/overlay/overlaybitmapex.hxx new file mode 100644 index 0000000000..42de7d6531 --- /dev/null +++ b/include/svx/sdr/overlay/overlaybitmapex.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 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/bitmapex.hxx> + + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayBitmapEx final : public OverlayObjectWithBasePosition + { + // the Bitmap itself + BitmapEx maBitmapEx; + + // position of the basePosition inside the Bitmap, in pixels + sal_uInt16 mnCenterX; + sal_uInt16 mnCenterY; + + // optional transparency, shear and rotation + double mfAlpha; + double mfShearX; + double mfRotation; + + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + OverlayBitmapEx( + const basegfx::B2DPoint& rBasePos, + const BitmapEx& rBitmapEx, + sal_uInt16 nCenX = 0, + sal_uInt16 nCenY = 0, + double fAlpha = 0.0, + double fShearX = 0.0, + double fRotation = 0.0); + virtual ~OverlayBitmapEx() override; + }; +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaymanager.hxx b/include/svx/sdr/overlay/overlaymanager.hxx new file mode 100644 index 0000000000..696cf5c992 --- /dev/null +++ b/include/svx/sdr/overlay/overlaymanager.hxx @@ -0,0 +1,130 @@ +/* -*- 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_OVERLAY_OVERLAYMANAGER_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX + +#include <rtl/ref.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include <svx/sdr/overlay/overlayobject.hxx> +#include <tools/color.hxx> +#include <tools/gen.hxx> +#include <svx/svxdllapi.h> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <salhelper/simplereferenceobject.hxx> + +class OutputDevice; +class SdrModel; +namespace vcl { class Region; } + +namespace sdr::overlay { + class OverlayObject; +} + +namespace basegfx { + class B2DRange; +} + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayManager + : protected sdr::animation::Scheduler + , public salhelper::SimpleReferenceObject + { + private: + OverlayManager(const OverlayManager&) = delete; + OverlayManager& operator=(const OverlayManager&) = delete; + + protected: + // the OutputDevice to work on, set on construction and not to be changed + OutputDevice& mrOutputDevice; + + // the vector of registered OverlayObjects + OverlayObjectVector maOverlayObjects; + + // Stripe support. All striped OverlayObjects use these stripe + // values. Changes change all those objects. + Color maStripeColorA; // defaults to COL_BLACK + Color maStripeColorB; // defaults to COL_WHITE + sal_uInt32 mnStripeLengthPixel; // defaults to 4L + + // hold buffered the logic length of discrete vector (1.0, 0.0) and the + // view transformation belonging to it. Update happens in getDiscreteOne() + basegfx::B2DHomMatrix maViewTransformation; + drawinglayer::geometry::ViewInformation2D maViewInformation2D; + double mfDiscreteOne; + + // internal + void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const; + void ImpStripeDefinitionChanged(); + void impApplyRemoveActions(OverlayObject& rTarget); + void impApplyAddActions(OverlayObject& rTarget); + + // return mfDiscreteOne to derivations, but also check for buffered local + // ViewTransformation and evtl. correct mfDiscreteOne + double getDiscreteOne() const; + + tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const; + + OverlayManager(OutputDevice& rOutputDevice); + virtual ~OverlayManager() override; + + public: + static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice); + + // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D + drawinglayer::geometry::ViewInformation2D const & getCurrentViewInformation2D() const; + + // complete redraw + virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = nullptr) const; + + // flush. Do buffered updates. + virtual void flush(); + + // get the OutputDevice + OutputDevice& getOutputDevice() const { return mrOutputDevice; } + + // add and remove OverlayObjects + void add(OverlayObject& rOverlayObject); + void remove(OverlayObject& rOverlayObject); + + // invalidate the given range at local OutputDevice + virtual void invalidateRange(const basegfx::B2DRange& rRange); + + // stripe support ColA + const Color& getStripeColorA() const { return maStripeColorA; } + void setStripeColorA(Color aNew); + + // stripe support ColB + const Color& getStripeColorB() const { return maStripeColorB; } + void setStripeColorB(Color aNew); + + // stripe support StripeLengthPixel + sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; } + void setStripeLengthPixel(sal_uInt32 nNew); + + void InsertEvent(sdr::animation::Event& rNew) { Scheduler::InsertEvent(rNew); } + }; + +} // end of namespace sdr::overlay + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayobject.hxx b/include/svx/sdr/overlay/overlayobject.hxx new file mode 100644 index 0000000000..1c8d1d43b1 --- /dev/null +++ b/include/svx/sdr/overlay/overlayobject.hxx @@ -0,0 +1,206 @@ +/* -*- 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_OVERLAY_OVERLAYOBJECT_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX + +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/range/b2drange.hxx> +#include <tools/color.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + +#include <vector> + +class OutputDevice; + +namespace sdr::overlay +{ + class OverlayManager; +} +namespace basegfx +{ + class B2DPolygon; + class B2DPolyPolygon; + class B2DRange; +} + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObject : public sdr::animation::Event + { + private: + OverlayObject(const OverlayObject&) = delete; + OverlayObject& operator=(const OverlayObject&) = delete; + + // Manager is allowed access to private Member mpOverlayManager + friend class OverlayManager; + + // pointer to OverlayManager, if object is added. Changed by + // OverlayManager, do not change Yourself. + OverlayManager* mpOverlayManager; + + // Primitive2DContainer of the OverlayObject + drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence; + + // Possible Offset added to the geometry (automatically in + // createOverlayObjectPrimitive2DSequence()). Usually zero, may + // be used e.g. from calc when GridOffset is needed + basegfx::B2DVector maOffset; + + protected: + // access methods to maPrimitive2DSequence. The usage of this methods may allow + // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence() + // implementations for buffering the last decomposition. + // Resetting is allowed e.g. in ::getOverlayObjectPrimitive2DSequence() implementations + // if the conditions have changed to force a re-creation in calling the base implementation. + // The only allowed setter of maPrimitive2DSequence is + // OverlayObject::getOverlayObjectPrimitive2DSequence() which should be called by calling + // the base implementation in derived functions. That one will use the result of + // createOverlayObjectPrimitive2DSequence() to provide the geometry. + const drawinglayer::primitive2d::Primitive2DContainer& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void resetPrimitive2DSequence() { maPrimitive2DSequence.clear(); } + + // the creation method for Primitive2DContainer. Called when getPrimitive2DSequence() + // sees that maPrimitive2DSequence is empty. Needs to be supported by all + // OverlayObject implementations. Default implementation will assert + // a missing implementation + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence(); + + // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) + static sal_uInt32 impCheckBlinkTimeValueRange(sal_uInt64 nBlinkTime); + + // region in logical coordinates + basegfx::B2DRange maBaseRange; + + // base color of this OverlayObject + Color maBaseColor; + + // Flag for visibility + bool mbIsVisible : 1; + + // Flag to control hittability + bool mbIsHittable : 1; + + // Flag to hold info if this objects supports animation. Default is + // false. If true, the Trigger() method should be overridden + // to implement the animation effect and to re-initiate the event. + bool mbAllowsAnimation : 1; + + // Flag to control if this OverlayObject allows AntiAliased visualisation. + // Default is true, but e.g. for selection visualisation in SC and SW, + // it is switched to false + bool mbAllowsAntiAliase : 1; + + // In High Contrast mode all fg and bg are forced to a pair of normal + // high contrast colors. If this flag is set, then in High Contrast mode + // the colors are instead forced to the high contrast selection fg/bg pair. + // Default is false. + bool mbHighContrastSelection : 1; + + // set changed flag. Call after change, since the old range is invalidated + // and then the new one is calculated and invalidated, too. This will only + // work after the change. + void objectChange(); + + // write access to AntiAliase flag. This is protected since + // only implementations are allowed to change this, preferably in their + // constructor + void allowAntiAliase(bool bNew); + + public: + explicit OverlayObject(Color aBaseColor); + virtual ~OverlayObject() override; + + // get OverlayManager + OverlayManager* getOverlayManager() const { return mpOverlayManager; } + + // the access method for Primitive2DContainer. Will use createPrimitive2DSequence and + // setPrimitive2DSequence if needed. Overriding may be used to allow disposal of last + // created primitives to react on changed circumstances and to re-create primitives + virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const; + + // access to visibility state + bool isVisible() const { return mbIsVisible; } + void setVisible(bool bNew); + + // access to hittable flag + bool isHittable() const { return mbIsHittable; } + void setHittable(bool bNew); + + // read access to AntiAliase flag + bool allowsAntiAliase() const { return mbAllowsAntiAliase; } + + // read access to DrawModeSettings flag + bool isHighContrastSelection() const { return mbHighContrastSelection; } + + // read access to baseRange. This may trigger createBaseRange() if + // object is changed. + const basegfx::B2DRange& getBaseRange() const; + + // access to baseColor + const Color& getBaseColor() const { return maBaseColor; } + void setBaseColor(Color aNew); + + // access to Offset + const basegfx::B2DVector& getOffset() const { return maOffset; } + void setOffset(const basegfx::B2DVector& rOffset); + + // execute event from base class sdr::animation::Event. Default + // implementation does nothing and does not create a new event. + virtual void Trigger(sal_uInt32 nTime) override; + + // access to AllowsAnimation flag + bool allowsAnimation() const { return mbAllowsAnimation; } + + // stripe definition has changed. The OverlayManager does have + // support data to draw graphics in two colors striped. This + // method notifies the OverlayObject if that change takes place. + // Default implementation does nothing. + virtual void stripeDefinitionHasChanged(); + }; + + // typedefs for a vector of OverlayObjects + typedef ::std::vector< OverlayObject* > OverlayObjectVector; + +} // end of namespace sdr::overlay + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject + { + protected: + // base position in logical coordinates + basegfx::B2DPoint maBasePosition; + + public: + OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor); + virtual ~OverlayObjectWithBasePosition() override; + + // access to basePosition + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + void setBasePosition(const basegfx::B2DPoint& rNew); + }; + +} // end of namespace sdr::overlay + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayobjectlist.hxx b/include/svx/sdr/overlay/overlayobjectlist.hxx new file mode 100644 index 0000000000..6985a1b5ae --- /dev/null +++ b/include/svx/sdr/overlay/overlayobjectlist.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 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <sal/types.h> +#include <svx/svxdllapi.h> +#include <memory> +#include <vector> + + +class Point; + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObjectList final + { + // the vector of OverlayObjects + ::std::vector< std::unique_ptr<OverlayObject> > maVector; + + public: + OverlayObjectList() {} + OverlayObjectList(const OverlayObjectList&) = delete; + OverlayObjectList& operator=(const OverlayObjectList&) = delete; + ~OverlayObjectList(); + + // clear list, this includes deletion of all contained objects + void clear(); + + // append objects (takes ownership) + void append(std::unique_ptr<OverlayObject> pOverlayObject); + + // access to objects + sal_uInt32 count() const { return maVector.size(); } + OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); } + + // Hittest with logical coordinates + bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const; + + // Hittest with pixel coordinates + bool isHitPixel(const Point& rDiscretePosition) const; + + // calculate BaseRange of all included OverlayObjects and return + basegfx::B2DRange getBaseRange() const; + }; + +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaypolypolygon.hxx b/include/svx/sdr/overlay/overlaypolypolygon.hxx new file mode 100644 index 0000000000..0cc31b38c7 --- /dev/null +++ b/include/svx/sdr/overlay/overlaypolypolygon.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 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + + +namespace sdr::overlay +{ + class SVXCORE_DLLPUBLIC OverlayPolyPolygon final : public OverlayObject + { + private: + basegfx::B2DPolyPolygon maLinePolyPolygon; + double mfLineWidth; + Color maFillColor; + + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPolyPolygon(basegfx::B2DPolyPolygon aLinePolyPolygon, + Color const & rLineColor, + double mfLineWidth, + Color const & rFillColor); + virtual ~OverlayPolyPolygon() override; + }; + + class SVXCORE_DLLPUBLIC OverlayPolyPolygonStripedAndFilled final : public OverlayObject + { + // geometry + basegfx::B2DPolyPolygon maLinePolyPolygon; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPolyPolygonStripedAndFilled( + basegfx::B2DPolyPolygon aLinePolyPolygon); + virtual ~OverlayPolyPolygonStripedAndFilled() override; + + // change geometry + const basegfx::B2DPolyPolygon& getLinePolyPolygon() const { return maLinePolyPolygon; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged() override; + }; + +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx new file mode 100644 index 0000000000..06e7428de1 --- /dev/null +++ b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.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 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayPrimitive2DSequenceObject final : public OverlayObjectWithBasePosition + { + // the sequence of primitives to show + const drawinglayer::primitive2d::Primitive2DContainer maSequence; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPrimitive2DSequenceObject(drawinglayer::primitive2d::Primitive2DContainer&& rSequence); + + virtual ~OverlayPrimitive2DSequenceObject() override; + }; + +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayselection.hxx b/include/svx/sdr/overlay/overlayselection.hxx new file mode 100644 index 0000000000..d456ac6bf1 --- /dev/null +++ b/include/svx/sdr/overlay/overlayselection.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 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + + +namespace sdr::overlay + { + // overlay type definition + enum class OverlayType + { + Invert, + Solid, + Transparent + }; + + class SVXCORE_DLLPUBLIC OverlaySelection final : public OverlayObject + { + // type of overlay + OverlayType meOverlayType; + + // geometry of overlay + std::vector< basegfx::B2DRange > maRanges; + + // Values of last primitive creation. These are checked in getOverlayObjectPrimitive2DSequence + // to evtl. get rid of last Primitive2DContainer. This ensures that these values are up-to-date + // and are usable when creating primitives + OverlayType maLastOverlayType; + sal_uInt16 mnLastTransparence; + + bool mbBorder : 1; + + // geometry creation for OverlayObject, can use local *Last* values + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + OverlaySelection( + OverlayType eType, + const Color& rColor, + std::vector< basegfx::B2DRange >&& rRanges, + bool bBorder); + virtual ~OverlaySelection() override; + + // data read access + const std::vector< basegfx::B2DRange >& getRanges() const { return maRanges; } + + /// override to check conditions for last createOverlayObjectPrimitive2DSequence + virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const override; + + // data write access + void setRanges(std::vector< basegfx::B2DRange >&& rNew); + }; +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx new file mode 100644 index 0000000000..13d1ccd642 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.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 . + */ + +#ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX +#define INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> +#include <svx/framelink.hxx> + +// predefines + +namespace drawinglayer::primitive2d + { + class SVXCORE_DLLPUBLIC SdrFrameBorderData + { + private: + basegfx::B2DPoint maOrigin; /// start point of borderline + basegfx::B2DVector maX; /// X-Axis of borderline with length + svx::frame::Style maStyle; /// Style of borderline + Color maColor; + bool mbForceColor; + + class SdrConnectStyleData + { + private: + svx::frame::Style maStyle; + basegfx::B2DVector maNormalizedPerpendicular; + bool mbStyleMirrored; + + public: + SdrConnectStyleData( + const svx::frame::Style& rStyle, + const basegfx::B2DVector& rNormalizedPerpendicular, + bool bStyleMirrored); + + const svx::frame::Style& getStyle() const { return maStyle; } + const basegfx::B2DVector& getNormalizedPerpendicular() const { return maNormalizedPerpendicular; } + bool getStyleMirrored() const { return mbStyleMirrored; } + bool operator==(const SdrConnectStyleData& rCompare) const; + }; + + std::vector<SdrConnectStyleData> maStart; + std::vector<SdrConnectStyleData> maEnd; + + public: + SdrFrameBorderData( + const basegfx::B2DPoint& rOrigin, + const basegfx::B2DVector& rX, + const svx::frame::Style& rStyle, + const Color* pForceColor); + + void addSdrConnectStyleData( + bool bStart, + const svx::frame::Style& rStyle, + const basegfx::B2DVector& rNormalizedPerpendicular, + bool bStyleMirrored); + + void create2DDecomposition( + Primitive2DContainer& rContainer, + double fMinDiscreteUnit) const; + + double getMinimalNonZeroBorderWidth() const; + bool operator==(const SdrFrameBorderData& rCompare) const; + }; + + typedef std::vector<SdrFrameBorderData> SdrFrameBorderDataVector; + +} // end of namespace drawinglayer::primitive2d + +namespace drawinglayer::primitive2d + { + class SVXCORE_DLLPUBLIC SdrFrameBorderPrimitive2D final : public BufferedDecompositionPrimitive2D + { + private: + SdrFrameBorderDataVector maFrameBorders; + double mfMinimalNonZeroBorderWidth; + double mfMinimalNonZeroBorderWidthUsedForDecompose; + bool mbForceToSingleDiscreteUnit; + + // local decomposition. + virtual void create2DDecomposition( + Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& aViewInformation) const override; + + public: + SdrFrameBorderPrimitive2D( + SdrFrameBorderDataVector&& rFrameBorders, + bool bForceToSingleDiscreteUnit); + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + // override to get view-dependent + virtual void get2DDecomposition( + Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const override; + + // data access + const SdrFrameBorderDataVector& getFrameBorders() const { return maFrameBorders; } + bool doForceToSingleDiscreteUnit() const { return mbForceToSingleDiscreteUnit; } + + // provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + +} // end of namespace drawinglayer::primitive2d + + +#endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx new file mode 100644 index 0000000000..917d22f149 --- /dev/null +++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.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 . + */ + +#ifndef INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX +#define INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX + +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> + + +#define PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 0) +#define PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 1) +#define PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 2) +#define PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 3) +#define PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 4) +#define PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 5) +#define PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 6) +#define PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 7) +#define PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 8) +#define PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 9) +#define PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 10) +#define PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 11) +#define PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 12) +#define PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 13) +#define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 14) +#define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 15) +#define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16) +#define PRIMITIVE2D_ID_OVERLAYRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17) +#define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) +#define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19) +#define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 20) +#define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21) +#define PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 22) +#define PRIMITIVE2D_ID_SDRCHAINEDTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 23) +#define PRIMITIVE2D_ID_SDRFRAMEBORDERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 24) +#define PRIMITIVE2D_ID_OVERLAYDIAGRAMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 25) +#define PRIMITIVE2D_ID_SLIDEBACKGROUNDFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 26) + + +#endif // INCLUDED_SVX_SDR_PRIMITIVE2D_SVX_PRIMITIVETYPES2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx new file mode 100644 index 0000000000..410fa593ac --- /dev/null +++ b/include/svx/sdr/properties/defaultproperties.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 . + */ + +#ifndef INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX +#define INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX + +#include <sal/config.h> + +#include <optional> +#include <span> + +#include <svx/sdr/properties/properties.hxx> +#include <svx/svxdllapi.h> +#include <svl/itemset.hxx> + +struct _xmlTextWriter; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +namespace sdr::properties + { + class SVXCORE_DLLPUBLIC DefaultProperties : public BaseProperties + { + protected: + // the to be used ItemSet + mutable std::optional<SfxItemSet> moItemSet; + + // create a new object specific itemset with object specific ranges. + virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override; + + // Test changeability for a single item. If an implementation wants to prevent + // changing an item it should override this method. + virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const; + + // Do the internal ItemChange. If only nWhich is given, the item needs to be cleared. + // Also needs to handle if nWhich and pNewItem is 0, which means to clear all items. + virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr); + + // Called after ItemChange() is done for all items. Allows local reactions on + // specific item changes + virtual void PostItemChange(const sal_uInt16 nWhich); + + // Internally react on ItemSet changes. The given span contains changed items. + // If nDeletedWhich is not 0, it indicates a deleted item. + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich); + + // check if SfxItemSet exists + bool HasSfxItemSet() const { return bool(moItemSet); } + + public: + // basic constructor + explicit DefaultProperties(SdrObject& rObj); + + // constructor for copying, but using new object + DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj); + + // destructor + virtual ~DefaultProperties() override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override; + + // get itemset + virtual const SfxItemSet& GetObjectItemSet() const override; + + // set single item + virtual void SetObjectItem(const SfxPoolItem& rItem) override; + + // set single item direct, do not do any notifies or things like that + virtual void SetObjectItemDirect(const SfxPoolItem& rItem) override; + + // clear single item + virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) override; + + // clear single item direct, do not do any notifies or things like that. + // Also supports complete deletion of items when default parameter 0 is used. + virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override; + + // set complete item set + virtual void SetObjectItemSet(const SfxItemSet& rSet) override; + + // set a new StyleSheet and broadcast + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, + bool bBroadcast) override; + + // get the installed StyleSheet + virtual SfxStyleSheet* GetStyleSheet() const override; + + // force default attributes for a specific object type, called from + // DefaultProperties::GetObjectItemSet() if a new ItemSet is created. + // Default implementation does nothing. + virtual void ForceDefaultAttributes(); + }; + +} // end of namespace sdr::properties + +#endif // INCLUDED_SVX_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx new file mode 100644 index 0000000000..d793753c6a --- /dev/null +++ b/include/svx/sdr/properties/properties.hxx @@ -0,0 +1,190 @@ +/* -*- 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_PROPERTIES_PROPERTIES_HXX +#define INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX + +#include <sal/config.h> + +#include <memory> + +#include <sal/types.h> +#include <svx/svxdllapi.h> +#include <svl/typedwhich.hxx> + +struct _xmlTextWriter; +typedef struct _xmlTextWriter* xmlTextWriterPtr; +class SdrObject; +class SfxItemSet; +class SfxPoolItem; +class SfxStyleSheet; +class Fraction; +class SfxItemPool; +class SdrModel; + +namespace sdr::properties +{ + class ItemChangeBroadcaster; +} + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// BaseProperties +// DefaultProperties ->SfxItemSet +// AttributeProperties ->SfxStyleSheet +// E3dProperties +// E3dCompoundProperties +// E3dExtrudeProperties +// E3dLatheProperties +// E3dSphereProperties +// E3dSceneProperties +// TextProperties ->maVersion +// ConnectorProperties +// CustomShapeProperties +// MeasureProperties +// RectangleProperties +// CaptionProperties +// CircleProperties +// GraphicProperties +// OleProperties +// CellProperties +// TableProperties +// GroupProperties +// EmptyProperties +// PageProperties + +namespace sdr::properties + { + class SVXCORE_DLLPUBLIC BaseProperties + { + private: + // the owner of this Properties. Set from constructor and not + // to be changed in any way. + SdrObject& mrObject; + + protected: + // internal access to SdrObject + const SdrObject& GetSdrObject() const; + + SdrObject& GetSdrObject(); + + public: + // basic constructor, used from SdrObject. + explicit BaseProperties(SdrObject& rObj); + + // destructor + virtual ~BaseProperties(); + + virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0; + + // Clone() operator, normally just calls the local copy constructor, + // see above. + virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const = 0; + + // Get the local ItemSet. This directly returns the local ItemSet of the object. No + // merging of ItemSets is done for e.g. Group objects. + virtual const SfxItemSet& GetObjectItemSet() const = 0; + + // get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may + // be overridden e.g for group objects to return a merged ItemSet of the object. + // When using this method the returned ItemSet may contain items in the state + // SfxItemState::DONTCARE which means there were several such items with different + // values. + virtual const SfxItemSet& GetMergedItemSet() const; + + // Sets all items which are on state SfxItemState::SET in rSet at the local ItemSet. + // Uses AllowItemChange(), ItemChange(), PostItemChange() and ItemSetChanged() calls. + virtual void SetObjectItemSet(const SfxItemSet& rSet) = 0; + + // Set merged ItemSet. Normally, this maps to SetObjectItemSet(). + virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false); + + // Set single item at the local ItemSet. Uses AllowItemChange(), + // ItemChange(), PostItemChange() and ItemSetChanged() calls. + virtual void SetObjectItem(const SfxPoolItem& rItem) = 0; + + // Set a single item direct. Only uses AllowItemChange() and ItemChange(), + // but not PostItemChange() and ItemSetChanged() calls. + virtual void SetObjectItemDirect(const SfxPoolItem& rItem) = 0; + + // Clear a single local item. Uses AllowItemChange(), + // ItemChange(), PostItemChange() and ItemSetChanged() calls. + virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) = 0; + + // Set a single item, iterate over hierarchies if necessary. Default + // Implementation falls back to ClearObjectItem(). + virtual void SetMergedItem(const SfxPoolItem& rItem); + + // Clear a single item, iterate over hierarchies if necessary. Default + // Implementation falls back to ClearObjectItem(). + virtual void ClearMergedItem(const sal_uInt16 nWhich); + + // Clear single item direct. Only uses AllowItemChange() and ItemChange(), + // but not PostItemChange() and ItemSetChanged() calls. + // Also supports complete deletion of items when default parameter 0 is used. + virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) = 0; + + // Set a new StyleSheet. Registers as listener at the StyleSheet to get knowledge + // of StyleSheet changes. + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, + bool bBroadcast) = 0; + + // Get the installed StyleSheet. + virtual SfxStyleSheet* GetStyleSheet() const = 0; + + // force all attributes which come from styles to hard attributes + // to be able to live without the style. + virtual void ForceStyleToHardAttributes(); + + // syntactical sugar for ItemSet accesses. Broadcasts before and after the changes + // to invalidate views in old and new BoundRects. As soon as the repaint mechanism + // will be changed these broadcasts will no longer be needed. + //void SetItemAndBroadcast(const SfxPoolItem& rItem); + //void ClearItemAndBroadcast(const sal_uInt16 nWhich = 0); + void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false); + + // Just a convenient shortcut for GetObjectItemSet().Get(nWhich). + const SfxPoolItem& GetItem(const sal_uInt16 nWhich) const; + template<class T> const T& GetItem(TypedWhichId<T> nWhich) const + { + return static_cast<const T&>(GetItem(sal_uInt16(nWhich))); + } + + // support for convenient broadcasting. Used from SetMergedItemAndBroadcast(), + // ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above. + // But also from inside SdrObjects. + void BroadcastItemChange(const ItemChangeBroadcaster& rChange); + + // #i101556# add versioning mechanism; used from e.g. text attribute set to + // allow detection of e.g. style sheet or single text attribute changes. The + // default implementation returns 0 (zero) + virtual sal_uInt32 getVersion() const; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; + }; + + // checks the FillStyle item and removes unneeded Gradient, FillBitmap and Hatch items + void SVXCORE_DLLPUBLIC CleanupFillProperties( SfxItemSet& rItemSet ); + +} // end of namespace sdr::properties + +#endif // INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx new file mode 100644 index 0000000000..91b9ca7ce7 --- /dev/null +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -0,0 +1,205 @@ +/* -*- 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_TABLE_TABLECONTROLLER_HXX +#define INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX + +#include <com/sun/star/util/XModifyListener.hpp> +#include <rtl/ref.hxx> + +#include <svx/sdr/overlay/overlayobjectlist.hxx> +#include <svx/selectioncontroller.hxx> +#include <svx/svdotable.hxx> +#include <svx/svdview.hxx> +#include <optional> +#include <unotools/weakref.hxx> + +struct ImplSVEvent; +class SdrView; +class SdrObject; +class SfxItemSet; +class SvxBoxInfoItem; +class SvxBoxItem; + +namespace sdr::table { + +class TableModel; + +class SVXCORE_DLLPUBLIC SvxTableController final : public sdr::SelectionController +{ +public: + SVX_DLLPRIVATE SvxTableController( + SdrView& rView, + const SdrTableObj& rObj); + SVX_DLLPRIVATE virtual ~SvxTableController() override; + + // from sdr::SelectionController + SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override; + SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) override; + SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) override; + SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override; + + SVX_DLLPRIVATE bool HasMarked() const; + SVX_DLLPRIVATE virtual bool DeleteMarked() override; + + SVX_DLLPRIVATE virtual void onSelectionHasChanged() override; + SVX_DLLPRIVATE virtual void onSelectAll() override; + + SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet ) override; + virtual void Execute( SfxRequest& rReq ) override; + + SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const override; + SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ) override; + + SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) override; + + // slots + SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = nullptr ); + SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId ); + SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId ); + SVX_DLLPRIVATE void onFormatTable(const SfxRequest& rReq); + SVX_DLLPRIVATE void MergeMarkedCells(); + SVX_DLLPRIVATE void SplitMarkedCells(const SfxRequest& rReq); + SVX_DLLPRIVATE void DistributeColumns( const bool bOptimize, const bool bMinimize ); + SVX_DLLPRIVATE void DistributeRows( const bool bOptimize, const bool bMinimize ); + SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId ); + SVX_DLLPRIVATE void changeTableEdge(const SfxRequest& rReq); + + SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( + SdrView& rView, + const SdrTableObj& rObj, + const rtl::Reference< sdr::SelectionController >& xRefController); + + static SvxBoxItem TextDistancesToSvxBoxItem(const SfxItemSet& rAttrSet); + static void SvxBoxItemToTextDistances(const SvxBoxItem& pOriginalItem, SfxItemSet& rAttrSet); + + SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const; + SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll); + void SetAttrToSelectedShape(const SfxItemSet& rAttr); + /** Fill the values that are common for all selected cells. + * + * This lets the Borders dialog to display the line arrangement + * properly. + */ + SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem& rBox, SvxBoxInfoItem& rBoxInfo) const; + + SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const override; + SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) override; + + SVX_DLLPRIVATE virtual rtl::Reference<SdrObject> GetMarkedSdrObjClone( SdrModel& rTargetModel ) override; + SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) override; + + SVX_DLLPRIVATE virtual bool hasSelectedCells() const override { return mbCellSelectionMode || mrView.IsTextEdit(); } + /// @see sdr::SelectionController::setCursorLogicPosition(). + SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint) override; + + /// @see sdr::SelectionController::getSelectedCells(). + void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos ) override; + void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos ); + + virtual bool ChangeFontSize(bool bGrow, const FontList* pFontList) override; + + void clearSelection(); + void selectAll(); + + SVX_DLLPRIVATE void onTableModified(); + + bool selectRow( sal_Int32 row ); + bool selectColumn( sal_Int32 column ); + bool deselectRow( sal_Int32 row ); + bool deselectColumn( sal_Int32 column ); + bool isRowSelected( sal_Int32 nRow ); + bool isColumnSelected( sal_Int32 nColumn ); + bool isRowHeader(); + bool isColumnHeader(); + sdr::table::SdrTableObj* GetTableObj() { return mxTableObj.get().get(); } +private: + SvxTableController(SvxTableController const &) = delete; + SvxTableController& operator =(SvxTableController const &) = delete; + + // internals + enum class TblAction + { + NONE, + GotoFirstCell, GotoFirstColumn, GotoFirstRow, + GotoLeftCell, GotoUpCell, GotoRightCell, GotoDownCell, + GotoLastCell, GotoLastColumn, GotoLastRow, + EditCell, StopTextEdit, + RemoveSelection, + HandledByView, Tab + }; + SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr ); + SVX_DLLPRIVATE void UpdateTableShape(); + + SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs ); + SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs ); + + SVX_DLLPRIVATE bool PasteObject( SdrTableObj const * pPasteTableObj ); + + SVX_DLLPRIVATE bool checkTableObject(); + SVX_DLLPRIVATE const CellPos& getSelectionStart(); + SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos ); + SVX_DLLPRIVATE const CellPos& getSelectionEnd(); + SVX_DLLPRIVATE void checkCell( CellPos& rPos ) const; + + SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow ); + + SVX_DLLPRIVATE void EditCell(const CellPos& rPos, vcl::Window* pWindow, TblAction nAction); + SVX_DLLPRIVATE void StopTextEdit(); + + SVX_DLLPRIVATE TblAction getKeyboardAction(const KeyEvent& rKEvt); + SVX_DLLPRIVATE bool executeAction(TblAction nAction, bool bSelect, vcl::Window* pWindow); + SVX_DLLPRIVATE void gotoCell(const CellPos& rCell, bool bSelect, vcl::Window* pWindow, TblAction nAction = TblAction::NONE); + + SVX_DLLPRIVATE void StartSelection( const CellPos& rPos ); + SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos ); + SVX_DLLPRIVATE void RemoveSelection(); + SVX_DLLPRIVATE void updateSelectionOverlay(); + SVX_DLLPRIVATE void destroySelectionOverlay(); + + SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos ); + + DECL_DLLPRIVATE_LINK( UpdateHdl, void *, void ); + + //TableModelRef mxTable; + rtl::Reference< TableModel > mxTable; + + CellPos maCursorFirstPos; + CellPos maCursorLastPos; + bool mbCellSelectionMode; + bool mbHasJustMerged; + CellPos maMouseDownPos; + bool mbLeftButtonDown; + std::optional<sdr::overlay::OverlayObjectList> mpSelectionOverlay; + SdrView& mrView; + unotools::WeakReference<SdrTableObj> mxTableObj; + css::uno::Reference< css::util::XModifyListener > mxModifyListener; + ImplSVEvent * mnUpdateEvent; +}; + +rtl::Reference< sdr::SelectionController > CreateTableController( + SdrView& rView, + const SdrTableObj& rObj, + const rtl::Reference< sdr::SelectionController >& xRefController ); + +} + +#endif // INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/table/tabledesign.hxx b/include/svx/sdr/table/tabledesign.hxx new file mode 100644 index 0000000000..118ebefcc0 --- /dev/null +++ b/include/svx/sdr/table/tabledesign.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 . + */ + +#ifndef INCLUDED_SVX_SDR_TABLE_TABLEDESIGN_HXX +#define INCLUDED_SVX_SDR_TABLE_TABLEDESIGN_HXX + +#include <svx/svxdllapi.h> + +#include <com/sun/star/container/XNameAccess.hpp> + +namespace sdr::table +{ +const sal_Int32 first_row_style = 0; +const sal_Int32 last_row_style = 1; +const sal_Int32 first_column_style = 2; +const sal_Int32 last_column_style = 3; +const sal_Int32 even_rows_style = 4; +const sal_Int32 odd_rows_style = 5; +const sal_Int32 even_columns_style = 6; +const sal_Int32 odd_columns_style = 7; +const sal_Int32 body_style = 8; +const sal_Int32 background_style = 9; +const sal_Int32 style_count = 10; + +extern SVX_DLLPUBLIC css::uno::Reference<css::container::XNameAccess> CreateTableDesignFamily(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |