diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /include/svx/sdr | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/svx/sdr')
29 files changed, 2940 insertions, 0 deletions
diff --git a/include/svx/sdr/animation/animationstate.hxx b/include/svx/sdr/animation/animationstate.hxx new file mode 100644 index 000000000..fb1974064 --- /dev/null +++ b/include/svx/sdr/animation/animationstate.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_ANIMATION_ANIMATIONSTATE_HXX +#define INCLUDED_SVX_SDR_ANIMATION_ANIMATIONSTATE_HXX + +#include <sal/types.h> +#include <svx/sdr/animation/scheduler.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace sdr +{ + namespace contact + { + class ViewObjectContact; + } // end of namespace contact +} + +namespace sdr +{ + namespace animation + { + class PrimitiveAnimation final : public Event + { + // the animated VOC + sdr::contact::ViewObjectContact& mrVOContact; + + // the vetor of animated primitives + drawinglayer::primitive2d::Primitive2DContainer maAnimatedPrimitives; + + // local helpers + double getSmallestNextTime(double fCurrentTime); + void prepareNextEvent(); + + public: + // basic constructor. + PrimitiveAnimation(sdr::contact::ViewObjectContact& rVOContact, const drawinglayer::primitive2d::Primitive2DContainer& rAnimatedPrimitives); + + // destructor + virtual ~PrimitiveAnimation() override; + + // execute event, from base class Event + virtual void Trigger(sal_uInt32 nTime) override; + }; + } // end of namespace animation +} // end of namespace sdr + +#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 000000000..fca03a854 --- /dev/null +++ b/include/svx/sdr/animation/objectanimator.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 +{ + namespace animation + { + class primitiveAnimator final : public Scheduler + { + public: + // basic constructor and destructor + primitiveAnimator(); + UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) virtual ~primitiveAnimator() override; + }; + } // end of namespace animation +} // end of namespace sdr + + +#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 000000000..43666f398 --- /dev/null +++ b/include/svx/sdr/animation/scheduler.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 +{ + namespace 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 animation +} // end of namespace sdr + + +#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 000000000..01d9a37c1 --- /dev/null +++ b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx @@ -0,0 +1,93 @@ +/* -*- 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/baseprimitive2d.hxx> +#include <svl/itemset.hxx> +#include <memory> + +////////////////////////////////////////////////////////////////////////////// + +class Color; + +namespace drawinglayer +{ + namespace attribute + { + class SVXCORE_DLLPUBLIC SdrAllFillAttributesHelper + { + private: + basegfx::B2DRange maLastPaintRange; + basegfx::B2DRange maLastDefineRange; + std::shared_ptr< drawinglayer::attribute::SdrFillAttribute > maFillAttribute; + std::shared_ptr< 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 attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#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 000000000..4c5842b45 --- /dev/null +++ b/include/svx/sdr/contact/displayinfo.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX +#define INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX + +#include <svx/svdsob.hxx> +#include <vcl/region.hxx> +#include <svx/svxdllapi.h> +#include <basegfx/range/b2irectangle.hxx> + +namespace sdr +{ + namespace contact + { + class SVXCORE_DLLPUBLIC DisplayInfo final + { + // The Layers which shall be processed (visible) + SdrLayerIDSet maProcessLayers; + + // The redraw area, in logical coordinates of OutputDevice. If Region + // is empty, everything needs to be redrawn + vcl::Region maRedrawArea; + + /// only for Writer: current page being painted + basegfx::B2IRectangle m_WriterPageFrame; + + // Internal flag to know when the control layer is painted. Default is + // false. If set to true, painting of the page, page borders and + // the rasters will be suppressed as if mbPageProcessingActive is set (see there). + // This flag is set internally from the processing mechanism to avoid double page + // painting when the control layer needs to be painted as last layer + bool mbControlLayerProcessingActive : 1; + + // Internal flag to decide if page stuff (background, border, MasterPage, grid, etc...) + // will be processed at all. This flag is user-defined and will not be changed from the + // processing mechanism. Default is true, thus set to false if PagePainting should be suppressed. + // For more granular switching page stuff painting on and off, use the according flags at the + // view (->Is*Visible()) + bool mbPageProcessingActive : 1; + + // Internal flag to remember if EnteredGroupDrawMode is active. Default is true + // since this mode starts activated and gets switched off when reaching + // the current group level. Should only be changed by instances which do + // primitive processing + bool mbGhostedDrawModeActive : 1; + + // Internal flag to know if a MasterPage is processed as SubContent of another + // page. Initialized to false, this should only be changed from the instance which + // is processing the MasterPage asSubContent and knows what it does + bool mbSubContentActive : 1; + + public: + // basic constructor. + DisplayInfo(); + + // access to ProcessLayers + void SetProcessLayers(const SdrLayerIDSet& rSet); + const SdrLayerIDSet& GetProcessLayers() const { return maProcessLayers; } + + // access to RedrawArea + void SetRedrawArea(const vcl::Region& rRegion); + const vcl::Region& GetRedrawArea() const { return maRedrawArea; } + + void SetWriterPageFrame(basegfx::B2IRectangle const& rPageFrame); + basegfx::B2IRectangle const& GetWriterPageFrame() const { return m_WriterPageFrame; } + + // Access to ControlLayerProcessingActive flag + void SetControlLayerProcessingActive(bool bDoPaint); + bool GetControlLayerProcessingActive() const { return mbControlLayerProcessingActive; } + + // Access to PageProcessingActive flag + void SetPageProcessingActive(bool bDoPaint); + bool GetPageProcessingActive() const { return mbPageProcessingActive; } + + // Save the original DrawMode from outdev + void ClearGhostedDrawMode(); + void SetGhostedDrawMode(); + bool IsGhostedDrawModeActive() const { return mbGhostedDrawModeActive; } + + // access to master page painting flag + bool GetSubContentActive() const { return mbSubContentActive; } + void SetSubContentActive(bool bNew); + }; + } // end of namespace contact +} // end of namespace sdr + + +#endif // INCLUDED_SVX_SDR_CONTACT_DISPLAYINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/objectcontact.hxx b/include/svx/sdr/contact/objectcontact.hxx new file mode 100644 index 000000000..6d5d63a27 --- /dev/null +++ b/include/svx/sdr/contact/objectcontact.hxx @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX +#define INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX + +#include <svx/sdr/animation/objectanimator.hxx> +#include <svx/sdr/animation/animationstate.hxx> +#include <svx/svxdllapi.h> +#include <drawinglayer/geometry/viewinformation2d.hxx> + +class SdrLayerIDSet; +namespace tools { class Rectangle; } +class SdrPageView; +class OutputDevice; + +namespace basegfx { + class B2DRange; + class B2DHomMatrix; +} + +namespace sdr::contact { + +class DisplayInfo; +class ViewContact; +class ViewObjectContactRedirector; + +class SVXCORE_DLLPUBLIC ObjectContact +{ +private: + // make ViewObjectContact a friend to exclusively allow it to use + // AddViewObjectContact/RemoveViewObjectContact + friend class ViewObjectContact; + + // All VOCs which are created using this OC, thus remembering this OC + // as a reference. All those VOCs need to be deleted when the OC goes down. + // Registering and de-registering is done in the VOC constructors/destructors. + std::vector< ViewObjectContact* > maViewObjectContactVector; + + // A new ViewObjectContact was created and shall be remembered. + void AddViewObjectContact(ViewObjectContact& rVOContact); + + // A ViewObjectContact was deleted and shall be forgotten. + void RemoveViewObjectContact(ViewObjectContact& rVOContact); + + // the primitiveAnimator which is used if this View and/or the contained primitives + // support animatedSwitchPrimitives + sdr::animation::primitiveAnimator maPrimitiveAnimator; + + // The redirector. If set it is used to pipe all supported calls + // to the redirector + ViewObjectContactRedirector* mpViewObjectContactRedirector; + + // the Primitive2DParameters containing view information + drawinglayer::geometry::ViewInformation2D maViewInformation2D; + + // flag for preview renderer + bool mbIsPreviewRenderer : 1; + +protected: + // Interface to allow derivates to travel over the registered VOC's + sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); } + ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; } + + // interface to allow derivates to set PreviewRenderer flag + void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; } + + // interface to allow derivates to set ViewInformation2D + void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; } + +public: + // basic constructor + ObjectContact(); + virtual ~ObjectContact() COVERITY_NOEXCEPT_FALSE; + + // LazyInvalidate request. This is used from the VOCs to mark that they + // got invalidated by an ActionChanged() call. An active view needs to remember + // this and take action on it. Default implementation directly calls back + // triggerLazyInvalidate() which promptly handles the request + virtual void setLazyInvalidate(ViewObjectContact& rVOC); + + // call this to support evtl. preparations for repaint. Default does nothing + virtual void PrepareProcessDisplay(); + + // Process the whole displaying + virtual void ProcessDisplay(DisplayInfo& rDisplayInfo); + + // test if visualizing of entered groups is switched on at all. Default + // implementation returns sal_False. + virtual bool DoVisualizeEnteredGroup() const; + + // get active group's (the entered group) ViewContact + virtual const ViewContact* getActiveViewContact() const; + + // Invalidate given rectangle at the window/output which is represented by + // this ObjectContact. Default does nothing. + virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const; + + // Get info about the need to visualize GluePoints. The default + // is that it is not necessary. + virtual bool AreGluePointsVisible() const; + + // method to get the primitiveAnimator + sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; } + + // check if text animation is allowed. Default is sal_true. + virtual bool IsTextAnimationAllowed() const; + + // check if graphic animation is allowed. Default is sal_true. + virtual bool IsGraphicAnimationAllowed() const; + + // access to ViewObjectContactRedirector + ViewObjectContactRedirector* GetViewObjectContactRedirector() const { return mpViewObjectContactRedirector; } + void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew); + + // print? Default is false + virtual bool isOutputToPrinter() const; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const; + + // gray display mode + virtual bool isDrawModeGray() const; + + // high contrast display mode + virtual bool isDrawModeHighContrast() const; + + // check if this is a preview renderer. Default is sal_False. + bool IsPreviewRenderer() const { return mbIsPreviewRenderer; } + + // get Primitive2DParameters for this view + const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; } + + /// access to SdrPageView. May return 0L like the default implementations do. Override as needed. + virtual SdrPageView* TryToGetSdrPageView() const; + + /// access to OutputDevice. May return 0L like the default implementations do. Override as needed. + virtual OutputDevice* TryToGetOutputDevice() const; + + // interface to support GridOffset for non-linear ViewToDevice transformation (calc) + virtual bool supportsGridOffsets() const; + virtual void calculateGridOffsetForViewOjectContact( + basegfx::B2DVector& rTarget, + const ViewObjectContact& rClient) const; + virtual void calculateGridOffsetForB2DRange( + basegfx::B2DVector& rTarget, + const basegfx::B2DRange& rB2DRange) const; + void resetAllGridOffsets(); +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_OBJECTCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/objectcontactofpageview.hxx b/include/svx/sdr/contact/objectcontactofpageview.hxx new file mode 100644 index 000000000..c3f4ef9d3 --- /dev/null +++ b/include/svx/sdr/contact/objectcontactofpageview.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX +#define INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX + +#include <svx/sdr/contact/objectcontact.hxx> +#include <vcl/idle.hxx> + +class SdrPageWindow; +class SdrPage; + +namespace sdr +{ + namespace contact + { + class SVXCORE_DLLPUBLIC ObjectContactOfPageView : public ObjectContact, public Idle + { + // the owner of this ObjectContactOfPageView. Set from constructor and not + // to be changed in any way. + SdrPageWindow& mrPageWindow; + + // Process the whole displaying, the real version + void DoProcessDisplay(DisplayInfo& rDisplayInfo); + + public: + // access to SdrPageWindow + SdrPageWindow& GetPageWindow() const { return mrPageWindow; } + + // access to SdrPage of PageView + SdrPage* GetSdrPage() const; + + // basic constructor, used from SdrPageView. + explicit ObjectContactOfPageView(SdrPageWindow& rPageWindow, + const char *pDebugName); + virtual ~ObjectContactOfPageView() override; + + // LazyInvalidate request. This is used from the VOCs to mark that they + // got invalidated by an ActionChanged() call. An active view needs to remember + // this and take action on it. Default implementation directly calls back + // triggerLazyInvalidate() which promptly handles the request + virtual void setLazyInvalidate(ViewObjectContact& rVOC) override; + + // call this to support evtl. preparations for repaint + virtual void PrepareProcessDisplay() override; + + // From baseclass Timer, the timeout call triggered by the LazyInvalidate mechanism + virtual void Invoke() final override; + + // Process the whole displaying + virtual void ProcessDisplay(DisplayInfo& rDisplayInfo) override; + + // test if visualizing of entered groups is switched on at all + virtual bool DoVisualizeEnteredGroup() const override; + + // get active group's (the entered group) ViewContact + virtual const ViewContact* getActiveViewContact() const override; + + // Invalidate given rectangle at the window/output which is represented by + // this ObjectContact. + virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const override; + + // Get info about the need to visualize GluePoints. The default + // is that it is not necessary. + virtual bool AreGluePointsVisible() const override; + + // check if text animation is allowed. + virtual bool IsTextAnimationAllowed() const override; + + // check if graphic animation is allowed. + virtual bool IsGraphicAnimationAllowed() const override; + + // print? Default is false + virtual bool isOutputToPrinter() const override; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const override; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const override; + + // gray display mode + virtual bool isDrawModeGray() const override; + + // high contrast display mode + virtual bool isDrawModeHighContrast() const override; + + // override access to SdrPageView + virtual SdrPageView* TryToGetSdrPageView() const override; + + // access to OutputDevice. May return 0L like the default implementations do. Override as needed. + virtual OutputDevice* TryToGetOutputDevice() const override; + + /** sets all UNO controls which are associated with this ObjectContact to + design or alive mode. + */ + void SetUNOControlsDesignMode( bool _bDesignMode ) const; + }; + } // end of namespace contact +} // end of namespace sdr + +#endif // INCLUDED_SVX_INC_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx new file mode 100644 index 000000000..c3e9328d9 --- /dev/null +++ b/include/svx/sdr/contact/viewcontact.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX + +#include <sal/types.h> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +class SdrLayerIDSet; +class SdrPage; +class SdrObject; + +namespace sdr::contact { + +class ObjectContact; +class ViewObjectContact; + +class SVXCORE_DLLPUBLIC ViewContact +{ +private: + // make ViewObjectContact a friend to exclusively allow it to use + // AddViewObjectContact/RemoveViewObjectContact + friend class ViewObjectContact; + + // List of ViewObjectContacts. This contains all VOCs which were constructed + // with this VC. Since the VOCs remember a reference to this VC, this list needs + // to be kept and is used e.g. at destructor to destroy all VOCs. + // Registering and de-registering is done in the VOC constructors/destructors. + std::vector< ViewObjectContact* > maViewObjectContactVector; + + // Primitive2DContainer of the ViewContact. This contains all necessary information + // for the graphical visualisation and needs to be supported by all VCs which + // can be visualized. + drawinglayer::primitive2d::Primitive2DContainer mxViewIndependentPrimitive2DSequence; + + // A new ViewObjectContact was created and shall be remembered. + void AddViewObjectContact(ViewObjectContact& rVOContact); + + // A ViewObjectContact was deleted and shall be forgotten. + void RemoveViewObjectContact(ViewObjectContact& rVOContact); + + // internal tooling to delete VOCs + void deleteAllVOCs(); + +protected: + // Interface to allow derivates to travel over the registered VOC's + sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); } + ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; } + + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. Default is to create + // a standard ViewObjectContact containing the given ObjectContact and *this + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact); + + // This method is responsible for creating the graphical visualisation data derived ONLY from + // the model data. It will be stored/buffered in mxViewIndependentPrimitive2DSequence. The default implementation + // creates a yellow replacement rectangle (1000, 1000, 5000, 3000) to visualize missing + // implementations. All implementations have to provide basic geometry here, this is the central + // visualisation method and will also be used for BoundRect computations in the long run. + // This means it's always an error when the default implementation is called and thus gets + // asserted there + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const; + + // basic constructor. Since this is a base class only, it shall + // never be called directly + ViewContact(); + +public: + // basic destructor with needed cleanups + virtual ~ViewContact(); + + // get an Object-specific ViewObjectContact for a specific + // ObjectContact (->View). Always needs to return something. + ViewObjectContact& GetViewObjectContact(ObjectContact& rObjectContact); + + // Test if this ViewContact has ViewObjectContacts(excluding previews) at all. This can + // be used to test if this ViewContact is visualized ATM or not + bool HasViewObjectContacts() const; + + // Check if this primitive is animated in any OC (View) which means it has + // generated a PrimitiveAnimation in its VOC + bool isAnimatedInAnyViewObjectContact() const; + + // Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L + // and GetViewContact default pops up an assert since it's an error if + // GetObjectCount has a result != 0 and it's not overridden. + virtual sal_uInt32 GetObjectCount() const; + virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const; + virtual ViewContact* GetParentContact() const; + + // React on insertion of a child into DRawHierarchy starting + // from this object + void ActionChildInserted(ViewContact& rChild); + + // access to SdrObject. May return 0L like the default + // implementations do. Override as needed. + virtual SdrObject* TryToGetSdrObject() const; + + // React on changes of the object of this ViewContact + virtual void ActionChanged(); + + // access to the local primitive. This will ensure that the primitive is + // current in comparing the local one with a fresh created incarnation + drawinglayer::primitive2d::Primitive2DContainer const & getViewIndependentPrimitive2DContainer() const; + + // add Gluepoints (if available) + virtual drawinglayer::primitive2d::Primitive2DContainer createGluePointPrimitive2DSequence() const; + + // Allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This + // is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception + // for 3D scenes. + // We take the param by value, since, for the common case, we can just std::move into the param, and + // std::move the result out, avoiding copying. + virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer rSource) const; + + virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const; + + // delete all existing VOCs including DrawHierarchy which will invalidate all + // visualisations, too. Used mostly at object removal from DrawHierarchy to + // delete all existing VOCs by purpose, but can also be used for other purposes. + // It is always possible to delete the VOCs, these are re-created on demand + void flushViewObjectContacts(bool bWithHierarchy = true); +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofe3dscene.hxx b/include/svx/sdr/contact/viewcontactofe3dscene.hxx new file mode 100644 index 000000000..b26e272f9 --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofe3dscene.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX + +#include <svx/scene3d.hxx> +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> +#include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <drawinglayer/geometry/viewinformation3d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + +namespace basegfx { + class B3DRange; +} + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfE3dScene final : public ViewContactOfSdrObj +{ +public: + // basic constructor, used from SdrObject. + explicit ViewContactOfE3dScene(E3dScene& rScene); + + // access to SdrObject + const E3dScene& GetE3dScene() const + { + return static_cast<const E3dScene&>(GetSdrObject()); + } + + // React on changes of the object of this ViewContact + virtual void ActionChanged() override; + + // access to ViewInformation3D and ObjectTransformation + const drawinglayer::geometry::ViewInformation3D& getViewInformation3D(const ::basegfx::B3DRange& rContentRange) const; + const drawinglayer::geometry::ViewInformation3D& getViewInformation3D() const; + const basegfx::B2DHomMatrix& getObjectTransformation() const; + + // attribute providers + const drawinglayer::attribute::SdrSceneAttribute& getSdrSceneAttribute() const; + const drawinglayer::attribute::SdrLightingAttribute& getSdrLightingAttribute() const; + + // scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the + // given SdrLayerIDSet is done. + drawinglayer::primitive2d::Primitive2DContainer createScenePrimitive2DSequence(const SdrLayerIDSet* pLayerVisibility) const; + + // helpers to get the sequence of all contained 3D primitives and its range, + // regardless of layer or visibility constraints and using a neutral ViewInformation3D + drawinglayer::primitive3d::Primitive3DContainer getAllPrimitive3DContainer() const; + basegfx::B3DRange getAllContentRange3D() const; + +private: + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. Default is to create + // a standard ViewObjectContact containing the given ObjectContact and *this + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override; + + // create methods for ViewInformation3D and ObjectTransformation + void createViewInformation3D(const ::basegfx::B3DRange& rContentRange); + void createObjectTransformation(); + + // attribute creators + void createSdrSceneAttribute(); + void createSdrLightingAttribute(); + + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override; + + // the 3d transformation stack + drawinglayer::geometry::ViewInformation3D maViewInformation3D; + + // the object transformation + basegfx::B2DHomMatrix maObjectTransformation; + + // attributes + drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute; + drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx new file mode 100644 index 000000000..cb2953200 --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX + +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> +#include <svx/svxdllapi.h> +#include <svx/svdomedia.hxx> +#include <tools/gen.hxx> + +namespace avmedia { class MediaItem; } + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfSdrMediaObj : public ViewContactOfSdrObj +{ + friend class ViewObjectContactOfSdrMediaObj; + +public: + + // basic constructor, used from SdrObject. + explicit ViewContactOfSdrMediaObj( SdrMediaObj& rMediaObj ); + virtual ~ViewContactOfSdrMediaObj() override; + +public: + + // access to SdrMediaObj + const SdrMediaObj& GetSdrMediaObj() const + { + return static_cast<const SdrMediaObj&>(GetSdrObject()); + } + + Size getPreferredSize() const; + + void updateMediaItem( ::avmedia::MediaItem& rItem ) const; + void executeMediaItem( const ::avmedia::MediaItem& rItem ); + +protected: + + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override; + + // get notified if some properties have changed + void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); + +protected: + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override; +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofsdrobj.hxx b/include/svx/sdr/contact/viewcontactofsdrobj.hxx new file mode 100644 index 000000000..a20dde7bb --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofsdrobj.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX + +#include <sal/types.h> +#include <svx/sdr/contact/viewcontact.hxx> +#include <svx/sdtakitm.hxx> +#include <svx/svxdllapi.h> + +class SdrObject; +class GeoStat; +class Bitmap; + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfSdrObj : public ViewContact +{ +protected: + // the owner of this ViewContact. Set from constructor and not + // to be changed in any way. + SdrObject& mrObject; + + // Remember AnimationKind of object. Used to find out if that kind + // has changed in ActionChanged() + SdrTextAniKind meRememberedAnimationKind; + + // Create an Object-Specific ViewObjectContact, set ViewContact and + // ObjectContact. Always needs to return something. + virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override; + +public: + // access to SdrObject + SdrObject& GetSdrObject() const + { + return mrObject; + } + + // basic constructor, used from SdrObject. + explicit ViewContactOfSdrObj(SdrObject& rObj); + virtual ~ViewContactOfSdrObj() override; + + // Access to possible sub-hierarchy + virtual sal_uInt32 GetObjectCount() const override; + virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const override; + virtual ViewContact* GetParentContact() const override; + + // React on changes of the object of this ViewContact + virtual void ActionChanged() override; + + /// override for accessing the SdrObject + virtual SdrObject* TryToGetSdrObject() const override; + + + // primitive stuff + + // add Gluepoints (if available) + virtual drawinglayer::primitive2d::Primitive2DContainer createGluePointPrimitive2DSequence() const override; + + // allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This + // is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception + // for 3D scenes + virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer aSource) const override; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofvirtobj.hxx b/include/svx/sdr/contact/viewcontactofvirtobj.hxx new file mode 100644 index 000000000..f1374c7fb --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofvirtobj.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX + +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> + +class SdrVirtObj; + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewContactOfVirtObj : public ViewContactOfSdrObj +{ +protected: + // internal access to SdrObject. Implementation in *.cxx to avoid + // including SdrVirtObj here. + SdrVirtObj& GetVirtObj() const; + +public: + // basic constructor, used from SdrObject. + explicit ViewContactOfVirtObj(SdrVirtObj& rObj); + virtual ~ViewContactOfVirtObj() override; + + // Access to possible sub-hierarchy + virtual sal_uInt32 GetObjectCount() const override; + +protected: + // This method is responsible for creating the graphical visualisation data + // ONLY based on model data + virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx new file mode 100644 index 000000000..9c806aa08 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontact.hxx @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX + +#include <memory> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace vcl { class Region; } + +namespace sdr::animation { + class PrimitiveAnimation; +} + +namespace sdr::contact { + +class DisplayInfo; +class ObjectContact; +class ViewContact; +class ViewObjectContactRedirector; + +class SVXCORE_DLLPUBLIC ViewObjectContact +{ +private: + // must-exist and constant contacts + ObjectContact& mrObjectContact; + ViewContact& mrViewContact; + + // This range defines the object's BoundRect + basegfx::B2DRange maObjectRange; + + // PrimitiveSequence of the ViewContact. This contains all necessary information + // for the graphical visualisation and needs to be supported by all VCs which + // can be visualized. + drawinglayer::primitive2d::Primitive2DContainer mxPrimitive2DSequence; + + // the PrimitiveAnimation if Primitive2DContainer contains animations + std::unique_ptr<sdr::animation::PrimitiveAnimation> mpPrimitiveAnimation; + + // possible on-demand calculated GridOffset for non-linear ViewToDevice transformation (calc) + basegfx::B2DVector maGridOffset; + + // This bool gets set when the object gets invalidated by ActionChanged() and + // can be used from the OC to late-invalidates + bool mbLazyInvalidate : 1; + +protected: + // make redirector a protected friend, it needs to call createPrimitives as default action + friend class ViewObjectContactRedirector; + + // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation + // and setup accordingly + void checkForPrimitive2DAnimations(); + + // This method is responsible for creating the graphical visualisation data which is + // stored/cached in the local primitive. Default gets view-independent Primitive + // from the ViewContact using ViewContact::getViewIndependentPrimitive2DContainer(), takes care of + // visibility, handles glue and ghosted. + // This method will not handle included hierarchies and not check geometric visibility. + virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + + // method for flushing Primitive2DContainer for VOC implementations + void flushPrimitive2DSequence() { mxPrimitive2DSequence.clear(); } + +public: + // basic constructor. + ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact); + virtual ~ViewObjectContact(); + + // access to ObjectContact + ObjectContact& GetObjectContact() const { return mrObjectContact; } + + // access to ViewContact + ViewContact& GetViewContact() const { return mrViewContact; } + + // get the object size range + const basegfx::B2DRange& getObjectRange() const; + + // React on changes of the object of this ViewContact + virtual void ActionChanged(); + + // LazyInvalidate handling + void triggerLazyInvalidate(); + + // Check if this primitive is animated in any OC (View) which means it has + // generated a PrimitiveAnimation + bool isAnimated() const { return (nullptr != mpPrimitiveAnimation); } + + // Take some action when new objects are inserted + void ActionChildInserted(ViewContact& rChild); + + // access to the local primitive. This will ensure that the local primitive is + // current in comparing the local one with a fresh created incarnation + // This method will not handle included hierarchies and not check visibility. + drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + + // test this VOC for visibility concerning model-view stuff like e.g. Layer + virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; + + // test this VOC for ghosted mode + virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const; + + // process this primitive: Eventually also recursively travel an existing hierarchy, + // e.g. for group objects, scenes or pages. This method will test geometrical visibility. + virtual drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; + + // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy + drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const; + + // interface to support GridOffset for non-linear ViewToDevice transformation (calc) + const basegfx::B2DVector& getGridOffset() const; + void resetGridOffset(); +}; + +} + + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx new file mode 100644 index 000000000..07e748651 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX + +#include <svx/sdr/contact/viewobjectcontact.hxx> + +class SdrObject; +class SdrLayerIDSet; +class OutputDevice; + +namespace sdr::contact { + +class SVXCORE_DLLPUBLIC ViewObjectContactOfSdrObj : public ViewObjectContact +{ + /** Test whether the primitive is visible on any layer from @c aLayers + + This should be overridden by ViewObjectContacts of SDR classes + that have subparts which can be on different layers (that is, + SdrObjGroup .-) + */ + virtual bool isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const; + +protected: + const SdrObject& getSdrObject() const; + +public: + ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact); + virtual ~ViewObjectContactOfSdrObj() override; + + virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const override; + + /** retrieves the device which a PageView belongs to, starting from its ObjectContactOfPageView + + Since #i72752#, the PaintWindow (and thus the OutputDevice) associated with a PageView is not + constant over its lifetime. Instead, during some paint operations, the PaintWindow/OutputDevice + might be temporarily patched. + + This method cares for this, by retrieving the very original OutputDevice. + */ + const OutputDevice* getPageViewOutputDevice() const; +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewobjectcontactredirector.hxx b/include/svx/sdr/contact/viewobjectcontactredirector.hxx new file mode 100644 index 000000000..1dc69d238 --- /dev/null +++ b/include/svx/sdr/contact/viewobjectcontactredirector.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX + +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace sdr::contact { + +class DisplayInfo; +class ViewObjectContact; + +// This class provides a mechanism to redirect the paint mechanism for all or +// single ViewObjectContacts. An own derivation may be set at single ViewContacts +// or at the ObjectContact for redirecting all. If both is used, the one at single +// objects will have priority. +class SVXCORE_DLLPUBLIC ViewObjectContactRedirector +{ +public: + // basic constructor. + ViewObjectContactRedirector(); + + // The destructor. + virtual ~ViewObjectContactRedirector(); + + // all default implementations just call the same methods at the original. To do something + // different, override the method and at least do what the method does. + virtual drawinglayer::primitive2d::Primitive2DContainer createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, + const sdr::contact::DisplayInfo& rDisplayInfo); +}; + +} + +#endif // INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx new file mode 100644 index 000000000..80059b791 --- /dev/null +++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx @@ -0,0 +1,84 @@ +/* -*- 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 +{ + namespace 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 overlay +} // end of namespace sdr + + +#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 000000000..fbfce1ee3 --- /dev/null +++ b/include/svx/sdr/overlay/overlaybitmapex.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 +{ + namespace 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 overlay +} // end of namespace sdr + + +#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 000000000..412d45aa3 --- /dev/null +++ b/include/svx/sdr/overlay/overlaymanager.hxx @@ -0,0 +1,139 @@ +/* -*- 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 <svtools/optionsdrawinglayer.hxx> +#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 +{ + namespace 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 an incarnation of Drawinglayer configuration options + SvtOptionsDrawinglayer maDrawinglayerOpt; + + // 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); + + // access to maDrawinglayerOpt + const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; } + + void InsertEvent(sdr::animation::Event& rNew) { Scheduler::InsertEvent(rNew); } + }; + } // end of namespace overlay +} // end of namespace sdr + +#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 000000000..569d93a25 --- /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/baseprimitive2d.hxx> + +#include <vector> + +class OutputDevice; + +namespace sdr +{ + namespace overlay + { + class OverlayManager; + } // end of namespace overlay +} + +namespace basegfx +{ + class B2DPolygon; + class B2DPolyPolygon; + class B2DRange; +} + +namespace sdr +{ + namespace 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; + + // 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 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 overlay +} // end of namespace sdr + +namespace sdr +{ + namespace 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 overlay +} // end of namespace sdr + +#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 000000000..4859db33e --- /dev/null +++ b/include/svx/sdr/overlay/overlayobjectlist.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 +{ + namespace 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 overlay +} // end of namespace sdr + + +#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 000000000..88c7404e6 --- /dev/null +++ b/include/svx/sdr/overlay/overlaypolypolygon.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_OVERLAY_OVERLAYPOLYPOLYGON_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + + +namespace sdr +{ + namespace overlay + { + class SVXCORE_DLLPUBLIC OverlayPolyPolygonStripedAndFilled final : public OverlayObject + { + // geometry + basegfx::B2DPolyPolygon maLinePolyPolygon; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPolyPolygonStripedAndFilled( + const basegfx::B2DPolyPolygon& rLinePolyPolygon); + virtual ~OverlayPolyPolygonStripedAndFilled() override; + + // change geometry + const basegfx::B2DPolyPolygon& getLinePolyPolygon() const { return maLinePolyPolygon; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged() override; + }; + } // end of namespace overlay +} // end of namespace sdr + + +#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 000000000..84cf195f4 --- /dev/null +++ b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + + +namespace sdr +{ + namespace 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(const drawinglayer::primitive2d::Primitive2DContainer& rSequence); + + virtual ~OverlayPrimitive2DSequenceObject() override; + }; + } // end of namespace overlay +} // end of namespace sdr + + +#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 000000000..dc40a8759 --- /dev/null +++ b/include/svx/sdr/overlay/overlayselection.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_OVERLAY_OVERLAYSELECTION_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + + +namespace sdr +{ + namespace 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, + const 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(const std::vector< basegfx::B2DRange >& rNew); + }; + } // end of namespace overlay +} // end of namespace sdr + + +#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 000000000..820726698 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx @@ -0,0 +1,132 @@ +/* -*- 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/baseprimitive2d.hxx> +#include <svx/framelink.hxx> + +// predefines + +namespace drawinglayer +{ + namespace 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 primitive2d +} // end of namespace drawinglayer + +namespace drawinglayer +{ + namespace primitive2d + { + class SVXCORE_DLLPUBLIC SdrFrameBorderPrimitive2D final : public BufferedDecompositionPrimitive2D + { + private: + std::shared_ptr<SdrFrameBorderDataVector> maFrameBorders; + double mfMinimalNonZeroBorderWidth; + double mfMinimalNonZeroBorderWidthUsedForDecompose; + bool mbForceToSingleDiscreteUnit; + + // local decomposition. + virtual void create2DDecomposition( + Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& aViewInformation) const override; + + public: + SdrFrameBorderPrimitive2D( + std::shared_ptr<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 std::shared_ptr<SdrFrameBorderDataVector>& getFrameBorders() const { return maFrameBorders; } + bool doForceToSingleDiscreteUnit() const { return mbForceToSingleDiscreteUnit; } + + // provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + + +#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 000000000..d6cb948a6 --- /dev/null +++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_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) + + +#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 000000000..852b5e881 --- /dev/null +++ b/include/svx/sdr/properties/defaultproperties.hxx @@ -0,0 +1,111 @@ +/* -*- 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 <memory> + +#include <svx/sdr/properties/properties.hxx> +#include <svx/svxdllapi.h> + +struct _xmlTextWriter; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +namespace sdr +{ + namespace properties + { + class SVXCORE_DLLPUBLIC DefaultProperties : public BaseProperties + { + protected: + // the to be used ItemSet + std::unique_ptr<SfxItemSet> mpItemSet; + + // create a new itemset + virtual std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& rPool) override; + + // test changeability for a single item + virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const override; + + // Do the ItemChange, may do special handling + virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; + + // Called after ItemChange() is done for all items. + virtual void PostItemChange(const sal_uInt16 nWhich) override; + + // react on ItemSet changes + virtual void ItemSetChanged(const SfxItemSet& rSet) override; + + // check if SfxItemSet exists + bool HasSfxItemSet() const { return bool(mpItemSet); } + + 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) 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 properties +} // end of namespace sdr + +#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 000000000..22d9bf2f7 --- /dev/null +++ b/include/svx/sdr/properties/properties.hxx @@ -0,0 +1,213 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 +{ + namespace 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 +{ + namespace 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: + // apply the correct SfyStyleSheet from SdrObject's SdrModel + virtual void applyDefaultStyleSheetFromSdrModel(); + + // create a new object specific itemset with object specific ranges. + virtual std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0; + + // internal access to SdrObject + const SdrObject& GetSdrObject() const; + + SdrObject& GetSdrObject(); + + // 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 = 0; + + // 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) = 0; + + // Called after ItemChange() is done for all items. Allows local reactions on + // specific item changes + virtual void PostItemChange(const sal_uInt16 nWhich) = 0; + + // Internally react on ItemSet changes. The given ItemSet contains all changed items, the new ones. + virtual void ItemSetChanged(const SfxItemSet& rSet) = 0; + + public: + // basic constructor, used from SdrObject. + explicit BaseProperties(SdrObject& rObj); + + // destructor + virtual ~BaseProperties(); + + // 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) = 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 properties +} // end of namespace sdr + +#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 000000000..f34499a05 --- /dev/null +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -0,0 +1,198 @@ +/* -*- 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 <memory> + +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 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); + + SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const; + SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll); + /** 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 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(); } +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 ); + + 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_LINK( UpdateHdl, void *, void ); + + //TableModelRef mxTable; + rtl::Reference< TableModel > mxTable; + + CellPos maCursorFirstPos; + CellPos maCursorLastPos; + bool mbCellSelectionMode; + bool mbHasJustMerged; + CellPos maMouseDownPos; + bool mbLeftButtonDown; + std::unique_ptr<sdr::overlay::OverlayObjectList> mpSelectionOverlay; + SdrView& mrView; + tools::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 000000000..8c03ee67b --- /dev/null +++ b/include/svx/sdr/table/tabledesign.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_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: */ |