LibreOffice Module drawinglayer (master) 1
baseprimitive3d.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
21#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
22
24
27#include <com/sun/star/graphic/XPrimitive3D.hpp>
29#include <deque>
30
31
38#define DeclPrimitive3DIDBlock() \
39 virtual sal_uInt32 getPrimitive3DID() const override;
40
41#define ImplPrimitive3DIDBlock(TheClass, TheID) \
42 sal_uInt32 TheClass::getPrimitive3DID() const { return TheID; }
43
44
45// predefines
46
47namespace drawinglayer::geometry {
48 class ViewInformation3D;
49}
50
54 typedef css::uno::Reference< css::graphic::XPrimitive3D > Primitive3DReference;
55
56 class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive3DContainer : public std::deque< Primitive3DReference >
57 {
58 public:
60 explicit Primitive3DContainer( size_type count ) : deque(count) {}
61 Primitive3DContainer( const Primitive3DContainer& other ) : deque(other) {}
62 Primitive3DContainer( Primitive3DContainer&& other ) noexcept : deque(std::move(other)) {}
63 Primitive3DContainer( std::initializer_list<Primitive3DReference> init ) : deque(init) {}
64 template <class Iter>
65 Primitive3DContainer(Iter first, Iter last) : deque(first, last) {}
66
67 void append(const Primitive3DContainer& rSource);
68 Primitive3DContainer& operator=(const Primitive3DContainer& r) { deque::operator=(r); return *this; }
69 Primitive3DContainer& operator=(Primitive3DContainer&& r) noexcept { deque::operator=(std::move(r)); return *this; }
70 bool operator==(const Primitive3DContainer& rB) const;
71 bool operator!=(const Primitive3DContainer& rB) const { return !operator==(rB); }
72 basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& aViewInformation) const;
73 };
74}
75
76
77// basePrimitive3D class
78
80 {
97 {
100 public:
101 // constructor/destructor
103 virtual ~BasePrimitive3D() override;
104
110 virtual bool operator==( const BasePrimitive3D& rPrimitive ) const;
111 bool operator!=( const BasePrimitive3D& rPrimitive ) const { return !operator==(rPrimitive); }
112
117 virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
118
122 virtual sal_uInt32 getPrimitive3DID() const = 0;
123
125 virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
126
127
128 // Methods from XPrimitive3D
129
130
134 virtual css::uno::Sequence< ::css::uno::Reference< ::css::graphic::XPrimitive3D > > SAL_CALL getDecomposition( const css::uno::Sequence< css::beans::PropertyValue >& rViewParameters ) override;
135
139 virtual css::geometry::RealRectangle3D SAL_CALL getRange( const css::uno::Sequence< css::beans::PropertyValue >& rViewParameters ) override;
140 };
141
142} // end of namespace drawinglayer::primitive2d
143
144
145// BufferedDecompositionPrimitive3D class
146
148 {
157 : public BasePrimitive3D
158 {
159 private:
162
163 protected:
168 const Primitive3DContainer& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; }
169 void setBuffered3DDecomposition(const Primitive3DContainer& rNew) { maBuffered3DDecomposition = rNew; }
170
174 virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
175
176 public:
177 // constructor
179
186 virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
187 };
188
189} // end of namespace drawinglayer::primitive3d
190
191
192// tooling
193
195 {
197 basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation);
198
203
204} // end of namespace drawinglayer::primitive3d
205
206
207#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
208
209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FILE * init(int, char **)
BasePrimitive3D & operator=(const BasePrimitive3D &)=delete
bool operator!=(const BasePrimitive3D &rPrimitive) const
BasePrimitive3D(const BasePrimitive3D &)=delete
virtual sal_uInt32 getPrimitive3DID() const =0
provide unique ID for fast identifying of known primitive implementations in renderers.
Primitive3DContainer maBuffered3DDecomposition
a sequence used for buffering the last create3DDecomposition() result
void setBuffered3DDecomposition(const Primitive3DContainer &rNew)
const Primitive3DContainer & getBuffered3DDecomposition() const
access methods to maBuffered3DDecomposition.
Primitive3DContainer & operator=(Primitive3DContainer &&r) noexcept
Primitive3DContainer & operator=(const Primitive3DContainer &r)
Primitive3DContainer(const Primitive3DContainer &other)
bool operator!=(const Primitive3DContainer &rB) const
Primitive3DContainer(std::initializer_list< Primitive3DReference > init)
Primitive3DContainer(Primitive3DContainer &&other) noexcept
#define DRAWINGLAYER_DLLPUBLIC
B2DRange getRange(const B2DPolygon &rCandidate)
SdrPrimitive3D class.
css::uno::Reference< css::graphic::XPrimitive3D > Primitive3DReference
bool arePrimitive3DReferencesEqual(const Primitive3DReference &rxA, const Primitive3DReference &rxB)
compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitiv...
comphelper::WeakComponentImplHelper< css::graphic::XPrimitive3D > BasePrimitive3DImplBase
typedefs for basePrimitive3DImplBase, Primitive3DContainer and Primitive3DReference
basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference &rCandidate, const geometry::ViewInformation3D &aViewInformation)
get B3DRange from a given Primitive3DReference
constexpr OUStringLiteral first
constexpr OUStringLiteral last
#define SAL_WARN_UNUSED
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)