summaryrefslogtreecommitdiff
path: root/include/drawinglayer/primitive2d
diff options
context:
space:
mode:
Diffstat (limited to 'include/drawinglayer/primitive2d')
-rw-r--r--include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx2
-rw-r--r--include/drawinglayer/primitive2d/CommonTypes.hxx6
-rw-r--r--include/drawinglayer/primitive2d/Primitive2DContainer.hxx6
-rw-r--r--include/drawinglayer/primitive2d/Tools.hxx13
-rw-r--r--include/drawinglayer/primitive2d/baseprimitive2d.hxx58
-rw-r--r--include/drawinglayer/primitive2d/bitmapprimitive2d.hxx2
-rw-r--r--include/drawinglayer/primitive2d/groupprimitive2d.hxx2
-rw-r--r--include/drawinglayer/primitive2d/patternfillprimitive2d.hxx2
-rw-r--r--include/drawinglayer/primitive2d/textbreakuphelper.hxx4
9 files changed, 81 insertions, 14 deletions
diff --git a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
index e875709b440e..8087a6544dc0 100644
--- a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
+++ b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
@@ -20,7 +20,7 @@
#pragma once
#include <drawinglayer/drawinglayerdllapi.h>
-
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
namespace drawinglayer::geometry
diff --git a/include/drawinglayer/primitive2d/CommonTypes.hxx b/include/drawinglayer/primitive2d/CommonTypes.hxx
index a7ef629fc98f..3e14b05daa30 100644
--- a/include/drawinglayer/primitive2d/CommonTypes.hxx
+++ b/include/drawinglayer/primitive2d/CommonTypes.hxx
@@ -20,11 +20,13 @@
#pragma once
#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <rtl/ref.hxx>
namespace drawinglayer::primitive2d
{
-typedef css::uno::Reference<css::graphic::XPrimitive2D> Primitive2DReference;
-typedef css::uno::Sequence<Primitive2DReference> Primitive2DSequence;
+class BasePrimitive2D;
+typedef rtl::Reference<BasePrimitive2D> Primitive2DReference;
+typedef css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> Primitive2DSequence;
} // end of namespace drawinglayer::primitive2d
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
index 43268d0209dd..45688e504936 100644
--- a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
@@ -21,6 +21,7 @@
#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/CommonTypes.hxx>
#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
@@ -70,6 +71,9 @@ public:
: deque(first, last)
{
}
+ Primitive2DContainer(
+ const css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>&);
+ Primitive2DContainer(const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>&);
virtual void visit(const Primitive2DReference& rSource) override { append(rSource); }
virtual void visit(const Primitive2DContainer& rSource) override { append(rSource); }
@@ -93,6 +97,8 @@ public:
bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); }
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const;
Primitive2DContainer maybeInvert(bool bInvert = false) const;
+
+ css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> toSequence() const;
};
} // end of namespace drawinglayer::primitive2d
diff --git a/include/drawinglayer/primitive2d/Tools.hxx b/include/drawinglayer/primitive2d/Tools.hxx
index fcb7ff48ce54..3eaa322d9a4f 100644
--- a/include/drawinglayer/primitive2d/Tools.hxx
+++ b/include/drawinglayer/primitive2d/Tools.hxx
@@ -22,13 +22,9 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/primitive2d/CommonTypes.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <basegfx/range/b2drange.hxx>
-namespace drawinglayer::geometry
-{
-class ViewInformation2D;
-}
-
namespace drawinglayer::primitive2d
{
/// get B2DRange from a given Primitive2DReference
@@ -41,6 +37,13 @@ basegfx::B2DRange DRAWINGLAYERCORE_DLLPUBLIC getB2DRangeFromPrimitive2DReference
bool DRAWINGLAYERCORE_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
const Primitive2DReference& rB);
+/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+bool DRAWINGLAYERCORE_DLLPUBLIC
+arePrimitive2DReferencesEqual(const css::uno::Reference<css::graphic::XPrimitive2D>& rA,
+ const css::uno::Reference<css::graphic::XPrimitive2D>& rB);
+
OUString DRAWINGLAYERCORE_DLLPUBLIC idToString(sal_uInt32 nId);
} // end of namespace drawinglayer::primitive2d
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index 444fec94c384..5fbcafc655db 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -31,6 +31,9 @@
#include <com/sun/star/util/XAccounting.hpp>
#include <basegfx/range/b2drange.hxx>
#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ref.hxx>
+#include <deque>
#include <mutex>
namespace drawinglayer::geometry
@@ -147,7 +150,7 @@ namespace drawinglayer::primitive2d
for view-independent primitives which are defined by not using ViewInformation2D
in their get2DDecomposition/getB2DRange implementations.
*/
-class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : public BasePrimitive2DImplBase
+class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : public salhelper::SimpleReferenceObject
{
BasePrimitive2D(const BasePrimitive2D&) = delete;
BasePrimitive2D& operator=(const BasePrimitive2D&) = delete;
@@ -183,6 +186,54 @@ public:
/** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
will construct a ViewInformation2D from the ViewParameters for that purpose
*/
+ virtual Primitive2DContainer
+ getDecomposition(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
+
+ /** The getRange implementation for UNO API will use getRange from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual css::geometry::RealRectangle2D
+ getRange(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
+
+ // XAccounting
+ virtual sal_Int64 estimateUsage();
+};
+
+/**
+ Rather than make all the BasePrimitive2D classes bear the cost of being an UNO
+ object, we just wrap the top level BasePrimitive2D in this class when we need
+ to pass them over UNO
+*/
+class DRAWINGLAYERCORE_DLLPUBLIC UnoPrimitive2D final : public BasePrimitive2DImplBase
+{
+ UnoPrimitive2D(const UnoPrimitive2D&) = delete;
+ UnoPrimitive2D& operator=(const UnoPrimitive2D&) = delete;
+
+public:
+ // constructor/destructor
+ UnoPrimitive2D(const rtl::Reference<BasePrimitive2D>& rPrimitive)
+ : mxPrimitive(rPrimitive)
+ {
+ }
+ virtual ~UnoPrimitive2D() override;
+
+ /// The default implementation will use getDecomposition results to create the range
+ basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from drawinglayer_primitivetypes2d.hxx to define unique IDs.
+ */
+ sal_uInt32 getPrimitive2DID() const;
+
+ /// The default implementation will return an empty sequence
+ void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ // Methods from XPrimitive2D
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
virtual css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>> SAL_CALL
getDecomposition(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters) override;
@@ -194,6 +245,11 @@ public:
// XAccounting
virtual sal_Int64 SAL_CALL estimateUsage() override;
+
+ rtl::Reference<BasePrimitive2D> const& getBasePrimitive2D() const { return mxPrimitive; }
+
+private:
+ rtl::Reference<BasePrimitive2D> mxPrimitive;
};
} // end of namespace drawinglayer::primitive2d
diff --git a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
index bef384eb47b2..46c0825af5e5 100644
--- a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
@@ -67,7 +67,7 @@ public:
getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
// XAccounting
- virtual sal_Int64 SAL_CALL estimateUsage() override;
+ virtual sal_Int64 estimateUsage() override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
diff --git a/include/drawinglayer/primitive2d/groupprimitive2d.hxx b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
index 52d4fb4eb13b..b34bef834f03 100644
--- a/include/drawinglayer/primitive2d/groupprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
@@ -85,7 +85,7 @@ namespace drawinglayer::primitive2d
virtual sal_uInt32 getPrimitive2DID() const override;
// XAccounting
- virtual sal_Int64 SAL_CALL estimateUsage() override;
+ virtual sal_Int64 estimateUsage() override;
};
} // end of namespace drawinglayer::primitive2d
diff --git a/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
index 63a3e6d8d274..9da0e44e5414 100644
--- a/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
@@ -85,7 +85,7 @@ namespace drawinglayer::primitive2d
virtual sal_uInt32 getPrimitive2DID() const override;
// XAccounting
- virtual sal_Int64 SAL_CALL estimateUsage() override;
+ virtual sal_Int64 estimateUsage() override;
/// helper which creates the content - checks if clipping is needed and eventually
/// creates buffered content to speed up rendering
diff --git a/include/drawinglayer/primitive2d/textbreakuphelper.hxx b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
index de233da8ea07..c007bb6afa1c 100644
--- a/include/drawinglayer/primitive2d/textbreakuphelper.hxx
+++ b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
@@ -20,7 +20,7 @@
#pragma once
#include <drawinglayer/drawinglayerdllapi.h>
-#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -39,7 +39,7 @@ namespace drawinglayer::primitive2d
{
private:
const TextSimplePortionPrimitive2D& mrSource;
- Primitive2DContainer mxResult;
+ Primitive2DContainer mxResult;
TextLayouterDevice maTextLayouter;
basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose maDecTrans;