21#include <rtl/math.hxx>
29#include <com/sun/star/beans/XPropertySet.hpp>
30#include <com/sun/star/drawing/Direction3D.hpp>
31#include <com/sun/star/drawing/CameraGeometry.hpp>
42 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
44 maDiffuseColor(0x00000000),
45 maDirection(0.0, 0.0, 1.0),
52 switch(aIter.getToken())
63 if (!std::isnan(aVal.
getX()) && !std::isnan(aVal.
getY()) && !std::isnan(aVal.
getZ()))
69 SAL_WARN(
"xmloff",
"NaNs found in light direction: " << aIter.toString());
96 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
97 uno::Reference< drawing::XShapes >
const & rShapes,
98 bool bTemporaryShapes)
109 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
113 AddShape(
"com.sun.star.drawing.Shape3DSceneObject" );
145 uno::Reference< beans::XPropertySet > xPropSet(
mxShape, uno::UNO_QUERY);
152 GetImport().GetShapeImport()->popGroupAndPostProcess();
160 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
189: mrImport( rImporter ),
190 mbSetTransform( false ),
191 mxPrjMode(
drawing::ProjectionMode_PERSPECTIVE),
195 mxShadeMode(
drawing::ShadeMode_SMOOTH),
196 maAmbientColor(0x00666666),
197 mbLightingMode(false),
198 maVRP(0.0, 0.0, 1.0),
199 maVPN(0.0, 0.0, 1.0),
200 maVUP(0.0, 1.0, 0.0),
211 maList.push_back(xContext);
213 return xContext.get();
219 auto nAttributeToken = aIter.
getToken();
269 mxPrjMode = drawing::ProjectionMode_PARALLEL;
271 mxPrjMode = drawing::ProjectionMode_PERSPECTIVE;
348 for(
size_t a = 0;
a <
maList.size();
a++)
354 drawing::Direction3D aLightDir;
365 xPropSet->setPropertyValue(
"D3DSceneLightColor1", aAny);
366 xPropSet->setPropertyValue(
"D3DSceneLightDirection1", aAny2);
367 xPropSet->setPropertyValue(
"D3DSceneLightOn1", aAny3);
372 xPropSet->setPropertyValue(
"D3DSceneLightColor2", aAny);
373 xPropSet->setPropertyValue(
"D3DSceneLightDirection2", aAny2);
374 xPropSet->setPropertyValue(
"D3DSceneLightOn2", aAny3);
379 xPropSet->setPropertyValue(
"D3DSceneLightColor3", aAny);
380 xPropSet->setPropertyValue(
"D3DSceneLightDirection3", aAny2);
381 xPropSet->setPropertyValue(
"D3DSceneLightOn3", aAny3);
386 xPropSet->setPropertyValue(
"D3DSceneLightColor4", aAny);
387 xPropSet->setPropertyValue(
"D3DSceneLightDirection4", aAny2);
388 xPropSet->setPropertyValue(
"D3DSceneLightOn4", aAny3);
393 xPropSet->setPropertyValue(
"D3DSceneLightColor5", aAny);
394 xPropSet->setPropertyValue(
"D3DSceneLightDirection5", aAny2);
395 xPropSet->setPropertyValue(
"D3DSceneLightOn5", aAny3);
400 xPropSet->setPropertyValue(
"D3DSceneLightColor6", aAny);
401 xPropSet->setPropertyValue(
"D3DSceneLightDirection6", aAny2);
402 xPropSet->setPropertyValue(
"D3DSceneLightOn6", aAny3);
407 xPropSet->setPropertyValue(
"D3DSceneLightColor7", aAny);
408 xPropSet->setPropertyValue(
"D3DSceneLightDirection7", aAny2);
409 xPropSet->setPropertyValue(
"D3DSceneLightOn7", aAny3);
414 xPropSet->setPropertyValue(
"D3DSceneLightColor8", aAny);
415 xPropSet->setPropertyValue(
"D3DSceneLightDirection8", aAny2);
416 xPropSet->setPropertyValue(
"D3DSceneLightOn8", aAny3);
424 drawing::CameraGeometry aCamGeo;
434 xPropSet->setPropertyValue(
"D3DCameraGeometry",
uno::Any(aCamGeo));
SdXML3DLightContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
::basegfx::B3DVector maDirection
virtual ~SdXML3DLightContext() override
const ::basegfx::B3DVector & GetDirection() const
sal_Int32 GetDiffuseColor() const
void processSceneAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &aIter)
this should be called for each scene attribute
void setSceneAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
this sets the scene attributes at this propertyset
css::drawing::ShadeMode mxShadeMode
SdXML3DSceneAttributesHelper(SvXMLImport &rImporter)
::basegfx::B3DVector maVRP
css::drawing::ProjectionMode mxPrjMode
SvXMLImportContext * create3DLightContext(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
creates a 3d light context and adds it to the internal list for later processing
css::drawing::HomogenMatrix mxHomMat
::std::vector< rtl::Reference< SdXML3DLightContext > > maList
::basegfx::B3DVector maVUP
::basegfx::B3DVector maVPN
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual ~SdXML3DSceneShapeContext() override
SdXML3DSceneShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
css::uno::Reference< css::drawing::XShapes > mxChildren
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
void AddShape(css::uno::Reference< css::drawing::XShape > &xShape)
SvXMLImport & GetImport()
void SetStyle(bool bSupportsStyle=true)
if bSupportsStyle is false, auto styles will be set but not a style
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
This class deliberately does not support XWeak, to improve performance when loading large documents.
css::uno::Reference< css::drawing::XShape > mxShape
static bool convertB3DVector(::basegfx::B3DVector &rVector, std::string_view rValue)
convert string to basegfx::B3DVector
static SvXMLShapeContext * Create3DSceneChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
static bool convertBool(bool &rBool, std::u16string_view rString)
sal_Int32 getToken() const
OUString toString() const
std::string_view toView() const
#define SAL_WARN(area, stream)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
constexpr sal_Int32 TOKEN_MASK
constexpr sal_uInt16 XML_NAMESPACE_DR3D