summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-01-01 21:00:44 +0100
committerTomaž Vajngerl <quikee@gmail.com>2020-01-04 11:21:03 +0100
commitcd47cf36ebb70a3d6897b0abbb0b3cd8b290e1af (patch)
tree26c34ca80aab885bd99fe75227239c7e37aa530c /include
parentadf7031e3a35fe9d43085e8b223a6e36d20a32f4 (diff)
drawinglayer: extract classes from baseprimitive2d.hxx to own files
This extracts Primitive2DContainer class to its own file, common typedefs for PrimitiveReference, Primitive2DSequence to own file CommonTypes.hxx, some commonly used and independent functions to Tools.hxx. But for not BufferedDecompositionPrimitive2D class is left as it is. Change-Id: Ia55bafd32fb95eba945d091e2c2ae89b160140d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86086 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/drawinglayer/primitive2d/CommonTypes.hxx31
-rw-r--r--include/drawinglayer/primitive2d/Primitive2DContainer.hxx92
-rw-r--r--include/drawinglayer/primitive2d/Primitive2DVisitor.hxx41
-rw-r--r--include/drawinglayer/primitive2d/Tools.hxx47
-rw-r--r--include/drawinglayer/primitive2d/baseprimitive2d.hxx87
5 files changed, 214 insertions, 84 deletions
diff --git a/include/drawinglayer/primitive2d/CommonTypes.hxx b/include/drawinglayer/primitive2d/CommonTypes.hxx
new file mode 100644
index 000000000000..a7ef629fc98f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/CommonTypes.hxx
@@ -0,0 +1,31 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/graphic/XPrimitive2D.hpp>
+
+namespace drawinglayer::primitive2d
+{
+typedef css::uno::Reference<css::graphic::XPrimitive2D> Primitive2DReference;
+typedef css::uno::Sequence<Primitive2DReference> Primitive2DSequence;
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
new file mode 100644
index 000000000000..4b852f340a14
--- /dev/null
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.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 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
+
+#include <basegfx/range/b2drange.hxx>
+#include <deque>
+
+namespace drawinglayer::geometry
+{
+class ViewInformation2D;
+}
+
+namespace drawinglayer::primitive2d
+{
+class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer
+ : public std::deque<Primitive2DReference>,
+ public Primitive2DDecompositionVisitor
+{
+public:
+ explicit Primitive2DContainer() {}
+ explicit Primitive2DContainer(size_type count)
+ : deque(count)
+ {
+ }
+ virtual ~Primitive2DContainer() override;
+ Primitive2DContainer(const Primitive2DContainer& other)
+ : deque(other)
+ {
+ }
+ Primitive2DContainer(Primitive2DContainer&& other) noexcept
+ : deque(std::move(other))
+ {
+ }
+ Primitive2DContainer(const std::deque<Primitive2DReference>& other)
+ : deque(other)
+ {
+ }
+ Primitive2DContainer(std::initializer_list<Primitive2DReference> init)
+ : deque(init)
+ {
+ }
+ template <class Iter>
+ Primitive2DContainer(Iter first, Iter last)
+ : deque(first, last)
+ {
+ }
+
+ virtual void append(const Primitive2DReference&) override;
+ virtual void append(const Primitive2DContainer& rSource) override;
+ virtual void append(Primitive2DContainer&& rSource) override;
+ void append(const Primitive2DSequence& rSource);
+ Primitive2DContainer& operator=(const Primitive2DContainer& r)
+ {
+ deque::operator=(r);
+ return *this;
+ }
+ Primitive2DContainer& operator=(Primitive2DContainer&& r) noexcept
+ {
+ deque::operator=(std::move(r));
+ return *this;
+ }
+ bool operator==(const Primitive2DContainer& rB) const;
+ bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); }
+ basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const;
+ Primitive2DContainer maybeInvert(bool bInvert = false) const;
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
new file mode 100644
index 000000000000..dfe04b32a320
--- /dev/null
+++ b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+
+namespace drawinglayer::primitive2d
+{
+class Primitive2DContainer;
+
+// Visitor class for walking a tree of Primitive2DReference
+class DRAWINGLAYER_DLLPUBLIC Primitive2DDecompositionVisitor
+{
+public:
+ virtual void append(const Primitive2DReference&) = 0;
+ virtual void append(const Primitive2DContainer&) = 0;
+ virtual void append(Primitive2DContainer&&) = 0;
+ virtual ~Primitive2DDecompositionVisitor() {}
+};
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/Tools.hxx b/include/drawinglayer/primitive2d/Tools.hxx
new file mode 100644
index 000000000000..fbb6f5717c01
--- /dev/null
+++ b/include/drawinglayer/primitive2d/Tools.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+namespace drawinglayer::geometry
+{
+class ViewInformation2D;
+}
+
+namespace drawinglayer::primitive2d
+{
+/// get B2DRange from a given Primitive2DReference
+basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
+ const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
+
+/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
+ const Primitive2DReference& rB);
+
+OUString DRAWINGLAYER_DLLPUBLIC idToString(sal_uInt32 nId);
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index dfe196e2e608..5ac8fc31e1f7 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -23,11 +23,11 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <cppuhelper/compbase.hxx>
-#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <drawinglayer/primitive2d/CommonTypes.hxx>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <com/sun/star/util/XAccounting.hpp>
#include <cppuhelper/basemutex.hxx>
#include <basegfx/range/b2drange.hxx>
-#include <deque>
/** defines for DeclPrimitive2DIDBlock and ImplPrimitive2DIDBlock
Added to be able to simply change identification stuff later, e.g. add
@@ -47,75 +47,8 @@ class ViewInformation2D;
namespace drawinglayer::primitive2d
{
-/// typedefs for basePrimitive2DImplBase, Primitive2DSequence and Primitive2DReference
typedef cppu::WeakComponentImplHelper<css::graphic::XPrimitive2D, css::util::XAccounting>
BasePrimitive2DImplBase;
-typedef css::uno::Reference<css::graphic::XPrimitive2D> Primitive2DReference;
-typedef css::uno::Sequence<Primitive2DReference> Primitive2DSequence;
-
-class Primitive2DContainer;
-// Visitor class for walking a tree of Primitive2DReference in BasePrimitive2D::get2DDecomposition
-class DRAWINGLAYER_DLLPUBLIC Primitive2DDecompositionVisitor
-{
-public:
- virtual void append(const Primitive2DReference&) = 0;
- virtual void append(const Primitive2DContainer&) = 0;
- virtual void append(Primitive2DContainer&&) = 0;
- virtual ~Primitive2DDecompositionVisitor();
-};
-
-class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer
- : public std::deque<Primitive2DReference>,
- public Primitive2DDecompositionVisitor
-{
-public:
- explicit Primitive2DContainer() {}
- explicit Primitive2DContainer(size_type count)
- : deque(count)
- {
- }
- virtual ~Primitive2DContainer() override;
- Primitive2DContainer(const Primitive2DContainer& other)
- : deque(other)
- {
- }
- Primitive2DContainer(Primitive2DContainer&& other) noexcept
- : deque(std::move(other))
- {
- }
- Primitive2DContainer(const std::deque<Primitive2DReference>& other)
- : deque(other)
- {
- }
- Primitive2DContainer(std::initializer_list<Primitive2DReference> init)
- : deque(init)
- {
- }
- template <class Iter>
- Primitive2DContainer(Iter first, Iter last)
- : deque(first, last)
- {
- }
-
- virtual void append(const Primitive2DReference&) override;
- virtual void append(const Primitive2DContainer& rSource) override;
- virtual void append(Primitive2DContainer&& rSource) override;
- void append(const Primitive2DSequence& rSource);
- Primitive2DContainer& operator=(const Primitive2DContainer& r)
- {
- deque::operator=(r);
- return *this;
- }
- Primitive2DContainer& operator=(Primitive2DContainer&& r) noexcept
- {
- deque::operator=(std::move(r));
- return *this;
- }
- bool operator==(const Primitive2DContainer& rB) const;
- bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); }
- basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const;
- Primitive2DContainer maybeInvert(bool bInvert = false) const;
-};
/** BasePrimitive2D class
@@ -189,7 +122,7 @@ public:
the parameter ViewInformation2D is the same as the last one. This is usually the case
for view-independent primitives which are defined by not using ViewInformation2D
in their get2DDecomposition/getB2DRange implementations.
- */
+*/
class DRAWINGLAYER_DLLPUBLIC BasePrimitive2D : protected cppu::BaseMutex,
public BasePrimitive2DImplBase
{
@@ -311,20 +244,6 @@ public:
const geometry::ViewInformation2D& rViewInformation) const override;
};
-// tooling
-
-/// get B2DRange from a given Primitive2DReference
-basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
- const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
-
-/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
- and using compare operator
- */
-bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
- const Primitive2DReference& rB);
-
-OUString DRAWINGLAYER_DLLPUBLIC idToString(sal_uInt32 nId);
-
} // end of namespace drawinglayer::primitive2d
#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX