diff options
Diffstat (limited to 'include/svx/sdr/overlay')
-rw-r--r-- | include/svx/sdr/overlay/overlayanimatedbitmapex.hxx | 92 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaybitmapex.hxx | 66 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaycrosshair.hxx | 51 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayhatchrect.hxx | 71 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayhelpline.hxx | 60 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayline.hxx | 59 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaymanager.hxx | 151 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaymanagerbuffered.hxx | 98 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayobject.hxx | 196 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayobjectcell.hxx | 62 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayobjectlist.hxx | 78 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaypolypolygon.hxx | 58 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx | 62 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayrollingrectangle.hxx | 75 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayselection.hxx | 87 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaytools.hxx | 270 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaytriangle.hxx | 62 |
17 files changed, 1598 insertions, 0 deletions
diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx new file mode 100644 index 000000000000..756d2dac3731 --- /dev/null +++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX +#define _SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/bitmapex.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayAnimatedBitmapEx : public OverlayObjectWithBasePosition + { + protected: + // 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; + + // bitfield + // Flag to remember which state to draw. Inited with sal_False (0) + unsigned mbOverlayState : 1; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) + void impCheckBlinkTimeValueRange(); + + public: + OverlayAnimatedBitmapEx( + const basegfx::B2DPoint& rBasePos, + const BitmapEx& rBitmapEx1, + const BitmapEx& rBitmapEx2, + sal_uInt32 nBlinkTime = 500, + sal_uInt16 nCenX1 = 0, + sal_uInt16 nCenY1 = 0, + sal_uInt16 nCenX2 = 0, + sal_uInt16 nCenY2 = 0); + virtual ~OverlayAnimatedBitmapEx(); + + const BitmapEx& getBitmapEx1() const { return maBitmapEx1; } + const BitmapEx& getBitmapEx2() const { return maBitmapEx2; } + + sal_uInt16 getCenterX1() const { return mnCenterX1; } + sal_uInt16 getCenterY1() const { return mnCenterY1; } + sal_uInt16 getCenterX2() const { return mnCenterX2; } + sal_uInt16 getCenterY2() const { return mnCenterY2; } + + // #i53216# added CursorBlinkTime (in ms) + sal_uInt32 getBlinkTime() const { return mnBlinkTime; } + + // 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); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_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 000000000000..bd841c6b4255 --- /dev/null +++ b/include/svx/sdr/overlay/overlaybitmapex.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 _SDR_OVERLAY_OVERLAYBITMAPEX_HXX +#define _SDR_OVERLAY_OVERLAYBITMAPEX_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/bitmapex.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayBitmapEx : public OverlayObjectWithBasePosition + { + protected: + // the Bitmap itself + BitmapEx maBitmapEx; + + // position of the basePosition inside the Bitmap, in pixels + sal_uInt16 mnCenterX; + sal_uInt16 mnCenterY; + + // optional transparency + double mfAlpha; + + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayBitmapEx( + const basegfx::B2DPoint& rBasePos, + const BitmapEx& rBitmapEx, + sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0, double fAlpha = 0.0 ); + virtual ~OverlayBitmapEx(); + + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + + sal_uInt16 getCenterX() const { return mnCenterX; } + sal_uInt16 getCenterY() const { return mnCenterY; } + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYBITMAPEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaycrosshair.hxx b/include/svx/sdr/overlay/overlaycrosshair.hxx new file mode 100644 index 000000000000..436705536819 --- /dev/null +++ b/include/svx/sdr/overlay/overlaycrosshair.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYCROSSHAIR_HXX +#define _SDR_OVERLAY_OVERLAYCROSSHAIR_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class OverlayCrosshairStriped : public OverlayObjectWithBasePosition + { + protected: + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + explicit OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos); + virtual ~OverlayCrosshairStriped(); + + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYCROSSHAIR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayhatchrect.hxx b/include/svx/sdr/overlay/overlayhatchrect.hxx new file mode 100644 index 000000000000..7f01c3537e42 --- /dev/null +++ b/include/svx/sdr/overlay/overlayhatchrect.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYHATCHRECT_HXX +#define _SDR_OVERLAY_OVERLAYHATCHRECT_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/hatch.hxx> + +////////////////////////////////////////////////////////////////////////////// + +class PolyPolygon; + +namespace sdr +{ + namespace overlay + { + class OverlayHatchRect : public OverlayObjectWithBasePosition + { + // geometric definitions + basegfx::B2DPoint maSecondPosition; + const double mfDiscreteGrow; + const double mfDiscreteShrink; + const double mfHatchRotation; + const double mfRotation; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayHatchRect( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fDiscreteGrow, + double fDiscreteShrink, + double fHatchRotation, + double fRotation); + + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + + // data read access + double getDiscreteGrow() const { return mfDiscreteGrow; } + double getDiscreteShrink() const { return mfDiscreteShrink; } + double getHatchRotation() const { return mfHatchRotation; } + double getRotation() const { return mfRotation; } + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYHATCHRECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayhelpline.hxx b/include/svx/sdr/overlay/overlayhelpline.hxx new file mode 100644 index 000000000000..3ab10df10626 --- /dev/null +++ b/include/svx/sdr/overlay/overlayhelpline.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYHELPLINE_HXX +#define _SDR_OVERLAY_OVERLAYHELPLINE_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <svx/svdhlpln.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class OverlayHelplineStriped : public OverlayObjectWithBasePosition + { + protected: + // remember HelpLineKind + SdrHelpLineKind meKind; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + explicit OverlayHelplineStriped( + const basegfx::B2DPoint& rBasePos, + SdrHelpLineKind eNewKind = SDRHELPLINE_POINT); + virtual ~OverlayHelplineStriped(); + + // dat read access + SdrHelpLineKind getKind() const { return meKind; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYHELPLINE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayline.hxx b/include/svx/sdr/overlay/overlayline.hxx new file mode 100644 index 000000000000..8b093fecbfb4 --- /dev/null +++ b/include/svx/sdr/overlay/overlayline.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYLINE_HXX +#define _SDR_OVERLAY_OVERLAYLINE_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class OverlayLineStriped : public OverlayObjectWithBasePosition + { + protected: + // second position in pixel + basegfx::B2DPoint maSecondPosition; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayLineStriped( + const basegfx::B2DPoint& rBasePos, + const basegfx::B2DPoint& rSecondPos); + virtual ~OverlayLineStriped(); + + // change second position + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYLINE_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 000000000000..e2c23b5dc6df --- /dev/null +++ b/include/svx/sdr/overlay/overlaymanager.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 _SDR_OVERLAY_OVERLAYMANAGER_HXX +#define _SDR_OVERLAY_OVERLAYMANAGER_HXX + +#include <boost/utility.hpp> +#include <rtl/ref.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/mapmod.hxx> +#include <tools/color.hxx> +#include "svx/svxdllapi.h" +#include <svtools/optionsdrawinglayer.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class OutputDevice; +class Region; + +namespace sdr { namespace overlay { + class OverlayObject; +}} + +namespace basegfx { + class B2DRange; +} + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayManager + : private boost::noncopyable + , protected ::sdr::animation::Scheduler + , public rtl::IReference + { + private: + oslInterlockedCount mnRefCount; + protected: + // the OutputDevice to work on, set on construction and not to be changed + OutputDevice& rmOutputDevice; + + // 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 Color(COL_BLACK) + Color maStripeColorB; // defaults to Color(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; + + OverlayManager(OutputDevice& rOutputDevice); + virtual ~OverlayManager(); + + public: + static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice); + + // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D + const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const; + + // complete redraw + virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0) const; + + // flush. Do buffered updates. + virtual void flush(); + + // #i68597# part of content gets copied, react on it + virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize); + + // restore part of background. Implemented form buffered versions only. + virtual void restoreBackground(const Region& rRegion) const; + + // get the OutputDevice + OutputDevice& getOutputDevice() const { return rmOutputDevice; } + + // 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 + Color getStripeColorA() const { return maStripeColorA; } + void setStripeColorA(Color aNew= Color(COL_BLACK)); + + // stripe support ColB + Color getStripeColorB() const { return maStripeColorB; } + void setStripeColorB(Color aNew = Color(COL_WHITE)); + + // stripe support StripeLengthPixel + sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; } + void setStripeLengthPixel(sal_uInt32 nNew = 5L); + + // access to maDrawinglayerOpt + const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; } + + void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); } + + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaymanagerbuffered.hxx b/include/svx/sdr/overlay/overlaymanagerbuffered.hxx new file mode 100644 index 000000000000..7f6dbe05d9e6 --- /dev/null +++ b/include/svx/sdr/overlay/overlaymanagerbuffered.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX +#define _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX + +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <basegfx/range/b2irange.hxx> +#include <vcl/virdev.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class OverlayManagerBuffered : public OverlayManager + { + protected: + // The VirtualDevice for draw window content buffering, this + // is the view content without overlay + VirtualDevice maBufferDevice; + + // #i73602# The VirtualDevice for OverlayPaint buffering. This + // is an extra device to avoid flickering of overlay paints + VirtualDevice maOutputBufferDevice; + + // Timer for buffering + Timer maBufferTimer; + + // Range for buffering (in pixel to be independent from mapMode) + basegfx::B2IRange maBufferRememberedRangePixel; + + // bitfield + // Flag to decide if PreRendering shall be used for overlay refreshes. + // Default is false. + unsigned mbRefreshWithPreRendering : 1; + + // link for timer + DECL_LINK(ImpBufferTimerHandler, AutoTimer*); + + // Internal methods for buffering + void ImpPrepareBufferDevice(); + void ImpRestoreBackground() const ; + void ImpRestoreBackground(const Region& rRegionPixel) const; + void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L); + + OverlayManagerBuffered( + OutputDevice& rOutputDevice, + bool bRefreshWithPreRendering = false); + virtual ~OverlayManagerBuffered(); + + public: + static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice, + bool bRefreshWithPreRendering = false); + + // complete redraw + virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const; + + // flush. Do buffered updates. + virtual void flush(); + + // #i68597# part of content gets copied, react on it + virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize); + + // restore part of background. Implemented form buffered versions only. + virtual void restoreBackground(const Region& rRegion) const; + + // invalidate the given range at local OutputDevice + virtual void invalidateRange(const basegfx::B2DRange& rRange); + + // access to RefreshWithPreRendering Flag + bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; } + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_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 000000000000..263e9a9ab57c --- /dev/null +++ b/include/svx/sdr/overlay/overlayobject.hxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYOBJECT_HXX +#define _SDR_OVERLAY_OVERLAYOBJECT_HXX + +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/range/b2drange.hxx> +#include <tools/color.hxx> +#include <rtl/ref.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include "svx/svxdllapi.h" +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class OutputDevice; + +namespace sdr +{ + namespace overlay + { + class OverlayManager; + } // end of namespace overlay +} // end of namespace sdr + +namespace basegfx +{ + class B2DPolygon; + class B2DPolyPolygon; + class B2DRange; +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayObject : private ::boost::noncopyable, public ::sdr::animation::Event + { + private: + // Manager is allowed access to private Member mpOverlayManager + friend class OverlayManager; + + // pointer to OverlayManager, if object is added. Changed by + // OverlayManager, do not chnge Yourself. + OverlayManager* mpOverlayManager; + + // Primitive2DSequence of the OverlayObject + drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence; + + 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. + const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void setPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DSequence& rNew) { maPrimitive2DSequence = rNew; } + + // the creation method for Primitive2DSequence. 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::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + // region in logical coordinates + basegfx::B2DRange maBaseRange; + + // base color of this OverlayObject + Color maBaseColor; + + // bitfield + // Flag for visibility + unsigned mbIsVisible : 1; + + // Flag to control hittability + unsigned mbIsHittable : 1; + + // Flag to hold info if this objects supports animation. Default is + // false. If true, the Trigger() method should be overloaded + // to implement the animation effect and to re-initiate the event. + unsigned mbAllowsAnimation : 1; + + // Flag tocontrol if this OverlayObject allows AntiAliased visualisation. + // Default is true, but e.g. for selection visualisation in SC and SW, + // it is switched to false + unsigned 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. + virtual void objectChange(); + + // write access to AntiAliase flag. This is protected since + // only implementations are allowed to change this, preferrably in their + // constructor + void allowAntiAliase(bool bNew); + + public: + explicit OverlayObject(Color aBaseColor); + virtual ~OverlayObject(); + + // get OverlayManager + OverlayManager* getOverlayManager() const { return mpOverlayManager; } + + // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and + // setPrimitive2DSequence if needed. Overloading may be used to allow disposal of last + // created primitives to react on changed circumstances and to re-create primitives + virtual drawinglayer::primitive2d::Primitive2DSequence 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 + Color getBaseColor() const { return maBaseColor; } + void setBaseColor(Color aNew); + + // 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); + + // acces 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 SVX_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject + { + protected: + // base position in logical coordinates + basegfx::B2DPoint maBasePosition; + + public: + OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor); + virtual ~OverlayObjectWithBasePosition(); + + // 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 //_SDR_OVERLAY_OVERLAYOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayobjectcell.hxx b/include/svx/sdr/overlay/overlayobjectcell.hxx new file mode 100644 index 000000000000..6707c0fc61eb --- /dev/null +++ b/include/svx/sdr/overlay/overlayobjectcell.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYOBJECTCELL_HXX +#define _SDR_OVERLAY_OVERLAYOBJECTCELL_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + +#include <vector> + +////////////////////////////////////////////////////////////////////////////// + +// #114409# +namespace sdr +{ + namespace overlay + { + enum CellOverlayType { CELL_OVERLAY_INVERT, CELL_OVERLAY_TRANSPARENT }; + + // OverlayObjectCell - used for cell cursor, selection and AutoFill handle + + class SVX_DLLPUBLIC OverlayObjectCell : public OverlayObject + { + public: + typedef ::std::vector< basegfx::B2DRange > RangeVector; + + private: + CellOverlayType mePaintType; + RangeVector maRectangles; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayObjectCell( CellOverlayType eType, const Color& rColor, const RangeVector& rRects); + virtual ~OverlayObjectCell(); + }; + + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYLINE_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 000000000000..ea75ace1e94a --- /dev/null +++ b/include/svx/sdr/overlay/overlayobjectlist.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYOBJECTLIST_HXX +#define _SDR_OVERLAY_OVERLAYOBJECTLIST_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <sal/types.h> +#include "svx/svxdllapi.h" + +////////////////////////////////////////////////////////////////////////////// + +#define DEFAULT_VALUE_FOR_HITTEST_PIXEL (2L) + +////////////////////////////////////////////////////////////////////////////// + +class Point; + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayObjectList + { + protected: + // the vector of OverlayObjects + OverlayObjectVector maVector; + + // default value for HiTestPixel + sal_uInt32 getDefaultValueForHitTestPixel() const { return 4L; } + + public: + OverlayObjectList() {} + ~OverlayObjectList(); + + // clear list, this includes deletion of all contained objects + void clear(); + + // append objects + void append(OverlayObject& rOverlayObject) { maVector.push_back(&rOverlayObject); } + + // 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 and pixel tolerance + bool isHitPixel(const Point& rDiscretePosition, sal_uInt32 fDiscreteTolerance = DEFAULT_VALUE_FOR_HITTEST_PIXEL) const; + + // calculate BaseRange of all included OverlayObjects and return + basegfx::B2DRange getBaseRange() const; + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_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 000000000000..d7dd82751f53 --- /dev/null +++ b/include/svx/sdr/overlay/overlaypolypolygon.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX +#define _SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayPolyPolygonStriped : public OverlayObject + { + protected: + // geometry + basegfx::B2DPolyPolygon maPolyPolygon; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + explicit OverlayPolyPolygonStriped(const basegfx::B2DPolyPolygon& rPolyPolygon); + virtual ~OverlayPolyPolygonStriped(); + + // change geometry + basegfx::B2DPolyPolygon getPolyPolygon() const { return maPolyPolygon; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_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 000000000000..a2e981c2c1a8 --- /dev/null +++ b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX +#define _SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class SVX_DLLPUBLIC OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition + { + protected: + // the sequence of primitives to show + const drawinglayer::primitive2d::Primitive2DSequence maSequence; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + private: + // internal helper to create a drawinglayer::geometry::ViewInformation2D + // using a OutputDevice and local knowledge + drawinglayer::geometry::ViewInformation2D impCreateViewInformation2D(OutputDevice& rOutputDevice) const; + + public: + explicit OverlayPrimitive2DSequenceObject(const drawinglayer::primitive2d::Primitive2DSequence& rSequence); + + virtual ~OverlayPrimitive2DSequenceObject(); + + // data read access + const drawinglayer::primitive2d::Primitive2DSequence& getSequence() const { return maSequence; } + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayrollingrectangle.hxx b/include/svx/sdr/overlay/overlayrollingrectangle.hxx new file mode 100644 index 000000000000..3a896aa3cdd8 --- /dev/null +++ b/include/svx/sdr/overlay/overlayrollingrectangle.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 _SDR_OVERLAY_OVERLAYROOLINGRECTANGLE_HXX +#define _SDR_OVERLAY_OVERLAYROOLINGRECTANGLE_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class OverlayRollingRectangleStriped : public OverlayObjectWithBasePosition + { + protected: + // second position in pixel + basegfx::B2DPoint maSecondPosition; + + // bitfield + // Flag to switch on/off long lines to the OutputDevice bounds + unsigned mbExtendedLines : 1; + + // Flag to switch on/off the bounds itself + unsigned mbShowBounds : 1; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayRollingRectangleStriped( + const basegfx::B2DPoint& rBasePos, + const basegfx::B2DPoint& rSecondPos, + bool bExtendedLines = false, + bool bShowBounds = true); + virtual ~OverlayRollingRectangleStriped(); + + // change second position + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + void setSecondPosition(const basegfx::B2DPoint& rNew); + + // change extended lines + bool getExtendedLines() const { return mbExtendedLines; } + + // change show bounds + bool getShowBounds() const { return mbShowBounds; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYROOLINGRECTANGLE_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 000000000000..e96b8fa3281d --- /dev/null +++ b/include/svx/sdr/overlay/overlayselection.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 _SDR_OVERLAY_OVERLAYSELECTION_HXX +#define _SDR_OVERLAY_OVERLAYSELECTION_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/region.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + // overlay type definition + enum OverlayType + { + OVERLAY_INVERT, + OVERLAY_SOLID, + OVERLAY_TRANSPARENT + }; + + class SVX_DLLPUBLIC OverlaySelection : public OverlayObject + { + protected: + // 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 Primitive2DSequence. This ensures that these values are up-to-date + // and are usable when creating primitives + OverlayType maLastOverlayType; + sal_uInt16 mnLastTransparence; + + // bitfield + unsigned mbBorder : 1; + + // geometry creation for OverlayObject, can use local *Last* values + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlaySelection( + OverlayType eType, + const Color& rColor, + const std::vector< basegfx::B2DRange >& rRanges, + bool bBorder); + virtual ~OverlaySelection(); + + // data read access + OverlayType getOverlayType() const { return meOverlayType; } + const std::vector< basegfx::B2DRange >& getRanges() const { return maRanges; } + bool getBorder() const { return mbBorder; } + + // overloaded to check conditions for last createOverlayObjectPrimitive2DSequence + virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const; + + // data write access + void setRanges(const std::vector< basegfx::B2DRange >& rNew); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYSELECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaytools.hxx b/include/svx/sdr/overlay/overlaytools.hxx new file mode 100644 index 000000000000..665d445e2d46 --- /dev/null +++ b/include/svx/sdr/overlay/overlaytools.hxx @@ -0,0 +1,270 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this 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 _SDR_OVERLAY_OVERLAYTOOLS_HXX +#define _SDR_OVERLAY_OVERLAYTOOLS_HXX + +#include <drawinglayer/primitive2d/primitivetools2d.hxx> +#include <vcl/bitmapex.hxx> + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class which holds a BotmapEx which is to be visualized +// at the given logic position with the Bitmap's pixel size, unscaled and +// unrotated (like a marker). The discrete pixel on the bitmap assocciated +// with the target position is given in discrete X,Y coordinates +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayBitmapExPrimitive : public DiscreteMetricDependentPrimitive2D + { + private: + // The BitmapEx to use, PixelSize is used + BitmapEx maBitmapEx; + + // The logic position + basegfx::B2DPoint maBasePosition; + + // The pixel inside the BitmapEx which is assocciated with + // the target position (offset in the bitmap) + sal_uInt16 mnCenterX; + sal_uInt16 mnCenterY; + + protected: + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayBitmapExPrimitive( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rBasePosition, + sal_uInt16 nCenterX, + sal_uInt16 nCenterY); + + // data access + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + sal_uInt16 getCenterX() const { return mnCenterX; } + sal_uInt16 getCenterY() const { return mnCenterY; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for a crosshair +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayCrosshairPrimitive : public ViewportDependentPrimitive2D + { + private: + // The logic position + basegfx::B2DPoint maBasePosition; + + // The stripe colors and legth + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayCrosshairPrimitive( + const basegfx::B2DPoint& rBasePosition, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // data access + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for a hatch rectangle as used e.g. for text object +// selection hilighting +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayHatchRectanglePrimitive : public DiscreteMetricDependentPrimitive2D + { + private: + // the logic rectangle definition + basegfx::B2DRange maObjectRange; + + // the hatch definition + double mfDiscreteHatchDistance; + double mfHatchRotation; + basegfx::BColor maHatchColor; + + // the dscrete grow and shrink of the box + double mfDiscreteGrow; + double mfDiscreteShrink; + + // the rotation of the primitive itself + double mfRotation; + + protected: + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayHatchRectanglePrimitive( + const basegfx::B2DRange& rObjectRange, + double fDiscreteHatchDistance, + double fHatchRotation, + const basegfx::BColor& rHatchColor, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation); + + // data access + const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } + double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance; } + double getHatchRotation() const { return mfHatchRotation; } + const basegfx::BColor& getHatchColor() const { return maHatchColor; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + double getDiscreteShrink() const { return mfDiscreteShrink; } + double getRotation() const { return mfRotation; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for a striped helpline + +namespace drawinglayer +{ + namespace primitive2d + { + enum HelplineStyle + { + HELPLINESTYLE_POINT, + HELPLINESTYLE_VERTICAL, + HELPLINESTYLE_HORIZONTAL + }; + + class OverlayHelplineStripedPrimitive : public ViewportDependentPrimitive2D + { + private: + // The logic position + basegfx::B2DPoint maBasePosition; + + // the style + HelplineStyle meStyle; + + // The stripe colors and legth + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayHelplineStripedPrimitive( + const basegfx::B2DPoint& rBasePosition, + HelplineStyle eStyle, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // data access + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + HelplineStyle getStyle() const { return meStyle; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// Overlay helper class for rolling rectangle helplines. This primitive is +// only for the extended lines to the ends of the view + +namespace drawinglayer +{ + namespace primitive2d + { + class OverlayRollingRectanglePrimitive : public ViewportDependentPrimitive2D + { + private: + // The logic range + basegfx::B2DRange maRollingRectangle; + + // The stripe colors and legth + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + double mfDiscreteDashLength; + + protected: + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + OverlayRollingRectanglePrimitive( + const basegfx::B2DRange& aRollingRectangle, + const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, + double fDiscreteDashLength); + + // data access + const basegfx::B2DRange& getRollingRectangle() const { return maRollingRectangle; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + // compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYTOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaytriangle.hxx b/include/svx/sdr/overlay/overlaytriangle.hxx new file mode 100644 index 000000000000..b17e6be8a8c6 --- /dev/null +++ b/include/svx/sdr/overlay/overlaytriangle.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SDR_OVERLAY_OVERLAYTRIANGLE_HXX +#define _SDR_OVERLAY_OVERLAYTRIANGLE_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + class OverlayTriangle : public OverlayObjectWithBasePosition + { + protected: + // second and third position in pixel + basegfx::B2DPoint maSecondPosition; + basegfx::B2DPoint maThirdPosition; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayTriangle( + const basegfx::B2DPoint& rBasePos, + const basegfx::B2DPoint& rSecondPos, + const basegfx::B2DPoint& rThirdPos, + Color aTriangleColor); + virtual ~OverlayTriangle(); + + // change second position + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + + // change third position + const basegfx::B2DPoint& getThirdPosition() const { return maThirdPosition; } + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYTRIANGLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |