LibreOffice Module drawinglayer (master) 1
objectinfoextractor2d.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
23
24using namespace com::sun::star;
25
27{
29 {
30 if(mpFound)
31 return;
32
33 switch(rCandidate.getPrimitive2DID())
34 {
36 {
37 mpFound = dynamic_cast< const primitive2d::ObjectInfoPrimitive2D* >(&rCandidate);
38 break;
39 }
40 default :
41 {
42 // we look for an encapsulated primitive, so do not decompose primitives
43 // based on GroupPrimitive2D, just visit their children. It may be that more
44 // group-like primitives need to be added here, but all primitives with
45 // grouping functionality should be implemented based on the GroupPrimitive2D
46 // class and have their main content accessible as children
47 const primitive2d::GroupPrimitive2D* pGroupPrimitive2D = dynamic_cast< const primitive2d::GroupPrimitive2D* >(&rCandidate);
48
49 if(pGroupPrimitive2D)
50 {
51 // process group children recursively
52 process(pGroupPrimitive2D->getChildren());
53 }
54 else
55 {
56 // do not process recursively, we *only* want to find existing
57 // ObjectInfoPrimitive2D entries
58 }
59
60 break;
61 }
62 }
63 }
64
66 : BaseProcessor2D(rViewInformation),
67 mpFound(nullptr)
68 {
69 }
70
72 {
73 }
74
75} // end of namespace
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
void process(const primitive2d::BasePrimitive2D &rCandidate)
ObjectInfoPrimitiveExtractor2D(const geometry::ViewInformation2D &rViewInformation)
void processBasePrimitive2D(const primitive2d::BasePrimitive2D &rCandidate) override
tooling methods
const primitive2d::ObjectInfoPrimitive2D * mpFound
the target
#define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D