1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_drawinglayer.hxx"
30 
31 #include <drawinglayer/processor3d/baseprocessor3d.hxx>
32 
33 //////////////////////////////////////////////////////////////////////////////
34 
35 using namespace com::sun::star;
36 
37 //////////////////////////////////////////////////////////////////////////////
38 
39 namespace drawinglayer
40 {
41 	namespace processor3d
42 	{
43 		void BaseProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& /*rCandidate*/)
44 		{
45 		}
46 
47 		BaseProcessor3D::BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation)
48 		:	maViewInformation3D(rViewInformation)
49 		{
50 		}
51 
52 		BaseProcessor3D::~BaseProcessor3D()
53 		{
54 		}
55 
56 		void BaseProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
57 		{
58 			if(rSource.hasElements())
59 			{
60 				const sal_Int32 nCount(rSource.getLength());
61 
62 				for(sal_Int32 a(0L); a < nCount; a++)
63 				{
64 					// get reference
65 					const primitive3d::Primitive3DReference xReference(rSource[a]);
66 
67 					if(xReference.is())
68 					{
69 						// try to cast to BasePrimitive3D implementation
70 						const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get());
71 
72 						if(pBasePrimitive)
73 						{
74 							processBasePrimitive3D(*pBasePrimitive);
75 						}
76 						else
77 						{
78 							// unknown implementation, use UNO API call instead and process recursively
79 							const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence());
80 							process(xReference->getDecomposition(rViewParameters));
81 						}
82 					}
83 				}
84 			}
85 		}
86 	} // end of namespace processor3d
87 } // end of namespace drawinglayer
88 
89 //////////////////////////////////////////////////////////////////////////////
90 
91 namespace drawinglayer
92 {
93 	namespace processor3d
94 	{
95 		CollectingProcessor3D::CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation)
96 		:	BaseProcessor3D(rViewInformation),
97 			maPrimitive3DSequence()
98 		{
99 		}
100 
101 		CollectingProcessor3D::~CollectingProcessor3D()
102 		{
103 		}
104 
105 		void CollectingProcessor3D::process(const primitive3d::Primitive3DSequence& rSource)
106 		{
107 			// accept everything
108 			primitive3d::appendPrimitive3DSequenceToPrimitive3DSequence(maPrimitive3DSequence, rSource);
109 		}
110 	} // end of namespace processor3d
111 } // end of namespace drawinglayer
112 
113 //////////////////////////////////////////////////////////////////////////////
114 // eof
115