1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_drawinglayer.hxx"
26 
27 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
28 
29 //////////////////////////////////////////////////////////////////////////////
30 
31 using namespace com::sun::star;
32 
33 //////////////////////////////////////////////////////////////////////////////
34 
35 namespace drawinglayer
36 {
37 	namespace processor2d
38 	{
processBasePrimitive2D(const primitive2d::BasePrimitive2D &)39 		void BaseProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& /*rCandidate*/)
40 		{
41 		}
42 
BaseProcessor2D(const geometry::ViewInformation2D & rViewInformation)43 		BaseProcessor2D::BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation)
44 		:	maViewInformation2D(rViewInformation)
45 		{
46 		}
47 
~BaseProcessor2D()48 		BaseProcessor2D::~BaseProcessor2D()
49 		{
50 		}
51 
process(const primitive2d::Primitive2DSequence & rSource)52 		void BaseProcessor2D::process(const primitive2d::Primitive2DSequence& rSource)
53 		{
54 			if(rSource.hasElements())
55 			{
56 				const sal_Int32 nCount(rSource.getLength());
57 
58 				for(sal_Int32 a(0L); a < nCount; a++)
59 				{
60 					// get reference
61 					const primitive2d::Primitive2DReference xReference(rSource[a]);
62 
63 					if(xReference.is())
64 					{
65 						// try to cast to BasePrimitive2D implementation
66 						const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get());
67 
68 						if(pBasePrimitive)
69 						{
70 							// it is a BasePrimitive2D implementation, use local processor
71 							processBasePrimitive2D(*pBasePrimitive);
72 						}
73 						else
74 						{
75 							// unknown implementation, use UNO API call instead and process recursively
76 							const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation2D().getViewInformationSequence());
77 							process(xReference->getDecomposition(rViewParameters));
78 						}
79 					}
80 				}
81 			}
82 		}
83 	} // end of namespace processor2d
84 } // end of namespace drawinglayer
85 
86 //////////////////////////////////////////////////////////////////////////////
87 // eof
88