LibreOffice Module drawinglayer (master) 1
linegeometryextractor2d.cxx
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
25
26
27using namespace com::sun::star;
28
29
31{
33 : BaseProcessor2D(rViewInformation),
34 mbInLineGeometry(false)
35 {
36 }
37
39 {
40 }
41
43 {
44 switch(rCandidate.getPrimitive2DID())
45 {
48 {
49 // enter a line geometry group (with or without LineEnds)
50 bool bOldState(mbInLineGeometry);
51 mbInLineGeometry = true;
52 process(rCandidate);
53 mbInLineGeometry = bOldState;
54 break;
55 }
57 {
59 {
60 // extract hairline line geometry in world coordinates
61 const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
62 basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
63 aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
64 maExtractedHairlines.push_back(aLocalPolygon);
65 }
66 break;
67 }
69 {
71 {
72 // extract filled line geometry (line with width)
73 const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
74 basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
75 aLocalPolyPolygon.transform(getViewInformation2D().getObjectTransformation());
76 maExtractedLineFills.push_back(aLocalPolyPolygon);
77 }
78 break;
79 }
81 {
82 // remember current transformation and ViewInformation
83 const primitive2d::TransformPrimitive2D& rTransformCandidate(static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate));
84 const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
85
86 // create new transformations for CurrentTransformation and for local ViewInformation2D
88 aViewInformation2D.setObjectTransformation(getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation());
89 updateViewInformation(aViewInformation2D);
90
91 // process content
92 process(rTransformCandidate.getChildren());
93
94 // restore transformations
95 updateViewInformation(aLastViewInformation2D);
96
97 break;
98 }
106 {
107 // ignorable primitives
108 break;
109 }
110 default :
111 {
112 // process recursively
113 process(rCandidate);
114 break;
115 }
116 }
117 }
118
119} // end of namespace
120
121/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void transform(const basegfx::B2DHomMatrix &rMatrix)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void setObjectTransformation(const basegfx::B2DHomMatrix &rNew)
virtual sal_uInt32 getPrimitive2DID() const =0
provide unique ID for fast identifying of known primitive implementations in renderers.
const Primitive2DContainer & getChildren() const
data read access
const basegfx::B2DPolyPolygon & getB2DPolyPolygon() const
data read access
const basegfx::B2DPolygon & getB2DPolygon() const
data read access
const basegfx::B2DHomMatrix & getTransformation() const
data read access
void process(const primitive2d::BasePrimitive2D &rCandidate)
void updateViewInformation(const geometry::ViewInformation2D &rViewInformation2D)
const geometry::ViewInformation2D & getViewInformation2D() const
data read access
void processBasePrimitive2D(const primitive2d::BasePrimitive2D &rCandidate) override
tooling methods
LineGeometryExtractor2D(const geometry::ViewInformation2D &rViewInformation)
#define PRIMITIVE2D_ID_SCENEPRIMITIVE2D
#define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D
#define PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D
#define PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D
#define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D
#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D
#define PRIMITIVE2D_ID_MASKPRIMITIVE2D
#define PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D
#define PRIMITIVE2D_ID_METAFILEPRIMITIVE2D
#define PRIMITIVE2D_ID_BITMAPPRIMITIVE2D
#define PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D
#define PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D