Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / drawinglayer / source / processor2d / objectinfoextractor2d.cxx
blob552406d53f68b7c226c75aec1381c4d336226802
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <drawinglayer/processor2d/objectinfoextractor2d.hxx>
21 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
22 #include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx>
24 using namespace com::sun::star;
26 namespace drawinglayer::processor2d
28 void ObjectInfoPrimitiveExtractor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
30 if(mpFound)
31 return;
33 switch(rCandidate.getPrimitive2DID())
35 case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D :
37 mpFound = dynamic_cast< const primitive2d::ObjectInfoPrimitive2D* >(&rCandidate);
38 break;
40 default :
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);
49 if(pGroupPrimitive2D)
51 // process group children recursively
52 process(pGroupPrimitive2D->getChildren());
54 else
56 // do not process recursively, we *only* want to find existing
57 // ObjectInfoPrimitive2D entries
60 break;
65 ObjectInfoPrimitiveExtractor2D::ObjectInfoPrimitiveExtractor2D(const geometry::ViewInformation2D& rViewInformation)
66 : BaseProcessor2D(rViewInformation),
67 mpFound(nullptr)
71 ObjectInfoPrimitiveExtractor2D::~ObjectInfoPrimitiveExtractor2D()
75 } // end of namespace
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */