summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r--xmloff/source/draw/EnhancedCustomShapeToken.cxx221
-rw-r--r--xmloff/source/draw/XMLGraphicsDefaultStyle.cxx111
-rw-r--r--xmloff/source/draw/XMLImageMapContext.cxx723
-rw-r--r--xmloff/source/draw/XMLImageMapExport.cxx386
-rw-r--r--xmloff/source/draw/XMLNumberStyles.cxx743
-rw-r--r--xmloff/source/draw/XMLNumberStylesExport.hxx53
-rw-r--r--xmloff/source/draw/XMLReplacementImageContext.cxx136
-rw-r--r--xmloff/source/draw/XMLShapePropertySetContext.cxx116
-rw-r--r--xmloff/source/draw/XMLShapeStyleContext.cxx326
-rw-r--r--xmloff/source/draw/animationexport.cxx1782
-rw-r--r--xmloff/source/draw/animationimport.cxx1523
-rw-r--r--xmloff/source/draw/animexp.cxx553
-rw-r--r--xmloff/source/draw/animimp.cxx694
-rw-r--r--xmloff/source/draw/descriptionimp.cxx93
-rw-r--r--xmloff/source/draw/descriptionimp.hxx60
-rw-r--r--xmloff/source/draw/eventimp.cxx575
-rw-r--r--xmloff/source/draw/eventimp.hxx57
-rw-r--r--xmloff/source/draw/layerexp.cxx109
-rw-r--r--xmloff/source/draw/layerexp.hxx40
-rw-r--r--xmloff/source/draw/layerimp.cxx180
-rw-r--r--xmloff/source/draw/layerimp.hxx58
-rw-r--r--xmloff/source/draw/makefile.mk85
-rw-r--r--xmloff/source/draw/numithdl.cxx63
-rw-r--r--xmloff/source/draw/numithdl.hxx52
-rw-r--r--xmloff/source/draw/propimp0.cxx272
-rw-r--r--xmloff/source/draw/propimp0.hxx78
-rw-r--r--xmloff/source/draw/sdpropls.cxx1764
-rw-r--r--xmloff/source/draw/sdpropls.hxx334
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx2991
-rw-r--r--xmloff/source/draw/sdxmlexp_impl.hxx228
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx1099
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx339
-rw-r--r--xmloff/source/draw/shapeexport.cxx1303
-rw-r--r--xmloff/source/draw/shapeexport2.cxx2056
-rw-r--r--xmloff/source/draw/shapeexport3.cxx498
-rw-r--r--xmloff/source/draw/shapeexport4.cxx1236
-rw-r--r--xmloff/source/draw/shapeimport.cxx1466
-rw-r--r--xmloff/source/draw/viewcontext.cxx91
-rw-r--r--xmloff/source/draw/viewcontext.hxx54
-rw-r--r--xmloff/source/draw/xexptran.cxx3117
-rw-r--r--xmloff/source/draw/ximp3dobject.cxx613
-rw-r--r--xmloff/source/draw/ximp3dobject.hxx179
-rw-r--r--xmloff/source/draw/ximp3dscene.cxx497
-rw-r--r--xmloff/source/draw/ximp3dscene.hxx81
-rw-r--r--xmloff/source/draw/ximpbody.cxx388
-rw-r--r--xmloff/source/draw/ximpbody.hxx79
-rw-r--r--xmloff/source/draw/ximpcustomshape.cxx1383
-rw-r--r--xmloff/source/draw/ximpcustomshape.hxx77
-rw-r--r--xmloff/source/draw/ximpgrp.cxx130
-rw-r--r--xmloff/source/draw/ximpgrp.hxx72
-rw-r--r--xmloff/source/draw/ximplink.cxx102
-rw-r--r--xmloff/source/draw/ximplink.hxx66
-rw-r--r--xmloff/source/draw/ximpnote.cxx142
-rw-r--r--xmloff/source/draw/ximpnote.hxx58
-rw-r--r--xmloff/source/draw/ximppage.cxx647
-rw-r--r--xmloff/source/draw/ximppage.hxx96
-rw-r--r--xmloff/source/draw/ximpshap.cxx3771
-rw-r--r--xmloff/source/draw/ximpshap.hxx664
-rw-r--r--xmloff/source/draw/ximpshow.cxx282
-rw-r--r--xmloff/source/draw/ximpshow.hxx57
-rw-r--r--xmloff/source/draw/ximpstyl.cxx1692
-rw-r--r--xmloff/source/draw/ximpstyl.hxx302
62 files changed, 37043 insertions, 0 deletions
diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
new file mode 100644
index 000000000000..1a4ddcc67cfe
--- /dev/null
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "EnhancedCustomShapeToken.hxx"
+#include <osl/mutex.hxx>
+#include <hash_map>
+#include <string.h>
+
+namespace xmloff { namespace EnhancedCustomShapeToken {
+
+struct TCheck
+{
+ bool operator()( const char* s1, const char* s2 ) const
+ {
+ return strcmp( s1, s2 ) == 0;
+ }
+};
+typedef std::hash_map< const char*, EnhancedCustomShapeTokenEnum, std::hash<const char*>, TCheck> TypeNameHashMap;
+static TypeNameHashMap* pHashMap = NULL;
+static ::osl::Mutex& getHashMapMutex()
+{
+ static osl::Mutex s_aHashMapProtection;
+ return s_aHashMapProtection;
+}
+
+struct TokenTable
+{
+ const char* pS;
+ EnhancedCustomShapeTokenEnum pE;
+};
+
+static const TokenTable pTokenTableArray[] =
+{
+ { "type", EAS_type },
+ { "name", EAS_name },
+ { "mirror-horizontal", EAS_mirror_horizontal },
+ { "mirror-vertical", EAS_mirror_vertical },
+ { "viewBox", EAS_viewBox },
+ { "text-rotate-angle", EAS_text_rotate_angle },
+ { "extrusion-allowed", EAS_extrusion_allowed },
+ { "extrusion-text-path-allowed", EAS_text_path_allowed },
+ { "extrusion-concentric-gradient-fill", EAS_concentric_gradient_fill_allowed },
+ { "extrusion", EAS_extrusion },
+ { "extrusion-brightness", EAS_extrusion_brightness },
+ { "extrusion-depth", EAS_extrusion_depth },
+ { "extrusion-diffusion", EAS_extrusion_diffusion },
+ { "extrusion-number-of-line-segments", EAS_extrusion_number_of_line_segments },
+ { "extrusion-light-face", EAS_extrusion_light_face },
+ { "extrusion-first-light-harsh", EAS_extrusion_first_light_harsh },
+ { "extrusion-second-light-harsh", EAS_extrusion_second_light_harsh },
+ { "extrusion-first-light-livel", EAS_extrusion_first_light_level },
+ { "extrusion-second-light-level", EAS_extrusion_second_light_level },
+ { "extrusion-first-light-direction", EAS_extrusion_first_light_direction },
+ { "extrusion-second-light-direction", EAS_extrusion_second_light_direction },
+ { "extrusion-metal", EAS_extrusion_metal },
+ { "shade-mode", EAS_shade_mode },
+ { "extrusion-rotation-angle", EAS_extrusion_rotation_angle },
+ { "extrusion-rotation-center", EAS_extrusion_rotation_center },
+ { "extrusion-shininess", EAS_extrusion_shininess },
+ { "extrusion-skew", EAS_extrusion_skew },
+ { "extrusion-specularity", EAS_extrusion_specularity },
+ { "projection", EAS_projection },
+ { "extrusion-viewpoint", EAS_extrusion_viewpoint },
+ { "extrusion-origin", EAS_extrusion_origin },
+ { "extrusion-color", EAS_extrusion_color },
+ { "enhanced-path", EAS_enhanced_path },
+ { "path-stretchpoint-x", EAS_path_stretchpoint_x },
+ { "path-stretchpoint-y", EAS_path_stretchpoint_y },
+ { "text-areas", EAS_text_areas },
+ { "glue-points", EAS_glue_points },
+ { "glue-point-type", EAS_glue_point_type },
+ { "glue-point-leaving-directions", EAS_glue_point_leaving_directions },
+ { "text-path", EAS_text_path },
+ { "text-path-mode", EAS_text_path_mode },
+ { "text-path-scale", EAS_text_path_scale },
+ { "text-path-same-letter-heights", EAS_text_path_same_letter_heights },
+ { "modifiers", EAS_modifiers },
+ { "equation", EAS_equation },
+ { "formula", EAS_formula },
+ { "handle", EAS_handle },
+ { "handle-mirror-horizontal", EAS_handle_mirror_horizontal },
+ { "handle-mirror-vertical", EAS_handle_mirror_vertical },
+ { "handle-switched", EAS_handle_switched },
+ { "handle-position", EAS_handle_position },
+ { "handle-range-x-minimum", EAS_handle_range_x_minimum },
+ { "handle-range-x-maximum", EAS_handle_range_x_maximum },
+ { "handle-range-y-minimum", EAS_handle_range_y_minimum },
+ { "handle-range-y-maximum", EAS_handle_range_y_maximum },
+ { "handle-polar", EAS_handle_polar },
+ { "handle-radius-range-minimum", EAS_handle_radius_range_minimum },
+ { "handle-radius-range-maximum", EAS_handle_radius_range_maximum },
+
+ { "CustomShapeEngine", EAS_CustomShapeEngine },
+ { "CustomShapeData", EAS_CustomShapeData },
+ { "Type", EAS_Type },
+ { "MirroredX", EAS_MirroredX },
+ { "MirroredY", EAS_MirroredY },
+ { "ViewBox", EAS_ViewBox },
+ { "TextRotateAngle", EAS_TextRotateAngle },
+ { "ExtrusionAllowed", EAS_ExtrusionAllowed },
+ { "TextPathAllowed", EAS_TextPathAllowed },
+ { "ConcentricGradientFillAllowed", EAS_ConcentricGradientFillAllowed },
+ { "Extrusion", EAS_Extrusion },
+ { "Equations", EAS_Equations },
+ { "Equation", EAS_Equation },
+ { "Path", EAS_Path },
+ { "TextPath", EAS_TextPath },
+ { "Handles", EAS_Handles },
+ { "Handle", EAS_Handle },
+ { "Brightness", EAS_Brightness },
+ { "Depth", EAS_Depth },
+ { "Diffusion", EAS_Diffusion },
+ { "NumberOfLineSegments", EAS_NumberOfLineSegments },
+ { "LightFace", EAS_LightFace },
+ { "FirstLightHarsh", EAS_FirstLightHarsh },
+ { "SecondLightHarsh", EAS_SecondLightHarsh },
+ { "FirstLightLevel", EAS_FirstLightLevel },
+ { "SecondLightLevel", EAS_SecondLightLevel },
+ { "FirstLightDirection", EAS_FirstLightDirection },
+ { "SecondLightDirection", EAS_SecondLightDirection },
+ { "Metal", EAS_Metal },
+ { "ShadeMode", EAS_ShadeMode },
+ { "RotateAngle", EAS_RotateAngle },
+ { "RotationCenter", EAS_RotationCenter },
+ { "Shininess", EAS_Shininess },
+ { "Skew", EAS_Skew },
+ { "Specularity", EAS_Specularity },
+ { "ProjectionMode", EAS_ProjectionMode },
+ { "ViewPoint", EAS_ViewPoint },
+ { "Origin", EAS_Origin },
+ { "Color", EAS_Color },
+ { "Switched", EAS_Switched },
+ { "Polar", EAS_Polar },
+ { "RangeXMinimum", EAS_RangeXMinimum },
+ { "RangeXMaximum", EAS_RangeXMaximum },
+ { "RangeYMinimum", EAS_RangeYMinimum },
+ { "RangeYMaximum", EAS_RangeYMaximum },
+ { "RadiusRangeMinimum", EAS_RadiusRangeMinimum },
+ { "RadiusRangeMaximum", EAS_RadiusRangeMaximum },
+ { "Coordinates", EAS_Coordinates },
+ { "Segments", EAS_Segments },
+ { "StretchX", EAS_StretchX },
+ { "StretchY", EAS_StretchY },
+ { "TextFrames", EAS_TextFrames },
+ { "GluePoints", EAS_GluePoints },
+ { "GluePointLeavingDirections", EAS_GluePointLeavingDirections },
+ { "GluePointType", EAS_GluePointType },
+ { "TextPathMode", EAS_TextPathMode },
+ { "ScaleX", EAS_ScaleX },
+ { "SameLetterHeights", EAS_SameLetterHeights },
+ { "Position", EAS_Position },
+ { "AdjustmentValues", EAS_AdjustmentValues },
+
+ { "Last", EAS_Last },
+ { "NotFound", EAS_NotFound }
+};
+
+EnhancedCustomShapeTokenEnum EASGet( const rtl::OUString& rShapeType )
+{
+ if ( !pHashMap )
+ { // init hash map
+ ::osl::MutexGuard aGuard( getHashMapMutex() );
+ if ( !pHashMap )
+ {
+ TypeNameHashMap* pH = new TypeNameHashMap;
+ const TokenTable* pPtr = pTokenTableArray;
+ const TokenTable* pEnd = pPtr + ( sizeof( pTokenTableArray ) / sizeof( TokenTable ) );
+ for ( ; pPtr < pEnd; pPtr++ )
+ (*pH)[ pPtr->pS ] = pPtr->pE;
+ pHashMap = pH;
+ }
+ }
+ EnhancedCustomShapeTokenEnum eRetValue = EAS_NotFound;
+ int i, nLen = rShapeType.getLength();
+ char* pBuf = new char[ nLen + 1 ];
+ for ( i = 0; i < nLen; i++ )
+ pBuf[ i ] = (char)rShapeType[ i ];
+ pBuf[ i ] = 0;
+ TypeNameHashMap::iterator aHashIter( pHashMap->find( pBuf ) );
+ delete[] pBuf;
+ if ( aHashIter != pHashMap->end() )
+ eRetValue = (*aHashIter).second;
+ return eRetValue;
+}
+
+rtl::OUString EASGet( const EnhancedCustomShapeTokenEnum eToken )
+{
+ sal_uInt32 i = eToken >= EAS_Last
+ ? (sal_uInt32)EAS_NotFound
+ : (sal_uInt32)eToken;
+ return rtl::OUString::createFromAscii( pTokenTableArray[ i ].pS );
+}
+
+}
+}
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
new file mode 100644
index 000000000000..4b8bcf429057
--- /dev/null
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <tools/debug.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+
+#ifndef _XMLOFF_FAMILIES_HXX
+#include <xmloff/families.hxx>
+#endif
+#include "XMLShapePropertySetContext.hxx"
+#include <xmloff/XMLGraphicsDefaultStyle.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::xml::sax;
+
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_TEXT_PROPERTIES;
+using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
+using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( XMLGraphicsDefaultStyle, XMLPropStyleContext );
+
+XMLGraphicsDefaultStyle::XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList >& xAttrList, SvXMLStylesContext& rStyles )
+: XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sal_True )
+{
+}
+
+XMLGraphicsDefaultStyle::~XMLGraphicsDefaultStyle()
+{
+}
+
+SvXMLImportContext *XMLGraphicsDefaultStyle::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new XMLShapePropertySetContext( GetImport(), nPrefix, rLocalName, xAttrList, nFamily, GetProperties(), xImpPrMap );
+ }
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+// This method is called for every default style
+void XMLGraphicsDefaultStyle::SetDefaults()
+{
+ Reference< XMultiServiceFactory > xFact( GetImport().GetModel(), UNO_QUERY );
+ if( !xFact.is() )
+ return;
+
+ Reference< XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY );
+ if( !xDefaults.is() )
+ return;
+
+ FillPropertySet( xDefaults );
+}
+
+
diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx
new file mode 100644
index 000000000000..81c962b1be9e
--- /dev/null
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -0,0 +1,723 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLImageMapContext.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+
+#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#endif
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include "xmlerror.hxx"
+#include <xmloff/XMLEventsImportContext.hxx>
+#include "XMLStringBufferImportContext.hxx"
+#include <tools/debug.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::drawing::PointSequenceSequence;
+using ::com::sun::star::document::XEventsSupplier;
+
+
+enum XMLImageMapToken
+{
+ XML_TOK_IMAP_URL,
+ XML_TOK_IMAP_X,
+ XML_TOK_IMAP_Y,
+ XML_TOK_IMAP_CENTER_X,
+ XML_TOK_IMAP_CENTER_Y,
+ XML_TOK_IMAP_WIDTH,
+ XML_TOK_IMAP_HEIGTH,
+ XML_TOK_IMAP_POINTS,
+ XML_TOK_IMAP_VIEWBOX,
+ XML_TOK_IMAP_NOHREF,
+ XML_TOK_IMAP_NAME,
+ XML_TOK_IMAP_RADIUS,
+ XML_TOK_IMAP_TARGET
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aImageMapObjectTokenMap[] =
+{
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_IMAP_URL },
+ { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_IMAP_NAME },
+ { XML_NAMESPACE_DRAW, XML_NOHREF, XML_TOK_IMAP_NOHREF },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_IMAP_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_IMAP_Y },
+ { XML_NAMESPACE_SVG, XML_CX, XML_TOK_IMAP_CENTER_X },
+ { XML_NAMESPACE_SVG, XML_CY, XML_TOK_IMAP_CENTER_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_IMAP_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_IMAP_HEIGTH },
+ { XML_NAMESPACE_SVG, XML_R, XML_TOK_IMAP_RADIUS },
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_IMAP_VIEWBOX },
+ { XML_NAMESPACE_DRAW, XML_POINTS, XML_TOK_IMAP_POINTS },
+ { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, XML_TOK_IMAP_TARGET },
+ XML_TOKEN_MAP_END
+};
+
+
+
+class XMLImageMapObjectContext : public SvXMLImportContext
+{
+
+protected:
+
+ const ::rtl::OUString sBoundary;
+ const ::rtl::OUString sCenter;
+ const ::rtl::OUString sTitle;
+ const ::rtl::OUString sDescription;
+ const ::rtl::OUString sImageMap;
+ const ::rtl::OUString sIsActive;
+ const ::rtl::OUString sName;
+ const ::rtl::OUString sPolygon;
+ const ::rtl::OUString sRadius;
+ const ::rtl::OUString sTarget;
+ const ::rtl::OUString sURL;
+
+ ::rtl::OUString sServiceName;
+
+ Reference<XIndexContainer> xImageMap; /// the image map
+ Reference<XPropertySet> xMapEntry; /// one map-entry (one area)
+
+ ::rtl::OUString sUrl;
+ ::rtl::OUString sTargt;
+ ::rtl::OUStringBuffer sDescriptionBuffer;
+ ::rtl::OUStringBuffer sTitleBuffer;
+ ::rtl::OUString sNam;
+ sal_Bool bIsActive;
+
+ sal_Bool bValid;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapObjectContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap,
+ const sal_Char* pServiceName);
+
+ void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ void EndElement();
+
+ SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+
+protected:
+
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+TYPEINIT1( XMLImageMapObjectContext, SvXMLImportContext );
+
+XMLImageMapObjectContext::XMLImageMapObjectContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap,
+ const sal_Char* pServiceName) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ sBoundary(RTL_CONSTASCII_USTRINGPARAM("Boundary")),
+ sCenter(RTL_CONSTASCII_USTRINGPARAM("Center")),
+ sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
+ sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
+ sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
+ sIsActive(RTL_CONSTASCII_USTRINGPARAM("IsActive")),
+ sName(RTL_CONSTASCII_USTRINGPARAM("Name")),
+ sPolygon(RTL_CONSTASCII_USTRINGPARAM("Polygon")),
+ sRadius(RTL_CONSTASCII_USTRINGPARAM("Radius")),
+ sTarget(RTL_CONSTASCII_USTRINGPARAM("Target")),
+ sURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
+ xImageMap(xMap),
+ bIsActive(sal_True),
+ bValid(sal_False)
+{
+ DBG_ASSERT(NULL != pServiceName,
+ "Please supply the image map object service name");
+
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
+ if( xFactory.is() )
+ {
+ Reference<XInterface> xIfc = xFactory->createInstance(
+ OUString::createFromAscii(pServiceName));
+ DBG_ASSERT(xIfc.is(), "can't create image map object!");
+ if( xIfc.is() )
+ {
+ Reference<XPropertySet> xPropertySet( xIfc, UNO_QUERY );
+
+ xMapEntry = xPropertySet;
+ }
+ // else: can't create service -> ignore
+ }
+ // else: can't even get factory -> ignore
+}
+
+void XMLImageMapObjectContext::StartElement(
+ const Reference<XAttributeList >& xAttrList )
+{
+ SvXMLTokenMap aMap(aImageMapObjectTokenMap);
+
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ OUString sValue = xAttrList->getValueByIndex(nAttr);
+
+ ProcessAttribute(
+ (enum XMLImageMapToken)aMap.Get(nPrefix, sLocalName), sValue);
+ }
+}
+
+void XMLImageMapObjectContext::EndElement()
+{
+ // only create and insert image map object if validity flag is set
+ // (and we actually have an image map)
+ if ( bValid && xImageMap.is() && xMapEntry.is() )
+ {
+ // set values
+ Prepare( xMapEntry );
+
+ // insert into image map
+ Any aAny;
+ aAny <<= xMapEntry;
+ xImageMap->insertByIndex( xImageMap->getCount(), aAny );
+ }
+ // else: not valid -> don't create and insert
+}
+
+SvXMLImportContext* XMLImageMapObjectContext::CreateChildContext(
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
+ {
+ Reference<XEventsSupplier> xEvents( xMapEntry, UNO_QUERY );
+ return new XMLEventsImportContext(
+ GetImport(), nPrefix, rLocalName, xEvents);
+ }
+ else if ( (XML_NAMESPACE_SVG == nPrefix) &&
+ IsXMLToken(rLocalName, XML_TITLE) )
+ {
+ return new XMLStringBufferImportContext(
+ GetImport(), nPrefix, rLocalName, sTitleBuffer);
+ }
+ else if ( (XML_NAMESPACE_SVG == nPrefix) &&
+ IsXMLToken(rLocalName, XML_DESC) )
+ {
+ return new XMLStringBufferImportContext(
+ GetImport(), nPrefix, rLocalName, sDescriptionBuffer);
+ }
+ else
+ return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+}
+
+void XMLImageMapObjectContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_URL:
+ sUrl = GetImport().GetAbsoluteReference(rValue);
+ break;
+
+ case XML_TOK_IMAP_TARGET:
+ sTargt = rValue;
+ break;
+
+ case XML_TOK_IMAP_NOHREF:
+ bIsActive = ! IsXMLToken(rValue, XML_NOHREF);
+ break;
+
+ case XML_TOK_IMAP_NAME:
+ sNam = rValue;
+ break;
+ default:
+ // do nothing
+ break;
+ }
+}
+
+void XMLImageMapObjectContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ rPropertySet->setPropertyValue( sURL, Any( sUrl ) );
+ rPropertySet->setPropertyValue( sTitle, Any( sTitleBuffer.makeStringAndClear() ) );
+ rPropertySet->setPropertyValue( sDescription, Any( sDescriptionBuffer.makeStringAndClear() ) );
+ rPropertySet->setPropertyValue( sTarget, Any( sTargt ) );
+ rPropertySet->setPropertyValue( sIsActive, Any( bIsActive ) );
+ rPropertySet->setPropertyValue( sName, Any( sNam ) );
+}
+
+
+
+class XMLImageMapRectangleContext : public XMLImageMapObjectContext
+{
+ awt::Rectangle aRectangle;
+
+ sal_Bool bXOK;
+ sal_Bool bYOK;
+ sal_Bool bWidthOK;
+ sal_Bool bHeightOK;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapRectangleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap);
+
+ virtual ~XMLImageMapRectangleContext();
+
+protected:
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+
+TYPEINIT1(XMLImageMapRectangleContext, XMLImageMapObjectContext);
+
+XMLImageMapRectangleContext::XMLImageMapRectangleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap) :
+ XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
+ "com.sun.star.image.ImageMapRectangleObject"),
+ bXOK(sal_False),
+ bYOK(sal_False),
+ bWidthOK(sal_False),
+ bHeightOK(sal_False)
+{
+}
+
+XMLImageMapRectangleContext::~XMLImageMapRectangleContext()
+{
+}
+
+void XMLImageMapRectangleContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ sal_Int32 nTmp;
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_X:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.X = nTmp;
+ bXOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_Y:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.Y = nTmp;
+ bYOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_WIDTH:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.Width = nTmp;
+ bWidthOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_HEIGTH:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aRectangle.Height = nTmp;
+ bHeightOK = sal_True;
+ }
+ break;
+ default:
+ XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
+ }
+
+ bValid = bHeightOK && bXOK && bYOK && bWidthOK;
+}
+
+void XMLImageMapRectangleContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ Any aAny;
+ aAny <<= aRectangle;
+ rPropertySet->setPropertyValue( sBoundary, aAny );
+
+ // common properties handled by super class
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
+
+
+class XMLImageMapPolygonContext : public XMLImageMapObjectContext
+{
+ ::rtl::OUString sViewBoxString;
+ ::rtl::OUString sPointsString;
+
+ sal_Bool bViewBoxOK;
+ sal_Bool bPointsOK;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapPolygonContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap);
+
+ virtual ~XMLImageMapPolygonContext();
+
+protected:
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+
+
+TYPEINIT1(XMLImageMapPolygonContext, XMLImageMapObjectContext);
+
+XMLImageMapPolygonContext::XMLImageMapPolygonContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap) :
+ XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
+ "com.sun.star.image.ImageMapPolygonObject"),
+ bViewBoxOK(sal_False),
+ bPointsOK(sal_False)
+{
+}
+
+XMLImageMapPolygonContext::~XMLImageMapPolygonContext()
+{
+}
+
+void XMLImageMapPolygonContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_POINTS:
+ sPointsString = rValue;
+ bPointsOK = sal_True;
+ break;
+ case XML_TOK_IMAP_VIEWBOX:
+ sViewBoxString = rValue;
+ bViewBoxOK = sal_True;
+ break;
+ default:
+ XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
+ break;
+ }
+
+ bValid = bViewBoxOK && bPointsOK;
+}
+
+void XMLImageMapPolygonContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ // process view box
+ SdXMLImExViewBox aViewBox(sViewBoxString,
+ GetImport().GetMM100UnitConverter());
+
+ // get polygon sequence
+ awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
+ awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize,
+ GetImport().GetMM100UnitConverter() );
+ PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
+
+ // only use first element of sequence-sequence
+ if (aPointSeqSeq.getLength() > 0)
+ {
+ Any aAny;
+ aAny <<= aPointSeqSeq[0];
+ rPropertySet->setPropertyValue(sPolygon, aAny);
+ }
+
+ // parent properties
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
+
+
+
+class XMLImageMapCircleContext : public XMLImageMapObjectContext
+{
+ awt::Point aCenter;
+ sal_Int32 nRadius;
+
+ sal_Bool bXOK;
+ sal_Bool bYOK;
+ sal_Bool bRadiusOK;
+
+public:
+ TYPEINFO();
+
+ XMLImageMapCircleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexContainer> xMap);
+
+ virtual ~XMLImageMapCircleContext();
+
+protected:
+ virtual void ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const ::rtl::OUString& rValue);
+
+ virtual void Prepare(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & rPropertySet);
+};
+
+TYPEINIT1(XMLImageMapCircleContext, XMLImageMapObjectContext);
+
+XMLImageMapCircleContext::XMLImageMapCircleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XIndexContainer> xMap) :
+ XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
+ "com.sun.star.image.ImageMapCircleObject"),
+ bXOK(sal_False),
+ bYOK(sal_False),
+ bRadiusOK(sal_False)
+{
+}
+
+XMLImageMapCircleContext::~XMLImageMapCircleContext()
+{
+}
+
+void XMLImageMapCircleContext::ProcessAttribute(
+ enum XMLImageMapToken eToken,
+ const OUString& rValue)
+{
+ sal_Int32 nTmp;
+ switch (eToken)
+ {
+ case XML_TOK_IMAP_CENTER_X:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aCenter.X = nTmp;
+ bXOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_CENTER_Y:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ aCenter.Y = nTmp;
+ bYOK = sal_True;
+ }
+ break;
+ case XML_TOK_IMAP_RADIUS:
+ if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
+ rValue))
+ {
+ nRadius = nTmp;
+ bRadiusOK = sal_True;
+ }
+ break;
+ default:
+ XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
+ }
+
+ bValid = bRadiusOK && bXOK && bYOK;
+}
+
+void XMLImageMapCircleContext::Prepare(
+ Reference<XPropertySet> & rPropertySet)
+{
+ // center (x,y)
+ Any aAny;
+ aAny <<= aCenter;
+ rPropertySet->setPropertyValue( sCenter, aAny );
+
+ // radius
+ aAny <<= nRadius;
+ rPropertySet->setPropertyValue( sRadius, aAny );
+
+ // common properties handled by super class
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
+
+
+
+
+
+
+
+
+
+
+TYPEINIT1(XMLImageMapContext, SvXMLImportContext);
+
+XMLImageMapContext::XMLImageMapContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ Reference<XPropertySet> & rPropertySet) :
+ SvXMLImportContext(rImport, nPrefix, rLocalName),
+ sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
+ xPropertySet(rPropertySet)
+
+{
+ try
+ {
+ Reference < XPropertySetInfo > xInfo =
+ xPropertySet->getPropertySetInfo();
+ if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) )
+ xPropertySet->getPropertyValue(sImageMap) >>= xImageMap;
+ }
+ catch( com::sun::star::uno::Exception e )
+ {
+ uno::Sequence<OUString> aSeq(0);
+ rImport.SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+}
+
+XMLImageMapContext::~XMLImageMapContext()
+{
+}
+
+SvXMLImportContext *XMLImageMapContext::CreateChildContext(
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList> & xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if ( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if ( IsXMLToken(rLocalName, XML_AREA_RECTANGLE) )
+ {
+ pContext = new XMLImageMapRectangleContext(
+ GetImport(), nPrefix, rLocalName, xImageMap);
+ }
+ else if ( IsXMLToken(rLocalName, XML_AREA_POLYGON) )
+ {
+ pContext = new XMLImageMapPolygonContext(
+ GetImport(), nPrefix, rLocalName, xImageMap);
+ }
+ else if ( IsXMLToken(rLocalName, XML_AREA_CIRCLE) )
+ {
+ pContext = new XMLImageMapCircleContext(
+ GetImport(), nPrefix, rLocalName, xImageMap);
+ }
+ }
+ else
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+ return pContext;
+}
+
+void XMLImageMapContext::EndElement()
+{
+ Reference < XPropertySetInfo > xInfo =
+ xPropertySet->getPropertySetInfo();
+ if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) )
+ xPropertySet->setPropertyValue(sImageMap, uno::makeAny( xImageMap ) );
+}
+
diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx
new file mode 100644
index 000000000000..01d14ecab54e
--- /dev/null
+++ b/xmloff/source/draw/XMLImageMapExport.cxx
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLImageMapExport.hxx"
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+
+#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#endif
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <xmloff/xmlexp.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+
+
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::drawing::PointSequence;
+
+
+const sal_Char sAPI_ImageMapRectangleObject[] = "com.sun.star.image.ImageMapRectangleObject";
+const sal_Char sAPI_ImageMapCircleObject[] = "com.sun.star.image.ImageMapCircleObject";
+const sal_Char sAPI_ImageMapPolygonObject[] = "com.sun.star.image.ImageMapPolygonObject";
+
+XMLImageMapExport::XMLImageMapExport(SvXMLExport& rExp) :
+ msBoundary(RTL_CONSTASCII_USTRINGPARAM("Boundary")),
+ msCenter(RTL_CONSTASCII_USTRINGPARAM("Center")),
+ msDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
+ msImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
+ msIsActive(RTL_CONSTASCII_USTRINGPARAM("IsActive")),
+ msName(RTL_CONSTASCII_USTRINGPARAM("Name")),
+ msPolygon(RTL_CONSTASCII_USTRINGPARAM("Polygon")),
+ msRadius(RTL_CONSTASCII_USTRINGPARAM("Radius")),
+ msTarget(RTL_CONSTASCII_USTRINGPARAM("Target")),
+ msURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
+ msTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
+ mrExport(rExp),
+ mbWhiteSpace(sal_True)
+{
+}
+
+XMLImageMapExport::~XMLImageMapExport()
+{
+
+}
+
+void XMLImageMapExport::Export(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ if (rPropertySet->getPropertySetInfo()->hasPropertyByName(msImageMap))
+ {
+ Any aAny = rPropertySet->getPropertyValue(msImageMap);
+ Reference<XIndexContainer> aContainer;
+ aAny >>= aContainer;
+
+ Export(aContainer);
+ }
+ // else: no ImageMap property -> nothing to do
+}
+
+void XMLImageMapExport::Export(
+ const Reference<XIndexContainer> & rContainer)
+{
+ if (rContainer.is())
+ {
+ if (rContainer->hasElements())
+ {
+ // image map container element
+ SvXMLElementExport aImageMapElement(
+ mrExport, XML_NAMESPACE_DRAW, XML_IMAGE_MAP,
+ mbWhiteSpace, mbWhiteSpace);
+
+ // iterate over image map elements and call ExportMapEntry(...)
+ // for each
+ sal_Int32 nLength = rContainer->getCount();
+ for(sal_Int32 i = 0; i < nLength; i++)
+ {
+ Any aAny = rContainer->getByIndex(i);
+ Reference<XPropertySet> rElement;
+ aAny >>= rElement;
+
+ DBG_ASSERT(rElement.is(), "Image map element is empty!");
+ if (rElement.is())
+ {
+ ExportMapEntry(rElement);
+ }
+ }
+ }
+ // else: container is empty -> nothing to do
+ }
+ // else: no container -> nothign to do
+}
+
+
+void XMLImageMapExport::ExportMapEntry(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ Reference<XServiceInfo> xServiceInfo(rPropertySet, UNO_QUERY);
+ if (xServiceInfo.is())
+ {
+ enum XMLTokenEnum eType = XML_TOKEN_INVALID;
+
+ // distinguish map entries by their service name
+ Sequence<OUString> sServiceNames =
+ xServiceInfo->getSupportedServiceNames();
+ sal_Int32 nLength = sServiceNames.getLength();
+ for( sal_Int32 i=0; i<nLength; i++ )
+ {
+ OUString& rName = sServiceNames[i];
+
+ if ( rName.equalsAsciiL(sAPI_ImageMapRectangleObject,
+ sizeof(sAPI_ImageMapRectangleObject)-1) )
+ {
+ eType = XML_AREA_RECTANGLE;
+ break;
+ }
+ else if ( rName.equalsAsciiL(sAPI_ImageMapCircleObject,
+ sizeof(sAPI_ImageMapCircleObject)-1) )
+ {
+ eType = XML_AREA_CIRCLE;
+ break;
+ }
+ else if ( rName.equalsAsciiL(sAPI_ImageMapPolygonObject,
+ sizeof(sAPI_ImageMapPolygonObject)-1))
+ {
+ eType = XML_AREA_POLYGON;
+ break;
+ }
+ }
+
+ // return from method if no proper service is found!
+ DBG_ASSERT(XML_TOKEN_INVALID != eType,
+ "Image map element doesn't support appropriate service!");
+ if (XML_TOKEN_INVALID == eType)
+ return;
+
+ // now: handle ImageMapObject properties (those for all types)
+
+ // XLINK (URL property)
+ Any aAny = rPropertySet->getPropertyValue(msURL);
+ OUString sHref;
+ aAny >>= sHref;
+ if (sHref.getLength() > 0)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(sHref));
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+
+ // Target property (and xlink:show)
+ aAny = rPropertySet->getPropertyValue(msTarget);
+ OUString sTargt;
+ aAny >>= sTargt;
+ if (sTargt.getLength() > 0)
+ {
+ mrExport.AddAttribute(
+ XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, sTargt);
+
+ mrExport.AddAttribute(
+ XML_NAMESPACE_XLINK, XML_SHOW,
+ sTargt.equalsAsciiL( "_blank", sizeof("_blank")-1 )
+ ? XML_NEW : XML_REPLACE );
+ }
+
+ // name
+ aAny = rPropertySet->getPropertyValue(msName);
+ OUString sItemName;
+ aAny >>= sItemName;
+ if (sItemName.getLength() > 0)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, sItemName);
+ }
+
+ // is-active
+ aAny = rPropertySet->getPropertyValue(msIsActive);
+ if (! *(sal_Bool*)aAny.getValue())
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NOHREF, XML_NOHREF);
+ }
+
+ // call specific rectangle/circle/... method
+ // also prepare element name
+ switch (eType)
+ {
+ case XML_AREA_RECTANGLE:
+ ExportRectangle(rPropertySet);
+ break;
+ case XML_AREA_CIRCLE:
+ ExportCircle(rPropertySet);
+ break;
+ case XML_AREA_POLYGON:
+ ExportPolygon(rPropertySet);
+ break;
+ default:
+ break;
+ }
+
+ // write element
+ DBG_ASSERT(XML_TOKEN_INVALID != eType,
+ "No name?! How did this happen?");
+ SvXMLElementExport aAreaElement(mrExport, XML_NAMESPACE_DRAW, eType,
+ mbWhiteSpace, mbWhiteSpace);
+
+ // title property (as <svg:title> element)
+ OUString sTitle;
+ rPropertySet->getPropertyValue(msTitle) >>= sTitle;
+ if(sTitle.getLength())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, mbWhiteSpace, sal_False);
+ mrExport.Characters(sTitle);
+ }
+
+ // description property (as <svg:desc> element)
+ OUString sDescription;
+ rPropertySet->getPropertyValue(msDescription) >>= sDescription;
+ if (sDescription.getLength() > 0)
+ {
+ SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, mbWhiteSpace, sal_False);
+ mrExport.Characters(sDescription);
+ }
+
+ // export events attached to this
+ Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
+ mrExport.GetEventExport().Export(xSupplier, mbWhiteSpace);
+ }
+ // else: no service info -> can't determine type -> ignore entry
+}
+
+void XMLImageMapExport::ExportRectangle(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // get boundary rectangle
+ Any aAny = rPropertySet->getPropertyValue(msBoundary);
+ awt::Rectangle aRectangle;
+ aAny >>= aRectangle;
+
+ // parameters svg:x, svg:y, svg:width, svg:height
+ OUStringBuffer aBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.X);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Width);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Height);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
+ aBuffer.makeStringAndClear() );
+}
+
+void XMLImageMapExport::ExportCircle(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // get boundary rectangle
+ Any aAny = rPropertySet->getPropertyValue(msCenter);
+ awt::Point aCenter;
+ aAny >>= aCenter;
+
+ // parameters svg:cx, svg:cy
+ OUStringBuffer aBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.X);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CX,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CY,
+ aBuffer.makeStringAndClear() );
+
+ // radius
+ aAny = rPropertySet->getPropertyValue(msRadius);
+ sal_Int32 nRadius = 0;
+ aAny >>= nRadius;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nRadius);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_R,
+ aBuffer.makeStringAndClear() );
+}
+
+void XMLImageMapExport::ExportPolygon(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // polygons get exported as bounding box, viewbox, and coordinate
+ // pair sequence. The bounding box is always the entire image.
+
+ // get polygon point sequence
+ Any aAny = rPropertySet->getPropertyValue(msPolygon);
+ PointSequence aPoly;
+ aAny >>= aPoly;
+
+ // get bounding box (assume top-left to be 0,0)
+ sal_Int32 nWidth = 0;
+ sal_Int32 nHeight = 0;
+ sal_Int32 nLength = aPoly.getLength();
+ const struct awt::Point* pPointPtr = aPoly.getConstArray();
+ for ( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ sal_Int32 nPolyX = pPointPtr->X;
+ sal_Int32 nPolyY = pPointPtr->Y;
+
+ if ( nPolyX > nWidth )
+ nWidth = nPolyX;
+ if ( nPolyY > nHeight )
+ nHeight = nPolyY;
+
+ pPointPtr++;
+ }
+ DBG_ASSERT(nWidth > 0, "impossible Polygon found");
+ DBG_ASSERT(nHeight > 0, "impossible Polygon found");
+
+ // parameters svg:x, svg:y, svg:width, svg:height
+ OUStringBuffer aBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nWidth);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
+ aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nHeight);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
+ aBuffer.makeStringAndClear() );
+
+ // svg:viewbox
+ SdXMLImExViewBox aViewBox(0, 0, nWidth, nHeight);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
+ aViewBox.GetExportString());
+
+ // export point sequence
+ awt::Point aPoint(0, 0);
+ awt::Size aSize(nWidth, nHeight);
+ SdXMLImExPointsElement aPoints( &aPoly, aViewBox, aPoint, aSize );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS,
+ aPoints.GetExportString());
+}
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
new file mode 100644
index 000000000000..dcd26e616e6f
--- /dev/null
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -0,0 +1,743 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <XMLNumberStylesExport.hxx>
+#include <XMLNumberStylesImport.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include "sdxmlexp_impl.hxx"
+#include "sdxmlimp_impl.hxx"
+
+using namespace rtl;
+using namespace ::xmloff::token;
+
+struct SdXMLDataStyleNumber
+{
+ enum XMLTokenEnum meNumberStyle;
+ sal_Bool mbLong;
+ sal_Bool mbTextual;
+ sal_Bool mbDecimal02;
+ const char* mpText;
+}
+ aSdXMLDataStyleNumbers[] =
+{
+ { XML_DAY, sal_False, sal_False, sal_False, NULL },
+ { XML_DAY, sal_True, sal_False, sal_False, NULL },
+ { XML_MONTH, sal_True, sal_False, sal_False, NULL },
+ { XML_MONTH, sal_False, sal_True, sal_False, NULL },
+ { XML_MONTH, sal_True, sal_True, sal_False, NULL },
+ { XML_YEAR, sal_False, sal_False, sal_False, NULL },
+ { XML_YEAR, sal_True, sal_False, sal_False, NULL },
+ { XML_DAY_OF_WEEK, sal_False, sal_False, sal_False, NULL },
+ { XML_DAY_OF_WEEK, sal_True, sal_False, sal_False, NULL },
+ { XML_TEXT, sal_False, sal_False, sal_False, "." },
+ { XML_TEXT, sal_False, sal_False, sal_False, " " },
+ { XML_TEXT, sal_False, sal_False, sal_False, ", " },
+ { XML_TEXT, sal_False, sal_False, sal_False, ". " },
+ { XML_HOURS, sal_False, sal_False, sal_False, NULL },
+ { XML_MINUTES, sal_False, sal_False, sal_False, NULL },
+ { XML_TEXT, sal_False, sal_False, sal_False, ":" },
+ { XML_AM_PM, sal_False, sal_False, sal_False, NULL },
+ { XML_SECONDS, sal_False, sal_False, sal_False, NULL },
+ { XML_SECONDS, sal_False, sal_False, sal_True, NULL },
+ { XML_TOKEN_INVALID, 0, 0, 0, NULL }
+};
+
+// date
+
+#define DATA_STYLE_NUMBER_END 0
+#define DATA_STYLE_NUMBER_DAY 1 // <number:day/>
+#define DATA_STYLE_NUMBER_DAY_LONG 2 // <number:day number:style="long"/>
+#define DATA_STYLE_NUMBER_MONTH_LONG 3 // <number:month number:style="long"/>
+#define DATA_STYLE_NUMBER_MONTH_TEXT 4 // <number:month number:textual="true"/>
+#define DATA_STYLE_NUMBER_MONTH_LONG_TEXT 5 // <number:month number:style="long" number:textual="true"/>
+#define DATA_STYLE_NUMBER_YEAR 6 // <number:year/>
+#define DATA_STYLE_NUMBER_YEAR_LONG 7 // <number:year number:style="long"/>
+#define DATA_STYLE_NUMBER_DAYOFWEEK 8 // <number:day-of-week/>
+#define DATA_STYLE_NUMBER_DAYOFWEEK_LONG 9 // <number:day-of-week number:style="long"/>
+#define DATA_STYLE_NUMBER_TEXT_POINT 10 // <number:text>.</number:text>
+#define DATA_STYLE_NUMBER_TEXT_SPACE 11 // <number:text> </number:text>
+#define DATA_STYLE_NUMBER_TEXT_COMMASPACE 12 // <number:text>, </number:text>
+#define DATA_STYLE_NUMBER_TEXT_POINTSPACE 13 // <number:text>. </number:text>
+#define DATA_STYLE_NUMBER_HOURS 14 // <number:hours/>
+#define DATA_STYLE_NUMBER_MINUTES 15 // <number:minutes/>
+#define DATA_STYLE_NUMBER_TEXT_COLON 16 // <number:text>:</number:text>
+#define DATA_STYLE_NUMBER_AMPM 17 // <number:am-pm/>
+#define DATA_STYLE_NUMBER_SECONDS 18 // <number:seconds/>
+#define DATA_STYLE_NUMBER_SECONDS_02 19 // <number:seconds number:/>
+
+
+struct SdXMLFixedDataStyle
+{
+ const char* mpName;
+ sal_Bool mbAutomatic;
+ sal_Bool mbDateStyle;
+ sal_uInt8 mpFormat[8];
+};
+
+const SdXMLFixedDataStyle aSdXML_Standard_Short =
+{
+ "D1", sal_True, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_MONTH_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_Standard_Long =
+{
+ "D2", sal_True, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAYOFWEEK_LONG,
+ DATA_STYLE_NUMBER_TEXT_COMMASPACE,
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_1 =
+{
+ "D3", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_MONTH_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_YEAR,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_2 =
+{
+ "D4", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_MONTH_LONG,
+ DATA_STYLE_NUMBER_TEXT_POINT,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_3 =
+{
+ "D5", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_4 =
+{
+ "D6", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_5 =
+{
+ "D7", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAYOFWEEK,
+ DATA_STYLE_NUMBER_TEXT_COMMASPACE,
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_DateStyle_6 =
+{
+ "D8", sal_False, sal_True,
+ {
+ DATA_STYLE_NUMBER_DAYOFWEEK_LONG,
+ DATA_STYLE_NUMBER_TEXT_COMMASPACE,
+ DATA_STYLE_NUMBER_DAY,
+ DATA_STYLE_NUMBER_TEXT_POINTSPACE,
+ DATA_STYLE_NUMBER_MONTH_LONG_TEXT,
+ DATA_STYLE_NUMBER_TEXT_SPACE,
+ DATA_STYLE_NUMBER_YEAR_LONG,
+ 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_1 =
+{ "T1", sal_True, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0,
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_2 =
+{ "T2", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ 0, 0, 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_3 =
+{ "T3", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_4 =
+{ "T4", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS_02,
+ 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_5 =
+{ "T5", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0, 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_6 =
+{ "T6", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle aSdXML_TimeStyle_7 =
+{ "T7", sal_False, sal_False,
+ {
+ DATA_STYLE_NUMBER_HOURS,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_MINUTES,
+ DATA_STYLE_NUMBER_TEXT_COLON,
+ DATA_STYLE_NUMBER_SECONDS_02,
+ DATA_STYLE_NUMBER_AMPM,
+ 0, 0
+ }
+};
+
+const SdXMLFixedDataStyle* aSdXMLFixedDateFormats[SdXMLDateFormatCount] =
+{
+ &aSdXML_Standard_Short,
+ &aSdXML_Standard_Long,
+ &aSdXML_DateStyle_1,
+ &aSdXML_DateStyle_2,
+ &aSdXML_DateStyle_3,
+ &aSdXML_DateStyle_4,
+ &aSdXML_DateStyle_5,
+ &aSdXML_DateStyle_6,
+};
+
+const SdXMLFixedDataStyle* aSdXMLFixedTimeFormats[SdXMLTimeFormatCount] =
+{
+ &aSdXML_TimeStyle_1,
+ &aSdXML_TimeStyle_2,
+ &aSdXML_TimeStyle_3,
+ &aSdXML_TimeStyle_4,
+ &aSdXML_TimeStyle_5,
+ &aSdXML_TimeStyle_6,
+ &aSdXML_TimeStyle_7
+};
+
+
+///////////////////////////////////////////////////////////////////////
+// export
+
+#ifndef SVX_LIGHT
+
+static void SdXMLExportDataStyleNumber( SdXMLExport& rExport, SdXMLDataStyleNumber& rElement )
+{
+ if( rElement.mbDecimal02 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES, XML_2 );
+ }
+
+ if( rElement.mbLong )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_STYLE, XML_LONG );
+ }
+
+ if( rElement.mbTextual )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TEXTUAL, XML_TRUE );
+ }
+
+ SvXMLElementExport aNumberStyle( rExport, XML_NAMESPACE_NUMBER, rElement.meNumberStyle, sal_True, sal_False );
+ if( rElement.mpText )
+ {
+ OUString sAttrValue( OUString::createFromAscii( rElement.mpText ) );
+ rExport.GetDocHandler()->characters( sAttrValue );
+ }
+}
+
+static void SdXMLExportStyle( SdXMLExport& rExport, const SdXMLFixedDataStyle* pStyle, const SdXMLFixedDataStyle* pStyle2 = NULL )
+{
+ OUString sAttrValue;
+
+ // name
+ sAttrValue = OUString::createFromAscii( pStyle->mpName );
+ if( pStyle2 )
+ sAttrValue += OUString::createFromAscii( pStyle2->mpName );
+
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, sAttrValue );
+
+ if( pStyle->mbAutomatic )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_AUTOMATIC_ORDER, XML_TRUE );
+ }
+
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_NUMBER, pStyle->mbDateStyle ? XML_DATE_STYLE : XML_TIME_STYLE, sal_True, sal_True );
+
+ do
+ {
+
+ const sal_uInt8* pElements = (const sal_uInt8*)&pStyle->mpFormat[0];
+
+ while( *pElements )
+ {
+ SdXMLDataStyleNumber& rElement = aSdXMLDataStyleNumbers[ (*pElements++) - 1 ];
+ SdXMLExportDataStyleNumber( rExport, rElement );
+ }
+
+ if( pStyle2 )
+ {
+ SdXMLDataStyleNumber& rElement = aSdXMLDataStyleNumbers[ DATA_STYLE_NUMBER_TEXT_SPACE - 1 ];
+ SdXMLExportDataStyleNumber( rExport, rElement );
+ }
+
+ pStyle = pStyle2;
+ pStyle2 = NULL;
+ }
+ while( pStyle );
+}
+
+void SdXMLNumberStylesExporter::exportTimeStyle( SdXMLExport& rExport, sal_Int32 nStyle )
+{
+ DBG_ASSERT( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount), "Unknown time style!" );
+ if( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount) )
+ SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nStyle ] );
+}
+
+void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport& rExport, sal_Int32 nStyle )
+{
+ if( nStyle > 0x0f )
+ {
+ int nDateStyle = nStyle & 0x0f;
+ bool bHasDate = nDateStyle != 0;
+
+ if( nDateStyle > 1 )
+ nDateStyle -= 2;
+
+ DBG_ASSERT( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount), "unknown date style!" );
+
+ int nTimeStyle = (nStyle >> 4) & 0x0f;
+ bool bHasTime = nTimeStyle != 0;
+
+ if( nTimeStyle > 1 )
+ nTimeStyle -= 2;
+
+ DBG_ASSERT( (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount), "Unknown time style!" );
+
+ if( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount) && (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount) )
+ {
+ if( bHasDate )
+ {
+ if( bHasTime )
+ {
+ SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ], aSdXMLFixedTimeFormats[ nTimeStyle ] );
+ }
+ else
+ {
+ SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ] );
+ }
+ }
+ else if( bHasTime )
+ {
+ SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nTimeStyle ] );
+ }
+ }
+ }
+ else
+ {
+ DBG_ASSERT( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount), "unknown date style!" );
+ if( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount) )
+ SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nStyle ] );
+ }
+}
+
+OUString SdXMLNumberStylesExporter::getTimeStyleName(const sal_Int32 nTimeFormat )
+{
+ sal_Int32 nFormat = nTimeFormat;
+ if( nFormat > 1 )
+ nFormat -= 2;
+
+ if( (nFormat >= 0) && (nFormat < SdXMLTimeFormatCount) )
+ {
+ return OUString::createFromAscii(aSdXMLFixedTimeFormats[nFormat]->mpName );
+ }
+ else
+ {
+ return OUString();
+ }
+}
+
+OUString SdXMLNumberStylesExporter::getDateStyleName(const sal_Int32 nDateFormat )
+{
+ sal_Int32 nFormat = nDateFormat;
+
+ if( nFormat > 0x0f )
+ {
+ OUString aStr;
+ if( nFormat & 0x0f )
+ aStr = getDateStyleName( nFormat & 0x0f );
+ aStr += getTimeStyleName( (nFormat >> 4) & 0x0f );
+ return aStr;
+ }
+
+ if( nFormat > 1 )
+ nFormat -= 2;
+
+ if( (nFormat >= 0) && (nFormat < SdXMLDateFormatCount) )
+ {
+ return OUString::createFromAscii(aSdXMLFixedDateFormats[nFormat]->mpName );
+ }
+ else
+ {
+ return OUString();
+ }
+}
+
+#endif // #ifndef SVX_LIGHT
+
+
+///////////////////////////////////////////////////////////////////////
+// import
+
+class SdXMLNumberFormatMemberImportContext : public SvXMLImportContext
+{
+private:
+ SdXMLNumberFormatImportContext* mpParent;
+
+ OUString maNumberStyle;
+ sal_Bool mbLong;
+ sal_Bool mbTextual;
+ sal_Bool mbDecimal02;
+ OUString maText;
+ SvXMLImportContext* mpSlaveContext;
+
+public:
+ TYPEINFO();
+
+ SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ SdXMLNumberFormatImportContext* pParent,
+ SvXMLImportContext* pSlaveContext );
+ virtual ~SdXMLNumberFormatMemberImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( SdXMLNumberFormatMemberImportContext, SvXMLImportContext );
+
+SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, SdXMLNumberFormatImportContext* pParent, SvXMLImportContext* pSlaveContext )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpParent( pParent ),
+ maNumberStyle( rLocalName ),
+ mpSlaveContext( pSlaveContext )
+{
+ mbLong = sal_False;
+ mbTextual = sal_False;
+ mbDecimal02 = sal_False;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ if( nPrefix == XML_NAMESPACE_NUMBER )
+ {
+ if( IsXMLToken( aLocalName, XML_DECIMAL_PLACES ) )
+ {
+ mbDecimal02 = IsXMLToken( sValue, XML_2 );
+ }
+ else if( IsXMLToken( aLocalName, XML_STYLE ) )
+ {
+ mbLong = IsXMLToken( sValue, XML_LONG );
+ }
+ else if( IsXMLToken( aLocalName, XML_TEXTUAL ) )
+ {
+ mbTextual = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+
+}
+
+SdXMLNumberFormatMemberImportContext::~SdXMLNumberFormatMemberImportContext()
+{
+}
+
+SvXMLImportContext *SdXMLNumberFormatMemberImportContext::CreateChildContext( USHORT nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ return mpSlaveContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+}
+
+void SdXMLNumberFormatMemberImportContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ mpSlaveContext->StartElement( xAttrList );
+}
+
+void SdXMLNumberFormatMemberImportContext::EndElement()
+{
+ mpSlaveContext->EndElement();
+
+ if( mpParent )
+ mpParent->add( maNumberStyle, mbLong, mbTextual, mbDecimal02, maText );
+}
+
+void SdXMLNumberFormatMemberImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ mpSlaveContext->Characters( rChars );
+ maText += rChars;
+}
+
+TYPEINIT1( SdXMLNumberFormatImportContext, SvXMLImportContext );
+
+
+SdXMLNumberFormatImportContext::SdXMLNumberFormatImportContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, SvXMLNumImpData* pNewData, sal_uInt16 nNewType, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, SvXMLStylesContext& rStyles)
+: SvXMLNumFormatContext(rImport, nPrfx, rLocalName, pNewData, nNewType, xAttrList, rStyles),
+ mrImport( rImport ),
+ mbAutomatic( sal_False ),
+ mnIndex(0),
+ mnKey( -1 )
+{
+ mbTimeStyle = IsXMLToken( rLocalName, XML_TIME_STYLE );
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ if( nPrefix == XML_NAMESPACE_NUMBER )
+ {
+ if( IsXMLToken( aLocalName, XML_AUTOMATIC_ORDER ) )
+ {
+ mbAutomatic = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+}
+
+SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext()
+{
+}
+
+void SdXMLNumberFormatImportContext::add( OUString& rNumberStyle, sal_Bool bLong, sal_Bool bTextual, sal_Bool bDecimal02, OUString& rText )
+{
+ if( mnIndex == -1 || mnIndex == 16 )
+ {
+ mnIndex = -1;
+ return;
+ }
+
+ const SdXMLDataStyleNumber* pStyleMember = aSdXMLDataStyleNumbers;
+ for( sal_uInt8 nIndex = 0; pStyleMember->meNumberStyle != XML_TOKEN_INVALID; nIndex++, pStyleMember++ )
+ {
+ if( (IsXMLToken(rNumberStyle, pStyleMember->meNumberStyle) &&
+ (pStyleMember->mbLong == bLong) &&
+ (pStyleMember->mbTextual == bTextual) &&
+ (pStyleMember->mbDecimal02 == bDecimal02) &&
+ ( ( (pStyleMember->mpText == NULL) && (rText.getLength() == 0) ) ||
+ ( pStyleMember->mpText && (rText.compareToAscii( pStyleMember->mpText ) == 0 )) ) ) )
+ {
+ mnElements[mnIndex++] = nIndex + 1;
+ return;
+ }
+ }
+}
+
+bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const
+{
+ if( (pStyle->mbAutomatic != mbAutomatic) && (nIndex == 0))
+ return sal_False;
+
+ sal_Int16 nCompareIndex;
+ for( nCompareIndex = 0; nCompareIndex < 8; nIndex++, nCompareIndex++ )
+ {
+ if( pStyle->mpFormat[nCompareIndex] != mnElements[nIndex] )
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+void SdXMLNumberFormatImportContext::EndElement()
+{
+ SvXMLNumFormatContext::EndElement();
+
+ for( ; mnIndex < 16; mnIndex++ )
+ {
+ mnElements[mnIndex] = 0;
+ }
+
+ if( mbTimeStyle )
+ {
+ // compare import with all time styles
+ for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ )
+ {
+ sal_Int16 nIndex = 0;
+ if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) )
+ {
+ mnKey = nFormat + 2;
+ break;
+ }
+ }
+ }
+ else
+ {
+ // compare import with all date styles
+ for( sal_Int16 nFormat = 0; nFormat < SdXMLDateFormatCount; nFormat++ )
+ {
+ sal_Int16 nIndex = 0;
+ if( compareStyle( aSdXMLFixedDateFormats[nFormat], nIndex ) )
+ {
+ mnKey = nFormat + 2;
+ break;
+ }
+ else if( mnElements[nIndex] == DATA_STYLE_NUMBER_TEXT_SPACE )
+ {
+ // if its a valid date ending with a space, see if a time style follows
+ for( sal_Int16 nTimeFormat = 0; nTimeFormat < SdXMLTimeFormatCount; nTimeFormat++ )
+ {
+ sal_Int16 nIndex2 = nIndex + 1;
+ if( compareStyle( aSdXMLFixedTimeFormats[nTimeFormat], nIndex2 ) )
+ {
+ mnKey = (nFormat + 2) | ((nTimeFormat + 2) << 4);
+ break;
+ }
+ }
+ }
+ }
+
+ // no date style found? maybe its an extended time style
+ if( mnKey == -1 )
+ {
+ // compare import with all time styles
+ for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ )
+ {
+ sal_Int16 nIndex = 0;
+ if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) )
+ {
+ mnKey = (nFormat + 2) << 4;
+ break;
+ }
+ }
+ }
+ }
+}
+
+SvXMLImportContext * SdXMLNumberFormatImportContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new SdXMLNumberFormatMemberImportContext( GetImport(), nPrefix, rLocalName, xAttrList, this, SvXMLNumFormatContext::CreateChildContext( nPrefix, rLocalName, xAttrList ) );
+}
diff --git a/xmloff/source/draw/XMLNumberStylesExport.hxx b/xmloff/source/draw/XMLNumberStylesExport.hxx
new file mode 100644
index 000000000000..08f425aa566a
--- /dev/null
+++ b/xmloff/source/draw/XMLNumberStylesExport.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_NUMBERSTYLESEXPORT_HXX
+#define _XMLOFF_NUMBERSTYLESEXPORT_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+class SdXMLExport;
+
+const sal_Int16 SdXMLDateFormatCount = 8;
+const sal_Int16 SdXMLTimeFormatCount = 7;
+
+class SdXMLNumberStylesExporter
+{
+public:
+ static void exportTimeStyle( SdXMLExport& rExport, sal_Int32 nStyle );
+ static void exportDateStyle( SdXMLExport& rExport, sal_Int32 nStyle );
+
+ static sal_Int32 getDateStyleCount() { return SdXMLDateFormatCount; }
+ static sal_Int32 getTimeStyleCount() { return SdXMLTimeFormatCount; }
+
+ static rtl::OUString getTimeStyleName(const sal_Int32 nTimeFormat );
+ static rtl::OUString getDateStyleName(const sal_Int32 nDateFormat );
+};
+
+#endif // _XMLOFF_NUMBERSTYLESEXPORT_HXX
+
diff --git a/xmloff/source/draw/XMLReplacementImageContext.cxx b/xmloff/source/draw/XMLReplacementImageContext.cxx
new file mode 100644
index 000000000000..4eb607e0403b
--- /dev/null
+++ b/xmloff/source/draw/XMLReplacementImageContext.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include "XMLReplacementImageContext.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::makeAny;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::beans;
+
+TYPEINIT1( XMLReplacementImageContext, SvXMLImportContext );
+
+XMLReplacementImageContext::XMLReplacementImageContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & rAttrList,
+ const Reference< XPropertySet > & rPropSet ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ m_xPropSet( rPropSet ),
+ m_sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))
+{
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ const SvXMLTokenMap& rTokenMap =
+ xTxtImport->GetTextFrameAttrTokenMap();
+
+ sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = rAttrList->getNameByIndex( i );
+ const OUString& rValue = rAttrList->getValueByIndex( i );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_FRAME_HREF:
+ m_sHRef = rValue;
+ break;
+ }
+ }
+}
+
+XMLReplacementImageContext::~XMLReplacementImageContext()
+{
+}
+
+void XMLReplacementImageContext::EndElement()
+{
+ OSL_ENSURE( m_sHRef.getLength() > 0 || m_xBase64Stream.is(),
+ "neither URL nor base64 image data given" );
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ OUString sHRef;
+ if( m_sHRef.getLength() )
+ {
+ sal_Bool bForceLoad = xTxtImport->IsInsertMode() ||
+ xTxtImport->IsBlockMode() ||
+ xTxtImport->IsStylesOnlyMode() ||
+ xTxtImport->IsOrganizerMode();
+ sHRef = GetImport().ResolveGraphicObjectURL( m_sHRef, !bForceLoad );
+ }
+ else if( m_xBase64Stream.is() )
+ {
+ sHRef = GetImport().ResolveGraphicObjectURLFromBase64( m_xBase64Stream );
+ m_xBase64Stream = 0;
+ }
+
+ Reference < XPropertySetInfo > xPropSetInfo =
+ m_xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( m_sGraphicURL ) )
+ m_xPropSet->setPropertyValue( m_sGraphicURL, makeAny( sHRef ) );
+}
+
+SvXMLImportContext *XMLReplacementImageContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ IsXMLToken( rLocalName, ::xmloff::token::XML_BINARY_DATA ) &&
+ !m_xBase64Stream.is() )
+ {
+ m_xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( m_xBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ m_xBase64Stream );
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+
diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx
new file mode 100644
index 000000000000..e1c94dcf5cc7
--- /dev/null
+++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#ifndef _XMLOFF_XMLSHAPEPROPERTYSETCONTEXT_HXX_
+#include "XMLShapePropertySetContext.hxx"
+#endif
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include "xmltabi.hxx"
+#include <xmloff/txtprmap.hxx>
+
+#include "sdpropls.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLShapePropertySetContext, SvXMLPropertySetContext );
+
+XMLShapePropertySetContext::XMLShapePropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_uInt32 nFam,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
+ rProps, rMap ),
+ mnBulletIndex(-1)
+{
+}
+
+XMLShapePropertySetContext::~XMLShapePropertySetContext()
+{
+}
+
+void XMLShapePropertySetContext::EndElement()
+{
+ Reference< container::XIndexReplace > xNumRule;
+ if( mxBulletStyle.Is() )
+ {
+ SvxXMLListStyleContext* pBulletStyle = (SvxXMLListStyleContext*)&mxBulletStyle;
+ xNumRule = pBulletStyle->CreateNumRule( GetImport().GetModel() );
+ if( xNumRule.is() )
+ pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
+ }
+
+ Any aAny;
+ aAny <<= xNumRule;
+
+ XMLPropertyState aPropState( mnBulletIndex, aAny );
+ mrProperties.push_back( aPropState );
+
+ SvXMLPropertySetContext::EndElement();
+}
+
+SvXMLImportContext *XMLShapePropertySetContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_NUMBERINGRULES:
+ mnBulletIndex = rProp.mnIndex;
+ mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ case CTF_TABSTOP:
+ pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
+ rLocalName, rProp,
+ rProperties );
+ break;
+ }
+
+ if( !pContext )
+ pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList,
+ rProperties, rProp );
+
+ return pContext;
+}
diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx
new file mode 100644
index 000000000000..15211495f18d
--- /dev/null
+++ b/xmloff/source/draw/XMLShapeStyleContext.cxx
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include "XMLShapePropertySetContext.hxx"
+#include <xmloff/contextid.hxx>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+#include <xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmlerror.hxx"
+#include <xmloff/maptype.hxx>
+
+#include "sdpropls.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using ::xmloff::token::IsXMLToken;
+using ::xmloff::token::XML_TEXT_PROPERTIES;
+using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
+using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLShapeStyleContext, XMLPropStyleContext );
+
+XMLShapeStyleContext::XMLShapeStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily)
+: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ),
+ m_bIsNumRuleAlreadyConverted( sal_False )
+{
+}
+
+XMLShapeStyleContext::~XMLShapeStyleContext()
+{
+}
+
+void XMLShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if ((0 == m_sControlDataStyleName.getLength()) && (::xmloff::token::GetXMLToken(::xmloff::token::XML_DATA_STYLE_NAME) == rLocalName))
+ {
+ m_sControlDataStyleName = rValue;
+ }
+ else if( (XML_NAMESPACE_STYLE == nPrefixKey) && IsXMLToken( rLocalName, ::xmloff::token::XML_LIST_STYLE_NAME ) )
+ {
+ m_sListStyleName = rValue;
+ }
+ else
+ {
+ XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+
+ if( (XML_NAMESPACE_STYLE == nPrefixKey) &&
+ ( IsXMLToken( rLocalName, ::xmloff::token::XML_NAME ) || IsXMLToken( rLocalName, ::xmloff::token::XML_DISPLAY_NAME ) ) )
+ {
+ if( GetName().getLength() && GetDisplayName().getLength() && GetName() != GetDisplayName() )
+ {
+ const_cast< SvXMLImport&>( GetImport() ).
+ AddStyleDisplayName( GetFamily(), GetName(), GetDisplayName() );
+ }
+ }
+ }
+}
+
+SvXMLImportContext *XMLShapeStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix )
+ {
+ sal_uInt32 nFamily = 0;
+ if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_TEXT;
+ else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_PARAGRAPH;
+ else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
+ nFamily = XML_TYPE_PROP_GRAPHIC;
+ if( nFamily )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new XMLShapePropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ nFamily,
+ GetProperties(),
+ xImpPrMap );
+ }
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet > & rPropSet )
+{
+ if( !m_bIsNumRuleAlreadyConverted )
+ {
+ m_bIsNumRuleAlreadyConverted = sal_True;
+
+ // for compatibility to beta files, search for CTF_SD_NUMBERINGRULES_NAME to
+ // import numbering rules from the style:properties element
+ const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
+
+ ::std::vector< XMLPropertyState > &rProperties = GetProperties();
+ ::std::vector< XMLPropertyState >::iterator end( rProperties.end() );
+ ::std::vector< XMLPropertyState >::iterator property;
+
+ // first, look for the old format, where we had a text:list-style-name
+ // attribute in the style:properties element
+ for( property = rProperties.begin(); property != end; property++ )
+ {
+ // find properties with context
+ if( (property->mnIndex != -1) && (rMapper->GetEntryContextId( property->mnIndex ) == CTF_SD_NUMBERINGRULES_NAME) )
+ break;
+ }
+
+ // if we did not find an old list-style-name in the properties, and we need one
+ // because we got a style:list-style attribute in the style-style element
+ // we generate one
+ if( (property == end) && ( 0 != m_sListStyleName.getLength() ) )
+ {
+ sal_Int32 nIndex = rMapper->FindEntryIndex( CTF_SD_NUMBERINGRULES_NAME );
+ DBG_ASSERT( -1 != nIndex, "can't find numbering rules property entry, can't set numbering rule!" );
+
+ XMLPropertyState aNewState( nIndex );
+ rProperties.push_back( aNewState );
+ end = rProperties.end();
+ property = end - 1;
+ }
+
+ // so, if we have an old or a new list style name, we set its value to
+ // a numbering rule
+ if( property != end )
+ {
+ if( 0 == m_sListStyleName.getLength() )
+ {
+ property->maValue >>= m_sListStyleName;
+ }
+
+ const SvxXMLListStyleContext *pListStyle = GetImport().GetTextImport()->FindAutoListStyle( m_sListStyleName );
+
+ DBG_ASSERT( pListStyle, "list-style not found for shape style" );
+ if( pListStyle )
+ {
+ uno::Reference< container::XIndexReplace > xNumRule( pListStyle->CreateNumRule( GetImport().GetModel() ) );
+ pListStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
+ property->maValue <<= xNumRule;
+ }
+ else
+ {
+ property->mnIndex = -1;
+ }
+ }
+ }
+
+ struct _ContextID_Index_Pair aContextIDs[] =
+ {
+ { CTF_DASHNAME , -1 },
+ { CTF_LINESTARTNAME , -1 },
+ { CTF_LINEENDNAME , -1 },
+ { CTF_FILLGRADIENTNAME, -1 },
+ { CTF_FILLTRANSNAME , -1 },
+ { CTF_FILLHATCHNAME , -1 },
+ { CTF_FILLBITMAPNAME , -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_LEFT, -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_TOP, -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH, -1 },
+ { CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT, -1 },
+ { -1, -1 }
+ };
+ static sal_uInt16 aFamilies[] =
+ {
+ XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_HATCH_ID,
+ XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
+ };
+
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+
+ Reference< XPropertySetInfo > xInfo;
+ // get property set mapper
+ UniReference<XMLPropertySetMapper> xPropMapper( xImpPrMap->getPropertySetMapper() );
+
+ for( sal_uInt16 i=0; aContextIDs[i].nContextID != -1; i++ )
+ {
+ sal_Int32 nIndex = aContextIDs[i].nIndex;
+ if( nIndex != -1 ) switch( aContextIDs[i].nContextID )
+ {
+ case CTF_DASHNAME:
+ case CTF_LINESTARTNAME:
+ case CTF_LINEENDNAME:
+ case CTF_FILLGRADIENTNAME:
+ case CTF_FILLTRANSNAME:
+ case CTF_FILLHATCHNAME:
+ case CTF_FILLBITMAPNAME:
+ {
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ OUString sStyleName;
+ rState.maValue >>= sStyleName;
+ sStyleName = GetImport().GetStyleDisplayName( aFamilies[i], sStyleName );
+ try
+ {
+
+ // set property
+ const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex);
+ if( !xInfo.is() )
+ xInfo = rPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
+ }
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& e )
+ {
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = sStyleName;
+ GetImport().SetError(
+ XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
+ aSeq, e.Message, NULL );
+ }
+ break;
+ }
+ case CTF_SD_OLE_VIS_AREA_IMPORT_LEFT:
+ case CTF_SD_OLE_VIS_AREA_IMPORT_TOP:
+ case CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH:
+ case CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT:
+ {
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex);
+ try
+ {
+ if( !xInfo.is() )
+ xInfo = rPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, rState.maValue );
+ }
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& e )
+ {
+ Sequence<OUString> aSeq;
+ GetImport().SetError(
+ XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
+ aSeq, e.Message, NULL );
+ }
+ break;
+ }
+ }
+ }
+
+ if (m_sControlDataStyleName.getLength())
+ { // we had a data-style-name attribute
+
+ // set the formatting on the control model of the control shape
+ uno::Reference< drawing::XControlShape > xControlShape(rPropSet, uno::UNO_QUERY);
+ DBG_ASSERT(xControlShape.is(), "XMLShapeStyleContext::FillPropertySet: data style for a non-control shape!");
+ if (xControlShape.is())
+ {
+ uno::Reference< beans::XPropertySet > xControlModel(xControlShape->getControl(), uno::UNO_QUERY);
+ DBG_ASSERT(xControlModel.is(), "XMLShapeStyleContext::FillPropertySet: no control model for the shape!");
+ if (xControlModel.is())
+ {
+ GetImport().GetFormImport()->applyControlNumberStyle(xControlModel, m_sControlDataStyleName);
+ }
+ }
+ }
+}
+
+void XMLShapeStyleContext::Finish( sal_Bool /*bOverwrite*/ )
+{
+}
+
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
new file mode 100644
index 000000000000..eaf83444114c
--- /dev/null
+++ b/xmloff/source/draw/animationexport.cxx
@@ -0,0 +1,1782 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/AnimationEndSync.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/AnimationCalcMode.hpp>
+#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/animations/TransitionSubType.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include <tools/debug.hxx>
+#include <tools/time.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include "sdxmlexp_impl.hxx"
+#include "sdpropls.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/shapeexport.hxx>
+
+#include "animations.hxx"
+#include "animationexport.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+
+namespace xmloff
+{
+
+SvXMLEnumMapEntry* getAnimationsEnumMap( sal_uInt16 nMap )
+{
+ switch( nMap )
+ {
+ case Animations_EnumMap_Fill:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Fill[] =
+ {
+ { XML_DEFAULT, AnimationFill::DEFAULT },
+ { XML_REMOVE, AnimationFill::REMOVE },
+ { XML_FREEZE, AnimationFill::FREEZE },
+ { XML_HOLD, AnimationFill::HOLD },
+ { XML_TRANSITION, AnimationFill::TRANSITION },
+ { XML_AUTO, AnimationFill::AUTO },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Fill;
+ }
+ case Animations_EnumMap_FillDefault:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Fill[] =
+ {
+ { XML_INHERIT, AnimationFill::INHERIT },
+ { XML_REMOVE, AnimationFill::REMOVE },
+ { XML_FREEZE, AnimationFill::FREEZE },
+ { XML_HOLD, AnimationFill::HOLD },
+ { XML_TRANSITION, AnimationFill::TRANSITION },
+ { XML_AUTO, AnimationFill::AUTO },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Fill;
+ }
+ case Animations_EnumMap_Restart:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Restart[] =
+ {
+ { XML_DEFAULT, AnimationRestart::DEFAULT },
+ { XML_ALWAYS, AnimationRestart::ALWAYS },
+ { XML_WHENNOTACTIVE,AnimationRestart::WHEN_NOT_ACTIVE },
+ { XML_NEVER, AnimationRestart::NEVER },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Restart;
+ }
+ case Animations_EnumMap_RestartDefault:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_RestartDefault[] =
+ {
+ { XML_INHERIT, AnimationRestart::INHERIT },
+ { XML_ALWAYS, AnimationRestart::ALWAYS },
+ { XML_WHENNOTACTIVE,AnimationRestart::WHEN_NOT_ACTIVE },
+ { XML_NEVER, AnimationRestart::NEVER },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_RestartDefault;
+ }
+ case Animations_EnumMap_Endsync:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Endsync[] =
+ {
+ { XML_FIRST, AnimationEndSync::FIRST },
+ { XML_LAST, AnimationEndSync::LAST },
+ { XML_ALL, AnimationEndSync::ALL },
+ { XML_MEDIA, AnimationEndSync::MEDIA },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Endsync;
+ }
+ case Animations_EnumMap_CalcMode:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_CalcMode[] =
+ {
+ { XML_DISCRETE, AnimationCalcMode::DISCRETE },
+ { XML_LINEAR, AnimationCalcMode::LINEAR },
+ { XML_PACED, AnimationCalcMode::PACED },
+ { XML_SPLINE, AnimationCalcMode::SPLINE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_CalcMode;
+ }
+ case Animations_EnumMap_AdditiveMode:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_AdditiveMode[] =
+ {
+ { XML_BASE, AnimationAdditiveMode::BASE },
+ { XML_SUM, AnimationAdditiveMode::SUM },
+ { XML_REPLACE, AnimationAdditiveMode::REPLACE },
+ { XML_MULTIPLY, AnimationAdditiveMode::MULTIPLY },
+ { XML_NONE, AnimationAdditiveMode::NONE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_AdditiveMode;
+ }
+ case Animations_EnumMap_TransformType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_TransformType[] =
+ {
+ { XML_TRANSLATE, AnimationTransformType::TRANSLATE },
+ { XML_SCALE, AnimationTransformType::SCALE },
+ { XML_ROTATE, AnimationTransformType::ROTATE },
+ { XML_SKEWX, AnimationTransformType::SKEWX },
+ { XML_SKEWY, AnimationTransformType::SKEWY },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_TransformType;
+ }
+ case Animations_EnumMap_TransitionType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_TransitionType[] =
+ {
+ { XML_BARWIPE, TransitionType::BARWIPE },
+ { XML_BOXWIPE, TransitionType::BOXWIPE },
+ { XML_FOURBOXWIPE, TransitionType::FOURBOXWIPE },
+ { XML_BARNDOORWIPE, TransitionType::BARNDOORWIPE },
+ { XML_DIAGONALWIPE, TransitionType::DIAGONALWIPE },
+ { XML_BOWTIEWIPE, TransitionType::BOWTIEWIPE },
+ { XML_MISCDIAGONALWIPE, TransitionType::MISCDIAGONALWIPE },
+ { XML_VEEWIPE, TransitionType::VEEWIPE },
+ { XML_BARNVEEWIPE, TransitionType::BARNVEEWIPE },
+ { XML_ZIGZAGWIPE, TransitionType::ZIGZAGWIPE },
+ { XML_BARNZIGZAGWIPE, TransitionType::BARNZIGZAGWIPE },
+ { XML_IRISWIPE, TransitionType::IRISWIPE },
+ { XML_TRIANGLEWIPE, TransitionType::TRIANGLEWIPE },
+ { XML_ARROWHEADWIPE, TransitionType::ARROWHEADWIPE },
+ { XML_PENTAGONWIPE, TransitionType::PENTAGONWIPE },
+ { XML_HEXAGONWIPE, TransitionType::HEXAGONWIPE },
+ { XML_ELLIPSEWIPE, TransitionType::ELLIPSEWIPE },
+ { XML_EYEWIPE, TransitionType::EYEWIPE },
+ { XML_ROUNDRECTWIPE, TransitionType::ROUNDRECTWIPE },
+ { XML_STARWIPE, TransitionType::STARWIPE },
+ { XML_MISCSHAPEWIPE, TransitionType::MISCSHAPEWIPE },
+ { XML_CLOCKWIPE, TransitionType::CLOCKWIPE },
+ { XML_PINWHEELWIPE, TransitionType::PINWHEELWIPE },
+ { XML_SINGLESWEEPWIPE, TransitionType::SINGLESWEEPWIPE },
+ { XML_FANWIPE, TransitionType::FANWIPE },
+ { XML_DOUBLEFANWIPE, TransitionType::DOUBLEFANWIPE },
+ { XML_DOUBLESWEEPWIPE, TransitionType::DOUBLESWEEPWIPE },
+ { XML_SALOONDOORWIPE, TransitionType::SALOONDOORWIPE },
+ { XML_WINDSHIELDWIPE, TransitionType::WINDSHIELDWIPE },
+ { XML_SNAKEWIPE, TransitionType::SNAKEWIPE },
+ { XML_SPIRALWIPE, TransitionType::SPIRALWIPE },
+ { XML_PARALLELSNAKESWIPE,TransitionType::PARALLELSNAKESWIPE },
+ { XML_BOXSNAKESWIPE, TransitionType::BOXSNAKESWIPE },
+ { XML_WATERFALLWIPE, TransitionType::WATERFALLWIPE },
+ { XML_PUSHWIPE, TransitionType::PUSHWIPE },
+ { XML_SLIDEWIPE, TransitionType::SLIDEWIPE },
+ { XML_FADE, TransitionType::FADE },
+ { XML_RANDOMBARWIPE, TransitionType::RANDOMBARWIPE },
+ { XML_CHECKERBOARDWIPE, TransitionType::CHECKERBOARDWIPE },
+ { XML_DISSOLVE, TransitionType::DISSOLVE },
+ { XML_BLINDSWIPE, TransitionType::BLINDSWIPE },
+ { XML_RANDOM, TransitionType::RANDOM },
+ { XML_ZOOM, TransitionType::ZOOM },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_TransitionType;
+ }
+ case Animations_EnumMap_TransitionSubType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_TransitionSubType[] =
+ {
+ { XML_DEFAULT, TransitionSubType::DEFAULT },
+ { XML_LEFTTORIGHT, TransitionSubType::LEFTTORIGHT },
+ { XML_TOPTOBOTTOM, TransitionSubType::TOPTOBOTTOM },
+ { XML_TOPLEFT, TransitionSubType::TOPLEFT },
+ { XML_TOPRIGHT, TransitionSubType::TOPRIGHT },
+ { XML_BOTTOMRIGHT, TransitionSubType::BOTTOMRIGHT },
+ { XML_BOTTOMLEFT, TransitionSubType::BOTTOMLEFT },
+ { XML_TOPCENTER, TransitionSubType::TOPCENTER },
+ { XML_RIGHTCENTER, TransitionSubType::RIGHTCENTER },
+ { XML_BOTTOMCENTER, TransitionSubType::BOTTOMCENTER },
+ { XML_LEFTCENTER, TransitionSubType::LEFTCENTER },
+ { XML_CORNERSIN, TransitionSubType::CORNERSIN },
+ { XML_CORNERSOUT, TransitionSubType::CORNERSOUT },
+ { XML_VERTICAL, TransitionSubType::VERTICAL },
+ { XML_HORIZONTAL, TransitionSubType::HORIZONTAL },
+ { XML_DIAGONALBOTTOMLEFT, TransitionSubType::DIAGONALBOTTOMLEFT },
+ { XML_DIAGONALTOPLEFT, TransitionSubType::DIAGONALTOPLEFT },
+ { XML_DOUBLEBARNDOOR, TransitionSubType::DOUBLEBARNDOOR },
+ { XML_DOUBLEDIAMOND, TransitionSubType::DOUBLEDIAMOND },
+ { XML_DOWN, TransitionSubType::DOWN },
+ { XML_LEFT, TransitionSubType::LEFT },
+ { XML_UP, TransitionSubType::UP },
+ { XML_RIGHT, TransitionSubType::RIGHT },
+ { XML_RECTANGLE, TransitionSubType::RECTANGLE },
+ { XML_DIAMOND, TransitionSubType::DIAMOND },
+ { XML_CIRCLE, TransitionSubType::CIRCLE },
+ { XML_FOURPOINT, TransitionSubType::FOURPOINT },
+ { XML_FIVEPOINT, TransitionSubType::FIVEPOINT },
+ { XML_SIXPOINT, TransitionSubType::SIXPOINT },
+ { XML_HEART, TransitionSubType::HEART },
+ { XML_KEYHOLE, TransitionSubType::KEYHOLE },
+ { XML_CLOCKWISETWELVE, TransitionSubType::CLOCKWISETWELVE },
+ { XML_CLOCKWISETHREE, TransitionSubType::CLOCKWISETHREE },
+ { XML_CLOCKWISESIX, TransitionSubType::CLOCKWISESIX },
+ { XML_CLOCKWISENINE, TransitionSubType::CLOCKWISENINE },
+ { XML_TWOBLADEVERTICAL, TransitionSubType::TWOBLADEVERTICAL },
+ { XML_TWOBLADEHORIZONTAL, TransitionSubType::TWOBLADEHORIZONTAL },
+ { XML_FOURBLADE, TransitionSubType::FOURBLADE },
+ { XML_CLOCKWISETOP, TransitionSubType::CLOCKWISETOP },
+ { XML_CLOCKWISERIGHT, TransitionSubType::CLOCKWISERIGHT },
+ { XML_CLOCKWISEBOTTOM, TransitionSubType::CLOCKWISEBOTTOM },
+ { XML_CLOCKWISELEFT, TransitionSubType::CLOCKWISELEFT },
+ { XML_CLOCKWISETOPLEFT, TransitionSubType::CLOCKWISETOPLEFT },
+ { XML_COUNTERCLOCKWISEBOTTOMLEFT,TransitionSubType::COUNTERCLOCKWISEBOTTOMLEFT },
+ { XML_CLOCKWISEBOTTOMRIGHT, TransitionSubType::CLOCKWISEBOTTOMRIGHT },
+ { XML_COUNTERCLOCKWISETOPRIGHT,TransitionSubType::COUNTERCLOCKWISETOPRIGHT },
+ { XML_CENTERTOP, TransitionSubType::CENTERTOP },
+ { XML_CENTERRIGHT, TransitionSubType::CENTERRIGHT },
+ { XML_TOP, TransitionSubType::TOP },
+ { XML_BOTTOM, TransitionSubType::BOTTOM },
+ { XML_FANOUTVERTICAL, TransitionSubType::FANOUTVERTICAL },
+ { XML_FANOUTHORIZONTAL, TransitionSubType::FANOUTHORIZONTAL },
+ { XML_FANINVERTICAL, TransitionSubType::FANINVERTICAL },
+ { XML_FANINHORIZONTAL, TransitionSubType::FANINHORIZONTAL },
+ { XML_PARALLELVERTICAL, TransitionSubType::PARALLELVERTICAL },
+ { XML_PARALLELDIAGONAL, TransitionSubType::PARALLELDIAGONAL },
+ { XML_OPPOSITEVERTICAL, TransitionSubType::OPPOSITEVERTICAL },
+ { XML_OPPOSITEHORIZONTAL, TransitionSubType::OPPOSITEHORIZONTAL },
+ { XML_PARALLELDIAGONALTOPLEFT,TransitionSubType::PARALLELDIAGONALTOPLEFT },
+ { XML_PARALLELDIAGONALBOTTOMLEFT,TransitionSubType::PARALLELDIAGONALBOTTOMLEFT },
+ { XML_TOPLEFTHORIZONTAL, TransitionSubType::TOPLEFTHORIZONTAL },
+ { XML_TOPLEFTDIAGONAL, TransitionSubType::TOPLEFTDIAGONAL },
+ { XML_TOPRIGHTDIAGONAL, TransitionSubType::TOPRIGHTDIAGONAL },
+ { XML_BOTTOMRIGHTDIAGONAL, TransitionSubType::BOTTOMRIGHTDIAGONAL },
+ { XML_BOTTOMLEFTDIAGONAL, TransitionSubType::BOTTOMLEFTDIAGONAL },
+ { XML_TOPLEFTCLOCKWISE, TransitionSubType::TOPLEFTCLOCKWISE },
+ { XML_TOPRIGHTCLOCKWISE, TransitionSubType::TOPRIGHTCLOCKWISE },
+ { XML_BOTTOMRIGHTCLOCKWISE, TransitionSubType::BOTTOMRIGHTCLOCKWISE },
+ { XML_BOTTOMLEFTCLOCKWISE, TransitionSubType::BOTTOMLEFTCLOCKWISE },
+ { XML_TOPLEFTCOUNTERCLOCKWISE,TransitionSubType::TOPLEFTCOUNTERCLOCKWISE },
+ { XML_TOPRIGHTCOUNTERCLOCKWISE,TransitionSubType::TOPRIGHTCOUNTERCLOCKWISE },
+ { XML_BOTTOMRIGHTCOUNTERCLOCKWISE,TransitionSubType::BOTTOMRIGHTCOUNTERCLOCKWISE },
+ { XML_BOTTOMLEFTCOUNTERCLOCKWISE,TransitionSubType::BOTTOMLEFTCOUNTERCLOCKWISE },
+ { XML_VERTICALTOPSAME, TransitionSubType::VERTICALTOPSAME },
+ { XML_VERTICALBOTTOMSAME, TransitionSubType::VERTICALBOTTOMSAME },
+ { XML_VERTICALTOPLEFTOPPOSITE,TransitionSubType::VERTICALTOPLEFTOPPOSITE },
+ { XML_VERTICALBOTTOMLEFTOPPOSITE,TransitionSubType::VERTICALBOTTOMLEFTOPPOSITE },
+ { XML_HORIZONTALLEFTSAME, TransitionSubType::HORIZONTALLEFTSAME },
+ { XML_HORIZONTALRIGHTSAME, TransitionSubType::HORIZONTALRIGHTSAME },
+ { XML_HORIZONTALTOPLEFTOPPOSITE,TransitionSubType::HORIZONTALTOPLEFTOPPOSITE },
+ { XML_HORIZONTALTOPRIGHTOPPOSITE,TransitionSubType::HORIZONTALTOPRIGHTOPPOSITE },
+ { XML_DIAGONALBOTTOMLEFTOPPOSITE,TransitionSubType::DIAGONALBOTTOMLEFTOPPOSITE },
+ { XML_DIAGONALTOPLEFTOPPOSITE,TransitionSubType::DIAGONALTOPLEFTOPPOSITE },
+ { XML_TWOBOXTOP, TransitionSubType::TWOBOXTOP },
+ { XML_TWOBOXBOTTOM, TransitionSubType::TWOBOXBOTTOM },
+ { XML_TWOBOXLEFT, TransitionSubType::TWOBOXLEFT },
+ { XML_TWOBOXRIGHT, TransitionSubType::TWOBOXRIGHT },
+ { XML_FOURBOXVERTICAL, TransitionSubType::FOURBOXVERTICAL },
+ { XML_FOURBOXHORIZONTAL, TransitionSubType::FOURBOXHORIZONTAL },
+ { XML_VERTICALLEFT, TransitionSubType::VERTICALLEFT },
+ { XML_VERTICALRIGHT, TransitionSubType::VERTICALRIGHT },
+ { XML_HORIZONTALLEFT, TransitionSubType::HORIZONTALLEFT },
+ { XML_HORIZONTALRIGHT, TransitionSubType::HORIZONTALRIGHT },
+ { XML_FROMLEFT, TransitionSubType::FROMLEFT },
+ { XML_FROMTOP, TransitionSubType::FROMTOP },
+ { XML_FROMRIGHT, TransitionSubType::FROMRIGHT },
+ { XML_FROMBOTTOM, TransitionSubType::FROMBOTTOM },
+ { XML_CROSSFADE, TransitionSubType::CROSSFADE },
+ { XML_FADETOCOLOR, TransitionSubType::FADETOCOLOR },
+ { XML_FADEFROMCOLOR, TransitionSubType::FADEFROMCOLOR },
+ { XML_FADEOVERCOLOR, TransitionSubType::FADEOVERCOLOR },
+ { XML_THREEBLADE, TransitionSubType::THREEBLADE },
+ { XML_EIGHTBLADE, TransitionSubType::EIGHTBLADE },
+ { XML_ONEBLADE, TransitionSubType::ONEBLADE },
+ { XML_ACROSS, TransitionSubType::ACROSS },
+ { XML_TOPLEFTVERTICAL, TransitionSubType::TOPLEFTVERTICAL },
+ { XML_COMBHORIZONTAL, TransitionSubType::COMBHORIZONTAL },
+ { XML_COMBVERTICAL, TransitionSubType::COMBVERTICAL },
+ { XML_IN, TransitionSubType::IN },
+ { XML_OUT, TransitionSubType::OUT },
+ { XML_ROTATEIN, TransitionSubType::ROTATEIN },
+ { XML_ROTATEOUT, TransitionSubType::ROTATEOUT },
+ { XML_FROMTOPLEFT, TransitionSubType::FROMTOPLEFT },
+ { XML_FROMTOPRIGHT, TransitionSubType::FROMTOPRIGHT },
+ { XML_FROMBOTTOMLEFT, TransitionSubType::FROMBOTTOMLEFT },
+ { XML_FROMBOTTOMRIGHT, TransitionSubType::FROMBOTTOMRIGHT },
+
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_TransitionSubType;
+ }
+ case Animations_EnumMap_EventTrigger:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_EventTrigger[] =
+ {
+ { XML_ONBEGIN, EventTrigger::ON_BEGIN },
+ { XML_ONEND, EventTrigger::ON_END },
+ { XML_BEGIN, EventTrigger::BEGIN_EVENT },
+ { XML_END, EventTrigger::END_EVENT },
+ { XML_CLICK, EventTrigger::ON_CLICK },
+ { XML_DOUBLECLICK, EventTrigger::ON_DBL_CLICK },
+ { XML_MOUSEOVER, EventTrigger::ON_MOUSE_ENTER },
+ { XML_MOUSEOUT, EventTrigger::ON_MOUSE_LEAVE },
+ { XML_NEXT, EventTrigger::ON_NEXT },
+ { XML_PREVIOUS, EventTrigger::ON_PREV },
+ { XML_STOP_AUDIO, EventTrigger::ON_STOP_AUDIO },
+ { XML_REPEAT, EventTrigger::REPEAT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_EventTrigger;
+ }
+
+ case Animations_EnumMap_EffectPresetClass:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_EffectPresetClass[] =
+ {
+ { XML_CUSTOM, EffectPresetClass::CUSTOM },
+ { XML_ENTRANCE, EffectPresetClass::ENTRANCE },
+ { XML_EXIT, EffectPresetClass::EXIT },
+ { XML_EMPHASIS, EffectPresetClass::EMPHASIS },
+ { XML_MOTION_PATH, EffectPresetClass::MOTIONPATH },
+ { XML_OLE_ACTION, EffectPresetClass::OLEACTION },
+ { XML_MEDIA_CALL, EffectPresetClass::MEDIACALL },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_EffectPresetClass;
+ }
+
+ case Animations_EnumMap_EffectNodeType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_EffectNodeType[] =
+ {
+ { XML_DEFAULT, EffectNodeType::DEFAULT },
+ { XML_ON_CLICK, EffectNodeType::ON_CLICK },
+ { XML_WITH_PREVIOUS, EffectNodeType::WITH_PREVIOUS },
+ { XML_AFTER_PREVIOUS, EffectNodeType::AFTER_PREVIOUS },
+ { XML_MAIN_SEQUENCE, EffectNodeType::MAIN_SEQUENCE },
+ { XML_TIMING_ROOT, EffectNodeType::TIMING_ROOT },
+ { XML_INTERACTIVE_SEQUENCE, EffectNodeType::INTERACTIVE_SEQUENCE },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_EffectNodeType;
+ }
+ case Animations_EnumMap_SubItem:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_SubItem[] =
+ {
+ { XML_WHOLE, ShapeAnimationSubType::AS_WHOLE },
+ { XML_BACKGROUND, ShapeAnimationSubType::ONLY_BACKGROUND },
+ { XML_TEXT, ShapeAnimationSubType::ONLY_TEXT },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_SubItem;
+ }
+ case Animations_EnumMap_IterateType:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_IterateType[] =
+ {
+ { XML_BY_PARAGRAPH, TextAnimationType::BY_PARAGRAPH },
+ { XML_BY_WORD, TextAnimationType::BY_WORD },
+ { XML_BY_LETTER, TextAnimationType::BY_LETTER },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_IterateType;
+ }
+ case Animations_EnumMap_Command:
+ {
+ static SvXMLEnumMapEntry aAnimations_EnumMap_Command[] =
+ {
+ { XML_CUSTOM, EffectCommands::CUSTOM },
+ { XML_VERB, EffectCommands::VERB },
+ { XML_PLAY, EffectCommands::PLAY },
+ { XML_TOGGLE_PAUSE, EffectCommands::TOGGLEPAUSE },
+ { XML_STOP, EffectCommands::STOP },
+ { XML_STOP_AUDIO, EffectCommands::STOPAUDIO },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ return aAnimations_EnumMap_Command;
+ }
+ }
+
+ DBG_ERROR( "xmloff::getAnimationsEnumMap(), invalid map!" );
+ return NULL;
+}
+
+struct ImplAttributeNameConversion* getAnimationAttributeNamesConversionList()
+{
+ static struct ImplAttributeNameConversion gImplConversionList[] =
+ {
+ { XML_X, "X" },
+ { XML_Y, "Y" },
+ { XML_WIDTH, "Width" },
+ { XML_HEIGHT, "Height" },
+ { XML_ROTATE, "Rotate" },
+ { XML_SKEWX, "SkewX" },
+ { XML_FILL_COLOR, "FillColor" },
+ { XML_FILL, "FillStyle" },
+ { XML_STROKE_COLOR, "LineColor" },
+ { XML_STROKE, "LineStyle" },
+ { XML_COLOR, "CharColor" },
+ { XML_TEXT_ROTATION_ANGLE, "CharRotation" },
+ { XML_FONT_WEIGHT, "CharWeight" },
+ { XML_TEXT_UNDERLINE, "CharUnderline" },
+ { XML_FONT_FAMILY, "CharFontName" },
+ { XML_FONT_SIZE, "CharHeight" },
+ { XML_FONT_STYLE, "CharPosture" },
+ { XML_VISIBILITY, "Visibility" },
+ { XML_OPACITY, "Opacity" },
+ { XML_DIM, "DimColor" },
+ { XML_TOKEN_INVALID, NULL }
+ };
+
+ return gImplConversionList;
+}
+
+
+class AnimationsExporterImpl
+{
+public:
+ AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps );
+
+ void prepareNode( const Reference< XAnimationNode >& xNode );
+ void exportNode( const Reference< XAnimationNode >& xNode );
+
+ void exportContainer( const Reference< XTimeContainer >& xNode, sal_Int16 nContainerNodeType );
+ void exportAnimate( const Reference< XAnimate >& xNode );
+ void exportAudio( const Reference< XAudio >& xAudio );
+ void exportCommand( const Reference< XCommand >& xCommand );
+
+ Reference< XInterface > getParagraphTarget( const ParagraphTarget* pTarget ) const;
+
+ void convertPath( OUStringBuffer& sTmp, const Any& rPath );
+ void convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue );
+ void convertTiming( OUStringBuffer& sTmp, const Any& rTiming );
+ void convertSource( OUStringBuffer& sTmp, const Any& rSource );
+ void convertTarget( OUStringBuffer& sTmp, const Any& rTarget );
+
+ void prepareValue( const Any& rValue );
+
+ void exportTransitionNode();
+ void prepareTransitionNode();
+
+ bool mbHasTransition;
+private:
+ SvXMLExport& mrExport;
+ Reference< XInterface > mxExport;
+ Reference< XPropertySet > mxPageProps;
+};
+
+AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
+: mbHasTransition(false)
+, mrExport( rExport )
+, mxPageProps( xPageProps )
+{
+ try
+ {
+ mxExport = static_cast< ::com::sun::star::document::XFilter *>(&rExport);
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::AnimationsExporterImpl(), RuntimeException catched!" );
+ }
+}
+
+void AnimationsExporterImpl::exportTransitionNode()
+{
+ if( mbHasTransition && mxPageProps.is() )
+ {
+ sal_Int16 nTransition = 0;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) >>= nTransition;
+
+ Any aSound( mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) );
+ OUString sSoundURL;
+ aSound >>= sSoundURL;
+ sal_Bool bStopSound = sal_False;
+ if( !(aSound >>= bStopSound) )
+ bStopSound = sal_False;
+
+
+ OUStringBuffer sTmp;
+ if( (nTransition != 0) || (sSoundURL.getLength() != 0) || bStopSound )
+ {
+ Reference< XInterface > xSource( mxPageProps.get() );
+ Event aEvent;
+ aEvent.Source <<= xSource;
+ aEvent.Trigger = EventTrigger::BEGIN_EVENT;
+ aEvent.Repeat = 0;
+
+ convertTiming( sTmp, Any( aEvent ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BEGIN, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_PAR, sal_True, sal_True );
+
+ if( nTransition != 0 )
+ {
+ sal_Int16 nSubtype = 0;
+ sal_Bool bDirection = sal_False;
+ sal_Int32 nFadeColor = 0;
+ double fDuration = 0.0;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) ) >>= nSubtype;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDirection" ) ) ) >>= bDirection;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionFadeColor" ) ) ) >>= nFadeColor;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDuration" ) ) ) >>= fDuration;
+
+ SvXMLUnitConverter::convertDouble( sTmp, fDuration );
+ sTmp.append( sal_Unicode('s'));
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() );
+
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTransition, getAnimationsEnumMap(Animations_EnumMap_TransitionType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TYPE, sTmp.makeStringAndClear() );
+
+ if( nSubtype != TransitionSubType::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nSubtype, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_SUBTYPE, sTmp.makeStringAndClear() );
+ }
+
+ if( !bDirection )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DIRECTION, XML_REVERSE );
+
+ if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) ))
+ {
+ SvXMLUnitConverter::convertColor( sTmp, nFadeColor );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() );
+ }
+ SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_TRANSITIONFILTER, sal_True, sal_True );
+ }
+
+ if( bStopSound )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COMMAND, XML_STOP_AUDIO );
+ SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_COMMAND, sal_True, sal_True );
+ }
+ else if( sSoundURL.getLength() != 0)
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference( sSoundURL ) );
+
+ sal_Bool bLoopSound = sal_False;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) >>= bLoopSound;
+
+ if( bLoopSound )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE );
+ SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_AUDIO, sal_True, sal_True );
+ }
+ }
+ }
+}
+
+void AnimationsExporterImpl::prepareTransitionNode()
+{
+ if( mxPageProps.is() ) try
+ {
+ sal_Int16 nTransition = 0;
+ mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) >>= nTransition;
+
+ sal_Bool bStopSound = sal_False;
+ OUString sSoundURL;
+
+ if( nTransition == 0 )
+ {
+ Any aSound( mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) );
+ aSound >>= sSoundURL;
+
+ if( !(aSound >>= bStopSound) )
+ bStopSound = sal_False;
+ }
+
+ if( (nTransition != 0) || (sSoundURL.getLength() != 0) || bStopSound )
+ {
+ mbHasTransition = true;
+ Reference< XInterface > xInt( mxPageProps.get() );
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xInt );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::prepareNode(), Exception caught!" );
+ }
+
+}
+
+void AnimationsExporterImpl::prepareNode( const Reference< XAnimationNode >& xNode )
+{
+ try
+ {
+ prepareValue( xNode->getBegin() );
+ prepareValue( xNode->getEnd() );
+
+ sal_Int16 nNodeType = xNode->getType();
+ switch( nNodeType )
+ {
+ case AnimationNodeType::ITERATE:
+ {
+ Reference< XIterateContainer > xIter( xNode, UNO_QUERY_THROW );
+ prepareValue( xIter->getTarget() );
+ }
+ // its intended that here is no break!
+ case AnimationNodeType::PAR:
+ case AnimationNodeType::SEQ:
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ prepareNode( xChildNode );
+ }
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE:
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATEMOTION:
+ case AnimationNodeType::ANIMATECOLOR:
+ case AnimationNodeType::ANIMATETRANSFORM:
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
+ prepareValue( xAnimate->getTarget() );
+ }
+ break;
+
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
+ prepareValue( xCommand->getTarget() );
+ }
+ break;
+
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
+ prepareValue( xAudio->getSource() );
+ }
+ break;
+ }
+
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ if( aUserData.hasElements() )
+ {
+ const NamedValue* pValue = aUserData.getConstArray();
+ const sal_Int32 nLength = aUserData.getLength();
+ sal_Int32 nElement;
+ for( nElement = 0; nElement < nLength; nElement++, pValue++ )
+ {
+ if( IsXMLToken( pValue->Name, XML_MASTER_ELEMENT ) )
+ {
+ Reference< XInterface > xMaster;
+ pValue->Value >>= xMaster;
+ if( xMaster.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xMaster );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::prepareNode(), RuntimeException catched!" );
+ }
+}
+
+void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNode )
+{
+ try
+ {
+ OUStringBuffer sTmp;
+
+ const OUString& rExportIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xNode );
+ if( rExportIdentifier.getLength() )
+ {
+ mrExport.AddAttributeIdLegacy(
+ XML_NAMESPACE_ANIMATION, rExportIdentifier);
+ }
+
+ Any aTemp( xNode->getBegin() );
+ if( aTemp.hasValue() )
+ {
+ convertTiming( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BEGIN, sTmp.makeStringAndClear() );
+ }
+
+ double fTemp = 0;
+ sal_Int32 nTemp;
+
+ aTemp = xNode->getDuration();
+ if( aTemp.hasValue() )
+ {
+ if( aTemp >>= fTemp )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ sTmp.append( sal_Unicode('s'));
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ Timing eTiming;
+ if( aTemp >>= eTiming )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, eTiming == Timing_INDEFINITE ? XML_INDEFINITE : XML_MEDIA );
+ }
+ }
+
+ aTemp = xNode->getEnd();
+ if( aTemp.hasValue() )
+ {
+ convertTiming( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_END, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getFill();
+ if( nTemp != AnimationFill::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_Fill) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FILL, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getFillDefault();
+ if( nTemp != AnimationFill::INHERIT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_FillDefault) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FILLDEFAULT, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getRestart();
+ if( nTemp != AnimationRestart::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_Restart) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_RESTART, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xNode->getRestartDefault();
+ if( nTemp != AnimationRestart::INHERIT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_RestartDefault) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_RESTARTDEFAULT, sTmp.makeStringAndClear() );
+ }
+
+ fTemp = xNode->getAcceleration();
+ if( fTemp != 0.0 )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCELERATE, sTmp.makeStringAndClear() );
+ }
+
+ fTemp = xNode->getDecelerate();
+ if( fTemp != 0.0 )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DECELERATE, sTmp.makeStringAndClear() );
+ }
+
+ sal_Bool bTemp = xNode->getAutoReverse();
+ if( bTemp )
+ {
+ SvXMLUnitConverter::convertBool( sTmp, bTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_AUTOREVERSE, sTmp.makeStringAndClear() );
+ }
+
+ aTemp = xNode->getRepeatCount();
+ if( aTemp.hasValue() )
+ {
+ Timing eTiming;
+ if( (aTemp >>= eTiming ) && (eTiming == Timing_INDEFINITE ) )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE );
+ else if( aTemp >>= fTemp )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, sTmp.makeStringAndClear() );
+ }
+ }
+
+ aTemp = xNode->getRepeatDuration();
+ if( aTemp.hasValue() )
+ {
+ Timing eTiming;
+ if( ( aTemp >>= eTiming ) && (eTiming == Timing_INDEFINITE) )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, XML_INDEFINITE );
+ }
+ else if( aTemp >>= fTemp )
+ {
+ SvXMLUnitConverter::convertDouble( sTmp, fTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, sTmp.makeStringAndClear() );
+ }
+ }
+
+ aTemp = xNode->getEndSync();
+ if( aTemp.hasValue() )
+ {
+ if( aTemp >>= nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_Endsync) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ENDSYNC, sTmp.makeStringAndClear() );
+ }
+ }
+
+ sal_Int16 nContainerNodeType = EffectNodeType::DEFAULT;
+ OUString aPresetId;
+ Sequence< NamedValue > aUserData( xNode->getUserData() );
+ if( aUserData.hasElements() )
+ {
+ const NamedValue* pValue = aUserData.getConstArray();
+ const sal_Int32 nLength = aUserData.getLength();
+ sal_Int32 nElement;
+ for( nElement = 0; nElement < nLength; nElement++, pValue++ )
+ {
+ if( IsXMLToken( pValue->Name, XML_NODE_TYPE ) )
+ {
+ if( (pValue->Value >>= nContainerNodeType) && (nContainerNodeType != EffectNodeType::DEFAULT) )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nContainerNodeType, getAnimationsEnumMap(Animations_EnumMap_EffectNodeType) );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NODE_TYPE, sTmp.makeStringAndClear() );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_PRESET_ID ) )
+ {
+ if( pValue->Value >>= aPresetId )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_ID, aPresetId );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_PRESET_SUB_TYPE ) )
+ {
+ OUString aPresetSubType;
+ if( pValue->Value >>= aPresetSubType )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_SUB_TYPE, aPresetSubType );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_PRESET_CLASS ) )
+ {
+ sal_Int16 nEffectPresetClass = sal_Int16();
+ if( pValue->Value >>= nEffectPresetClass )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nEffectPresetClass, getAnimationsEnumMap(Animations_EnumMap_EffectPresetClass) );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_CLASS, sTmp.makeStringAndClear() );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_MASTER_ELEMENT ) )
+ {
+ Reference< XInterface > xMaster;
+ pValue->Value >>= xMaster;
+ if( xMaster.is() )
+ {
+ const OUString& rIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier(xMaster);
+ if( rIdentifier.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_MASTER_ELEMENT, rIdentifier );
+ }
+ }
+ else if( IsXMLToken( pValue->Name, XML_GROUP_ID ) )
+ {
+ sal_Int32 nGroupId = 0;
+ if( pValue->Value >>= nGroupId )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, OUString::valueOf( nGroupId ) );
+ }
+ else
+ {
+ OUString aTmp;
+ if( pValue->Value >>= aTmp )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, pValue->Name, aTmp );
+ }
+ }
+ }
+
+ nTemp = xNode->getType();
+ switch( nTemp )
+ {
+ case AnimationNodeType::PAR:
+ case AnimationNodeType::SEQ:
+ case AnimationNodeType::ITERATE:
+ {
+ Reference< XTimeContainer > xContainer( xNode, UNO_QUERY_THROW );
+ exportContainer( xContainer, nContainerNodeType );
+ }
+ break;
+
+ case AnimationNodeType::ANIMATE:
+ case AnimationNodeType::SET:
+ case AnimationNodeType::ANIMATEMOTION:
+ case AnimationNodeType::ANIMATECOLOR:
+ case AnimationNodeType::ANIMATETRANSFORM:
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
+ exportAnimate( xAnimate );
+ }
+ break;
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
+ exportAudio( xAudio );
+ }
+ break;
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
+ exportCommand( xCommand );
+ }
+ break;
+ default:
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportNode(), invalid AnimationNodeType!" );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportNode(), RuntimeException catched!" );
+ }
+
+ // if something goes wrong, its always a good idea to clear the attribute list
+ mrExport.ClearAttrList();
+}
+
+void AnimationsExporterImpl::exportContainer( const Reference< XTimeContainer >& xContainer, sal_Int16 nContainerNodeType )
+{
+ try
+ {
+ const sal_Int32 nNodeType = xContainer->getType();
+
+ if( nNodeType == AnimationNodeType::ITERATE )
+ {
+ OUStringBuffer sTmp;
+ Reference< XIterateContainer > xIter( xContainer, UNO_QUERY_THROW );
+
+ Any aTemp( xIter->getTarget() );
+ if( aTemp.hasValue() )
+ {
+ convertTarget( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
+ }
+
+ sal_Int16 nTemp = xIter->getSubItem();
+ if( nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_SubItem) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xIter->getIterateType();
+ if( nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_IterateType) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, sTmp.makeStringAndClear() );
+ }
+
+ double fTemp = xIter->getIterateInterval();
+ if( fTemp )
+ {
+ if( 0 == ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) )
+ {
+ // issue 146582
+ sal_Int32 nSecondsFraction = static_cast<sal_Int32>(fTemp * 1000 ) % 1000;
+ ::Time aTime( static_cast<sal_Int32>( fTemp * 100 ) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, SvXMLUnitConverter::convertTimeDuration( aTime, nSecondsFraction ) );
+ }
+ else
+ {
+ sTmp.append( fTemp );
+ sTmp.append( (sal_Unicode)'s' );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, sTmp.makeStringAndClear() );
+ }
+ }
+ }
+
+ XMLTokenEnum eElementToken;
+ switch( nNodeType )
+ {
+ case AnimationNodeType::PAR: eElementToken = XML_PAR; break;
+ case AnimationNodeType::SEQ: eElementToken = XML_SEQ; break;
+ case AnimationNodeType::ITERATE:eElementToken = XML_ITERATE; break;
+ default:
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportContainer(), invalid TimeContainerType!" );
+ return;
+ }
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, eElementToken, sal_True, sal_True );
+
+ if( nContainerNodeType == EffectNodeType::TIMING_ROOT )
+ exportTransitionNode();
+
+ Reference< XEnumerationAccess > xEnumerationAccess( xContainer, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ exportNode( xChildNode );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportContainer(), RuntimeException catched!" );
+ }
+}
+
+void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimate )
+{
+ try
+ {
+ const sal_Int16 nNodeType = xAnimate->getType();
+
+ OUStringBuffer sTmp;
+ sal_Int32 nTemp;
+ sal_Bool bTemp;
+
+ Any aTemp( xAnimate->getTarget() );
+ if( aTemp.hasValue() )
+ {
+ convertTarget( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
+ }
+
+ nTemp = xAnimate->getSubItem();
+ if( nTemp )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_SubItem) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, sTmp.makeStringAndClear() );
+ }
+
+ XMLTokenEnum eAttributeName = XML_TOKEN_INVALID;
+
+ if( nNodeType == AnimationNodeType::TRANSITIONFILTER )
+ {
+ eAttributeName = XML_TRANSITIONFILTER;
+ }
+ else if( nNodeType == AnimationNodeType::ANIMATETRANSFORM )
+ {
+ eAttributeName = XML_ANIMATETRANSFORM;
+ }
+ else if( nNodeType == AnimationNodeType::ANIMATEMOTION )
+ {
+ eAttributeName = XML_ANIMATEMOTION;
+ }
+ else
+ {
+ OUString sTemp( xAnimate->getAttributeName() );
+ if( sTemp.getLength() )
+ {
+ ImplAttributeNameConversion* p = getAnimationAttributeNamesConversionList();
+ while( p->mpAPIName )
+ {
+ if( sTemp.compareToAscii( p->mpAPIName ) == 0 )
+ {
+ sTemp = GetXMLToken( p->meXMLToken );
+ eAttributeName = p->meXMLToken;
+ break;
+ }
+
+ p++;
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, sTemp );
+ }
+ else
+ {
+ OUString aStr( RTL_CONSTASCII_USTRINGPARAM( "invalid" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, aStr );
+ }
+ }
+
+ Sequence< Any > aValues( xAnimate->getValues() );
+ if( aValues.getLength() )
+ {
+ aTemp <<= aValues;
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_VALUES, sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ aTemp = xAnimate->getFrom();
+ if( aTemp.hasValue() )
+ {
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FROM, sTmp.makeStringAndClear() );
+ }
+
+ aTemp = xAnimate->getBy();
+ if( aTemp.hasValue() )
+ {
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BY, sTmp.makeStringAndClear() );
+ }
+
+ aTemp = xAnimate->getTo();
+ if( aTemp.hasValue() )
+ {
+ convertValue( eAttributeName, sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TO, sTmp.makeStringAndClear() );
+ }
+ }
+
+ if(nNodeType != AnimationNodeType::SET)
+ {
+ Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
+ if( aKeyTimes.getLength() )
+ {
+ sal_Int32 nLength = aKeyTimes.getLength();
+ const double* p = aKeyTimes.getConstArray();
+
+ while( nLength-- )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+
+ sTmp.append( *p++ );
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_KEYTIMES, sTmp.makeStringAndClear() );
+ }
+
+ OUString sTemp( xAnimate->getFormula() );
+ if( sTemp.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_FORMULA, sTemp );
+
+ if( (nNodeType != AnimationNodeType::TRANSITIONFILTER) &&
+ (nNodeType != AnimationNodeType::AUDIO ) )
+ {
+ // calcMode = "discrete | linear | paced | spline"
+ nTemp = xAnimate->getCalcMode();
+ if( ((nNodeType == AnimationNodeType::ANIMATEMOTION ) && (nTemp != AnimationCalcMode::PACED)) ||
+ ((nNodeType != AnimationNodeType::ANIMATEMOTION ) && (nTemp != AnimationCalcMode::LINEAR)) )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_CalcMode) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_CALCMODE, sTmp.makeStringAndClear() );
+ }
+
+ bTemp = xAnimate->getAccumulate();
+ if( bTemp )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCUMULATE, XML_SUM );
+
+ nTemp = xAnimate->getAdditive();
+ if( nTemp != AnimationAdditiveMode::REPLACE )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_AdditiveMode) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ADDITIVE, sTmp.makeStringAndClear() );
+ }
+ }
+
+ Sequence< TimeFilterPair > aTimeFilter( xAnimate->getTimeFilter() );
+ if( aTimeFilter.getLength() )
+ {
+ sal_Int32 nLength = aTimeFilter.getLength();
+ const TimeFilterPair* p = aTimeFilter.getConstArray();
+
+ while( nLength-- )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+
+ sTmp.append( p->Time );
+ sTmp.append( (sal_Unicode)',' );
+ sTmp.append( p->Progress );
+
+ p++;
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_KEYSPLINES, sTmp.makeStringAndClear() );
+ }
+ }
+
+ XMLTokenEnum eElementToken = XML_ANIMATE;
+
+ switch( nNodeType )
+ {
+ case AnimationNodeType::ANIMATE:
+ eElementToken = XML_ANIMATE;
+ break;
+
+ case AnimationNodeType::SET:
+ eElementToken = XML_SET;
+ break;
+
+ case AnimationNodeType::ANIMATEMOTION:
+ {
+ eElementToken = XML_ANIMATEMOTION;
+
+ Reference< XAnimateMotion > xAnimateMotion( xAnimate, UNO_QUERY_THROW );
+
+ aTemp = xAnimateMotion->getPath();
+ if( aTemp.hasValue() )
+ {
+ convertPath( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_PATH, sTmp.makeStringAndClear() );
+ }
+
+ // TODO: origin = ( parent | layout )
+ aTemp = xAnimateMotion->getOrigin();
+ }
+ break;
+
+ case AnimationNodeType::ANIMATECOLOR:
+ {
+ eElementToken = XML_ANIMATECOLOR;
+
+ Reference< XAnimateColor > xAnimateColor( xAnimate, UNO_QUERY_THROW );
+
+ nTemp = xAnimateColor->getColorInterpolation();
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION, (nTemp == AnimationColorSpace::RGB) ? XML_RGB : XML_HSL );
+
+ bTemp = xAnimateColor->getDirection();
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION_DIRECTION, bTemp ? XML_CLOCKWISE : XML_COUNTER_CLOCKWISE );
+ }
+ break;
+
+ case AnimationNodeType::ANIMATETRANSFORM:
+ {
+ eElementToken = XML_ANIMATETRANSFORM;
+
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, XML_TRANSFORM );
+
+ Reference< XAnimateTransform > xTransform( xAnimate, UNO_QUERY_THROW );
+ nTemp = xTransform->getTransformType();
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTemp, getAnimationsEnumMap(Animations_EnumMap_TransformType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_TYPE, sTmp.makeStringAndClear() );
+ }
+ break;
+
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XTransitionFilter > xTransitionFilter( xAnimate, UNO_QUERY );
+ eElementToken = XML_TRANSITIONFILTER;
+
+ sal_Int16 nTransition = xTransitionFilter->getTransition();
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nTransition, getAnimationsEnumMap(Animations_EnumMap_TransitionType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TYPE, sTmp.makeStringAndClear() );
+
+ sal_Int16 nSubtype = xTransitionFilter->getSubtype();
+ if( nSubtype != TransitionSubType::DEFAULT )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nSubtype, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_SUBTYPE, sTmp.makeStringAndClear() );
+ }
+
+ bTemp = xTransitionFilter->getMode();
+ if( !bTemp )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_MODE, XML_OUT );
+
+ bTemp = xTransitionFilter->getDirection();
+ if( !bTemp )
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DIRECTION, XML_REVERSE );
+
+ if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) ))
+ {
+ nTemp = xTransitionFilter->getFadeColor();
+ SvXMLUnitConverter::convertColor( sTmp, nTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() );
+ }
+ }
+ break;
+ }
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, eElementToken, sal_True, sal_True );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportAnimate(), Exception cought!" );
+ }
+}
+
+void AnimationsExporterImpl::exportAudio( const Reference< XAudio >& xAudio )
+{
+ if( xAudio.is() ) try
+ {
+ OUString aSourceURL;
+ xAudio->getSource() >>= aSourceURL;
+ if( aSourceURL.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference( aSourceURL ) );
+
+ const double fVolume = xAudio->getVolume();
+ if( fVolume != 1.0 )
+ {
+ OUStringBuffer sTmp;
+ SvXMLUnitConverter::convertDouble( sTmp, fVolume );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, sTmp.makeStringAndClear() );
+ }
+
+/* todo?
+ sal_Int32 nEndAfterSlide = 0;
+ xAudio->getEndAfterSlide() >>= nEndAfterSlide;
+ if( nEndAfterSlide != 0 )
+ mrExport.AddAttribute( );
+*/
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_AUDIO, sal_True, sal_True );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportAudio(), exception caught!" );
+ }
+}
+
+void AnimationsExporterImpl::exportCommand( const Reference< XCommand >& xCommand )
+{
+ if( xCommand.is() ) try
+ {
+ OUStringBuffer sTmp;
+ Any aTemp( xCommand->getTarget() );
+ if( aTemp.hasValue() )
+ {
+ convertTarget( sTmp, aTemp );
+ mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
+ }
+
+ sal_Int16 nCommand = xCommand->getCommand();
+ SvXMLUnitConverter::convertEnum( sTmp, (USHORT)nCommand, getAnimationsEnumMap(Animations_EnumMap_Command) );
+ mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COMMAND, sTmp.makeStringAndClear() );
+
+// todo virtual ::com::sun::star::uno::Any SAL_CALL getParameter() throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_COMMAND, sal_True, sal_True );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::exportCommand(), exception caught!" );
+ }
+}
+
+Reference< XInterface > AnimationsExporterImpl::getParagraphTarget( const ParagraphTarget* pTarget ) const
+{
+ if( pTarget ) try
+ {
+ Reference< XEnumerationAccess > xParaEnumAccess( pTarget->Shape, UNO_QUERY_THROW );
+
+ Reference< XEnumeration > xEnumeration( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
+ sal_Int32 nParagraph = pTarget->Paragraph;
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XInterface > xRef( xEnumeration->nextElement(), UNO_QUERY );
+ if( nParagraph-- == 0 )
+ return xRef;
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::getParagraphTarget(), RuntimeException catched!" );
+ }
+
+ Reference< XInterface > xRef;
+ return xRef;
+}
+
+void AnimationsExporterImpl::convertPath( OUStringBuffer& sTmp, const Any& rPath )
+{
+ OUString aStr;
+ rPath >>= aStr;
+
+ sTmp = aStr;
+}
+
+void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue )
+{
+ if( !rValue.hasValue() )
+ return;
+
+ if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
+ {
+ const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() );
+ OUStringBuffer sTmp2;
+ convertValue( eAttributeName, sTmp, pValuePair->First );
+ sTmp.append( (sal_Unicode)',' );
+ convertValue( eAttributeName, sTmp2, pValuePair->Second );
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ else if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
+ const sal_Int32 nLength = pSequence->getLength();
+ sal_Int32 nElement;
+ const Any* pAny = pSequence->getConstArray();
+
+ OUStringBuffer sTmp2;
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+ convertValue( eAttributeName, sTmp2, *pAny );
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ }
+ else
+ {
+ OUString aString;
+ sal_Int32 nType;
+
+ switch( eAttributeName )
+ {
+ case XML_X:
+ case XML_Y:
+ case XML_WIDTH:
+ case XML_HEIGHT:
+ case XML_ANIMATETRANSFORM:
+ case XML_ANIMATEMOTION:
+ {
+ if( rValue >>= aString )
+ {
+ /*
+ const sal_Char* pSource[] = { "$X", "$Y", "$Width", "$Height", NULL };
+ const sal_Char* pDest[] = { "$x", "$y", "$width", "$height", NULL };
+ const sal_Int32 nLength[] = { 2, 2, 6, 7, 0 };
+
+ sal_Int32 nIndex = 0;
+ while( (nIndex = aString.indexOf( (sal_Unicode)'$', nIndex )) != -1 )
+ {
+ const sal_Char** ps = pSource;
+ const sal_Char** pd = pDest;
+ const sal_Int32* pl = nLength;
+
+ while( *ps )
+ {
+ if( aString.matchAsciiL( *ps, *pl, nIndex ) )
+ {
+ const OUString aNew( OUString::createFromAscii( *pd ) );
+ aString = aString.replaceAt( nIndex, *pl, aNew );
+ nIndex += aNew.getLength();
+ break;
+ }
+
+ ps++;
+ pd++;
+ pl++;
+ }
+
+ if( *ps == 0 )
+ nIndex++;
+ }
+ */
+ sTmp.append( aString );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const double*)0) )
+ {
+ sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
+ }
+ else
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::convertValue(), invalid value type!" );
+ }
+ return;
+ }
+
+ case XML_SKEWX:
+ case XML_ROTATE: nType = XML_TYPE_DOUBLE; break;
+ case XML_TEXT_ROTATION_ANGLE: nType = XML_TYPE_NUMBER16; break;
+ case XML_FILL_COLOR:
+ case XML_STROKE_COLOR:
+ case XML_DIM:
+ case XML_COLOR: nType = XML_TYPE_COLOR; break;
+ case XML_FILL: nType = XML_SD_TYPE_FILLSTYLE; break;
+ case XML_STROKE: nType = XML_SD_TYPE_STROKE; break;
+ case XML_FONT_WEIGHT: nType = XML_TYPE_TEXT_WEIGHT; break;
+ case XML_FONT_STYLE: nType = XML_TYPE_TEXT_POSTURE; break;
+ case XML_TEXT_UNDERLINE: nType = XML_TYPE_TEXT_UNDERLINE_STYLE; break;
+ case XML_FONT_SIZE: nType = XML_TYPE_DOUBLE_PERCENT; break;
+ case XML_VISIBILITY: nType = XML_SD_TYPE_PRESPAGE_VISIBILITY; break;
+ case XML_OPACITY:
+ case XML_TRANSITIONFILTER: nType = XML_TYPE_DOUBLE; break;
+ default:
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::convertValue(), invalid AttributeName!" );
+ nType = XML_TYPE_STRING;
+ }
+
+ const XMLPropertyHandler* pHandler = static_cast<SdXMLExport*>(&mrExport)->GetSdPropHdlFactory()->GetPropertyHandler( nType );
+ if( pHandler )
+ {
+ pHandler->exportXML( aString, rValue, mrExport.GetMM100UnitConverter() );
+ sTmp.append( aString );
+ }
+ }
+
+/*
+ if( rValue.getValueType() == ::getCppuType((const double*)0) )
+ {
+ sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
+ {
+ sTmp.append( *(static_cast< const OUString* >( rValue.getValue() )) );
+ }
+ else
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::convertValue(), invalid value type!" );
+ }
+*/
+}
+
+void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rValue )
+{
+ if( !rValue.hasValue() )
+ return;
+
+ if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
+ const sal_Int32 nLength = pSequence->getLength();
+ sal_Int32 nElement;
+ const Any* pAny = pSequence->getConstArray();
+
+ OUStringBuffer sTmp2;
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ {
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)';' );
+ convertTiming( sTmp2, *pAny );
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ }
+ else if( rValue.getValueType() == ::getCppuType((const double*)0) )
+ {
+ sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
+ sTmp.append( sal_Unicode('s'));
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Timing*)0) )
+ {
+ const Timing* pTiming = static_cast< const Timing* >( rValue.getValue() );
+ sTmp.append( GetXMLToken( (*pTiming == Timing_MEDIA) ? XML_MEDIA : XML_INDEFINITE ) );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Event*)0) )
+ {
+ OUStringBuffer sTmp2;
+
+ const Event* pEvent = static_cast< const Event* >( rValue.getValue() );
+
+ if( pEvent->Trigger != EventTrigger::NONE )
+ {
+ if( pEvent->Source.hasValue() )
+ {
+ convertSource( sTmp, pEvent->Source );
+ sTmp.append( (sal_Unicode)'.' );
+ }
+
+ SvXMLUnitConverter::convertEnum( sTmp2, (USHORT)pEvent->Trigger, getAnimationsEnumMap(Animations_EnumMap_EventTrigger) );
+
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+
+ if( pEvent->Offset.hasValue() )
+ {
+ convertTiming( sTmp2, pEvent->Offset );
+
+ if( sTmp.getLength() )
+ sTmp.append( (sal_Unicode)'+' );
+
+ sTmp.append( sTmp2.makeStringAndClear() );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "xmloff::AnimationsExporterImpl::convertTiming(), invalid value type!" );
+ }
+}
+
+void AnimationsExporterImpl::convertSource( OUStringBuffer& sTmp, const Any& rSource )
+{
+ convertTarget( sTmp, rSource );
+}
+
+void AnimationsExporterImpl::convertTarget( OUStringBuffer& sTmp, const Any& rTarget )
+{
+ if( !rTarget.hasValue() )
+ return;
+
+ Reference< XInterface > xRef;
+
+ if( rTarget.getValueTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE )
+ {
+ rTarget >>= xRef;
+ }
+ else if( rTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ xRef = getParagraphTarget( static_cast< const ParagraphTarget* >( rTarget.getValue() ) );
+ }
+
+ DBG_ASSERT( xRef.is(), "xmloff::AnimationsExporterImpl::convertTarget(), invalid target type!" );
+ if( xRef.is() )
+ {
+ const OUString& rIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier(xRef);
+ if( rIdentifier.getLength() )
+ sTmp.append( rIdentifier );
+ }
+}
+
+void AnimationsExporterImpl::prepareValue( const Any& rValue )
+{
+ if( !rValue.hasValue() )
+ return;
+
+ if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
+ {
+ const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() );
+ prepareValue( pValuePair->First );
+ prepareValue( pValuePair->Second );
+ }
+ else if( rValue.getValueType() == ::getCppuType((Sequence<Any>*)0) )
+ {
+ const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
+ const sal_Int32 nLength = pSequence->getLength();
+ sal_Int32 nElement;
+ const Any* pAny = pSequence->getConstArray();
+
+ for( nElement = 0; nElement < nLength; nElement++, pAny++ )
+ prepareValue( *pAny );
+ }
+ else if( rValue.getValueTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE )
+ {
+ Reference< XInterface> xRef( rValue, UNO_QUERY );
+ if( xRef.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xRef );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
+ {
+ Reference< XInterface> xRef( getParagraphTarget( static_cast< const ParagraphTarget* >( rValue.getValue() ) ) );
+ if( xRef.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xRef );
+ }
+ else if( rValue.getValueType() == ::getCppuType((const Event*)0) )
+ {
+ const Event* pEvent = static_cast< const Event* >( rValue.getValue() );
+ prepareValue( pEvent->Source );
+ }
+}
+
+AnimationsExporter::AnimationsExporter( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
+{
+ mpImpl = new AnimationsExporterImpl( rExport, xPageProps );
+}
+
+AnimationsExporter::~AnimationsExporter()
+{
+ delete mpImpl;
+}
+
+void AnimationsExporter::prepare( Reference< XAnimationNode > xRootNode )
+{
+ try
+ {
+ if( xRootNode.is() )
+ {
+ mpImpl->prepareTransitionNode();
+ mpImpl->prepareNode( xRootNode );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporter::prepare(), exception catched" );
+ }
+}
+
+void AnimationsExporter::exportAnimations( Reference< XAnimationNode > xRootNode )
+{
+ try
+ {
+ if( xRootNode.is() )
+ {
+ bool bHasEffects = mpImpl->mbHasTransition;
+
+ if( !bHasEffects )
+ {
+ // first check if there are no animations
+ Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ if( xEnumeration->hasMoreElements() )
+ {
+ // first child node may be an empty main sequence, check this
+ Reference< XAnimationNode > xMainNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ Reference< XEnumerationAccess > xMainEnumerationAccess( xMainNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xMainEnumeration( xMainEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+
+ // only export if the main sequence is not empty or if there are additional
+ // trigger sequences
+ bHasEffects = xMainEnumeration->hasMoreElements() || xEnumeration->hasMoreElements();
+ }
+ }
+
+ if( bHasEffects )
+ mpImpl->exportNode( xRootNode );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsExporter::exportAnimations(), exception catched" );
+ }
+}
+
+}
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
new file mode 100644
index 000000000000..17bba5170c79
--- /dev/null
+++ b/xmloff/source/draw/animationimport.cxx
@@ -0,0 +1,1523 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <tools/time.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XCommand.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/animations/ValuePair.hpp>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+#include <com/sun/star/presentation/EffectPresetClass.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <list>
+#include <xmloff/xmltypes.hxx>
+#include "sdpropls.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <osl/mutex.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "anim.hxx"
+
+#include "animations.hxx"
+#include "animationimport.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::animations;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::drawing;
+using namespace ::xmloff::token;
+
+using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::text::XTextRange;
+using ::com::sun::star::text::XTextCursor;
+using ::com::sun::star::text::XTextRangeCompare;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::lang::XInitialization;
+
+namespace xmloff
+{
+
+///////////////////////////////////////////////////////////////////////
+
+
+
+///////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////
+
+class AnimationsImportHelperImpl
+{
+private:
+ SvXMLImport& mrImport;
+
+ SvXMLTokenMap* mpAnimationNodeTokenMap;
+ SvXMLTokenMap* mpAnimationNodeAttributeTokenMap;
+
+public:
+ AnimationsImportHelperImpl( SvXMLImport& rImport );
+ ~AnimationsImportHelperImpl();
+
+ const SvXMLTokenMap& getAnimationNodeTokenMap();
+ const SvXMLTokenMap& getAnimationNodeAttributeTokenMap();
+
+ Any convertValue( XMLTokenEnum eAttributeName, const OUString& rValue );
+ Sequence< Any > convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue );
+
+ Any convertTarget( const OUString& rValue );
+ Any convertPath( const OUString& rValue );
+ Any convertTiming( const OUString& rValue );
+ Sequence< double > convertKeyTimes( const OUString& rValue );
+ Sequence< TimeFilterPair > convertTimeFilter( const OUString& rValue );
+
+ bool convertAnimationValue( XMLTokenEnum eAttributeName, Any& rValue );
+ const OUString mastrHSL;
+};
+
+AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport& rImport )
+: mrImport( rImport ),
+ mpAnimationNodeTokenMap( NULL ),
+ mpAnimationNodeAttributeTokenMap( NULL ),
+ mastrHSL( RTL_CONSTASCII_USTRINGPARAM( "hsl" ) )
+{
+}
+
+AnimationsImportHelperImpl::~AnimationsImportHelperImpl()
+{
+ delete mpAnimationNodeTokenMap;
+ delete mpAnimationNodeAttributeTokenMap;
+}
+
+const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeTokenMap()
+{
+ if( mpAnimationNodeTokenMap == NULL )
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aAnimationNodeTokenMap[] =
+ {
+ { XML_NAMESPACE_ANIMATION, XML_PAR, (sal_uInt16)AnimationNodeType::PAR },
+ { XML_NAMESPACE_ANIMATION, XML_SEQ, (sal_uInt16)AnimationNodeType::SEQ },
+ { XML_NAMESPACE_ANIMATION, XML_ITERATE, (sal_uInt16)AnimationNodeType::ITERATE },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATE, (sal_uInt16)AnimationNodeType::ANIMATE },
+ { XML_NAMESPACE_ANIMATION, XML_SET, (sal_uInt16)AnimationNodeType::SET },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATEMOTION, (sal_uInt16)AnimationNodeType::ANIMATEMOTION },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATECOLOR, (sal_uInt16)AnimationNodeType::ANIMATECOLOR },
+ { XML_NAMESPACE_ANIMATION, XML_ANIMATETRANSFORM, (sal_uInt16)AnimationNodeType::ANIMATETRANSFORM },
+ { XML_NAMESPACE_ANIMATION, XML_TRANSITIONFILTER, (sal_uInt16)AnimationNodeType::TRANSITIONFILTER },
+ { XML_NAMESPACE_ANIMATION, XML_AUDIO, (sal_uInt16)AnimationNodeType::AUDIO },
+ { XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)AnimationNodeType::COMMAND },
+ XML_TOKEN_MAP_END
+ };
+
+ mpAnimationNodeTokenMap = new SvXMLTokenMap( aAnimationNodeTokenMap );
+ }
+
+ return *mpAnimationNodeTokenMap;
+}
+
+enum AnimationNodeAttributes
+{
+ ANA_Begin,
+ ANA_Dur,
+ ANA_End,
+ ANA_Fill,
+ ANA_FillDefault,
+ ANA_Restart,
+ ANA_RestartDefault,
+ ANA_Accelerate,
+ ANA_Decelerate,
+ ANA_AutoReverse,
+ ANA_RepeatCount,
+ ANA_RepeatDur,
+ ANA_EndSync,
+ ANA_Node_Type,
+ ANA_Preset_ID,
+ ANA_Preset_Sub_Type,
+ ANA_Preset_Class,
+ ANA_After_Effect,
+ ANA_Target,
+ ANA_XLink,
+ ANA_MasterElement,
+ ANA_SubItem,
+ ANA_AttributeName,
+ ANA_Values,
+ ANA_From,
+ ANA_By,
+ ANA_To,
+ ANA_KeyTimes,
+ ANA_CalcMode,
+ ANA_Accumulate,
+ ANA_AdditiveMode,
+ ANA_KeySplines,
+ ANA_Path,
+ ANA_ColorSpace,
+ ANA_ColorDirection,
+ ANA_TransformType,
+ ANA_TransitionType,
+ ANA_TransitionSubType,
+ ANA_Mode,
+ ANA_Direction,
+ ANA_FadeColor,
+ ANA_IterateType,
+ ANA_IterateInterval,
+ ANA_Formula,
+ ANA_ANIMID,
+ ANA_XMLID,
+ ANA_Group_Id,
+ ANA_Command,
+ ANA_Volume
+};
+
+const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenMap()
+{
+ if( mpAnimationNodeAttributeTokenMap == NULL )
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aAnimationNodeAttributeTokenMap[] =
+ {
+ { XML_NAMESPACE_SMIL, XML_BEGIN, (sal_uInt16)ANA_Begin },
+ { XML_NAMESPACE_SMIL, XML_DUR, (sal_uInt16)ANA_Dur },
+ { XML_NAMESPACE_SMIL, XML_END, (sal_uInt16)ANA_End },
+ { XML_NAMESPACE_SMIL, XML_FILL, (sal_uInt16)ANA_Fill },
+ { XML_NAMESPACE_SMIL, XML_FILLDEFAULT, (sal_uInt16)ANA_FillDefault },
+ { XML_NAMESPACE_SMIL, XML_RESTART, (sal_uInt16)ANA_Restart },
+ { XML_NAMESPACE_SMIL, XML_RESTARTDEFAULT, (sal_uInt16)ANA_RestartDefault },
+ { XML_NAMESPACE_SMIL, XML_ACCELERATE, (sal_uInt16)ANA_Accelerate },
+ { XML_NAMESPACE_SMIL, XML_DECELERATE, (sal_uInt16)ANA_Decelerate },
+ { XML_NAMESPACE_SMIL, XML_AUTOREVERSE, (sal_uInt16)ANA_AutoReverse },
+ { XML_NAMESPACE_SMIL, XML_REPEATCOUNT, (sal_uInt16)ANA_RepeatCount },
+ { XML_NAMESPACE_SMIL, XML_REPEATDUR, (sal_uInt16)ANA_RepeatDur },
+ { XML_NAMESPACE_SMIL, XML_ENDSYNC, (sal_uInt16)ANA_EndSync },
+ { XML_NAMESPACE_PRESENTATION, XML_NODE_TYPE, (sal_uInt16)ANA_Node_Type },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESET_ID, (sal_uInt16)ANA_Preset_ID },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESET_SUB_TYPE, (sal_uInt16)ANA_Preset_Sub_Type },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESET_CLASS, (sal_uInt16)ANA_Preset_Class },
+ { XML_NAMESPACE_PRESENTATION, XML_AFTER_EFFECT, (sal_uInt16)ANA_After_Effect },
+ { XML_NAMESPACE_SMIL, XML_TARGETELEMENT, (sal_uInt16)ANA_Target },
+ { XML_NAMESPACE_XLINK, XML_HREF, (sal_uInt16)ANA_XLink },
+ { XML_NAMESPACE_PRESENTATION, XML_MASTER_ELEMENT, (sal_uInt16)ANA_MasterElement },
+ { XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, (sal_uInt16)ANA_SubItem },
+ { XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, (sal_uInt16)ANA_AttributeName },
+ { XML_NAMESPACE_SMIL, XML_VALUES, (sal_uInt16)ANA_Values },
+ { XML_NAMESPACE_SMIL, XML_FROM, (sal_uInt16)ANA_From },
+ { XML_NAMESPACE_SMIL, XML_BY, (sal_uInt16)ANA_By },
+ { XML_NAMESPACE_SMIL, XML_TO, (sal_uInt16)ANA_To },
+ { XML_NAMESPACE_SMIL, XML_KEYTIMES, (sal_uInt16)ANA_KeyTimes },
+ { XML_NAMESPACE_SMIL, XML_CALCMODE, (sal_uInt16)ANA_CalcMode },
+ { XML_NAMESPACE_SMIL, XML_ACCUMULATE, (sal_uInt16)ANA_Accumulate },
+ { XML_NAMESPACE_PRESENTATION, XML_ADDITIVE, (sal_uInt16)ANA_AdditiveMode },
+ { XML_NAMESPACE_SMIL, XML_ADDITIVE, (sal_uInt16)ANA_AdditiveMode },
+ { XML_NAMESPACE_SMIL, XML_KEYSPLINES, (sal_uInt16)ANA_KeySplines },
+ { XML_NAMESPACE_SVG, XML_PATH, (sal_uInt16)ANA_Path },
+ { XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION, (sal_uInt16)ANA_ColorSpace },
+ { XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION_DIRECTION, (sal_uInt16)ANA_ColorDirection },
+ { XML_NAMESPACE_SVG, XML_TYPE, (sal_uInt16)ANA_TransformType },
+ { XML_NAMESPACE_SMIL, XML_TYPE, (sal_uInt16)ANA_TransitionType },
+ { XML_NAMESPACE_SMIL, XML_SUBTYPE, (sal_uInt16)ANA_TransitionSubType },
+ { XML_NAMESPACE_SMIL, XML_MODE, (sal_uInt16)ANA_Mode },
+ { XML_NAMESPACE_SMIL, XML_DIRECTION, (sal_uInt16)ANA_Direction },
+ { XML_NAMESPACE_SMIL, XML_FADECOLOR, (sal_uInt16)ANA_FadeColor },
+ { XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, (sal_uInt16)ANA_IterateType },
+ { XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, (sal_uInt16)ANA_IterateInterval },
+ { XML_NAMESPACE_ANIMATION, XML_FORMULA, (sal_uInt16)ANA_Formula },
+ { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ANIMID },
+ { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_XMLID },
+ { XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, (sal_uInt16)ANA_Group_Id },
+ { XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, (sal_uInt16)ANA_Volume },
+ { XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)ANA_Command },
+
+ XML_TOKEN_MAP_END
+ };
+
+ mpAnimationNodeAttributeTokenMap = new SvXMLTokenMap( aAnimationNodeAttributeTokenMap );
+ }
+
+ return *mpAnimationNodeAttributeTokenMap;
+}
+
+static bool isDouble( const OUString& rValue )
+{
+ sal_Int32 nLength = rValue.getLength();
+ const sal_Unicode * pStr = rValue.getStr();
+ while( nLength )
+ {
+ if( (*pStr >= '0' && *pStr <= '9') || *pStr == '-' || *pStr == '.' || *pStr == '+' || *pStr == 'e' || *pStr == 'E' )
+ {
+ pStr++;
+ nLength--;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+static bool isTime( const OUString& rValue )
+{
+ sal_Int32 nLength = rValue.getLength();
+ const sal_Unicode * pStr;
+ for( pStr = rValue.getStr(); nLength; pStr++, nLength-- )
+ {
+ if( !( (*pStr >= '0' && *pStr <= '9') || *pStr == '-' || *pStr == '.' || *pStr == '+' || *pStr == 'e' || *pStr == 'E' ) )
+ break;
+ }
+
+ // return true if this is a double (if someone forgot the 's' we silently ignore it)
+ // or if its a double that ends with a 's' or 'S'
+ return (nLength == 0) || ((*pStr == 's' || *pStr == 'S') && (nLength == 1));
+}
+
+static sal_Int32 count_codes( const OUString& rString, sal_Unicode nCode )
+{
+ sal_Int32 nCount = 0;
+ sal_Int32 fromIndex = 0;
+
+ while(true)
+ {
+ fromIndex = rString.indexOf( nCode, fromIndex );
+ if( fromIndex == -1 )
+ break;
+
+ fromIndex++;
+ nCount++;
+ }
+
+ return nCount;
+}
+
+Any AnimationsImportHelperImpl::convertTarget( const OUString& rValue )
+{
+ try
+ {
+ Reference< XInterface > xRef( mrImport.getInterfaceToIdentifierMapper().getReference( rValue ) );
+
+ Reference< XShape > _xShape( xRef, UNO_QUERY );
+ if( _xShape.is() )
+ return makeAny( _xShape );
+
+ Reference< XTextCursor > xTextCursor( xRef, UNO_QUERY );
+ if( xTextCursor.is() )
+ {
+ Reference< XTextRange > xStart( xTextCursor->getStart() ), xRange;
+ Reference< XShape > xShape( xTextCursor->getText(), UNO_QUERY_THROW );
+ Reference< XTextRangeCompare > xTextRangeCompare( xShape, UNO_QUERY_THROW );
+
+ Reference< XEnumerationAccess > xParaEnumAccess( xShape, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
+ sal_Int16 nParagraph = 0;
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ xEnumeration->nextElement() >>= xRange;
+
+ // break if start of selection is prior to end of current paragraph
+ if( xRange.is() && (xTextRangeCompare->compareRegionEnds( xStart, xRange ) >= 0 ) )
+ {
+ return makeAny( ParagraphTarget( xShape, nParagraph ) );
+ }
+
+ nParagraph++;
+ }
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsImportImpl::convertTarget(), RuntimeException catched!" );
+ }
+
+ Any aAny;
+ return aAny;
+}
+
+Any AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName, const OUString& rValue )
+{
+ sal_Int32 nCommaPos = -1, nPos;
+ sal_Int32 nOpenBrakets = 0;
+ for( nPos = 0; (nPos < rValue.getLength()) && (nCommaPos == -1); nPos++ )
+ {
+ switch( rValue[nPos] )
+ {
+ case ',':
+ if( nOpenBrakets == 0 )
+ nCommaPos = nPos;
+ break;
+ case '(':
+ case '[':
+ case '{':
+ nOpenBrakets++;
+ break;
+ case ')':
+ case ']':
+ case '}':
+ nOpenBrakets--;
+ break;
+ }
+ }
+
+ if( nCommaPos >= 0 )
+ {
+ ValuePair aPair;
+ aPair.First = convertValue( eAttributeName, rValue.copy( 0, nCommaPos ) );
+ aPair.Second = convertValue( eAttributeName, rValue.copy( nCommaPos+1, rValue.getLength() - nCommaPos - 1 ) );
+ return makeAny( aPair );
+ }
+ else
+ {
+ Any aAny;
+ sal_Int32 nType = XML_TYPE_STRING;
+
+ if( rValue.getLength() ) switch( eAttributeName )
+ {
+ case XML_X:
+ case XML_Y:
+ case XML_WIDTH:
+ case XML_HEIGHT:
+ case XML_TRANSLATE:
+ {
+ return makeAny( rValue );
+ }
+
+ case XML_SCALE:
+ case XML_SKEWY:
+ case XML_SKEWX:
+ case XML_OPACITY:
+ case XML_ROTATE: nType = XML_TYPE_DOUBLE; break;
+ case XML_TEXT_ROTATION_ANGLE:nType = XML_TYPE_TEXT_ROTATION_ANGLE; break;
+ case XML_FILL_COLOR:
+ case XML_STROKE_COLOR:
+ case XML_DIM:
+ case XML_COLOR: nType = XML_TYPE_COLOR; break;
+ case XML_FILL: nType = XML_SD_TYPE_FILLSTYLE; break;
+ case XML_STROKE: nType = XML_SD_TYPE_STROKE; break;
+ case XML_FONT_WEIGHT: nType = XML_TYPE_TEXT_WEIGHT; break;
+ case XML_FONT_STYLE: nType = XML_TYPE_TEXT_POSTURE; break;
+ case XML_TEXT_UNDERLINE: nType = XML_TYPE_TEXT_UNDERLINE_STYLE; break;
+ case XML_FONT_SIZE: nType = XML_TYPE_DOUBLE_PERCENT; break;
+ case XML_VISIBILITY: nType = XML_SD_TYPE_PRESPAGE_VISIBILITY; break;
+
+ default:
+ if( rValue.getLength() )
+ aAny <<= rValue;
+ return aAny;
+ }
+
+ const XMLPropertyHandler* pHandler = mrImport.GetShapeImport()->GetSdPropHdlFactory()->GetPropertyHandler( nType );
+ if( pHandler )
+ pHandler->importXML( rValue, aAny, mrImport.GetMM100UnitConverter() );
+
+ return aAny;
+
+/*
+ if( rValue.getLength() == 0 )
+ {
+ Any aAny;
+ return aAny;
+ }
+ else if( rValue.indexOf( '#' ) == 0 )
+ {
+ // color
+ Color aColor;
+ SvXMLUnitConverter::convertColor( aColor, rValue );
+
+ return makeAny( static_cast< sal_Int32 >( aColor.GetRGBColor() ) );
+ }
+ else if( rValue.indexOf( '$' ) != -1 )
+ {
+ // formula
+ return makeAny( rValue );
+ }
+ else
+ {
+ if( isDouble( rValue ) )
+ {
+ return makeAny( rValue.toDouble() );
+ }
+ else
+ {
+ return makeAny( rValue );
+ }
+ }
+*/
+ }
+}
+
+Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue )
+{
+ Sequence< Any > aValues;
+
+ // do we have any value at all?
+ if( rValue.getLength() )
+ {
+ sal_Int32 nElements = count_codes( rValue, (sal_Unicode)';') + 1; // a non empty string has at least one value
+
+ // prepare the sequence
+ aValues.realloc( nElements );
+
+ // fill the sequence
+ Any* pValues = aValues.getArray();
+ sal_Int32 nIndex, nElement;
+ for( nIndex = 0, nElement = 0; nElements && (nIndex >= 0); nElements-- )
+ {
+ *pValues++ = convertValue( eAttributeName, rValue.getToken( 0, ';', nIndex ) );
+ }
+ }
+
+ return aValues;
+}
+
+Any AnimationsImportHelperImpl::convertTiming( const OUString& rValue )
+{
+ Any aAny;
+
+ // do we have any value at all?
+ if( rValue.getLength() )
+ {
+ // count the values
+ sal_Int32 nElements = count_codes( rValue, (sal_Unicode)';' ) + 1; // a non empty string has at least one value
+
+ if( nElements == 1 )
+ {
+ if( IsXMLToken( rValue, XML_MEDIA ) )
+ {
+ aAny <<= Timing_MEDIA;
+ }
+ else if( IsXMLToken( rValue, XML_INDEFINITE ) )
+ {
+ aAny <<= Timing_INDEFINITE;
+ }
+ else if( isTime( rValue ) )
+ {
+ aAny <<= rValue.toDouble();
+ }
+ else
+ {
+ Event aEvent;
+ aEvent.Repeat = 0;
+ aEvent.Trigger = 0;
+
+ OUString aEventTrigger;
+
+ sal_Int32 nPos = rValue.indexOf( (sal_Unicode)'+' );
+ if( nPos == -1 )
+ {
+ aEventTrigger = rValue;
+ }
+ else
+ {
+ aEventTrigger = rValue.copy( 0, nPos );
+
+ // convert offset
+ aEvent.Offset <<= convertTiming( rValue.copy( nPos + 1 ) );
+ }
+
+ nPos = aEventTrigger.indexOf( (sal_Unicode)'.' );
+ if( nPos != -1 )
+ {
+ aEvent.Source <<= mrImport.getInterfaceToIdentifierMapper().getReference( aEventTrigger.copy( 0, nPos ) );
+ aEventTrigger = aEventTrigger.copy( nPos + 1 );
+ }
+
+ sal_uInt16 nEnum;
+ if( SvXMLUnitConverter::convertEnum( nEnum, aEventTrigger, getAnimationsEnumMap(Animations_EnumMap_EventTrigger) ) )
+ {
+ aEvent.Trigger = (sal_Int16)nEnum;
+ }
+ else
+ {
+ DBG_ERROR("AnimationsImportHelperImpl::convertTiming(), unknown event trigger!");
+ }
+
+ aAny <<= aEvent;
+ }
+ }
+ else
+ {
+ // fill the sequence
+ Sequence< Any > aValues( nElements );
+ Any* pValues = aValues.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ *pValues++ = convertTiming( rValue.getToken( 0, ';', nIndex ) );
+
+ aAny <<= aValues;
+ }
+ }
+ return aAny;
+}
+
+Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( const OUString& rValue )
+{
+ sal_Int32 nElements = 0;
+
+ if( rValue.getLength() )
+ nElements = count_codes( rValue, (sal_Unicode)';' ) + 1; // a non empty string has at least one value
+
+ Sequence< double > aKeyTimes( nElements );
+
+ if( nElements )
+ {
+ double* pValues = aKeyTimes.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ *pValues++ = rValue.getToken( 0, ';', nIndex ).toDouble();
+ }
+
+ return aKeyTimes;
+}
+
+Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const OUString& rValue )
+{
+ sal_Int32 nElements = 0;
+
+ if( rValue.getLength() )
+ nElements = count_codes( rValue, (sal_Unicode)';' ) + 1; // a non empty string has at least one value
+
+ Sequence< TimeFilterPair > aTimeFilter( nElements );
+
+ if( nElements )
+ {
+ TimeFilterPair* pValues = aTimeFilter.getArray();
+ sal_Int32 nIndex = 0;
+ while( (nElements--) && (nIndex >= 0) )
+ {
+ const OUString aToken( rValue.getToken( 0, ';', nIndex ) );
+
+ sal_Int32 nPos = aToken.indexOf( ',' );
+ if( nPos >= 0 )
+ {
+ pValues->Time = aToken.copy( 0, nPos ).toDouble();
+ pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
+ }
+ pValues++;
+ }
+ }
+
+ return aTimeFilter;
+}
+
+Any AnimationsImportHelperImpl::convertPath( const OUString& rValue )
+{
+ return makeAny( rValue );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( AnimationNodeContext, SvXMLImportContext );
+
+AnimationNodeContext::AnimationNodeContext(
+ const Reference< XAnimationNode >& xParentNode,
+ SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ AnimationsImportHelperImpl* pHelper /* = NULL */ )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpHelper( pHelper ),
+ mbRootContext( pHelper == NULL )
+{
+ try
+ {
+ if( mbRootContext )
+ {
+ mpHelper = new AnimationsImportHelperImpl( rImport );
+ mxNode = xParentNode;
+ }
+ else
+ {
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ sal_Int16 nPresetClass = EffectPresetClass::CUSTOM;
+
+ const sal_Char* pServiceName = 0;
+
+ sal_Int16 nNodeType = (sal_Int16)mpHelper->getAnimationNodeTokenMap().Get( nPrfx, rLocalName );
+ switch( nNodeType )
+ {
+ case AnimationNodeType::SEQ: pServiceName = "com.sun.star.animations.SequenceTimeContainer"; break;
+ case AnimationNodeType::ITERATE: pServiceName = "com.sun.star.animations.IterateContainer"; break;
+ case AnimationNodeType::ANIMATE: pServiceName = "com.sun.star.animations.Animate"; break;
+ case AnimationNodeType::SET: pServiceName = "com.sun.star.animations.AnimateSet"; break;
+ case AnimationNodeType::ANIMATEMOTION: pServiceName = "com.sun.star.animations.AnimateMotion"; break;
+ case AnimationNodeType::ANIMATECOLOR: pServiceName = "com.sun.star.animations.AnimateColor"; break;
+ case AnimationNodeType::ANIMATETRANSFORM: pServiceName = "com.sun.star.animations.AnimateTransform"; break;
+ case AnimationNodeType::TRANSITIONFILTER: pServiceName = "com.sun.star.animations.TransitionFilter"; break;
+ case AnimationNodeType::AUDIO: pServiceName = "com.sun.star.animations.Audio"; break;
+ case AnimationNodeType::COMMAND: pServiceName = "com.sun.star.animations.Command"; break;
+ case AnimationNodeType::PAR:
+ {
+ const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_Int16 nAttribute;
+ for( nAttribute = 0; nAttribute < nCount; nAttribute++ )
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttribute ), &aLocalName );
+ if( (nPrefix == XML_NAMESPACE_PRESENTATION) && IsXMLToken( aLocalName, XML_PRESET_ID ) )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( nAttribute );
+ if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ooo-entrance-random" ) ) )
+ {
+ nPresetClass = EffectPresetClass::ENTRANCE;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ooo-exit-random" ) ) )
+ {
+ nPresetClass = EffectPresetClass::EXIT;
+ }
+
+ if( nPresetClass != EffectPresetClass::CUSTOM )
+ {
+ pServiceName = "com.sun.star.comp.sd.RandomAnimationNode";
+ break;
+ }
+ }
+ }
+ if( !pServiceName )
+ pServiceName = "com.sun.star.animations.ParallelTimeContainer";
+ }
+ break;
+ default:
+ pServiceName = 0;
+ }
+
+ if( pServiceName && xFactory.is() )
+ {
+ mxNode = Reference< XAnimationNode >( xFactory->createInstance(
+ OUString::createFromAscii(pServiceName) ), UNO_QUERY_THROW );
+
+ if( nPresetClass != EffectPresetClass::CUSTOM )
+ {
+ Reference< XInitialization > xInit( mxNode, UNO_QUERY_THROW );
+ const Any aAny( makeAny( nPresetClass ) );
+ Sequence< Any > aArgs( &aAny, 1 ) ;
+ xInit->initialize( aArgs );
+ }
+
+ init_node( xAttrList );
+
+ Reference< XTimeContainer > xParentContainer( xParentNode, UNO_QUERY_THROW );
+ xParentContainer->appendChild( mxNode );
+ }
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationsImportImpl::AnimationsImportImpl(), RuntimeException catched!" );
+ }
+}
+
+AnimationNodeContext::~AnimationNodeContext()
+{
+ if( mbRootContext )
+ delete mpHelper;
+}
+
+void AnimationNodeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ // code of StartElement is moved to init_node that is now called
+ // in c'tor before appending this node to its parent.
+ // This is needed for random nodes that need the correct target
+ // set when child nodes are appended.
+}
+
+void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ if( mxNode.is() ) try
+ {
+ const sal_Int16 nNodeType = mxNode->getType();
+
+ // query for optional interfaces that are often used later
+ Reference< XAnimate > xAnimate( mxNode, UNO_QUERY );
+ Reference< XCommand > xCommand( mxNode, UNO_QUERY );
+ Reference< XTransitionFilter > xTransitionFilter( mxNode, UNO_QUERY );
+ Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+
+ std::list< NamedValue > aUserData;
+ XMLTokenEnum meAttributeName = XML_TOKEN_INVALID;
+ OUString aFrom, aBy, aTo, aValues;
+ bool bHaveXmlId( false );
+ OUString sXmlId;
+
+ const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ sal_uInt16 nEnum;
+ sal_Int16 nAttribute;
+ for( nAttribute = 0; nAttribute < nCount; nAttribute++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( nAttribute );
+ const OUString& rValue = xAttrList->getValueByIndex( nAttribute );
+
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ switch( mpHelper->getAnimationNodeAttributeTokenMap().Get( nPrefix, aLocalName ) )
+ {
+ case ANA_Begin:
+ {
+ mxNode->setBegin( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_Dur:
+ {
+ mxNode->setDuration( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_End:
+ {
+ mxNode->setEnd( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_Fill:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Fill) ) )
+ mxNode->setFill( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_FillDefault:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_FillDefault) ) )
+ mxNode->setFillDefault( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_Restart:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Restart) ) )
+ mxNode->setRestart( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_RestartDefault:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_RestartDefault) ) )
+ mxNode->setRestartDefault( (sal_Int16)nEnum );
+ }
+ break;
+ case ANA_Accelerate:
+ {
+ if( isDouble( rValue ) )
+ mxNode->setAcceleration( rValue.toDouble() );
+ }
+ break;
+ case ANA_Decelerate:
+ {
+ if( isDouble( rValue ) )
+ mxNode->setDecelerate( rValue.toDouble() );
+ }
+ break;
+ case ANA_AutoReverse:
+ {
+ sal_Bool bTemp;
+ if( SvXMLUnitConverter::convertBool( bTemp, rValue ) )
+ mxNode->setAutoReverse( bTemp );
+ }
+ break;
+ case ANA_RepeatCount:
+ {
+ mxNode->setRepeatCount( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_RepeatDur:
+ {
+ mxNode->setRepeatDuration( mpHelper->convertTiming( rValue ) );
+ }
+ break;
+ case ANA_EndSync:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Endsync) ) )
+ mxNode->setEndSync( makeAny( (sal_Int16)nEnum ) );
+ }
+ break;
+ case ANA_Node_Type:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_EffectNodeType) ) )
+ aUserData.push_back( NamedValue( GetXMLToken( XML_NODE_TYPE ), makeAny( (sal_Int16)nEnum ) ) );
+ }
+ break;
+ case ANA_Preset_ID:
+ {
+ aUserData.push_back( NamedValue( GetXMLToken( XML_PRESET_ID ), makeAny( rValue ) ) );
+ }
+ break;
+ case ANA_Preset_Sub_Type:
+ {
+ aUserData.push_back( NamedValue( GetXMLToken( XML_PRESET_SUB_TYPE ), makeAny( rValue ) ) );
+ }
+ break;
+ case ANA_Preset_Class:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_EffectPresetClass) ) )
+ aUserData.push_back( NamedValue( GetXMLToken( XML_PRESET_CLASS ), makeAny( (sal_Int16)nEnum ) ) );
+ }
+ break;
+ case ANA_After_Effect:
+ {
+ sal_Bool bTemp;
+ if( SvXMLUnitConverter::convertBool( bTemp, rValue ) )
+ aUserData.push_back( NamedValue( GetXMLToken( XML_AFTER_EFFECT ), makeAny( bTemp ) ) );
+ }
+ break;
+ case ANA_XLink:
+ {
+ if( nNodeType == AnimationNodeType::AUDIO )
+ {
+ Reference< XAudio > xAudio( mxNode, UNO_QUERY_THROW );
+ xAudio->setSource( makeAny( GetImport().GetAbsoluteReference( rValue ) ) );
+ break;
+ }
+
+ }
+ // fall through intented!
+ case ANA_Target:
+ {
+ {
+ Any aTarget( mpHelper->convertTarget( rValue ) );
+
+ if( xAnimate.is() )
+ {
+ xAnimate->setTarget( aTarget );
+ }
+ else if( xIter.is() )
+ {
+ xIter->setTarget( aTarget );
+ }
+ else if( xCommand.is() )
+ {
+ xCommand->setTarget( aTarget );
+ }
+ }
+ }
+ break;
+
+ case ANA_Volume:
+ {
+ if( nNodeType == AnimationNodeType::AUDIO )
+ {
+ if( isDouble( rValue ) )
+ {
+ Reference< XAudio > xAudio( mxNode, UNO_QUERY_THROW );
+ xAudio->setVolume( rValue.toDouble() );
+ }
+ }
+ }
+ break;
+
+ case ANA_MasterElement:
+ {
+ Reference< XAnimationNode > xMaster( GetImport().getInterfaceToIdentifierMapper().getReference( rValue ), UNO_QUERY );
+ aUserData.push_back( NamedValue( GetXMLToken( XML_MASTER_ELEMENT ), makeAny( xMaster ) ) );
+ }
+ break;
+
+ case ANA_SubItem:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_SubItem) ) )
+ {
+ if( xAnimate.is() )
+ {
+ xAnimate->setSubItem( (sal_Int16)nEnum );
+ }
+ else if( xIter.is() )
+ {
+ xIter->setSubItem( (sal_Int16)nEnum );
+ }
+ }
+ }
+ break;
+
+ case ANA_AttributeName:
+ {
+ if( xAnimate.is() )
+ {
+ OUString aName( rValue );
+
+ ImplAttributeNameConversion* p = getAnimationAttributeNamesConversionList();
+ while( p->mpAPIName )
+ {
+ if( IsXMLToken( aName, p->meXMLToken ) )
+ {
+ aName = OUString::createFromAscii( p->mpAPIName );
+ meAttributeName = p->meXMLToken;
+ break;
+ }
+
+ p++;
+ }
+
+ xAnimate->setAttributeName( aName );
+ }
+ }
+ break;
+
+ case ANA_Values:
+ {
+ aValues = rValue;
+ }
+ break;
+
+ case ANA_From:
+ {
+ aFrom = rValue;
+ }
+ break;
+
+ case ANA_By:
+ {
+ aBy = rValue;
+ }
+ break;
+
+ case ANA_To:
+ {
+ aTo = rValue;
+ }
+ break;
+
+ case ANA_KeyTimes:
+ {
+ if( xAnimate.is() )
+ xAnimate->setKeyTimes( mpHelper->convertKeyTimes( rValue ) );
+ }
+ break;
+
+ case ANA_Formula:
+ {
+ if( xAnimate.is() )
+ xAnimate->setFormula( rValue );
+ }
+ break;
+
+ case ANA_ANIMID:
+ {
+ if (!bHaveXmlId) { sXmlId = rValue; }
+ }
+ break;
+ case ANA_XMLID:
+ {
+ sXmlId = rValue;
+ bHaveXmlId = true;
+ }
+ break;
+
+ case ANA_CalcMode:
+ {
+ if( xAnimate.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_CalcMode) ) )
+ xAnimate->setCalcMode( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_Accumulate:
+ {
+ if( xAnimate.is() )
+ xAnimate->setAccumulate( IsXMLToken( rValue, XML_SUM ) );
+ }
+ break;
+
+ case ANA_AdditiveMode:
+ {
+ if( xAnimate.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_AdditiveMode) ) )
+ xAnimate->setAdditive( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_KeySplines:
+ {
+ if( xAnimate.is() )
+ xAnimate->setTimeFilter( mpHelper->convertTimeFilter( rValue ) );
+ }
+ break;
+
+ case ANA_Path:
+ {
+ Reference< XAnimateMotion > xAnimateMotion( mxNode, UNO_QUERY );
+ if( xAnimateMotion.is() )
+ xAnimateMotion->setPath( mpHelper->convertPath( rValue ) );
+ }
+ break;
+
+ case ANA_ColorSpace:
+ {
+ Reference< XAnimateColor > xAnimateColor( mxNode, UNO_QUERY );
+ if( xAnimateColor.is() )
+ xAnimateColor->setColorInterpolation( IsXMLToken( rValue, XML_HSL ) ? AnimationColorSpace::HSL : AnimationColorSpace::RGB );
+ }
+ break;
+
+ case ANA_ColorDirection:
+ {
+ Reference< XAnimateColor > xAnimateColor( mxNode, UNO_QUERY );
+ if( xAnimateColor.is() )
+ xAnimateColor->setDirection( IsXMLToken( rValue, XML_CLOCKWISE ) );
+ }
+ break;
+
+ case ANA_TransformType:
+ {
+ Reference< XAnimateTransform > xTransform( mxNode, UNO_QUERY );
+ if( xTransform.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_TransformType) ) )
+ {
+ xTransform->setTransformType( (sal_Int16)nEnum );
+ switch( nEnum )
+ {
+ case AnimationTransformType::SCALE: meAttributeName = XML_SCALE; break;
+ case AnimationTransformType::ROTATE: meAttributeName = XML_ROTATE; break;
+ case AnimationTransformType::SKEWX: meAttributeName = XML_SKEWX; break;
+ case AnimationTransformType::SKEWY: meAttributeName = XML_SKEWY; break;
+ //case AnimationTransformType::TRANSLATE:
+ default:
+ meAttributeName = XML_TRANSLATE; break;
+ }
+ }
+ }
+ }
+ break;
+
+ case ANA_TransitionType:
+ {
+ if( xTransitionFilter.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_TransitionType) ) )
+ xTransitionFilter->setTransition( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_TransitionSubType:
+ {
+ if( xTransitionFilter.is() )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) ) )
+ xTransitionFilter->setSubtype( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_Mode:
+ {
+ if( xTransitionFilter.is() )
+ xTransitionFilter->setMode( IsXMLToken( rValue, XML_IN ) );
+ }
+ break;
+
+ case ANA_Direction:
+ {
+ if( xTransitionFilter.is() )
+ xTransitionFilter->setDirection( IsXMLToken( rValue, XML_FORWARD ) );
+ }
+ break;
+
+ case ANA_FadeColor:
+ {
+ if( xTransitionFilter.is() )
+ {
+ Color aColor;
+ SvXMLUnitConverter::convertColor( aColor, rValue );
+ xTransitionFilter->setFadeColor( static_cast< sal_Int32 >( aColor.GetRGBColor() ) );
+ }
+ }
+ break;
+
+ case ANA_IterateType:
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_IterateType) ) )
+ {
+ if( xIter.is() )
+ xIter->setIterateType( (sal_Int16)nEnum );
+ }
+ }
+ break;
+
+ case ANA_IterateInterval:
+ {
+ if( xIter.is() )
+ {
+ double fInterval = 0.0;
+ if( rValue.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("P")) )
+ {
+ ::Time aTime;
+ sal_Int32 nSecondsFraction = 0;
+ if( SvXMLUnitConverter::convertTimeDuration( rValue, aTime, &nSecondsFraction ) )
+ {
+ fInterval = ((((aTime.GetHour() * 60) + aTime.GetMin()) * 60) + aTime.GetSec()) + (nSecondsFraction / 1000.0);
+ }
+ }
+ else
+ {
+ fInterval = rValue.toDouble();
+ }
+
+ xIter->setIterateInterval( fInterval );
+ }
+ }
+ break;
+
+ case ANA_Group_Id:
+ {
+ aUserData.push_back( NamedValue( aLocalName, makeAny( rValue.toInt32() ) ) );
+ }
+ break;
+
+ case ANA_Command:
+ {
+ if( xCommand.is() && nNodeType == AnimationNodeType::COMMAND )
+ {
+ if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Command) ) )
+ {
+ xCommand->setCommand( (sal_Int16)nEnum );
+ }
+ }
+ }
+ break;
+
+ default:
+ // push all unknown attributes within the presentation namespace as user data
+ if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ aUserData.push_back( NamedValue( aLocalName, makeAny( rValue ) ) );
+ }
+ }
+ }
+
+ if (sXmlId.getLength())
+ {
+ Reference< XInterface > const xRef( mxNode, UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
+
+ sal_Int32 nUserDataCount = aUserData.size();
+ if( nUserDataCount )
+ {
+ Sequence< NamedValue > aUnoUserData( nUserDataCount );
+ NamedValue* pData = aUnoUserData.getArray();
+ std::list< NamedValue >::iterator aIter( aUserData.begin() );
+ const std::list< NamedValue >::iterator aEnd( aUserData.end() );
+ while( aIter != aEnd )
+ *pData++ = (*aIter++);
+
+ mxNode->setUserData( aUnoUserData );
+ }
+
+ // convert values
+ if( xAnimate.is() )
+ {
+ if( aFrom.getLength() )
+ xAnimate->setFrom( mpHelper->convertValue( meAttributeName, aFrom ) );
+
+ if( aBy.getLength() )
+ xAnimate->setBy( mpHelper->convertValue( meAttributeName, aBy ) );
+
+ if( aTo.getLength() )
+ xAnimate->setTo( mpHelper->convertValue( meAttributeName, aTo ) );
+
+ if( aValues.getLength() )
+ xAnimate->setValues( mpHelper->convertValueSequence( meAttributeName, aValues ) );
+ }
+ }
+ catch( RuntimeException& )
+ {
+ DBG_ERROR( "xmloff::AnimationNodeContext::StartElement(), RuntimeException catched!" );
+ }
+}
+
+SvXMLImportContext * AnimationNodeContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( mxNode.is())
+ return new AnimationNodeContext( mxNode, GetImport(), nPrefix, rLocalName, xAttrList, mpHelper );
+ else
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+// --------------------------------------------------------------------
+
+class AnimationsImport: public SvXMLImport, public XAnimationNodeSupplier
+{
+public:
+ AnimationsImport( const Reference< XMultiServiceFactory > & rSMgr );
+ ~AnimationsImport() throw ();
+
+ SvXMLImportContext* CreateContext(USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList);
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XAnimationNodeSupplier
+ Reference< XAnimationNode > SAL_CALL getAnimationNode() throw (RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+private:
+ Reference< XAnimationNode > mxRootNode;
+};
+
+AnimationsImport::AnimationsImport( const Reference< XMultiServiceFactory > & rSMgr )
+: SvXMLImport( rSMgr, true )
+{
+ // add namespaces
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_PRESENTATION),
+ GetXMLToken(XML_N_PRESENTATION),
+ XML_NAMESPACE_PRESENTATION);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_SMIL),
+ GetXMLToken(XML_N_SMIL),
+ XML_NAMESPACE_SMIL);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_ANIMATION),
+ GetXMLToken(XML_N_ANIMATION),
+ XML_NAMESPACE_ANIMATION);
+
+ mxRootNode = Reference< XAnimationNode >::query(rSMgr->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.SequenceTimeContainer"))));
+}
+
+AnimationsImport::~AnimationsImport() throw ()
+{
+}
+
+// XInterface
+Any SAL_CALL AnimationsImport::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ if ( aType == ::getCppuType((Reference<XAnimationNodeSupplier> *)0) )
+ {
+ return makeAny( Reference<XAnimationNodeSupplier>( this ) );
+ }
+ else
+ {
+ return SvXMLImport::queryInterface( aType );
+ }
+}
+
+void SAL_CALL AnimationsImport::acquire() throw ()
+{
+ SvXMLImport::acquire();
+}
+
+void SAL_CALL AnimationsImport::release() throw ()
+{
+ SvXMLImport::release();
+}
+
+SvXMLImportContext *AnimationsImport::CreateContext(USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( (XML_NAMESPACE_ANIMATION == nPrefix) && IsXMLToken( rLocalName, XML_SEQ ) )
+ {
+ pContext = new AnimationNodeContext( mxRootNode, *this, nPrefix, rLocalName, xAttrList );
+ }
+ else
+ {
+ pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ }
+
+ return pContext;
+}
+
+// XAnimationNodeSupplier
+Reference< XAnimationNode > SAL_CALL AnimationsImport::getAnimationNode() throw (RuntimeException)
+{
+ return mxRootNode;
+}
+
+void AnimationNodeContext::postProcessRootNode( SvXMLImport& /*rImport*/, const Reference< XAnimationNode >& xRootNode, Reference< XPropertySet >& xPageProps )
+{
+ if( xRootNode.is() && xPageProps.is() ) try
+ {
+ Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ if( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
+ if( xNode->getType() == AnimationNodeType::PAR )
+ {
+ Event aEvent;
+ if( (xNode->getBegin() >>= aEvent) && (aEvent.Trigger == EventTrigger::BEGIN_EVENT) )
+ {
+ // found transition node
+ Reference< XEnumerationAccess > xChildEnumerationAccess( xNode, UNO_QUERY_THROW );
+ Reference< XEnumeration > xChildEnumeration( xChildEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
+ while( xChildEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimationNode > xChildNode( xChildEnumeration->nextElement(), UNO_QUERY_THROW );
+ switch( xChildNode->getType() )
+ {
+ case AnimationNodeType::TRANSITIONFILTER:
+ {
+ Reference< XTransitionFilter > xTransFilter( xChildNode, UNO_QUERY_THROW );
+
+
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ), Any( xTransFilter->getTransition() ) );
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ), Any( xTransFilter->getSubtype() ) );
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDirection" ) ), Any( xTransFilter->getDirection() ) );
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionFadeColor" ) ), Any( xTransFilter->getFadeColor() ) );
+
+ double fDuration;
+ if( xTransFilter->getDuration() >>= fDuration )
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDuration" ) ), Any( fDuration ) );
+
+ }
+ break;
+
+ case AnimationNodeType::COMMAND:
+ {
+ Reference< XCommand > xCommand( xChildNode, UNO_QUERY_THROW );
+ if( xCommand->getCommand() == EffectCommands::STOPAUDIO )
+ {
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ), Any(sal_True) );
+ }
+ }
+ break;
+
+ case AnimationNodeType::AUDIO:
+ {
+ Reference< XAudio > xAudio( xChildNode, UNO_QUERY_THROW );
+ OUString sSoundURL;
+ if( (xAudio->getSource() >>= sSoundURL) && (sSoundURL.getLength() != 0) )
+ {
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ), Any(sSoundURL) );
+
+ Timing eTiming;
+ if( (xAudio->getRepeatCount() >>= eTiming) && (eTiming == Timing_INDEFINITE) )
+ xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ), Any( sal_True ) );
+ }
+ }
+ break;
+
+ }
+ }
+
+ Reference< XTimeContainer > xRootContainer( xRootNode, UNO_QUERY_THROW );
+ xRootContainer->removeChild( xNode );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("xmloff::AnimationsImport::postProcessRootNode(), exception caught!");
+ }
+}
+
+} // namespace xmloff
+
+Sequence< OUString > SAL_CALL AnimationsImport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Xmloff.AnimationsImport" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL AnimationsImport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "xmloff::AnimationsImport" ) );
+}
+
+Reference< XInterface > SAL_CALL AnimationsImport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
+{
+ return (cppu::OWeakObject*)new xmloff::AnimationsImport( rSMgr );
+
+}
+
+namespace xmloff
+{
+
+OUString SAL_CALL AnimationsImport::getImplementationName() throw(RuntimeException)
+{
+ return AnimationsImport_getImplementationName();
+}
+
+sal_Bool SAL_CALL AnimationsImport::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return ServiceName.equalsAscii( "com.sun.star.comp.Xmloff.AnimationsImport" );
+}
+
+Sequence< OUString > SAL_CALL AnimationsImport::getSupportedServiceNames() throw(RuntimeException)
+{
+ return AnimationsImport_getSupportedServiceNames();
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx
new file mode 100644
index 000000000000..600ab5c7144f
--- /dev/null
+++ b/xmloff/source/draw/animexp.cxx
@@ -0,0 +1,553 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+
+#include <list>
+#include <comphelper/extract.hxx>
+#include <tools/color.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/shapeexport.hxx>
+#include "anim.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+
+const struct Effect
+{
+ XMLEffect meKind;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+ sal_Bool mbIn;
+}
+ AnimationEffectMap[] =
+{
+ { EK_none, ED_none, -1, sal_True }, // AnimationEffect_NONE
+ { EK_fade, ED_from_left, -1, sal_True }, // AnimationEffect_FADE_FROM_LEFT
+ { EK_fade, ED_from_top, -1, sal_True }, // AnimationEffect_FADE_FROM_TOP
+ { EK_fade, ED_from_right, -1, sal_True }, // AnimationEffect_FADE_FROM_RIGHT
+ { EK_fade, ED_from_bottom, -1, sal_True }, // AnimationEffect_FADE_FROM_BOTTOM
+ { EK_fade, ED_to_center, -1, sal_True }, // AnimationEffect_FADE_TO_CENTER
+ { EK_fade, ED_from_center, -1, sal_True }, // AnimationEffect_FADE_FROM_CENTER
+ { EK_move, ED_from_left, -1, sal_True }, // AnimationEffect_MOVE_FROM_LEFT
+ { EK_move, ED_from_top, -1, sal_True }, // AnimationEffect_MOVE_FROM_TOP
+ { EK_move, ED_from_right, -1, sal_True }, // AnimationEffect_MOVE_FROM_RIGHT
+ { EK_move, ED_from_bottom, -1, sal_True }, // AnimationEffect_MOVE_FROM_BOTTOM
+ { EK_stripes, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_STRIPES
+ { EK_stripes, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_STRIPES
+ { EK_fade, ED_clockwise, -1, sal_True }, // AnimationEffect_CLOCKWISE
+ { EK_fade, ED_cclockwise, -1, sal_True }, // AnimationEffect_COUNTERCLOCKWISE
+ { EK_fade, ED_from_upperleft, -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERLEFT
+ { EK_fade, ED_from_upperright, -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERRIGHT
+ { EK_fade, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERLEFT
+ { EK_fade, ED_from_lowerright, -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERRIGHT
+ { EK_close,ED_vertical, -1, sal_True }, // AnimationEffect_CLOSE_VERTICAL
+ { EK_close,ED_horizontal, -1, sal_True }, // AnimationEffect_CLOSE_HORIZONTAL
+ { EK_open, ED_vertical, -1, sal_True }, // AnimationEffect_OPEN_VERTICAL
+ { EK_open, ED_horizontal, -1, sal_True }, // AnimationEffect_OPEN_HORIZONTAL
+ { EK_move, ED_path, -1, sal_True }, // AnimationEffect_PATH
+ { EK_move, ED_to_left, -1, sal_False },// AnimationEffect_MOVE_TO_LEFT
+ { EK_move, ED_to_top, -1, sal_False },// AnimationEffect_MOVE_TO_TOP
+ { EK_move, ED_to_right, -1, sal_False },// AnimationEffect_MOVE_TO_RIGHT
+ { EK_move, ED_to_bottom, -1, sal_False },// AnimationEffect_MOVE_TO_BOTTOM
+ { EK_fade, ED_spiral_inward_left, -1, sal_True }, // AnimationEffect_SPIRALIN_LEFT
+ { EK_fade, ED_spiral_inward_right, -1, sal_True }, // AnimationEffect_SPIRALIN_RIGHT
+ { EK_fade, ED_spiral_outward_left, -1, sal_True }, // AnimationEffect_SPIRALOUT_LEFT
+ { EK_fade, ED_spiral_outward_right, -1, sal_True }, // AnimationEffect_SPIRALOUT_RIGHT
+ { EK_dissolve, ED_none, -1, sal_True }, // AnimationEffect_DISSOLVE
+ { EK_wavyline, ED_from_left, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_LEFT
+ { EK_wavyline, ED_from_top, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_TOP
+ { EK_wavyline, ED_from_right, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_RIGHT
+ { EK_wavyline, ED_from_bottom, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_BOTTOM
+ { EK_random, ED_none, -1, sal_True }, // AnimationEffect_RANDOM
+ { EK_lines, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_LINES
+ { EK_lines, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_LINES
+ { EK_laser, ED_from_left, -1, sal_True }, // AnimationEffect_LASER_FROM_LEFT
+ { EK_laser, ED_from_top, -1, sal_True }, // AnimationEffect_LASER_FROM_TOP
+ { EK_laser, ED_from_right, -1, sal_True }, // AnimationEffect_LASER_FROM_RIGHT
+ { EK_laser, ED_from_bottom, -1, sal_True }, // AnimationEffect_LASER_FROM_BOTTOM
+ { EK_laser, ED_from_upperleft, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERLEFT
+ { EK_laser, ED_from_upperright, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERRIGHT
+ { EK_laser, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERLEFT
+ { EK_laser, ED_from_lowerright, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERRIGHT
+ { EK_appear,ED_none, -1, sal_True }, // AnimationEffect_APPEAR
+ { EK_hide, ED_none, -1, sal_False },// AnimationEffect_HIDE
+ { EK_move, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERLEFT
+ { EK_move, ED_from_upperright, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERRIGHT
+ { EK_move, ED_from_lowerright, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERRIGHT
+ { EK_move, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERLEFT
+ { EK_move, ED_to_upperleft, -1, sal_False },// AnimationEffect_MOVE_TO_UPPERLEFT
+ { EK_move, ED_to_upperright, -1, sal_False },// AnimationEffect_MOVE_TO_UPPERRIGHT
+ { EK_move, ED_to_lowerright, -1, sal_False },// AnimationEffect_MOVE_TO_LOWERRIGHT
+ { EK_move, ED_to_lowerleft, -1, sal_False },// AnimationEffect_MOVE_TO_LOWERLEFT
+ { EK_move_short, ED_from_left, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LEFT
+ { EK_move_short, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
+ { EK_move_short, ED_from_top, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_TOP
+ { EK_move_short, ED_from_upperright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
+ { EK_move_short, ED_from_right, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_RIGHT
+ { EK_move_short, ED_from_lowerright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
+ { EK_move_short, ED_from_bottom, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_BOTTOM
+ { EK_move_short, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
+ { EK_move_short, ED_to_left, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LEFT
+ { EK_move_short, ED_to_upperleft, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
+ { EK_move_short, ED_to_top, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_TOP
+ { EK_move_short, ED_to_upperright, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
+ { EK_move_short, ED_to_right, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_RIGHT
+ { EK_move_short, ED_to_lowerright, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
+ { EK_move_short, ED_to_bottom, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_BOTTOM
+ { EK_move_short, ED_to_lowerleft, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
+ { EK_checkerboard, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_CHECKERBOARD
+ { EK_checkerboard, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_CHECKERBOARD
+ { EK_rotate, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_ROTATE
+ { EK_rotate, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_ROTATE
+ { EK_stretch,ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_STRETCH
+ { EK_stretch,ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_STRETCH
+ { EK_stretch,ED_from_left, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LEFT
+ { EK_stretch,ED_from_upperleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERLEFT
+ { EK_stretch,ED_from_top, -1, sal_True }, // AnimationEffect_STRETCH_FROM_TOP
+ { EK_stretch,ED_from_upperright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERRIGHT
+ { EK_stretch,ED_from_right, -1, sal_True }, // AnimationEffect_STRETCH_FROM_RIGHT
+ { EK_stretch,ED_from_lowerright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERRIGHT
+ { EK_stretch,ED_from_bottom, -1, sal_True }, // AnimationEffect_STRETCH_FROM_BOTTOM
+ { EK_stretch,ED_from_lowerleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERLEFT
+ { EK_move, ED_none, 0, sal_True }, // AnimationEffect_ZOOM_IN
+ { EK_move, ED_none, 50, sal_True }, // AnimationEffect_ZOOM_IN_SMALL
+ { EK_move, ED_spiral_inward_left, 0, sal_True }, // AnimationEffect_ZOOM_IN_SPIRAL
+ { EK_move, ED_none, 400, sal_True }, // AnimationEffect_ZOOM_OUT
+ { EK_move, ED_none, 200, sal_True }, // AnimationEffect_ZOOM_OUT_SMALL
+ { EK_move, ED_spiral_inward_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_SPIRAL
+ { EK_move, ED_from_left, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LEFT
+ { EK_move, ED_from_upperleft, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
+ { EK_move, ED_from_top, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_TOP
+ { EK_move, ED_from_upperright, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
+ { EK_move, ED_from_right, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_RIGHT
+ { EK_move, ED_from_lowerright, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
+ { EK_move, ED_from_bottom, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_BOTTOM
+ { EK_move, ED_from_lowerleft, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
+ { EK_move, ED_from_center, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_CENTER
+ { EK_move, ED_from_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LEFT
+ { EK_move, ED_from_upperleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
+ { EK_move, ED_from_top, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_TOP
+ { EK_move, ED_from_upperright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
+ { EK_move, ED_from_right, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_RIGHT
+ { EK_move, ED_from_lowerright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
+ { EK_move, ED_from_bottom, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_BOTTOM
+ { EK_move, ED_from_lowerleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
+ { EK_move, ED_from_center, 400, sal_True } // AnimationEffect_ZOOM_OUT_FROM_CENTER
+};
+
+void SdXMLImplSetEffect( AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDirection& eDirection, sal_Int16& nStartScale, sal_Bool& bIn )
+{
+ if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER )
+ {
+ DBG_ERROR( "unknown animation effect!" );
+ eEffect = AnimationEffect_NONE;
+ }
+
+ const Effect& rEffect = AnimationEffectMap[eEffect];
+ eKind = rEffect.meKind;
+ eDirection = rEffect.meDirection;
+ nStartScale = rEffect.mnStartScale;
+ bIn = rEffect.mbIn;
+}
+
+enum XMLActionKind
+{
+ XMLE_SHOW,
+ XMLE_HIDE,
+ XMLE_DIM,
+ XMLE_PLAY
+};
+
+struct XMLEffectHint
+{
+ XMLActionKind meKind;
+ sal_Bool mbTextEffect;
+ Reference<XShape> mxShape;
+
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+
+ AnimationSpeed meSpeed;
+ Color maDimColor;
+ OUString maSoundURL;
+ sal_Bool mbPlayFull;
+ sal_Int32 mnPresId;
+ sal_Int32 mnPathShapeId;
+
+ int operator<(const XMLEffectHint& rComp) const { return mnPresId < rComp.mnPresId; }
+
+ XMLEffectHint()
+ : meKind( XMLE_SHOW ), mbTextEffect( sal_False ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( -1 ),
+ meSpeed( AnimationSpeed_SLOW ), maDimColor(0), mbPlayFull( sal_False ),
+ mnPresId( 0 ), mnPathShapeId( -1 )
+ {}
+};
+
+class AnimExpImpl
+{
+public:
+ list<XMLEffectHint> maEffects;
+ UniReference< XMLShapeExport > mxShapeExp;
+
+ OUString msDimColor;
+ OUString msDimHide;
+ OUString msDimPrev;
+ OUString msEffect;
+ OUString msPlayFull;
+ OUString msPresOrder;
+ OUString msSound;
+ OUString msSoundOn;
+ OUString msSpeed;
+ OUString msTextEffect;
+ OUString msIsAnimation;
+ OUString msAnimPath;
+
+ AnimExpImpl()
+ : msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
+ msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
+ msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
+ msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
+ msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
+ msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
+ msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
+ msIsAnimation( RTL_CONSTASCII_USTRINGPARAM( "IsAnimation" ) ),
+ msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) )
+ {}
+};
+
+XMLAnimationsExporter::XMLAnimationsExporter( XMLShapeExport* pShapeExp )
+{
+ mpImpl = new AnimExpImpl;
+ mpImpl->mxShapeExp = pShapeExp;
+}
+
+XMLAnimationsExporter::~XMLAnimationsExporter()
+{
+ delete mpImpl;
+ mpImpl = NULL;
+}
+
+void XMLAnimationsExporter::prepare( Reference< XShape > xShape, SvXMLExport& )
+{
+ try
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ) ) )
+ return;
+ }
+
+ Reference< XPropertySet > xProps( xShape, UNO_QUERY );
+ if( xProps.is() )
+ {
+ AnimationEffect eEffect;
+ xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
+ if( eEffect == AnimationEffect_PATH )
+ {
+ Reference< XShape > xPath;
+ xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
+// strip if( xPath.is() )
+// strip mrExport.getInterfaceToIdentifierMapper()->registerReference( xShape );
+// strip mpImpl->mxShapeExp->createShapeId( xPath );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ DBG_ERROR("exception catched while collection animation information!");
+ }
+}
+
+void XMLAnimationsExporter::collect( Reference< XShape > xShape, SvXMLExport& rExport )
+{
+ try
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ) ) )
+ return;
+ }
+
+ Reference< XPropertySet > xProps( xShape, UNO_QUERY );
+ if( xProps.is() )
+ {
+ const OUString aEmptyStr;
+
+ Reference< XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
+ AnimationEffect eEffect;
+ XMLEffectHint aEffect;
+
+ if( any2bool( xProps->getPropertyValue( mpImpl->msSoundOn ) ) )
+ {
+ xProps->getPropertyValue( mpImpl->msSound ) >>= aEffect.maSoundURL;
+ xProps->getPropertyValue( mpImpl->msPlayFull ) >>= aEffect.mbPlayFull;
+ }
+
+ xProps->getPropertyValue( mpImpl->msPresOrder ) >>= aEffect.mnPresId;
+ xProps->getPropertyValue( mpImpl->msSpeed ) >>= aEffect.meSpeed;
+
+
+ sal_Bool bIsAnimation = false;
+ xProps->getPropertyValue( mpImpl->msIsAnimation ) >>= bIsAnimation;
+ if( bIsAnimation )
+ {
+ aEffect.meKind = XMLE_PLAY;
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ }
+
+ {
+
+ xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
+ if( eEffect != AnimationEffect_NONE )
+ {
+ sal_Bool bIn = sal_True;
+ SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
+
+ aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ if( eEffect == AnimationEffect_PATH )
+ {
+ Reference< XShape > xPath;
+ xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
+ if( xPath.is() )
+ {
+// strip mpImpl->mxShapeExp->createShapeId( xPath );
+// strip aEffect.mnPathShapeId = mpImpl->mxShapeExp->getShapeId( xPath );
+ }
+ }
+ mpImpl->maEffects.push_back( aEffect );
+
+ aEffect.mnPathShapeId = -1;
+ aEffect.maSoundURL = aEmptyStr;
+ }
+
+ xProps->getPropertyValue( mpImpl->msTextEffect ) >>= eEffect;
+ if( eEffect != AnimationEffect_NONE )
+ {
+ sal_Bool bIn = sal_True;
+ SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
+ aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
+ aEffect.mbTextEffect = sal_True;
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ aEffect.mbTextEffect = sal_False;
+ aEffect.maSoundURL = aEmptyStr;
+ }
+
+ sal_Bool bDimPrev = false;
+ sal_Bool bDimHide = false;
+ xProps->getPropertyValue( mpImpl->msDimPrev ) >>= bDimPrev;
+ xProps->getPropertyValue( mpImpl->msDimHide ) >>= bDimHide;
+ if( bDimPrev || bDimHide )
+ {
+ aEffect.meKind = bDimPrev ? XMLE_DIM : XMLE_HIDE;
+ aEffect.meEffect = EK_none;
+ aEffect.meDirection = ED_none;
+ aEffect.meSpeed = AnimationSpeed_MEDIUM;
+ if( bDimPrev )
+ {
+ sal_Int32 nColor = 0;
+ xProps->getPropertyValue( mpImpl->msDimColor ) >>= nColor;
+ aEffect.maDimColor.SetColor( nColor );
+ }
+
+ if( !aEffect.mxShape.is() )
+ {
+ rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
+ aEffect.mxShape = xShape;
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ aEffect.maSoundURL = aEmptyStr;
+ }
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ DBG_ERROR("exception catched while collection animation information!");
+ }
+}
+
+void XMLAnimationsExporter::exportAnimations( SvXMLExport& rExport )
+{
+ mpImpl->maEffects.sort();
+
+ list<XMLEffectHint>::iterator aIter = mpImpl->maEffects.begin();
+ const list<XMLEffectHint>::iterator aEnd = mpImpl->maEffects.end();
+
+ OUStringBuffer sTmp;
+
+ if( aIter != aEnd )
+ {
+ SvXMLElementExport aElement( rExport, XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, sal_True, sal_True );
+
+ do
+ {
+ XMLEffectHint& rEffect = *aIter;
+
+ DBG_ASSERT( rEffect.mxShape.is(), "shape id creation failed for animation effect?" );
+
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_SHAPE_ID, rExport.getInterfaceToIdentifierMapper().getIdentifier( rEffect.mxShape ) );
+
+ if( rEffect.meKind == XMLE_DIM )
+ {
+ // export a dim action;
+
+ SvXMLUnitConverter::convertColor( sTmp, rEffect.maDimColor );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_DIM, sal_True, sal_True );
+ }
+ else if( rEffect.meKind == XMLE_PLAY )
+ {
+ if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, sTmp.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_PLAY, sal_True, sal_True );
+ }
+ else
+ {
+
+ if( rEffect.meEffect != EK_none )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meEffect, aXML_AnimationEffect_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.meDirection != ED_none )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meDirection, aXML_AnimationDirection_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.mnStartScale != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( sTmp, rEffect.mnStartScale );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.mnPathShapeId != -1 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PATH_ID, OUString::valueOf( rEffect.mnPathShapeId ) );
+ }
+
+ enum XMLTokenEnum eLocalName;
+ if( rEffect.meKind == XMLE_SHOW )
+ {
+ if( rEffect.mbTextEffect )
+ eLocalName = XML_SHOW_TEXT;
+ else
+ eLocalName = XML_SHOW_SHAPE;
+ }
+ else
+ {
+ if( rEffect.mbTextEffect )
+ eLocalName = XML_HIDE_TEXT;
+ else
+ eLocalName = XML_HIDE_SHAPE;
+ }
+
+ SvXMLElementExport aEle( rExport, XML_NAMESPACE_PRESENTATION, eLocalName, sal_True, sal_True );
+ if( rEffect.maSoundURL.getLength() != 0 )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, rExport.GetRelativeReference(rEffect.maSoundURL) );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ if( rEffect.mbPlayFull )
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
+ }
+ }
+
+ aIter++;
+ }
+ while( aIter != aEnd );
+ }
+
+ mpImpl->maEffects.clear();
+}
diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx
new file mode 100644
index 000000000000..fb7abfa4f94a
--- /dev/null
+++ b/xmloff/source/draw/animimp.cxx
@@ -0,0 +1,694 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+
+#include <list>
+#include <tools/color.hxx>
+#include <comphelper/extract.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+/*
+#include <xmloff/xmlement.hxx>
+*/
+#include <xmloff/nmspmap.hxx>
+#include "anim.hxx"
+#include "animimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+SvXMLEnumMapEntry aXML_AnimationEffect_EnumMap[] =
+{
+ { XML_NONE, EK_none },
+ { XML_FADE, EK_fade },
+ { XML_MOVE, EK_move },
+ { XML_STRIPES, EK_stripes },
+ { XML_OPEN, EK_open },
+ { XML_CLOSE, EK_close },
+ { XML_DISSOLVE, EK_dissolve },
+ { XML_WAVYLINE, EK_wavyline },
+ { XML_RANDOM, EK_random },
+ { XML_LINES, EK_lines },
+ { XML_LASER, EK_laser },
+ { XML_APPEAR, EK_appear },
+ { XML_HIDE, EK_hide },
+ { XML_MOVE_SHORT, EK_move_short },
+ { XML_CHECKERBOARD, EK_checkerboard },
+ { XML_ROTATE, EK_rotate },
+ { XML_STRETCH, EK_stretch },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_AnimationDirection_EnumMap[] =
+{
+ { XML_NONE, ED_none },
+ { XML_FROM_LEFT, ED_from_left },
+ { XML_FROM_TOP, ED_from_top },
+ { XML_FROM_RIGHT, ED_from_right },
+ { XML_FROM_BOTTOM, ED_from_bottom },
+ { XML_FROM_CENTER, ED_from_center },
+ { XML_FROM_UPPER_LEFT, ED_from_upperleft },
+ { XML_FROM_UPPER_RIGHT, ED_from_upperright },
+ { XML_FROM_LOWER_LEFT, ED_from_lowerleft },
+ { XML_FROM_LOWER_RIGHT, ED_from_lowerright },
+ { XML_TO_LEFT, ED_to_left },
+ { XML_TO_TOP, ED_to_top },
+ { XML_TO_RIGHT, ED_to_right },
+ { XML_TO_BOTTOM, ED_to_bottom },
+ { XML_TO_UPPER_LEFT, ED_to_upperleft },
+ { XML_TO_UPPER_RIGHT, ED_to_upperright },
+ { XML_TO_LOWER_RIGHT, ED_to_lowerright },
+ { XML_TO_LOWER_LEFT, ED_to_lowerleft },
+ { XML_PATH, ED_path },
+ { XML_SPIRAL_INWARD_LEFT, ED_spiral_inward_left },
+ { XML_SPIRAL_INWARD_RIGHT,ED_spiral_inward_right },
+ { XML_SPIRAL_OUTWARD_LEFT, ED_spiral_outward_left },
+ { XML_SPIRAL_OUTWARD_RIGHT, ED_spiral_outward_right },
+ { XML_VERTICAL, ED_vertical },
+ { XML_HORIZONTAL, ED_horizontal },
+ { XML_TO_CENTER, ED_to_center },
+ { XML_CLOCKWISE, ED_clockwise },
+ { XML_COUNTER_CLOCKWISE,ED_cclockwise },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_AnimationSpeed_EnumMap[] =
+{
+ { XML_SLOW, AnimationSpeed_SLOW },
+ { XML_MEDIUM, AnimationSpeed_MEDIUM },
+ { XML_FAST, AnimationSpeed_FAST },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool /*bIn*/ )
+{
+ switch( eKind )
+ {
+ case EK_fade:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_FADE_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_FADE_FROM_TOP;
+ case ED_from_right: return AnimationEffect_FADE_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_FADE_FROM_BOTTOM;
+ case ED_from_center: return AnimationEffect_FADE_FROM_CENTER;
+ case ED_from_upperleft: return AnimationEffect_FADE_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_FADE_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT;
+ case ED_to_center: return AnimationEffect_FADE_TO_CENTER;
+ case ED_clockwise: return AnimationEffect_CLOCKWISE;
+ case ED_cclockwise: return AnimationEffect_COUNTERCLOCKWISE;
+ case ED_spiral_inward_left: return AnimationEffect_SPIRALIN_LEFT;
+ case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT;
+ case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT;
+ case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT;
+ default: return AnimationEffect_FADE_FROM_LEFT;
+ }
+ case EK_move:
+ if( nStartScale == 200 )
+ {
+ return AnimationEffect_ZOOM_OUT_SMALL;
+ }
+ else if( nStartScale == 50 )
+ {
+ return AnimationEffect_ZOOM_IN_SMALL;
+ }
+ else if( nStartScale < 100 )
+ {
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_ZOOM_IN_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_ZOOM_IN_FROM_TOP;
+ case ED_from_right: return AnimationEffect_ZOOM_IN_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_ZOOM_IN_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT;
+ case ED_from_center: return AnimationEffect_ZOOM_IN_FROM_CENTER;
+ case ED_spiral_inward_left: return AnimationEffect_ZOOM_IN_SPIRAL;
+ case ED_to_left: return AnimationEffect_MOVE_TO_LEFT;
+ case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
+ case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
+ case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
+ case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
+ case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
+ case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
+ case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
+ default: return AnimationEffect_ZOOM_IN;
+ }
+ }
+ else if( nStartScale > 100 )
+ {
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_ZOOM_OUT_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_ZOOM_OUT_FROM_TOP;
+ case ED_from_right: return AnimationEffect_ZOOM_OUT_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT;
+ case ED_from_center: return AnimationEffect_ZOOM_OUT_FROM_CENTER;
+ case ED_spiral_inward_left: return AnimationEffect_ZOOM_OUT_SPIRAL;
+ default: return AnimationEffect_ZOOM_OUT;
+ }
+ }
+ else
+ {
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_MOVE_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_MOVE_FROM_TOP;
+ case ED_from_right: return AnimationEffect_MOVE_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_MOVE_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_MOVE_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_MOVE_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_MOVE_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_MOVE_FROM_LOWERRIGHT;
+ case ED_path: return AnimationEffect_PATH;
+ case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
+ case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
+ case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
+ case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
+ case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
+ case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
+ case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
+ default:
+ break;
+ }
+ }
+ return AnimationEffect_MOVE_FROM_LEFT;
+ case EK_stripes:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_STRIPES;
+ else
+ return AnimationEffect_HORIZONTAL_STRIPES;
+ case EK_open:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_OPEN_VERTICAL;
+ else
+ return AnimationEffect_OPEN_HORIZONTAL;
+ case EK_close:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_CLOSE_VERTICAL;
+ else
+ return AnimationEffect_CLOSE_HORIZONTAL;
+ case EK_dissolve:
+ return AnimationEffect_DISSOLVE;
+ case EK_wavyline:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_WAVYLINE_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_WAVYLINE_FROM_TOP;
+ case ED_from_right: return AnimationEffect_WAVYLINE_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_WAVYLINE_FROM_BOTTOM;
+ default: return AnimationEffect_WAVYLINE_FROM_LEFT;
+ }
+ case EK_random:
+ return AnimationEffect_RANDOM;
+ case EK_lines:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_LINES;
+ else
+ return AnimationEffect_HORIZONTAL_LINES;
+ case EK_laser:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_LASER_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_LASER_FROM_TOP;
+ case ED_from_right: return AnimationEffect_LASER_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_LASER_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_LASER_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_LASER_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_LASER_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_LASER_FROM_LOWERRIGHT;
+ default: return AnimationEffect_LASER_FROM_LEFT;
+ }
+ case EK_appear:
+ return AnimationEffect_APPEAR;
+ case EK_hide:
+ return AnimationEffect_HIDE;
+ case EK_move_short:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_MOVE_SHORT_FROM_TOP;
+ case ED_from_right: return AnimationEffect_MOVE_SHORT_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT;
+ case ED_to_left: return AnimationEffect_MOVE_SHORT_TO_LEFT;
+ case ED_to_upperleft: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT;
+ case ED_to_top: return AnimationEffect_MOVE_SHORT_TO_TOP;
+ case ED_to_upperright: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT;
+ case ED_to_right: return AnimationEffect_MOVE_SHORT_TO_RIGHT;
+ case ED_to_lowerright: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT;
+ case ED_to_bottom: return AnimationEffect_MOVE_SHORT_TO_BOTTOM;
+ case ED_to_lowerleft: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT;
+ default: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
+ }
+ case EK_checkerboard:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_CHECKERBOARD;
+ else
+ return AnimationEffect_HORIZONTAL_CHECKERBOARD;
+ case EK_rotate:
+ if( eDirection == ED_vertical )
+ return AnimationEffect_VERTICAL_ROTATE;
+ else
+ return AnimationEffect_HORIZONTAL_ROTATE;
+ case EK_stretch:
+ switch( eDirection )
+ {
+ case ED_from_left: return AnimationEffect_STRETCH_FROM_LEFT;
+ case ED_from_top: return AnimationEffect_STRETCH_FROM_TOP;
+ case ED_from_right: return AnimationEffect_STRETCH_FROM_RIGHT;
+ case ED_from_bottom: return AnimationEffect_STRETCH_FROM_BOTTOM;
+ case ED_from_upperleft: return AnimationEffect_STRETCH_FROM_UPPERLEFT;
+ case ED_from_upperright: return AnimationEffect_STRETCH_FROM_UPPERRIGHT;
+ case ED_from_lowerleft: return AnimationEffect_STRETCH_FROM_LOWERLEFT;
+ case ED_from_lowerright: return AnimationEffect_STRETCH_FROM_LOWERRIGHT;
+ case ED_vertical: return AnimationEffect_VERTICAL_STRETCH;
+ case ED_horizontal: return AnimationEffect_HORIZONTAL_STRETCH;
+ default:
+ break;
+ }
+ return AnimationEffect_STRETCH_FROM_LEFT;
+ default:
+ return AnimationEffect_NONE;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class AnimImpImpl
+{
+public:
+ Reference< XPropertySet > mxLastShape;
+ OUString maLastShapeId;
+
+ OUString msDimColor;
+ OUString msDimHide;
+ OUString msDimPrev;
+ OUString msEffect;
+ OUString msPlayFull;
+ OUString msPresOrder;
+ OUString msSound;
+ OUString msSoundOn;
+ OUString msSpeed;
+ OUString msTextEffect;
+ OUString msPresShapeService;
+ OUString msAnimPath;
+ OUString msIsAnimation;
+
+ AnimImpImpl()
+ : msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
+ msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
+ msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
+ msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
+ msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
+ msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
+ msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
+ msPresShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ),
+ msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) ),
+ msIsAnimation( RTL_CONSTASCII_USTRINGPARAM( "IsAnimation" ) )
+ {}
+};
+
+///////////////////////////////////////////////////////////////////////
+
+enum XMLActionKind
+{
+ XMLE_SHOW,
+ XMLE_HIDE,
+ XMLE_DIM,
+ XMLE_PLAY
+};
+
+class XMLAnimationsEffectContext : public SvXMLImportContext
+{
+public:
+ AnimImpImpl* mpImpl;
+
+ XMLActionKind meKind;
+ sal_Bool mbTextEffect;
+ OUString maShapeId;
+
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+
+ AnimationSpeed meSpeed;
+ Color maDimColor;
+ OUString maSoundURL;
+ sal_Bool mbPlayFull;
+ OUString maPathShapeId;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsEffectContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList,
+ AnimImpImpl* pImpl);
+ virtual ~XMLAnimationsEffectContext();
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList );
+};
+
+class XMLAnimationsSoundContext : public SvXMLImportContext
+{
+ XMLAnimationsEffectContext* mpParent;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
+ virtual ~XMLAnimationsSoundContext();
+};
+
+TYPEINIT1( XMLAnimationsSoundContext, SvXMLImportContext );
+
+XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent )
+: SvXMLImportContext( rImport, nPrfx, rLocalName ), mpParent( pParent )
+{
+ if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
+ {
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ mpParent->maSoundURL = rImport.GetAbsoluteReference(sValue);
+ }
+ break;
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_PLAY_FULL ) )
+ {
+ mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+ }
+}
+
+XMLAnimationsSoundContext::~XMLAnimationsSoundContext()
+{
+}
+
+
+TYPEINIT1( XMLAnimationsEffectContext, SvXMLImportContext );
+
+XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, AnimImpImpl* pImpl )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpImpl( pImpl ),
+ meKind( XMLE_SHOW ), mbTextEffect( sal_False ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
+ meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( sal_False )
+{
+ if( IsXMLToken( rLocalName, XML_SHOW_SHAPE ) )
+ {
+ meKind = XMLE_SHOW;
+ }
+ else if( IsXMLToken( rLocalName, XML_SHOW_TEXT ) )
+ {
+ meKind = XMLE_SHOW;
+ mbTextEffect = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_HIDE_SHAPE ) )
+ {
+ meKind = XMLE_HIDE;
+ }
+ else if( IsXMLToken( rLocalName, XML_HIDE_TEXT ) )
+ {
+ meKind = XMLE_HIDE;
+ mbTextEffect = sal_True;
+ }
+ else if( IsXMLToken( rLocalName, XML_DIM ) )
+ {
+ meKind = XMLE_DIM;
+ }
+ else if( IsXMLToken( rLocalName, XML_PLAY ) )
+ {
+ meKind = XMLE_PLAY;
+ }
+ else
+ {
+ // unknown action, overread
+ return;
+ }
+
+ // read attributes
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( aLocalName, XML_SHAPE_ID ) )
+ {
+ maShapeId = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_COLOR ) )
+ {
+ SvXMLUnitConverter::convertColor(maDimColor, sValue);
+ }
+ break;
+
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_EFFECT ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
+ meEffect = (XMLEffect)eEnum;
+ }
+ else if( IsXMLToken(aLocalName, XML_DIRECTION ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
+ meDirection = (XMLEffectDirection)eEnum;
+ }
+ else if( IsXMLToken( aLocalName, XML_START_SCALE ) )
+ {
+ sal_Int32 nScale;
+ if( SvXMLUnitConverter::convertPercent( nScale, sValue ) )
+ mnStartScale = (sal_Int16)nScale;
+ }
+ else if( IsXMLToken( aLocalName, XML_SPEED ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
+ meSpeed = (AnimationSpeed)eEnum;
+ }
+ else if( IsXMLToken( aLocalName, XML_PATH_ID ) )
+ {
+ maPathShapeId = sValue;
+ }
+ break;
+ }
+ }
+}
+
+XMLAnimationsEffectContext::~XMLAnimationsEffectContext()
+{
+}
+
+SvXMLImportContext * XMLAnimationsEffectContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ return new XMLAnimationsSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+}
+
+void XMLAnimationsEffectContext::EndElement()
+{
+ // set effect on shape
+
+ try
+ {
+ UniReference< XMLShapeImportHelper > xShapeImport( GetImport().GetShapeImport() );
+ Any aAny;
+
+ if( maShapeId.getLength() )
+ {
+ Reference< XPropertySet > xSet;
+ if( mpImpl->maLastShapeId != maShapeId )
+ {
+ xSet = Reference< XPropertySet >::query( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId ) );
+ if( xSet.is() )
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( mpImpl->msPresShapeService ) )
+ return;
+ }
+
+ mpImpl->maLastShapeId = maShapeId;
+ mpImpl->mxLastShape = xSet;
+ }
+ }
+ else
+ {
+ xSet = mpImpl->mxLastShape;
+ }
+
+ if( xSet.is() )
+ {
+ if( meKind == XMLE_DIM )
+ {
+ aAny <<= (sal_Bool)sal_True;
+ xSet->setPropertyValue( mpImpl->msDimPrev, aAny );
+
+ aAny <<= (sal_Int32)maDimColor.GetColor();
+ xSet->setPropertyValue( mpImpl->msDimColor, aAny );
+ }
+ else if( meKind == XMLE_PLAY )
+ {
+ aAny <<= (sal_Bool)sal_True;
+ xSet->setPropertyValue( mpImpl->msIsAnimation, aAny );
+
+ aAny <<= meSpeed;
+ xSet->setPropertyValue( mpImpl->msSpeed, aAny );
+ }
+ else
+ {
+ if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == EK_none )
+ {
+ aAny = bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msDimHide, aAny );
+ }
+ else
+ {
+ const AnimationEffect eEffect = ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
+
+ xSet->setPropertyValue( mbTextEffect ? mpImpl->msTextEffect : mpImpl->msEffect, makeAny( eEffect ) );
+ xSet->setPropertyValue( mpImpl->msSpeed, makeAny( meSpeed ) );
+
+ if( eEffect == AnimationEffect_PATH && maPathShapeId.getLength() )
+ {
+ Reference< XShape > xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), UNO_QUERY );
+ if( xPath.is() )
+ xSet->setPropertyValue( mpImpl->msAnimPath, makeAny( xPath ) );
+ }
+ }
+ }
+ }
+ if( maSoundURL.getLength() != 0 )
+ {
+ if( xSet.is() )
+ {
+ aAny <<= maSoundURL;
+ xSet->setPropertyValue( mpImpl->msSound, aAny );
+
+ aAny <<= bool2any( mbPlayFull );
+ xSet->setPropertyValue( mpImpl->msPlayFull, aAny );
+
+ aAny <<= bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msSoundOn, aAny );
+ }
+ else
+ {
+ DBG_ERROR("XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
+ }
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ DBG_ERROR( "exception catched while importing animation information!" );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLAnimationsContext, SvXMLImportContext );
+
+XMLAnimationsContext::XMLAnimationsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ mpImpl = new AnimImpImpl();
+}
+
+XMLAnimationsContext::~XMLAnimationsContext()
+{
+ delete mpImpl;
+}
+
+SvXMLImportContext * XMLAnimationsContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new XMLAnimationsEffectContext( GetImport(), nPrefix, rLocalName, xAttrList, mpImpl );
+}
diff --git a/xmloff/source/draw/descriptionimp.cxx b/xmloff/source/draw/descriptionimp.cxx
new file mode 100644
index 000000000000..7d17de3a7471
--- /dev/null
+++ b/xmloff/source/draw/descriptionimp.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+
+#include "descriptionimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLDescriptionContext, SvXMLImportContext );
+
+SdXMLDescriptionContext::SdXMLDescriptionContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
+ const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
+: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
+{
+}
+
+SdXMLDescriptionContext::~SdXMLDescriptionContext()
+{
+}
+
+void SdXMLDescriptionContext::EndElement()
+{
+ if( msText.getLength() ) try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY_THROW);
+ if(IsXMLToken(GetLocalName(),XML_TITLE))
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), Any(msText));
+ }
+ else
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Description")), Any(msText));
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+// This method is called for all characters that are contained in the
+// current element. The default is to ignore them.
+void SdXMLDescriptionContext::Characters( const ::rtl::OUString& rChars )
+{
+ msText += rChars;
+}
+
diff --git a/xmloff/source/draw/descriptionimp.hxx b/xmloff/source/draw/descriptionimp.hxx
new file mode 100644
index 000000000000..61441b9dba69
--- /dev/null
+++ b/xmloff/source/draw/descriptionimp.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_DESCRIPTIONIMP_HXX
+#define _XMLOFF_DESCRIPTIONIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// office:events inside a shape
+
+class SdXMLDescriptionContext : public SvXMLImportContext
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+ ::rtl::OUString msText;
+public:
+ TYPEINFO();
+
+ SdXMLDescriptionContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rxShape );
+ virtual ~SdXMLDescriptionContext();
+
+ virtual void EndElement();
+
+ // This method is called for all characters that are contained in the
+ // current element. The default is to ignore them.
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+#endif // _XMLOFF_EVENTIMP_HXX
+
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
new file mode 100644
index 000000000000..ad559bc0bf45
--- /dev/null
+++ b/xmloff/source/draw/eventimp.cxx
@@ -0,0 +1,575 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <tools/urlobj.hxx>
+#include <comphelper/extract.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "eventimp.hxx"
+#include "anim.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////
+
+SvXMLEnumMapEntry __READONLY_DATA aXML_EventActions_EnumMap[] =
+{
+ { XML_NONE, ClickAction_NONE },
+ { XML_PREVIOUS_PAGE, ClickAction_PREVPAGE },
+ { XML_NEXT_PAGE, ClickAction_NEXTPAGE },
+ { XML_FIRST_PAGE, ClickAction_FIRSTPAGE },
+ { XML_LAST_PAGE, ClickAction_LASTPAGE },
+ { XML_HIDE, ClickAction_INVISIBLE },
+ { XML_STOP, ClickAction_STOPPRESENTATION },
+ { XML_EXECUTE, ClickAction_PROGRAM },
+ { XML_SHOW, ClickAction_BOOKMARK },
+ { XML_SHOW, ClickAction_DOCUMENT },
+ { XML_EXECUTE_MACRO, ClickAction_MACRO },
+ { XML_VERB, ClickAction_VERB },
+ { XML_FADE_OUT, ClickAction_VANISH },
+ { XML_SOUND, ClickAction_SOUND },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class SdXMLEventContext : public SvXMLImportContext
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+
+public:
+ TYPEINFO();
+
+ SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape );
+ virtual ~SdXMLEventContext();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+ sal_Bool mbValid;
+ sal_Bool mbScript;
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ sal_Bool mbActionEvent;
+#endif
+ ClickAction meClickAction;
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+ AnimationSpeed meSpeed;
+ sal_Int32 mnVerb;
+ OUString msSoundURL;
+ sal_Bool mbPlayFull;
+ OUString msMacroName;
+ OUString msBookmark;
+ OUString msLanguage;
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ OUString msHyperURL;
+#endif
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class XMLEventSoundContext : public SvXMLImportContext
+{
+ SdXMLEventContext* mpParent;
+
+public:
+ TYPEINFO();
+
+ XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent );
+ virtual ~XMLEventSoundContext();
+};
+
+TYPEINIT1( XMLEventSoundContext, SvXMLImportContext );
+
+XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent )
+: SvXMLImportContext( rImp, nPrfx, rLocalName ), mpParent( pParent )
+{
+ if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
+ {
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aAttrLocalName;
+ sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nAttrPrefix )
+ {
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( aAttrLocalName, XML_HREF ) )
+ {
+ mpParent->msSoundURL = rImp.GetAbsoluteReference(sValue);
+ }
+ break;
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aAttrLocalName, XML_PLAY_FULL ) )
+ {
+ mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
+ }
+ }
+ }
+ }
+}
+
+XMLEventSoundContext::~XMLEventSoundContext()
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
+
+SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
+: SvXMLImportContext(rImp, nPrfx, rLocalName),
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ mxShape( rxShape ), mbScript( sal_False ), mbActionEvent( sal_False ), meClickAction( ClickAction_NONE ),
+#else
+ mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
+#endif
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
+ meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
+{
+ static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ static const OUString sXMLActionName( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
+#endif
+
+ if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
+ {
+ mbValid = sal_True;
+ }
+ else if( nPrfx == XML_NAMESPACE_SCRIPT && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
+ {
+ mbScript = sal_True;
+ mbValid = sal_True;
+ }
+ else
+ {
+ return;
+ }
+
+ // read attributes
+ OUString sEventName;
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; (i < nAttrCount) && mbValid; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aAttrLocalName;
+ sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nAttrPrefix )
+ {
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aAttrLocalName, XML_ACTION ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_EventActions_EnumMap ) )
+ meClickAction = (ClickAction)eEnum;
+ }
+ if( IsXMLToken( aAttrLocalName, XML_EFFECT ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
+ meEffect = (XMLEffect)eEnum;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_DIRECTION ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
+ meDirection = (XMLEffectDirection)eEnum;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_START_SCALE ) )
+ {
+ sal_Int32 nScale;
+ if( SvXMLUnitConverter::convertPercent( nScale, sValue ) )
+ mnStartScale = (sal_Int16)nScale;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_SPEED ) )
+ {
+ USHORT eEnum;
+ if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
+ meSpeed = (AnimationSpeed)eEnum;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_VERB ) )
+ {
+ SvXMLUnitConverter::convertNumber( mnVerb, sValue );
+ }
+ break;
+
+ case XML_NAMESPACE_SCRIPT:
+ if( IsXMLToken( aAttrLocalName, XML_EVENT_NAME ) )
+ {
+ sEventName = sValue;
+ sal_uInt16 nScriptPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == sXMLClickName || sEventName == sXMLActionName );
+ mbActionEvent = mbValid && (sEventName == sXMLActionName);
+#else
+ mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
+#endif
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
+ {
+ // language is not evaluated!
+ OUString aScriptLanguage;
+ msLanguage = sValue;
+ sal_uInt16 nScriptPrefix = rImp.GetNamespaceMap().
+ GetKeyByAttrName( msLanguage, &aScriptLanguage );
+ if( XML_NAMESPACE_OOO == nScriptPrefix )
+ msLanguage = aScriptLanguage;
+ }
+ else if( IsXMLToken( aAttrLocalName, XML_MACRO_NAME ) )
+ {
+ msMacroName = sValue;
+ }
+// else if( IsXMLToken( aLocalName, XML_LIBRARY ) )
+// {
+// msLibrary = sValue;
+// }
+ break;
+
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( aAttrLocalName, XML_HREF ) )
+ {
+ if ( mbScript )
+ {
+ msMacroName = sValue;
+ }
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ else if ( mbActionEvent )
+ {
+ msHyperURL = sValue;
+ }
+#endif
+ else
+ {
+ const rtl::OUString &rTmp =
+ rImp.GetAbsoluteReference(sValue);
+ INetURLObject::translateToInternal( rTmp, msBookmark,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ }
+ }
+ break;
+ }
+ }
+
+ if( mbValid )
+ mbValid = sEventName.getLength() != 0;
+}
+
+SdXMLEventContext::~SdXMLEventContext()
+{
+}
+
+SvXMLImportContext * SdXMLEventContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+}
+
+void SdXMLEventContext::EndElement()
+{
+ if( !mbValid )
+ return;
+
+ do
+ {
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
+ if( !xEventsSupplier.is() )
+ break;
+
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
+ DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
+ if( !xEvents.is() )
+ break;
+
+ OUString sAPIEventName;
+ uno::Sequence< beans::PropertyValue > aProperties;
+
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ if( mbActionEvent )
+ {
+ sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) );
+ aProperties.realloc( 2 );
+ beans::PropertyValue* pProperty = aProperties.getArray();
+
+ pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperty->Handle = -1;
+ pProperty->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) );
+ pProperty->State = beans::PropertyState_DIRECT_VALUE;
+ ++pProperty;
+ pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ pProperty->Handle = -1;
+ pProperty->Value <<= msHyperURL;
+ pProperty->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+#endif
+ {
+ sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+
+ if( mbScript )
+ meClickAction = ClickAction_MACRO;
+
+ sal_Int32 nPropertyCount = 2;
+ switch( meClickAction )
+ {
+ case ClickAction_NONE:
+ case ClickAction_PREVPAGE:
+ case ClickAction_NEXTPAGE:
+ case ClickAction_FIRSTPAGE:
+ case ClickAction_LASTPAGE:
+ case ClickAction_INVISIBLE:
+ case ClickAction_STOPPRESENTATION:
+ break;
+ case ClickAction_PROGRAM:
+ case ClickAction_VERB:
+ case ClickAction_BOOKMARK:
+ case ClickAction_DOCUMENT:
+ nPropertyCount += 1;
+ break;
+ case ClickAction_MACRO:
+ if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
+ nPropertyCount += 1;
+ break;
+
+ case ClickAction_SOUND:
+ nPropertyCount += 2;
+ break;
+
+ case ClickAction_VANISH:
+ nPropertyCount += 4;
+ break;
+ default:
+ break;
+ }
+
+ aProperties.realloc( nPropertyCount );
+ beans::PropertyValue* pProperties = aProperties.getArray();
+
+ if( ClickAction_MACRO == meClickAction )
+ {
+ if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
+ {
+ OUString sLibrary;
+ const OUString& rApp = GetXMLToken( XML_APPLICATION );
+ const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
+ if( msMacroName.getLength() > rApp.getLength()+1 &&
+ msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
+ ':' == msMacroName[rApp.getLength()] )
+ {
+ sLibrary = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
+ msMacroName = msMacroName.copy( rApp.getLength()+1 );
+ }
+ else if( msMacroName.getLength() > rDoc.getLength()+1 &&
+ msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
+ ':' == msMacroName[rDoc.getLength()] )
+ {
+ sLibrary = rDoc;
+ msMacroName = msMacroName.copy( rDoc.getLength()+1 );
+ }
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msMacroName;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= sLibrary;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ pProperties->Name =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Script") );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "Script" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msMacroName;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ pProperties->Handle = -1;
+ pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ // ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event
+ // so check here if its realy a bookmark or maybe a document
+ if( meClickAction == ClickAction_BOOKMARK )
+ {
+ if( msBookmark.compareToAscii( "#", 1 ) != 0 )
+ meClickAction = ClickAction_DOCUMENT;
+ }
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= meClickAction;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ switch( meClickAction )
+ {
+ case ClickAction_NONE:
+ case ClickAction_PREVPAGE:
+ case ClickAction_NEXTPAGE:
+ case ClickAction_FIRSTPAGE:
+ case ClickAction_LASTPAGE:
+ case ClickAction_INVISIBLE:
+ case ClickAction_STOPPRESENTATION:
+ break;
+
+ case ClickAction_BOOKMARK:
+ msBookmark = msBookmark.copy(1);
+
+ // Note: no break here!!!
+
+ case ClickAction_DOCUMENT:
+ case ClickAction_PROGRAM:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msBookmark;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+
+ case ClickAction_VANISH:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True );
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= meSpeed;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ // NOTE: no break here!!!
+
+ case ClickAction_SOUND:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= msSoundURL;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") );
+ pProperties->Handle = -1;
+ pProperties->Value = ::cppu::bool2any(mbPlayFull);
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+
+ case ClickAction_VERB:
+ pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") );
+ pProperties->Handle = -1;
+ pProperties->Value <<= mnVerb;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+ case ClickAction_MACRO:
+ DBG_ERROR("xmloff::SdXMLEventContext::EndElement(), ClickAction_MACRO must be handled in different if case");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
+
+ } while(0);
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLEventsContext, SvXMLImportContext );
+
+SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
+ const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
+: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
+{
+}
+
+SdXMLEventsContext::~SdXMLEventsContext()
+{
+}
+
+SvXMLImportContext * SdXMLEventsContext::CreateChildContext( USHORT nPrfx, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new SdXMLEventContext( GetImport(), nPrfx, rLocalName, xAttrList, mxShape );
+}
diff --git a/xmloff/source/draw/eventimp.hxx b/xmloff/source/draw/eventimp.hxx
new file mode 100644
index 000000000000..75441fb7657a
--- /dev/null
+++ b/xmloff/source/draw/eventimp.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_EVENTIMP_HXX
+#define _XMLOFF_EVENTIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// office:events inside a shape
+
+class SdXMLEventsContext : public SvXMLImportContext
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+
+public:
+ TYPEINFO();
+
+ SdXMLEventsContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rxShape );
+ virtual ~SdXMLEventsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_EVENTIMP_HXX
+
diff --git a/xmloff/source/draw/layerexp.cxx b/xmloff/source/draw/layerexp.cxx
new file mode 100644
index 000000000000..e5393279a0fa
--- /dev/null
+++ b/xmloff/source/draw/layerexp.cxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/XLayerSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "layerexp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::xmloff::token;
+
+void SdXMLayerExporter::exportLayer( SvXMLExport& rExport )
+{
+ Reference< XLayerSupplier > xLayerSupplier( rExport.GetModel(), UNO_QUERY );
+ if( !xLayerSupplier.is() )
+ return;
+
+ Reference< XIndexAccess > xLayerManager( xLayerSupplier->getLayerManager(), UNO_QUERY );
+ if( !xLayerManager.is() )
+ return;
+
+ const sal_Int32 nCount = xLayerManager->getCount();
+ if( nCount == 0 )
+ return;
+
+ const OUString strName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
+ const OUString strTitle( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
+ const OUString strDescription( RTL_CONSTASCII_USTRINGPARAM( "Description" ) );
+
+ OUString sTmp;
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_LAYER_SET, sal_True, sal_True );
+
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ try
+ {
+ Reference< XPropertySet> xLayer( xLayerManager->getByIndex( nIndex ), UNO_QUERY_THROW );
+ xLayer->getPropertyValue( strName ) >>= sTmp;
+ if(sTmp.getLength())
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, sTmp );
+
+ SvXMLElementExport aEle( rExport, XML_NAMESPACE_DRAW, XML_LAYER, sal_True, sal_True );
+
+ // title property (as <svg:title> element)
+ xLayer->getPropertyValue(strTitle) >>= sTmp;
+ if(sTmp.getLength())
+ {
+ SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
+ rExport.Characters(sTmp);
+ }
+
+ // description property (as <svg:desc> element)
+ xLayer->getPropertyValue(strDescription) >>= sTmp;
+ if(sTmp.getLength() > 0)
+ {
+ SvXMLElementExport aDesc(rExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False);
+ rExport.Characters(sTmp);
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLayerExporter::exportLayer(), exception caught during export of one layer!");
+ }
+ }
+}
diff --git a/xmloff/source/draw/layerexp.hxx b/xmloff/source/draw/layerexp.hxx
new file mode 100644
index 000000000000..35da3e1daafe
--- /dev/null
+++ b/xmloff/source/draw/layerexp.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_LAYEREXP_HXX
+#define _XMLOFF_LAYEREXP_HXX
+
+class SvXMLExport;
+
+class SdXMLayerExporter
+{
+public:
+ static void exportLayer( SvXMLExport& rExport );
+};
+
+#endif // _XMLOFF_ANIMEXP_HXX
+
diff --git a/xmloff/source/draw/layerimp.cxx b/xmloff/source/draw/layerimp.cxx
new file mode 100644
index 000000000000..960ff3ea1871
--- /dev/null
+++ b/xmloff/source/draw/layerimp.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/drawing/XLayerSupplier.hpp>
+#include <comphelper/extract.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "layerimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#include "XMLStringBufferImportContext.hxx"
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using ::xmloff::token::IsXMLToken;
+
+class SdXMLLayerContext : public SvXMLImportContext
+{
+public:
+ SdXMLLayerContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XNameAccess >& xLayerManager );
+ virtual ~SdXMLLayerContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const Reference< XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxLayerManager;
+ ::rtl::OUString msName;
+ ::rtl::OUStringBuffer sDescriptionBuffer;
+ ::rtl::OUStringBuffer sTitleBuffer;
+};
+
+SdXMLLayerContext::SdXMLLayerContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XNameAccess >& xLayerManager )
+: SvXMLImportContext(rImport, nPrefix, rLocalName)
+, mxLayerManager( xLayerManager )
+{
+ const OUString strName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
+
+ OUString aName;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString aLocalName;
+ if( GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( i ), &aLocalName ) == XML_NAMESPACE_DRAW )
+ {
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ msName = sValue;
+ break; // no more attributes needed
+ }
+ }
+ }
+
+}
+
+SdXMLLayerContext::~SdXMLLayerContext()
+{
+}
+
+SvXMLImportContext * SdXMLLayerContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const Reference< XAttributeList >& )
+{
+ if( (XML_NAMESPACE_SVG == nPrefix) && IsXMLToken(rLocalName, XML_TITLE) )
+ {
+ return new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, sTitleBuffer);
+ }
+ else if( (XML_NAMESPACE_SVG == nPrefix) && IsXMLToken(rLocalName, XML_DESC) )
+ {
+ return new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, sDescriptionBuffer);
+ }
+ else
+ {
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+}
+
+void SdXMLLayerContext::EndElement()
+{
+ DBG_ASSERT( msName.getLength(), "xmloff::SdXMLLayerContext::EndElement(), draw:layer element without draw:name!" );
+ if( msName.getLength() ) try
+ {
+ Reference< XPropertySet > xLayer;
+
+ if( mxLayerManager->hasByName( msName ) )
+ {
+ mxLayerManager->getByName( msName ) >>= xLayer;
+ DBG_ASSERT( xLayer.is(), "xmloff::SdXMLLayerContext::EndElement(), failed to get existing XLayer!" );
+ }
+ else
+ {
+ Reference< XLayerManager > xLayerManager( mxLayerManager, UNO_QUERY );
+ if( xLayerManager.is() )
+ xLayer = Reference< XPropertySet >::query( xLayerManager->insertNewByIndex( xLayerManager->getCount() ) );
+ DBG_ASSERT( xLayer.is(), "xmloff::SdXMLLayerContext::EndElement(), failed to create new XLayer!" );
+
+ if( xLayer.is() )
+ xLayer->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), Any( msName ) );
+ }
+
+ if( xLayer.is() )
+ {
+ xLayer->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), Any( sTitleBuffer.makeStringAndClear() ) );
+ xLayer->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ), Any( sDescriptionBuffer.makeStringAndClear() ) );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLLayerContext::EndElement(), exception caught!");
+ }
+}
+
+
+TYPEINIT1( SdXMLLayerSetContext, SvXMLImportContext );
+
+SdXMLLayerSetContext::SdXMLLayerSetContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>&)
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ Reference< XLayerSupplier > xLayerSupplier( rImport.GetModel(), UNO_QUERY );
+ DBG_ASSERT( xLayerSupplier.is(), "xmloff::SdXMLLayerSetContext::SdXMLLayerSetContext(), XModel is not supporting XLayerSupplier!" );
+ if( xLayerSupplier.is() )
+ mxLayerManager = xLayerSupplier->getLayerManager();
+}
+
+SdXMLLayerSetContext::~SdXMLLayerSetContext()
+{
+}
+
+SvXMLImportContext * SdXMLLayerSetContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new SdXMLLayerContext( GetImport(), nPrefix, rLocalName, xAttrList, mxLayerManager );
+}
diff --git a/xmloff/source/draw/layerimp.hxx b/xmloff/source/draw/layerimp.hxx
new file mode 100644
index 000000000000..9933bb8660ae
--- /dev/null
+++ b/xmloff/source/draw/layerimp.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_LAYERIMP_HXX
+#define _XMLOFF_LAYERIMP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+class AnimImpImpl;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class SdXMLLayerSetContext : public SvXMLImportContext
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxLayerManager;
+
+public:
+ TYPEINFO();
+
+ SdXMLLayerSetContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLLayerSetContext();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_ANIMIMP_HXX
+
diff --git a/xmloff/source/draw/makefile.mk b/xmloff/source/draw/makefile.mk
new file mode 100644
index 000000000000..3c9f7ae024f9
--- /dev/null
+++ b/xmloff/source/draw/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=xmloff
+TARGET=draw
+AUTOSEG=true
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/animationexport.obj\
+ $(SLO)$/animationimport.obj\
+ $(SLO)$/XMLNumberStyles.obj\
+ $(SLO)$/XMLGraphicsDefaultStyle.obj\
+ $(SLO)$/viewcontext.obj\
+ $(SLO)$/eventimp.obj\
+ $(SLO)$/layerexp.obj\
+ $(SLO)$/layerimp.obj\
+ $(SLO)$/ximpshow.obj\
+ $(SLO)$/animimp.obj\
+ $(SLO)$/animexp.obj\
+ $(SLO)$/numithdl.obj\
+ $(SLO)$/sdxmlimp.obj \
+ $(SLO)$/sdxmlexp.obj \
+ $(SLO)$/ximpstyl.obj \
+ $(SLO)$/ximpbody.obj \
+ $(SLO)$/ximpshap.obj \
+ $(SLO)$/ximpgrp.obj \
+ $(SLO)$/ximp3dscene.obj \
+ $(SLO)$/ximp3dobject.obj \
+ $(SLO)$/ximpnote.obj \
+ $(SLO)$/sdpropls.obj \
+ $(SLO)$/propimp0.obj \
+ $(SLO)$/xexptran.obj \
+ $(SLO)$/shapeexport.obj \
+ $(SLO)$/shapeexport2.obj \
+ $(SLO)$/shapeexport3.obj \
+ $(SLO)$/shapeexport4.obj \
+ $(SLO)$/shapeimport.obj \
+ $(SLO)$/XMLImageMapExport.obj \
+ $(SLO)$/XMLImageMapContext.obj \
+ $(SLO)$/XMLShapePropertySetContext.obj \
+ $(SLO)$/XMLShapeStyleContext.obj \
+ $(SLO)$/ximppage.obj \
+ $(SLO)$/ximpcustomshape.obj \
+ $(SLO)$/EnhancedCustomShapeToken.obj \
+ $(SLO)$/XMLReplacementImageContext.obj \
+ $(SLO)$/descriptionimp.obj \
+ $(SLO)$/ximplink.obj
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/xmloff/source/draw/numithdl.cxx b/xmloff/source/draw/numithdl.cxx
new file mode 100644
index 000000000000..8488efedb88c
--- /dev/null
+++ b/xmloff/source/draw/numithdl.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <numithdl.hxx>
+
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNumRulePropHdl
+//
+
+XMLNumRulePropHdl::XMLNumRulePropHdl( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > xNumRuleCompare )
+: mxNumRuleCompare( xNumRuleCompare )
+{
+}
+
+XMLNumRulePropHdl::~XMLNumRulePropHdl()
+{
+ // Nothing to do
+}
+
+bool XMLNumRulePropHdl::equals( const uno::Any& r1, const uno::Any& r2 ) const
+{
+ return mxNumRuleCompare.is() && mxNumRuleCompare->compare( r1, r2 ) == 0;
+}
+
+sal_Bool XMLNumRulePropHdl::importXML( const ::rtl::OUString& /*rStrImpValue*/, ::com::sun::star::uno::Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return sal_False;
+}
+
+sal_Bool XMLNumRulePropHdl::exportXML( ::rtl::OUString& /*rStrExpValue*/, const ::com::sun::star::uno::Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return sal_False;
+}
+
diff --git a/xmloff/source/draw/numithdl.hxx b/xmloff/source/draw/numithdl.hxx
new file mode 100644
index 000000000000..efba122ca6e1
--- /dev/null
+++ b/xmloff/source/draw/numithdl.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_NUMRULE_HXX
+#define _XMLOFF_PROPERTYHANDLER_NUMRULE_HXX
+
+#include <com/sun/star/ucb/XAnyCompare.hpp>
+#include <xmloff/xmlprhdl.hxx>
+
+/**
+ PropertyHandler for the list-style
+*/
+class XMLNumRulePropHdl : public XMLPropertyHandler
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > mxNumRuleCompare;
+public:
+ XMLNumRulePropHdl( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > xNumRuleCompare );
+ virtual ~XMLNumRulePropHdl();
+
+ virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// NumRules will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_NUMRULE_HXX
diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx
new file mode 100644
index 000000000000..711ac3329bb1
--- /dev/null
+++ b/xmloff/source/draw/propimp0.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/string.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "propimp0.hxx"
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlimp.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of graphic property Stroke
+
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of presentation page property Change
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of an effect duration property handler
+
+
+XMLDurationPropertyHdl::~XMLDurationPropertyHdl()
+{
+}
+
+sal_Bool XMLDurationPropertyHdl::importXML(
+ const OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ util::DateTime aTime;
+ SvXMLUnitConverter::convertTime( aTime, rStrImpValue );
+
+ const sal_Int32 nSeconds = ( aTime.Hours * 60 + aTime.Minutes ) * 60 + aTime.Seconds;
+ rValue <<= nSeconds;
+
+ return sal_True;
+}
+
+sal_Bool XMLDurationPropertyHdl::exportXML(
+ OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nVal = 0;
+
+ if(rValue >>= nVal)
+ {
+ util::DateTime aTime( 0, (sal_uInt16)nVal, 0, 0, 0, 0, 0 );
+
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertTime( aOut, aTime );
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of an opacity property handler
+
+
+XMLOpacityPropertyHdl::XMLOpacityPropertyHdl( SvXMLImport* pImport )
+: mpImport( pImport )
+{
+}
+
+XMLOpacityPropertyHdl::~XMLOpacityPropertyHdl()
+{
+}
+
+sal_Bool XMLOpacityPropertyHdl::importXML(
+ const OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue = 0;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ if( SvXMLUnitConverter::convertPercent( nValue, rStrImpValue ) )
+ bRet = sal_True;
+ }
+ else
+ {
+ nValue = sal_Int32( rStrImpValue.toDouble() * 100.0 );
+ bRet = sal_True;
+ }
+
+ if( bRet )
+ {
+ // check ranges
+ if( nValue < 0 )
+ nValue = 0;
+ if( nValue > 100 )
+ nValue = 100;
+
+ // convert xml opacity to api transparency
+ nValue = 100 - nValue;
+
+ // #i42959#
+ if( mpImport )
+ {
+ sal_Int32 nUPD, nBuild;
+ if( mpImport->getBuildIds( nUPD, nBuild ) )
+ {
+ // correct import of documents written prior to StarOffice 8/OOO 2.0 final
+ if( (nUPD == 680) && (nBuild < 8951) )
+ nValue = 100 - nValue;
+ }
+ }
+
+ rValue <<= sal_uInt16(nValue);
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLOpacityPropertyHdl::exportXML(
+ OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nVal = sal_uInt16();
+
+ if( rValue >>= nVal )
+ {
+ OUStringBuffer aOut;
+
+ nVal = 100 - nVal;
+ SvXMLUnitConverter::convertPercent( aOut, nVal );
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of an text animation step amount
+
+XMLTextAnimationStepPropertyHdl::~XMLTextAnimationStepPropertyHdl()
+{
+}
+
+sal_Bool XMLTextAnimationStepPropertyHdl::importXML(
+ const OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue = 0;
+
+ const OUString aPX( RTL_CONSTASCII_USTRINGPARAM( "px" ) );
+ sal_Int32 nPos = rStrImpValue.indexOf( aPX );
+ if( nPos != -1 )
+ {
+ if( rUnitConverter.convertNumber( nValue, rStrImpValue.copy( 0, nPos ) ) )
+ {
+ rValue <<= sal_Int16( -nValue );
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ if( rUnitConverter.convertMeasure( nValue, rStrImpValue ) )
+ {
+ rValue <<= sal_Int16( nValue );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTextAnimationStepPropertyHdl::exportXML(
+ OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nVal = sal_Int16();
+
+ if( rValue >>= nVal )
+ {
+ OUStringBuffer aOut;
+
+ if( nVal < 0 )
+ {
+ const OUString aPX( RTL_CONSTASCII_USTRINGPARAM( "px" ) );
+ rUnitConverter.convertNumber( aOut, (sal_Int32)-nVal );
+ aOut.append( aPX );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, nVal );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#include "sdxmlexp_impl.hxx"
+
+XMLDateTimeFormatHdl::XMLDateTimeFormatHdl( SvXMLExport* pExport )
+: mpExport( pExport )
+{
+}
+
+XMLDateTimeFormatHdl::~XMLDateTimeFormatHdl()
+{
+}
+
+sal_Bool XMLDateTimeFormatHdl::importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ rValue <<= rStrImpValue;
+ return true;
+}
+
+sal_Bool XMLDateTimeFormatHdl::exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nNumberFormat = 0;
+ if( mpExport && (rValue >>= nNumberFormat) )
+ {
+ mpExport->addDataStyle( nNumberFormat );
+ rStrExpValue = mpExport->getDataStyleName( nNumberFormat );
+ return sal_True;
+ }
+
+ return sal_False;
+}
diff --git a/xmloff/source/draw/propimp0.hxx b/xmloff/source/draw/propimp0.hxx
new file mode 100644
index 000000000000..e866db28a9a9
--- /dev/null
+++ b/xmloff/source/draw/propimp0.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PROPIMP0_HXX
+#define _PROPIMP0_HXX
+
+#include <xmloff/xmlprhdl.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// graphic property Stroke
+
+class XMLDurationPropertyHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLDurationPropertyHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class SvXMLImport;
+class XMLOpacityPropertyHdl : public XMLPropertyHandler
+{
+private:
+ SvXMLImport* mpImport;
+public:
+ XMLOpacityPropertyHdl( SvXMLImport* pImport );
+ virtual ~XMLOpacityPropertyHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLTextAnimationStepPropertyHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLTextAnimationStepPropertyHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class SvXMLExport;
+class XMLDateTimeFormatHdl : public XMLPropertyHandler
+{
+private:
+ SvXMLExport* mpExport;
+
+public:
+ XMLDateTimeFormatHdl( SvXMLExport* pExport );
+ virtual ~XMLDateTimeFormatHdl();
+ virtual sal_Bool importXML( const rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+#endif // _PROPIMP0_HXX
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
new file mode 100644
index 000000000000..9dac5b4cd469
--- /dev/null
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -0,0 +1,1764 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/animations/TransitionType.hpp>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+
+#ifndef _COM_SUN_STAR_DRAWING_BitmapMode_HPP_
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#endif
+#include <com/sun/star/text/WritingMode.hpp>
+#include <xmloff/EnumPropertyHdl.hxx>
+#include <xmloff/NamedBoolPropertyHdl.hxx>
+#include <xmloff/WordWrapPropertyHdl.hxx>
+#include "numithdl.hxx"
+#include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
+#include "XMLFillBitmapSizePropertyHandler.hxx"
+#include "XMLBitmapLogicalSizePropertyHandler.hxx"
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
+#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
+#include <xmloff/controlpropertyhdl.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "sdpropls.hxx"
+#include "propimp0.hxx"
+#include <xmloff/xmlexp.hxx>
+#include <xmlnmspe.hxx>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <xmloff/txtprmap.hxx>
+#include "XMLClipPropertyHandler.hxx"
+#include "XMLIsPercentagePropertyHandler.hxx"
+#include "XMLPercentOrMeasurePropertyHandler.hxx"
+#include "animations.hxx"
+#include <xmloff/xmluconv.hxx>
+
+#include "sdxmlexp_impl.hxx"
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+#define _MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
+#define _MAPV(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version }
+#define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_GRAPHIC,context)
+#define GMAPV(name,prefix,token,type,context,version) _MAPV(name,prefix,token,type|XML_TYPE_PROP_GRAPHIC,context,version)
+#define DPMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_DRAWING_PAGE,context)
+#define TMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_TEXT,context)
+#define PMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_PARAGRAPH,context)
+#define MAP_END() { 0L, 0, 0, XML_EMPTY, 0 ,0, SvtSaveOptions::ODFVER_010}
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for graphic properties
+
+const XMLPropertyMapEntry aXMLSDProperties[] =
+{
+ // this entry must be first! this is needed for XMLShapeImportHelper::CreateExternalShapePropMapper
+ GMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+
+ // stroke attributes
+ GMAP( "LineStyle", XML_NAMESPACE_DRAW, XML_STROKE, XML_SD_TYPE_STROKE, 0 ),
+ GMAP( "LineDashName", XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT , CTF_DASHNAME ),
+ GMAP( "LineWidth", XML_NAMESPACE_SVG, XML_STROKE_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "LineColor", XML_NAMESPACE_SVG, XML_STROKE_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "LineStartName", XML_NAMESPACE_DRAW, XML_MARKER_START, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_LINESTARTNAME ),
+ GMAP( "LineStartWidth", XML_NAMESPACE_DRAW, XML_MARKER_START_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "LineStartCenter", XML_NAMESPACE_DRAW, XML_MARKER_START_CENTER, XML_TYPE_BOOL, 0 ),
+ GMAP( "LineEndName", XML_NAMESPACE_DRAW, XML_MARKER_END, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_LINEENDNAME ),
+ GMAP( "LineEndWidth", XML_NAMESPACE_DRAW, XML_MARKER_END_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "LineEndCenter", XML_NAMESPACE_DRAW, XML_MARKER_END_CENTER, XML_TYPE_BOOL, 0 ),
+ GMAP( "LineTransparence", XML_NAMESPACE_SVG, XML_STROKE_OPACITY, XML_SD_TYPE_OPACITY, 0 ),
+ GMAP( "LineJoint", XML_NAMESPACE_DRAW, XML_STROKE_LINEJOIN, XML_SD_TYPE_LINEJOIN, 0 ),
+
+ // fill attributes
+ GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, 0 ),
+ GMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ),
+ GMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ),
+ GMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
+ GMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ),
+ GMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
+ GMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
+
+ GMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
+ GMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
+ GMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SD_TYPE_BITMAP_REFPOINT, 0 ),
+ GMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
+ GMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),
+
+ // text frame attributes
+ GMAP( "TextHorizontalAdjust", XML_NAMESPACE_DRAW, XML_TEXTAREA_HORIZONTAL_ALIGN, XML_SD_TYPE_TEXT_ALIGN, 0 ),
+ GMAP( "TextVerticalAdjust", XML_NAMESPACE_DRAW, XML_TEXTAREA_VERTICAL_ALIGN, XML_SD_TYPE_VERTICAL_ALIGN, 0 ),
+ GMAP( "TextAutoGrowHeight", XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextAutoGrowWidth", XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextFitToSize", XML_NAMESPACE_DRAW, XML_FIT_TO_SIZE, XML_SD_TYPE_FITTOSIZE, 0 ),
+ GMAP( "TextContourFrame", XML_NAMESPACE_DRAW, XML_FIT_TO_CONTOUR, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextMaximumFrameHeight", XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_TYPE_MEASURE, 0 ),
+ GMAP( "TextMaximumFrameWidth", XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "TextMinimumFrameHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextMinimumFrameWidth", XML_NAMESPACE_FO, XML_MIN_WIDTH, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "TextUpperDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextLowerDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextLeftDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ GMAP( "TextRightDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
+ PMAP( "TextWritingMode", XML_NAMESPACE_STYLE,XML_WRITING_MODE, XML_SD_TYPE_WRITINGMODE|MID_FLAG_MULTI_PROPERTY, CTF_WRITINGMODE ),
+ GMAP( "NumberingRules", XML_NAMESPACE_TEXT, XML_LIST_STYLE, XML_SD_TYPE_NUMBULLET|MID_FLAG_ELEMENT_ITEM, CTF_NUMBERINGRULES ),
+ GMAP( "NumberingRules", XML_NAMESPACE_TEXT, XML_LIST_STYLE_NAME, XML_TYPE_STRING, CTF_SD_NUMBERINGRULES_NAME ),
+ GMAP( "TextWordWrap", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_WRAP_OPTION, 0 ),
+
+ // shadow attributes
+ GMAP( "Shadow", XML_NAMESPACE_DRAW, XML_SHADOW, XML_SD_TYPE_SHADOW, 0 ),
+ GMAP( "ShadowXDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_TYPE_MEASURE, 0 ),
+ GMAP( "ShadowYDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_TYPE_MEASURE, 0 ),
+ GMAP( "ShadowColor", XML_NAMESPACE_DRAW, XML_SHADOW_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "ShadowTransparence", XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, XML_TYPE_NEG_PERCENT, 0 ),
+
+ // graphic attributes
+ GMAP( "GraphicColorMode", XML_NAMESPACE_DRAW, XML_COLOR_MODE, XML_TYPE_COLOR_MODE, 0 ), // exists in SW, too, with same property name
+ GMAP( "AdjustLuminance", XML_NAMESPACE_DRAW, XML_LUMINANCE, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustContrast", XML_NAMESPACE_DRAW, XML_CONTRAST, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "Gamma", XML_NAMESPACE_DRAW, XML_GAMMA, XML_TYPE_DOUBLE_PERCENT, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustRed", XML_NAMESPACE_DRAW, XML_RED, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustGreen", XML_NAMESPACE_DRAW, XML_GREEN, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAP( "AdjustBlue", XML_NAMESPACE_DRAW, XML_BLUE, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
+ GMAPV( "GraphicCrop", XML_NAMESPACE_FO, XML_CLIP, XML_TYPE_TEXT_CLIP, CTF_TEXT_CLIP, SvtSaveOptions::ODFVER_012 ), // exists in SW, too, with same property name
+ GMAP( "GraphicCrop", XML_NAMESPACE_FO, XML_CLIP, XML_TYPE_TEXT_CLIP11, CTF_TEXT_CLIP11 ), // exists in SW, too, with same property name
+ GMAP( "Transparency", XML_NAMESPACE_DRAW, XML_IMAGE_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too, with same property name // #i25616#
+ GMAP( "IsMirrored", XML_NAMESPACE_STYLE, XML_MIRROR, XML_TYPE_SD_MIRROR|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too // #i40214#
+
+ // animation text attributes
+ TMAP( "TextAnimationKind", XML_NAMESPACE_STYLE,XML_TEXT_BLINKING, XML_TYPE_TEXT_ANIMATION_BLINKING, CTF_TEXTANIMATION_BLINKING ),
+ GMAP( "TextAnimationKind", XML_NAMESPACE_TEXT, XML_ANIMATION, XML_TYPE_TEXT_ANIMATION, CTF_TEXTANIMATION_KIND ),
+ GMAP( "TextAnimationDirection", XML_NAMESPACE_TEXT, XML_ANIMATION_DIRECTION, XML_TYPE_TEXT_ANIMATION_DIRECTION, 0 ),
+ GMAP( "TextAnimationStartInside", XML_NAMESPACE_TEXT, XML_ANIMATION_START_INSIDE, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextAnimationStopInside", XML_NAMESPACE_TEXT, XML_ANIMATION_STOP_INSIDE, XML_TYPE_BOOL, 0 ),
+ GMAP( "TextAnimationCount", XML_NAMESPACE_TEXT, XML_ANIMATION_REPEAT, XML_TYPE_NUMBER16, 0 ),
+ GMAP( "TextAnimationDelay", XML_NAMESPACE_TEXT, XML_ANIMATION_DELAY, XML_TYPE_DURATION16_MS, 0 ),
+ GMAP( "TextAnimationAmount", XML_NAMESPACE_TEXT, XML_ANIMATION_STEPS, XML_TYPE_TEXT_ANIMATION_STEPS, 0 ),
+
+ // connector attributes
+ GMAP( "EdgeNode1HorzDist", XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_HORIZONTAL, XML_TYPE_MEASURE, 0 ),
+ GMAP( "EdgeNode1VertDist", XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_VERTICAL, XML_TYPE_MEASURE, 0 ),
+ GMAP( "EdgeNode2HorzDist", XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_HORIZONTAL, XML_TYPE_MEASURE, 0 ),
+ GMAP( "EdgeNode2VertDist", XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_VERTICAL, XML_TYPE_MEASURE, 0 ),
+
+ // measure attributes
+ GMAP( "MeasureLineDistance", XML_NAMESPACE_DRAW, XML_LINE_DISTANCE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLineOverhang", XML_NAMESPACE_DRAW, XML_GUIDE_OVERHANG, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLineDistance", XML_NAMESPACE_DRAW, XML_GUIDE_DISTANCE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLine1Length", XML_NAMESPACE_DRAW, XML_START_GUIDE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureHelpLine2Length", XML_NAMESPACE_DRAW, XML_END_GUIDE, XML_TYPE_MEASURE, 0 ),
+ GMAP( "MeasureTextHorizontalPosition", XML_NAMESPACE_DRAW, XML_MEASURE_ALIGN, XML_SD_TYPE_MEASURE_HALIGN, 0 ),
+ GMAP( "MeasureTextVerticalPosition", XML_NAMESPACE_DRAW, XML_MEASURE_VERTICAL_ALIGN, XML_SD_TYPE_MEASURE_VALIGN, 0 ),
+ GMAP( "MeasureUnit", XML_NAMESPACE_DRAW, XML_UNIT, XML_SD_TYPE_MEASURE_UNIT, 0 ),
+ GMAP( "MeasureShowUnit", XML_NAMESPACE_DRAW, XML_SHOW_UNIT, XML_TYPE_BOOL, 0 ),
+ GMAP( "MeasureBelowReferenceEdge", XML_NAMESPACE_DRAW, XML_PLACING, XML_SD_TYPE_MEASURE_PLACING, 0 ),
+ GMAP( "MeasureTextRotate90", XML_NAMESPACE_DRAW, XML_PARALLEL, XML_TYPE_BOOL, 0 ),
+ GMAP( "MeasureDecimalPlaces", XML_NAMESPACE_DRAW, XML_DECIMAL_PLACES, XML_TYPE_NUMBER16, 0 ),
+
+ // 3D geometry attributes
+ GMAP( "D3DHorizontalSegments", XML_NAMESPACE_DR3D, XML_HORIZONTAL_SEGMENTS, XML_TYPE_NUMBER, 0 ),
+ GMAP( "D3DVerticalSegments", XML_NAMESPACE_DR3D, XML_VERTICAL_SEGMENTS, XML_TYPE_NUMBER, 0 ),
+ GMAP( "D3DPercentDiagonal", XML_NAMESPACE_DR3D, XML_EDGE_ROUNDING, XML_TYPE_PERCENT, 0 ),
+ GMAP( "D3DBackscale", XML_NAMESPACE_DR3D, XML_BACK_SCALE, XML_TYPE_PERCENT, 0 ),
+ GMAP( "D3DEndAngle", XML_NAMESPACE_DR3D, XML_END_ANGLE, XML_TYPE_NUMBER, 0 ),
+ GMAP( "D3DDepth", XML_NAMESPACE_DR3D, XML_DEPTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "D3DDoubleSided", XML_NAMESPACE_DR3D, XML_BACKFACE_CULLING, XML_SD_TYPE_BACKFACE_CULLING, 0 ),
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ GMAP( "D3DCloseFront", XML_NAMESPACE_DR3D, XML_CLOSE_FRONT, XML_TYPE_BOOL, 0 ),
+ GMAP( "D3DCloseBack", XML_NAMESPACE_DR3D, XML_CLOSE_BACK, XML_TYPE_BOOL, 0 ),
+
+ // 3D lighting attributes
+ GMAP( "D3DNormalsKind", XML_NAMESPACE_DR3D, XML_NORMALS_KIND, XML_SD_TYPE_NORMALS_KIND, 0 ),
+ GMAP( "D3DNormalsInvert", XML_NAMESPACE_DR3D, XML_NORMALS_DIRECTION, XML_SD_TYPE_NORMALS_DIRECTION, 0 ),
+
+ // 3D texture attributes
+ GMAP( "D3DTextureProjectionX", XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_X, XML_SD_TYPE_TEX_GENERATION_MODE_X, 0 ),
+ GMAP( "D3DTextureProjectionY", XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_Y, XML_SD_TYPE_TEX_GENERATION_MODE_Y, 0 ),
+ GMAP( "D3DTextureKind", XML_NAMESPACE_DR3D, XML_TEX_KIND, XML_SD_TYPE_TEX_KIND, 0 ),
+ GMAP( "D3DTextureMode", XML_NAMESPACE_DR3D, XML_TEX_MODE, XML_SD_TYPE_TEX_MODE, 0 ),
+ GMAP( "D3DTextureFilter", XML_NAMESPACE_DR3D, XML_TEX_FILTER, XML_SD_TYPE_BACKFACE_CULLING, 0 ),
+
+ // 3D material attributes
+ GMAP( "D3DMaterialColor", XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "D3DMaterialEmission", XML_NAMESPACE_DR3D, XML_EMISSIVE_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "D3DMaterialSpecular", XML_NAMESPACE_DR3D, XML_SPECULAR_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "D3DMaterialSpecularIntensity", XML_NAMESPACE_DR3D, XML_SHININESS, XML_TYPE_PERCENT, 0 ),
+
+ // 3D shadow attributes
+ GMAP( "D3DShadow3D", XML_NAMESPACE_DR3D, XML_SHADOW, XML_SD_TYPE_SHADOW, 0 ),
+
+ // #FontWork# attributes
+ GMAP( "FontWorkStyle", XML_NAMESPACE_DRAW, XML_FONTWORK_STYLE, XML_SD_TYPE_FONTWORK_STYLE, CTF_FONTWORK_STYLE ),
+ GMAP( "FontWorkAdjust", XML_NAMESPACE_DRAW, XML_FONTWORK_ADJUST, XML_SD_TYPE_FONTWORK_ADJUST,CTF_FONTWORK_ADJUST ),
+ GMAP( "FontWorkDistance", XML_NAMESPACE_DRAW, XML_FONTWORK_DISTANCE, XML_TYPE_MEASURE, CTF_FONTWORK_DISTANCE ),
+ GMAP( "FontWorkStart", XML_NAMESPACE_DRAW, XML_FONTWORK_START, XML_TYPE_MEASURE, CTF_FONTWORK_START ),
+ GMAP( "FontWorkMirror", XML_NAMESPACE_DRAW, XML_FONTWORK_MIRROR, XML_TYPE_BOOL, CTF_FONTWORK_MIRROR ),
+ GMAP( "FontWorkOutline", XML_NAMESPACE_DRAW, XML_FONTWORK_OUTLINE, XML_TYPE_BOOL, CTF_FONTWORK_OUTLINE ),
+ GMAP( "FontWorkShadow", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW, XML_SD_TYPE_FONTWORK_SHADOW,CTF_FONTWORK_SHADOW ),
+ GMAP( "FontWorkShadowColor", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_COLOR, XML_TYPE_COLOR, CTF_FONTWORK_SHADOWCOLOR ),
+ GMAP( "FontWorkShadowOffsetX", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_X, XML_TYPE_MEASURE, CTF_FONTWORK_SHADOWOFFSETX ),
+ GMAP( "FontWorkShadowOffsetY", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_Y, XML_TYPE_MEASURE, CTF_FONTWORK_SHADOWOFFSETY ),
+ GMAP( "FontWorkForm", XML_NAMESPACE_DRAW, XML_FONTWORK_FORM, XML_SD_TYPE_FONTWORK_FORM, CTF_FONTWORK_FORM ),
+ GMAP( "FontWorkHideForm", XML_NAMESPACE_DRAW, XML_FONTWORK_HIDE_FORM, XML_TYPE_BOOL, CTF_FONTWORK_HIDEFORM ),
+ GMAP( "FontWorkShadowTransparence", XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_TRANSPARENCE, XML_TYPE_PERCENT, CTF_FONTWORK_SHADOWTRANSPARENCE ),
+
+ // control attributes (border exists one mor time for the text additions of shapes)
+ GMAP( "ControlSymbolColor", XML_NAMESPACE_DRAW, XML_SYMBOL_COLOR, XML_TYPE_COLOR, 0 ),
+ GMAP( "ControlBackground", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "ControlBorder", XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ GMAP( "ControlBorderColor", XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER_COLOR|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
+ GMAP( "ControlDataStyle", XML_NAMESPACE_STYLE,XML_DATA_STYLE_NAME, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_EXPORT|MID_FLAG_SPECIAL_ITEM, CTF_SD_CONTROL_SHAPE_DATA_STYLE ),
+ GMAP( "ControlTextEmphasis", XML_NAMESPACE_STYLE,XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ),
+ GMAP( "ImageScaleMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_IMAGE_SCALE_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ GMAP( "ControlWritingMode", XML_NAMESPACE_STYLE,XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT|MID_FLAG_MULTI_PROPERTY, CTF_CONTROLWRITINGMODE ),
+
+ // special entries for floating frames
+ GMAP( "FrameIsAutoScroll", XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_SCROLLBAR, XML_TYPE_BOOL|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_SCROLLBAR ),
+ GMAP( "FrameIsBorder", XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_BORDER, XML_TYPE_BOOL|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_BORDER ),
+ GMAP( "FrameMarginWidth", XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_HORIZONTAL, XML_TYPE_MEASURE_PX|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_MARGIN_HORI ),
+ GMAP( "FrameMarginHeight", XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_VERTICAL, XML_TYPE_MEASURE_PX|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_MARGIN_VERT ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_TYPE_RECTANGLE_LEFT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_LEFT ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_TYPE_RECTANGLE_TOP|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_TOP ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_TYPE_RECTANGLE_WIDTH|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH ),
+ GMAP( "VisibleArea", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_TYPE_RECTANGLE_HEIGHT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY, CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML__EMPTY, XML_TYPE_BUILDIN_CMP_ONLY, CTF_SD_OLE_ISINTERNAL ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_TYPE_RECTANGLE_LEFT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_LEFT ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_TYPE_RECTANGLE_TOP|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_TOP ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_TYPE_RECTANGLE_WIDTH|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH ),
+ GMAP( "IsInternal", XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_TYPE_RECTANGLE_HEIGHT|MID_FLAG_MERGE_PROPERTY|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT ),
+
+ GMAP( "Aspect", XML_NAMESPACE_DRAW, XML_DRAW_ASPECT, XML_TYPE_TEXT_DRAW_ASPECT|MID_FLAG_MULTI_PROPERTY, CTF_SD_OLE_ASPECT ),
+
+ // caption properties
+ GMAP( "CaptionType", XML_NAMESPACE_DRAW, XML_CAPTION_TYPE, XML_SD_TYPE_CAPTION_TYPE, 0 ),
+ GMAP( "CaptionIsFixedAngle", XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE_TYPE, XML_SD_TYPE_CAPTION_ANGLE_TYPE, 0 ),
+ GMAP( "CaptionAngle", XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE, XML_TYPE_NUMBER, 0 ),
+ GMAP( "CaptionGap", XML_NAMESPACE_DRAW, XML_CAPTION_GAP, XML_TYPE_MEASURE, 0 ),
+ GMAP( "CaptionEscapeDirection", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE_DIRECTION, XML_SD_TYPE_CAPTION_ESC_DIR, 0 ),
+ GMAP( "CaptionIsEscapeRelative", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_SD_TYPE_CAPTION_IS_ESC_REL|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ISESCREL ),
+ GMAP( "CaptionEscapeRelative", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_SD_TYPE_CAPTION_ESC_REL|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ESCREL ),
+ GMAP( "CaptionEscapeAbsolute", XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_SD_TYPE_CAPTION_ESC_ABS|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ESCABS ),
+ GMAP( "CaptionLineLength", XML_NAMESPACE_DRAW, XML_CAPTION_LINE_LENGTH, XML_TYPE_MEASURE, 0 ),
+ GMAP( "CaptionIsFitLineLength", XML_NAMESPACE_DRAW, XML_CAPTION_FIT_LINE_LENGTH, XML_TYPE_BOOL, 0 ),
+
+ // misc object properties
+ GMAP( "MoveProtect", XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_MOVE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_MOVE_PROTECT ),
+ GMAP( "SizeProtect", XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_SIZE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_SIZE_PROTECT ),
+ MAP_END()
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for presentation page properties
+
+const XMLPropertyMapEntry aXMLSDPresPageProps[] =
+{
+ DPMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+
+ DPMAP( "Change", XML_NAMESPACE_PRESENTATION, XML_TRANSITION_TYPE, XML_SD_TYPE_PRESPAGE_TYPE, CTF_PAGE_TRANS_TYPE ),
+ DPMAP( "Effect", XML_NAMESPACE_PRESENTATION, XML_TRANSITION_STYLE, XML_SD_TYPE_PRESPAGE_STYLE, CTF_PAGE_TRANS_STYLE ),
+ DPMAP( "Speed", XML_NAMESPACE_PRESENTATION, XML_TRANSITION_SPEED, XML_SD_TYPE_PRESPAGE_SPEED, CTF_PAGE_TRANS_SPEED ),
+ DPMAP( "Duration", XML_NAMESPACE_PRESENTATION, XML_DURATION, XML_SD_TYPE_PRESPAGE_DURATION, CTF_PAGE_TRANS_DURATION ),
+ DPMAP( "Visible", XML_NAMESPACE_PRESENTATION, XML_VISIBILITY, XML_SD_TYPE_PRESPAGE_VISIBILITY, CTF_PAGE_VISIBLE ),
+ DPMAP( "Sound", XML_NAMESPACE_PRESENTATION, XML_SOUND, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PAGE_SOUND_URL ),
+ DPMAP( "BackgroundFullSize", XML_NAMESPACE_DRAW, XML_BACKGROUND_SIZE, XML_SD_TYPE_PRESPAGE_BACKSIZE, CTF_PAGE_BACKSIZE ),
+
+ DPMAP( "IsBackgroundVisible", XML_NAMESPACE_PRESENTATION, XML_BACKGROUND_VISIBLE, XML_TYPE_BOOL, 0 ),
+ DPMAP( "IsBackgroundObjectsVisible", XML_NAMESPACE_PRESENTATION, XML_BACKGROUND_OBJECTS_VISIBLE, XML_TYPE_BOOL, 0 ),
+
+ DPMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, 0 ),
+ DPMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ DPMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ),
+ DPMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER, 0 ),
+ DPMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
+ GMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ),
+ DPMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
+ DPMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
+ DPMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_BITMAP_MODE, 0 ),
+ DPMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
+ DPMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
+ DPMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SD_TYPE_BITMAP_REFPOINT, 0 ),
+ DPMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
+ DPMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SD_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),
+
+ DPMAP( "IsHeaderVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_HEADER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_HEADER_VISIBLE ),
+ DPMAP( "IsFooterVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_FOOTER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_FOOTER_VISIBLE ),
+ DPMAP( "IsPageNumberVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_PAGE_NUMBER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_PAGE_NUMBER_VISIBLE ),
+ DPMAP( "IsDateTimeVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_DATE_TIME, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_DATE_TIME_VISIBLE ),
+
+ DPMAP( "TransitionType", XML_NAMESPACE_SMIL, XML_TYPE, XML_SD_TYPE_TRANSITION_TYPE, CTF_PAGE_TRANSITION_TYPE ),
+ DPMAP( "TransitionSubtype", XML_NAMESPACE_SMIL, XML_SUBTYPE, XML_SD_TYPE_TRANSTIION_SUBTYPE, CTF_PAGE_TRANSITION_SUBTYPE ),
+ DPMAP( "TransitionDirection", XML_NAMESPACE_SMIL, XML_DIRECTION, XML_SD_TYPE_TRANSTIION_DIRECTION, CTF_PAGE_TRANSITION_DIRECTION ),
+ DPMAP( "TransitionFadeColor", XML_NAMESPACE_SMIL, XML_FADECOLOR, XML_TYPE_COLOR, CTF_PAGE_TRANSITION_FADECOLOR ),
+ MAP_END()
+};
+
+const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[] =
+{
+ DPMAP( "IsHeaderVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_HEADER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_HEADER_VISIBLE ),
+ DPMAP( "IsFooterVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_FOOTER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_FOOTER_VISIBLE ),
+ DPMAP( "IsPageNumberVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_PAGE_NUMBER, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_PAGE_NUMBER_VISIBLE ),
+ DPMAP( "IsDateTimeVisible", XML_NAMESPACE_PRESENTATION, XML_DISPLAY_DATE_TIME, XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE, CTF_DATE_TIME_VISIBLE ),
+
+ MAP_END()
+};
+
+/** contains the attribute to property mapping for a drawing layer table
+ WARNING: if attributes are added, SdXMLTableShapeContext::processAttribute needs to be updated!
+*/
+const XMLPropertyMapEntry aXMLTableShapeAttributes[] =
+{
+ _MAP( "UseFirstRowStyle", XML_NAMESPACE_TABLE, XML_USE_FIRST_ROW_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseLastRowStyle", XML_NAMESPACE_TABLE, XML_USE_LAST_ROW_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseFirstColumnStyle", XML_NAMESPACE_TABLE, XML_USE_FIRST_COLUMN_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseLastColumnStyle", XML_NAMESPACE_TABLE, XML_USE_LAST_COLUMN_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseBandingRowStyle", XML_NAMESPACE_TABLE, XML_USE_BANDING_ROWS_STYLES, XML_TYPE_BOOL, 0 ),
+ _MAP( "UseBandingColumnStyle", XML_NAMESPACE_TABLE, XML_USE_BANDING_COLUMNS_STYLES, XML_TYPE_BOOL, 0 ),
+ MAP_END()
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// implementation of factory for own graphic properties
+
+SvXMLEnumMapEntry aXML_LineStyle_EnumMap[] =
+{
+ { XML_NONE, drawing::LineStyle_NONE },
+ { XML_SOLID, drawing::LineStyle_SOLID },
+ { XML_DASH, drawing::LineStyle_DASH },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_LineJoint_EnumMap[] =
+{
+ { XML_NONE, drawing::LineJoint_NONE },
+ { XML_MITER, drawing::LineJoint_MITER },
+ { XML_ROUND, drawing::LineJoint_ROUND },
+ { XML_BEVEL, drawing::LineJoint_BEVEL },
+ { XML_MIDDLE, drawing::LineJoint_MIDDLE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_FillStyle_EnumMap[] =
+{
+ { XML_NONE, drawing::FillStyle_NONE },
+ { XML_SOLID, drawing::FillStyle_SOLID },
+ { XML_BITMAP, drawing::FillStyle_BITMAP },
+ { XML_GRADIENT, drawing::FillStyle_GRADIENT },
+ { XML_HATCH, drawing::FillStyle_HATCH },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_PresChange_EnumMap[] =
+{
+ { XML_MANUAL, 0 },
+ { XML_AUTOMATIC, 1 },
+ { XML_SEMI_AUTOMATIC, 2 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TransSpeed_EnumMap[] =
+{
+ { XML_FAST, presentation::AnimationSpeed_FAST },
+ { XML_MEDIUM, presentation::AnimationSpeed_MEDIUM },
+ { XML_SLOW, presentation::AnimationSpeed_SLOW },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_FadeEffect_EnumMap[] =
+{
+ { XML_NONE, presentation::FadeEffect_NONE },
+ { XML_FADE_FROM_LEFT, presentation::FadeEffect_FADE_FROM_LEFT },
+ { XML_FADE_FROM_TOP, presentation::FadeEffect_FADE_FROM_TOP },
+ { XML_FADE_FROM_RIGHT, presentation::FadeEffect_FADE_FROM_RIGHT },
+ { XML_FADE_FROM_BOTTOM, presentation::FadeEffect_FADE_FROM_BOTTOM },
+ { XML_FADE_TO_CENTER, presentation::FadeEffect_FADE_TO_CENTER },
+ { XML_FADE_FROM_CENTER, presentation::FadeEffect_FADE_FROM_CENTER },
+ { XML_MOVE_FROM_LEFT, presentation::FadeEffect_MOVE_FROM_LEFT },
+ { XML_MOVE_FROM_TOP, presentation::FadeEffect_MOVE_FROM_TOP },
+ { XML_MOVE_FROM_RIGHT, presentation::FadeEffect_MOVE_FROM_RIGHT },
+ { XML_MOVE_FROM_BOTTOM, presentation::FadeEffect_MOVE_FROM_BOTTOM },
+ { XML_ROLL_FROM_TOP, presentation::FadeEffect_ROLL_FROM_TOP },
+ { XML_ROLL_FROM_LEFT, presentation::FadeEffect_ROLL_FROM_LEFT },
+ { XML_ROLL_FROM_RIGHT, presentation::FadeEffect_ROLL_FROM_RIGHT },
+ { XML_ROLL_FROM_BOTTOM, presentation::FadeEffect_ROLL_FROM_BOTTOM },
+ { XML_VERTICAL_STRIPES, presentation::FadeEffect_VERTICAL_STRIPES },
+ { XML_HORIZONTAL_STRIPES, presentation::FadeEffect_HORIZONTAL_STRIPES },
+ { XML_CLOCKWISE, presentation::FadeEffect_CLOCKWISE },
+ { XML_COUNTERCLOCKWISE, presentation::FadeEffect_COUNTERCLOCKWISE },
+ { XML_FADE_FROM_UPPERLEFT, presentation::FadeEffect_FADE_FROM_UPPERLEFT },
+ { XML_FADE_FROM_UPPERRIGHT, presentation::FadeEffect_FADE_FROM_UPPERRIGHT },
+ { XML_FADE_FROM_LOWERLEFT, presentation::FadeEffect_FADE_FROM_LOWERLEFT },
+ { XML_FADE_FROM_LOWERRIGHT, presentation::FadeEffect_FADE_FROM_LOWERRIGHT },
+ { XML_CLOSE_VERTICAL, presentation::FadeEffect_CLOSE_VERTICAL },
+ { XML_CLOSE_HORIZONTAL, presentation::FadeEffect_CLOSE_HORIZONTAL },
+ { XML_OPEN_VERTICAL, presentation::FadeEffect_OPEN_VERTICAL },
+ { XML_OPEN_HORIZONTAL, presentation::FadeEffect_OPEN_HORIZONTAL },
+ { XML_SPIRALIN_LEFT, presentation::FadeEffect_SPIRALIN_LEFT },
+ { XML_SPIRALIN_RIGHT, presentation::FadeEffect_SPIRALIN_RIGHT },
+ { XML_SPIRALOUT_LEFT, presentation::FadeEffect_SPIRALOUT_LEFT },
+ { XML_SPIRALOUT_RIGHT, presentation::FadeEffect_SPIRALOUT_RIGHT },
+ { XML_DISSOLVE, presentation::FadeEffect_DISSOLVE },
+ { XML_WAVYLINE_FROM_LEFT, presentation::FadeEffect_WAVYLINE_FROM_LEFT },
+ { XML_WAVYLINE_FROM_TOP, presentation::FadeEffect_WAVYLINE_FROM_TOP },
+ { XML_WAVYLINE_FROM_RIGHT, presentation::FadeEffect_WAVYLINE_FROM_RIGHT },
+ { XML_WAVYLINE_FROM_BOTTOM, presentation::FadeEffect_WAVYLINE_FROM_BOTTOM },
+ { XML_RANDOM, presentation::FadeEffect_RANDOM },
+ { XML_STRETCH_FROM_LEFT, presentation::FadeEffect_STRETCH_FROM_LEFT },
+ { XML_STRETCH_FROM_TOP, presentation::FadeEffect_STRETCH_FROM_TOP },
+ { XML_STRETCH_FROM_RIGHT, presentation::FadeEffect_STRETCH_FROM_RIGHT },
+ { XML_STRETCH_FROM_BOTTOM, presentation::FadeEffect_STRETCH_FROM_BOTTOM },
+ { XML_VERTICAL_LINES, presentation::FadeEffect_VERTICAL_LINES },
+ { XML_HORIZONTAL_LINES, presentation::FadeEffect_HORIZONTAL_LINES },
+ { XML_MOVE_FROM_UPPERLEFT, presentation::FadeEffect_MOVE_FROM_UPPERLEFT },
+ { XML_MOVE_FROM_UPPERRIGHT, presentation::FadeEffect_MOVE_FROM_UPPERRIGHT },
+ { XML_MOVE_FROM_LOWERRIGHT, presentation::FadeEffect_MOVE_FROM_LOWERRIGHT },
+ { XML_MOVE_FROM_LOWERLEFT, presentation::FadeEffect_MOVE_FROM_LOWERLEFT },
+ { XML_UNCOVER_TO_LEFT, presentation::FadeEffect_UNCOVER_TO_LEFT },
+ { XML_UNCOVER_TO_UPPERLEFT, presentation::FadeEffect_UNCOVER_TO_UPPERLEFT },
+ { XML_UNCOVER_TO_TOP, presentation::FadeEffect_UNCOVER_TO_TOP },
+ { XML_UNCOVER_TO_UPPERRIGHT,presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT },
+ { XML_UNCOVER_TO_RIGHT, presentation::FadeEffect_UNCOVER_TO_RIGHT },
+ { XML_UNCOVER_TO_LOWERRIGHT,presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT },
+ { XML_UNCOVER_TO_BOTTOM, presentation::FadeEffect_UNCOVER_TO_BOTTOM },
+ { XML_UNCOVER_TO_LOWERLEFT, presentation::FadeEffect_UNCOVER_TO_LOWERLEFT },
+ { XML_VERTICAL_CHECKERBOARD,presentation::FadeEffect_VERTICAL_CHECKERBOARD },
+ { XML_HORIZONTAL_CHECKERBOARD,presentation::FadeEffect_HORIZONTAL_CHECKERBOARD },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_ConnectionKind_EnumMap[] =
+{
+ { XML_STANDARD, drawing::ConnectorType_STANDARD },
+ { XML_CURVE, drawing::ConnectorType_CURVE },
+ { XML_LINE, drawing::ConnectorType_LINE },
+ { XML_LINES, drawing::ConnectorType_LINES },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[] =
+{
+ { XML_REPEAT, drawing::BitmapMode_REPEAT },
+ { XML_STRETCH, drawing::BitmapMode_STRETCH },
+ { XML_BACKGROUND_NO_REPEAT, drawing::BitmapMode_NO_REPEAT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// 3D EnumMaps
+
+SvXMLEnumMapEntry aXML_NormalsKind_EnumMap[] =
+{
+ { XML_OBJECT, drawing::NormalsKind_SPECIFIC },
+ { XML_FLAT, drawing::NormalsKind_FLAT },
+ { XML_SPHERE, drawing::NormalsKind_SPHERE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexGenerationX_EnumMap[] =
+{
+ { XML_OBJECT, drawing::TextureProjectionMode_OBJECTSPECIFIC },
+ { XML_PARALLEL, drawing::TextureProjectionMode_PARALLEL },
+ { XML_SPHERE, drawing::TextureProjectionMode_SPHERE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexGenerationY_EnumMap[] =
+{
+ { XML_OBJECT, drawing::TextureProjectionMode_OBJECTSPECIFIC },
+ { XML_PARALLEL, drawing::TextureProjectionMode_PARALLEL },
+ { XML_SPHERE, drawing::TextureProjectionMode_SPHERE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexKind_EnumMap[] =
+{
+ { XML_LUMINANCE, drawing::TextureKind_LUMINANCE },
+// { XML_INTENSITY, drawing::TextureKind_INTENSITY },
+ { XML_COLOR, drawing::TextureKind_COLOR },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_TexMode_EnumMap[] =
+{
+ { XML_REPLACE, drawing::TextureMode_REPLACE },
+ { XML_MODULATE, drawing::TextureMode_MODULATE },
+ { XML_BLEND, drawing::TextureMode_BLEND },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_RefPoint_EnumMap[] =
+{
+ { XML_TOP_LEFT, drawing::RectanglePoint_LEFT_TOP },
+ { XML_TOP, drawing::RectanglePoint_MIDDLE_TOP },
+ { XML_TOP_RIGHT, drawing::RectanglePoint_RIGHT_TOP },
+ { XML_LEFT, drawing::RectanglePoint_LEFT_MIDDLE },
+ { XML_CENTER, drawing::RectanglePoint_MIDDLE_MIDDLE },
+ { XML_RIGHT, drawing::RectanglePoint_RIGHT_MIDDLE },
+ { XML_BOTTOM_LEFT, drawing::RectanglePoint_LEFT_BOTTOM },
+ { XML_BOTTOM, drawing::RectanglePoint_MIDDLE_BOTTOM },
+ { XML_BOTTOM_RIGHT, drawing::RectanglePoint_RIGHT_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_CircleKind_EnumMap[] =
+{
+ { XML_FULL, drawing::CircleKind_FULL },
+ { XML_SECTION, drawing::CircleKind_SECTION },
+ { XML_CUT, drawing::CircleKind_CUT },
+ { XML_ARC, drawing::CircleKind_ARC },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_WritingMode_EnumMap[] =
+{
+ { XML_TB_RL, text::WritingMode_TB_RL },
+ { XML_LR_TB, text::WritingMode_LR_TB },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_TextAnimation_Enum[] =
+{
+ { XML_NONE, drawing::TextAnimationKind_NONE },
+ { XML_BLINKING, drawing::TextAnimationKind_BLINK }, // will be filtered
+ { XML_SCROLL, drawing::TextAnimationKind_SCROLL },
+ { XML_ALTERNATE, drawing::TextAnimationKind_ALTERNATE },
+ { XML_SLIDE, drawing::TextAnimationKind_SLIDE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_TextAnimation_Blinking_Enum[] =
+{
+ { XML_FALSE, drawing::TextAnimationKind_NONE },
+ { XML_TRUE, drawing::TextAnimationKind_BLINK },
+ { XML_FALSE, drawing::TextAnimationKind_SCROLL },
+ { XML_FALSE, drawing::TextAnimationKind_ALTERNATE },
+ { XML_FALSE, drawing::TextAnimationKind_SLIDE },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_TextAnimationDirection_Enum[] =
+{
+ { XML_LEFT, drawing::TextAnimationDirection_LEFT },
+ { XML_RIGHT, drawing::TextAnimationDirection_RIGHT }, // will be filtered
+ { XML_UP, drawing::TextAnimationDirection_UP },
+ { XML_DOWN, drawing::TextAnimationDirection_DOWN },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_TextAlign_Enum[] =
+{
+ { XML_LEFT, drawing::TextHorizontalAdjust_LEFT },
+ { XML_CENTER, drawing::TextHorizontalAdjust_CENTER },
+ { XML_RIGHT, drawing::TextHorizontalAdjust_RIGHT },
+ { XML_JUSTIFY, drawing::TextHorizontalAdjust_BLOCK },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_VerticalAlign_Enum[] =
+{
+ { XML_TOP, drawing::TextVerticalAdjust_TOP },
+ { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER },
+ { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM },
+ { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_FitToSize_Enum[] =
+{
+ { XML_FALSE, drawing::TextFitToSizeType_NONE },
+ { XML_TRUE, drawing::TextFitToSizeType_PROPORTIONAL },
+ { XML_TRUE, drawing::TextFitToSizeType_ALLLINES },
+ { XML_TRUE, drawing::TextFitToSizeType_RESIZEATTR },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_MeasureUnit_Enum[] =
+{
+ { XML_AUTOMATIC, 0 },
+ { XML_UNIT_MM, 1 },
+ { XML_UNIT_CM, 2 },
+ { XML_UNIT_M, 3 },
+ { XML_UNIT_KM, 4 },
+ { XML_UNIT_PT, 6 },
+ { XML_UNIT_PC, 7 },
+ { XML_UNIT_INCH, 8 },
+ { XML_UNIT_FOOT, 9 },
+ { XML_UNIT_MILES, 10 },
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Measure_HAlign_Enum[] =
+{
+ { XML_AUTOMATIC, drawing::MeasureTextHorzPos_AUTO },
+ { XML_LEFT_OUTSIDE, drawing::MeasureTextHorzPos_LEFTOUTSIDE },
+ { XML_INSIDE, drawing::MeasureTextHorzPos_INSIDE },
+ { XML_RIGHT_OUTSIDE, drawing::MeasureTextHorzPos_RIGHTOUTSIDE},
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Measure_VAlign_Enum[] =
+{
+ { XML_AUTOMATIC, drawing::MeasureTextVertPos_AUTO },
+ { XML_ABOVE, drawing::MeasureTextVertPos_EAST },
+ { XML_BELOW, drawing::MeasureTextVertPos_WEST },
+ { XML_CENTER, drawing::MeasureTextVertPos_CENTERED },
+ { XML_TOKEN_INVALID,0 }
+};
+
+// #FontWork#
+SvXMLEnumMapEntry __READONLY_DATA pXML_Fontwork_Style_Enum[] =
+{
+ { XML_ROTATE, 0 }, //XFT_ROTATE,
+ { XML_UPRIGHT, 1 }, //XFT_UPRIGHT,
+ { XML_SLANT_X, 2 }, //XFT_SLANTX,
+ { XML_SLANT_Y, 3 }, //XFT_SLANTY,
+ { XML_NONE, 4 }, //XFT_NONE
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Fontwork_Adjust_Enum[] =
+{
+ { XML_LEFT, 0 }, //XFT_LEFT,
+ { XML_RIGHT, 1 }, //XFT_RIGHT,
+ { XML_AUTOSIZE, 2 }, //XFT_AUTOSIZE,
+ { XML_CENTER, 3 }, //XFT_CENTER
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Fontwork_Shadow_Enum[] =
+{
+ { XML_NORMAL, 0 }, //XFTSHADOW_NORMAL,
+ { XML_SLANT, 1 }, //XFTSHADOW_SLANT,
+ { XML_NONE, 2 }, //XFTSHADOW_NONE
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Fontwork_Form_Enum[] =
+{
+ { XML_NONE, 0 }, //XFTFORM_NONE,
+ { XML_TOPCIRCLE, 1 }, //XFTFORM_TOPCIRC,
+ { XML_BOTTOMCIRCLE, 2 }, //XFTFORM_BOTCIRC,
+ { XML_LEFTCIRCLE, 3 }, //XFTFORM_LFTCIRC,
+ { XML_RIGHTCIRCLE, 4 }, //XFTFORM_RGTCIRC,
+ { XML_TOPARC, 5 }, //XFTFORM_TOPARC,
+ { XML_BOTTOMARC, 6 }, //XFTFORM_BOTARC,
+ { XML_LEFTARC, 7 }, //XFTFORM_LFTARC,
+ { XML_RIGHTARC, 8 }, //XFTFORM_RGTARC,
+ { XML_BUTTON1, 9 }, //XFTFORM_BUTTON1,
+ { XML_BUTTON2, 10 }, //XFTFORM_BUTTON2,
+ { XML_BUTTON3, 11 }, //XFTFORM_BUTTON3,
+ { XML_BUTTON4, 12 }, //XFTFORM_BUTTON4
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Caption_Esc_Dir_Enum[] =
+{
+ { XML_HORIZONTAL, 0 }, //SDRCAPT_ESCHORIZONTAL,
+ { XML_VERTICAL, 1 }, //SDRCAPT_ESCVERTICAL,
+ { XML_AUTO, 2 }, //SDRCAPT_ESCBESTFIT,
+ { XML_TOKEN_INVALID,0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Caption_Type_Enum[] =
+{
+ { XML_STRAIGHT_LINE, 0 }, //SDRCAPT_TYPE1,
+ { XML_ANGLED_LINE, 1 }, //SDRCAPT_TYPE2,
+ { XML_ANGLED_CONNECTOR_LINE, 2 }, //SDRCAPT_TYPE3,
+ { XML_TOKEN_INVALID,0 }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class XMLCaptionEscapeRelative : public XMLPropertyHandler
+{
+public:
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+sal_Bool XMLCaptionEscapeRelative::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue;
+
+ if( !SvXMLUnitConverter::convertPercent( nValue, rStrImpValue ) )
+ return sal_False;
+
+ nValue *= 100;
+ rValue <<= nValue;
+ return sal_True;
+}
+
+sal_Bool XMLCaptionEscapeRelative::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Int32 nValue = 0;
+ if( !(rValue >>= nValue ) )
+ return sal_False;
+
+ nValue /= 100;
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertPercent( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class XMLMoveSizeProtectHdl : public XMLPropertyHandler
+{
+public:
+ XMLMoveSizeProtectHdl( sal_Int32 nType ) : mnType( nType ) {}
+
+ virtual sal_Bool importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML(
+ ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const;
+private:
+ const sal_Int32 mnType;
+};
+
+sal_Bool XMLMoveSizeProtectHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const
+{
+ const sal_Bool bValue = rStrImpValue.indexOf( GetXMLToken( mnType == XML_SD_TYPE_MOVE_PROTECT ? XML_POSITION : XML_SIZE ) ) != -1;
+ rValue <<= bValue;
+ return sal_True;
+}
+
+sal_Bool XMLMoveSizeProtectHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& ) const
+{
+ sal_Bool bValue = sal_Bool();
+ if( !(rValue >>= bValue ) )
+ return sal_False;
+
+ if( bValue )
+ {
+ if( rStrExpValue.getLength() )
+ rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+
+ rStrExpValue += GetXMLToken( mnType == XML_SD_TYPE_MOVE_PROTECT ? XML_POSITION : XML_SIZE );
+ }
+
+ return sal_True;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class XMLSdHeaderFooterVisibilityTypeHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLSdHeaderFooterVisibilityTypeHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+XMLSdHeaderFooterVisibilityTypeHdl::~XMLSdHeaderFooterVisibilityTypeHdl()
+{
+}
+
+sal_Bool XMLSdHeaderFooterVisibilityTypeHdl::importXML(
+ const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ // #i38644#
+ // attributes with this type where saved with VISIBLE|HIDDEN prior
+ // to src680m67. So we have to import that correctly
+ const sal_Bool bBool = IsXMLToken(rStrImpValue, XML_TRUE) || IsXMLToken(rStrImpValue, XML_VISIBLE);
+ rValue <<= bBool;
+ return bBool || IsXMLToken(rStrImpValue, XML_FALSE) || IsXMLToken(rStrImpValue, XML_HIDDEN);
+}
+
+sal_Bool XMLSdHeaderFooterVisibilityTypeHdl::exportXML(
+ OUString& rStrExpValue,
+ const Any& rValue,
+ const SvXMLUnitConverter& ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Bool bValue = sal_Bool();
+
+ if (rValue >>= bValue)
+ {
+ SvXMLUnitConverter::convertBool( aOut, bValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > xModel, SvXMLImport& rImport )
+: mxModel( xModel ), mpExport(0), mpImport( &rImport )
+{
+}
+
+XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > xModel, SvXMLExport& rExport )
+: mxModel( xModel ), mpExport( &rExport ), mpImport(0)
+{
+}
+
+XMLSdPropHdlFactory::~XMLSdPropHdlFactory()
+{
+}
+
+const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
+{
+ const XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
+ if(!pHdl)
+ {
+ switch(nType)
+ {
+ case XML_SD_TYPE_STROKE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_LineStyle_EnumMap, ::getCppuType((const drawing::LineStyle*)0) );
+ break;
+ }
+ case XML_SD_TYPE_LINEJOIN :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_LineJoint_EnumMap, ::getCppuType((const drawing::LineJoint*)0) );
+ break;
+ }
+ case XML_SD_TYPE_FILLSTYLE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const drawing::FillStyle*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_TYPE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_PresChange_EnumMap, ::getCppuType((const sal_Int32*)0) );
+ break;
+ }
+ case XML_SD_TYPE_SHADOW :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
+ break;
+ }
+ case XML_TYPE_SD_MIRROR:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_HORIZONTAL), GetXMLToken(XML_NONE) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_STYLE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_FadeEffect_EnumMap, ::getCppuType((const presentation::FadeEffect*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_SPEED :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TransSpeed_EnumMap, ::getCppuType((const presentation::AnimationSpeed*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_DURATION :
+ {
+ pHdl = new XMLDurationPropertyHdl();
+ break;
+ }
+ case XML_SD_TYPE_TEXT_CROSSEDOUT :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_SOLID), GetXMLToken(XML_NONE) );
+ break;
+ }
+ case XML_SD_TYPE_OPACITY :
+ {
+ pHdl = new XMLOpacityPropertyHdl(mpImport);
+ break;
+ }
+ case XML_SD_TYPE_WRITINGMODE :
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_WritingMode_EnumMap, ::getCppuType((const text::WritingMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_VISIBILITY :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
+ break;
+ }
+ case XML_SD_TYPE_PRESPAGE_BACKSIZE:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FULL), GetXMLToken(XML_BORDER) );
+ break;
+ }
+
+ //////////////////////////////////////////////////////////////////
+ // 3D Properties
+
+ case XML_SD_TYPE_BACKFACE_CULLING:
+ {
+ // #87922# DoubleSided -> BackfaceCulling
+ // This BOOL needs to be flipped, DoubleSided TRUE -> NO Backface culling
+ // and vice versa.
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_DISABLED), GetXMLToken(XML_ENABLED) );
+ break;
+ }
+
+ case XML_SD_TYPE_NORMALS_KIND:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_NormalsKind_EnumMap, ::getCppuType((const drawing::NormalsKind*)0) );
+ break;
+ }
+ case XML_SD_TYPE_NORMALS_DIRECTION:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_NORMAL), GetXMLToken(XML_INVERSE) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_GENERATION_MODE_X:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexGenerationX_EnumMap, ::getCppuType((const drawing::TextureProjectionMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_GENERATION_MODE_Y:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexGenerationY_EnumMap, ::getCppuType((const drawing::TextureProjectionMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_KIND:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexKind_EnumMap, ::getCppuType((const drawing::TextureKind*)0) );
+ break;
+ }
+ case XML_SD_TYPE_TEX_MODE:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_TexMode_EnumMap, ::getCppuType((const drawing::TextureMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_NUMBULLET:
+ {
+ uno::Reference<ucb::XAnyCompareFactory> xCompareFac( mxModel, uno::UNO_QUERY );
+ uno::Reference<ucb::XAnyCompare> xCompare;
+ if( xCompareFac.is() )
+ xCompare = xCompareFac->createAnyCompareByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ) );
+
+ pHdl = new XMLNumRulePropHdl( xCompare );
+ break;
+ }
+ case XML_SD_TYPE_BITMAP_MODE:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const drawing::BitmapMode*)0) );
+ break;
+ }
+ case XML_SD_TYPE_BITMAPREPOFFSETX:
+ case XML_SD_TYPE_BITMAPREPOFFSETY:
+ {
+ pHdl = new XMLBitmapRepeatOffsetPropertyHandler( nType == XML_SD_TYPE_BITMAPREPOFFSETX );
+ break;
+ }
+ case XML_SD_TYPE_FILLBITMAPSIZE:
+ {
+ pHdl = new XMLFillBitmapSizePropertyHandler();
+ break;
+ }
+ case XML_SD_TYPE_LOGICAL_SIZE:
+ {
+ pHdl = new XMLBitmapLogicalSizePropertyHandler();
+ break;
+ }
+ case XML_SD_TYPE_BITMAP_REFPOINT:
+ {
+ pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const ::com::sun::star::drawing::RectanglePoint*)0) );
+ break;
+ }
+ case XML_TYPE_TEXT_ANIMATION:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAnimation_Enum, ::getCppuType((const com::sun::star::drawing::TextAnimationKind*)0) );
+ break;
+ case XML_TYPE_TEXT_ANIMATION_BLINKING:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAnimation_Blinking_Enum, ::getCppuType((const com::sun::star::drawing::TextAnimationKind*)0) );
+ break;
+ case XML_TYPE_TEXT_ANIMATION_DIRECTION:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAnimationDirection_Enum, ::getCppuType((const com::sun::star::drawing::TextAnimationDirection*)0) );
+ break;
+ case XML_TYPE_TEXT_ANIMATION_STEPS:
+ pHdl = new XMLTextAnimationStepPropertyHdl;
+ break;
+ case XML_SD_TYPE_TEXT_ALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_TextAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextHorizontalAdjust*)0) );
+ break;
+ case XML_SD_TYPE_VERTICAL_ALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::drawing::TextVerticalAdjust*)0) );
+ break;
+ case XML_SD_TYPE_FITTOSIZE:
+ pHdl = new XMLEnumPropertyHdl( pXML_FitToSize_Enum, ::getCppuType((const com::sun::star::drawing::TextFitToSizeType*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_UNIT:
+ pHdl = new XMLEnumPropertyHdl( pXML_MeasureUnit_Enum, ::getCppuType((const sal_Int32*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_HALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_Measure_HAlign_Enum, ::getCppuType((const com::sun::star::drawing::MeasureTextHorzPos*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_VALIGN:
+ pHdl = new XMLEnumPropertyHdl( pXML_Measure_VAlign_Enum, ::getCppuType((const com::sun::star::drawing::MeasureTextVertPos*)0) );
+ break;
+ case XML_SD_TYPE_MEASURE_PLACING:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_BELOW), GetXMLToken(XML_ABOVE) );
+ }
+ break;
+ case XML_TYPE_TEXT_CLIP11:
+ pHdl = new XMLClipPropertyHandler( sal_True );
+ break;
+ case XML_TYPE_TEXT_CLIP:
+ pHdl = new XMLClipPropertyHandler( sal_False );
+ break;
+
+ // #FontWork#
+ case XML_SD_TYPE_FONTWORK_STYLE :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Style_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_FONTWORK_ADJUST :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Adjust_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_FONTWORK_SHADOW :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Shadow_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_FONTWORK_FORM :
+ pHdl = new XMLEnumPropertyHdl( pXML_Fontwork_Form_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+
+ case XML_SD_TYPE_CONTROL_BORDER:
+ pHdl = new ::xmloff::OControlBorderHandler( ::xmloff::OControlBorderHandler::STYLE );
+ break;
+ case XML_SD_TYPE_CONTROL_BORDER_COLOR:
+ pHdl = new ::xmloff::OControlBorderHandler( ::xmloff::OControlBorderHandler::COLOR );
+ break;
+ case XML_SD_TYPE_IMAGE_SCALE_MODE:
+ pHdl = new ::xmloff::ImageScaleModeHandler;
+ break;
+ case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
+ pHdl = new ::xmloff::OControlTextEmphasisHandler;
+ break;
+
+ case XML_SD_TYPE_CAPTION_ANGLE_TYPE:
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FIXED), GetXMLToken(XML_FREE) );
+ break;
+ }
+ case XML_SD_TYPE_CAPTION_IS_ESC_REL:
+ pHdl = new XMLIsPercentagePropertyHandler();
+ break;
+ case XML_SD_TYPE_CAPTION_ESC_REL:
+ pHdl = new XMLCaptionEscapeRelative();
+ break;
+ case XML_SD_TYPE_CAPTION_ESC_ABS:
+ pHdl = new XMLPercentOrMeasurePropertyHandler( sal_False );
+ break;
+ case XML_SD_TYPE_CAPTION_ESC_DIR:
+ pHdl = new XMLEnumPropertyHdl( pXML_Caption_Esc_Dir_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_CAPTION_TYPE:
+ pHdl = new XMLEnumPropertyHdl( pXML_Caption_Type_Enum , ::getCppuType((const sal_Int32*)0));
+ break;
+ case XML_SD_TYPE_DATETIMEUPDATE:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FIXED), GetXMLToken(XML_VARIABLE) );
+ break;
+ case XML_SD_TYPE_DATETIME_FORMAT:
+ pHdl = new XMLDateTimeFormatHdl( mpExport );
+ break;
+ case XML_SD_TYPE_TRANSITION_TYPE:
+ pHdl = new XMLEnumPropertyHdl( xmloff::getAnimationsEnumMap(xmloff::Animations_EnumMap_TransitionType) , ::getCppuType((const sal_Int16*)0));
+ break;
+ case XML_SD_TYPE_TRANSTIION_SUBTYPE:
+ pHdl = new XMLEnumPropertyHdl( xmloff::getAnimationsEnumMap(xmloff::Animations_EnumMap_TransitionSubType) , ::getCppuType((const sal_Int16*)0));
+ break;
+ case XML_SD_TYPE_TRANSTIION_DIRECTION:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_FORWARD), GetXMLToken(XML_REVERSE) );
+ break;
+ case XML_TYPE_WRAP_OPTION:
+ pHdl = new XMLWordWrapPropertyHdl( mpImport );
+ break;
+
+ case XML_SD_TYPE_MOVE_PROTECT:
+ case XML_SD_TYPE_SIZE_PROTECT:
+ pHdl = new XMLMoveSizeProtectHdl( nType );
+ break;
+ case XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE:
+ pHdl = new XMLSdHeaderFooterVisibilityTypeHdl();
+ break;
+ }
+
+ if(pHdl)
+ PutHdlCache(nType, pHdl);
+ }
+
+ return pHdl;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapePropertySetMapper::XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef)
+: XMLPropertySetMapper( aXMLSDProperties, rFactoryRef )
+{
+}
+
+XMLShapePropertySetMapper::XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef, sal_uInt16 nOffset)
+: XMLPropertySetMapper( &aXMLSDProperties[nOffset], rFactoryRef )
+{
+}
+
+XMLShapePropertySetMapper::~XMLShapePropertySetMapper()
+{
+}
+
+// ----------------------------------------
+
+XMLShapeExportPropertyMapper::XMLShapeExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, XMLTextListAutoStylePool *pListAutoPool, SvXMLExport& rExport )
+: SvXMLExportPropertyMapper( rMapper )
+, mpListAutoPool( pListAutoPool )
+, mrExport( rExport )
+, maNumRuleExp( rExport )
+, mbIsInAutoStyles( sal_True )
+, msCDATA( GetXMLToken(XML_CDATA))
+, msTrue( GetXMLToken(XML_TRUE))
+, msFalse( GetXMLToken(XML_FALSE))
+{
+}
+
+XMLShapeExportPropertyMapper::~XMLShapeExportPropertyMapper()
+{
+}
+
+void XMLShapeExportPropertyMapper::ContextFilter(
+ std::vector< XMLPropertyState >& rProperties,
+ uno::Reference< beans::XPropertySet > rPropSet ) const
+{
+ XMLPropertyState* pRepeatOffsetX = NULL;
+ XMLPropertyState* pRepeatOffsetY = NULL;
+ XMLPropertyState* pTextAnimationBlinking = NULL;
+ XMLPropertyState* pTextAnimationKind = NULL;
+
+ // #FontWork#
+ XMLPropertyState* pFontWorkStyle = NULL;
+ XMLPropertyState* pFontWorkAdjust = NULL;
+ XMLPropertyState* pFontWorkDistance = NULL;
+ XMLPropertyState* pFontWorkStart = NULL;
+ XMLPropertyState* pFontWorkMirror = NULL;
+ XMLPropertyState* pFontWorkOutline = NULL;
+ XMLPropertyState* pFontWorkShadow = NULL;
+ XMLPropertyState* pFontWorkShadowColor = NULL;
+ XMLPropertyState* pFontWorkShadowOffsetx = NULL;
+ XMLPropertyState* pFontWorkShadowOffsety = NULL;
+ XMLPropertyState* pFontWorkForm = NULL;
+ XMLPropertyState* pFontWorkHideform = NULL;
+ XMLPropertyState* pFontWorkShadowTransparence = NULL;
+
+ // OLE
+ XMLPropertyState* pOLEVisAreaLeft = NULL;
+ XMLPropertyState* pOLEVisAreaTop = NULL;
+ XMLPropertyState* pOLEVisAreaWidth = NULL;
+ XMLPropertyState* pOLEVisAreaHeight = NULL;
+ XMLPropertyState* pOLEIsInternal = NULL;
+
+ // caption
+ XMLPropertyState* pCaptionIsEscRel = NULL;
+ XMLPropertyState* pCaptionEscRel = NULL;
+ XMLPropertyState* pCaptionEscAbs = NULL;
+
+ // filter fo:clip
+ XMLPropertyState* pClip11State = NULL;
+ XMLPropertyState* pClipState = NULL;
+
+ XMLPropertyState* pShapeWritingMode = NULL;
+ XMLPropertyState* pTextWritingMode = NULL;
+ XMLPropertyState* pControlWritingMode = NULL;
+
+ // filter properties
+ for( std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
+ aIter != rProperties.end();
+ ++aIter )
+ {
+ XMLPropertyState *property = &(*aIter);
+ if( property->mnIndex == -1 )
+ continue;
+
+ // find properties with context
+ // to prevent writing this property set mnIndex member to -1
+ switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
+ {
+ case CTF_NUMBERINGRULES:
+ {
+ if( mbIsInAutoStyles )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_SD_NUMBERINGRULES_NAME:
+ {
+ // this property is not exported in the style:properties element
+ // because its an XIndexAccess and not a string.
+ // This will be handled in SvXMLAutoStylePoolP::exportStyleAttributes
+ // This is suboptimal
+ if( !mbIsInAutoStyles )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_WRITINGMODE:
+ {
+ pShapeWritingMode = property;
+ text::WritingMode eWritingMode;
+ if( property->maValue >>= eWritingMode )
+ {
+ if( text::WritingMode_LR_TB == eWritingMode )
+ {
+ property->mnIndex = -1;
+ pShapeWritingMode = 0;
+ }
+ }
+ }
+ break;
+ case CTF_CONTROLWRITINGMODE:
+ pControlWritingMode = property;
+ break;
+ case CTF_TEXTWRITINGMODE:
+ pTextWritingMode = property;
+ break;
+ case CTF_REPEAT_OFFSET_X:
+ pRepeatOffsetX = property;
+ break;
+
+ case CTF_REPEAT_OFFSET_Y:
+ pRepeatOffsetY = property;
+ break;
+
+ case CTF_DASHNAME:
+ case CTF_FILLGRADIENTNAME:
+ case CTF_FILLHATCHNAME:
+ case CTF_FILLBITMAPNAME:
+ {
+ OUString aStr;
+ if( (property->maValue >>= aStr) && 0 == aStr.getLength() )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_TEXTANIMATION_BLINKING:
+ pTextAnimationBlinking = property;
+ break;
+ case CTF_TEXTANIMATION_KIND:
+ pTextAnimationKind = property;
+ break;
+
+ // #FontWork#
+ case CTF_FONTWORK_STYLE: pFontWorkStyle = property; break;
+ case CTF_FONTWORK_ADJUST: pFontWorkAdjust = property; break;
+ case CTF_FONTWORK_DISTANCE: pFontWorkDistance = property; break;
+ case CTF_FONTWORK_START: pFontWorkStart = property; break;
+ case CTF_FONTWORK_MIRROR: pFontWorkMirror = property; break;
+ case CTF_FONTWORK_OUTLINE: pFontWorkOutline = property; break;
+ case CTF_FONTWORK_SHADOW: pFontWorkShadow = property; break;
+ case CTF_FONTWORK_SHADOWCOLOR: pFontWorkShadowColor = property; break;
+ case CTF_FONTWORK_SHADOWOFFSETX: pFontWorkShadowOffsetx = property; break;
+ case CTF_FONTWORK_SHADOWOFFSETY: pFontWorkShadowOffsety = property; break;
+ case CTF_FONTWORK_FORM: pFontWorkForm = property; break;
+ case CTF_FONTWORK_HIDEFORM: pFontWorkHideform = property; break;
+ case CTF_FONTWORK_SHADOWTRANSPARENCE: pFontWorkShadowTransparence = property; break;
+
+ // OLE
+ case CTF_SD_OLE_VIS_AREA_EXPORT_LEFT: pOLEVisAreaLeft = property; break;
+ case CTF_SD_OLE_VIS_AREA_EXPORT_TOP: pOLEVisAreaTop = property; break;
+ case CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH: pOLEVisAreaWidth = property; break;
+ case CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT: pOLEVisAreaHeight = property; break;
+ case CTF_SD_OLE_ISINTERNAL: pOLEIsInternal = property; break;
+
+ case CTF_FRAME_DISPLAY_SCROLLBAR:
+ {
+ if( !property->maValue.hasValue() )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_FRAME_MARGIN_HORI:
+ case CTF_FRAME_MARGIN_VERT:
+ {
+ sal_Int32 nValue = 0;
+ if( (property->maValue >>= nValue) && (nValue < 0) )
+ property->mnIndex = -1;
+ }
+ break;
+
+ case CTF_SD_MOVE_PROTECT:
+ {
+ sal_Bool bProtected = sal_Bool();
+ if( (property->maValue >>= bProtected) && !bProtected )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_SD_SIZE_PROTECT:
+ {
+ sal_Bool bProtected = sal_Bool();
+ if( (property->maValue >>= bProtected) && !bProtected )
+ property->mnIndex = -1;
+ }
+ break;
+ case CTF_CAPTION_ISESCREL: pCaptionIsEscRel = property; break;
+ case CTF_CAPTION_ESCREL: pCaptionEscRel = property; break;
+ case CTF_CAPTION_ESCABS: pCaptionEscAbs = property; break;
+ case CTF_TEXT_CLIP11: pClip11State = property; break;
+ case CTF_TEXT_CLIP: pClipState = property; break;
+ }
+ }
+
+ // check for duplicate writing mode
+ if( pShapeWritingMode && (pTextWritingMode || pControlWritingMode) )
+ {
+ if( pTextWritingMode )
+ pTextWritingMode->mnIndex = -1;
+ if( pControlWritingMode )
+ pControlWritingMode->mnIndex = -1;
+ }
+ else if( pTextWritingMode && pControlWritingMode )
+ {
+ pControlWritingMode->mnIndex = -1;
+ }
+
+ // do not export visual area for internal ole objects
+ if( pOLEIsInternal )
+ {
+ sal_Bool bInternal = sal_Bool();
+ if( (pOLEIsInternal->maValue >>= bInternal) && !bInternal )
+ {
+ try
+ {
+ const OUString sVisibleArea( RTL_CONSTASCII_USTRINGPARAM("VisibleArea") );
+ awt::Rectangle aRect;
+ if( rPropSet->getPropertyValue( sVisibleArea ) >>= aRect )
+ {
+ if( pOLEVisAreaLeft )
+ {
+ pOLEVisAreaLeft->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_LEFT );
+ pOLEVisAreaLeft->maValue <<= aRect;
+ }
+ if( pOLEVisAreaTop )
+ {
+ pOLEVisAreaTop->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_TOP );
+ pOLEVisAreaTop->maValue <<= aRect;
+ }
+ if( pOLEVisAreaWidth )
+ {
+ pOLEVisAreaWidth->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH );
+ pOLEVisAreaWidth->maValue <<= aRect;
+ }
+ if( pOLEVisAreaHeight )
+ {
+ pOLEVisAreaHeight->mnIndex = getPropertySetMapper()->FindEntryIndex( CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT );
+ pOLEVisAreaHeight->maValue <<= aRect;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ else
+ {
+ if( pOLEVisAreaLeft ) pOLEVisAreaLeft->mnIndex = -1;
+ if( pOLEVisAreaTop ) pOLEVisAreaTop->mnIndex = -1;
+ if( pOLEVisAreaWidth ) pOLEVisAreaWidth->mnIndex = -1;
+ if( pOLEVisAreaHeight ) pOLEVisAreaHeight->mnIndex = -1;
+ }
+
+ pOLEIsInternal->mnIndex = -1;
+ }
+
+ if( pTextAnimationBlinking && pTextAnimationKind )
+ {
+ drawing::TextAnimationKind eKind;
+ if( (pTextAnimationKind->maValue >>= eKind) && eKind != drawing::TextAnimationKind_BLINK )
+ {
+ pTextAnimationBlinking->mnIndex = -1;
+ }
+ else
+ {
+ pTextAnimationKind->mnIndex = -1;
+ }
+ }
+
+ if( pRepeatOffsetX && pRepeatOffsetY )
+ {
+ sal_Int32 nOffset = 0;
+ if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
+ pRepeatOffsetX->mnIndex = -1;
+ else
+ pRepeatOffsetY->mnIndex = -1;
+ }
+
+ if(pFontWorkStyle)
+ {
+ // #FontWork#
+ sal_Int32 nStyle = 0;
+
+ if(pFontWorkStyle->maValue >>= nStyle)
+ {
+ if(/*XFT_NONE*/4 == nStyle)
+ {
+ pFontWorkStyle->mnIndex = -1;
+ if(pFontWorkAdjust)
+ pFontWorkAdjust->mnIndex = -1;
+ if(pFontWorkDistance)
+ pFontWorkDistance->mnIndex = -1;
+ if(pFontWorkStart)
+ pFontWorkStart->mnIndex = -1;
+ if(pFontWorkMirror)
+ pFontWorkMirror->mnIndex = -1;
+ if(pFontWorkOutline)
+ pFontWorkOutline->mnIndex = -1;
+ if(pFontWorkShadow)
+ pFontWorkShadow->mnIndex = -1;
+ if(pFontWorkShadowColor)
+ pFontWorkShadowColor->mnIndex = -1;
+ if(pFontWorkShadowOffsetx)
+ pFontWorkShadowOffsetx->mnIndex = -1;
+ if(pFontWorkShadowOffsety)
+ pFontWorkShadowOffsety->mnIndex = -1;
+ if(pFontWorkForm)
+ pFontWorkForm->mnIndex = -1;
+ if(pFontWorkHideform)
+ pFontWorkHideform->mnIndex = -1;
+ if(pFontWorkShadowTransparence)
+ pFontWorkShadowTransparence->mnIndex = -1;
+ }
+ }
+ }
+
+ if( pCaptionIsEscRel )
+ {
+ sal_Bool bIsRel = false;
+ pCaptionIsEscRel->maValue >>= bIsRel;
+
+ if( bIsRel )
+ {
+ if( pCaptionEscAbs )
+ pCaptionEscAbs->mnIndex = -1;
+ }
+ else
+ {
+ if( pCaptionEscRel )
+ pCaptionEscRel->mnIndex = -1;
+ }
+
+ pCaptionIsEscRel->mnIndex = -1;
+ }
+
+ if( pClipState != NULL && pClip11State != NULL )
+ pClip11State->mnIndex = -1;
+
+ SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
+}
+
+void XMLShapeExportPropertyMapper::handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_SD_CONTROL_SHAPE_DATA_STYLE:
+ // not to be handled by the base class
+ break;
+
+ default:
+ SvXMLExportPropertyMapper::handleSpecialItem( rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
+ break;
+ }
+}
+
+void XMLShapeExportPropertyMapper::handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_NUMBERINGRULES:
+ {
+ // only export list-styles as elements in styles section
+ if( !mbIsInAutoStyles )
+ {
+ uno::Reference< container::XIndexReplace > xNumRule( rProperty.maValue, uno::UNO_QUERY );
+ if( xNumRule.is() )
+ const_cast<XMLShapeExportPropertyMapper*>(this)->maNumRuleExp.exportNumberingRule( maStyleName, xNumRule );
+ }
+ }
+ break;
+ default:
+ SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty, nFlags, pProperties, nIdx );
+ break;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLPagePropertySetMapper::XMLPagePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef)
+: XMLPropertySetMapper( aXMLSDPresPageProps, rFactoryRef )
+{
+}
+
+XMLPagePropertySetMapper::~XMLPagePropertySetMapper()
+{
+}
+
+// ----------------------------------------
+
+XMLPageExportPropertyMapper::XMLPageExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, SvXMLExport& rExport ) :
+ SvXMLExportPropertyMapper( rMapper ),
+ mrExport( rExport ),
+ msCDATA( GetXMLToken(XML_CDATA))
+{
+}
+
+XMLPageExportPropertyMapper::~XMLPageExportPropertyMapper()
+{
+}
+
+void XMLPageExportPropertyMapper::ContextFilter(
+ std::vector< XMLPropertyState >& rProperties,
+ uno::Reference< beans::XPropertySet > rPropSet ) const
+{
+ XMLPropertyState* pRepeatOffsetX = NULL;
+ XMLPropertyState* pRepeatOffsetY = NULL;
+ XMLPropertyState* pTransType = NULL;
+ XMLPropertyState* pTransDuration = NULL;
+ XMLPropertyState* pDateTimeUpdate = NULL;
+ XMLPropertyState* pDateTimeFormat = NULL;
+ XMLPropertyState* pTransitionFadeColor = NULL;
+
+ sal_Int16 nTransitionType = 0;
+
+ // filter properties
+ for( std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
+ aIter != rProperties.end();
+ ++aIter )
+ {
+ XMLPropertyState *property = &(*aIter);
+ if( property->mnIndex == -1 )
+ continue;
+
+ // find properties with context
+ // to prevent writing this property set mnIndex member to -1
+ switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
+ {
+
+ case CTF_REPEAT_OFFSET_X:
+ pRepeatOffsetX = property;
+ break;
+
+ case CTF_REPEAT_OFFSET_Y:
+ pRepeatOffsetY = property;
+ break;
+ case CTF_PAGE_TRANS_TYPE:
+ pTransType = property;
+ break;
+ case CTF_PAGE_TRANS_STYLE:
+ if( mrExport.getExportFlags() & EXPORT_OASIS )
+ (*property).mnIndex = -1;
+ break;
+ case CTF_PAGE_TRANSITION_TYPE:
+ {
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) ||
+ (((*property).maValue >>= nTransitionType) && (nTransitionType == 0)) )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_TRANSITION_SUBTYPE:
+ {
+ sal_Int16 nTransitionSubtype = sal_Int16();
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) ||
+ (((*property).maValue >>= nTransitionSubtype) && (nTransitionSubtype == 0)) )
+ (*property).mnIndex = -1;
+
+ }
+ break;
+ case CTF_PAGE_TRANSITION_DIRECTION:
+ {
+ sal_Bool bDirection = sal_Bool();
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) ||
+ (((*property).maValue >>= bDirection) && bDirection) )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_TRANSITION_FADECOLOR:
+ if( ((mrExport.getExportFlags() & EXPORT_OASIS) == 0) )
+ (*property).mnIndex = -1;
+ else
+ pTransitionFadeColor = property;
+ break;
+ case CTF_PAGE_TRANS_SPEED:
+ {
+ presentation::AnimationSpeed aEnum;
+ if( ((*property).maValue >>= aEnum) && aEnum == presentation::AnimationSpeed_MEDIUM )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_VISIBLE:
+// case CTF_HEADER_VISIBLE:
+// case CTF_FOOTER_VISIBLE:
+// case CTF_PAGE_NUMBER_VISIBLE:
+// case CTF_DATE_TIME_VISIBLE:
+ {
+ sal_Bool bVisible = false;
+ (*property).maValue >>= bVisible;
+ if( bVisible )
+ (*property).mnIndex = -1;
+ }
+ break;
+ case CTF_PAGE_TRANS_DURATION:
+ pTransDuration = property;
+ break;
+ case CTF_HEADER_TEXT:
+ case CTF_FOOTER_TEXT:
+ case CTF_DATE_TIME_TEXT:
+ {
+ OUString aValue;
+ (*property).maValue >>= aValue;
+ if( aValue.getLength() == 0 )
+ (*property).mnIndex = -1;
+ }
+ break;
+
+ case CTF_DATE_TIME_UPDATE:
+ pDateTimeUpdate = property;
+ break;
+
+ case CTF_DATE_TIME_FORMAT:
+ pDateTimeFormat = property;
+ break;
+ }
+ }
+
+ if( pTransitionFadeColor && nTransitionType != ::com::sun::star::animations::TransitionType::FADE )
+ pTransitionFadeColor->mnIndex = -1;
+
+ if( pDateTimeFormat && pDateTimeUpdate )
+ {
+ sal_Bool bIsFixed = false;
+ pDateTimeUpdate->maValue >>= bIsFixed;
+ if( bIsFixed )
+ pDateTimeFormat->mnIndex = -1;
+ }
+
+ if( pRepeatOffsetX && pRepeatOffsetY )
+ {
+ sal_Int32 nOffset = 0;
+ if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
+ pRepeatOffsetX->mnIndex = -1;
+ else
+ pRepeatOffsetY->mnIndex = -1;
+ }
+
+ if( pTransType && pTransDuration )
+ {
+ sal_Int32 nChange = 0;
+ pTransType->maValue >>= nChange;
+
+ // only export duration for automatic
+ if( nChange != 1 )
+ pTransDuration->mnIndex = -1;
+
+ // do not export default transition change
+ if( nChange == 0 )
+ pTransType->mnIndex = -1;
+ }
+
+ SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
+}
+
+void XMLPageExportPropertyMapper::handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx) const
+{
+ switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
+ {
+ case CTF_PAGE_SOUND_URL:
+ {
+ OUString aSoundURL;
+ if( (rProperty.maValue >>= aSoundURL) && aSoundURL.getLength() != 0 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(aSoundURL) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
+ }
+ }
+ break;
+ default:
+ SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty, nFlags, pProperties, nIdx );
+ break;
+ }
+}
+
diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx
new file mode 100644
index 000000000000..e56379c0781f
--- /dev/null
+++ b/xmloff/source/draw/sdpropls.hxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDPROPLS_HXX
+#define _SDPROPLS_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <xmloff/xmlnume.hxx>
+#include <xmloff/maptype.hxx>
+#include <xmloff/xmltypes.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/prhdlfac.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include "XMLTextListAutoStylePool.hxx"
+#include <xmloff/xmlexppr.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for graphic properties
+
+extern const XMLPropertyMapEntry aXMLSDProperties[];
+
+//////////////////////////////////////////////////////////////////////////////
+// entry list for presentation page properties
+
+extern const XMLPropertyMapEntry aXMLSDPresPageProps[];
+extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[];
+
+//////////////////////////////////////////////////////////////////////////////
+// types of own properties
+
+#define XML_SD_TYPE_STROKE (XML_SD_TYPES_START + 0)
+#define XML_SD_TYPE_PRESPAGE_TYPE (XML_SD_TYPES_START + 1)
+#define XML_SD_TYPE_PRESPAGE_STYLE (XML_SD_TYPES_START + 2)
+#define XML_SD_TYPE_PRESPAGE_SPEED (XML_SD_TYPES_START + 3)
+#define XML_SD_TYPE_PRESPAGE_DURATION (XML_SD_TYPES_START + 4)
+#define XML_SD_TYPE_PRESPAGE_VISIBILITY (XML_SD_TYPES_START + 5)
+#define XML_SD_TYPE_MARKER (XML_SD_TYPES_START + 6 )
+#define XML_SD_TYPE_OPACITY (XML_SD_TYPES_START + 7 )
+#define XML_SD_TYPE_LINEJOIN (XML_SD_TYPES_START + 8 )
+#define XML_SD_TYPE_FILLSTYLE (XML_SD_TYPES_START + 9 )
+#define XML_SD_TYPE_GRADIENT (XML_SD_TYPES_START + 10 )
+#define XML_SD_TYPE_GRADIENT_STEPCOUNT (XML_SD_TYPES_START + 11 )
+#define XML_SD_TYPE_SHADOW (XML_SD_TYPES_START + 12 )
+#define XML_SD_TYPE_TEXT_CROSSEDOUT (XML_SD_TYPES_START + 13 )
+#define XML_SD_TYPE_NUMBULLET (XML_SD_TYPES_START + 14 )
+#define XML_SD_TYPE_WRITINGMODE (XML_SD_TYPES_START + 15 )
+#define XML_SD_TYPE_BITMAP_MODE (XML_SD_TYPES_START + 16 )
+#define XML_SD_TYPE_BITMAPREPOFFSETX (XML_SD_TYPES_START + 17 )
+#define XML_SD_TYPE_BITMAPREPOFFSETY (XML_SD_TYPES_START + 18 )
+#define XML_SD_TYPE_FILLBITMAPSIZE (XML_SD_TYPES_START + 19 )
+#define XML_SD_TYPE_LOGICAL_SIZE (XML_SD_TYPES_START + 20 )
+#define XML_SD_TYPE_BITMAP_REFPOINT (XML_SD_TYPES_START + 21 )
+#define XML_SD_TYPE_PRESPAGE_BACKSIZE (XML_SD_TYPES_START + 22 )
+#define XML_TYPE_TEXT_ANIMATION_BLINKING (XML_SD_TYPES_START + 23 )
+#define XML_TYPE_TEXT_ANIMATION_STEPS (XML_SD_TYPES_START + 24 )
+#define XML_SD_TYPE_TEXT_ALIGN (XML_SD_TYPES_START + 25 )
+#define XML_SD_TYPE_VERTICAL_ALIGN (XML_SD_TYPES_START + 26 )
+#define XML_SD_TYPE_FITTOSIZE (XML_SD_TYPES_START + 27 )
+#define XML_SD_TYPE_MEASURE_HALIGN (XML_SD_TYPES_START + 28 )
+#define XML_SD_TYPE_MEASURE_VALIGN (XML_SD_TYPES_START + 29 )
+#define XML_SD_TYPE_MEASURE_UNIT (XML_SD_TYPES_START + 30 )
+#define XML_SD_TYPE_MEASURE_PLACING (XML_SD_TYPES_START + 31 )
+#define XML_SD_TYPE_CONTROL_BORDER (XML_SD_TYPES_START + 32 )
+#define XML_SD_TYPE_CONTROL_BORDER_COLOR (XML_SD_TYPES_START + 33 )
+#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 )
+
+// 3D property types
+#define XML_SD_TYPE_BACKFACE_CULLING (XML_SD_TYPES_START + 40 )
+#define XML_SD_TYPE_NORMALS_KIND (XML_SD_TYPES_START + 41 )
+#define XML_SD_TYPE_NORMALS_DIRECTION (XML_SD_TYPES_START + 42 )
+#define XML_SD_TYPE_TEX_GENERATION_MODE_X (XML_SD_TYPES_START + 43 )
+#define XML_SD_TYPE_TEX_GENERATION_MODE_Y (XML_SD_TYPES_START + 44 )
+#define XML_SD_TYPE_TEX_KIND (XML_SD_TYPES_START + 45 )
+#define XML_SD_TYPE_TEX_MODE (XML_SD_TYPES_START + 46 )
+
+//////////////////////////////////////////////////////////////////////////////
+// #FontWork# types
+#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 )
+#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 )
+#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 )
+#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 )
+
+//////////////////////////////////////////////////////////////////////////////
+// Caption types
+#define XML_SD_TYPE_CAPTION_ANGLE_TYPE (XML_SD_TYPES_START + 60 )
+#define XML_SD_TYPE_CAPTION_IS_ESC_REL (XML_SD_TYPES_START + 61 )
+#define XML_SD_TYPE_CAPTION_ESC_REL (XML_SD_TYPES_START + 62 )
+#define XML_SD_TYPE_CAPTION_ESC_ABS (XML_SD_TYPES_START + 63 )
+#define XML_SD_TYPE_CAPTION_ESC_DIR (XML_SD_TYPES_START + 64 )
+#define XML_SD_TYPE_CAPTION_TYPE (XML_SD_TYPES_START + 65 )
+
+//////////////////////////////////////////////////////////////////////////////
+// header & footer types
+#define XML_SD_TYPE_DATETIMEUPDATE (XML_SD_TYPES_START + 70 )
+#define XML_SD_TYPE_DATETIME_FORMAT (XML_SD_TYPES_START + 71 )
+
+//////////////////////////////////////////////////////////////////////////////
+
+// new types for merged style:protect attribute
+#define XML_SD_TYPE_MOVE_PROTECT (XML_SD_TYPES_START + 72 )
+#define XML_SD_TYPE_SIZE_PROTECT (XML_SD_TYPES_START + 73 )
+
+// new type for style:mirror attribute
+#define XML_TYPE_SD_MIRROR (XML_SD_TYPES_START + 74 )
+
+//////////////////////////////////////////////////////////////////////////////
+
+// new smil transition types for pages
+#define XML_SD_TYPE_TRANSITION_TYPE (XML_SD_TYPES_START + 75 )
+#define XML_SD_TYPE_TRANSTIION_SUBTYPE (XML_SD_TYPES_START + 76 )
+#define XML_SD_TYPE_TRANSTIION_DIRECTION (XML_SD_TYPES_START + 77 )
+
+#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE (XML_SD_TYPES_START + 78 )
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define CTF_NUMBERINGRULES 1000
+#define CTF_CONTROLWRITINGMODE 1001
+#define CTF_WRITINGMODE 1002
+#define CTF_REPEAT_OFFSET_X 1003
+#define CTF_REPEAT_OFFSET_Y 1004
+#define CTF_PAGE_SOUND_URL 1005
+#define CTF_PAGE_VISIBLE 1006
+#define CTF_PAGE_TRANS_TYPE 1007
+#define CTF_PAGE_TRANS_STYLE 1008
+#define CTF_PAGE_TRANS_SPEED 1009
+#define CTF_PAGE_TRANS_DURATION 1010
+#define CTF_PAGE_BACKSIZE 1011
+#define CTF_DASHNAME 1012
+#define CTF_LINESTARTNAME 1013
+#define CTF_LINEENDNAME 1014
+#define CTF_FILLGRADIENTNAME 1015
+#define CTF_FILLHATCHNAME 1016
+#define CTF_FILLBITMAPNAME 1017
+#define CTF_FILLTRANSNAME 1018
+#define CTF_TEXTANIMATION_BLINKING 1019
+#define CTF_TEXTANIMATION_KIND 1020
+
+#define CTF_PAGE_TRANSITION_TYPE 1021
+#define CTF_PAGE_TRANSITION_SUBTYPE 1022
+#define CTF_PAGE_TRANSITION_DIRECTION 1023
+#define CTF_PAGE_TRANSITION_FADECOLOR 1024
+
+//////////////////////////////////////////////////////////////////////////////
+// #FontWork#
+#define CTF_FONTWORK_STYLE 1021
+#define CTF_FONTWORK_ADJUST 1022
+#define CTF_FONTWORK_DISTANCE 1023
+#define CTF_FONTWORK_START 1024
+#define CTF_FONTWORK_MIRROR 1025
+#define CTF_FONTWORK_OUTLINE 1026
+#define CTF_FONTWORK_SHADOW 1027
+#define CTF_FONTWORK_SHADOWCOLOR 1028
+#define CTF_FONTWORK_SHADOWOFFSETX 1029
+#define CTF_FONTWORK_SHADOWOFFSETY 1030
+#define CTF_FONTWORK_FORM 1031
+#define CTF_FONTWORK_HIDEFORM 1032
+#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033
+
+//////////////////////////////////////////////////////////////////////////////
+// OLE part 1
+#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT 1040
+#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP 1041
+#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH 1042
+#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT 1043
+#define CTF_SD_OLE_ISINTERNAL 1044
+
+#define CTF_SD_MOVE_PROTECT 1045
+#define CTF_SD_SIZE_PROTECT 1046
+
+//////////////////////////////////////////////////////////////////////////////
+// caption
+#define CTF_CAPTION_ISESCREL 1047
+#define CTF_CAPTION_ESCREL 1048
+#define CTF_CAPTION_ESCABS 1049
+
+//////////////////////////////////////////////////////////////////////////////
+// header&footer
+#define CTF_HEADER_VISIBLE 1050
+#define CTF_FOOTER_VISIBLE 1051
+#define CTF_PAGE_NUMBER_VISIBLE 1052
+#define CTF_DATE_TIME_VISIBLE 1053
+#define CTF_HEADER_TEXT 1054
+#define CTF_FOOTER_TEXT 1055
+#define CTF_DATE_TIME_TEXT 1056
+#define CTF_DATE_TIME_FORMAT 1057
+#define CTF_DATE_TIME_UPDATE 1058
+
+//////////////////////////////////////////////////////////////////////////////
+// OLE part 2
+#define CTF_SD_OLE_ASPECT 1059
+#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT 1060
+#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP 1061
+#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH 1062
+#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT 1063
+
+//////////////////////////////////////////////////////////////////////////////
+// enum maps for attributes
+
+extern SvXMLEnumMapEntry aXML_ConnectionKind_EnumMap[];
+extern SvXMLEnumMapEntry aXML_CircleKind_EnumMap[];
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** contains the attribute to property mapping for a drawing layer table */
+extern const XMLPropertyMapEntry aXMLTableShapeAttributes[];
+
+//////////////////////////////////////////////////////////////////////////////
+// factory for own graphic properties
+
+class SvXMLExport;
+class SvXMLImport;
+
+class XMLSdPropHdlFactory : public XMLPropertyHandlerFactory
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ SvXMLExport* mpExport;
+ SvXMLImport* mpImport;
+
+public:
+ XMLSdPropHdlFactory( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >, SvXMLExport& rExport );
+ XMLSdPropHdlFactory( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >, SvXMLImport& rImport );
+ virtual ~XMLSdPropHdlFactory();
+ virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
+};
+
+class XMLShapePropertySetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef);
+ XMLShapePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef, sal_uInt16 nOffset);
+ ~XMLShapePropertySetMapper();
+};
+
+class XMLShapeExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+private:
+ XMLTextListAutoStylePool *mpListAutoPool;
+ SvXMLExport& mrExport;
+ SvxXMLNumRuleExport maNumRuleExp;
+ sal_Bool mbIsInAutoStyles;
+
+ const rtl::OUString msCDATA;
+ const rtl::OUString msTrue;
+ const rtl::OUString msFalse;
+
+protected:
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+public:
+ XMLShapeExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, XMLTextListAutoStylePool *pListAutoPool, SvXMLExport& rExport );
+ virtual ~XMLShapeExportPropertyMapper();
+
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState >* pProperties = 0,
+ sal_uInt32 nIdx = 0
+ ) const;
+
+ void SetAutoStyles( sal_Bool bIsInAutoStyles ) { mbIsInAutoStyles = bIsInAutoStyles; }
+
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+};
+
+class XMLPagePropertySetMapper : public XMLPropertySetMapper
+{
+public:
+ XMLPagePropertySetMapper(const UniReference< XMLPropertyHandlerFactory >& rFactoryRef);
+ ~XMLPagePropertySetMapper();
+};
+
+class XMLPageExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+private:
+ SvXMLExport& mrExport;
+
+ const rtl::OUString msCDATA;
+ const rtl::OUString msTrue;
+ const rtl::OUString msFalse;
+
+protected:
+ virtual void ContextFilter(
+ ::std::vector< XMLPropertyState >& rProperties,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > rPropSet ) const;
+public:
+ XMLPageExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper, SvXMLExport& rExport );
+ virtual ~XMLPageExportPropertyMapper();
+
+ virtual void handleElementItem(
+ SvXMLExport& rExport,
+ const XMLPropertyState& rProperty,
+ sal_uInt16 nFlags,
+ const ::std::vector< XMLPropertyState >* pProperties = 0,
+ sal_uInt32 nIdx = 0
+ ) const;
+};
+
+#endif // _SDPROPLS_HXX
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
new file mode 100644
index 000000000000..862326495a70
--- /dev/null
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -0,0 +1,2991 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlmetae.hxx>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include "sdxmlexp_impl.hxx"
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <tools/gen.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/styleexp.hxx>
+#include "sdpropls.hxx"
+#include <xmloff/xmlexppr.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include "xexptran.hxx"
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+#include <comphelper/extract.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "PropertySetMerger.hxx"
+#include "layerexp.hxx"
+
+
+#include "VisAreaExport.hxx"
+#include "XMLNumberStylesExport.hxx"
+#include <tools/list.hxx>
+#include <tools/string.hxx>
+
+#include "animationexport.hxx"
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star::text;
+using namespace ::xmloff::token;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImpXMLEXPPageMasterInfo
+{
+ sal_Int32 mnBorderBottom;
+ sal_Int32 mnBorderLeft;
+ sal_Int32 mnBorderRight;
+ sal_Int32 mnBorderTop;
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+ view::PaperOrientation meOrientation;
+ OUString msName;
+ OUString msMasterPageName;
+
+public:
+ ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage);
+ BOOL operator==(const ImpXMLEXPPageMasterInfo& rInfo) const;
+ void SetName(const OUString& rStr);
+
+ const OUString& GetName() const { return msName; }
+ const OUString& GetMasterPageName() const { return msMasterPageName; }
+
+ sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
+ sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
+ sal_Int32 GetBorderRight() const { return mnBorderRight; }
+ sal_Int32 GetBorderTop() const { return mnBorderTop; }
+ sal_Int32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetHeight() const { return mnHeight; }
+ view::PaperOrientation GetOrientation() const { return meOrientation; }
+};
+
+ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
+ const SdXMLExport& rExp,
+ const Reference<XDrawPage>& xPage)
+: mnBorderBottom(0),
+ mnBorderLeft(0),
+ mnBorderRight(0),
+ mnBorderTop(0),
+ mnWidth(0),
+ mnHeight(0),
+ meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
+{
+ Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
+ if(xPropSet.is())
+ {
+ Any aAny;
+
+ Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom") )))
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")));
+ aAny >>= mnBorderBottom;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
+ aAny >>= mnBorderLeft;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")));
+ aAny >>= mnBorderRight;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
+ aAny >>= mnBorderTop;
+ }
+
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Width") )))
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
+ aAny >>= mnWidth;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
+ aAny >>= mnHeight;
+ }
+
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation") )))
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")));
+ aAny >>= meOrientation;
+ }
+ }
+
+ Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ msMasterPageName = xMasterNamed->getName();
+ }
+}
+
+BOOL ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const
+{
+ return ((mnBorderBottom == rInfo.mnBorderBottom)
+ && (mnBorderLeft == rInfo.mnBorderLeft)
+ && (mnBorderRight == rInfo.mnBorderRight)
+ && (mnBorderTop == rInfo.mnBorderTop)
+ && (mnWidth == rInfo.mnWidth)
+ && (mnHeight == rInfo.mnHeight)
+ && (meOrientation == rInfo.meOrientation));
+}
+
+void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
+{
+ msName = rStr;
+}
+
+DECLARE_LIST(ImpXMLEXPPageMasterList, ImpXMLEXPPageMasterInfo*)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define IMP_AUTOLAYOUT_INFO_MAX (35L)
+
+class ImpXMLAutoLayoutInfo
+{
+ sal_uInt16 mnType;
+ ImpXMLEXPPageMasterInfo* mpPageMasterInfo;
+ OUString msLayoutName;
+ Rectangle maTitleRect;
+ Rectangle maPresRect;
+ sal_Int32 mnGapX;
+ sal_Int32 mnGapY;
+
+public:
+ ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf);
+
+ BOOL operator==(const ImpXMLAutoLayoutInfo& rInfo) const;
+
+ sal_uInt16 GetLayoutType() const { return mnType; }
+ sal_Int32 GetGapX() const { return mnGapX; }
+ sal_Int32 GetGapY() const { return mnGapY; }
+
+ const OUString& GetLayoutName() const { return msLayoutName; }
+ void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; }
+
+ const Rectangle& GetTitleRectangle() const { return maTitleRect; }
+ const Rectangle& GetPresRectangle() const { return maPresRect; }
+
+ static BOOL IsCreateNecessary(sal_uInt16 nTyp);
+};
+
+BOOL ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp)
+{
+ if(nTyp == 5 /* AUTOLAYOUT_ORG */
+ || nTyp == 20 /* AUTOLAYOUT_NONE */
+ || nTyp >= IMP_AUTOLAYOUT_INFO_MAX)
+ return FALSE;
+ return TRUE;
+}
+
+BOOL ImpXMLAutoLayoutInfo::operator==(const ImpXMLAutoLayoutInfo& rInfo) const
+{
+ return ((mnType == rInfo.mnType
+ && mpPageMasterInfo == rInfo.mpPageMasterInfo));
+}
+
+ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf)
+: mnType(nTyp),
+ mpPageMasterInfo(pInf)
+{
+ // create full info (initialze with typical values)
+ Point aPagePos(0,0);
+ Size aPageSize(28000, 21000);
+ Size aPageInnerSize(28000, 21000);
+
+ if(mpPageMasterInfo)
+ {
+ aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop());
+ aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight());
+ aPageInnerSize = aPageSize;
+ aPageInnerSize.Width() -= mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight();
+ aPageInnerSize.Height() -= mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom();
+ }
+
+ // title rectangle aligning
+ Point aTitlePos(aPagePos);
+ Size aTitleSize(aPageInnerSize);
+
+ if(mnType == 21 /* AUTOLAYOUT_NOTES */)
+ {
+ aTitleSize.Height() = (long) (aTitleSize.Height() / 2.5);
+ Point aPos = aTitlePos;
+ aPos.Y() += long( aTitleSize.Height() * 0.083 );
+ Size aPartArea = aTitleSize;
+ Size aSize;
+
+ // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
+ double fH = (double) aPartArea.Width() / aPageSize.Width();
+ double fV = (double) aPartArea.Height() / aPageSize.Height();
+
+ if ( fH > fV )
+ fH = fV;
+ aSize.Width() = (long) (fH * aPageSize.Width());
+ aSize.Height() = (long) (fH * aPageSize.Height());
+
+ aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
+ aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
+
+ aTitlePos = aPos;
+ aTitleSize = aSize;
+ }
+ else if(mnType == 27 || mnType == 28)
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
+ // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ Point aClassicTPos(
+ aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
+ aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
+ Size aClassicTSize(
+ long( aTitleSize.Width() * 0.854 ),
+ long( aTitleSize.Height() * 0.167 ));
+ Point aLPos(aPagePos);
+ Size aLSize(aPageInnerSize);
+ Point aClassicLPos(
+ aLPos.X() + long( aLSize.Width() * 0.0735 ),
+ aLPos.Y() + long( aLSize.Height() * 0.472 ));
+ Size aClassicLSize(
+ long( aLSize.Width() * 0.854 ),
+ long( aLSize.Height() * 0.444 ));
+
+ aTitlePos.X() = (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height();
+ aTitlePos.Y() = aClassicTPos.Y();
+ aTitleSize.Width() = aClassicTSize.Height();
+ aTitleSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
+ }
+ else
+ {
+ aTitlePos.X() += long( aTitleSize.Width() * 0.0735 );
+ aTitlePos.Y() += long( aTitleSize.Height() * 0.083 );
+ aTitleSize.Width() = long( aTitleSize.Width() * 0.854 );
+ aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
+ }
+
+ maTitleRect.SetPos(aTitlePos);
+ maTitleRect.SetSize(aTitleSize);
+
+ // layout rectangle aligning
+ Point aLayoutPos(aPagePos);
+ Size aLayoutSize(aPageInnerSize);
+
+ if(mnType == 21 /* AUTOLAYOUT_NOTES */)
+ {
+ aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * 0.472 );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.444 );
+ }
+ else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT
+ {
+ // keep info for inner area in maPresRect, put info for gap size
+ // to maTitleRect position
+ mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2;
+ mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2;
+
+ if(!mnGapX)
+ mnGapX = aPageSize.Width() / 10;
+
+ if(!mnGapY)
+ mnGapY = aPageSize.Height() / 10;
+
+ if(mnGapX < aPageInnerSize.Width() / 10)
+ mnGapX = aPageInnerSize.Width() / 10;
+
+ if(mnGapY < aPageInnerSize.Height() / 10)
+ mnGapY = aPageInnerSize.Height() / 10;
+ }
+ else if(mnType == 27 || mnType == 28)
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
+ // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ Point aClassicTPos(
+ aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
+ aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
+ Size aClassicTSize(
+ long( aTitleSize.Width() * 0.854 ),
+ long( aTitleSize.Height() * 0.167 ));
+ Point aClassicLPos(
+ aLayoutPos.X() + long( aLayoutSize.Width() * 0.0735 ),
+ aLayoutPos.Y() + long( aLayoutSize.Height() * 0.472 ));
+ Size aClassicLSize(
+ long( aLayoutSize.Width() * 0.854 ),
+ long( aLayoutSize.Height() * 0.444 ));
+
+ aLayoutPos.X() = aClassicLPos.X();
+ aLayoutPos.Y() = aClassicTPos.Y();
+ aLayoutSize.Width() = (aClassicLPos.X() + aClassicLSize.Width())
+ - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height())));
+ aLayoutSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
+ }
+ else if( mnType == 32 )
+ {
+ // AUTOLAYOUT_ONLY_TEXT
+ aLayoutPos = aTitlePos;
+ aLayoutSize.Width() = aTitleSize.Width();
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.825 );
+ }
+ else
+ {
+ aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * 0.278 );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * 0.630 );
+ }
+
+ maPresRect.SetPos(aLayoutPos);
+ maPresRect.SetSize(aLayoutSize);
+}
+
+DECLARE_LIST(ImpXMLAutoLayoutInfoList, ImpXMLAutoLayoutInfo*)
+
+//////////////////////////////////////////////////////////////////////////////
+
+// #110680#
+SdXMLExport::SdXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nExportFlags )
+: SvXMLExport( xServiceFactory, MAP_CM, bIsDraw ? XML_DRAWING : XML_PRESENTATION, nExportFlags ),
+ mnDocMasterPageCount(0L),
+ mnDocDrawPageCount(0L),
+ mnShapeStyleInfoIndex(0L),
+ mnObjectCount(0L),
+ mpPageMasterInfoList(new ImpXMLEXPPageMasterList(1, 4, 4)),
+ mpPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
+ mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
+ mpHandoutPageMaster(NULL),
+ mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList(1, 4, 4)),
+ mpSdPropHdlFactory(0L),
+ mpPropertySetMapper(0L),
+ mpPresPagePropsMapper(0L),
+ mbIsDraw(bIsDraw),
+ mbFamilyGraphicUsed(FALSE),
+ mbFamilyPresentationUsed(FALSE),
+ msZIndex( GetXMLToken(XML_ZINDEX) ),
+ msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
+ msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
+ msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
+ msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
+ msPageLayoutNames( RTL_CONSTASCII_USTRINGPARAM("PageLayoutNames") )
+{
+
+
+}
+
+// XExporter
+void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SvXMLExport::setSourceDocument( xDoc );
+
+ const OUString aEmpty;
+
+ // prepare factory parts
+ mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this );
+ if(mpSdPropHdlFactory)
+ {
+ // set lock to avoid deletion
+ mpSdPropHdlFactory->acquire();
+
+ // build one ref
+ const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory;
+
+ // construct PropertySetMapper
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef);
+
+ mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&GetTextParagraphExport()->GetListAutoStylePool(), *this );
+ // set lock to avoid deletion
+ mpPropertySetMapper->acquire();
+
+ // chain text attributes
+ mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
+
+ // construct PresPagePropsMapper
+ xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef);
+
+ mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this );
+ if(mpPresPagePropsMapper)
+ {
+ // set lock to avoid deletion
+ mpPresPagePropsMapper->acquire();
+ }
+ }
+
+ // add family name
+ GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
+ GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
+ GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)),
+ GetPresPagePropsMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX)));
+ // prepare access to styles
+ Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY );
+ if(xFamSup.is())
+ {
+ mxDocStyleFamilies = xFamSup->getStyleFamilies();
+ }
+
+ // prepare access to master pages
+ Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY);
+ if(xMasterPagesSupplier.is())
+ {
+ mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
+ if(mxDocMasterPages.is())
+ {
+ mnDocMasterPageCount = mxDocMasterPages->getCount();
+ maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, aEmpty );
+ }
+ }
+
+ // prepare access to draw pages
+ Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY);
+ if(xDrawPagesSupplier.is())
+ {
+ mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
+ if(mxDocDrawPages.is())
+ {
+ mnDocDrawPageCount = mxDocDrawPages->getCount();
+ maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
+ maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
+ if( !mbIsDraw )
+ maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 );
+
+ HeaderFooterPageSettingsImpl aEmptySettings;
+ maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
+ maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
+ }
+ }
+
+ // #82003# count all draw objects for use with progress bar.
+ // #88245# init mnObjectCount once, use counter itself as flag. It
+ // is initialized to 0.
+ if(!mnObjectCount)
+ {
+ if( IsImpress() )
+ {
+ // #91587# add handout master count
+ Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY);
+ if(xHandoutSupp.is())
+ {
+ Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage());
+ if(xHandoutPage.is())
+ {
+ Reference<drawing::XShapes> xShapes(xHandoutPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xShapes);
+ }
+ }
+ }
+ }
+
+ if(mxDocMasterPages.is())
+ {
+ for(sal_Int32 a(0); a < mnDocMasterPageCount; a++)
+ {
+ Any aAny(mxDocMasterPages->getByIndex(a));
+ Reference< drawing::XShapes > xMasterPage;
+
+ if((aAny >>= xMasterPage) && xMasterPage.is())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xMasterPage);
+ }
+
+ if( IsImpress() )
+ {
+ // #91587# take notes pages from master pages into account
+ Reference<presentation::XPresentationPage> xPresPage;
+ if((aAny >>= xPresPage) && xPresPage.is())
+ {
+ Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xShapes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(mxDocDrawPages.is())
+ {
+ for(sal_Int32 a(0); a < mnDocDrawPageCount; a++)
+ {
+ Any aAny(mxDocDrawPages->getByIndex(a));
+ Reference< drawing::XShapes > xPage;
+
+ if((aAny >>= xPage) && xPage.is())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xPage);
+ }
+
+ if( IsImpress() )
+ {
+ // #91587# take notes pages from draw pages into account
+ Reference<presentation::XPresentationPage> xPresPage;
+ if((aAny >>= xPresPage) && xPresPage.is())
+ {
+ Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ mnObjectCount += ImpRecursiveObjectCount(xShapes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // #82003# init progress bar
+ GetProgressBarHelper()->SetReference(mnObjectCount);
+ }
+
+ // add namespaces
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_PRESENTATION),
+ GetXMLToken(XML_N_PRESENTATION),
+ XML_NAMESPACE_PRESENTATION);
+
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_SMIL),
+ GetXMLToken(XML_N_SMIL_COMPAT),
+ XML_NAMESPACE_SMIL);
+
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_ANIMATION),
+ GetXMLToken(XML_N_ANIMATION),
+ XML_NAMESPACE_ANIMATION);
+
+ if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
+ {
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_OFFICE_EXT),
+ GetXMLToken(XML_N_OFFICE_EXT),
+ XML_NAMESPACE_OFFICE_EXT);
+
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_DRAW_EXT),
+ GetXMLToken(XML_N_DRAW_EXT),
+ XML_NAMESPACE_DRAW_EXT);
+ }
+
+ GetShapeExport()->enableLayerExport();
+
+ // #88546# enable progress bar increments
+ GetShapeExport()->enableHandleProgressBar();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #82003# helper function for recursive object count
+sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(Reference< drawing::XShapes > xShapes)
+{
+ sal_uInt32 nRetval(0L);
+
+ if(xShapes.is())
+ {
+ sal_Int32 nCount = xShapes->getCount();
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ Any aAny(xShapes->getByIndex(a));
+ Reference< drawing::XShapes > xGroup;
+
+ if((aAny >>= xGroup) && xGroup.is())
+ {
+ // #93180# count group objects, too.
+ nRetval += 1 + ImpRecursiveObjectCount(xGroup);
+ }
+ else
+ {
+ nRetval++;
+ }
+ }
+ }
+
+ return nRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+__EXPORT SdXMLExport::~SdXMLExport()
+{
+ // cleanup factory, decrease refcount. Should lead to destruction.
+ if(mpSdPropHdlFactory)
+ {
+ mpSdPropHdlFactory->release();
+ mpSdPropHdlFactory = 0L;
+ }
+
+ // cleanup mapper, decrease refcount. Should lead to destruction.
+ if(mpPropertySetMapper)
+ {
+ mpPropertySetMapper->release();
+ mpPropertySetMapper = 0L;
+ }
+
+ // cleanup presPage mapper, decrease refcount. Should lead to destruction.
+ if(mpPresPagePropsMapper)
+ {
+ mpPresPagePropsMapper->release();
+ mpPresPagePropsMapper = 0L;
+ }
+
+ // clear evtl. temporary page master infos
+ if(mpPageMasterInfoList)
+ {
+ while(mpPageMasterInfoList->Count())
+ delete mpPageMasterInfoList->Remove(mpPageMasterInfoList->Count() - 1L);
+ delete mpPageMasterInfoList;
+ mpPageMasterInfoList = 0L;
+ }
+ if(mpPageMasterUsageList)
+ {
+ delete mpPageMasterUsageList;
+ mpPageMasterUsageList = 0L;
+ }
+ if(mpNotesPageMasterUsageList)
+ {
+ delete mpNotesPageMasterUsageList;
+ mpNotesPageMasterUsageList = 0L;
+ }
+
+ // clear auto-layout infos
+ if(mpAutoLayoutInfoList)
+ {
+ while(mpAutoLayoutInfoList->Count())
+ delete mpAutoLayoutInfoList->Remove(mpAutoLayoutInfoList->Count() - 1L);
+ delete mpAutoLayoutInfoList;
+ mpAutoLayoutInfoList = 0L;
+ }
+
+// #82003# status indicator stop is called exclusively
+// from SdXMLFilter::Export() now.
+//
+// stop progress view
+// if(GetStatusIndicator().is())
+// {
+// GetStatusIndicator()->end();
+// GetStatusIndicator()->reset();
+// }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// to get default values in XPropertySet use this wrapper class
+
+class ImpDefaultMapper : public ::cppu::WeakAggImplHelper1< beans::XPropertySet >
+{
+ Reference< beans::XPropertyState > mxState;
+ Reference< beans::XPropertySet > mxSet;
+
+public:
+ ImpDefaultMapper( Reference< beans::XPropertyState >& rxState );
+
+ // Methods
+ virtual Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // empty implementations
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+};
+
+ImpDefaultMapper::ImpDefaultMapper( Reference< beans::XPropertyState >& rxState )
+: mxState( rxState ),
+ mxSet( rxState, UNO_QUERY )
+{
+}
+
+Reference< beans::XPropertySetInfo > SAL_CALL ImpDefaultMapper::getPropertySetInfo() throw(uno::RuntimeException)
+{
+ return mxSet->getPropertySetInfo();
+}
+
+void SAL_CALL ImpDefaultMapper::setPropertyValue( const OUString& aPropertyName, const Any& /*aValue*/ ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ mxState->setPropertyToDefault( aPropertyName /*, aValue */ );
+}
+
+Any SAL_CALL ImpDefaultMapper::getPropertyValue( const OUString& PropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return mxState->getPropertyDefault( PropertyName );
+}
+
+// empty implementations
+void SAL_CALL ImpDefaultMapper::addPropertyChangeListener( const OUString&, const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL ImpDefaultMapper::removePropertyChangeListener( const OUString&, const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL ImpDefaultMapper::addVetoableChangeListener( const OUString&, const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL ImpDefaultMapper::removeVetoableChangeListener( const OUString&, const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/* moved to shapeexport.cxx
+void SdXMLExport::ImpWriteObjGraphicStyleInfos()
+{
+ XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
+ const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
+
+ // write graphic family default style
+ Reference< lang::XMultiServiceFactory > xFact( GetModel(), UNO_QUERY );
+ if( xFact.is() )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY );
+ if( xDefaults.is() )
+ {
+ aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), aMapperRef );
+
+ // write graphic family styles
+ aStEx.exportStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_NAME, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), aMapperRef, FALSE, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {
+ }
+ }
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpPrepAutoLayoutInfos()
+{
+ if(IsImpress())
+ {
+ OUString aStr;
+
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr))
+ maDrawPagesAutoLayoutNames[0] = aStr;
+ }
+ }
+
+ // prepare name creation
+ for(sal_Int32 nCnt = 0L; nCnt < mnDocDrawPageCount; nCnt++)
+ {
+ Any aAny(mxDocDrawPages->getByIndex(nCnt));
+ Reference<XDrawPage> xDrawPage;
+
+ if((aAny >>= xDrawPage) && xDrawPage.is())
+ {
+ if(ImpPrepAutoLayoutInfo(xDrawPage, aStr))
+ maDrawPagesAutoLayoutNames[nCnt+1] = aStr;
+ }
+ }
+ }
+}
+
+BOOL SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName)
+{
+ rName = OUString();
+ BOOL bRetval(FALSE);
+
+ Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
+ if(xPropSet.is())
+ {
+ sal_uInt16 nType = sal_uInt16();
+ Any aAny;
+
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")));
+ if(aAny >>= nType)
+ {
+ if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
+ {
+ ImpXMLEXPPageMasterInfo* pInfo = 0L;
+
+ // get master-page info
+ Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY);
+ if(xMasterPageInt.is())
+ {
+ Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
+ {
+ Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ OUString sMasterPageName = xMasterNamed->getName();
+ pInfo = ImpGetPageMasterInfoByName(sMasterPageName);
+ }
+ }
+ }
+
+ // create entry and look for existance
+ ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo);
+ BOOL bDidExist(FALSE);
+
+ for(sal_uInt32 nCnt = 0L; !bDidExist && nCnt < mpAutoLayoutInfoList->Count(); nCnt++)
+ {
+ if(*mpAutoLayoutInfoList->GetObject(nCnt) == *pNew)
+ {
+ delete pNew;
+ pNew = mpAutoLayoutInfoList->GetObject(nCnt);
+ bDidExist = TRUE;
+ }
+ }
+
+ if(!bDidExist)
+ {
+ mpAutoLayoutInfoList->Insert(pNew, LIST_APPEND);
+ OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("AL"));
+ sNewName += OUString::valueOf(sal_Int32(mpAutoLayoutInfoList->Count() - 1));
+ sNewName += OUString(RTL_CONSTASCII_USTRINGPARAM("T"));
+ sNewName += OUString::valueOf(sal_Int32(nType));
+ pNew->SetLayoutName(sNewName);
+ }
+
+ rName = pNew->GetLayoutName();
+ bRetval = TRUE;
+ }
+ }
+ }
+
+ return bRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWriteAutoLayoutInfos()
+{
+ if(mpAutoLayoutInfoList->Count())
+ {
+ for(sal_uInt32 nCnt = 0L; nCnt < mpAutoLayoutInfoList->Count(); nCnt++)
+ {
+ ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->GetObject(nCnt);
+ if(pInfo)
+ {
+ // prepare presentation-page layout attributes, style-name
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName());
+
+ // write draw-style attributes
+ SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, sal_True, sal_True);
+
+ // write presentation placeholders
+ switch(pInfo->GetLayoutType())
+ {
+ case 0 : // AUTOLAYOUT_TITLE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
+ break;
+ }
+ case 1 : // AUTOLAYOUT_ENUM
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle());
+ break;
+ }
+ case 2 : // AUTOLAYOUT_CHART
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle());
+ break;
+ }
+ case 3 : // AUTOLAYOUT_2TEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 4 : // AUTOLAYOUT_TEXTCHART
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight);
+ break;
+ }
+ case 6 : // AUTOLAYOUT_TEXTCLIP
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight);
+ break;
+ }
+ case 7 : // AUTOLAYOUT_CHARTTEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 8 : // AUTOLAYOUT_TAB
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle());
+ break;
+ }
+ case 9 : // AUTOLAYOUT_CLIPTEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 10 : // AUTOLAYOUT_TEXTOBJ
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight);
+ break;
+ }
+ case 11 : // AUTOLAYOUT_OBJ
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle());
+ break;
+ }
+ case 12 : // AUTOLAYOUT_TEXT2OBJ
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRightTop(aLeft);
+ aRightTop.Left() = long(aRightTop.Left() + aRightTop.GetWidth() * 1.05);
+ aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477));
+ Rectangle aRightBottom(aRightTop);
+ aRightBottom.Top() = long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom);
+ break;
+ }
+ case 13 : // AUTOLAYOUT_OBJTEXT
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 14 : // AUTOLAYOUT_OBJOVERTEXT
+ {
+ Rectangle aTop(pInfo->GetPresRectangle());
+ aTop.setHeight(long(aTop.GetHeight() * 0.477));
+ Rectangle aBottom(aTop);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
+ break;
+ }
+ case 15 : // AUTOLAYOUT_2OBJTEXT
+ {
+ Rectangle aLeftTop(pInfo->GetPresRectangle());
+ aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488));
+ Rectangle aRight(aLeftTop);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+ aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477));
+ Rectangle aLeftBottom(aLeftTop);
+ aLeftBottom.Top() = long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
+ break;
+ }
+ case 16 : // AUTOLAYOUT_2OBJOVERTEXT
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ Rectangle aBottom(aTopLeft);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
+ break;
+ }
+ case 17 : // AUTOLAYOUT_TEXTOVEROBJ
+ {
+ Rectangle aTop(pInfo->GetPresRectangle());
+ aTop.setHeight(long(aTop.GetHeight() * 0.477));
+ Rectangle aBottom(aTop);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom);
+ break;
+ }
+ case 18 : // AUTOLAYOUT_4OBJ
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight);
+ break;
+ }
+ case 19 : // AUTOLAYOUT_ONLY_TITLE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ break;
+ }
+ case 21 : // AUTOLAYOUT_NOTES
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle());
+ break;
+ }
+ case 22 : // AUTOLAYOUT_HANDOUT1
+ case 23 : // AUTOLAYOUT_HANDOUT2
+ case 24 : // AUTOLAYOUT_HANDOUT3
+ case 25 : // AUTOLAYOUT_HANDOUT4
+ case 26 : // AUTOLAYOUT_HANDOUT6
+ case 31 : // AUTOLAYOUT_HANDOUT9
+ {
+ sal_Int32 nColCnt, nRowCnt;
+ sal_Int32 nGapX = pInfo->GetGapX();
+ sal_Int32 nGapY = pInfo->GetGapY();
+
+ switch(pInfo->GetLayoutType())
+ {
+ case 22 : nColCnt = 1; nRowCnt = 1; break;
+ case 23 : nColCnt = 1; nRowCnt = 2; break;
+ case 24 : nColCnt = 1; nRowCnt = 3; break;
+ case 25 : nColCnt = 2; nRowCnt = 2; break;
+ case 26 : nColCnt = 3; nRowCnt = 2; break;
+ case 31 : nColCnt = 3; nRowCnt = 3; break;
+ default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values?
+ }
+
+ Size aPartSize(pInfo->GetTitleRectangle().GetSize());
+ Point aPartPos(pInfo->GetTitleRectangle().TopLeft());
+
+ if(aPartSize.Width() > aPartSize.Height())
+ {
+ sal_Int32 nZwi(nColCnt);
+ nColCnt = nRowCnt;
+ nRowCnt = nZwi;
+ }
+
+ aPartSize.Width() = (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt;
+ aPartSize.Height() = (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt;
+
+ Point aTmpPos(aPartPos);
+
+ for(sal_Int32 a = 0L; a < nRowCnt; a++)
+ {
+ aTmpPos.X() = aPartPos.X();
+
+ for(sal_Int32 b = 0L; b < nColCnt; b++)
+ {
+ Rectangle aTmpRect(aTmpPos, aPartSize);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect);
+ aTmpPos.X() += aPartSize.Width() + nGapX;
+ }
+
+ aTmpPos.Y() += aPartSize.Height() + nGapY;
+ }
+ break;
+ }
+ case 27 : // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
+ {
+ Rectangle aTop(pInfo->GetPresRectangle());
+ aTop.setHeight(long(aTop.GetHeight() * 0.488));
+ Rectangle aBottom(aTop);
+ aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom);
+ break;
+ }
+ case 28 : // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
+ break;
+ }
+ case 29 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
+ break;
+ }
+ case 30 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
+ {
+ Rectangle aLeft(pInfo->GetPresRectangle());
+ aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
+ Rectangle aRight(aLeft);
+ aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight);
+ break;
+ }
+ case 32 : // AUTOLAYOUT_TITLE
+ {
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
+ break;
+ }
+
+ case 33 : // AUTOLAYOUT_4CLIPART
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
+ break;
+ }
+
+ case 34 : // AUTOLAYOUT_6CLIPART
+ {
+ Rectangle aTopLeft(pInfo->GetPresRectangle());
+ aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
+ Rectangle aTopCenter(aTopLeft);
+ aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
+ Rectangle aTopRight(aTopLeft);
+ aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
+
+ Rectangle aBottomLeft(aTopLeft);
+ aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
+ Rectangle aBottomCenter(aTopCenter);
+ aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
+ Rectangle aBottomRight(aTopRight);
+ aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
+
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
+ ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("XMLEXP: unknown autolayout export");
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect)
+{
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // prepare presentation-placeholder attributes, presentation:object
+ switch(ePl)
+ {
+ case XmlPlaceholderTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("title")); break;
+ case XmlPlaceholderOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("outline")); break;
+ case XmlPlaceholderSubtitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle")); break;
+ case XmlPlaceholderText: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("text")); break;
+ case XmlPlaceholderGraphic: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("graphic")); break;
+ case XmlPlaceholderObject: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("object")); break;
+ case XmlPlaceholderChart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("chart")); break;
+ case XmlPlaceholderOrgchart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("orgchart")); break;
+ case XmlPlaceholderTable: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("table")); break;
+ case XmlPlaceholderPage: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("page")); break;
+ case XmlPlaceholderNotes: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("notes")); break;
+ case XmlPlaceholderHandout: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("handout")); break;
+ case XmlPlaceholderVerticalTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title")); break;
+ case XmlPlaceholderVerticalOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline")); break;
+ }
+
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr);
+
+ // svg:x,y,width,height
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Left());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Top());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetWidth());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetHeight());
+ aStr = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
+
+ // write presentation-placeholder
+ SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, sal_True, sal_True);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference< XDrawPage > xMasterPage )
+{
+ bool bDoesExist = false;
+
+ ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
+
+ // compare with prev page-master infos
+ for(sal_uInt32 a = 0; !bDoesExist && a < mpPageMasterInfoList->Count(); a++)
+ {
+ if(mpPageMasterInfoList->GetObject(a)
+ && *mpPageMasterInfoList->GetObject(a) == *pNewInfo)
+ {
+ delete pNewInfo;
+ pNewInfo = mpPageMasterInfoList->GetObject(a);
+ bDoesExist = true;
+ }
+ }
+ // add entry when not found same page-master infos
+ if(!bDoesExist)
+ mpPageMasterInfoList->Insert(pNewInfo, LIST_APPEND);
+
+ return pNewInfo;
+}
+
+void SdXMLExport::ImpPrepPageMasterInfos()
+{
+ if( IsImpress() )
+ {
+ // create page master info for handout master page
+
+ Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY );
+ if( xHMS.is() )
+ {
+ Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() );
+ if( xMasterPage.is() )
+ mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
+ }
+ }
+
+ // create page master infos for master pages
+ if(mnDocMasterPageCount)
+ {
+ // look for needed page-masters, create these
+ for(sal_Int32 nMPageId = 0L; nMPageId < mnDocMasterPageCount; nMPageId++)
+ {
+ Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
+ ImpXMLEXPPageMasterInfo* pNewInfo = 0L;
+
+ if(xMasterPage.is())
+ pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
+
+ mpPageMasterUsageList->Insert(pNewInfo, LIST_APPEND);
+
+ // look for page master of handout page
+ if(IsImpress())
+ {
+ pNewInfo = NULL;
+ Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
+ }
+ }
+ mpNotesPageMasterUsageList->Insert( pNewInfo, LIST_APPEND );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWritePageMasterInfos()
+{
+ // write created page-masters, create names for these
+ for(sal_uInt32 nCnt = 0L; nCnt < mpPageMasterInfoList->Count(); nCnt++)
+ {
+ ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->GetObject(nCnt);
+ if(pInfo)
+ {
+ // create name
+ OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("PM"));
+
+ sNewName += OUString::valueOf((sal_Int32)nCnt);
+ pInfo->SetName(sNewName);
+
+ // prepare page-master attributes
+ OUString sString;
+ OUStringBuffer sStringBuffer;
+
+ sString = sNewName;
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString);
+
+ // write page-layout
+ SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, sal_True, sal_True);
+
+ // prepare style:properties inside page-master
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderTop());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderBottom());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderLeft());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderRight());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetWidth());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString);
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetHeight());
+ sString = sStringBuffer.makeStringAndClear();
+ AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString);
+
+ if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT)
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT);
+ else
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE);
+
+ // write style:properties
+ SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, sal_True, sal_True);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName)
+{
+ if(rName.getLength() && mpPageMasterInfoList->Count())
+ {
+ for(sal_uInt32 nCnt = 0L; nCnt < mpPageMasterInfoList->Count(); nCnt++)
+ {
+ ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->GetObject(nCnt);
+ if(pInfo)
+ {
+ if(pInfo->GetMasterPageName().getLength() && rName.equals(pInfo->GetMasterPageName()))
+ {
+ return pInfo;
+ }
+ }
+ }
+ }
+ return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpPrepDrawPageInfos()
+{
+ // create draw:style-name entries for page export
+ // containing presentation page attributes AND background attributes
+ // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
+
+ sal_Int32 nCnt;
+ for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
+ {
+ Reference<XDrawPage> xDrawPage;
+ mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage;
+ maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
+
+ Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false );
+
+ maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage );
+ maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const sal_Char* pPrefix )
+{
+ // search rVector if there is already a string that equals rText
+ std::vector< OUString >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); aIter++, nIndex++ )
+ {
+ if( (*aIter) == rText )
+ break;
+ }
+
+ // if nothing is found, append the string at the end of rVector
+ if( aIter == rVector.end() )
+ rVector.push_back( rText );
+
+ // create a reference string with pPrefix and the index of the
+ // found or created rText
+ OUString aStr( OUString::createFromAscii( pPrefix ) );
+ aStr += OUString::valueOf( nIndex );
+ return aStr;
+}
+
+static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, sal_Bool bFixed, sal_Int32 nFormat, const sal_Char* pPrefix )
+{
+ // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
+ std::vector< DateTimeDeclImpl >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); aIter++, nIndex++ )
+ {
+ const DateTimeDeclImpl& rDecl = (*aIter);
+ if( (rDecl.mbFixed == bFixed ) &&
+ (!bFixed || rDecl.maStrText == rText) &&
+ (bFixed || (rDecl.mnFormat == nFormat) ) )
+ break;
+ }
+
+ // if nothing is found, append a new DateTimeDeclImpl
+ if( aIter == rVector.end() )
+ {
+ DateTimeDeclImpl aDecl;
+ aDecl.maStrText = rText;
+ aDecl.mbFixed = bFixed;
+ aDecl.mnFormat = nFormat;
+ rVector.push_back( aDecl );
+ }
+
+ // create a reference string with pPrefix and the index of the
+ // found or created DateTimeDeclImpl
+ OUString aStr( OUString::createFromAscii( pPrefix ) );
+ aStr += OUString::valueOf( nIndex );
+ return aStr;
+
+}
+
+static const sal_Char* gpStrHeaderTextPrefix = "hdr";
+static const sal_Char* gpStrFooterTextPrefix = "ftr";
+static const sal_Char* gpStrDateTimeTextPrefix = "dtd";
+
+HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage )
+{
+ HeaderFooterPageSettingsImpl aSettings;
+
+ if( xDrawPage.is() ) try
+ {
+ Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+
+ OUString aStrText;
+
+ const OUString aStrHeaderTextProp( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) );
+ if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
+ {
+ xSet->getPropertyValue( aStrHeaderTextProp ) >>= aStrText;
+ if( aStrText.getLength() )
+ aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
+ }
+
+ const OUString aStrFooterTextProp( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) );
+ if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
+ {
+ xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
+ if( aStrText.getLength() )
+ aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
+ }
+
+ const OUString aStrDateTimeTextProp( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) );
+ if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
+ {
+ sal_Bool bFixed = false;
+ sal_Int32 nFormat = 0;
+ xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText;
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ) ) >>= bFixed;
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ) ) >>= nFormat;
+
+ if( !bFixed || aStrText.getLength() )
+ {
+ aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix );
+ if( !bFixed )
+ addDataStyle( nFormat );
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" );
+ }
+
+ return aSettings;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpWriteHeaderFooterDecls()
+{
+ OUStringBuffer sBuffer;
+
+ if( !maHeaderDeclsVector.empty() )
+ {
+ // export header decls
+ const OUString aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix ) );
+ std::vector< OUString >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); aIter++, nIndex++ )
+ {
+ sBuffer.append( aPrefix );
+ sBuffer.append( nIndex );
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, sal_True, sal_True);
+ Characters((*aIter));
+ }
+ }
+
+ if( !maFooterDeclsVector.empty() )
+ {
+ // export footer decls
+ const OUString aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix ) );
+ std::vector< OUString >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); aIter++, nIndex++ )
+ {
+ sBuffer.append( aPrefix );
+ sBuffer.append( nIndex );
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, sal_False, sal_False);
+ Characters((*aIter));
+ }
+ }
+
+ if( !maDateTimeDeclsVector.empty() )
+ {
+ // export footer decls
+ const OUString aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix ) );
+ std::vector< DateTimeDeclImpl >::iterator aIter;
+ sal_Int32 nIndex;
+ for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); aIter++, nIndex++ )
+ {
+ const DateTimeDeclImpl& rDecl = (*aIter);
+
+ sBuffer.append( aPrefix );
+ sBuffer.append( nIndex );
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
+
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE );
+
+ if( !rDecl.mbFixed )
+ AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) );
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, sal_False, sal_False);
+ if( rDecl.mbFixed )
+ Characters(rDecl.maStrText);
+ }
+ }
+}
+
+void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings )
+{
+ if( aSettings.maStrHeaderDeclName.getLength() )
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName );
+
+ if( aSettings.maStrFooterDeclName.getLength() )
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName );
+
+ if( aSettings.maStrDateTimeDeclName.getLength() )
+ AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+OUString SdXMLExport::ImpCreatePresPageStyleName( Reference<XDrawPage> xDrawPage, bool bExportBackground /* = true */ )
+{
+ // create name
+ OUString sStyleName;
+
+ // create style for this page and add to auto style pool
+
+ Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY);
+ if(xPropSet1.is())
+ {
+ Reference< beans::XPropertySet > xPropSet;
+
+ if( bExportBackground )
+ {
+ // since the background items are in a different propertyset
+ // which itself is a property of the pages property set
+ // we now merge these two propertysets if possible to simulate
+ // a single propertyset with all draw page properties
+ const OUString aBackground(RTL_CONSTASCII_USTRINGPARAM("Background"));
+ Reference< beans::XPropertySet > xPropSet2;
+ Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
+ {
+ Any aAny( xPropSet1->getPropertyValue( aBackground ) );
+ aAny >>= xPropSet2;
+ }
+
+ if( xPropSet2.is() )
+ xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 );
+ else
+ xPropSet = xPropSet1;
+ }
+ else
+ {
+ xPropSet = xPropSet1;
+ }
+
+ const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() );
+
+ std::vector< XMLPropertyState > xPropStates( aMapperRef->Filter( xPropSet ) );
+
+ if( !xPropStates.empty() )
+ {
+ // there are filtered properties -> hard attributes
+ // try to find this style in AutoStylePool
+ sStyleName = GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
+
+ if(!sStyleName.getLength())
+ {
+ // Style did not exist, add it to AutoStalePool
+ sStyleName = GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
+ }
+ }
+ }
+
+ return sStyleName;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::ImpPrepMasterPageInfos()
+{
+ // create draw:style-name entries for master page export
+ // containing only background attributes
+ // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
+
+ sal_Int32 nCnt;
+ for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
+ {
+ Reference<XDrawPage> xDrawPage;
+ mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage;
+ maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
+ }
+
+ if( IsImpress() )
+ {
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage );
+ maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void SdXMLExport::ImpWritePresentationStyles()
+{
+ if(IsImpress())
+ {
+ for(sal_Int32 nCnt = 0L; nCnt < mnDocMasterPageCount; nCnt++)
+ {
+ Any aAny(mxDocMasterPages->getByIndex(nCnt));
+ Reference<container::XNamed> xNamed;
+
+ if(aAny >>= xNamed)
+ {
+ // write presentation styles (ONLY if presentation)
+ if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
+ {
+ XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
+ const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
+
+ OUString aPrefix( xNamed->getName() );
+
+ aPrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ aStEx.exportStyleFamily(xNamed->getName(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
+ aMapperRef, FALSE,
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix);
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::SetProgress(sal_Int32 nProg)
+{
+ // set progress view
+ if(GetStatusIndicator().is())
+ GetStatusIndicator()->setValue(nProg);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #82003#
+
+void SdXMLExport::_ExportMeta()
+{
+ uno::Sequence<beans::NamedValue> stats(1);
+ stats[0] = beans::NamedValue(::rtl::OUString::createFromAscii("ObjectCount"),
+ uno::makeAny(mnObjectCount));
+
+ // update document statistics at the model
+ uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xPropSup->getDocumentProperties());
+ if (xDocProps.is()) {
+ xDocProps->setDocumentStatistics(stats);
+ }
+
+ // call parent
+ SvXMLExport::_ExportMeta();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportContent()
+{
+ // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
+ ImpWriteHeaderFooterDecls();
+
+ // page export
+ for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
+ {
+ uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY );
+
+ SetProgress(((nPageInd + 1) * 100) / mnDocDrawPageCount);
+
+ if(xDrawPage.is())
+ {
+ // prepare page attributes, name of page
+ Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY);
+ if(xNamed.is())
+ AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName());
+
+ // draw:style-name (presentation page attributes AND background attributes)
+ if( maDrawPagesStyleNames[nPageInd].getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
+ maDrawPagesStyleNames[nPageInd]);
+
+ // draw:master-page-name
+ Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
+ if(xMasterPageInt.is())
+ {
+ Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
+ {
+ Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME,
+ EncodeStyleName( xMasterNamed->getName()) );
+ }
+ }
+ }
+
+ // presentation:page-layout-name
+ if( IsImpress() && maDrawPagesAutoLayoutNames[nPageInd+1].getLength())
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] );
+ }
+
+ Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY );
+ if( xProps.is() )
+ {
+ try
+ {
+ OUString aBookmarkURL;
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ) ) >>= aBookmarkURL;
+
+ if( aBookmarkURL.getLength() )
+ {
+ sal_Int32 nIndex = aBookmarkURL.lastIndexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ OUString aFileName( aBookmarkURL.copy( 0, nIndex ) );
+ OUString aBookmarkName( aBookmarkURL.copy( nIndex+1 ) );
+
+ aBookmarkURL = GetRelativeReference( aFileName );
+ aBookmarkURL += String( '#' );
+ aBookmarkURL += aBookmarkName;
+ }
+
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL);
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE );
+ AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR(" no \"BookmarkURL\" property at page?" );
+ }
+ }
+
+ if( IsImpress() )
+ ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] );
+
+
+ OUString sNavigationOrder( getNavigationOrder( xDrawPage ) );
+ if( sNavigationOrder.getLength() != 0 )
+ AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder );
+
+ UniReference< xmloff::AnimationsExporter > xAnimationsExporter;
+ uno::Reference< ::com::sun::star::animations::XAnimationNodeSupplier > xAnimNodeSupplier;
+
+ // prepare animation export
+ if(IsImpress())
+ {
+ if( getExportFlags() & EXPORT_OASIS )
+ {
+ // export new animations for oasis format
+ xAnimNodeSupplier.set( xDrawPage, UNO_QUERY );
+
+ // prepare animations exporter if impress
+ if(xAnimNodeSupplier.is())
+ {
+ xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps );
+ xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() );
+ }
+ }
+ else
+ {
+ // export old animations for ooo format
+ UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+ }
+
+ // write draw:id
+ const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
+ if( aPageId.getLength() != 0 )
+ {
+ AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
+ }
+
+ // write page
+ SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xDrawPage );
+
+ // write graphic objects on this page (if any)
+ Reference< drawing::XShapes > xExportShapes(xDrawPage, UNO_QUERY);
+ if(xExportShapes.is() && xExportShapes->getCount())
+ GetShapeExport()->exportShapes( xExportShapes );
+
+ // write animations and presentation notes (ONLY if presentation)
+ if(IsImpress())
+ {
+ if(xAnimNodeSupplier.is())
+ {
+ xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() );
+ }
+ else
+ {
+ // animations
+ UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
+ if( xAnimExport.is() )
+ xAnimExport->exportAnimations( *this );
+
+ xAnimExport = NULL;
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+
+ // presentations
+ Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is())
+ {
+ if( maDrawNotesPagesStyleNames[nPageInd].getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]);
+
+ ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] );
+
+ // write presentation notes
+ SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xNotesPage );
+
+ // write shapes per se
+ GetShapeExport()->exportShapes( xShapes );
+ }
+ }
+ }
+ }
+
+ exportAnnotations( xDrawPage );
+ }
+ }
+
+ if( IsImpress() )
+ exportPresentationSettings();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::exportPresentationSettings()
+{
+ try
+ {
+ Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY );
+ if( !xPresSupplier.is() )
+ return;
+
+ Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY );
+ if( !xPresProps.is() )
+ return;
+
+ sal_Bool bHasAttr = sal_False;
+
+ sal_Bool bTemp = false;
+
+ // export range
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ OUString aFirstPage;
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) >>= aFirstPage;
+ if( aFirstPage.getLength() )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage );
+ bHasAttr = sal_True;
+ }
+ else
+ {
+ OUString aCustomShow;
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) >>= aCustomShow;
+ if( aCustomShow.getLength() )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow );
+ bHasAttr = sal_True;
+ }
+ }
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE );
+ bHasAttr = sal_True;
+
+ sal_Int32 nPause = 0;
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ) ) >>= nPause;
+
+ util::DateTime aTime( 0, (sal_uInt16)nPause, 0, 0, 0, 0, 0 );
+
+ OUStringBuffer aOut;
+ SvXMLUnitConverter::convertTime( aOut, aTime );
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() );
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, XML_FALSE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ) ) >>= bTemp;
+ if( !bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED );
+ bHasAttr = sal_True;
+ }
+
+ xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ) ) >>= bTemp;
+ if( bTemp )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE );
+ bHasAttr = sal_True;
+ }
+
+ Reference< container::XNameContainer > xShows;
+ Sequence< OUString > aShowNames;
+ const OUString* pShowNames = NULL;
+ sal_Int32 nShowCount = 0;
+
+ Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
+ if( xSup.is() )
+ {
+ xShows = xSup->getCustomPresentations();
+ if( xShows.is() )
+ {
+ aShowNames = xShows->getElementNames();
+ pShowNames = aShowNames.getArray();
+ nShowCount = aShowNames.getLength();
+ }
+ }
+
+ if( bHasAttr || nShowCount != 0 )
+ {
+ SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, sal_True, sal_True);
+
+ if( nShowCount == 0 )
+ return;
+
+ Reference< XIndexContainer > xShow;
+ Reference< XNamed > xPageName;
+
+ OUStringBuffer sTmp;
+
+ for( sal_Int32 nIndex = 0; nIndex < nShowCount; nIndex++, pShowNames++ )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, *pShowNames );
+
+ xShows->getByName( *pShowNames ) >>= xShow;
+ DBG_ASSERT( xShow.is(), "invalid custom show!" );
+ if( !xShow.is() )
+ continue;
+
+ const sal_Int32 nPageCount = xShow->getCount();
+ for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ xShow->getByIndex( nPage ) >>= xPageName;
+
+ if( !xPageName.is() )
+ continue;
+
+ if( sTmp.getLength() != 0 )
+ sTmp.append( sal_Unicode( ',' ) );
+ sTmp.append( xPageName->getName() );
+
+ }
+
+ if( sTmp.getLength() )
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, sal_True, sal_True);
+ }
+ }
+ }
+ catch( uno::Exception )
+ {
+ DBG_ERROR( "uno::Exception while exporting <presentation:settings>" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportStyles(BOOL bUsed)
+{
+ GetPropertySetMapper()->SetAutoStyles( sal_False );
+
+ // export fill styles
+ SvXMLExport::_ExportStyles( bUsed );
+
+ // write draw:style-name for object graphic-styles
+ GetShapeExport()->ExportGraphicDefaults();
+
+ GetShapeExport()->GetShapeTableExport()->exportTableStyles();
+
+ // write presentation styles
+ ImpWritePresentationStyles();
+
+ // prepare draw:auto-layout-name for page export
+ ImpPrepAutoLayoutInfos();
+
+ // write draw:auto-layout-name for page export
+ ImpWriteAutoLayoutInfos();
+
+ Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
+ if( xInfoSet.is() )
+ {
+ Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ Any aAny;
+
+ if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
+ {
+ aAny <<= maDrawPagesAutoLayoutNames;
+ xInfoSet->setPropertyValue( msPageLayoutNames, aAny );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportAutoStyles()
+{
+ Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
+ if( xInfoSet.is() )
+ {
+ Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
+ {
+ xInfoSet->getPropertyValue( msPageLayoutNames ) >>= maDrawPagesAutoLayoutNames;
+ }
+ }
+
+ GetPropertySetMapper()->SetAutoStyles( sal_True );
+
+ if( getExportFlags() & EXPORT_STYLES )
+ {
+ // #80012# PageMaster export moved from _ExportStyles
+ // prepare page-master infos
+ ImpPrepPageMasterInfos();
+
+ // write page-master infos
+ ImpWritePageMasterInfos();
+
+ // prepare draw:style-name for master page export
+ ImpPrepMasterPageInfos();
+ }
+
+ if( getExportFlags() & EXPORT_CONTENT )
+ {
+ // prepare draw:style-name for page export
+ ImpPrepDrawPageInfos();
+ }
+
+ // export draw-page styles
+ GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
+ , GetDocHandler(),
+ GetMM100UnitConverter(),
+ GetNamespaceMap()
+ );
+
+ if( getExportFlags() & EXPORT_STYLES )
+ {
+ // create auto style infos for shapes on master handout page
+ if( IsImpress() )
+ {
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
+ }
+ }
+
+ // create auto style infos for objects on master pages
+ for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
+ {
+ Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
+
+ if( xMasterPage.is() )
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xMasterPage );
+
+ // get MasterPage Name
+ OUString aMasterPageNamePrefix;
+ Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
+ if(xNamed.is())
+ {
+ aMasterPageNamePrefix = xNamed->getName();
+ }
+ if(aMasterPageNamePrefix.getLength())
+ {
+ aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ }
+ GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
+
+ Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
+ if(xMasterShapes.is() && xMasterShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xMasterShapes );
+
+ if(IsImpress())
+ {
+ Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xNotesPage );
+
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
+ }
+ }
+ collectAnnotationAutoStyles(xMasterPage);
+ }
+ }
+ }
+
+ if( getExportFlags() & EXPORT_CONTENT )
+ {
+ // prepare animations exporter if impress
+ if(IsImpress() && ((getExportFlags() & EXPORT_OASIS) == 0) )
+ {
+ UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+
+ // create auto style infos for objects on pages
+ for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
+ {
+ Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY );
+ if( xDrawPage.is() )
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xDrawPage );
+
+ // get MasterPage Name
+ OUString aMasterPageNamePrefix;
+ Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
+ if(xMasterPageInt.is())
+ {
+ Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
+ {
+ Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ aMasterPageNamePrefix = xMasterNamed->getName();
+ }
+ }
+ }
+ if(aMasterPageNamePrefix.getLength())
+ {
+ aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ }
+
+ GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
+
+ // prepare object infos
+ Reference< drawing::XShapes > xDrawShapes(xDrawPage, UNO_QUERY);
+ if(xDrawShapes.is() && xDrawShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xDrawShapes );
+
+ // prepare presentation notes page object infos (ONLY if presentation)
+ if(IsImpress())
+ {
+ Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xNotesPage );
+
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
+ }
+ }
+
+ collectAnnotationAutoStyles( xDrawPage );
+ }
+ }
+ if(IsImpress())
+ {
+ UniReference< XMLAnimationsExporter > xAnimExport;
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+ }
+
+ exportAutoDataStyles();
+
+ GetShapeExport()->exportAutoStyles();
+
+ sal_uInt16 nContentAutostyles = EXPORT_CONTENT | EXPORT_AUTOSTYLES;
+ if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles )
+ GetFormExport()->exportAutoStyles( );
+
+ // ...for text
+ GetTextParagraphExport()->exportTextAutoStyles();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::_ExportMasterStyles()
+{
+ // export layer
+ SdXMLayerExporter::exportLayer( *this );
+
+ // export handout master page if impress
+ if( IsImpress() )
+ {
+ Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
+ if( xHandoutPage.is() )
+ {
+ // presentation:page-layout-name
+ if( IsImpress() && maDrawPagesAutoLayoutNames[0].getLength())
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] ));
+ }
+
+ ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
+ if(pInfo)
+ {
+ OUString sString = pInfo->GetName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
+ }
+
+ // draw:style-name
+ if( maHandoutMasterStyleName.getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName);
+
+ ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings );
+
+ // write masterpage
+ SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, sal_True, sal_True);
+
+ // write graphic objects on this master page (if any)
+ Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->exportShapes( xShapes );
+ }
+ }
+ }
+
+ // export MasterPages in master-styles section
+ for(sal_Int32 nMPageId = 0L; nMPageId < mnDocMasterPageCount; nMPageId++)
+ {
+ Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
+ if(xMasterPage.is())
+ {
+ // prepare masterpage attributes
+ OUString sMasterPageName;
+ Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
+ if(xNamed.is())
+ {
+ sal_Bool bEncoded = sal_False;
+ sMasterPageName = xNamed->getName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME,
+ EncodeStyleName( sMasterPageName, &bEncoded ));
+ if( bEncoded )
+ AddAttribute(
+ XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
+ sMasterPageName );
+ }
+
+ ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->GetObject(nMPageId);
+ if(pInfo)
+ {
+ OUString sString = pInfo->GetName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
+ }
+
+ // draw:style-name (background attributes)
+ if( maMasterPagesStyleNames[nMPageId].getLength() )
+ AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
+ maMasterPagesStyleNames[nMPageId]);
+
+ // write masterpage
+ SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xMasterPage );
+
+ // write graphic objects on this master page (if any)
+ Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
+ if(xMasterShapes.is() && xMasterShapes->getCount())
+ GetShapeExport()->exportShapes( xMasterShapes );
+
+ // write presentation notes (ONLY if presentation)
+ if(IsImpress())
+ {
+ Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
+ if(xPresPage.is())
+ {
+ Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
+ if(xShapes.is())
+ {
+ ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->GetObject(nMPageId);
+ if(pMasterInfo)
+ {
+ OUString sString = pMasterInfo->GetName();
+ AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
+ }
+
+ // write presentation notes
+ SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
+
+ // write optional office:forms
+ exportFormsElement( xNotesPage );
+
+ // write shapes per se
+ GetShapeExport()->exportShapes( xShapes );
+ }
+ }
+ }
+ }
+ exportAnnotations( xMasterPage );
+ }
+ }
+}
+
+void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage )
+{
+ if( xDrawPage.is() )
+ {
+ Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY );
+ if ( xFormsSupplier.is() && xFormsSupplier->hasForms() )
+ {
+ // write masterpage
+ ::xmloff::OOfficeFormsExport aForms(*this);
+ GetFormExport()->exportForms( xDrawPage );
+ }
+
+ if(! GetFormExport()->seekPage( xDrawPage ) )
+ {
+ DBG_ERROR( "OFormLayerXMLExport::seekPage failed!" );
+ }
+ }
+}
+
+void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
+{
+ rProps.realloc(4);
+ beans::PropertyValue* pProps = rProps.getArray();
+ if(pProps)
+ {
+// SvXMLElementExport aViewSettingsElem(*this, XML_NAMESPACE_DRAW, XML_VIEW_SETTINGS, sal_True, sal_True);
+
+ Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
+ if( !xPropSet.is() )
+ return;
+
+ awt::Rectangle aVisArea;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ) ) >>= aVisArea;
+/*
+ sal_Int16 nMapUnit;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MapUnit" ) ) ) >>= nMapUnit;
+*/
+
+ sal_uInt16 i = 0;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaTop"));
+ pProps[i++].Value <<= aVisArea.Y;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaLeft"));
+ pProps[i++].Value <<= aVisArea.X;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaWidth"));
+ pProps[i++].Value <<= aVisArea.Width;
+ pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaHeight"));
+ pProps[i++].Value <<= aVisArea.Height;
+ }
+}
+
+void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
+{
+ Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
+ if( xFac.is() )
+ {
+ Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
+ if( xProps.is() )
+ SvXMLUnitConverter::convertPropertySet( rProps, xProps );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat )
+{
+ sal_Int32 nFormat = nNumberFormat;
+ if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) )
+ nFormat -= 2;
+
+ if( bTimeFormat )
+ {
+ if( maUsedTimeStyles.count( nFormat ) == 0 )
+ maUsedTimeStyles.insert( nFormat );
+ }
+ else
+ {
+ if( maUsedDateStyles.count( nFormat ) == 0 )
+ maUsedDateStyles.insert( nFormat );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::exportDataStyles()
+{
+ // there are no data styles to export in draw/impress yet
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::exportAutoDataStyles()
+{
+ SdXMLFormatMap::iterator aIter( maUsedDateStyles.begin() );
+ SdXMLFormatMap::iterator aEnd( maUsedDateStyles.end() );
+
+ while( aIter != aEnd )
+ SdXMLNumberStylesExporter::exportDateStyle( *this, (*aIter++) );
+
+ aIter = maUsedTimeStyles.begin();
+ aEnd = maUsedTimeStyles.end();
+ while( aIter != aEnd )
+ SdXMLNumberStylesExporter::exportTimeStyle( *this, (*aIter++) );
+
+ if(HasFormExport())
+ GetFormExport()->exportAutoControlNumberStyles();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat ) const
+{
+ if( bTimeFormat )
+ {
+ return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat );
+ }
+ else
+ {
+ return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat );
+ }
+}
+
+OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage )
+{
+ OUStringBuffer sNavOrder;
+ try
+ {
+ Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ) ), UNO_QUERY_THROW );
+
+ Reference< XIndexAccess > xZOrderAccess( xDrawPage, UNO_QUERY );
+
+ // only export navigation order if it is different from the z-order
+ if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount()) )
+ {
+ sal_Int32 nIndex;
+ const sal_Int32 nCount = xNavOrder->getCount();
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) );
+ if( sId.getLength() != 0 )
+ {
+ if( sNavOrder.getLength() != 0 )
+ sNavOrder.append( (sal_Unicode)' ' );
+ sNavOrder.append( sId );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return sNavOrder.makeStringAndClear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage )
+{
+ Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
+ if( xAnnotationAccess.is() ) try
+ {
+ Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+ if( xAnnotationEnumeration.is() )
+ {
+ while( xAnnotationEnumeration->hasMoreElements() )
+ {
+ Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
+ Reference< XText > xText( xAnnotation->getTextRange() );
+ if(xText.is() && xText->getString().getLength())
+ GetTextParagraphExport()->collectTextAutoStyles( xText );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles");
+ }
+}
+
+void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
+{
+ // do not export in ODF 1.2 or older
+ if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
+ return;
+
+ Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
+ if( xAnnotationAccess.is() ) try
+ {
+ Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+ if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() )
+ {
+ OUStringBuffer sStringBuffer;
+ do
+ {
+ Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
+
+ RealPoint2D aPosition( xAnnotation->getPosition() );
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.X * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear());
+
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.Y * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear());
+
+ RealSize2D aSize( xAnnotation->getSize() );
+
+ if( aSize.Width || aSize.Height )
+ {
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Width * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear());
+ GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Height * 100 ) );
+ AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear());
+ }
+
+ // annotation element + content
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, sal_False, sal_True);
+
+ // author
+ OUString aAuthor( xAnnotation->getAuthor() );
+ if( aAuthor.getLength() )
+ {
+ SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, sal_True, sal_False );
+ this->Characters(aAuthor);
+ }
+
+ {
+ // date time
+ DateTime aDate( xAnnotation->getDateTime() );
+ GetMM100UnitConverter().convertDateTime(sStringBuffer, aDate, sal_True);
+ SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False );
+ Characters(sStringBuffer.makeStringAndClear());
+ }
+
+ com::sun::star::uno::Reference < com::sun::star::text::XText > xText( xAnnotation->getTextRange() );
+ if( xText.is() )
+ this->GetTextParagraphExport()->exportText( xText );
+ }
+ while( xAnnotationEnumeration->hasMoreElements() );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLExport::exportAnnotations(), exception caught during export of annotations");
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define SERVICE( classname, servicename, implementationname, draw, flags )\
+uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
+{\
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( servicename ) );\
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
+ return aSeq;\
+}\
+OUString SAL_CALL classname##_getImplementationName() throw()\
+{\
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationname ) );\
+}\
+uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
+{\
+ return (cppu::OWeakObject*)new SdXMLExport( rSMgr, draw, flags );\
+}
+
+SERVICE( XMLImpressExportOasis, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", sal_False, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLImpressStylesExportOasis, "com.sun.star.comp.Impress.XMLOasisStylesExporter", "XMLImpressStylesExportOasis", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLImpressContentExportOasis, "com.sun.star.comp.Impress.XMLOasisContentExporter", "XMLImpressContentExportOasis", sal_False, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLImpressMetaExportOasis, "com.sun.star.comp.Impress.XMLOasisMetaExporter", "XMLImpressMetaExportOasis", sal_False, EXPORT_OASIS|EXPORT_META );
+SERVICE( XMLImpressSettingsExportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsExporter", "XMLImpressSettingsExportOasis", sal_False, EXPORT_OASIS|EXPORT_SETTINGS );
+
+SERVICE( XMLImpressExportOOO, "com.sun.star.comp.Impress.XMLExporter", "XMLImpressExportOOO", sal_False, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLImpressStylesExportOOO, "com.sun.star.comp.Impress.XMLStylesExporter", "XMLImpressStylesExportOOO", sal_False, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLImpressContentExportOOO, "com.sun.star.comp.Impress.XMLContentExporter", "XMLImpressContentExportOOO", sal_False, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLImpressMetaExportOOO, "com.sun.star.comp.Impress.XMLMetaExporter", "XMLImpressMetaExportOOO", sal_False, EXPORT_META );
+SERVICE( XMLImpressSettingsExportOOO, "com.sun.star.comp.Impress.XMLSettingsExporter", "XMLImpressSettingsExportOOO", sal_False, EXPORT_SETTINGS );
+
+SERVICE( XMLDrawExportOasis, "com.sun.star.comp.Draw.XMLOasisExporter", "XMLDrawExportOasis", sal_True, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLDrawStylesExportOasis, "com.sun.star.comp.Draw.XMLOasisStylesExporter", "XMLDrawStylesExportOasis", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLDrawContentExportOasis, "com.sun.star.comp.Draw.XMLOasisContentExporter", "XMLDrawContentExportOasis", sal_True, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLDrawMetaExportOasis, "com.sun.star.comp.Draw.XMLOasisMetaExporter", "XMLDrawMetaExportOasis", sal_True, EXPORT_OASIS|EXPORT_META );
+SERVICE( XMLDrawSettingsExportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsExporter", "XMLDrawSettingsExportOasis", sal_True, EXPORT_OASIS|EXPORT_SETTINGS );
+
+SERVICE( XMLDrawExportOOO, "com.sun.star.comp.Draw.XMLExporter", "XMLDrawExportOOO", sal_True, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLDrawStylesExportOOO, "com.sun.star.comp.Draw.XMLStylesExporter", "XMLDrawStylesExportOOO", sal_True, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+SERVICE( XMLDrawContentExportOOO, "com.sun.star.comp.Draw.XMLContentExporter", "XMLDrawContentExportOOO", sal_True, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+SERVICE( XMLDrawMetaExportOOO, "com.sun.star.comp.Draw.XMLMetaExporter", "XMLDrawMetaExportOOO", sal_True, EXPORT_META );
+SERVICE( XMLDrawSettingsExportOOO, "com.sun.star.comp.Draw.XMLSettingsExporter", "XMLDrawSettingsExportOOO", sal_True, EXPORT_SETTINGS );
+
+SERVICE( XMLDrawingLayerExport, "com.sun.star.comp.DrawingLayer.XMLExporter", "XMLDrawingLayerExport", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+SERVICE( XMLImpressClipboardExport, "com.sun.star.comp.Impress.XMLClipboardExporter", "XMLImpressClipboardExport", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
+
+// XServiceInfo
+OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeException )
+{
+ if( IsDraw())
+ {
+ // Draw
+
+ switch( getExportFlags())
+ {
+ case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLDrawExportOOO_getImplementationName();
+ case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLDrawStylesExportOOO_getImplementationName();
+ case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLDrawContentExportOOO_getImplementationName();
+ case EXPORT_META:
+ return XMLDrawMetaExportOOO_getImplementationName();
+ case EXPORT_SETTINGS:
+ return XMLDrawSettingsExportOOO_getImplementationName();
+
+ case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLDrawExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLDrawStylesExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLDrawContentExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_META:
+ return XMLDrawMetaExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_SETTINGS:
+ return XMLDrawSettingsExportOasis_getImplementationName();
+
+ default:
+ return XMLDrawExportOOO_getImplementationName();
+ }
+ }
+ else
+ {
+ // Impress
+
+ switch( getExportFlags())
+ {
+ case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLImpressExportOOO_getImplementationName();
+ case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLImpressStylesExportOOO_getImplementationName();
+ case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLImpressContentExportOOO_getImplementationName();
+ case EXPORT_META:
+ return XMLImpressMetaExportOOO_getImplementationName();
+ case EXPORT_SETTINGS:
+ return XMLImpressSettingsExportOOO_getImplementationName();
+ case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
+ return XMLImpressExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
+ return XMLImpressStylesExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
+ return XMLImpressContentExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_META:
+ return XMLImpressMetaExportOasis_getImplementationName();
+ case EXPORT_OASIS|EXPORT_SETTINGS:
+ return XMLImpressSettingsExportOasis_getImplementationName();
+
+ default:
+ return XMLImpressExportOOO_getImplementationName();
+ }
+ }
+}
diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx
new file mode 100644
index 000000000000..aa792d43faf6
--- /dev/null
+++ b/xmloff/source/draw/sdxmlexp_impl.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDXMLEXP_IMPL_HXX
+#define _SDXMLEXP_IMPL_HXX
+
+#include <xmloff/xmlexp.hxx>
+
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <comphelper/stl_types.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SvXMLUnitConverter;
+class SvXMLExportItemMapper;
+class SfxPoolItem;
+class SfxItemSet;
+class OUStrings_Impl;
+class OUStringsSort_Impl;
+class Rectangle;
+
+class ImpPresPageDrawStylePropMapper;
+class ImpXMLEXPPageMasterList;
+class ImpXMLEXPPageMasterInfo;
+class ImpXMLDrawPageInfoList;
+class ImpXMLAutoLayoutInfoList;
+class SvXMLAutoStylePoolP;
+class XMLSdPropHdlFactory;
+class ImpXMLShapeStyleInfo;
+class XMLShapeExportPropertyMapper;
+class XMLPageExportPropertyMapper;
+
+//////////////////////////////////////////////////////////////////////////////
+
+enum XmlPlaceholder
+{
+ XmlPlaceholderTitle,
+ XmlPlaceholderOutline,
+ XmlPlaceholderSubtitle,
+ XmlPlaceholderText,
+ XmlPlaceholderGraphic,
+ XmlPlaceholderObject,
+ XmlPlaceholderChart,
+ XmlPlaceholderOrgchart,
+ XmlPlaceholderTable,
+ XmlPlaceholderPage,
+ XmlPlaceholderNotes,
+ XmlPlaceholderHandout,
+ XmlPlaceholderVerticalTitle,
+ XmlPlaceholderVerticalOutline
+};
+
+DECLARE_STL_STDKEY_SET( sal_Int32, SdXMLFormatMap );
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct HeaderFooterPageSettingsImpl
+{
+ rtl::OUString maStrHeaderDeclName;
+ rtl::OUString maStrFooterDeclName;
+ rtl::OUString maStrDateTimeDeclName;
+};
+
+struct DateTimeDeclImpl
+{
+ rtl::OUString maStrText;
+ sal_Bool mbFixed;
+ sal_Int32 mnFormat;
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLExport : public SvXMLExport
+{
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages;
+ sal_Int32 mnDocMasterPageCount;
+ sal_Int32 mnDocDrawPageCount;
+ sal_uInt32 mnShapeStyleInfoIndex;
+ sal_uInt32 mnObjectCount;
+
+ // temporary infos
+ ImpXMLEXPPageMasterList* mpPageMasterInfoList;
+ ImpXMLEXPPageMasterList* mpPageMasterUsageList;
+ ImpXMLEXPPageMasterList* mpNotesPageMasterUsageList;
+ ImpXMLEXPPageMasterInfo* mpHandoutPageMaster;
+ ImpXMLAutoLayoutInfoList* mpAutoLayoutInfoList;
+
+ com::sun::star::uno::Sequence< ::rtl::OUString > maDrawPagesAutoLayoutNames;
+
+ ::std::vector< ::rtl::OUString > maDrawPagesStyleNames;
+ ::std::vector< ::rtl::OUString > maDrawNotesPagesStyleNames;
+ ::std::vector< ::rtl::OUString > maMasterPagesStyleNames;
+ ::rtl::OUString maHandoutMasterStyleName;
+ ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings;
+ ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings;
+
+ ::std::vector< ::rtl::OUString > maHeaderDeclsVector;
+ ::std::vector< ::rtl::OUString > maFooterDeclsVector;
+ ::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector;
+
+ HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings;
+
+ XMLSdPropHdlFactory* mpSdPropHdlFactory;
+ XMLShapeExportPropertyMapper* mpPropertySetMapper;
+ XMLPageExportPropertyMapper* mpPresPagePropsMapper;
+
+ SdXMLFormatMap maUsedDateStyles; // this is a vector with the used formatings for date fields
+ SdXMLFormatMap maUsedTimeStyles; // this is a vector with the used formatings for time fields
+
+ sal_Bool mbIsDraw;
+ sal_Bool mbFamilyGraphicUsed;
+ sal_Bool mbFamilyPresentationUsed;
+
+ const rtl::OUString msZIndex;
+ const rtl::OUString msEmptyPres;
+ const rtl::OUString msModel;
+ const rtl::OUString msStartShape;
+ const rtl::OUString msEndShape;
+ const rtl::OUString msPageLayoutNames;
+
+ virtual void _ExportStyles(BOOL bUsed);
+ virtual void _ExportAutoStyles();
+ virtual void _ExportMasterStyles();
+ virtual void _ExportContent();
+ // #82003#
+ virtual void _ExportMeta();
+
+ ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage );
+ void ImpPrepPageMasterInfos();
+ void ImpPrepDrawMasterInfos();
+ void ImpWritePageMasterInfos();
+ void ImpPrepAutoLayoutInfos();
+ HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xDrawPage );
+ ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(const rtl::OUString& rName);
+
+ void ImpPrepDrawPageInfos();
+ void ImpPrepMasterPageInfos();
+ void ImpWritePresentationStyles();
+ ::rtl::OUString ImpCreatePresPageStyleName( com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> xDrawPage, bool bExportBackground = true );
+
+ BOOL ImpPrepAutoLayoutInfo(const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xPage, rtl::OUString& rName);
+ void ImpWriteAutoLayoutInfos();
+ void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect);
+ void ImpWriteHeaderFooterDecls();
+ void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings );
+
+ void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage );
+ void exportPresentationSettings();
+
+ // #82003# helper function for recursive object count
+ sal_uInt32 ImpRecursiveObjectCount( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes);
+
+ rtl::OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
+
+ void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
+ void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
+
+protected:
+ virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+ virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+
+public:
+ // #110680#
+ SdXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
+ virtual ~SdXMLExport();
+
+ void SetProgress(sal_Int32 nProg);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // get factories and mappers
+ XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; }
+ XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; }
+ XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; }
+
+ BOOL IsDraw() const { return mbIsDraw; }
+ BOOL IsImpress() const { return !mbIsDraw; }
+
+ BOOL IsFamilyGraphicUsed() const { return mbFamilyGraphicUsed; }
+ void SetFamilyGraphicUsed() { mbFamilyGraphicUsed = TRUE; }
+ BOOL IsFamilyPresentationUsed() const { return mbFamilyPresentationUsed; }
+ void SetFamilyPresentationUsed() { mbFamilyPresentationUsed = TRUE; }
+
+ virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
+ virtual void exportDataStyles();
+ virtual void exportAutoDataStyles();
+ virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
+
+ // XServiceInfo ( : SvXMLExport )
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // _SDXMLEXP_HXX
+
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
new file mode 100644
index 000000000000..76942cf817db
--- /dev/null
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -0,0 +1,1099 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/string.hxx>
+
+#ifndef _XMLOFF_XMLMETAI_HXX
+#include <xmloff/xmlscripti.hxx>
+#endif
+#include "sdxmlimp_impl.hxx"
+#include "ximpbody.hxx"
+
+#ifndef _SFX_XMLMETAI_HXX
+#include <xmloff/xmlmetai.hxx>
+#endif
+#include "ximpstyl.hxx"
+#include "xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/DocumentSettingsContext.hxx>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include "sdpropls.hxx"
+#include <xmloff/xmlexppr.hxx>
+#include "xmlerror.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <xmloff/XMLFontStylesContext.hxx>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLBodyContext_Impl : public SvXMLImportContext
+{
+ const SdXMLImport& GetSdImport() const
+ { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+
+ SdXMLBodyContext_Impl( SdXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+ virtual ~SdXMLBodyContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+};
+
+SdXMLBodyContext_Impl::SdXMLBodyContext_Impl( SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+}
+
+SdXMLBodyContext_Impl::~SdXMLBodyContext_Impl()
+{
+}
+
+SvXMLImportContext *SdXMLBodyContext_Impl::CreateChildContext(
+ sal_uInt16 /*nPrefix*/,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ return GetSdImport().CreateBodyContext(rLocalName, xAttrList);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// NB: virtually inherit so we can multiply inherit properly
+// in SdXMLFlatDocContext_Impl
+class SdXMLDocContext_Impl : public virtual SvXMLImportContext
+{
+protected:
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ SdXMLDocContext_Impl(
+ SdXMLImport& rImport,
+ USHORT nPrfx,
+ const OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLDocContext_Impl();
+
+ TYPEINFO();
+
+ virtual SvXMLImportContext *CreateChildContext(USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDocContext_Impl::SdXMLDocContext_Impl(
+ SdXMLImport& rImport,
+ USHORT nPrfx,
+ const OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+: SvXMLImportContext(rImport, nPrfx, rLName)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDocContext_Impl::~SdXMLDocContext_Impl()
+{
+}
+
+TYPEINIT1( SdXMLDocContext_Impl, SvXMLImportContext );
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLDocContext_Impl::CreateChildContext(
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetDocElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_DOC_FONTDECLS:
+ {
+ pContext = GetSdImport().CreateFontDeclsContext( rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_DOC_SETTINGS:
+ {
+ if( GetImport().getImportFlags() & IMPORT_SETTINGS )
+ {
+ pContext = new XMLDocumentSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ break;
+ }
+ case XML_TOK_DOC_STYLES:
+ {
+ if( GetImport().getImportFlags() & IMPORT_STYLES )
+ {
+ // office:styles inside office:document
+ pContext = GetSdImport().CreateStylesContext(rLocalName, xAttrList);
+ }
+ break;
+ }
+ case XML_TOK_DOC_AUTOSTYLES:
+ {
+ if( GetImport().getImportFlags() & IMPORT_AUTOSTYLES )
+ {
+ // office:automatic-styles inside office:document
+ pContext = GetSdImport().CreateAutoStylesContext(rLocalName, xAttrList);
+ }
+ break;
+ }
+ case XML_TOK_DOC_MASTERSTYLES:
+ {
+ if( GetImport().getImportFlags() & IMPORT_MASTERSTYLES )
+ {
+ // office:master-styles inside office:document
+ pContext = GetSdImport().CreateMasterStylesContext(rLocalName, xAttrList);
+ }
+ break;
+ }
+ case XML_TOK_DOC_META:
+ {
+ DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
+ break;
+ }
+ case XML_TOK_DOC_SCRIPT:
+ {
+ if( GetImport().getImportFlags() & IMPORT_SCRIPTS )
+ {
+ // office:script inside office:document
+ pContext = GetSdImport().CreateScriptContext( rLocalName );
+ }
+ break;
+ }
+ case XML_TOK_DOC_BODY:
+ {
+ if( GetImport().getImportFlags() & IMPORT_CONTENT )
+ {
+ // office:body inside office:document
+ pContext = new SdXMLBodyContext_Impl(GetSdImport(),nPrefix,
+ rLocalName, xAttrList);
+ }
+ break;
+ }
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// context for flat file xml format
+class SdXMLFlatDocContext_Impl
+ : public SdXMLDocContext_Impl, public SvXMLMetaDocumentContext
+{
+public:
+ SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
+ USHORT i_nPrefix, const OUString & i_rLName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
+
+ virtual ~SdXMLFlatDocContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT i_nPrefix, const OUString& i_rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList);
+};
+
+SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
+ USHORT i_nPrefix, const OUString & i_rLName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+ SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
+ SdXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
+ SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
+ i_xDocProps, i_xDocBuilder)
+{
+}
+
+SdXMLFlatDocContext_Impl::~SdXMLFlatDocContext_Impl() { }
+
+SvXMLImportContext *SdXMLFlatDocContext_Impl::CreateChildContext(
+ USHORT i_nPrefix, const OUString& i_rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
+{
+ // behave like meta base class iff we encounter office:meta
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetDocElemTokenMap();
+ if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
+ return SvXMLMetaDocumentContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ } else {
+ return SdXMLDocContext_Impl::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define SERVICE(classname,servicename,implementationname,draw,flags)\
+uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
+{\
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( servicename ) );\
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
+ return aSeq;\
+}\
+OUString SAL_CALL classname##_getImplementationName() throw()\
+{\
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationname ) );\
+}\
+uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
+{\
+ return (cppu::OWeakObject*)new SdXMLImport( rSMgr, draw, flags );\
+}
+
+SERVICE( XMLImpressImportOasis, "com.sun.star.comp.Impress.XMLOasisImporter", "XMLImpressImportOasis", sal_False, IMPORT_ALL )
+SERVICE( XMLDrawImportOasis, "com.sun.star.comp.Draw.XMLOasisImporter", "XMLDrawImportOasis", sal_True, IMPORT_ALL )
+
+SERVICE( XMLImpressStylesImportOasis, "com.sun.star.comp.Impress.XMLOasisStylesImporter", "XMLImpressStylesImportOasis", sal_False, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES )
+SERVICE( XMLDrawStylesImportOasis, "com.sun.star.comp.Draw.XMLOasisStylesImporter", "XMLImpressStylesImportOasis", sal_True, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES )
+
+SERVICE( XMLImpressContentImportOasis, "com.sun.star.comp.Impress.XMLOasisContentImporter", "XMLImpressContentImportOasis", sal_False, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS )
+SERVICE( XMLDrawContentImportOasis, "com.sun.star.comp.Draw.XMLOasisContentImporter", "XMLImpressContentImportOasis", sal_True, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS )
+
+SERVICE( XMLImpressMetaImportOasis, "com.sun.star.comp.Impress.XMLOasisMetaImporter", "XMLImpressMetaImportOasis", sal_False, IMPORT_META )
+SERVICE( XMLDrawMetaImportOasis, "com.sun.star.comp.Draw.XMLOasisMetaImporter", "XMLImpressMetaImportOasis", sal_True, IMPORT_META )
+
+SERVICE( XMLImpressSettingsImportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsImporter", "XMLImpressSettingsImportOasis", sal_False, IMPORT_SETTINGS )
+SERVICE( XMLDrawSettingsImportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsImporter", "XMLImpressSettingsImportOasis", sal_True, IMPORT_SETTINGS )
+
+//////////////////////////////////////////////////////////////////////////////
+
+// #110680#
+SdXMLImport::SdXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nImportFlags )
+: SvXMLImport( xServiceFactory, nImportFlags ),
+ mpMasterStylesContext(0L),
+ mpDocElemTokenMap(0L),
+ mpBodyElemTokenMap(0L),
+ mpStylesElemTokenMap(0L),
+ mpMasterPageElemTokenMap(0L),
+ mpMasterPageAttrTokenMap(0L),
+ mpPageMasterAttrTokenMap(0L),
+ mpPageMasterStyleAttrTokenMap(0L),
+ mpDrawPageAttrTokenMap(0L),
+ mpDrawPageElemTokenMap(0L),
+ mpPresentationPlaceholderAttrTokenMap(0L),
+ mnStyleFamilyMask(0),
+ mnNewPageCount(0L),
+ mnNewMasterPageCount(0L),
+ mbIsDraw(bIsDraw),
+ mbLoadDoc(sal_True),
+ mbPreview(sal_False),
+ msPageLayouts( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ),
+ msPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) )
+{
+ // add namespaces
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_PRESENTATION),
+ GetXMLToken(XML_N_PRESENTATION),
+ XML_NAMESPACE_PRESENTATION);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_SMIL),
+ GetXMLToken(XML_N_SMIL_COMPAT),
+ XML_NAMESPACE_SMIL);
+
+ GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_ANIMATION),
+ GetXMLToken(XML_N_ANIMATION),
+ XML_NAMESPACE_ANIMATION);
+}
+
+// XImporter
+void SAL_CALL SdXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SvXMLImport::setTargetDocument( xDoc );
+
+ uno::Reference< lang::XServiceInfo > xDocServices( GetModel(), uno::UNO_QUERY );
+ if( !xDocServices.is() )
+ throw lang::IllegalArgumentException();
+
+ mbIsDraw = !xDocServices->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) );
+
+ // prepare access to styles
+ uno::Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), uno::UNO_QUERY );
+ if(xFamSup.is())
+ mxDocStyleFamilies = xFamSup->getStyleFamilies();
+
+ // prepare access to master pages
+ uno::Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), uno::UNO_QUERY);
+ if(xMasterPagesSupplier.is())
+ mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
+
+ // prepare access to draw pages
+ uno::Reference <drawing::XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), uno::UNO_QUERY);
+ if(!xDrawPagesSupplier.is())
+ throw lang::IllegalArgumentException();
+
+ mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
+ if(!mxDocDrawPages.is())
+ throw lang::IllegalArgumentException();
+
+ if( mxDocDrawPages.is() && mxDocDrawPages->getCount() > 0 )
+ {
+ uno::Reference< form::XFormsSupplier > xFormsSupp;
+ mxDocDrawPages->getByIndex(0) >>= xFormsSupp;
+ mbIsFormsSupported = xFormsSupp.is();
+ }
+
+ // #88546# enable progress bar increments, SdXMLImport is only used for
+ // draw/impress import
+ GetShapeImport()->enableHandleProgressBar();
+
+ uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
+ if( xFac.is() )
+ {
+ uno::Sequence< OUString > sSNS( xFac->getAvailableServiceNames() );
+ sal_Int32 n = sSNS.getLength();
+ const OUString* pSNS( sSNS.getConstArray() );
+ while( --n > 0 )
+ {
+ if( (*pSNS++).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape") ) )
+ {
+ mbIsTableShapeSupported = true;
+ break;
+ }
+ }
+ }
+}
+
+// XInitialization
+void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw( uno::Exception, uno::RuntimeException)
+{
+ SvXMLImport::initialize( aArguments );
+
+ uno::Reference< beans::XPropertySet > xInfoSet( getImportInfo() );
+ if( xInfoSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ if( xInfoSetInfo->hasPropertyByName( msPageLayouts ) )
+ xInfoSet->getPropertyValue( msPageLayouts ) >>= mxPageLayouts;
+
+ if( xInfoSetInfo->hasPropertyByName( msPreview ) )
+ xInfoSet->getPropertyValue( msPreview ) >>= mbPreview;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImport::~SdXMLImport() throw ()
+{
+// #80365# removed ending of progress bar here, this was an old implementation
+// and maybe removed on demand
+// // stop progress view
+// if(mxStatusIndicator.is())
+// {
+// mxStatusIndicator->end();
+// mxStatusIndicator->reset();
+// }
+
+ // Styles or AutoStyles context?
+ if(mpMasterStylesContext)
+ mpMasterStylesContext->ReleaseRef();
+
+ // delete all token maps
+ if(mpDocElemTokenMap)
+ delete mpDocElemTokenMap;
+ if(mpBodyElemTokenMap)
+ delete mpBodyElemTokenMap;
+ if(mpStylesElemTokenMap)
+ delete mpStylesElemTokenMap;
+ if(mpMasterPageElemTokenMap)
+ delete mpMasterPageElemTokenMap;
+ if(mpMasterPageAttrTokenMap)
+ delete mpMasterPageAttrTokenMap;
+ if(mpPageMasterAttrTokenMap)
+ delete mpPageMasterAttrTokenMap;
+ if(mpPageMasterStyleAttrTokenMap)
+ delete mpPageMasterStyleAttrTokenMap;
+ if(mpDrawPageAttrTokenMap)
+ delete mpDrawPageAttrTokenMap;
+ if(mpDrawPageElemTokenMap)
+ delete mpDrawPageElemTokenMap;
+ if(mpPresentationPlaceholderAttrTokenMap)
+ delete mpPresentationPlaceholderAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLImport::SetProgress(sal_Int32 nProg)
+{
+ // set progress view
+ if(mxStatusIndicator.is())
+ mxStatusIndicator->setValue(nProg);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetDocElemTokenMap()
+{
+ if(!mpDocElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aDocElemTokenMap[] =
+{
+ { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
+ { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
+ { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
+ { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
+ { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
+ { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPT },
+ { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
+ { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
+ XML_TOKEN_MAP_END
+};
+
+ mpDocElemTokenMap = new SvXMLTokenMap(aDocElemTokenMap);
+ } // if(!mpDocElemTokenMap)
+
+ return *mpDocElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetBodyElemTokenMap()
+{
+ if(!mpBodyElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aBodyElemTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_PAGE, XML_TOK_BODY_PAGE },
+ { XML_NAMESPACE_PRESENTATION, XML_SETTINGS, XML_TOK_BODY_SETTINGS },
+ { XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, XML_TOK_BODY_HEADER_DECL },
+ { XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, XML_TOK_BODY_FOOTER_DECL },
+ { XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL,XML_TOK_BODY_DATE_TIME_DECL },
+
+ XML_TOKEN_MAP_END
+};
+
+ mpBodyElemTokenMap = new SvXMLTokenMap(aBodyElemTokenMap);
+ } // if(!mpBodyElemTokenMap)
+
+ return *mpBodyElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetStylesElemTokenMap()
+{
+ if(!mpStylesElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aStylesElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, XML_TOK_STYLES_PAGE_MASTER },
+ { XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT },
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_STYLES_STYLE },
+ XML_TOKEN_MAP_END
+};
+
+ mpStylesElemTokenMap = new SvXMLTokenMap(aStylesElemTokenMap);
+ } // if(!mpStylesElemTokenMap)
+
+ return *mpStylesElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetMasterPageElemTokenMap()
+{
+ if(!mpMasterPageElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aMasterPageElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_MASTERPAGE_STYLE },
+ { XML_NAMESPACE_PRESENTATION, XML_NOTES, XML_TOK_MASTERPAGE_NOTES },
+ XML_TOKEN_MAP_END
+};
+
+ mpMasterPageElemTokenMap = new SvXMLTokenMap(aMasterPageElemTokenMap);
+ } // if(!mpMasterPageElemTokenMap)
+
+ return *mpMasterPageElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetMasterPageAttrTokenMap()
+{
+ if(!mpMasterPageAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aMasterPageAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_MASTERPAGE_NAME },
+ { XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, XML_TOK_MASTERPAGE_DISPLAY_NAME },
+ { XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, XML_TOK_MASTERPAGE_PAGE_MASTER_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_MASTERPAGE_STYLE_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_MASTERPAGE_USE_HEADER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_MASTERPAGE_USE_FOOTER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME },
+ XML_TOKEN_MAP_END
+};
+
+ mpMasterPageAttrTokenMap = new SvXMLTokenMap(aMasterPageAttrTokenMap);
+ } // if(!mpMasterPageAttrTokenMap)
+
+ return *mpMasterPageAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetPageMasterAttrTokenMap()
+{
+ if(!mpPageMasterAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aPageMasterAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, XML_NAME, XML_TOK_PAGEMASTER_NAME },
+ XML_TOKEN_MAP_END
+};
+
+ mpPageMasterAttrTokenMap = new SvXMLTokenMap(aPageMasterAttrTokenMap);
+ } // if(!mpPageMasterAttrTokenMap)
+
+ return *mpPageMasterAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetPageMasterStyleAttrTokenMap()
+{
+ if(!mpPageMasterStyleAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aPageMasterStyleAttrTokenMap[] =
+{
+ { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP },
+ { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM },
+ { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT },
+ { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT },
+ { XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH },
+ { XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT },
+ { XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION },
+ XML_TOKEN_MAP_END
+};
+
+ mpPageMasterStyleAttrTokenMap = new SvXMLTokenMap(aPageMasterStyleAttrTokenMap);
+ } // if(!mpPageMasterStyleAttrTokenMap)
+
+ return *mpPageMasterStyleAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetDrawPageAttrTokenMap()
+{
+ if(!mpDrawPageAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aDrawPageAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_DRAWPAGE_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_DRAWPAGE_STYLE_NAME },
+ { XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME },
+ { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_DRAWID },
+ { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_XMLID },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DRAWPAGE_HREF },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_HEADER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME },
+ { XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME },
+
+ XML_TOKEN_MAP_END
+};
+
+ mpDrawPageAttrTokenMap = new SvXMLTokenMap(aDrawPageAttrTokenMap);
+ } // if(!mpDrawPageAttrTokenMap)
+
+ return *mpDrawPageAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetDrawPageElemTokenMap()
+{
+ if(!mpDrawPageElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aDrawPageElemTokenMap[] =
+{
+ { XML_NAMESPACE_PRESENTATION, XML_NOTES, XML_TOK_DRAWPAGE_NOTES },
+ { XML_NAMESPACE_ANIMATION, XML_PAR, XML_TOK_DRAWPAGE_PAR },
+ { XML_NAMESPACE_ANIMATION, XML_SEQ, XML_TOK_DRAWPAGE_SEQ },
+ XML_TOKEN_MAP_END
+};
+
+ mpDrawPageElemTokenMap = new SvXMLTokenMap(aDrawPageElemTokenMap);
+ } // if(!mpDrawPageElemTokenMap)
+
+ return *mpDrawPageElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SdXMLImport::GetPresentationPlaceholderAttrTokenMap()
+{
+ if(!mpPresentationPlaceholderAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aPresentationPlaceholderAttrTokenMap[] =
+{
+ { XML_NAMESPACE_PRESENTATION, XML_OBJECT, XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_PRESENTATIONPLACEHOLDER_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_PRESENTATIONPLACEHOLDER_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT },
+ XML_TOKEN_MAP_END
+};
+
+ mpPresentationPlaceholderAttrTokenMap = new SvXMLTokenMap(aPresentationPlaceholderAttrTokenMap);
+ } // if(!mpPresentationPlaceholderAttrTokenMap)
+
+ return *mpPresentationPlaceholderAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateContext(USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(XML_NAMESPACE_OFFICE == nPrefix &&
+ ( IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ||
+ IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT ) ||
+ IsXMLToken( rLocalName, XML_DOCUMENT_SETTINGS ) ))
+ {
+ pContext = new SdXMLDocContext_Impl(*this, nPrefix, rLocalName, xAttrList);
+ } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ ( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
+ pContext = CreateMetaContext(rLocalName, xAttrList);
+ } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(::rtl::OUString::createFromAscii(
+ "com.sun.star.xml.dom.SAXDocumentBuilder")),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ // flat OpenDocument file format
+ pContext = new SdXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
+ xAttrList, xDPS->getDocumentProperties(), xDocBuilder);
+ } else {
+ pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ if (!IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
+ {
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(::rtl::OUString::createFromAscii(
+ "com.sun.star.xml.dom.SAXDocumentBuilder")),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ pContext = new SvXMLMetaDocumentContext(*this,
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xDPS->getDocumentProperties(), xDocBuilder);
+ }
+
+ if(!pContext)
+ {
+ pContext = new SvXMLImportContext(*this, XML_NAMESPACE_OFFICE, rLocalName);
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateBodyContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+{
+ SvXMLImportContext *pContext = 0;
+ pContext = new SdXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName);
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStylesContext *SdXMLImport::CreateStylesContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ if(GetShapeImport()->GetStylesContext())
+ return GetShapeImport()->GetStylesContext();
+
+ GetShapeImport()->SetStylesContext(new SdXMLStylesContext(
+ *this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, FALSE));
+
+ return GetShapeImport()->GetStylesContext();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStylesContext *SdXMLImport::CreateAutoStylesContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ if(GetShapeImport()->GetAutoStylesContext())
+ return GetShapeImport()->GetAutoStylesContext();
+
+ GetShapeImport()->SetAutoStylesContext(new SdXMLStylesContext(
+ *this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, TRUE));
+
+ return GetShapeImport()->GetAutoStylesContext();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLImport::CreateMasterStylesContext(const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>&)
+{
+ if(mpMasterStylesContext)
+ return mpMasterStylesContext;
+
+ mpMasterStylesContext = new SdXMLMasterStylesContext(
+ *this, XML_NAMESPACE_OFFICE, rLocalName);
+ mpMasterStylesContext->AddRef();
+
+ return mpMasterStylesContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateFontDeclsContext(const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ XMLFontStylesContext *pFSContext =
+ new XMLFontStylesContext( *this, XML_NAMESPACE_OFFICE,
+ rLocalName, xAttrList,
+ gsl_getSystemTextEncoding() );
+ SetFontDecls( pFSContext );
+ return pFSContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// import pool defaults. Parameter contains pool defaults read
+// from input data. These data needs to be set at the model.
+//
+void SdXMLImport::ImportPoolDefaults(const XMLPropStyleContext*)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLImport::CreateScriptContext(
+ const OUString& rLocalName )
+{
+ SvXMLImportContext *pContext = 0;
+
+ pContext = new XMLScriptContext( *this,
+ XML_NAMESPACE_OFFICE, rLocalName,
+ GetModel() );
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLImport::SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps)
+{
+ uno::Reference< beans::XPropertySet > xPropSet( GetModel(), uno::UNO_QUERY );
+ if( !xPropSet.is() )
+ return;
+
+ awt::Rectangle aVisArea( 0,0, 28000, 21000 );
+ sal_Int32 nCount = aViewProps.getLength();
+
+ const beans::PropertyValue* pValues = aViewProps.getConstArray();
+
+ while( nCount-- )
+ {
+ const OUString& rName = pValues->Name;
+ const uno::Any rValue = pValues->Value;
+
+ if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaTop") ) )
+ {
+ rValue >>= aVisArea.Y;
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaLeft") ) )
+ {
+ rValue >>= aVisArea.X;
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaWidth") ) )
+ {
+ rValue >>= aVisArea.Width;
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("VisibleAreaHeight") ) )
+ {
+ rValue >>= aVisArea.Height;
+ }
+
+ pValues++;
+ }
+
+ try
+ {
+ xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), uno::makeAny( aVisArea ) );
+ }
+ catch( com::sun::star::uno::Exception e )
+ {
+ uno::Sequence<OUString> aSeq(0);
+ SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+}
+
+void SdXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps)
+{
+ uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
+ if( !xFac.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), uno::UNO_QUERY );
+ if( !xProps.is() )
+ return;
+
+ uno::Reference< beans::XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
+ if( !xInfo.is() )
+ return;
+
+ sal_Int32 nCount = aConfigProps.getLength();
+ const beans::PropertyValue* pValues = aConfigProps.getConstArray();
+
+ while( nCount-- )
+ {
+ try
+ {
+ const OUString& rProperty = pValues->Name;
+ if( xInfo->hasPropertyByName( rProperty ) )
+ xProps->setPropertyValue( rProperty, pValues->Value );
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ OSL_TRACE( "#SdXMLImport::SetConfigurationSettings: Exception!" );
+ }
+
+ pValues++;
+ }
+}
+
+// #80365# overload this method to read and use the hint value from the
+// written meta information. If no info is found, guess 10 draw objects
+//void SdXMLImport::SetStatisticAttributes(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+void SdXMLImport::SetStatistics(
+ const uno::Sequence<beans::NamedValue> & i_rStats)
+{
+ static const char* s_stats[] =
+ { "ObjectCount", 0 };
+
+ SvXMLImport::SetStatistics(i_rStats);
+
+ sal_uInt32 nCount(10);
+ for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
+ for (const char** pStat = s_stats; *pStat != 0; ++pStat) {
+ if (i_rStats[i].Name.equalsAscii(*pStat)) {
+ sal_Int32 val = 0;
+ if (i_rStats[i].Value >>= val) {
+ nCount = val;
+ } else {
+ DBG_ERROR("SdXMLImport::SetStatistics: invalid entry");
+ }
+ }
+ }
+ }
+
+ if(nCount)
+ {
+ GetProgressBarHelper()->SetReference(nCount);
+ GetProgressBarHelper()->SetValue(0);
+ }
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SdXMLImport::getImplementationName() throw( uno::RuntimeException )
+{
+ if( IsDraw())
+ {
+ // Draw
+
+ switch( getImportFlags())
+ {
+ case IMPORT_ALL:
+ return XMLDrawImportOasis_getImplementationName();
+ case (IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES):
+ return XMLDrawStylesImportOasis_getImplementationName();
+ case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
+ return XMLDrawContentImportOasis_getImplementationName();
+ case IMPORT_META:
+ return XMLDrawMetaImportOasis_getImplementationName();
+ case IMPORT_SETTINGS:
+ return XMLDrawSettingsImportOasis_getImplementationName();
+ default:
+ return XMLDrawImportOasis_getImplementationName();
+ }
+ }
+ else
+ {
+ // Impress
+
+ switch( getImportFlags())
+ {
+ case IMPORT_ALL:
+ return XMLImpressImportOasis_getImplementationName();
+ case (IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES):
+ return XMLImpressStylesImportOasis_getImplementationName();
+ case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
+ return XMLImpressContentImportOasis_getImplementationName();
+ case IMPORT_META:
+ return XMLImpressMetaImportOasis_getImplementationName();
+ case IMPORT_SETTINGS:
+ return XMLImpressSettingsImportOasis_getImplementationName();
+ default:
+ return XMLImpressImportOasis_getImplementationName();
+ }
+ }
+}
+
+ HeaderFooterDeclMap maHeaderDeclsMap;
+ HeaderFooterDeclMap maFooterDeclsMap;
+ DateTimeDeclMap maDateTimeDeclsMap;
+
+void SdXMLImport::AddHeaderDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText )
+{
+ if( rName.getLength() && rText.getLength() )
+ maHeaderDeclsMap[rName] = rText;
+}
+
+void SdXMLImport::AddFooterDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText )
+{
+ if( rName.getLength() && rText.getLength() )
+ maFooterDeclsMap[rName] = rText;
+}
+
+void SdXMLImport::AddDateTimeDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText, sal_Bool bFixed, const ::rtl::OUString& rDateTimeFormat )
+{
+ if( rName.getLength() && (rText.getLength() || !bFixed) )
+ {
+ DateTimeDeclContextImpl aDecl;
+ aDecl.maStrText = rText;
+ aDecl.mbFixed = bFixed;
+ aDecl.maStrDateTimeFormat = rDateTimeFormat;
+ maDateTimeDeclsMap[rName] = aDecl;
+ }
+}
+
+::rtl::OUString SdXMLImport::GetHeaderDecl( const ::rtl::OUString& rName ) const
+{
+ ::rtl::OUString aRet;
+ HeaderFooterDeclMap::const_iterator aIter( maHeaderDeclsMap.find( rName ) );
+ if( aIter != maHeaderDeclsMap.end() )
+ aRet = (*aIter).second;
+
+ return aRet;
+}
+
+::rtl::OUString SdXMLImport::GetFooterDecl( const ::rtl::OUString& rName ) const
+{
+ ::rtl::OUString aRet;
+ HeaderFooterDeclMap::const_iterator aIter( maFooterDeclsMap.find( rName ) );
+ if( aIter != maFooterDeclsMap.end() )
+ aRet = (*aIter).second;
+
+ return aRet;
+}
+
+::rtl::OUString SdXMLImport::GetDateTimeDecl( const ::rtl::OUString& rName, sal_Bool& rbFixed, ::rtl::OUString& rDateTimeFormat )
+{
+ DateTimeDeclContextImpl aDecl;
+
+ DateTimeDeclMap::const_iterator aIter( maDateTimeDeclsMap.find( rName ) );
+ if( aIter != maDateTimeDeclsMap.end() )
+ aDecl = (*aIter).second;
+
+ rbFixed = aDecl.mbFixed;
+ rDateTimeFormat = aDecl.maStrDateTimeFormat;
+ return aDecl.maStrText;
+}
+
+// eof
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
new file mode 100644
index 000000000000..d1cd0df80563
--- /dev/null
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDXMLIMP_IMPL_HXX
+#define _SDXMLIMP_IMPL_HXX
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <xmloff/xmltkmap.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#ifndef __SGI_STL_VECTOR
+#include <vector>
+#endif
+#include <xmloff/xmlimp.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+enum SdXMLDocElemTokenMap
+{
+ XML_TOK_DOC_FONTDECLS,
+ XML_TOK_DOC_STYLES,
+ XML_TOK_DOC_AUTOSTYLES,
+ XML_TOK_DOC_MASTERSTYLES,
+ XML_TOK_DOC_META,
+ XML_TOK_DOC_BODY,
+ XML_TOK_DOC_SCRIPT,
+ XML_TOK_DOC_SETTINGS,
+ XML_TOK_OFFICE_END = XML_TOK_UNKNOWN
+};
+
+enum SdXMLBodyElemTokenMap
+{
+ XML_TOK_BODY_PAGE,
+ XML_TOK_BODY_SETTINGS,
+ XML_TOK_BODY_HEADER_DECL,
+ XML_TOK_BODY_FOOTER_DECL,
+ XML_TOK_BODY_DATE_TIME_DECL
+};
+
+enum SdXMLStylesElemTokenMap
+{
+ XML_TOK_STYLES_MASTER_PAGE,
+ XML_TOK_STYLES_STYLE,
+ XML_TOK_STYLES_PAGE_MASTER,
+ XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT
+};
+
+enum SdXMLAutoStylesElemTokenMap
+{
+ XML_TOK_AUTOSTYLES_STYLE
+};
+
+enum SdXMLMasterPageElemTokenMap
+{
+ XML_TOK_MASTERPAGE_STYLE,
+ XML_TOK_MASTERPAGE_NOTES
+};
+
+enum SdXMLMasterPageAttrTokenMap
+{
+ XML_TOK_MASTERPAGE_NAME,
+ XML_TOK_MASTERPAGE_DISPLAY_NAME,
+ XML_TOK_MASTERPAGE_PAGE_MASTER_NAME,
+ XML_TOK_MASTERPAGE_STYLE_NAME,
+ XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME,
+ XML_TOK_MASTERPAGE_USE_HEADER_NAME,
+ XML_TOK_MASTERPAGE_USE_FOOTER_NAME,
+ XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME
+};
+
+enum SdXMLPageMasterAttrTokenMap
+{
+ XML_TOK_PAGEMASTER_NAME
+};
+
+enum SdXMLPageMasterStyleAttrTokenMap
+{
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP,
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM,
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT,
+ XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT,
+ XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH,
+ XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT,
+ XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION
+};
+
+enum SdXMLDocStyleAttrTokenMap
+{
+ XML_TOK_DOCSTYLE_NAME,
+ XML_TOK_DOCSTYLE_FAMILY,
+ XML_TOK_DOCSTYLE_PARENT_STYLE_NAME,
+ XML_TOK_DOCSTYLE_AUTOMATIC
+};
+
+enum SdXMLDocStyleElemTokenMap
+{
+ XML_TOK_DOCSTYLE_PROPERTIES,
+ XML_TOK_DOCSTYLE_PRESENTATION_PLACEHOLDER
+};
+
+enum SdXMLDrawPageAttrTokenMap
+{
+ XML_TOK_DRAWPAGE_NAME,
+ XML_TOK_DRAWPAGE_STYLE_NAME,
+ XML_TOK_DRAWPAGE_MASTER_PAGE_NAME,
+ XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME,
+ XML_TOK_DRAWPAGE_DRAWID,
+ XML_TOK_DRAWPAGE_XMLID,
+ XML_TOK_DRAWPAGE_HREF,
+ XML_TOK_DRAWPAGE_USE_HEADER_NAME,
+ XML_TOK_DRAWPAGE_USE_FOOTER_NAME,
+ XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME
+};
+
+enum SdXMLDrawPageElemTokenMap
+{
+ XML_TOK_DRAWPAGE_NOTES,
+ XML_TOK_DRAWPAGE_PAR,
+ XML_TOK_DRAWPAGE_SEQ
+};
+
+enum SdXMLPresentationPlaceholderAttrTokenMap
+{
+ XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME,
+ XML_TOK_PRESENTATIONPLACEHOLDER_X,
+ XML_TOK_PRESENTATIONPLACEHOLDER_Y,
+ XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH,
+ XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct SdXMLltXDrawPageId
+{
+ bool operator()(sal_Int32 nId1, sal_Int32 nId2 ) const
+ {
+ return nId1 < nId2;
+ }
+};
+
+typedef std::map< sal_Int32, com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >, SdXMLltXDrawPageId > DrawPageIdMap;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SvXMLUnitConverter;
+class SvXMLTokenMap;
+class XMLSdPropHdlFactory;
+class XMLPropertySetMapper;
+class XMLPropStyleContext;
+class SdXMLStylesContext;
+class SdXMLMasterStylesContext;
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct DateTimeDeclContextImpl
+{
+ rtl::OUString maStrText;
+ sal_Bool mbFixed;
+ rtl::OUString maStrDateTimeFormat;
+
+ DateTimeDeclContextImpl() : mbFixed(sal_True) {}
+};
+
+DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, HeaderFooterDeclMap );
+DECLARE_STL_USTRINGACCESS_MAP( DateTimeDeclContextImpl, DateTimeDeclMap );
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLImport: public SvXMLImport
+{
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxPageLayouts;
+
+ // contexts for Style and AutoStyle import
+ SdXMLMasterStylesContext* mpMasterStylesContext;
+
+ // token map lists
+ SvXMLTokenMap* mpDocElemTokenMap;
+ SvXMLTokenMap* mpBodyElemTokenMap;
+ SvXMLTokenMap* mpStylesElemTokenMap;
+ SvXMLTokenMap* mpAutoStylesElemTokenMap;
+ SvXMLTokenMap* mpMasterPageElemTokenMap;
+ SvXMLTokenMap* mpMasterPageAttrTokenMap;
+ SvXMLTokenMap* mpPageMasterAttrTokenMap;
+ SvXMLTokenMap* mpPageMasterStyleAttrTokenMap;
+ SvXMLTokenMap* mpDocStyleAttrTokenMap;
+ SvXMLTokenMap* mpDocStyleElemTokenMap;
+ SvXMLTokenMap* mpDrawPageAttrTokenMap;
+ SvXMLTokenMap* mpDrawPageElemTokenMap;
+ SvXMLTokenMap* mpPresentationPlaceholderAttrTokenMap;
+
+ sal_uInt16 mnStyleFamilyMask;
+
+ sal_Int32 mnNewPageCount;
+ sal_Int32 mnNewMasterPageCount;
+
+ sal_Bool mbIsDraw;
+ sal_Bool mbLoadDoc;
+ sal_Bool mbPreview;
+
+ DrawPageIdMap maDrawPageIds;
+
+ ::rtl::OUString msPageLayouts;
+ ::rtl::OUString msPreview;
+
+ HeaderFooterDeclMap maHeaderDeclsMap;
+ HeaderFooterDeclMap maFooterDeclsMap;
+ DateTimeDeclMap maDateTimeDeclsMap;
+
+protected:
+ // This method is called after the namespace map has been updated, but
+ // before a context for the current element has been pushed.
+ virtual SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+public:
+ // #110680#
+ SdXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_Bool bIsDraw, sal_uInt16 nImportFlags = IMPORT_ALL );
+ ~SdXMLImport() throw ();
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ void SetProgress(sal_Int32 nProg);
+
+ virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
+ virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
+
+ // namespace office
+ // NB: in contrast to other CreateFooContexts, this particular one handles
+ // the root element (i.e. office:document-meta)
+ SvXMLImportContext* CreateMetaContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLImportContext* CreateScriptContext( const ::rtl::OUString& rLocalName );
+ SvXMLImportContext* CreateBodyContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLStylesContext* CreateStylesContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLStylesContext* CreateAutoStylesContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLImportContext* CreateMasterStylesContext(const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ SvXMLImportContext *CreateFontDeclsContext(const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ // Styles and AutoStyles contexts
+ const SdXMLMasterStylesContext* GetMasterStylesContext() const { return mpMasterStylesContext; }
+
+ sal_uInt16 GetStyleFamilyMask() const { return mnStyleFamilyMask; }
+ sal_Bool IsStylesOnlyMode() const { return !mbLoadDoc; }
+
+ const SvXMLTokenMap& GetDocElemTokenMap();
+ const SvXMLTokenMap& GetBodyElemTokenMap();
+ const SvXMLTokenMap& GetStylesElemTokenMap();
+ const SvXMLTokenMap& GetMasterPageElemTokenMap();
+ const SvXMLTokenMap& GetMasterPageAttrTokenMap();
+ const SvXMLTokenMap& GetPageMasterAttrTokenMap();
+ const SvXMLTokenMap& GetPageMasterStyleAttrTokenMap();
+ const SvXMLTokenMap& GetDrawPageAttrTokenMap();
+ const SvXMLTokenMap& GetDrawPageElemTokenMap();
+ const SvXMLTokenMap& GetPresentationPlaceholderAttrTokenMap();
+
+ // export local parameters concerning page access and similar
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& GetLocalDocStyleFamilies() const { return mxDocStyleFamilies; }
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess >& GetLocalMasterPages() const { return mxDocMasterPages; }
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess >& GetLocalDrawPages() const { return mxDocDrawPages; }
+
+ sal_Int32 GetNewPageCount() const { return mnNewPageCount; }
+ void IncrementNewPageCount() { mnNewPageCount++; }
+ sal_Int32 GetNewMasterPageCount() const { return mnNewMasterPageCount; }
+ void IncrementNewMasterPageCount() { mnNewMasterPageCount++; }
+
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > getPageLayouts() const { return mxPageLayouts; }
+
+ sal_Bool IsDraw() const { return mbIsDraw; }
+ sal_Bool IsImpress() const { return !mbIsDraw; }
+
+ // import pool defaults. Parameter contains pool defaults read
+ // from input data. These data needs to be set at the model.
+ void ImportPoolDefaults(const XMLPropStyleContext* pPool);
+
+ // #80365#
+ virtual void SetStatistics(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue> & i_rStats);
+
+ sal_Bool IsPreview() const { return mbPreview; }
+
+ // XServiceInfo ( : SvXMLExport )
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+
+ void AddHeaderDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText );
+ void AddFooterDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText );
+ void AddDateTimeDecl( const ::rtl::OUString& rName, const ::rtl::OUString& rText, sal_Bool bFixed, const ::rtl::OUString& rDateTimeFormat );
+
+ ::rtl::OUString GetHeaderDecl( const ::rtl::OUString& rName ) const;
+ ::rtl::OUString GetFooterDecl( const ::rtl::OUString& rName ) const;
+ ::rtl::OUString GetDateTimeDecl( const ::rtl::OUString& rName, sal_Bool& rbFixed, ::rtl::OUString& rDateTimeFormat );
+
+};
+
+#endif // _SDXMLIMP_HXX
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
new file mode 100644
index 000000000000..d3dd99967ae9
--- /dev/null
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -0,0 +1,1303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <memory>
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/container/XIdentifierAccess.hpp>
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
+#include <com/sun/star/drawing/EscapeDirection.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <xmloff/xmluconv.hxx>
+#include "PropertySetMerger.hxx"
+
+#include <xmloff/shapeexport.hxx>
+#include "sdpropls.hxx"
+#include "sdxmlexp_impl.hxx"
+#include <xmloff/families.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/contextid.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <tools/string.hxx>
+#include <sot/clsids.hxx>
+#include <tools/globname.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+
+#include "xmlnmspe.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
+ SvXMLExportPropertyMapper *pExtMapper )
+: mrExport( rExp ),
+ mnNextUniqueShapeId(1),
+ maShapesInfos(),
+ maCurrentShapesIter(maShapesInfos.end()),
+ mbExportLayer( sal_False ),
+ // #88546# init to FALSE
+ mbHandleProgressBar( sal_False ),
+ msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ),
+ msPrintable( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
+ msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ),
+ msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
+ msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
+ msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
+ msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
+ msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
+ msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
+ msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
+#endif
+ msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
+ msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
+ msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
+ msScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
+ msLibrary( RTL_CONSTASCII_USTRINGPARAM("Library") ),
+ msClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
+ msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
+ msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
+ msSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
+ msStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") )
+{
+ // construct PropertyHandlerFactory
+ mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), rExp );
+ // construct PropertySetMapper
+ mxPropertySetMapper = CreateShapePropMapper( mrExport );
+ if( pExtMapper )
+ {
+ UniReference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper );
+ mxPropertySetMapper->ChainExportMapper( xExtMapper );
+ }
+
+/*
+ // chain text attributes
+ xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
+*/
+
+ mrExport.GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
+ mrExport.GetAutoStylePool()->AddFamily(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
+ GetPropertySetMapper(),
+ OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
+
+ maCurrentInfo = maShapeInfos.end();
+
+ // create table export helper and let him add his families in time
+ GetShapeTableExport();
+}
+
+///////////////////////////////////////////////////////////////////////
+
+XMLShapeExport::~XMLShapeExport()
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format
+uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< drawing::XShape > xCustomShapeReplacement;
+
+ if( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
+ {
+ String aType( (OUString)xShape->getShapeType() );
+ if( aType.EqualsAscii( (const sal_Char*)"com.sun.star.drawing.CustomShape" ) )
+ {
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ rtl::OUString aEngine;
+ xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) ) ) >>= aEngine;
+ if ( !aEngine.getLength() )
+ aEngine = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) );
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ /*
+ uno::Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pCustomShape );
+ if ( !aXShape.is() )
+ aXShape = new SvxCustomShape( (SdrObjCustomShape*)pCustomShape );
+ */
+ if ( aEngine.getLength() && xFactory.is() )
+ {
+ uno::Sequence< uno::Any > aArgument( 1 );
+ uno::Sequence< beans::PropertyValue > aPropValues( 2 );
+ aPropValues[ 0 ].Name = rtl::OUString::createFromAscii( "CustomShape" );
+ aPropValues[ 0 ].Value <<= xShape;
+ sal_Bool bForceGroupWithText = sal_True;
+ aPropValues[ 1 ].Name = rtl::OUString::createFromAscii( "ForceGroupWithText" );
+ aPropValues[ 1 ].Value <<= bForceGroupWithText;
+ aArgument[ 0 ] <<= aPropValues;
+ uno::Reference< uno::XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
+ if ( xInterface.is() )
+ {
+ uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
+ uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
+ if ( xCustomShapeEngine.is() )
+ xCustomShapeReplacement = xCustomShapeEngine->render();
+ }
+ }
+ }
+ }
+ }
+ return xCustomShapeReplacement;
+}
+
+// This method collects all automatic styles for the given XShape
+void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape )
+{
+ if( maCurrentShapesIter == maShapesInfos.end() )
+ {
+ DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
+ return;
+ }
+ sal_Int32 nZIndex = 0;
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
+ if( xSet.is() )
+ xSet->getPropertyValue(msZIndex) >>= nZIndex;
+
+ ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
+
+ if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
+ {
+ DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
+ return;
+ }
+
+ ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
+
+ uno::Reference< drawing::XShape > xCustomShapeReplacement = checkForCustomShapeReplacement( xShape );
+ if ( xCustomShapeReplacement.is() )
+ aShapeInfo.xCustomShapeReplacement = xCustomShapeReplacement;
+
+ // -----------------------------
+ // first compute the shapes type
+ // -----------------------------
+ ImpCalcShapeType(xShape, aShapeInfo.meShapeType);
+
+ const bool bObjSupportsText =
+// aShapeInfo.meShapeType != XmlShapeTypeDrawControlShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresChartShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawOLE2Shape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresOLE2Shape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawSheetShape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresSheetShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DSceneObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DCubeObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DSphereObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DLatheObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDraw3DExtrudeObject &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape &&
+ aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
+
+ const bool bObjSupportsStyle =
+ aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
+
+ sal_Bool bIsEmptyPresObj = sal_False;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if ( aShapeInfo.xCustomShapeReplacement.is() )
+ xPropSet.clear();
+
+ // ----------------
+ // prep text styles
+ // ----------------
+ if( xPropSet.is() && bObjSupportsText )
+ {
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ if(xText.is() && xText->getString().getLength())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(msEmptyPres) )
+ {
+ uno::Any aAny = xPropSet->getPropertyValue(msEmptyPres);
+ aAny >>= bIsEmptyPresObj;
+ }
+
+ if(!bIsEmptyPresObj)
+ {
+ GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText );
+ }
+ }
+ }
+
+ // ------------------------------
+ // compute the shape parent style
+ // ------------------------------
+ if( xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
+
+ OUString aParentName;
+ uno::Reference< style::XStyle > xStyle;
+
+ if( bObjSupportsStyle )
+ {
+ if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName( OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) )
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) >>= xStyle;
+
+ if(xStyle.is())
+ {
+ // get family ID
+ uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
+ DBG_ASSERT( xStylePropSet.is(), "style without a XPropertySet?" );
+ try
+ {
+ if(xStylePropSet.is())
+ {
+ OUString aFamilyName;
+ xStylePropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Family"))) >>= aFamilyName;
+ if(aFamilyName.getLength() && !aFamilyName.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics"))))
+ aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+ }
+ }
+ catch(beans::UnknownPropertyException aException)
+ {
+ // Ignored.
+ DBG_ASSERT(false,
+ "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
+ }
+
+ // get parent-style name
+ if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == aShapeInfo.mnFamily)
+ {
+ aParentName = msPresentationStylePrefix;
+ }
+
+ aParentName += xStyle->getName();
+ }
+ }
+
+ // filter propset
+ std::vector< XMLPropertyState > xPropStates;
+
+ sal_Int32 nCount = 0;
+ if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) )
+ {
+ xPropStates = GetPropertySetMapper()->Filter( xPropSet );
+
+ if (XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType)
+ {
+ // for control shapes, we additionally need the number format style (if any)
+ uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
+ DBG_ASSERT(xControl.is(), "XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
+ if (xControl.is())
+ {
+ uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
+ DBG_ASSERT(xControlModel.is(), "XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
+
+ ::rtl::OUString sNumberStyle = mrExport.GetFormExport()->getControlNumberStyle(xControlModel);
+ if (0 != sNumberStyle.getLength())
+ {
+ sal_Int32 nIndex = GetPropertySetMapper()->getPropertySetMapper()->FindEntryIndex(CTF_SD_CONTROL_SHAPE_DATA_STYLE);
+ // TODO : this retrieval of the index could be moved into the ctor, holding the index
+ // as member, thus saving time.
+ DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
+
+ XMLPropertyState aNewState(nIndex, uno::makeAny(sNumberStyle));
+ xPropStates.push_back(aNewState);
+ }
+ }
+ }
+
+ std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
+ std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
+ while( aIter != aEnd )
+ {
+ if( aIter->mnIndex != -1 )
+ nCount++;
+ aIter++;
+ }
+ }
+
+ if(nCount == 0)
+ {
+ // no hard attributes, use parent style name for export
+ aShapeInfo.msStyleName = aParentName;
+ }
+ else
+ {
+ // there are filtered properties -> hard attributes
+ // try to find this style in AutoStylePool
+ aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Find(aShapeInfo.mnFamily, aParentName, xPropStates);
+
+ if(!aShapeInfo.msStyleName.getLength())
+ {
+ // Style did not exist, add it to AutoStalePool
+ aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Add(aShapeInfo.mnFamily, aParentName, xPropStates);
+ }
+ }
+
+ // optionaly generate auto style for text attributes
+ if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) && bObjSupportsText )
+ {
+ xPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet );
+
+ // ----------------------------------------------------------------------
+ // yet more additionally, we need to care for the ParaAdjust property
+ if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if ( xPropSetInfo.is() && xPropState.is() )
+ {
+ // this is because:
+ // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model
+ // * control models are allowed to have an Align of "void"
+ // * the Default for control model's Align is TextAlign_LEFT
+ // * defaults for style properties are not written, but we need to write the "left",
+ // because we need to distiguish this "left" from the case where not align attribute
+ // is present which means "void"
+ // 102407 - 2002-11-01 - fs@openoffice.org
+ static const ::rtl::OUString s_sParaAdjustPropertyName( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) );
+ if ( xPropSetInfo->hasPropertyByName( s_sParaAdjustPropertyName )
+ && ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( s_sParaAdjustPropertyName ) )
+ )
+ {
+ sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST );
+ // TODO : this retrieval of the index should be moved into the ctor, holding the index
+ // as member, thus saving time.
+ DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
+
+ uno::Any aParaAdjustValue = xPropSet->getPropertyValue( s_sParaAdjustPropertyName );
+ XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue );
+
+ xPropStates.push_back( aAlignDefaultState );
+ }
+ }
+ }
+ // ----------------------------------------------------------------------
+
+ nCount = 0;
+ std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
+ std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
+ while( aIter != aEnd )
+ {
+ if( aIter->mnIndex != -1 )
+ nCount++;
+ aIter++;
+ }
+
+ if( nCount )
+ {
+ const OUString aEmpty;
+ aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates );
+ if(!aShapeInfo.msTextStyleName.getLength())
+ {
+ // Style did not exist, add it to AutoStalePool
+ aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates);
+ }
+ }
+ }
+ }
+
+ // ----------------------------------------
+ // prepare animation informations if needed
+ // ----------------------------------------
+ if( mxAnimationsExporter.is() )
+ mxAnimationsExporter->prepare( xShape, mrExport );
+
+ // check for special shapes
+
+ switch( aShapeInfo.meShapeType )
+ {
+ case XmlShapeTypeDrawConnectorShape:
+ {
+ uno::Reference< uno::XInterface > xConnection;
+
+ // create shape ids for export later
+ xPropSet->getPropertyValue( msStartShape ) >>= xConnection;
+ if( xConnection.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
+
+ xPropSet->getPropertyValue( msEndShape ) >>= xConnection;
+ if( xConnection.is() )
+ mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
+ break;
+ }
+ case XmlShapeTypePresTableShape:
+ case XmlShapeTypeDrawTableShape:
+ {
+ try
+ {
+ uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
+ GetShapeTableExport()->collectTableAutoStyles( xRange );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table!" );
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ maShapeInfos.push_back( aShapeInfo );
+ maCurrentInfo = maShapeInfos.begin();
+
+ // -----------------------------------------------------
+ // check for shape collections (group shape or 3d scene)
+ // and collect contained shapes style infos
+ // -----------------------------------------------------
+ const uno::Reference< drawing::XShape >& xCollection = aShapeInfo.xCustomShapeReplacement.is()
+ ? aShapeInfo.xCustomShapeReplacement : xShape;
+ {
+ uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ collectShapesAutoStyles( xShapes );
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// --> OD 2008-05-08 #refactorlists#
+namespace
+{
+ class NewTextListsHelper
+ {
+ public:
+ NewTextListsHelper( SvXMLExport& rExp )
+ : mrExport( rExp )
+ {
+ mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
+ }
+
+ ~NewTextListsHelper()
+ {
+ mrExport.GetTextParagraphExport()->PopTextListsHelper();
+ }
+
+ private:
+ SvXMLExport& mrExport;
+ };
+}
+// This method exports the given XShape
+void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape,
+ sal_Int32 nFeatures /* = SEF_DEFAULT */,
+ com::sun::star::awt::Point* pRefPoint /* = NULL */,
+ SvXMLAttributeList* pAttrList /* = NULL */ )
+{
+ if( maCurrentShapesIter == maShapesInfos.end() )
+ {
+ DBG_ERROR( "XMLShapeExport::exportShape(): no auto styles where collected before export" );
+ return;
+ }
+ sal_Int32 nZIndex = 0;
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
+
+
+ ::std::auto_ptr< SvXMLElementExport > mpHyperlinkElement;
+
+ // export hyperlinks with <a><shape/></a>. Currently only in draw since draw
+ // does not support document events
+ if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::E_DRAW) ) try
+ {
+ presentation::ClickAction eAction = presentation::ClickAction_NONE;
+ xSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("OnClick"))) >>= eAction;
+
+ if( (eAction == presentation::ClickAction_DOCUMENT) ||
+ (eAction == presentation::ClickAction_BOOKMARK) )
+ {
+ OUString sURL;
+ xSet->getPropertyValue(msBookmark) >>= sURL;
+
+ if( sURL.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mpHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, sal_True, sal_True) );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR("XMLShapeExport::exportShape(): exception during hyperlink export");
+ }
+
+
+ if( xSet.is() )
+ xSet->getPropertyValue(msZIndex) >>= nZIndex;
+
+ ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
+
+ if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
+ {
+ DBG_ERROR( "XMLShapeExport::exportShape(): no shape info collected for a given shape" );
+ return;
+ }
+
+ // --> OD 2008-05-08 #refactorlists#
+ NewTextListsHelper aNewTextListsHelper( mrExport );
+ // <--
+
+ const ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
+
+
+#ifdef DBG_UTIL
+ // ---------------------------------------
+ // check if this is the correct ShapesInfo
+ // ---------------------------------------
+ uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
+ DBG_ASSERT( xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(), "XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
+ }
+
+ // -----------------------------
+ // first compute the shapes type
+ // -----------------------------
+ {
+ XmlShapeType eShapeType(XmlShapeTypeNotYetSet);
+ ImpCalcShapeType(xShape, eShapeType);
+
+ DBG_ASSERT( eShapeType == aShapeInfo.meShapeType, "exportShape callings do not correspond to collectShapeAutoStyles calls!" );
+ }
+#endif
+
+ // ----------------------------------------
+ // collect animation informations if needed
+ // ----------------------------------------
+ if( mxAnimationsExporter.is() )
+ mxAnimationsExporter->collect( xShape, mrExport );
+
+ // -------------------------------
+ // export shapes name if he has one
+ // --> OD 2006-03-13 #i51726#
+ // Export of the shape name for text documents only if the OpenDocument
+ // file format is written - exceptions are group shapes.
+ // Note: Writer documents in OpenOffice.org file format doesn't contain
+ // any names for shapes, except for group shapes.
+ // -------------------------------
+ {
+ // --> OD 2006-03-10 #i51726#
+ if ( ( GetExport().GetModelType() != SvtModuleOptions::E_WRITER &&
+ GetExport().GetModelType() != SvtModuleOptions::E_WRITERWEB &&
+ GetExport().GetModelType() != SvtModuleOptions::E_WRITERGLOBAL ) ||
+ ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 ||
+ aShapeInfo.meShapeType == XmlShapeTypeDrawGroupShape ||
+ ( aShapeInfo.meShapeType == XmlShapeTypeDrawCustomShape &&
+ aShapeInfo.xCustomShapeReplacement.is() ) )
+ {
+ uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
+ if( xNamed.is() )
+ {
+ const OUString aName( xNamed->getName() );
+ if( aName.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, aName );
+ }
+ }
+ // <--
+ }
+
+ // ------------------
+ // export style name
+ // ------------------
+ if( aShapeInfo.msStyleName.getLength() != 0 )
+ {
+ if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == aShapeInfo.mnFamily)
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
+ else
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
+ }
+
+ // ------------------
+ // export text style name
+ // ------------------
+ if( aShapeInfo.msTextStyleName.getLength() != 0 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TEXT_STYLE_NAME, aShapeInfo.msTextStyleName );
+ }
+
+ // --------------------------
+ // export shapes id if needed
+ // --------------------------
+ {
+ uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
+ const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
+ if( rShapeId.getLength() )
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId);
+ }
+ }
+
+ // --------------------------
+ // export layer information
+ // --------------------------
+ if( IsLayerExportEnabled() )
+ {
+ // check for group or scene shape and not export layer if this is one
+ uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
+ if( !xShapes.is() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
+ OUString aLayerName;
+ xProps->getPropertyValue( OUString::createFromAscii( "LayerName" ) ) >>= aLayerName;
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LAYER, aLayerName );
+
+ }
+ catch( uno::Exception e )
+ {
+ DBG_ERROR( "could not export layer name for shape!" );
+ }
+ }
+ }
+
+ // export draw:display (do not export in ODF 1.2 or older)
+ if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) )
+ {
+ if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
+ aShapeInfo.meShapeType != XmlShapeTypeHandoutShape )
+
+ try
+ {
+ sal_Bool bVisible = sal_True;
+ sal_Bool bPrintable = sal_True;
+
+ xSet->getPropertyValue(msVisible) >>= bVisible;
+ xSet->getPropertyValue(msPrintable) >>= bPrintable;
+
+ XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
+ const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
+ switch( nDisplay )
+ {
+ case 0: eDisplayToken = XML_NONE; break;
+ case 1: eDisplayToken = XML_PRINTER; break;
+ case 2: eDisplayToken = XML_SCREEN; break;
+ // case 3: eDisplayToken = XML_ALWAYS break; this is the default
+ }
+
+ if( eDisplayToken != XML_TOKEN_INVALID )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "XMLShapeExport::exportShape(), exception caught!" );
+ }
+ }
+
+ // #82003# test export count
+ // #91587# ALWAYS increment since now ALL to be exported shapes are counted.
+ if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled())
+ {
+ mrExport.GetProgressBarHelper()->Increment();
+ }
+
+ onExport( xShape );
+
+ // --------------------
+ // export shape element
+ // --------------------
+ switch(aShapeInfo.meShapeType)
+ {
+ case XmlShapeTypeDrawRectangleShape:
+ {
+ ImpExportRectangleShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+ case XmlShapeTypeDrawEllipseShape:
+ {
+ ImpExportEllipseShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+ case XmlShapeTypeDrawLineShape:
+ {
+ ImpExportLineShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+ case XmlShapeTypeDrawPolyPolygonShape: // closed PolyPolygon
+ case XmlShapeTypeDrawPolyLineShape: // open PolyPolygon
+ case XmlShapeTypeDrawClosedBezierShape: // closed PolyPolygon containing curves
+ case XmlShapeTypeDrawOpenBezierShape: // open PolyPolygon containing curves
+ {
+ ImpExportPolygonShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawTextShape:
+ case XmlShapeTypePresTitleTextShape:
+ case XmlShapeTypePresOutlinerShape:
+ case XmlShapeTypePresSubtitleShape:
+ case XmlShapeTypePresNotesShape:
+ case XmlShapeTypePresHeaderShape:
+ case XmlShapeTypePresFooterShape:
+ case XmlShapeTypePresSlideNumberShape:
+ case XmlShapeTypePresDateTimeShape:
+ {
+ ImpExportTextBoxShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawGraphicObjectShape:
+ case XmlShapeTypePresGraphicObjectShape:
+ {
+ ImpExportGraphicObjectShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawChartShape:
+ case XmlShapeTypePresChartShape:
+ {
+ ImpExportChartShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint, pAttrList );
+ break;
+ }
+
+ case XmlShapeTypeDrawControlShape:
+ {
+ ImpExportControlShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawConnectorShape:
+ {
+ ImpExportConnectorShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawMeasureShape:
+ {
+ ImpExportMeasureShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawOLE2Shape:
+ case XmlShapeTypePresOLE2Shape:
+ case XmlShapeTypeDrawSheetShape:
+ case XmlShapeTypePresSheetShape:
+ {
+ ImpExportOLE2Shape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypePresTableShape:
+ case XmlShapeTypeDrawTableShape:
+ {
+ ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawPageShape:
+ case XmlShapeTypePresPageShape:
+ case XmlShapeTypeHandoutShape:
+ {
+ ImpExportPageShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawCaptionShape:
+ {
+ ImpExportCaptionShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDraw3DCubeObject:
+ case XmlShapeTypeDraw3DSphereObject:
+ case XmlShapeTypeDraw3DLatheObject:
+ case XmlShapeTypeDraw3DExtrudeObject:
+ {
+ ImpExport3DShape(xShape, aShapeInfo.meShapeType);
+ break;
+ }
+
+ case XmlShapeTypeDraw3DSceneObject:
+ {
+ ImpExport3DSceneShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawGroupShape:
+ {
+ // empty group
+ ImpExportGroupShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawFrameShape:
+ {
+ ImpExportFrameShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawAppletShape:
+ {
+ ImpExportAppletShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawPluginShape:
+ {
+ ImpExportPluginShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypeDrawCustomShape:
+ {
+ if ( aShapeInfo.xCustomShapeReplacement.is() )
+ ImpExportGroupShape( aShapeInfo.xCustomShapeReplacement, XmlShapeTypeDrawGroupShape, nFeatures, pRefPoint );
+ else
+ ImpExportCustomShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypePresMediaShape:
+ case XmlShapeTypeDrawMediaShape:
+ {
+ ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
+ break;
+ }
+
+ case XmlShapeTypePresOrgChartShape:
+ case XmlShapeTypeUnknown:
+ case XmlShapeTypeNotYetSet:
+ default:
+ {
+ // this should never happen and is an error
+ DBG_ERROR("XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
+ break;
+ }
+ }
+
+ mpHyperlinkElement.reset();
+
+ // #97489# #97111#
+ // if there was an error and no element for the shape was exported
+ // we need to clear the attribute list or the attributes will be
+ // set on the next exported element, which can result in corrupt
+ // xml files due to duplicate attributes
+
+ mrExport.CheckAttrList(); // asserts in non pro if we have attributes left
+ mrExport.ClearAttrList(); // clears the attributes
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// This method collects all automatic styles for the shapes inside the given XShapes collection
+void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XShapes >& xShapes )
+{
+ ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
+ seekShapes( xShapes );
+
+ uno::Reference< drawing::XShape > xShape;
+ const sal_Int32 nShapeCount(xShapes->getCount());
+ for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
+ {
+ xShapes->getByIndex(nShapeId) >>= xShape;
+ DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
+ if(!xShape.is())
+ continue;
+
+ collectShapeAutoStyles( xShape );
+ }
+
+ maCurrentShapesIter = aOldCurrentShapesIter;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// This method exports all XShape inside the given XShapes collection
+void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xShapes, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */ )
+{
+ ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
+ seekShapes( xShapes );
+
+ uno::Reference< drawing::XShape > xShape;
+ const sal_Int32 nShapeCount(xShapes->getCount());
+ for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
+ {
+ xShapes->getByIndex(nShapeId) >>= xShape;
+ DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
+ if(!xShape.is())
+ continue;
+
+ exportShape( xShape, nFeatures, pRefPoint );
+ }
+
+ maCurrentShapesIter = aOldCurrentShapesIter;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::seekShapes( const uno::Reference< drawing::XShapes >& xShapes ) throw()
+{
+ if( xShapes.is() )
+ {
+ maCurrentShapesIter = maShapesInfos.find( xShapes );
+ if( maCurrentShapesIter == maShapesInfos.end() )
+ {
+ ImplXMLShapeExportInfoVector aNewInfoVector;
+ aNewInfoVector.resize( (ShapesInfos::size_type) xShapes->getCount() );
+ maShapesInfos[ xShapes ] = aNewInfoVector;
+
+ maCurrentShapesIter = maShapesInfos.find( xShapes );
+
+ DBG_ASSERT( maCurrentShapesIter != maShapesInfos.end(), "XMLShapeExport::seekShapes(): insert into stl::map failed" );
+ }
+
+ DBG_ASSERT( (*maCurrentShapesIter).second.size() == (ShapesInfos::size_type)xShapes->getCount(), "XMLShapeExport::seekShapes(): XShapes size varied between calls" );
+
+ }
+ else
+ {
+ maCurrentShapesIter = maShapesInfos.end();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::exportAutoStyles()
+{
+ // export all autostyle infos
+
+ // ...for graphic
+// if(IsFamilyGraphicUsed())
+ {
+ GetExport().GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID
+ , GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap()
+ );
+ }
+
+ // ...for presentation
+// if(IsFamilyPresentationUsed())
+ {
+ GetExport().GetAutoStylePool()->exportXML(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID
+ , GetExport().GetDocHandler(),
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap()
+ );
+ }
+
+ if( mxShapeTableExport.is() )
+ mxShapeTableExport->exportAutoStyles();
+}
+
+///////////////////////////////////////////////////////////////////////
+
+/// returns the export property mapper for external chaining
+SvXMLExportPropertyMapper* XMLShapeExport::CreateShapePropMapper(
+ SvXMLExport& rExport )
+{
+ UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rExport.GetModel(), rExport );
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory );
+ SvXMLExportPropertyMapper* pResult =
+ new XMLShapeExportPropertyMapper( xMapper,
+ (XMLTextListAutoStylePool*)&rExport.GetTextParagraphExport()->GetListAutoStylePool(),
+ rExport );
+ // chain text attributes
+ return pResult;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType& eShapeType)
+{
+ // set in every case, so init here
+ eShapeType = XmlShapeTypeUnknown;
+
+ uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY);
+ if(xShapeDescriptor.is())
+ {
+ String aType((OUString)xShapeDescriptor->getShapeType());
+
+ if(aType.EqualsAscii((const sal_Char*)"com.sun.star.", 0, 13))
+ {
+ if(aType.EqualsAscii("drawing.", 13, 8))
+ {
+ // drawing shapes
+ if (aType.EqualsAscii("Rectangle", 21, 9)) { eShapeType = XmlShapeTypeDrawRectangleShape; }
+
+ // #i72177# Note: Correcting CustomShape, CustomShape->Custom, len from 9 (was wrong anyways) to 6.
+ // As can be seen at the other compares, the appendix "Shape" is left out of the comparison.
+ else if(aType.EqualsAscii("Custom", 21, 6)) { eShapeType = XmlShapeTypeDrawCustomShape; }
+
+ else if(aType.EqualsAscii("Ellipse", 21, 7)) { eShapeType = XmlShapeTypeDrawEllipseShape; }
+ else if(aType.EqualsAscii("Control", 21, 7)) { eShapeType = XmlShapeTypeDrawControlShape; }
+ else if(aType.EqualsAscii("Connector", 21, 9)) { eShapeType = XmlShapeTypeDrawConnectorShape; }
+ else if(aType.EqualsAscii("Measure", 21, 7)) { eShapeType = XmlShapeTypeDrawMeasureShape; }
+ else if(aType.EqualsAscii("Line", 21, 4)) { eShapeType = XmlShapeTypeDrawLineShape; }
+
+ // #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape
+ else if(aType.EqualsAscii("PolyPolygon", 21, 11)) { eShapeType = XmlShapeTypeDrawPolyPolygonShape; }
+
+ // #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape
+ else if(aType.EqualsAscii("PolyLine", 21, 8)) { eShapeType = XmlShapeTypeDrawPolyLineShape; }
+
+ else if(aType.EqualsAscii("OpenBezier", 21, 10)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
+ else if(aType.EqualsAscii("ClosedBezier", 21, 12)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
+
+ // #i72177# FreeHand (opened and closed) now supports the types OpenFreeHandShape and
+ // ClosedFreeHandShape respectively. Represent them as bezier shapes
+ else if(aType.EqualsAscii("OpenFreeHand", 21, 12)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
+ else if(aType.EqualsAscii("ClosedFreeHand", 21, 14)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
+
+ else if(aType.EqualsAscii("GraphicObject", 21, 13)) { eShapeType = XmlShapeTypeDrawGraphicObjectShape; }
+ else if(aType.EqualsAscii("Group", 21, 5)) { eShapeType = XmlShapeTypeDrawGroupShape; }
+ else if(aType.EqualsAscii("Text", 21, 4)) { eShapeType = XmlShapeTypeDrawTextShape; }
+ else if(aType.EqualsAscii("OLE2", 21, 4))
+ {
+ eShapeType = XmlShapeTypeDrawOLE2Shape;
+
+ // get info about presentation shape
+ uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
+
+ if(xPropSet.is())
+ {
+ rtl::OUString sCLSID;
+ if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID)
+ {
+ if (sCLSID.equals(mrExport.GetChartExport()->getChartCLSID()))
+ {
+ eShapeType = XmlShapeTypeDrawChartShape;
+ }
+ else if (
+ sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName()))
+ // #110680#
+ // same reaction for binfilter
+ || sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName()))
+ )
+ {
+ eShapeType = XmlShapeTypeDrawSheetShape;
+ }
+ else
+ {
+ // general OLE2 Object
+ }
+ }
+ }
+ }
+ else if(aType.EqualsAscii("Page", 21, 4)) { eShapeType = XmlShapeTypeDrawPageShape; }
+ else if(aType.EqualsAscii("Frame", 21, 5)) { eShapeType = XmlShapeTypeDrawFrameShape; }
+ else if(aType.EqualsAscii("Caption", 21, 7)) { eShapeType = XmlShapeTypeDrawCaptionShape; }
+ else if(aType.EqualsAscii("Plugin", 21, 6)) { eShapeType = XmlShapeTypeDrawPluginShape; }
+ else if(aType.EqualsAscii("Applet", 21, 6)) { eShapeType = XmlShapeTypeDrawAppletShape; }
+ else if(aType.EqualsAscii("MediaShape", 21, 10)) { eShapeType = XmlShapeTypeDrawMediaShape; }
+ else if(aType.EqualsAscii("TableShape", 21, 10)) { eShapeType = XmlShapeTypeDrawTableShape; }
+
+ // 3D shapes
+ else if(aType.EqualsAscii("Scene", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DSceneObject; }
+ else if(aType.EqualsAscii("Cube", 21 + 7, 4)) { eShapeType = XmlShapeTypeDraw3DCubeObject; }
+ else if(aType.EqualsAscii("Sphere", 21 + 7, 6)) { eShapeType = XmlShapeTypeDraw3DSphereObject; }
+ else if(aType.EqualsAscii("Lathe", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DLatheObject; }
+ else if(aType.EqualsAscii("Extrude", 21 + 7, 7)) { eShapeType = XmlShapeTypeDraw3DExtrudeObject; }
+ }
+ else if(aType.EqualsAscii("presentation.", 13, 13))
+ {
+ // presentation shapes
+ if (aType.EqualsAscii("TitleText", 26, 9)) { eShapeType = XmlShapeTypePresTitleTextShape; }
+ else if(aType.EqualsAscii("Outliner", 26, 8)) { eShapeType = XmlShapeTypePresOutlinerShape; }
+ else if(aType.EqualsAscii("Subtitle", 26, 8)) { eShapeType = XmlShapeTypePresSubtitleShape; }
+ else if(aType.EqualsAscii("GraphicObject", 26, 13)) { eShapeType = XmlShapeTypePresGraphicObjectShape; }
+ else if(aType.EqualsAscii("Page", 26, 4)) { eShapeType = XmlShapeTypePresPageShape; }
+ else if(aType.EqualsAscii("OLE2", 26, 4))
+ {
+ eShapeType = XmlShapeTypePresOLE2Shape;
+
+ // get info about presentation shape
+ uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
+
+ if(xPropSet.is()) try
+ {
+ rtl::OUString sCLSID;
+ if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID)
+ {
+ if( sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName())) ||
+ sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName())) )
+ {
+ eShapeType = XmlShapeTypePresSheetShape;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
+ }
+ }
+ else if(aType.EqualsAscii("Chart", 26, 5)) { eShapeType = XmlShapeTypePresChartShape; }
+ else if(aType.EqualsAscii("OrgChart", 26, 8)) { eShapeType = XmlShapeTypePresOrgChartShape; }
+ else if(aType.EqualsAscii("CalcShape", 26, 9)) { eShapeType = XmlShapeTypePresSheetShape; }
+ else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresTableShape; }
+ else if(aType.EqualsAscii("Notes", 26, 5)) { eShapeType = XmlShapeTypePresNotesShape; }
+ else if(aType.EqualsAscii("HandoutShape", 26, 12)) { eShapeType = XmlShapeTypeHandoutShape; }
+ else if(aType.EqualsAscii("HeaderShape", 26, 11)) { eShapeType = XmlShapeTypePresHeaderShape; }
+ else if(aType.EqualsAscii("FooterShape", 26, 11)) { eShapeType = XmlShapeTypePresFooterShape; }
+ else if(aType.EqualsAscii("SlideNumberShape", 26, 16)) { eShapeType = XmlShapeTypePresSlideNumberShape; }
+ else if(aType.EqualsAscii("DateTimeShape", 26, 13)) { eShapeType = XmlShapeTypePresDateTimeShape; }
+ else if(aType.EqualsAscii("MediaShape", 26, 10)) { eShapeType = XmlShapeTypePresMediaShape; }
+ }
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+extern SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[];
+extern SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[];
+
+/** exports all user defined glue points */
+void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
+ if( !xSupplier.is() )
+ return;
+
+ uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
+ if( !xGluePoints.is() )
+ return;
+
+ drawing::GluePoint2 aGluePoint;
+
+ uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
+
+ const sal_Int32 nCount = aIdSequence.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ const sal_Int32 nIdentifier = aIdSequence[nIndex];
+ if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
+ {
+ // export only user defined glue points
+
+ const OUString sId( OUString::valueOf( nIdentifier ) );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, sId );
+
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.X);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear());
+
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.Y);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear());
+
+ if( !aGluePoint.IsRelative )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.PositionAlignment, aXML_GlueAlignment_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ALIGN, msBuffer.makeStringAndClear() );
+ }
+
+ if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.Escape, aXML_GlueEscapeDirection_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ESCAPE_DIRECTION, msBuffer.makeStringAndClear() );
+ }
+
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_DRAW, XML_GLUE_POINT, sal_True, sal_True);
+ }
+ }
+}
+
+void XMLShapeExport::ExportGraphicDefaults()
+{
+ XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
+
+ // construct PropertySetMapper
+ UniReference< SvXMLExportPropertyMapper > xPropertySetMapper( CreateShapePropMapper( mrExport ) );
+ ((XMLShapeExportPropertyMapper*)xPropertySetMapper.get())->SetAutoStyles( sal_False );
+
+ // chain text attributes
+ xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(mrExport));
+
+ // chain special Writer/text frame default attributes
+ xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaDefaultExtPropMapper(mrExport));
+
+ // write graphic family default style
+ uno::Reference< lang::XMultiServiceFactory > xFact( mrExport.GetModel(), uno::UNO_QUERY );
+ if( xFact.is() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), uno::UNO_QUERY );
+ if( xDefaults.is() )
+ {
+ aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper );
+
+ // write graphic family styles
+ aStEx.exportStyleFamily("graphics", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper, FALSE, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {
+ }
+ }
+}
+
+void XMLShapeExport::onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& )
+{
+}
+
+const rtl::Reference< XMLTableExport >& XMLShapeExport::GetShapeTableExport()
+{
+ if( !mxShapeTableExport.is() )
+ {
+ rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ) );
+ UniReference < XMLPropertySetMapper > xMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
+ rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&mrExport.GetTextParagraphExport()->GetListAutoStylePool(), mrExport ) );
+ mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory );
+ }
+
+ return mxShapeTableExport;
+}
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
new file mode 100644
index 000000000000..d13b5e24e2db
--- /dev/null
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -0,0 +1,2056 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include "anim.hxx"
+
+#ifndef _XMLOFF_SHAPEEXPORT_HXX
+#include <xmloff/shapeexport.hxx>
+#endif
+#include "sdpropls.hxx"
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "XMLImageMapExport.hxx"
+#include "xexptran.hxx"
+#include <tools/gen.hxx> // FRound
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include "xmlnmspe.hxx"
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportNewTrans(const uno::Reference< beans::XPropertySet >& xPropSet,
+ sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct abour pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // use features and write
+ ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
+}
+
+void XMLShapeExport::ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix,
+ const uno::Reference< beans::XPropertySet >& xPropSet)
+{
+ // --> OD 2004-08-09 #i28749# - Get <TransformationInHoriL2R>, if it exist
+ // and if the document is exported into the OpenOffice.org file format.
+ // This property only exists at service com::sun::star::text::Shape - the
+ // Writer UNO service for shapes.
+ // This code is needed, because the positioning attributes in the
+ // OpenOffice.org file format are given in horizontal left-to-right layout
+ // regardless the layout direction the shape is in. In the OASIS Open Office
+ // file format the positioning attributes are correctly given in the layout
+ // direction the shape is in. Thus, this code provides the conversion from
+ // the OASIS Open Office file format to the OpenOffice.org file format.
+ uno::Any aAny;
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R"))) )
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R")));
+ }
+ else
+ {
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")));
+ }
+ // <--
+ drawing::HomogenMatrix3 aMatrix;
+ aAny >>= aMatrix;
+
+ rMatrix.set(0, 0, aMatrix.Line1.Column1);
+ rMatrix.set(0, 1, aMatrix.Line1.Column2);
+ rMatrix.set(0, 2, aMatrix.Line1.Column3);
+ rMatrix.set(1, 0, aMatrix.Line2.Column1);
+ rMatrix.set(1, 1, aMatrix.Line2.Column2);
+ rMatrix.set(1, 2, aMatrix.Line2.Column3);
+ rMatrix.set(2, 0, aMatrix.Line3.Column1);
+ rMatrix.set(2, 1, aMatrix.Line3.Column2);
+ rMatrix.set(2, 2, aMatrix.Line3.Column3);
+}
+
+void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale,
+ double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint)
+{
+ // decompose matrix
+ rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
+
+ // correct translation about pRefPoint
+ if(pRefPoint)
+ {
+ rTRTranslate -= ::basegfx::B2DTuple(pRefPoint->X, pRefPoint->Y);
+ }
+}
+
+void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear,
+ double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures)
+{
+ // allways write Size (rTRScale) since this statement carries the union
+ // of the object
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+ ::basegfx::B2DTuple aTRScale(rTRScale);
+
+ // svg: width
+ if(!(nFeatures & SEF_EXPORT_WIDTH))
+ {
+ aTRScale.setX(1.0);
+ }
+ else
+ {
+ if( aTRScale.getX() > 0.0 )
+ aTRScale.setX(aTRScale.getX() - 1.0);
+ else if( aTRScale.getX() < 0.0 )
+ aTRScale.setX(aTRScale.getX() + 1.0);
+ }
+
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
+
+ // svg: height
+ if(!(nFeatures & SEF_EXPORT_HEIGHT))
+ {
+ aTRScale.setY(1.0);
+ }
+ else
+ {
+ if( aTRScale.getY() > 0.0 )
+ aTRScale.setY(aTRScale.getY() - 1.0);
+ else if( aTRScale.getY() < 0.0 )
+ aTRScale.setY(aTRScale.getY() + 1.0);
+ }
+
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getY()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
+
+ // decide if transformation is neccessary
+ BOOL bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0);
+
+ if(bTransformationIsNeccessary)
+ {
+ // write transformation, but WITHOUT scale which is exported as size above
+ SdXMLImExTransform2D aTransform;
+
+ aTransform.AddSkewX(atan(fTRShear));
+
+ // #i78696#
+ // fTRRotate is mathematically correct, but due to the error
+ // we export/import it mirrored. Since the API implementation is fixed and
+ // uses the correctly oriented angle, it is necessary for compatibility to
+ // mirror the angle here to stay at the old behaviour. There is a follow-up
+ // task (#i78698#) to fix this in the next ODF FileFormat version
+ aTransform.AddRotate(-fTRRotate);
+
+ aTransform.AddTranslate(rTRTranslate);
+
+ // does transformation need to be exported?
+ if(aTransform.NeedsAction())
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+ }
+ else
+ {
+ // no shear, no rotate; just add object position to export and we are done
+ if(nFeatures & SEF_EXPORT_X)
+ {
+ // svg: x
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getX()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
+ }
+
+ if(nFeatures & SEF_EXPORT_Y)
+ {
+ // svg: y
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getY()));
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sal_Bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< beans::XPropertySet >& xPropSet, const rtl::OUString& rClass )
+{
+ sal_Bool bIsEmpty = sal_False;
+
+ OUStringBuffer sStringBuffer;
+
+ // write presentation class entry
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, rClass);
+
+ if( xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ sal_Bool bTemp = false;
+
+ // is empty pes shape?
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))))
+ {
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))) >>= bIsEmpty;
+ if( bIsEmpty )
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TRUE);
+ }
+
+ // is user-transformed?
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))))
+ {
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))) >>= bTemp;
+ if(!bTemp)
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TRUE);
+ }
+ }
+
+ return bIsEmpty;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
+ if( xEnumAccess.is() && xEnumAccess->hasElements() )
+ mrExport.GetTextParagraphExport()->exportText( xText );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+
+namespace {
+
+const sal_Int32 FOUND_CLICKACTION = 0x00000001;
+const sal_Int32 FOUND_BOOKMARK = 0x00000002;
+const sal_Int32 FOUND_EFFECT = 0x00000004;
+const sal_Int32 FOUND_PLAYFULL = 0x00000008;
+const sal_Int32 FOUND_VERB = 0x00000010;
+const sal_Int32 FOUND_SOUNDURL = 0x00000020;
+const sal_Int32 FOUND_SPEED = 0x00000040;
+const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
+const sal_Int32 FOUND_MACRO = 0x00000100;
+const sal_Int32 FOUND_LIBRARY = 0x00000200;
+const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+const sal_Int32 FOUND_URL = 0x00000800;
+#endif
+
+} // namespace
+
+void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
+ if( !xEventsSupplier.is() )
+ return;
+
+ uno::Reference< container::XNameAccess > xEvents( xEventsSupplier->getEvents(), uno::UNO_QUERY );
+ DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
+ if( !xEvents.is() )
+ return;
+
+ sal_Int32 nFound = 0;
+
+ // extract properties from "OnClick" event --------------------------------
+
+ OUString aClickEventType;
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
+ OUString aStrSoundURL;
+ sal_Bool bPlayFull = false;
+ sal_Int32 nVerb = 0;
+ OUString aStrMacro;
+ OUString aStrLibrary;
+ OUString aStrBookmark;
+
+ uno::Sequence< beans::PropertyValue > aClickProperties;
+ if( xEvents->hasByName( msOnClick ) && (xEvents->getByName( msOnClick ) >>= aClickProperties) )
+ {
+ const beans::PropertyValue* pProperty = aClickProperties.getConstArray();
+ const beans::PropertyValue* pPropertyEnd = pProperty + aClickProperties.getLength();
+ for( ; pProperty != pPropertyEnd; ++pProperty )
+ {
+ if( ( ( nFound & FOUND_CLICKEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
+ {
+ if( pProperty->Value >>= aClickEventType )
+ nFound |= FOUND_CLICKEVENTTYPE;
+ }
+ else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperty->Name == msClickAction )
+ {
+ if( pProperty->Value >>= eClickAction )
+ nFound |= FOUND_CLICKACTION;
+ }
+ else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperty->Name == msMacroName || pProperty->Name == msScript ) )
+ {
+ if( pProperty->Value >>= aStrMacro )
+ nFound |= FOUND_MACRO;
+ }
+ else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperty->Name == msLibrary )
+ {
+ if( pProperty->Value >>= aStrLibrary )
+ nFound |= FOUND_LIBRARY;
+ }
+ else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperty->Name == msEffect )
+ {
+ if( pProperty->Value >>= eEffect )
+ nFound |= FOUND_EFFECT;
+ }
+ else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperty->Name == msBookmark )
+ {
+ if( pProperty->Value >>= aStrBookmark )
+ nFound |= FOUND_BOOKMARK;
+ }
+ else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperty->Name == msSpeed )
+ {
+ if( pProperty->Value >>= eSpeed )
+ nFound |= FOUND_SPEED;
+ }
+ else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperty->Name == msSoundURL )
+ {
+ if( pProperty->Value >>= aStrSoundURL )
+ nFound |= FOUND_SOUNDURL;
+ }
+ else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperty->Name == msPlayFull )
+ {
+ if( pProperty->Value >>= bPlayFull )
+ nFound |= FOUND_PLAYFULL;
+ }
+ else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperty->Name == msVerb )
+ {
+ if( pProperty->Value >>= nVerb )
+ nFound |= FOUND_VERB;
+ }
+ }
+ }
+
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ // extract properties from "OnAction" event -------------------------------
+
+ OUString aActionEventType;
+ OUString aHyperURL;
+
+ uno::Sequence< beans::PropertyValue > aActionProperties;
+ if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) )
+ {
+ const beans::PropertyValue* pProperty = aActionProperties.getConstArray();
+ const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength();
+ for( ; pProperty != pPropertyEnd; ++pProperty )
+ {
+ if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
+ {
+ if( pProperty->Value >>= aActionEventType )
+ nFound |= FOUND_ACTIONEVENTTYPE;
+ }
+ else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL ) )
+ {
+ if( pProperty->Value >>= aHyperURL )
+ nFound |= FOUND_URL;
+ }
+ }
+ }
+#endif
+
+ // create the XML elements
+
+ if( aClickEventType == msPresentation )
+ {
+ if( ((nFound & FOUND_CLICKACTION) == 0) || (eClickAction == presentation::ClickAction_NONE) )
+ return;
+
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
+
+ enum XMLTokenEnum eStrAction;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_PREVPAGE: eStrAction = XML_PREVIOUS_PAGE; break;
+ case presentation::ClickAction_NEXTPAGE: eStrAction = XML_NEXT_PAGE; break;
+ case presentation::ClickAction_FIRSTPAGE: eStrAction = XML_FIRST_PAGE; break;
+ case presentation::ClickAction_LASTPAGE: eStrAction = XML_LAST_PAGE; break;
+ case presentation::ClickAction_INVISIBLE: eStrAction = XML_HIDE; break;
+ case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
+ case presentation::ClickAction_PROGRAM: eStrAction = XML_EXECUTE; break;
+ case presentation::ClickAction_BOOKMARK: eStrAction = XML_SHOW; break;
+ case presentation::ClickAction_DOCUMENT: eStrAction = XML_SHOW; break;
+ case presentation::ClickAction_MACRO: eStrAction = XML_EXECUTE_MACRO; break;
+ case presentation::ClickAction_VERB: eStrAction = XML_VERB; break;
+ case presentation::ClickAction_VANISH: eStrAction = XML_FADE_OUT; break;
+ case presentation::ClickAction_SOUND: eStrAction = XML_SOUND; break;
+ default:
+ DBG_ERROR( "unknown presentation::ClickAction found!" );
+ eStrAction = XML_UNKNOWN;
+ }
+
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction );
+
+ if( eClickAction == presentation::ClickAction_VANISH )
+ {
+ if( nFound & FOUND_EFFECT )
+ {
+ XMLEffect eKind;
+ XMLEffectDirection eDirection;
+ sal_Int16 nStartScale;
+ sal_Bool bIn;
+
+ SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
+
+ if( eKind != EK_none )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() );
+ }
+
+ if( eDirection != ED_none )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() );
+ }
+
+ if( nStartScale != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( msBuffer, nStartScale );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() );
+ }
+ }
+
+ if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE )
+ {
+ if( eSpeed != presentation::AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap );
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() );
+ }
+ }
+ }
+
+ if( eClickAction == presentation::ClickAction_PROGRAM ||
+ eClickAction == presentation::ClickAction_BOOKMARK ||
+ eClickAction == presentation::ClickAction_DOCUMENT )
+ {
+ if( eClickAction == presentation::ClickAction_BOOKMARK )
+ msBuffer.append( sal_Unicode('#') );
+
+ msBuffer.append( aStrBookmark );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ }
+
+ if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB )
+ {
+ msBuffer.append( nVerb );
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear());
+ }
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
+
+ if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
+ {
+ if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
+ if( nFound & FOUND_PLAYFULL && bPlayFull )
+ mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
+
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
+ }
+ }
+ }
+ else if( aClickEventType == msStarBasic )
+ {
+ if( nFound & FOUND_MACRO )
+ {
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
+
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "starbasic" ) ) ) );
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+
+ if( nFound & FOUND_LIBRARY )
+ {
+ OUString sLocation( GetXMLToken(
+ (aStrLibrary.equalsIgnoreAsciiCaseAscii("StarOffice") ||
+ aStrLibrary.equalsIgnoreAsciiCaseAscii("application") ) ? XML_APPLICATION
+ : XML_DOCUMENT ) );
+ OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
+ sTmp = sLocation;
+ sTmp.append( sal_Unicode( ':' ) );
+ sTmp.append( aStrMacro );
+ mrExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
+ sTmp.makeStringAndClear());
+ }
+ else
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro );
+ }
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
+ }
+ }
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ else if( aClickEventType == msScript || aActionEventType == msAction )
+ {
+ if( nFound & ( FOUND_MACRO | FOUND_URL ) )
+#else
+ else if( aClickEventType == msScript )
+ {
+ if( nFound & FOUND_MACRO )
+#endif
+ {
+ SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
+ if ( nFound & FOUND_MACRO )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
+ }
+#ifdef ISSUE66550_HLINK_FOR_SHAPES
+ if ( nFound & FOUND_URL )
+ {
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
+ }
+#endif
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** #i68101# export shape Title and Description */
+void XMLShapeExport::ImpExportDescription( const uno::Reference< drawing::XShape >& xShape )
+{
+ try
+ {
+ OUString aTitle;
+ OUString aDescription;
+
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
+ xProps->getPropertyValue( OUString::createFromAscii( "Title" ) ) >>= aTitle;
+ xProps->getPropertyValue( OUString::createFromAscii( "Description" ) ) >>= aDescription;
+
+ if(aTitle.getLength())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
+ mrExport.Characters( aTitle );
+ }
+
+ if(aDescription.getLength())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False );
+ mrExport.Characters( aDescription );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "could not export Title and/or Description for shape!" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ // write group shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aPGR(mrExport, XML_NAMESPACE_DRAW, XML_G, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ // #89764# if export of position is supressed for group shape,
+ // positions of contained objects should be written relative to
+ // the upper left edge of the group.
+ awt::Point aUpperLeft;
+
+ if(!(nFeatures & SEF_EXPORT_POSITION))
+ {
+ nFeatures |= SEF_EXPORT_POSITION;
+ aUpperLeft = xShape->getPosition();
+ pRefPoint = &aUpperLeft;
+ }
+
+ // write members
+ exportShapes( xShapes, nFeatures, pRefPoint );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportTextBoxShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // presentation attribute (if presentation)
+ sal_Bool bIsPresShape(FALSE);
+ sal_Bool bIsEmptyPresObj(FALSE);
+ OUString aStr;
+
+ switch(eShapeType)
+ {
+ case XmlShapeTypePresSubtitleShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresTitleTextShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_TITLE);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresOutlinerShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_OUTLINE);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresNotesShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_NOTES);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresHeaderShape:
+ {
+ aStr = GetXMLToken(XML_HEADER);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresFooterShape:
+ {
+ aStr = GetXMLToken(XML_FOOTER);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresSlideNumberShape:
+ {
+ aStr = GetXMLToken(XML_PAGE_NUMBER);
+ bIsPresShape = TRUE;
+ break;
+ }
+ case XmlShapeTypePresDateTimeShape:
+ {
+ aStr = GetXMLToken(XML_DATE_TIME);
+ bIsPresShape = TRUE;
+ break;
+ }
+ default:
+ break;
+ }
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ if(bIsPresShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
+
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0L);
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
+
+ {
+ // write text-box
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, sal_True, sal_True);
+ if(!bIsEmptyPresObj)
+ ImpExportText( xShape );
+ }
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportRectangleShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0L);
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
+
+ // write rectangle
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_RECT, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportLineShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ // #85920# use 'Geometry' to get the points of the line
+ // since this slot take anchor pos into account.
+
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct about pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // create base position
+ awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
+
+ // get the two points
+ uno::Any aAny(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))));
+ drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
+
+ if(pSourcePolyPolygon)
+ {
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+ if(pOuterSequence)
+ {
+ drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ if(pInnerSequence)
+ {
+ awt::Point* pArray = pInnerSequence->getArray();
+ if(pArray)
+ {
+ if(pInnerSequence->getLength() > 0)
+ {
+ aStart = awt::Point(
+ pArray->X + aBasePosition.X,
+ pArray->Y + aBasePosition.Y);
+ pArray++;
+ }
+
+ if(pInnerSequence->getLength() > 1)
+ {
+ aEnd = awt::Point(
+ pArray->X + aBasePosition.X,
+ pArray->Y + aBasePosition.Y);
+ }
+ }
+ }
+ }
+ }
+
+ if( nFeatures & SEF_EXPORT_X )
+ {
+ // svg: x1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
+
+ if( nFeatures & SEF_EXPORT_Y )
+ {
+ // svg: y1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
+
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // write line
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportEllipseShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // get size to decide between Circle and Ellipse
+ awt::Size aSize = xShape->getSize();
+ sal_Int32 nRx((aSize.Width + 1) / 2);
+ sal_Int32 nRy((aSize.Height + 1) / 2);
+ BOOL bCircle(nRx == nRy);
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ drawing::CircleKind eKind = drawing::CircleKind_FULL;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")) ) >>= eKind;
+ if( eKind != drawing::CircleKind_FULL )
+ {
+ OUStringBuffer sStringBuffer;
+ sal_Int32 nStartAngle = 0;
+ sal_Int32 nEndAngle = 0;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")) ) >>= nStartAngle;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")) ) >>= nEndAngle;
+
+ const double dStartAngle = nStartAngle / 100.0;
+ const double dEndAngle = nEndAngle / 100.0;
+
+ // export circle kind
+ SvXMLUnitConverter::convertEnum( sStringBuffer, (USHORT)eKind, aXML_CircleKind_EnumMap );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
+
+ // export start angle
+ SvXMLUnitConverter::convertDouble( sStringBuffer, dStartAngle );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
+
+ // export end angle
+ SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
+ }
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+
+ if(bCircle)
+ {
+ // write circle
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ else
+ {
+ // write ellipse
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportPolygonShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ BOOL bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape
+ || eShapeType == XmlShapeTypeDrawClosedBezierShape);
+ BOOL bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
+ || eShapeType == XmlShapeTypeDrawOpenBezierShape);
+
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct abour pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // use features and write
+ ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
+
+ // create and export ViewBox
+ awt::Point aPoint(0, 0);
+ awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
+ SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+
+ if(bBezier)
+ {
+ // get PolygonBezier
+ uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+ drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
+ (drawing::PolyPolygonBezierCoords*)aAny.getValue();
+
+ if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+ {
+ sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+
+ if(pOuterSequence && pOuterFlags)
+ {
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ drawing::FlagSequence* pFlags = pOuterFlags++;
+
+ if(pSequence && pFlags)
+ {
+ aSvgDElement.AddPolygon(pSequence, pFlags,
+ aPoint, aSize, bClosed);
+ }
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ }
+
+ // write object now
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ }
+ else
+ {
+ // get non-bezier polygon
+ uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+ drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
+
+ if(pSourcePolyPolygon && pSourcePolyPolygon->getLength())
+ {
+ sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength());
+
+ if(1L == nOuterCnt && !bBezier)
+ {
+ // simple polygon shape, can be written as svg:points sequence
+ drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray();
+ if(pSequence)
+ {
+ SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize,
+ // #96328#
+ bClosed);
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString());
+ }
+
+ // write object now
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
+ bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ else
+ {
+ // polypolygon or bezier, needs to be written as a svg:path sequence
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+ if(pOuterSequence)
+ {
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ if(pSequence)
+ {
+ aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
+ aSize, bClosed);
+ }
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ }
+
+ // write object now
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportGraphicObjectShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ sal_Bool bIsEmptyPresObj = sal_False;
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ OUString sImageURL;
+
+ if(eShapeType == XmlShapeTypePresGraphicObjectShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) );
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
+
+ if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ {
+ if( !bIsEmptyPresObj )
+ {
+ OUString aStreamURL;
+ OUString aStr;
+
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL;
+
+ OUString aResolveURL( sImageURL );
+ const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") );
+
+ // sj: trying to preserve the filename
+ if ( aStreamURL.match( sPackageURL, 0 ) )
+ {
+ rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
+ sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
+ if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
+ sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
+ nLastIndex = sRequestedName.lastIndexOf( '.' );
+ if ( nLastIndex >= 0 )
+ sRequestedName = sRequestedName.copy( 0, nLastIndex );
+ if ( sRequestedName.getLength() )
+ {
+ aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName=")));
+ aResolveURL = aResolveURL.concat( sRequestedName );
+ }
+ }
+
+ aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
+
+ if( aStr.getLength() )
+ {
+ if( aStr[ 0 ] == '#' )
+ {
+ aStreamURL = OUString::createFromAscii( "vnd.sun.star.Package:" );
+ aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
+ }
+
+ // update stream URL for load on demand
+ uno::Any aAny;
+ aAny <<= aStreamURL;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")), aAny );
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+ }
+ else
+ {
+ OUString aStr;
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ {
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True);
+
+ if( sImageURL.getLength() )
+ {
+ // optional office:binary-data
+ mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
+ }
+ if( !bIsEmptyPresObj )
+ ImpExportText( xShape );
+ }
+ }
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ // image map
+ GetExport().GetImageMapExport().Export( xPropSet );
+ ImpExportDescription( xShape ); // #i68101#
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportChartShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint,
+ SvXMLAttributeList* pAttrList )
+{
+ ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportControlShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ }
+
+ uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
+ DBG_ASSERT( xControl.is(), "Control shape is not supporting XControlShape" );
+ if( xControl.is() )
+ {
+ uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
+ DBG_ASSERT( xControlModel.is(), "Control shape has not XControlModel" );
+ if( xControlModel.is() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) );
+ }
+ }
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportConnectorShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
+
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // export connection kind
+ drawing::ConnectorType eType = drawing::ConnectorType_STANDARD;
+ uno::Any aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")));
+ aAny >>= eType;
+
+ if( eType != drawing::ConnectorType_STANDARD )
+ {
+ SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eType, aXML_ConnectionKind_EnumMap );
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TYPE, aStr);
+ }
+
+ // export line skew
+ sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
+
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")));
+ aAny >>= nDelta1;
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")));
+ aAny >>= nDelta2;
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")));
+ aAny >>= nDelta3;
+
+ if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
+ {
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta1);
+ if( nDelta2 != 0 || nDelta3 != 0 )
+ {
+ const char aSpace = ' ';
+ sStringBuffer.appendAscii( &aSpace, 1 );
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta2);
+ if( nDelta3 != 0 )
+ {
+ sStringBuffer.appendAscii( &aSpace, 1 );
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta3);
+ }
+ }
+
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LINE_SKEW, aStr);
+ }
+
+ // export start and end point
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and
+ // <EndPositionInHoriL2R>, if they exist and if the document is exported
+ // into the OpenOffice.org file format.
+ // These properties only exist at service com::sun::star::text::Shape - the
+ // Writer UNO service for shapes.
+ // This code is needed, because the positioning attributes in the
+ // OpenOffice.org file format are given in horizontal left-to-right layout
+ // regardless the layout direction the shape is in. In the OASIS Open Office
+ // file format the positioning attributes are correctly given in the layout
+ // direction the shape is in. Thus, this code provides the conversion from
+ // the OASIS Open Office file format to the OpenOffice.org file format.
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
+ }
+ else
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
+ }
+ // <--
+
+ if( pRefPoint )
+ {
+ aStart.X -= pRefPoint->X;
+ aStart.Y -= pRefPoint->Y;
+ aEnd.X -= pRefPoint->X;
+ aEnd.Y -= pRefPoint->Y;
+ }
+
+ if( nFeatures & SEF_EXPORT_X )
+ {
+ // svg: x1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
+
+ if( nFeatures & SEF_EXPORT_Y )
+ {
+ // svg: y1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
+
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // #i39320#
+ uno::Reference< uno::XInterface > xRefS;
+ uno::Reference< uno::XInterface > xRefE;
+
+ // export start connection
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartShape") ) ) >>= xRefS;
+ if( xRefS.is() )
+ {
+ const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_SHAPE, rShapeId);
+
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")) );
+ sal_Int32 nGluePointId = 0;
+ if( aAny >>= nGluePointId )
+ {
+ if( nGluePointId != -1 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::valueOf( nGluePointId ));
+ }
+ }
+ }
+
+ // export end connection
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndShape")) ) >>= xRefE;
+ if( xRefE.is() )
+ {
+ const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_SHAPE, rShapeId);
+
+ aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) );
+ sal_Int32 nGluePointId = 0;
+ if( aAny >>= nGluePointId )
+ {
+ if( nGluePointId != -1 )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::valueOf( nGluePointId ));
+ }
+ }
+ }
+
+ if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
+ {
+ // get PolygonBezier
+ drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
+ (drawing::PolyPolygonBezierCoords*)aAny.getValue();
+
+ if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+ {
+ sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
+ drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+
+ if(pOuterSequence && pOuterFlags)
+ {
+ // prepare svx:d element export
+ awt::Point aPoint( 0, 0 );
+ awt::Size aSize( 1, 1 );
+ SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+
+ for(sal_Int32 a(0L); a < nOuterCnt; a++)
+ {
+ drawing::PointSequence* pSequence = pOuterSequence++;
+ drawing::FlagSequence* pFlags = pOuterFlags++;
+
+ if(pSequence && pFlags)
+ {
+ aSvgDElement.AddPolygon(pSequence, pFlags,
+ aPoint, aSize, sal_False );
+ }
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ }
+ }
+ }
+
+ // write connector shape. Add Export later.
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportMeasureShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
+
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // export start and end point
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and
+ // <EndPositionInHoriL2R>, if they exist and if the document is exported
+ // into the OpenOffice.org file format.
+ // These properties only exist at service com::sun::star::text::Shape - the
+ // Writer UNO service for shapes.
+ // This code is needed, because the positioning attributes in the
+ // OpenOffice.org file format are given in horizontal left-to-right layout
+ // regardless the layout direction the shape is in. In the OASIS Open Office
+ // file format the positioning attributes are correctly given in the layout
+ // direction the shape is in. Thus, this code provides the conversion from
+ // the OASIS Open Office file format to the OpenOffice.org file format.
+ if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
+ xProps->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
+ }
+ else
+ {
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
+ xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
+ }
+ // <--
+
+ if( pRefPoint )
+ {
+ aStart.X -= pRefPoint->X;
+ aStart.Y -= pRefPoint->Y;
+ aEnd.X -= pRefPoint->X;
+ aEnd.Y -= pRefPoint->Y;
+ }
+
+ if( nFeatures & SEF_EXPORT_X )
+ {
+ // svg: x1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
+
+ if( nFeatures & SEF_EXPORT_Y )
+ {
+ // svg: y1
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
+
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // write measure shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
+ if( xText.is() )
+ mrExport.GetTextParagraphExport()->exportText( xText );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportOLE2Shape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */,
+ SvXMLAttributeList* pAttrList /* = NULL */ )
+{
+ uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
+
+ DBG_ASSERT( xPropSet.is() && xNamed.is(), "ole shape is not implementing needed interfaces");
+ if(xPropSet.is() && xNamed.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bIsEmptyPresObj = sal_False;
+
+ // presentation settings
+ if(eShapeType == XmlShapeTypePresOLE2Shape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
+ else if(eShapeType == XmlShapeTypePresChartShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
+ else if(eShapeType == XmlShapeTypePresSheetShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
+ OUString sPersistName;
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
+
+ if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ {
+ if (pAttrList)
+ {
+ mrExport.AddAttributeList(pAttrList);
+ }
+
+ OUString sClassId;
+ OUString sURL;
+ sal_Bool bInternal = false;
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsInternal"))) >>= bInternal;
+
+ if( !bIsEmptyPresObj )
+ {
+
+ if ( bInternal )
+ {
+ // OOo internal links have no storage persistance, URL is stored in the XML file
+ // the result LinkURL is empty in case the object is not a link
+ xPropSet->getPropertyValue( OUString::createFromAscii( "LinkURL" ) ) >>= sURL;
+ }
+
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ) ) >>= sPersistName;
+ if ( !sURL.getLength() )
+ {
+ if( sPersistName.getLength() )
+ {
+ sURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
+ sURL += sPersistName;
+ }
+ }
+
+ if( !bInternal )
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sClassId;
+
+ if( sClassId.getLength() )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
+ if(!bExportEmbedded)
+ {
+ // xlink:href
+ if( sURL.getLength() )
+ {
+ // #96717# in theorie, if we don't have a url we shouldn't even
+ // export this ole shape. But practical its to risky right now
+ // to change this so we better dispose this on load
+ sURL = mrExport.AddEmbeddedObject( sURL );
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+ }
+ }
+ else
+ {
+ // export empty href for empty placeholders to be valid odf
+ OUString sEmptyURL;
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sEmptyURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ enum XMLTokenEnum eElem = sClassId.getLength() ? XML_OBJECT_OLE : XML_OBJECT;
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True );
+
+ if(bExportEmbedded && !bIsEmptyPresObj)
+ {
+ // #100592#
+ if(bInternal)
+ {
+ // embedded XML
+ uno::Reference< lang::XComponent > xComp;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp;
+ DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
+ mrExport.ExportEmbeddedOwnObject( xComp );
+ }
+ else
+ {
+ // embed as Base64
+ // this is an alien object ( currently MSOLE is the only supported type of such objects )
+ // in case it is not an OASIS format the object should be asked to store replacement image if possible
+
+ ::rtl::OUString sURLRequest( sURL );
+ if ( ( mrExport.getExportFlags() & EXPORT_OASIS ) == 0 )
+ sURLRequest += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?oasis=false" ) );
+ mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
+ }
+ }
+ }
+ if( !bIsEmptyPresObj )
+ {
+ OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ sURL += sPersistName;
+ if( !bExportEmbedded )
+ {
+ sURL = GetExport().AddEmbeddedObject( sURL );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
+ XML_IMAGE, sal_False, sal_True );
+
+ if( bExportEmbedded )
+ GetExport().AddEmbeddedObjectAsBase64( sURL );
+ }
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportDescription( xShape ); // #i68101#
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportPageShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // #86163# Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // export page number used for this page
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
+ {
+ sal_Int32 nPageNumber = 0;
+ xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
+ if( nPageNumber )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::valueOf(nPageNumber));
+ }
+
+ // a presentation page shape, normally used on notes pages only. If
+ // it is used not as presentation shape, it may have been created with
+ // copy-paste exchange between draw and impress (this IS possible...)
+ if(eShapeType == XmlShapeTypePresPageShape)
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS,
+ XML_PRESENTATION_PAGE);
+ }
+
+ // write Page shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, bCreateNewline, sal_True);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportCaptionShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0L);
+ xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
+
+ awt::Point aCaptionPoint;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ) ) ) >>= aCaptionPoint;
+
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.X);
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
+
+ // write Caption shape. Add export later.
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ sal_Bool bAnnotation( (nFeatures & SEF_EXPORT_ANNOTATION) == SEF_EXPORT_ANNOTATION );
+
+ SvXMLElementExport aObj( mrExport,
+ (bAnnotation ? XML_NAMESPACE_OFFICE
+ : XML_NAMESPACE_DRAW),
+ (bAnnotation ? XML_ANNOTATION : XML_CAPTION),
+ bCreateNewline, sal_True );
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ if( bAnnotation )
+ mrExport.exportAnnotationMeta( xShape );
+ ImpExportText( xShape );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportFrameShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export frame url
+ OUString aStr;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ) ) >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export name
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ) ) >>= aStr;
+ if( aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
+
+ // write floating frame
+ {
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, sal_True, sal_True);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportAppletShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export frame url
+ OUString aStr;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ) ) >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export draw:applet-name
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ) ) >>= aStr;
+ if( aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
+
+ // export draw:code
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ) ) >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
+
+ // export draw:may-script
+ sal_Bool bIsScript = false;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ) ) >>= bIsScript;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
+
+ {
+ // write applet
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, sal_True, sal_True);
+
+ // export parameters
+ uno::Sequence< beans::PropertyValue > aCommands;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ) ) >>= aCommands;
+ const sal_Int32 nCount = aCommands.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aCommands[nIndex].Value >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportPluginShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export plugin url
+ OUString aStr;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ) ) >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+
+ // export mime-type
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ) ) >>= aStr;
+ if(aStr.getLength())
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
+
+ {
+ // write plugin
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, sal_True, sal_True);
+
+ // export parameters
+ uno::Sequence< beans::PropertyValue > aCommands;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ) ) >>= aCommands;
+ const sal_Int32 nCount = aCommands.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aCommands[nIndex].Value >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExportMediaShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ if(eShapeType == XmlShapeTypePresMediaShape)
+ ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
+
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, sal_True );
+
+ // export media url
+ OUString aMediaURL;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ) ) >>= aMediaURL;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( aMediaURL ) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export mime-type
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.media" ) ) );
+
+ // write plugin
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), sal_True);
+
+ // export parameters
+ const OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM( "false" ) ), aTrueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+
+ sal_Bool bLoop = false;
+ const OUString aLoopStr( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) );
+ xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+
+ sal_Bool bMute = false;
+ const OUString aMuteStr( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) );
+ xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+
+ sal_Int16 nVolumeDB = 0;
+ const OUString aVolumeDBStr( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) );
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ) ) >>= nVolumeDB;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::valueOf( static_cast< sal_Int32 >( nVolumeDB ) ) );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+
+ media::ZoomLevel eZoom;
+ const OUString aZoomStr( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) );
+ OUString aZoomValue;
+ xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ) ) >>= eZoom;
+ switch( eZoom )
+ {
+ case( media::ZoomLevel_ZOOM_1_TO_4 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "25%" ) ); break;
+ case( media::ZoomLevel_ZOOM_1_TO_2 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "50%" ) ); break;
+ case( media::ZoomLevel_ORIGINAL ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "100%" ) ); break;
+ case( media::ZoomLevel_ZOOM_2_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "200%" ) ); break;
+ case( media::ZoomLevel_ZOOM_4_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "400%" ) ); break;
+ case( media::ZoomLevel_FIT_TO_WINDOW ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fit" ) ); break;
+ case( media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fixedfit" ) ); break;
+ case( media::ZoomLevel_FULLSCREEN ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fullscreen" ) ); break;
+
+ default:
+ break;
+ }
+
+ if( aZoomValue.getLength() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
+ }
+ }
+}
diff --git a/xmloff/source/draw/shapeexport3.cxx b/xmloff/source/draw/shapeexport3.cxx
new file mode 100644
index 000000000000..559f94f6d51f
--- /dev/null
+++ b/xmloff/source/draw/shapeexport3.cxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <tools/gen.hxx>
+
+#ifndef _XMLOFF_SHAPEEXPORT_HXX
+#include <xmloff/shapeexport.hxx>
+#endif
+#include "sdpropls.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+
+#include "xmlnmspe.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+{
+ uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
+ DBG_ASSERT( xPropSet.is(), "XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
+ if( xPropSet.is() )
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // 3d attributes
+ export3DSceneAttributes( xPropSet );
+
+ // write 3DScene shape
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DR3D, XML_SCENE, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+
+ // write 3DSceneLights
+ export3DLamps( xPropSet );
+
+ // #89764# if export of position is supressed for group shape,
+ // positions of contained objects should be written relative to
+ // the upper left edge of the group.
+ awt::Point aUpperLeft;
+
+ if(!(nFeatures & SEF_EXPORT_POSITION))
+ {
+ nFeatures |= SEF_EXPORT_POSITION;
+ aUpperLeft = xShape->getPosition();
+ pRefPoint = &aUpperLeft;
+ }
+
+ // write members
+ exportShapes( xShapes, nFeatures, pRefPoint );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeExport::ImpExport3DShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType eShapeType, sal_Int32 /* nFeatures = SEF_DEFAULT */, awt::Point* /*pRefPoint = NULL */)
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
+ uno::Any aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")));
+ drawing::HomogenMatrix xHomMat;
+ aAny >>= xHomMat;
+ SdXMLImExTransform3D aTransform;
+ aTransform.AddHomogenMatrix(xHomMat);
+ if(aTransform.NeedsAction())
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+
+ switch(eShapeType)
+ {
+ case XmlShapeTypeDraw3DCubeObject:
+ {
+ // write 3DCube shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True);
+
+ // minEdge
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
+ drawing::Position3D aPosition3D;
+ aAny >>= aPosition3D;
+ ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
+
+ // maxEdge
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")));
+ drawing::Direction3D aDirection3D;
+ aAny >>= aDirection3D;
+ ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
+
+ // transform maxEdge from distance to pos
+ aDir3D = aPos3D + aDir3D;
+
+ // write minEdge
+ if(aPos3D != ::basegfx::B3DVector(-2500.0, -2500.0, -2500.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MIN_EDGE, aStr);
+ }
+
+ // write maxEdge
+ if(aDir3D != ::basegfx::B3DVector(2500.0, 2500.0, 2500.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MAX_EDGE, aStr);
+ }
+
+ break;
+ }
+ case XmlShapeTypeDraw3DSphereObject:
+ {
+ // write 3DSphere shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True);
+
+ // Center
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
+ drawing::Position3D aPosition3D;
+ aAny >>= aPosition3D;
+ ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
+
+ // Size
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")));
+ drawing::Direction3D aDirection3D;
+ aAny >>= aDirection3D;
+ ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
+
+ // write Center
+ if(aPos3D != ::basegfx::B3DVector(0.0, 0.0, 0.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_CENTER, aStr);
+ }
+
+ // write Size
+ if(aDir3D != ::basegfx::B3DVector(5000.0, 5000.0, 5000.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SIZE, aStr);
+ }
+
+ break;
+ }
+ case XmlShapeTypeDraw3DLatheObject:
+ case XmlShapeTypeDraw3DExtrudeObject:
+ {
+ // write special 3DLathe/3DExtrude attributes
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
+ drawing::PolyPolygonShape3D xPolyPolygon3D;
+ aAny >>= xPolyPolygon3D;
+
+ // look for maximal values
+ double fXMin = 0;
+ double fXMax = 0;
+ double fYMin = 0;
+ double fYMax = 0;
+ BOOL bInit(FALSE);
+ sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
+ drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
+ drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
+
+ sal_Int32 a;
+ for( a= 0L; a < nOuterSequenceCount; a++)
+ {
+ sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
+ double* pArrayX = pInnerSequenceX->getArray();
+ double* pArrayY = pInnerSequenceY->getArray();
+
+ for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+ {
+ double fX = *pArrayX++;
+ double fY = *pArrayY++;
+
+ if(bInit)
+ {
+ if(fX > fXMax)
+ fXMax = fX;
+
+ if(fX < fXMin)
+ fXMin = fX;
+
+ if(fY > fYMax)
+ fYMax = fY;
+
+ if(fY < fYMin)
+ fYMin = fY;
+ }
+ else
+ {
+ fXMin = fXMax = fX;
+ fYMin = fYMax = fY;
+ bInit = TRUE;
+ }
+ }
+
+ pInnerSequenceX++;
+ pInnerSequenceY++;
+ }
+
+ // export ViewBox
+ awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
+ awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
+ SdXMLImExViewBox aViewBox(
+ aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
+ aViewBox.GetExportString());
+
+ // prepare svx:d element export
+ SdXMLImExSvgDElement aSvgDElement(aViewBox);
+ pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
+ pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
+
+ for(a = 0L; a < nOuterSequenceCount; a++)
+ {
+ sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
+ double* pArrayX = pInnerSequenceX->getArray();
+ double* pArrayY = pInnerSequenceY->getArray();
+ drawing::PointSequence aPoly(nInnerSequenceCount);
+ awt::Point* pInnerSequence = aPoly.getArray();
+
+ for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+ {
+ double fX = *pArrayX++;
+ double fY = *pArrayY++;
+
+ *pInnerSequence = awt::Point(FRound(fX), FRound(fY));
+ pInnerSequence++;
+ }
+
+ // calculate closed flag
+ awt::Point* pFirst = aPoly.getArray();
+ awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
+ BOOL bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
+
+ aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint,
+ aMaxSize, bClosed);
+
+ // #80594# corrected error in PolyPolygon3D export for 3D XML
+ pInnerSequenceX++;
+ pInnerSequenceY++;
+ }
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+
+ if(eShapeType == XmlShapeTypeDraw3DLatheObject)
+ {
+ // write 3DLathe shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_ROTATE, sal_True, sal_True);
+ }
+ else
+ {
+ // write 3DExtrude shape
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_EXTRUDE, sal_True, sal_True);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** helper for chart that adds all attributes of a 3d scene element to the export */
+void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
+{
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ // world transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
+ uno::Any aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")));
+ drawing::HomogenMatrix xHomMat;
+ aAny >>= xHomMat;
+ SdXMLImExTransform3D aTransform;
+ aTransform.AddHomogenMatrix(xHomMat);
+ if(aTransform.NeedsAction())
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+
+ // VRP, VPN, VUP
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")));
+ drawing::CameraGeometry aCamGeo;
+ aAny >>= aCamGeo;
+
+ ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
+ if(aVRP != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVRP);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VRP, aStr);
+ }
+
+ ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
+ if(aVPN != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVPN);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VPN, aStr);
+ }
+
+ ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
+ if(aVUP != ::basegfx::B3DVector(0.0, 1.0, 0.0)) // write only when not default
+ {
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVUP);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VUP, aStr);
+ }
+
+ // projection "D3DScenePerspective" drawing::ProjectionMode
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")));
+ drawing::ProjectionMode xPrjMode;
+ aAny >>= xPrjMode;
+ if(xPrjMode == drawing::ProjectionMode_PARALLEL)
+ aStr = GetXMLToken(XML_PARALLEL);
+ else
+ aStr = GetXMLToken(XML_PERSPECTIVE);
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_PROJECTION, aStr);
+
+ // distance
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")));
+ sal_Int32 nDistance = 0;
+ aAny >>= nDistance;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDistance);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DISTANCE, aStr);
+
+ // focalLength
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")));
+ sal_Int32 nFocalLength = 0;
+ aAny >>= nFocalLength;
+ mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nFocalLength);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, aStr);
+
+ // shadowSlant
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")));
+ sal_Int16 nShadowSlant = 0;
+ aAny >>= nShadowSlant;
+ mrExport.GetMM100UnitConverter().convertNumber(sStringBuffer, (sal_Int32)nShadowSlant);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, aStr);
+
+ // shadeMode
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")));
+ drawing::ShadeMode xShadeMode;
+ if(aAny >>= xShadeMode)
+ {
+ if(xShadeMode == drawing::ShadeMode_FLAT)
+ aStr = GetXMLToken(XML_FLAT);
+ else if(xShadeMode == drawing::ShadeMode_PHONG)
+ aStr = GetXMLToken(XML_PHONG);
+ else if(xShadeMode == drawing::ShadeMode_SMOOTH)
+ aStr = GetXMLToken(XML_GOURAUD);
+ else
+ aStr = GetXMLToken(XML_DRAFT);
+ }
+ else
+ {
+ // ShadeMode enum not there, write default
+ aStr = GetXMLToken(XML_GOURAUD);
+ }
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr);
+
+ // ambientColor
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")));
+ sal_Int32 aColTemp = 0;
+ Color aAmbientColor;
+ aAny >>= aColTemp; aAmbientColor.SetColor(aColTemp);
+ mrExport.GetMM100UnitConverter().convertColor(sStringBuffer, aAmbientColor);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, aStr);
+
+ // lightingMode
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")));
+ sal_Bool bTwoSidedLighting = false;
+ aAny >>= bTwoSidedLighting;
+ mrExport.GetMM100UnitConverter().convertBool(sStringBuffer, bTwoSidedLighting);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, aStr);
+}
+
+/** helper for chart that exports all lamps from the propertyset */
+void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
+{
+ // write lamps 1..8 as content
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+
+ const OUString aColorPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor") );
+ const OUString aDirectionPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection") );
+ const OUString aLightOnPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn") );
+
+ OUString aPropName;
+ OUString aIndexStr;
+ sal_Int32 aColTemp = 0;
+ Color aLightColor;
+ ::basegfx::B3DVector aLightDirection;
+ drawing::Direction3D xLightDir;
+ sal_Bool bLightOnOff = false;
+ for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
+ {
+ aIndexStr = OUString::valueOf( nLamp );
+
+ // lightcolor
+ aPropName = aColorPropName;
+ aPropName += aIndexStr;
+ xPropSet->getPropertyValue( aPropName ) >>= aColTemp;
+ aLightColor.SetColor(aColTemp);
+ mrExport.GetMM100UnitConverter().convertColor(sStringBuffer, aLightColor);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr);
+
+ // lightdirection
+ aPropName = aDirectionPropName;
+ aPropName += aIndexStr;
+ xPropSet->getPropertyValue(aPropName) >>= xLightDir;
+ aLightDirection = ::basegfx::B3DVector(xLightDir.DirectionX, xLightDir.DirectionY, xLightDir.DirectionZ);
+ mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aLightDirection);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIRECTION, aStr);
+
+ // lighton
+ aPropName = aLightOnPropName;
+ aPropName += aIndexStr;
+ xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
+ mrExport.GetMM100UnitConverter().convertBool(sStringBuffer, bLightOnOff);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_ENABLED, aStr);
+
+ // specular
+ mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SPECULAR,
+ nLamp == 1 ? XML_TRUE : XML_FALSE);
+
+ // write light entry
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_LIGHT, sal_True, sal_True);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
new file mode 100644
index 000000000000..3f52fcd50084
--- /dev/null
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -0,0 +1,1236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/XSeekableInputStream.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+
+#include <com/sun/star/table/XColumnRowRange.hpp>
+
+#ifndef _XMLOFF_SHAPEEXPORT_HXX
+#include <xmloff/shapeexport.hxx>
+#endif
+#include "sdpropls.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "EnhancedCustomShapeToken.hxx"
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARI_HPP_
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#endif
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <rtl/math.hxx>
+#include <tools/string.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+
+#include "xmlnmspe.hxx"
+#include "XMLBase64Export.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::io;
+using namespace ::xmloff::token;
+using namespace ::xmloff::EnhancedCustomShapeToken;
+
+using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+//////////////////////////////////////////////////////////////////////////////
+
+void ExportParameter( rtl::OUStringBuffer& rStrBuffer, const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter )
+{
+ if ( rStrBuffer.getLength() )
+ rStrBuffer.append( (sal_Unicode)' ' );
+ if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fNumber = 0.0;
+ rParameter.Value >>= fNumber;
+ ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ rParameter.Value >>= nValue;
+
+ switch( rParameter.Type )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
+ {
+ rStrBuffer.append( (sal_Unicode)'?' );
+ rStrBuffer.append( (sal_Unicode)'f' );
+ rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
+ }
+ break;
+
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
+ {
+ rStrBuffer.append( (sal_Unicode)'$' );
+ rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
+ }
+ break;
+
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM :
+ rStrBuffer.append( GetXMLToken( XML_BOTTOM ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT :
+ rStrBuffer.append( GetXMLToken( XML_RIGHT ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP :
+ rStrBuffer.append( GetXMLToken( XML_TOP ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT :
+ rStrBuffer.append( GetXMLToken( XML_LEFT ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
+ rStrBuffer.append( GetXMLToken( XML_XSTRETCH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
+ rStrBuffer.append( GetXMLToken( XML_YSTRETCH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
+ rStrBuffer.append( GetXMLToken( XML_HASSTROKE ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL :
+ rStrBuffer.append( GetXMLToken( XML_HASFILL ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH :
+ rStrBuffer.append( GetXMLToken( XML_WIDTH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT :
+ rStrBuffer.append( GetXMLToken( XML_HEIGHT ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
+ rStrBuffer.append( GetXMLToken( XML_LOGWIDTH ) ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
+ rStrBuffer.append( GetXMLToken( XML_LOGHEIGHT ) ); break;
+ default :
+ rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
+ }
+ }
+}
+
+void ImpExportEquations( SvXMLExport& rExport, const uno::Sequence< rtl::OUString >& rEquations )
+{
+ sal_Int32 i;
+ for ( i = 0; i < rEquations.getLength(); i++ )
+ {
+ rtl::OUString aStr( String( 'f' ) );
+ aStr += rtl::OUString::valueOf( i );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aStr );
+
+ aStr = rEquations[ i ];
+ sal_Int32 nIndex = 0;
+ do
+ {
+ nIndex = aStr.indexOf( (sal_Unicode)'?', nIndex );
+ if ( nIndex != -1 )
+ {
+ rtl::OUString aNew( aStr.copy( 0, nIndex + 1 ) );
+ aNew += String( 'f' );
+ aNew += aStr.copy( nIndex + 1, ( aStr.getLength() - nIndex ) - 1 );
+ aStr = aNew;
+ nIndex++;
+ }
+ } while( nIndex != -1 );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FORMULA, aStr );
+ SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_EQUATION, sal_True, sal_True );
+ }
+}
+
+void ImpExportHandles( SvXMLExport& rExport, const uno::Sequence< beans::PropertyValues >& rHandles )
+{
+ sal_uInt32 i, j, nElements = rHandles.getLength();
+ if ( nElements )
+ {
+ rtl::OUString aStr;
+ rtl::OUStringBuffer aStrBuffer;
+
+ for ( i = 0; i < nElements; i++ )
+ {
+ sal_Bool bPosition = sal_False;
+ const uno::Sequence< beans::PropertyValue >& rPropSeq = rHandles[ i ];
+ for ( j = 0; j < (sal_uInt32)rPropSeq.getLength(); j++ )
+ {
+ const beans::PropertyValue& rPropVal = rPropSeq[ j ];
+ switch( EASGet( rPropVal.Name ) )
+ {
+ case EAS_Position :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ if ( rPropVal.Value >>= aPosition )
+ {
+ ExportParameter( aStrBuffer, aPosition.First );
+ ExportParameter( aStrBuffer, aPosition.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POSITION, aStr );
+ bPosition = sal_True;
+ }
+ }
+ break;
+ case EAS_MirroredX :
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredX )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_HORIZONTAL,
+ bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_MirroredY :
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredY )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_VERTICAL,
+ bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_Switched :
+ {
+ sal_Bool bSwitched = sal_Bool();
+ if ( rPropVal.Value >>= bSwitched )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_SWITCHED,
+ bSwitched ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_Polar :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
+ if ( rPropVal.Value >>= aPolar )
+ {
+ ExportParameter( aStrBuffer, aPolar.First );
+ ExportParameter( aStrBuffer, aPolar.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POLAR, aStr );
+ }
+ }
+ break;
+ case EAS_RadiusRangeMinimum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ if ( rPropVal.Value >>= aRadiusRangeMinimum )
+ {
+ ExportParameter( aStrBuffer, aRadiusRangeMinimum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MINIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RadiusRangeMaximum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ if ( rPropVal.Value >>= aRadiusRangeMaximum )
+ {
+ ExportParameter( aStrBuffer, aRadiusRangeMaximum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MAXIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeXMinimum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
+ if ( rPropVal.Value >>= aXRangeMinimum )
+ {
+ ExportParameter( aStrBuffer, aXRangeMinimum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MINIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeXMaximum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
+ if ( rPropVal.Value >>= aXRangeMaximum )
+ {
+ ExportParameter( aStrBuffer, aXRangeMaximum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MAXIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeYMinimum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
+ if ( rPropVal.Value >>= aYRangeMinimum )
+ {
+ ExportParameter( aStrBuffer, aYRangeMinimum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MINIMUM, aStr );
+ }
+ }
+ break;
+ case EAS_RangeYMaximum :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+ if ( rPropVal.Value >>= aYRangeMaximum )
+ {
+ ExportParameter( aStrBuffer, aYRangeMaximum );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MAXIMUM, aStr );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if ( bPosition )
+ SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_HANDLE, sal_True, sal_True );
+ else
+ rExport.ClearAttrList();
+ }
+ }
+}
+
+void ImpExportEnhancedPath( SvXMLExport& rExport,
+ const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
+ const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments )
+{
+
+ rtl::OUString aStr;
+ rtl::OUStringBuffer aStrBuffer;
+
+ sal_Int32 i, j, k, l;
+
+ sal_Int32 nCoords = rCoordinates.getLength();
+ sal_Int32 nSegments = rSegments.getLength();
+ sal_Bool bSimpleSegments = nSegments == 0;
+ if ( bSimpleSegments )
+ nSegments = 4;
+ for ( j = i = 0; j < nSegments; j++ )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
+ if ( bSimpleSegments )
+ {
+ // if there are not enough segments we will default them
+ switch( j )
+ {
+ case 0 :
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+ }
+ break;
+ case 1 :
+ {
+ aSegment.Count = (sal_Int16)Min( nCoords - 1, (sal_Int32)32767 );
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+ }
+ break;
+ case 2 :
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
+ }
+ break;
+ case 3 :
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+ }
+ break;
+ }
+ }
+ else
+ aSegment = rSegments[ j ];
+
+ if ( aStrBuffer.getLength() )
+ aStrBuffer.append( (sal_Unicode)' ' );
+
+ sal_Int32 nParameter = 0;
+ switch( aSegment.Command )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
+ aStrBuffer.append( (sal_Unicode)'Z' ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
+ aStrBuffer.append( (sal_Unicode)'N' ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
+ aStrBuffer.append( (sal_Unicode)'F' ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
+ aStrBuffer.append( (sal_Unicode)'S' ); break;
+
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
+ aStrBuffer.append( (sal_Unicode)'M' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
+ aStrBuffer.append( (sal_Unicode)'L' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
+ aStrBuffer.append( (sal_Unicode)'C' ); nParameter = 3; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
+ aStrBuffer.append( (sal_Unicode)'T' ); nParameter = 3; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
+ aStrBuffer.append( (sal_Unicode)'U' ); nParameter = 3; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
+ aStrBuffer.append( (sal_Unicode)'A' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC :
+ aStrBuffer.append( (sal_Unicode)'B' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
+ aStrBuffer.append( (sal_Unicode)'W' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
+ aStrBuffer.append( (sal_Unicode)'V' ); nParameter = 4; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
+ aStrBuffer.append( (sal_Unicode)'X' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
+ aStrBuffer.append( (sal_Unicode)'Y' ); nParameter = 1; break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
+ aStrBuffer.append( (sal_Unicode)'Q' ); nParameter = 2; break;
+
+ default : // ups, seems to be something wrong
+ {
+ aSegment.Count = 1;
+ aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+ }
+ break;
+ }
+ if ( nParameter )
+ {
+ for ( k = 0; k < aSegment.Count; k++ )
+ {
+ if ( ( i + nParameter ) <= nCoords )
+ {
+ for ( l = 0; l < nParameter; l++ )
+ {
+ ExportParameter( aStrBuffer, rCoordinates[ i ].First );
+ ExportParameter( aStrBuffer, rCoordinates[ i++ ].Second );
+ }
+ }
+ else
+ {
+ j = nSegments; // error -> exiting
+ break;
+ }
+ }
+ }
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENHANCED_PATH, aStr );
+}
+
+void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xPropSet )
+{
+ sal_Bool bEquations = sal_False;
+ uno::Sequence< rtl::OUString > aEquations;
+
+ sal_Bool bHandles = sal_False;
+ uno::Sequence< beans::PropertyValues > aHandles;
+
+ sal_Bool bCoordinates = sal_False;
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments;
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
+
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
+
+ rtl::OUString aStr;
+ rtl::OUStringBuffer aStrBuffer;
+ SvXMLUnitConverter& rUnitConverter = rExport.GetMM100UnitConverter();
+
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // geometry
+ const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
+ if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
+ {
+ uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
+ uno::Sequence< beans::PropertyValue > aGeoPropSeq;
+
+ if ( aGeoPropSet >>= aGeoPropSeq )
+ {
+ const rtl::OUString sCustomShapeType( RTL_CONSTASCII_USTRINGPARAM( "NonPrimitive" ) );
+ rtl::OUString aCustomShapeType( sCustomShapeType );
+
+ sal_Int32 j, nGeoPropCount = aGeoPropSeq.getLength();
+ for ( j = 0; j < nGeoPropCount; j++ )
+ {
+ const beans::PropertyValue& rGeoProp = aGeoPropSeq[ j ];
+ switch( EASGet( rGeoProp.Name ) )
+ {
+ case EAS_Type :
+ {
+ rGeoProp.Value >>= aCustomShapeType;
+ }
+ break;
+ case EAS_MirroredX :
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( rGeoProp.Value >>= bMirroredX )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_HORIZONTAL,
+ bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_MirroredY :
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( rGeoProp.Value >>= bMirroredY )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_VERTICAL,
+ bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_ViewBox :
+ {
+ awt::Rectangle aRect;
+ if ( rGeoProp.Value >>= aRect )
+ {
+ SdXMLImExViewBox aViewBox( aRect.X, aRect.Y, aRect.Width, aRect.Height );
+ rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() );
+ }
+ }
+ break;
+ case EAS_TextRotateAngle :
+ {
+ double fTextRotateAngle = 0;
+ if ( rGeoProp.Value >>= fTextRotateAngle )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fTextRotateAngle );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr );
+ }
+ }
+ break;
+ case EAS_Extrusion :
+ {
+ uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
+ if ( rGeoProp.Value >>= aExtrusionPropSeq )
+ {
+ sal_Int32 i, nCount = aExtrusionPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aExtrusionPropSeq[ i ];
+ switch( EASGet( rProp.Name ) )
+ {
+ case EAS_Extrusion :
+ {
+ sal_Bool bExtrusionOn = sal_Bool();
+ if ( rProp.Value >>= bExtrusionOn )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION,
+ bExtrusionOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_Brightness :
+ {
+ double fExtrusionBrightness = 0;
+ if ( rProp.Value >>= fExtrusionBrightness )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionBrightness, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_BRIGHTNESS, aStr );
+ }
+ }
+ break;
+ case EAS_Depth :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
+ if ( rProp.Value >>= aDepthParaPair )
+ {
+ double fDepth = 0;
+ if ( aDepthParaPair.First.Value >>= fDepth )
+ {
+ rExport.GetMM100UnitConverter().convertDouble( aStrBuffer, fDepth, sal_True );
+ ExportParameter( aStrBuffer, aDepthParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DEPTH, aStr );
+ }
+ }
+ }
+ break;
+ case EAS_Diffusion :
+ {
+ double fExtrusionDiffusion = 0;
+ if ( rProp.Value >>= fExtrusionDiffusion )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionDiffusion, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DIFFUSION, aStr );
+ }
+ }
+ break;
+ case EAS_NumberOfLineSegments :
+ {
+ sal_Int32 nExtrusionNumberOfLineSegments = 0;
+ if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS, rtl::OUString::valueOf( nExtrusionNumberOfLineSegments ) );
+ }
+ break;
+ case EAS_LightFace :
+ {
+ sal_Bool bExtrusionLightFace = sal_Bool();
+ if ( rProp.Value >>= bExtrusionLightFace )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_LIGHT_FACE,
+ bExtrusionLightFace ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_FirstLightHarsh :
+ {
+ sal_Bool bExtrusionFirstLightHarsh = sal_Bool();
+ if ( rProp.Value >>= bExtrusionFirstLightHarsh )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_HARSH,
+ bExtrusionFirstLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_SecondLightHarsh :
+ {
+ sal_Bool bExtrusionSecondLightHarsh = sal_Bool();
+ if ( rProp.Value >>= bExtrusionSecondLightHarsh )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_HARSH,
+ bExtrusionSecondLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_FirstLightLevel :
+ {
+ double fExtrusionFirstLightLevel = 0;
+ if ( rProp.Value >>= fExtrusionFirstLightLevel )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionFirstLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_LEVEL, aStr );
+ }
+ }
+ break;
+ case EAS_SecondLightLevel :
+ {
+ double fExtrusionSecondLightLevel = 0;
+ if ( rProp.Value >>= fExtrusionSecondLightLevel )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionSecondLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_LEVEL, aStr );
+ }
+ }
+ break;
+ case EAS_FirstLightDirection :
+ {
+ drawing::Direction3D aExtrusionFirstLightDirection;
+ if ( rProp.Value >>= aExtrusionFirstLightDirection )
+ {
+ ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
+ aExtrusionFirstLightDirection.DirectionZ );
+ rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_DIRECTION, aStr );
+ }
+ }
+ break;
+ case EAS_SecondLightDirection :
+ {
+ drawing::Direction3D aExtrusionSecondLightDirection;
+ if ( rProp.Value >>= aExtrusionSecondLightDirection )
+ {
+ ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
+ aExtrusionSecondLightDirection.DirectionZ );
+ rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_DIRECTION, aStr );
+ }
+ }
+ break;
+ case EAS_Metal :
+ {
+ sal_Bool bExtrusionMetal = sal_Bool();
+ if ( rProp.Value >>= bExtrusionMetal )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_METAL,
+ bExtrusionMetal ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_ShadeMode :
+ {
+ // shadeMode
+ drawing::ShadeMode eShadeMode;
+ if( rProp.Value >>= eShadeMode )
+ {
+ if( eShadeMode == drawing::ShadeMode_FLAT )
+ aStr = GetXMLToken( XML_FLAT );
+ else if( eShadeMode == drawing::ShadeMode_PHONG )
+ aStr = GetXMLToken( XML_PHONG );
+ else if( eShadeMode == drawing::ShadeMode_SMOOTH )
+ aStr = GetXMLToken( XML_GOURAUD );
+ else
+ aStr = GetXMLToken( XML_DRAFT );
+ }
+ else
+ {
+ // ShadeMode enum not there, write default
+ aStr = GetXMLToken( XML_FLAT);
+ }
+ rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr );
+ }
+ break;
+ case EAS_RotateAngle :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
+ if ( rProp.Value >>= aRotateAngleParaPair )
+ {
+ ExportParameter( aStrBuffer, aRotateAngleParaPair.First );
+ ExportParameter( aStrBuffer, aRotateAngleParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_ANGLE, aStr );
+ }
+ }
+ break;
+ case EAS_RotationCenter :
+ {
+ drawing::Direction3D aExtrusionRotationCenter;
+ if ( rProp.Value >>= aExtrusionRotationCenter )
+ {
+ ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
+ aExtrusionRotationCenter.DirectionZ );
+ rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_CENTER, aStr );
+ }
+ }
+ break;
+ case EAS_Shininess :
+ {
+ double fExtrusionShininess = 0;
+ if ( rProp.Value >>= fExtrusionShininess )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionShininess, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SHININESS, aStr );
+ }
+ }
+ break;
+ case EAS_Skew :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
+ if ( rProp.Value >>= aSkewParaPair )
+ {
+ ExportParameter( aStrBuffer, aSkewParaPair.First );
+ ExportParameter( aStrBuffer, aSkewParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SKEW, aStr );
+ }
+ }
+ break;
+ case EAS_Specularity :
+ {
+ double fExtrusionSpecularity = 0;
+ if ( rProp.Value >>= fExtrusionSpecularity )
+ {
+ rUnitConverter.convertDouble( aStrBuffer, fExtrusionSpecularity, sal_False, MAP_RELATIVE, MAP_RELATIVE );
+ aStrBuffer.append( (sal_Unicode)'%' );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SPECULARITY, aStr );
+ }
+ }
+ break;
+ case EAS_ProjectionMode :
+ {
+ drawing::ProjectionMode eProjectionMode;
+ if ( rProp.Value >>= eProjectionMode )
+ rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_PROJECTION,
+ eProjectionMode == drawing::ProjectionMode_PARALLEL ? GetXMLToken( XML_PARALLEL ) : GetXMLToken( XML_PERSPECTIVE ) );
+ }
+ break;
+ case EAS_ViewPoint :
+ {
+ drawing::Position3D aExtrusionViewPoint;
+ if ( rProp.Value >>= aExtrusionViewPoint )
+ {
+ rUnitConverter.convertPosition3D( aStrBuffer, aExtrusionViewPoint );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_VIEWPOINT, aStr );
+ }
+ }
+ break;
+ case EAS_Origin :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
+ if ( rProp.Value >>= aOriginParaPair )
+ {
+ ExportParameter( aStrBuffer, aOriginParaPair.First );
+ ExportParameter( aStrBuffer, aOriginParaPair.Second );
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ORIGIN, aStr );
+ }
+ }
+ break;
+ case EAS_Color :
+ {
+ sal_Bool bExtrusionColor = sal_Bool();
+ if ( rProp.Value >>= bExtrusionColor )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_COLOR,
+ bExtrusionColor ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case EAS_TextPath :
+ {
+ uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
+ if ( rGeoProp.Value >>= aTextPathPropSeq )
+ {
+ sal_Int32 i, nCount = aTextPathPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aTextPathPropSeq[ i ];
+ switch( EASGet( rProp.Name ) )
+ {
+ case EAS_TextPath :
+ {
+ sal_Bool bTextPathOn = sal_Bool();
+ if ( rProp.Value >>= bTextPathOn )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH,
+ bTextPathOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_TextPathMode :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
+ if ( rProp.Value >>= eTextPathMode )
+ {
+ switch ( eTextPathMode )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL: aStr = GetXMLToken( XML_NORMAL ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr = GetXMLToken( XML_PATH ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr = GetXMLToken( XML_SHAPE ); break;
+ default:
+ break;
+ }
+ if ( aStr.getLength() )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_MODE, aStr );
+ }
+ }
+ break;
+ case EAS_ScaleX :
+ {
+ sal_Bool bScaleX = sal_Bool();
+ if ( rProp.Value >>= bScaleX )
+ {
+ aStr = bScaleX ? GetXMLToken( XML_SHAPE ) : GetXMLToken( XML_PATH );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SCALE, aStr );
+ }
+ }
+ break;
+ case EAS_SameLetterHeights :
+ {
+ sal_Bool bSameLetterHeights = sal_Bool();
+ if ( rProp.Value >>= bSameLetterHeights )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SAME_LETTER_HEIGHTS,
+ bSameLetterHeights ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case EAS_Path :
+ {
+ uno::Sequence< beans::PropertyValue > aPathPropSeq;
+ if ( rGeoProp.Value >>= aPathPropSeq )
+ {
+ sal_Int32 i, nCount = aPathPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = aPathPropSeq[ i ];
+ switch( EASGet( rProp.Name ) )
+ {
+ case EAS_ExtrusionAllowed :
+ {
+ sal_Bool bExtrusionAllowed = sal_Bool();
+ if ( rProp.Value >>= bExtrusionAllowed )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ALLOWED,
+ bExtrusionAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_ConcentricGradientFillAllowed :
+ {
+ sal_Bool bConcentricGradientFillAllowed = sal_Bool();
+ if ( rProp.Value >>= bConcentricGradientFillAllowed )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONCENTRIC_GRADIENT_FILL_ALLOWED,
+ bConcentricGradientFillAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_TextPathAllowed :
+ {
+ sal_Bool bTextPathAllowed = sal_Bool();
+ if ( rProp.Value >>= bTextPathAllowed )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_ALLOWED,
+ bTextPathAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
+ }
+ break;
+ case EAS_GluePoints :
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
+ if ( rProp.Value >>= aGluePoints )
+ {
+ sal_Int32 k, nElements = aGluePoints.getLength();
+ if ( nElements )
+ {
+ for( k = 0; k < nElements; k++ )
+ {
+ ExportParameter( aStrBuffer, aGluePoints[ k ].First );
+ ExportParameter( aStrBuffer, aGluePoints[ k ].Second );
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ }
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINTS, aStr );
+ }
+ }
+ break;
+ case EAS_GluePointType :
+ {
+ sal_Int16 nGluePointType = sal_Int16();
+ if ( rProp.Value >>= nGluePointType )
+ {
+ switch ( nGluePointType )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeGluePointType::NONE : aStr = GetXMLToken( XML_NONE ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS : aStr = GetXMLToken( XML_SEGMENTS ); break;
+ case com::sun::star::drawing::EnhancedCustomShapeGluePointType::RECT : aStr = GetXMLToken( XML_RECTANGLE ); break;
+ }
+ if ( aStr.getLength() )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINT_TYPE, aStr );
+ }
+ }
+ break;
+ case EAS_Coordinates :
+ {
+ bCoordinates = ( rProp.Value >>= aCoordinates );
+ }
+ break;
+ case EAS_Segments :
+ {
+ rProp.Value >>= aSegments;
+ }
+ break;
+ case EAS_StretchX :
+ {
+ sal_Int32 nStretchPoint = 0;
+ if ( rProp.Value >>= nStretchPoint )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_X, rtl::OUString::valueOf( nStretchPoint ) );
+ }
+ break;
+ case EAS_StretchY :
+ {
+ sal_Int32 nStretchPoint = 0;
+ if ( rProp.Value >>= nStretchPoint )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_Y, rtl::OUString::valueOf( nStretchPoint ) );
+ }
+ break;
+ case EAS_TextFrames :
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
+ if ( rProp.Value >>= aPathTextFrames )
+ {
+ if ( (sal_uInt16)aPathTextFrames.getLength() )
+ {
+ sal_uInt16 k, nElements = (sal_uInt16)aPathTextFrames.getLength();
+ for ( k = 0; k < nElements; k++ )
+ {
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.First );
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.Second );
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.First );
+ ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.Second );
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ }
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_AREAS, aStr );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case EAS_Equations :
+ {
+ bEquations = ( rGeoProp.Value >>= aEquations );
+ }
+ break;
+ case EAS_Handles :
+ {
+ bHandles = ( rGeoProp.Value >>= aHandles );
+ }
+ break;
+ case EAS_AdjustmentValues :
+ {
+ rGeoProp.Value >>= aAdjustmentValues;
+ }
+ break;
+ default:
+ break;
+ }
+ } // for
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TYPE, aCustomShapeType );
+
+ // adjustments
+ sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength();
+ if ( nAdjustmentValues )
+ {
+ sal_Int32 i, nValue = 0;
+ for ( i = 0; i < nAdjustmentValues; i++ )
+ {
+ if ( i )
+ aStrBuffer.append( (sal_Unicode)' ' );
+
+ const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ];
+ if ( rAdj.State == beans::PropertyState_DIRECT_VALUE )
+ {
+ if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fValue = 0.0;
+ rAdj.Value >>= fValue;
+ rUnitConverter.convertDouble( aStrBuffer, fValue );
+ }
+ else
+ {
+ rAdj.Value >>= nValue;
+ rUnitConverter.convertNumber( aStrBuffer, nValue );
+ }
+ }
+ else
+ rUnitConverter.convertNumber( aStrBuffer, 0 ); // this should not be, but better than setting nothing
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MODIFIERS, aStr );
+ }
+ if ( bCoordinates )
+ ImpExportEnhancedPath( rExport, aCoordinates, aSegments );
+ }
+ }
+ SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_ENHANCED_GEOMETRY, sal_True, sal_True );
+ if ( bEquations )
+ ImpExportEquations( rExport, aEquations );
+ if ( bHandles )
+ ImpExportHandles( rExport, aHandles );
+}
+
+void XMLShapeExport::ImpExportCustomShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint )
+{
+ const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ if ( xPropSet.is() )
+ {
+ rtl::OUString aStr;
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // Transformation
+ ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
+
+ if ( xPropSetInfo.is() )
+ {
+ const rtl::OUString sCustomShapeEngine( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) );
+ if ( xPropSetInfo->hasPropertyByName( sCustomShapeEngine ) )
+ {
+ uno::Any aEngine( xPropSet->getPropertyValue( sCustomShapeEngine ) );
+ if ( ( aEngine >>= aStr ) && aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENGINE, aStr );
+ }
+ const rtl::OUString sCustomShapeData( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeData" ) );
+ if ( xPropSetInfo->hasPropertyByName( sCustomShapeData ) )
+ {
+ uno::Any aData( xPropSet->getPropertyValue( sCustomShapeData ) );
+ if ( ( aData >>= aStr ) && aStr.getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DATA, aStr );
+ }
+ }
+ sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
+ SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, sal_True );
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ ImpExportEnhancedGeometry( mrExport, xPropSet );
+ }
+}
+
+void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint )
+{
+ uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
+
+ DBG_ASSERT( xPropSet.is() && xNamed.is(), "xmloff::XMLShapeExport::ImpExportTableShape(), tabe shape is not implementing needed interfaces");
+ if(xPropSet.is() && xNamed.is()) try
+ {
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ sal_Bool bIsEmptyPresObj = sal_False;
+
+ // presentation settings
+ if(eShapeType == XmlShapeTypePresTableShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
+
+ const bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 );
+ const bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
+
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True );
+
+ if( !bIsEmptyPresObj )
+ {
+ uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) ), uno::UNO_QUERY );
+ if( xTemplate.is() )
+ {
+ const OUString sTemplate( xTemplate->getName() );
+ if( sTemplate.getLength() )
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sTemplate );
+
+ for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; pEntry->msApiName; pEntry++ )
+ {
+ try
+ {
+ sal_Bool bBool = sal_False;
+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
+
+ xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
+ if( bBool )
+ mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!");
+ }
+ }
+ }
+ }
+ uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
+
+ GetShapeTableExport()->exportTable( xRange );
+
+ uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReplacementGraphic" ) ) ), uno::UNO_QUERY );
+ if( xGraphic.is() ) try
+ {
+ Reference< lang::XMultiServiceFactory > xSM( GetExport().getServiceFactory(), UNO_QUERY_THROW );
+
+ uno::Reference< embed::XStorage > xPictureStorage;
+ uno::Reference< embed::XStorage > xStorage;
+ uno::Reference< io::XStream > xPictureStream;
+
+ OUString sPictureName;
+ if( bExportEmbedded )
+ {
+ xPictureStream.set( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.MemoryStream" ) ) ), UNO_QUERY_THROW );
+ }
+ else
+ {
+ xStorage.set( GetExport().GetTargetStorage(), UNO_QUERY_THROW );
+
+ xPictureStorage.set( xStorage->openStorageElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), ::embed::ElementModes::READWRITE ), uno::UNO_QUERY_THROW );
+ const OUString sPrefix( RTL_CONSTASCII_USTRINGPARAM("TablePreview") );
+ const OUString sSuffix( RTL_CONSTASCII_USTRINGPARAM(".svm") );
+
+ sal_Int32 nIndex = 0;
+ do
+ {
+ sPictureName = sPrefix;
+ sPictureName += OUString::valueOf( ++nIndex );
+ sPictureName += sSuffix;
+ }
+ while( xPictureStorage->hasByName( sPictureName ) );
+
+ xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), UNO_QUERY_THROW );
+ }
+
+ Reference< graphic::XGraphicProvider > xProvider( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
+ Sequence< beans::PropertyValue > aArgs( 2 );
+ aArgs[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) );
+ aArgs[ 0 ].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "image/x-vclgraphic" ) );
+ aArgs[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) );
+ aArgs[ 1 ].Value <<= xPictureStream->getOutputStream();
+ xProvider->storeGraphic( xGraphic, aArgs );
+
+ if( xPictureStorage.is() )
+ {
+ Reference< embed::XTransactedObject > xTrans( xPictureStorage, UNO_QUERY );
+ if( xTrans.is() )
+ xTrans->commit();
+ }
+
+ if( !bExportEmbedded )
+ {
+ OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) );
+ sURL += sPictureName;
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True );
+
+ if( bExportEmbedded )
+ {
+ Reference< XSeekableInputStream > xSeekable( xPictureStream, UNO_QUERY_THROW );
+ xSeekable->seek(0);
+
+ XMLBase64Export aBase64Exp( GetExport() );
+ aBase64Exp.exportOfficeBinaryDataElement( Reference < XInputStream >( xPictureStream, UNO_QUERY_THROW ) );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR("xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!");
+ }
+ }
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportDescription( xShape ); // #i68101#
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!" );
+ }
+}
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
new file mode 100644
index 000000000000..903b7d99809a
--- /dev/null
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -0,0 +1,1466 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+
+#include <com/sun/star/text/PositionLayoutDir.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+
+#include <list>
+
+#ifndef _XMLOFF_SHAPEIMPORT_HXX
+#include <xmloff/shapeimport.hxx>
+#endif
+#include <xmloff/xmltkmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "ximpstyl.hxx"
+#include "ximpshap.hxx"
+#include "sdpropls.hxx"
+#include <xmloff/xmlprmap.hxx>
+#include "ximp3dscene.hxx"
+#include "ximp3dobject.hxx"
+#include "ximpgrp.hxx"
+#include "ximplink.hxx"
+
+#include <map>
+#include <vector>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct ltint32
+{
+ bool operator()(const sal_Int32 p, sal_Int32 q) const
+ {
+ return p < q;
+ }
+};
+
+typedef std::map<sal_Int32,com::sun::star::uno::Reference< com::sun::star::drawing::XShape >,ltint32> IdShapeMap;
+
+struct ConnectionHint
+{
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxConnector;
+ sal_Bool bStart;
+ OUString aDestShapeId;
+ sal_Int32 nDestGlueId;
+};
+
+struct XShapeCompareHelper
+{
+ bool operator()(com::sun::star::uno::Reference < com::sun::star::drawing::XShape > x1,
+ com::sun::star::uno::Reference < com::sun::star::drawing::XShape > x2 ) const
+ {
+ return x1.get() < x2.get();
+ }
+};
+
+/** this map store all glue point id mappings for shapes that had user defined glue points. This
+ is needed because on insertion the glue points will get a new and unique id */
+typedef std::map<sal_Int32,sal_Int32,ltint32> GluePointIdMap;
+typedef std::map< com::sun::star::uno::Reference < com::sun::star::drawing::XShape >, GluePointIdMap, XShapeCompareHelper > ShapeGluePointsMap;
+
+/** this struct is created for each startPage() call and stores information that is needed during
+ import of shapes for one page. Since pages could be nested ( notes pages inside impress ) there
+ is a pointer so one can build up a stack of this structs */
+struct XMLShapeImportPageContextImpl
+{
+ ShapeGluePointsMap maShapeGluePointsMap;
+
+ uno::Reference < drawing::XShapes > mxShapes;
+
+ struct XMLShapeImportPageContextImpl* mpNext;
+};
+
+/** this class is to enable adding members to the XMLShapeImportHelper without getting incompatible */
+struct XMLShapeImportHelperImpl
+{
+ // context for sorting shapes
+ ShapeSortContext* mpSortContext;
+
+ IdShapeMap maShapeIds;
+
+ std::vector<ConnectionHint> maConnections;
+
+ // #88546# possibility to swich progress bar handling on/off
+ sal_Bool mbHandleProgressBar;
+
+ // stores the capability of the current model to create presentation shapes
+ sal_Bool mbIsPresentationShapesSupported;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapeImportHelper::XMLShapeImportHelper(
+ SvXMLImport& rImporter,
+ const uno::Reference< frame::XModel>& rModel,
+ SvXMLImportPropertyMapper *pExtMapper )
+: mpPageContext(NULL),
+ mxModel(rModel),
+
+ mpPropertySetMapper(0L),
+ mpPresPagePropsMapper(0L),
+ mpStylesContext(0L),
+ mpAutoStylesContext(0L),
+ mpGroupShapeElemTokenMap(0L),
+ mpFrameShapeElemTokenMap(0L),
+ mp3DSceneShapeElemTokenMap(0L),
+ mp3DObjectAttrTokenMap(0L),
+ mp3DPolygonBasedAttrTokenMap(0L),
+ mp3DCubeObjectAttrTokenMap(0L),
+ mp3DSphereObjectAttrTokenMap(0L),
+ mp3DSceneShapeAttrTokenMap(0L),
+ mp3DLightAttrTokenMap(0L),
+ mpPathShapeAttrTokenMap(0L),
+ mpPolygonShapeAttrTokenMap(0L),
+ msStartShape(RTL_CONSTASCII_USTRINGPARAM("StartShape")),
+ msEndShape(RTL_CONSTASCII_USTRINGPARAM("EndShape")),
+ msStartGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")),
+ msEndGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")),
+
+ mrImporter( rImporter )
+{
+ mpImpl = new XMLShapeImportHelperImpl();
+ mpImpl->mpSortContext = 0;
+
+ // #88546# init to FALSE
+ mpImpl->mbHandleProgressBar = sal_False;
+
+ mpSdPropHdlFactory = new XMLSdPropHdlFactory( rModel, rImporter );
+
+ // set lock to avoid deletion
+ mpSdPropHdlFactory->acquire();
+
+ // construct PropertySetMapper
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper(mpSdPropHdlFactory);
+ mpPropertySetMapper = new SvXMLImportPropertyMapper( xMapper, rImporter );
+ // set lock to avoid deletion
+ mpPropertySetMapper->acquire();
+
+ if( pExtMapper )
+ {
+ UniReference < SvXMLImportPropertyMapper > xExtMapper( pExtMapper );
+ mpPropertySetMapper->ChainImportMapper( xExtMapper );
+ }
+
+ // chain text attributes
+ mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImporter));
+ mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaDefaultExtPropMapper(rImporter));
+
+/*
+ // chain form attributes
+ const UniReference< SvXMLImportPropertyMapper> xFormMapper( rImporter.GetFormImport()->getStylePropertyMapper().getBodyPtr() );
+ mpPropertySetMapper->ChainImportMapper(xFormMapper);
+*/
+
+ // construct PresPagePropsMapper
+ xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, mpSdPropHdlFactory);
+ mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter );
+ if(mpPresPagePropsMapper)
+ {
+ // set lock to avoid deletion
+ mpPresPagePropsMapper->acquire();
+ }
+
+ uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY );
+ const OUString aSName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument") );
+ mpImpl->mbIsPresentationShapesSupported = xInfo.is() && xInfo->supportsService( aSName );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+XMLShapeImportHelper::~XMLShapeImportHelper()
+{
+ DBG_ASSERT( mpImpl->maConnections.empty(), "XMLShapeImportHelper::restoreConnections() was not called!" );
+
+ // cleanup factory, decrease refcount. Should lead to destruction.
+ if(mpSdPropHdlFactory)
+ {
+ mpSdPropHdlFactory->release();
+ mpSdPropHdlFactory = 0L;
+ }
+
+ // cleanup mapper, decrease refcount. Should lead to destruction.
+ if(mpPropertySetMapper)
+ {
+ mpPropertySetMapper->release();
+ mpPropertySetMapper = 0L;
+ }
+
+ // cleanup presPage mapper, decrease refcount. Should lead to destruction.
+ if(mpPresPagePropsMapper)
+ {
+ mpPresPagePropsMapper->release();
+ mpPresPagePropsMapper = 0L;
+ }
+
+ if(mpGroupShapeElemTokenMap) delete mpGroupShapeElemTokenMap;
+ if(mpFrameShapeElemTokenMap) delete mpFrameShapeElemTokenMap;
+/*
+ if(mpShapeAttrTokenMap) delete mpShapeAttrTokenMap;
+ if(mpRectShapeAttrTokenMap) delete mpRectShapeAttrTokenMap;
+ if(mpLineShapeAttrTokenMap) delete mpLineShapeAttrTokenMap;
+ if(mpEllipseShapeAttrTokenMap) delete mpEllipseShapeAttrTokenMap;
+ if(mpTextBoxShapeAttrTokenMap) delete mpTextBoxShapeAttrTokenMap;
+ if(mpControlShapeAttrTokenMap) delete mpControlShapeAttrTokenMap;
+ if(mpPageShapeAttrTokenMap) delete mpPageShapeAttrTokenMap;
+ if(mpGraphicObjectShapeAttrTokenMap) delete mpGraphicObjectShapeAttrTokenMap;
+*/
+ if(mpPolygonShapeAttrTokenMap) delete mpPolygonShapeAttrTokenMap;
+ if(mpPathShapeAttrTokenMap) delete mpPathShapeAttrTokenMap;
+ if(mp3DSceneShapeElemTokenMap) delete mp3DSceneShapeElemTokenMap;
+ if(mp3DObjectAttrTokenMap) delete mp3DObjectAttrTokenMap;
+ if(mp3DPolygonBasedAttrTokenMap) delete mp3DPolygonBasedAttrTokenMap;
+ if(mp3DCubeObjectAttrTokenMap) delete mp3DCubeObjectAttrTokenMap;
+ if(mp3DSphereObjectAttrTokenMap) delete mp3DSphereObjectAttrTokenMap;
+ if(mp3DSceneShapeAttrTokenMap) delete mp3DSceneShapeAttrTokenMap;
+ if(mp3DLightAttrTokenMap) delete mp3DLightAttrTokenMap;
+
+ // Styles or AutoStyles context?
+ if(mpStylesContext)
+ {
+ mpStylesContext->Clear();
+ mpStylesContext->ReleaseRef();
+ }
+
+ if(mpAutoStylesContext)
+ {
+ mpAutoStylesContext->Clear();
+ mpAutoStylesContext->ReleaseRef();
+ }
+
+ delete mpImpl;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetGroupShapeElemTokenMap()
+{
+ if(!mpGroupShapeElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aGroupShapeElemTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_G, XML_TOK_GROUP_GROUP },
+ { XML_NAMESPACE_DRAW, XML_RECT, XML_TOK_GROUP_RECT },
+ { XML_NAMESPACE_DRAW, XML_LINE, XML_TOK_GROUP_LINE },
+ { XML_NAMESPACE_DRAW, XML_CIRCLE, XML_TOK_GROUP_CIRCLE },
+ { XML_NAMESPACE_DRAW, XML_ELLIPSE, XML_TOK_GROUP_ELLIPSE },
+ { XML_NAMESPACE_DRAW, XML_POLYGON, XML_TOK_GROUP_POLYGON },
+ { XML_NAMESPACE_DRAW, XML_POLYLINE, XML_TOK_GROUP_POLYLINE },
+ { XML_NAMESPACE_DRAW, XML_PATH, XML_TOK_GROUP_PATH },
+
+ { XML_NAMESPACE_DRAW, XML_CONTROL, XML_TOK_GROUP_CONTROL },
+ { XML_NAMESPACE_DRAW, XML_CONNECTOR, XML_TOK_GROUP_CONNECTOR },
+ { XML_NAMESPACE_DRAW, XML_MEASURE, XML_TOK_GROUP_MEASURE },
+ { XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, XML_TOK_GROUP_PAGE },
+ { XML_NAMESPACE_DRAW, XML_CAPTION, XML_TOK_GROUP_CAPTION },
+
+ { XML_NAMESPACE_CHART, XML_CHART, XML_TOK_GROUP_CHART },
+ { XML_NAMESPACE_DR3D, XML_SCENE, XML_TOK_GROUP_3DSCENE },
+
+ { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_GROUP_FRAME },
+ { XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, XML_TOK_GROUP_CUSTOM_SHAPE },
+
+ { XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, XML_TOK_GROUP_CUSTOM_SHAPE },
+ { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_GROUP_ANNOTATION },
+ { XML_NAMESPACE_DRAW, XML_A, XML_TOK_GROUP_A },
+
+ XML_TOKEN_MAP_END
+};
+
+ mpGroupShapeElemTokenMap = new SvXMLTokenMap(aGroupShapeElemTokenMap);
+ } // if(!mpGroupShapeElemTokenMap)
+
+ return *mpGroupShapeElemTokenMap;
+}
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetFrameShapeElemTokenMap()
+{
+ if(!mpFrameShapeElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aFrameShapeElemTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_TEXT_BOX, XML_TOK_FRAME_TEXT_BOX },
+ { XML_NAMESPACE_DRAW, XML_IMAGE, XML_TOK_FRAME_IMAGE },
+ { XML_NAMESPACE_DRAW, XML_OBJECT, XML_TOK_FRAME_OBJECT },
+ { XML_NAMESPACE_DRAW, XML_OBJECT_OLE, XML_TOK_FRAME_OBJECT_OLE },
+ { XML_NAMESPACE_DRAW, XML_PLUGIN, XML_TOK_FRAME_PLUGIN },
+ { XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, XML_TOK_FRAME_FLOATING_FRAME},
+ { XML_NAMESPACE_DRAW, XML_APPLET, XML_TOK_FRAME_APPLET },
+ { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_FRAME_TABLE },
+ XML_TOKEN_MAP_END
+};
+
+ mpFrameShapeElemTokenMap = new SvXMLTokenMap(aFrameShapeElemTokenMap);
+ } // if(!mpFrameShapeElemTokenMap)
+
+ return *mpFrameShapeElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeElemTokenMap()
+{
+ if(!mp3DSceneShapeElemTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DSceneShapeElemTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_SCENE, XML_TOK_3DSCENE_3DSCENE },
+ { XML_NAMESPACE_DR3D, XML_CUBE, XML_TOK_3DSCENE_3DCUBE },
+ { XML_NAMESPACE_DR3D, XML_SPHERE, XML_TOK_3DSCENE_3DSPHERE },
+ { XML_NAMESPACE_DR3D, XML_ROTATE, XML_TOK_3DSCENE_3DLATHE },
+ { XML_NAMESPACE_DR3D, XML_EXTRUDE, XML_TOK_3DSCENE_3DEXTRUDE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DSceneShapeElemTokenMap = new SvXMLTokenMap(a3DSceneShapeElemTokenMap);
+ } // if(!mp3DSceneShapeElemTokenMap)
+
+ return *mp3DSceneShapeElemTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/*
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetShapeAttrTokenMap()
+{
+ if(!mpShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_SHAPE_NAME },
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_SHAPE_DRAWSTYLE_NAME_GRAPHICS },
+ { XML_NAMESPACE_PRESENTATION, XML_CLASS, XML_TOK_SHAPE_PRESENTATION_CLASS },
+ { XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, XML_TOK_SHAPE_DRAWSTYLE_NAME_PRESENTATION },
+ { XML_NAMESPACE_SVG, XML_TRANSFORM, XML_TOK_SHAPE_TRANSFORM },
+ { XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TOK_SHAPE_IS_PLACEHOLDER },
+ { XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TOK_SHAPE_IS_USER_TRANSFORMED },
+ XML_TOKEN_MAP_END
+};
+
+ mpShapeAttrTokenMap = new SvXMLTokenMap(aShapeAttrTokenMap);
+ }
+
+ return *mpShapeAttrTokenMap;
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DObjectAttrTokenMap()
+{
+ if(!mp3DObjectAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DObjectAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_3DOBJECT_DRAWSTYLE_NAME },
+ { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_3DOBJECT_TRANSFORM },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DObjectAttrTokenMap = new SvXMLTokenMap(a3DObjectAttrTokenMap);
+ } // if(!mp3DObjectAttrTokenMap)
+
+ return *mp3DObjectAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DPolygonBasedAttrTokenMap()
+{
+ if(!mp3DPolygonBasedAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DPolygonBasedAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_3DPOLYGONBASED_VIEWBOX },
+ { XML_NAMESPACE_SVG, XML_D, XML_TOK_3DPOLYGONBASED_D },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DPolygonBasedAttrTokenMap = new SvXMLTokenMap(a3DPolygonBasedAttrTokenMap);
+ } // if(!mp3DPolygonBasedAttrTokenMap)
+
+ return *mp3DPolygonBasedAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DCubeObjectAttrTokenMap()
+{
+ if(!mp3DCubeObjectAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DCubeObjectAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_MIN_EDGE, XML_TOK_3DCUBEOBJ_MINEDGE },
+ { XML_NAMESPACE_DR3D, XML_MAX_EDGE, XML_TOK_3DCUBEOBJ_MAXEDGE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DCubeObjectAttrTokenMap = new SvXMLTokenMap(a3DCubeObjectAttrTokenMap);
+ } // if(!mp3DCubeObjectAttrTokenMap)
+
+ return *mp3DCubeObjectAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DSphereObjectAttrTokenMap()
+{
+ if(!mp3DSphereObjectAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DSphereObjectAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_CENTER, XML_TOK_3DSPHEREOBJ_CENTER },
+ { XML_NAMESPACE_DR3D, XML_SIZE, XML_TOK_3DSPHEREOBJ_SIZE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DSphereObjectAttrTokenMap = new SvXMLTokenMap(a3DSphereObjectAttrTokenMap);
+ } // if(!mp3DSphereObjectAttrTokenMap)
+
+ return *mp3DSphereObjectAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/*
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetRectShapeAttrTokenMap()
+{
+ if(!mpRectShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aRectShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_RECTSHAPE_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_RECTSHAPE_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_RECTSHAPE_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_RECTSHAPE_HEIGHT },
+ { XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, XML_TOK_RECTSHAPE_CORNER_RADIUS },
+ XML_TOKEN_MAP_END
+};
+
+ mpRectShapeAttrTokenMap = new SvXMLTokenMap(aRectShapeAttrTokenMap);
+ }
+
+ return *mpRectShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetLineShapeAttrTokenMap()
+{
+ if(!mpLineShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aLineShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X1, XML_TOK_LINESHAPE_X1 },
+ { XML_NAMESPACE_SVG, XML_Y1, XML_TOK_LINESHAPE_Y1 },
+ { XML_NAMESPACE_SVG, XML_X2, XML_TOK_LINESHAPE_X2 },
+ { XML_NAMESPACE_SVG, XML_Y2, XML_TOK_LINESHAPE_Y2 },
+ XML_TOKEN_MAP_END
+};
+
+ mpLineShapeAttrTokenMap = new SvXMLTokenMap(aLineShapeAttrTokenMap);
+ }
+
+ return *mpLineShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetEllipseShapeAttrTokenMap()
+{
+ if(!mpEllipseShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aEllipseShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_RX, XML_TOK_ELLIPSESHAPE_RX },
+ { XML_NAMESPACE_SVG, XML_RY, XML_TOK_ELLIPSESHAPE_RY },
+ { XML_NAMESPACE_SVG, XML_CX, XML_TOK_ELLIPSESHAPE_CX },
+ { XML_NAMESPACE_SVG, XML_CY, XML_TOK_ELLIPSESHAPE_CY },
+ { XML_NAMESPACE_SVG, XML_R, XML_TOK_ELLIPSESHAPE_R },
+ XML_TOKEN_MAP_END
+};
+
+ mpEllipseShapeAttrTokenMap = new SvXMLTokenMap(aEllipseShapeAttrTokenMap);
+ }
+
+ return *mpEllipseShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+*/
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetPolygonShapeAttrTokenMap()
+{
+ if(!mpPolygonShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aPolygonShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_POLYGONSHAPE_VIEWBOX },
+ { XML_NAMESPACE_DRAW, XML_POINTS, XML_TOK_POLYGONSHAPE_POINTS },
+ XML_TOKEN_MAP_END
+};
+
+ mpPolygonShapeAttrTokenMap = new SvXMLTokenMap(aPolygonShapeAttrTokenMap);
+ } // if(!mpPolygonShapeAttrTokenMap)
+
+ return *mpPolygonShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetPathShapeAttrTokenMap()
+{
+ if(!mpPathShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aPathShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_PATHSHAPE_VIEWBOX },
+ { XML_NAMESPACE_SVG, XML_D, XML_TOK_PATHSHAPE_D },
+ XML_TOKEN_MAP_END
+};
+
+ mpPathShapeAttrTokenMap = new SvXMLTokenMap(aPathShapeAttrTokenMap);
+ } // if(!mpPathShapeAttrTokenMap)
+
+ return *mpPathShapeAttrTokenMap;
+}
+/*
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetTextBoxShapeAttrTokenMap()
+{
+ if(!mpTextBoxShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aTextBoxShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_TEXTBOXSHAPE_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TEXTBOXSHAPE_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_TEXTBOXSHAPE_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_TEXTBOXSHAPE_HEIGHT },
+ XML_TOKEN_MAP_END
+};
+
+ mpTextBoxShapeAttrTokenMap = new SvXMLTokenMap(aTextBoxShapeAttrTokenMap);
+ }
+
+ return *mpTextBoxShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetControlShapeAttrTokenMap()
+{
+ if(!mpControlShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aControlShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_CONTROLSHAPE_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_CONTROLSHAPE_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_CONTROLSHAPE_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CONTROLSHAPE_HEIGHT },
+ XML_TOKEN_MAP_END
+};
+
+ mpControlShapeAttrTokenMap = new SvXMLTokenMap(aControlShapeAttrTokenMap);
+ }
+
+ return *mpControlShapeAttrTokenMap;
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeAttrTokenMap()
+{
+ if(!mp3DSceneShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DSceneShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_3DSCENESHAPE_TRANSFORM },
+ { XML_NAMESPACE_DR3D, XML_VRP, XML_TOK_3DSCENESHAPE_VRP },
+ { XML_NAMESPACE_DR3D, XML_VPN, XML_TOK_3DSCENESHAPE_VPN },
+ { XML_NAMESPACE_DR3D, XML_VUP, XML_TOK_3DSCENESHAPE_VUP },
+ { XML_NAMESPACE_DR3D, XML_PROJECTION, XML_TOK_3DSCENESHAPE_PROJECTION },
+ { XML_NAMESPACE_DR3D, XML_DISTANCE, XML_TOK_3DSCENESHAPE_DISTANCE },
+ { XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, XML_TOK_3DSCENESHAPE_FOCAL_LENGTH },
+ { XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, XML_TOK_3DSCENESHAPE_SHADOW_SLANT },
+ { XML_NAMESPACE_DR3D, XML_SHADE_MODE, XML_TOK_3DSCENESHAPE_SHADE_MODE },
+ { XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, XML_TOK_3DSCENESHAPE_AMBIENT_COLOR },
+ { XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, XML_TOK_3DSCENESHAPE_LIGHTING_MODE },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DSceneShapeAttrTokenMap = new SvXMLTokenMap(a3DSceneShapeAttrTokenMap);
+ } // if(!mp3DSceneShapeAttrTokenMap)
+
+ return *mp3DSceneShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::Get3DLightAttrTokenMap()
+{
+ if(!mp3DLightAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry a3DLightAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_TOK_3DLIGHT_DIFFUSE_COLOR },
+ { XML_NAMESPACE_DR3D, XML_DIRECTION, XML_TOK_3DLIGHT_DIRECTION },
+ { XML_NAMESPACE_DR3D, XML_ENABLED, XML_TOK_3DLIGHT_ENABLED },
+ { XML_NAMESPACE_DR3D, XML_SPECULAR, XML_TOK_3DLIGHT_SPECULAR },
+ XML_TOKEN_MAP_END
+};
+
+ mp3DLightAttrTokenMap = new SvXMLTokenMap(a3DLightAttrTokenMap);
+ } // if(!mp3DLightAttrTokenMap)
+
+ return *mp3DLightAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/*
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetPageShapeAttrTokenMap()
+{
+ if(!mpPageShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aPageShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_PAGESHAPE_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_PAGESHAPE_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_PAGESHAPE_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_PAGESHAPE_HEIGHT },
+ XML_TOKEN_MAP_END
+};
+
+ mpPageShapeAttrTokenMap = new SvXMLTokenMap(aPageShapeAttrTokenMap);
+ }
+
+ return *mpPageShapeAttrTokenMap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+const SvXMLTokenMap& XMLShapeImportHelper::GetGraphicObjectShapeAttrTokenMap()
+{
+ if(!mpGraphicObjectShapeAttrTokenMap)
+ {
+ static __FAR_DATA SvXMLTokenMapEntry aGraphicObjectShapeAttrTokenMap[] =
+{
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_GOSHAPE_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_GOSHAPE_Y },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_GOSHAPE_WIDTH },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_GOSHAPE_HEIGHT },
+ { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_GOSHAPE_URL },
+ XML_TOKEN_MAP_END
+};
+
+ mpGraphicObjectShapeAttrTokenMap = new SvXMLTokenMap(aGraphicObjectShapeAttrTokenMap);
+ }
+
+ return *mpGraphicObjectShapeAttrTokenMap;
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLShapeContext* XMLShapeImportHelper::Create3DSceneChildContext(
+ SvXMLImport& rImport,
+ USHORT p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+{
+ SdXMLShapeContext *pContext = 0L;
+
+ if(rShapes.is())
+ {
+ const SvXMLTokenMap& rTokenMap = Get3DSceneShapeElemTokenMap();
+ switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_3DSCENE_3DSCENE:
+ {
+ // dr3d:3dscene inside dr3d:3dscene context
+ pContext = new SdXML3DSceneShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DCUBE:
+ {
+ // dr3d:3dcube inside dr3d:3dscene context
+ pContext = new SdXML3DCubeObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DSPHERE:
+ {
+ // dr3d:3dsphere inside dr3d:3dscene context
+ pContext = new SdXML3DSphereObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DLATHE:
+ {
+ // dr3d:3dlathe inside dr3d:3dscene context
+ pContext = new SdXML3DLatheObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ case XML_TOK_3DSCENE_3DEXTRUDE:
+ {
+ // dr3d:3dextrude inside dr3d:3dscene context
+ pContext = new SdXML3DExtrudeObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False);
+ break;
+ }
+ }
+ }
+
+ // now parse the attribute list and call the child context for each unknown attribute
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ pContext->processAttribute( nPrefix, aLocalName, aValue );
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeImportHelper::SetStylesContext(SvXMLStylesContext* pNew)
+{
+ mpStylesContext = pNew;
+ mpStylesContext->AddRef();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void XMLShapeImportHelper::SetAutoStylesContext(SvXMLStylesContext* pNew)
+{
+ mpAutoStylesContext = pNew;
+ mpAutoStylesContext->AddRef();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext(
+ SvXMLImport& rImport,
+ USHORT p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+{
+ SdXMLShapeContext *pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetGroupShapeElemTokenMap();
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_GROUP_GROUP:
+ {
+ // draw:g inside group context (RECURSIVE)
+ pContext = new SdXMLGroupShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape);
+ break;
+ }
+ case XML_TOK_GROUP_3DSCENE:
+ {
+ // dr3d:3dscene inside group context
+ pContext = new SdXML3DSceneShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape);
+ break;
+ }
+ case XML_TOK_GROUP_RECT:
+ {
+ // draw:rect inside group context
+ pContext = new SdXMLRectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_LINE:
+ {
+ // draw:line inside group context
+ pContext = new SdXMLLineShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CIRCLE:
+ case XML_TOK_GROUP_ELLIPSE:
+ {
+ // draw:circle or draw:ellipse inside group context
+ pContext = new SdXMLEllipseShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_POLYGON:
+ case XML_TOK_GROUP_POLYLINE:
+ {
+ // draw:polygon or draw:polyline inside group context
+ pContext = new SdXMLPolygonShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes,
+ rTokenMap.Get(p_nPrefix, rLocalName) == XML_TOK_GROUP_POLYGON ? TRUE : FALSE, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_PATH:
+ {
+ // draw:path inside group context
+ pContext = new SdXMLPathShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape);
+ break;
+ }
+ case XML_TOK_GROUP_FRAME:
+ {
+ // text:text-box inside group context
+ pContext = new SdXMLFrameShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CONTROL:
+ {
+ // draw:control inside group context
+ pContext = new SdXMLControlShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CONNECTOR:
+ {
+ // draw:connector inside group context
+ pContext = new SdXMLConnectorShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_MEASURE:
+ {
+ // draw:measure inside group context
+ pContext = new SdXMLMeasureShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_PAGE:
+ {
+ // draw:page inside group context
+ pContext = new SdXMLPageShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CAPTION:
+ case XML_TOK_GROUP_ANNOTATION:
+ {
+ // draw:caption inside group context
+ pContext = new SdXMLCaptionShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CHART:
+ {
+ // chart:chart inside group context
+ pContext = new SdXMLChartShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape );
+ break;
+ }
+ case XML_TOK_GROUP_CUSTOM_SHAPE:
+ {
+ // draw:customshape
+ pContext = new SdXMLCustomShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_GROUP_A:
+ {
+ return new SdXMLShapeLinkContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes );
+ }
+ // add other shapes here...
+ default:
+ return new SvXMLShapeContext( rImport, p_nPrefix, rLocalName, bTemporaryShape );
+ }
+
+ // now parse the attribute list and call the child context for each unknown attribute
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ pContext->processAttribute( nPrefix, aLocalName, aValue );
+ }
+
+ return pContext;
+}
+
+// This method is called from SdXMLFrameContext to create children of drawe:frame
+SvXMLShapeContext* XMLShapeImportHelper::CreateFrameChildContext(
+ SvXMLImport& rImport,
+ USHORT p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& rAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ const uno::Reference< xml::sax::XAttributeList>& rFrameAttrList)
+{
+ SdXMLShapeContext *pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetFrameShapeElemTokenMap();
+
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
+ if( rFrameAttrList.is() )
+ pAttrList->AppendAttributeList( rFrameAttrList );
+ uno::Reference < xml::sax::XAttributeList > xAttrList = pAttrList;
+
+
+ switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ {
+ case XML_TOK_FRAME_TEXT_BOX:
+ {
+ // text:text-box inside group context
+ pContext = new SdXMLTextBoxShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_IMAGE:
+ {
+ // office:image inside group context
+ pContext = new SdXMLGraphicObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_OBJECT:
+ case XML_TOK_FRAME_OBJECT_OLE:
+ {
+ // draw:object or draw:object_ole
+ pContext = new SdXMLObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_TABLE:
+ {
+ // draw:object or draw:object_ole
+ if( rImport.IsTableShapeSupported() )
+ pContext = new SdXMLTableShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes );
+ break;
+
+ }
+ case XML_TOK_FRAME_PLUGIN:
+ {
+ // draw:plugin
+ pContext = new SdXMLPluginShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_FLOATING_FRAME:
+ {
+ // draw:floating-frame
+ pContext = new SdXMLFloatingFrameShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ case XML_TOK_FRAME_APPLET:
+ {
+ // draw:applet
+ pContext = new SdXMLAppletShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False );
+ break;
+ }
+ // add other shapes here...
+ default:
+ break;
+ }
+
+ if( pContext )
+ {
+ // now parse the attribute list and call the child context for each unknown attribute
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ pContext->processAttribute( nPrefix, aLocalName, aValue );
+ }
+ }
+
+ return pContext;
+}
+
+SvXMLImportContext *XMLShapeImportHelper::CreateFrameChildContext(
+ SvXMLImportContext *pThisContext,
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext * pContext = NULL;
+
+ SdXMLFrameShapeContext *pFrameContext = PTR_CAST( SdXMLFrameShapeContext, pThisContext );
+ if( pFrameContext )
+ pContext = pFrameContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+
+/** this function is called whenever the implementation classes like to add this new
+ shape to the given XShapes.
+*/
+void XMLShapeImportHelper::addShape( uno::Reference< drawing::XShape >& rShape,
+ const uno::Reference< xml::sax::XAttributeList >&,
+ uno::Reference< drawing::XShapes >& rShapes)
+{
+ if( rShape.is() && rShapes.is() )
+ {
+ // add new shape to parent
+ rShapes->add( rShape );
+ }
+}
+
+/** this function is called whenever the implementation classes have finished importing
+ a shape to the given XShapes. The shape is already inserted into its XShapes and
+ all properties and styles are set.
+*/
+void XMLShapeImportHelper::finishShape(
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >&,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >&)
+{
+ // --> OD 2004-08-10 #i28749#, #i36248# - set property <PositionLayoutDir>
+ // to <PositionInHoriL2R>, if it exists and the import states that
+ // the shape positioning attributes are in horizontal left-to-right
+ // layout. This is the case for the OpenOffice.org file format.
+ // This setting is done for Writer documents, because the property
+ // only exists at service com::sun::star::text::Shape - the Writer
+ // UNO service for shapes.
+ // The value indicates that the positioning attributes are given
+ // in horizontal left-to-right layout. The property is evaluated
+ // during the first positioning of the shape in order to convert
+ // the shape position given in the OpenOffice.org file format to
+ // the one for the OASIS Open Office file format.
+ uno::Reference< beans::XPropertySet > xPropSet(rShape, uno::UNO_QUERY);
+ if ( xPropSet.is() )
+ {
+ if ( mrImporter.IsShapePositionInHoriL2R() &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PositionLayoutDir"))) )
+ {
+ uno::Any aPosLayoutDir;
+ aPosLayoutDir <<= text::PositionLayoutDir::PositionInHoriL2R;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("PositionLayoutDir")),
+ aPosLayoutDir );
+ }
+ }
+ // <--
+}
+
+// helper functions for z-order sorting
+struct ZOrderHint
+{
+ sal_Int32 nIs;
+ sal_Int32 nShould;
+
+ int operator<(const ZOrderHint& rComp) const { return nShould < rComp.nShould; }
+};
+
+class ShapeSortContext
+{
+public:
+ uno::Reference< drawing::XShapes > mxShapes;
+ list<ZOrderHint> maZOrderList;
+ list<ZOrderHint> maUnsortedList;
+
+ sal_Int32 mnCurrentZ;
+ ShapeSortContext* mpParentContext;
+ const OUString msZOrder;
+
+ ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext = NULL );
+
+ void moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos );
+};
+
+ShapeSortContext::ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext )
+: mxShapes( rShapes ), mnCurrentZ( 0 ), mpParentContext( pParentContext ),
+ msZOrder(RTL_CONSTASCII_USTRINGPARAM("ZOrder"))
+{
+}
+
+void ShapeSortContext::moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos )
+{
+ uno::Any aAny( mxShapes->getByIndex( nSourcePos ) );
+ uno::Reference< beans::XPropertySet > xPropSet;
+ aAny >>= xPropSet;
+
+ if( xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName( msZOrder ) )
+ {
+ aAny <<= nDestPos;
+ xPropSet->setPropertyValue( msZOrder, aAny );
+
+ list<ZOrderHint>::iterator aIter = maZOrderList.begin();
+ list<ZOrderHint>::iterator aEnd = maZOrderList.end();
+
+ while( aIter != aEnd )
+ {
+ if( (*aIter).nIs < nSourcePos )
+ {
+ DBG_ASSERT( (*aIter).nIs >= nDestPos, "Shape sorting failed" );
+ (*aIter).nIs++;
+ }
+ aIter++;
+ }
+
+ aIter = maUnsortedList.begin();
+ aEnd = maUnsortedList.end();
+
+ while( aIter != aEnd )
+ {
+ if( (*aIter).nIs < nSourcePos )
+ {
+ DBG_ASSERT( (*aIter).nIs >= nDestPos, "shape sorting failed" );
+ (*aIter).nIs++;
+ }
+ aIter++;
+ }
+ }
+}
+
+void XMLShapeImportHelper::pushGroupForSorting( uno::Reference< drawing::XShapes >& rShapes )
+{
+ mpImpl->mpSortContext = new ShapeSortContext( rShapes, mpImpl->mpSortContext );
+}
+
+void XMLShapeImportHelper::popGroupAndSort()
+{
+ DBG_ASSERT( mpImpl->mpSortContext, "No context to sort!" );
+ if( mpImpl->mpSortContext == NULL )
+ return;
+
+ try
+ {
+ list<ZOrderHint>& rZList = mpImpl->mpSortContext->maZOrderList;
+ list<ZOrderHint>& rUnsortedList = mpImpl->mpSortContext->maUnsortedList;
+
+ // sort shapes
+ if( !rZList.empty() )
+ {
+ // only do something if we have shapes to sort
+
+ // check if there are more shapes than inserted with ::shapeWithZIndexAdded()
+ // This can happen if there where already shapes on the page before import
+ // Since the writer may delete some of this shapes during import, we need
+ // to do this here and not in our c'tor anymore
+
+ // check if we have more shapes than we know of
+ sal_Int32 nCount = mpImpl->mpSortContext->mxShapes->getCount();
+
+ nCount -= rZList.size();
+ nCount -= rUnsortedList.size();
+
+
+ if( nCount > 0 )
+ {
+ // first update offsets of added shapes
+ list<ZOrderHint>::iterator aIter( rZList.begin() );
+ while( aIter != rZList.end() )
+ (*aIter++).nIs += nCount;
+
+ aIter = rUnsortedList.begin();
+ while( aIter != rUnsortedList.end() )
+ (*aIter++).nIs += nCount;
+
+ // second add the already existing shapes in the unsorted list
+ ZOrderHint aNewHint;
+
+ do
+ {
+ nCount--;
+
+ aNewHint.nIs = nCount;
+ aNewHint.nShould = -1;
+
+ rUnsortedList.insert(rUnsortedList.begin(), aNewHint);
+ }
+ while( nCount );
+ }
+
+ // sort z ordered shapes
+ rZList.sort();
+
+ // this is the current index, all shapes before that
+ // index are finished
+ sal_Int32 nIndex = 0;
+ while( !rZList.empty() )
+ {
+ list<ZOrderHint>::iterator aIter( rZList.begin() );
+
+ while( nIndex < (*aIter).nShould && !rUnsortedList.empty() )
+ {
+ ZOrderHint aGapHint( *rUnsortedList.begin() );
+ rUnsortedList.pop_front();
+
+ mpImpl->mpSortContext->moveShape( aGapHint.nIs, nIndex++ );
+ }
+
+ if( (*aIter).nIs != nIndex )
+ mpImpl->mpSortContext->moveShape( (*aIter).nIs, nIndex );
+
+ rZList.pop_front();
+ nIndex++;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR("exception while sorting shapes, sorting failed!");
+ }
+
+ // put parent on top and delete current context, were done
+ ShapeSortContext* pContext = mpImpl->mpSortContext;
+ mpImpl->mpSortContext = pContext->mpParentContext;
+ delete pContext;
+}
+
+void XMLShapeImportHelper::shapeWithZIndexAdded( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >&, sal_Int32 nZIndex )
+{
+ if( mpImpl->mpSortContext)
+ {
+ ZOrderHint aNewHint;
+ aNewHint.nIs = mpImpl->mpSortContext->mnCurrentZ++;
+ aNewHint.nShould = nZIndex;
+
+ if( nZIndex == -1 )
+ {
+ // don't care, so add to unsorted list
+ mpImpl->mpSortContext->maUnsortedList.push_back(aNewHint);
+ }
+ else
+ {
+ // insert into sort list
+ mpImpl->mpSortContext->maZOrderList.push_back(aNewHint);
+ }
+ }
+}
+
+void XMLShapeImportHelper::addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape,
+ sal_Bool bStart,
+ const rtl::OUString& rDestShapeId,
+ sal_Int32 nDestGlueId )
+{
+ ConnectionHint aHint;
+ aHint.mxConnector = rConnectorShape;
+ aHint.bStart = bStart;
+ aHint.aDestShapeId = rDestShapeId;
+ aHint.nDestGlueId = nDestGlueId;
+
+ mpImpl->maConnections.push_back( aHint );
+}
+
+void XMLShapeImportHelper::restoreConnections()
+{
+ if( !mpImpl->maConnections.empty() )
+ {
+ uno::Any aAny;
+
+ const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size();
+ for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ )
+ {
+ ConnectionHint& rHint = mpImpl->maConnections[i];
+ uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY );
+ if( xConnector.is() )
+ {
+ // #86637# remember line deltas
+ uno::Any aLine1Delta;
+ uno::Any aLine2Delta;
+ uno::Any aLine3Delta;
+ OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta"));
+ OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta"));
+ OUString aStr3(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta"));
+ aLine1Delta = xConnector->getPropertyValue(aStr1);
+ aLine2Delta = xConnector->getPropertyValue(aStr2);
+ aLine3Delta = xConnector->getPropertyValue(aStr3);
+
+ // #86637# simply setting these values WILL force the connector to do
+ // an new layout promptly. So the line delta values have to be rescued
+ // and restored around connector changes.
+ uno::Reference< drawing::XShape > xShape(
+ mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY );
+ if( xShape.is() )
+ {
+ aAny <<= xShape;
+ xConnector->setPropertyValue( rHint.bStart ? msStartShape : msEndShape, aAny );
+
+ sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId );
+ aAny <<= nGlueId;
+ xConnector->setPropertyValue( rHint.bStart ? msStartGluePointIndex : msEndGluePointIndex, aAny );
+ }
+
+ // #86637# restore line deltas
+ xConnector->setPropertyValue(aStr1, aLine1Delta );
+ xConnector->setPropertyValue(aStr2, aLine2Delta );
+ xConnector->setPropertyValue(aStr3, aLine3Delta );
+ }
+ }
+ mpImpl->maConnections.clear();
+ }
+}
+
+SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport )
+{
+ UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport );
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory );
+ SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport );
+
+ // chain text attributes
+ pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) );
+ return pResult;
+}
+
+/** creates a shape property set mapper that can be used for non shape elements.
+ Only current feature is that the ShapeUserDefinedAttributes property is not included in this one. */
+SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateExternalShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport )
+{
+ UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport );
+ UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory, 1 );
+ SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport );
+
+ // chain text attributes
+ pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) );
+ return pResult;
+}
+
+/** adds a mapping for a glue point identifier from an xml file to the identifier created after inserting
+ the new glue point into the core. The saved mappings can be retrieved by getGluePointId() */
+void XMLShapeImportHelper::addGluePointMapping( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
+ sal_Int32 nSourceId, sal_Int32 nDestinnationId )
+{
+ if( mpPageContext )
+ mpPageContext->maShapeGluePointsMap[xShape][nSourceId] = nDestinnationId;
+}
+
+/** moves all current DestinationId's by n */
+void XMLShapeImportHelper::moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n )
+{
+ if( mpPageContext )
+ {
+ ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) );
+ if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() )
+ {
+ GluePointIdMap::iterator aShapeIdIter = (*aShapeIter).second.begin();
+ GluePointIdMap::iterator aShapeIdEnd = (*aShapeIter).second.end();
+ while ( aShapeIdIter != aShapeIdEnd )
+ {
+ if ( (*aShapeIdIter).second != -1 )
+ (*aShapeIdIter).second += n;
+ aShapeIdIter++;
+ }
+ }
+ }
+}
+
+/** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after
+ inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */
+sal_Int32 XMLShapeImportHelper::getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId )
+{
+ if( mpPageContext )
+ {
+ ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) );
+ if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() )
+ {
+ GluePointIdMap::iterator aIdIter = (*aShapeIter).second.find(nSourceId);
+ if( aIdIter != (*aShapeIter).second.end() )
+ return (*aIdIter).second;
+ }
+ }
+
+ return -1;
+}
+
+/** this method must be calling before the first shape is imported for the given page */
+void XMLShapeImportHelper::startPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes )
+{
+ XMLShapeImportPageContextImpl* pOldContext = mpPageContext;
+ mpPageContext = new XMLShapeImportPageContextImpl();
+ mpPageContext->mpNext = pOldContext;
+ mpPageContext->mxShapes = rShapes;
+}
+
+/** this method must be calling after the last shape is imported for the given page */
+void XMLShapeImportHelper::endPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >&
+#ifdef DBG_UTIL
+rShapes
+#endif
+)
+{
+ DBG_ASSERT( mpPageContext && (mpPageContext->mxShapes == rShapes), "wrong call to endPage(), no startPage called or wrong page" );
+ if( NULL == mpPageContext )
+ return;
+
+ restoreConnections();
+
+ XMLShapeImportPageContextImpl* pNextContext = mpPageContext->mpNext;
+ delete mpPageContext;
+ mpPageContext = pNextContext;
+}
+
+// #88546#
+/** defines if the import should increment the progress bar or not */
+void XMLShapeImportHelper::enableHandleProgressBar( sal_Bool bEnable )
+{
+ mpImpl->mbHandleProgressBar = bEnable;
+}
+
+sal_Bool XMLShapeImportHelper::IsHandleProgressBarEnabled() const
+{
+ return mpImpl->mbHandleProgressBar;
+}
+
+/** queries the capability of the current model to create presentation shapes */
+sal_Bool XMLShapeImportHelper::IsPresentationShapesSupported()
+{
+ return mpImpl->mbIsPresentationShapesSupported;
+}
+
+const rtl::Reference< XMLTableImport >& XMLShapeImportHelper::GetShapeTableImport()
+{
+ if( !mxShapeTableImport.is() )
+ {
+ rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrImporter.GetModel(), mrImporter ) );
+ rtl::Reference< XMLPropertySetMapper > xPropertySetMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
+ mxShapeTableImport = new XMLTableImport( mrImporter, xPropertySetMapper, xFactory );
+ }
+
+ return mxShapeTableImport;
+}
+
+void SvXMLShapeContext::setHyperlink( const OUString& rHyperlink )
+{
+ msHyperlink = rHyperlink;
+}
diff --git a/xmloff/source/draw/viewcontext.cxx b/xmloff/source/draw/viewcontext.cxx
new file mode 100644
index 000000000000..0953cb7536ce
--- /dev/null
+++ b/xmloff/source/draw/viewcontext.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "viewcontext.hxx"
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "VisAreaContext.hxx"
+
+using namespace com::sun::star;
+using namespace rtl;
+using ::xmloff::token::IsXMLToken;
+
+using ::xmloff::token::XML_EMBEDDED_VISIBLE_AREA;
+
+//------------------------------------------------------------------
+
+SdXMLViewSettingsContext::SdXMLViewSettingsContext( SdXMLImport& rImport, USHORT nPrfx, const OUString& rLName, const uno::Reference<xml::sax::XAttributeList>& ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+}
+
+SdXMLViewSettingsContext::~SdXMLViewSettingsContext()
+{
+}
+
+SvXMLImportContext *SdXMLViewSettingsContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if (nPrefix == XML_NAMESPACE_OFFICE)
+ {
+ if ( IsXMLToken( rLocalName, XML_EMBEDDED_VISIBLE_AREA ) )
+ {
+ sal_Int16 nMeasureUnit = 0;
+
+ uno::Reference< beans::XPropertySet > xProps( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xProps.is() )
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MapUnit" ) ) ) >>= nMeasureUnit;
+
+ pContext = new XMLVisAreaContext(GetImport(), nPrefix, rLocalName, xAttrList, maVisArea, nMeasureUnit);
+ }
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void SdXMLViewSettingsContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maVisArea;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
+ }
+}
diff --git a/xmloff/source/draw/viewcontext.hxx b/xmloff/source/draw/viewcontext.hxx
new file mode 100644
index 000000000000..56e6be33bf81
--- /dev/null
+++ b/xmloff/source/draw/viewcontext.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_XMLVIEWSETTINGSCONTEXT_HXX
+#define _SD_XMLVIEWSETTINGSCONTEXT_HXX
+
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <xmloff/xmlictxt.hxx>
+
+class SdXMLImport;
+
+class SdXMLViewSettingsContext : public SvXMLImportContext
+{
+ ::com::sun::star::awt::Rectangle maVisArea;
+
+public:
+ SdXMLViewSettingsContext( SdXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLViewSettingsContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+};
+
+#endif
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
new file mode 100644
index 000000000000..e486394988db
--- /dev/null
+++ b/xmloff/source/draw/xexptran.cxx
@@ -0,0 +1,3117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xexptran.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/gen.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <tools/string.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+// Defines
+
+#define BORDER_INTEGERS_ARE_EQUAL (4)
+
+//////////////////////////////////////////////////////////////////////////////
+// Predeclarations
+
+void Imp_SkipDouble(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen);
+void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection);
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// parsing help functions for simple chars
+void Imp_SkipSpaces(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && sal_Unicode(' ') == rStr[rPos])
+ rPos++;
+}
+
+void Imp_SkipSpacesAndOpeningBraces(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && (sal_Unicode(' ') == rStr[rPos] || sal_Unicode('(') == rStr[rPos]))
+ rPos++;
+}
+
+void Imp_SkipSpacesAndCommas(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && (sal_Unicode(' ') == rStr[rPos] || sal_Unicode(',') == rStr[rPos]))
+ rPos++;
+}
+
+void Imp_SkipSpacesAndClosingBraces(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ while(rPos < nLen
+ && (sal_Unicode(' ') == rStr[rPos] || sal_Unicode(')') == rStr[rPos]))
+ rPos++;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// parsing help functions for integer numbers
+
+bool Imp_IsOnNumberChar(const OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true)
+{
+ sal_Unicode aChar(rStr[nPos]);
+
+ if((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ || (bSignAllowed && sal_Unicode('+') == aChar)
+ || (bSignAllowed && sal_Unicode('-') == aChar)
+ )
+ return true;
+ return false;
+}
+
+bool Imp_IsOnUnitChar(const OUString& rStr, const sal_Int32 nPos)
+{
+ sal_Unicode aChar(rStr[nPos]);
+
+ if((sal_Unicode('a') <= aChar && sal_Unicode('z') >= aChar)
+ || (sal_Unicode('A') <= aChar && sal_Unicode('Z') >= aChar)
+ || sal_Unicode('%') == aChar
+ )
+ return true;
+ return false;
+}
+
+void Imp_SkipNumber(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen)
+{
+ bool bSignAllowed(true);
+
+ while(rPos < nLen && Imp_IsOnNumberChar(rStr, rPos, bSignAllowed))
+ {
+ bSignAllowed = false;
+ rPos++;
+ }
+}
+
+void Imp_SkipNumberAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen)
+{
+ Imp_SkipNumber(rStr, rPos, nLen);
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+}
+
+// #100617# Allow to skip doubles, too.
+void Imp_SkipDoubleAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen)
+{
+ Imp_SkipDouble(rStr, rPos, nLen);
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+}
+
+void Imp_PutNumberChar(OUString& rStr, sal_Int32 nValue)
+{
+ OUStringBuffer sStringBuffer;
+ SvXMLUnitConverter::convertNumber(sStringBuffer, nValue);
+ rStr += OUString(sStringBuffer.makeStringAndClear());
+}
+
+void Imp_PutNumberCharWithSpace(OUString& rStr, sal_Int32 nValue)
+{
+ const sal_Int32 aLen(rStr.getLength());
+ if(aLen)
+ if(Imp_IsOnNumberChar(rStr, aLen - 1, false) && nValue >= 0)
+ rStr += String(sal_Unicode(' '));
+ Imp_PutNumberChar(rStr, nValue);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// parsing help functions for double numbers
+
+void Imp_SkipDouble(const OUString& rStr, sal_Int32& rPos, const sal_Int32)
+{
+ sal_Unicode aChar(rStr[rPos]);
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ aChar = rStr[++rPos];
+
+ while((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ || sal_Unicode('.') == aChar)
+ {
+ aChar = rStr[++rPos];
+ }
+
+ if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar)
+ {
+ aChar = rStr[++rPos];
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ aChar = rStr[++rPos];
+
+ while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ {
+ aChar = rStr[++rPos];
+ }
+ }
+}
+
+double Imp_GetDoubleChar(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen,
+ const SvXMLUnitConverter& rConv, double fRetval, bool bLookForUnits = false)
+{
+ sal_Unicode aChar(rStr[rPos]);
+ OUStringBuffer sNumberString;
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+
+ while((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ || sal_Unicode('.') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+
+ if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+
+ if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+
+ while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ {
+ sNumberString.append(rStr[rPos]);
+ aChar = rStr[++rPos];
+ }
+ }
+
+ if(bLookForUnits)
+ {
+ Imp_SkipSpaces(rStr, rPos, nLen);
+ while(rPos < nLen && Imp_IsOnUnitChar(rStr, rPos))
+ sNumberString.append(rStr[rPos++]);
+ }
+
+ if(sNumberString.getLength())
+ {
+ if(bLookForUnits)
+ rConv.convertDouble(fRetval, sNumberString.makeStringAndClear(), true);
+ else
+ rConv.convertDouble(fRetval, sNumberString.makeStringAndClear());
+ }
+
+ return fRetval;
+}
+
+void Imp_PutDoubleChar(OUString& rStr, const SvXMLUnitConverter& rConv, double fValue,
+ bool bConvertUnits = false)
+{
+ OUStringBuffer sStringBuffer;
+
+ if(bConvertUnits)
+ rConv.convertDouble(sStringBuffer, fValue, true);
+ else
+ rConv.convertDouble(sStringBuffer, fValue);
+
+ rStr += OUString(sStringBuffer.makeStringAndClear());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// base class of all 2D transform objects
+
+struct ImpSdXMLExpTransObj2DBase
+{
+ sal_uInt16 mnType;
+ ImpSdXMLExpTransObj2DBase(sal_uInt16 nType)
+ : mnType(nType) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// possible object types for 2D
+
+#define IMP_SDXMLEXP_TRANSOBJ2D_ROTATE 0x0000
+#define IMP_SDXMLEXP_TRANSOBJ2D_SCALE 0x0001
+#define IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE 0x0002
+#define IMP_SDXMLEXP_TRANSOBJ2D_SKEWX 0x0003
+#define IMP_SDXMLEXP_TRANSOBJ2D_SKEWY 0x0004
+#define IMP_SDXMLEXP_TRANSOBJ2D_MATRIX 0x0005
+
+//////////////////////////////////////////////////////////////////////////////
+// classes of objects, different sizes
+
+struct ImpSdXMLExpTransObj2DRotate : public ImpSdXMLExpTransObj2DBase
+{
+ double mfRotate;
+ ImpSdXMLExpTransObj2DRotate(double fVal)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_ROTATE), mfRotate(fVal) {}
+};
+struct ImpSdXMLExpTransObj2DScale : public ImpSdXMLExpTransObj2DBase
+{
+ ::basegfx::B2DTuple maScale;
+ ImpSdXMLExpTransObj2DScale(const ::basegfx::B2DTuple& rNew)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_SCALE), maScale(rNew) {}
+};
+struct ImpSdXMLExpTransObj2DTranslate : public ImpSdXMLExpTransObj2DBase
+{
+ ::basegfx::B2DTuple maTranslate;
+ ImpSdXMLExpTransObj2DTranslate(const ::basegfx::B2DTuple& rNew)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE), maTranslate(rNew) {}
+};
+struct ImpSdXMLExpTransObj2DSkewX : public ImpSdXMLExpTransObj2DBase
+{
+ double mfSkewX;
+ ImpSdXMLExpTransObj2DSkewX(double fVal)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_SKEWX), mfSkewX(fVal) {}
+};
+struct ImpSdXMLExpTransObj2DSkewY : public ImpSdXMLExpTransObj2DBase
+{
+ double mfSkewY;
+ ImpSdXMLExpTransObj2DSkewY(double fVal)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_SKEWY), mfSkewY(fVal) {}
+};
+struct ImpSdXMLExpTransObj2DMatrix : public ImpSdXMLExpTransObj2DBase
+{
+ ::basegfx::B2DHomMatrix maMatrix;
+ ImpSdXMLExpTransObj2DMatrix(const ::basegfx::B2DHomMatrix& rNew)
+ : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_MATRIX), maMatrix(rNew) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// delete all entries in list
+
+void SdXMLImExTransform2D::EmptyList()
+{
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj2DBase* pObj = maList[a];
+
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE :
+ {
+ delete (ImpSdXMLExpTransObj2DRotate*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SCALE :
+ {
+ delete (ImpSdXMLExpTransObj2DScale*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE :
+ {
+ delete (ImpSdXMLExpTransObj2DTranslate*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX :
+ {
+ delete (ImpSdXMLExpTransObj2DSkewX*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY :
+ {
+ delete (ImpSdXMLExpTransObj2DSkewY*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX :
+ {
+ delete (ImpSdXMLExpTransObj2DMatrix*)pObj;
+ break;
+ }
+ default :
+ {
+ DBG_ERROR("SdXMLImExTransform2D: impossible entry!");
+ break;
+ }
+ }
+ }
+
+ maList.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// add members
+
+void SdXMLImExTransform2D::AddRotate(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DRotate(fNew));
+}
+
+void SdXMLImExTransform2D::AddScale(const ::basegfx::B2DTuple& rNew)
+{
+ if(1.0 != rNew.getX() || 1.0 != rNew.getY())
+ maList.push_back(new ImpSdXMLExpTransObj2DScale(rNew));
+}
+
+void SdXMLImExTransform2D::AddTranslate(const ::basegfx::B2DTuple& rNew)
+{
+ if(!rNew.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj2DTranslate(rNew));
+}
+
+void SdXMLImExTransform2D::AddSkewX(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewX(fNew));
+}
+
+void SdXMLImExTransform2D::AddSkewY(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewY(fNew));
+}
+
+void SdXMLImExTransform2D::AddMatrix(const ::basegfx::B2DHomMatrix& rNew)
+{
+ if(!rNew.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj2DMatrix(rNew));
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// gen string for export
+const OUString& SdXMLImExTransform2D::GetExportString(const SvXMLUnitConverter& rConv)
+{
+ OUString aNewString;
+ OUString aClosingBrace(sal_Unicode(')'));
+ OUString aEmptySpace(sal_Unicode(' '));
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj2DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE :
+ {
+ aNewString += OUString::createFromAscii("rotate (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DRotate*)pObj)->mfRotate);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SCALE :
+ {
+ aNewString += OUString::createFromAscii("scale (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DScale*)pObj)->maScale.getX());
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DScale*)pObj)->maScale.getY());
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE :
+ {
+ aNewString += OUString::createFromAscii("translate (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DTranslate*)pObj)->maTranslate.getX(), true);
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DTranslate*)pObj)->maTranslate.getY(), true);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX :
+ {
+ aNewString += OUString::createFromAscii("skewX (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DSkewX*)pObj)->mfSkewX);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY :
+ {
+ aNewString += OUString::createFromAscii("skewY (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DSkewY*)pObj)->mfSkewY);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX :
+ {
+ aNewString += OUString::createFromAscii("matrix (");
+
+ // a
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(0, 0));
+ aNewString += aEmptySpace;
+
+ // b
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(1, 0));
+ aNewString += aEmptySpace;
+
+ // c
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(0, 1));
+ aNewString += aEmptySpace;
+
+ // d
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(1, 1));
+ aNewString += aEmptySpace;
+
+ // e
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(0, 2), true);
+ aNewString += aEmptySpace;
+
+ // f
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix.get(1, 2), true);
+
+ aNewString += aClosingBrace;
+ break;
+ }
+ default :
+ {
+ DBG_ERROR("SdXMLImExTransform2D: impossible entry!");
+ break;
+ }
+ }
+
+ // if not the last entry, add one space to next tag
+ if(a + 1UL != maList.size())
+ {
+ aNewString += aEmptySpace;
+ }
+ }
+
+ // fill string form OUString
+ msString = aNewString;
+
+ return msString;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// for Import: constructor with string, parses it and generates entries
+SdXMLImExTransform2D::SdXMLImExTransform2D(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ SetString(rNew, rConv);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sets new string, parses it and generates entries
+void SdXMLImExTransform2D::SetString(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ msString = rNew;
+ EmptyList();
+
+ if(msString.getLength())
+ {
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+
+ const OUString aString_rotate(OUString::createFromAscii("rotate"));
+ const OUString aString_scale(OUString::createFromAscii("scale"));
+ const OUString aString_translate(OUString::createFromAscii("translate"));
+ const OUString aString_skewX(OUString::createFromAscii("skewX"));
+ const OUString aString_skewY(OUString::createFromAscii("skewY"));
+ const OUString aString_matrix(OUString::createFromAscii("matrix"));
+
+ sal_Int32 nPos(0);
+
+ while(nPos < nLen)
+ {
+ // skip spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // look for tag
+ if(nPos < nLen)
+ {
+ if(nPos == aStr.indexOf(aString_rotate, nPos))
+ {
+ double fValue(0.0);
+ nPos += 6;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DRotate(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_scale, nPos))
+ {
+ ::basegfx::B2DTuple aValue(1.0, 1.0);
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX()));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY()));
+
+ if(aValue.getX() != 1.0 || aValue.getY() != 1.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DScale(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_translate, nPos))
+ {
+ ::basegfx::B2DTuple aValue;
+ nPos += 9;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX(), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY(), true));
+
+ if(!aValue.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj2DTranslate(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_skewX, nPos))
+ {
+ double fValue(0.0);
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewX(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_skewY, nPos))
+ {
+ double fValue(0.0);
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj2DSkewY(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_matrix, nPos))
+ {
+ ::basegfx::B2DHomMatrix aValue;
+
+ nPos += 6;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+
+ // a
+ aValue.set(0, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // b
+ aValue.set(1, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // c
+ aValue.set(0, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // d
+ aValue.set(1, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // e
+ aValue.set(0, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 2), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // f
+ aValue.set(1, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 2), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ if(!aValue.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj2DMatrix(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else
+ {
+ nPos++;
+ }
+ }
+ }
+ }
+}
+
+void SdXMLImExTransform2D::GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans)
+{
+ rFullTrans.identity();
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj2DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE :
+ {
+ // #i78696#
+ // mfRotate is mathematically wrong oriented since we export/import the angle
+ // values mirrored. This error is fixed in the API, but not yet in the FileFormat.
+ // For the FileFormat there is a follow-up task (#i78698#) to fix this in the next
+ // ODF FileFormat version. For now - to emulate the old behaviour - it is necessary
+ // to mirror the value here
+ rFullTrans.rotate(((ImpSdXMLExpTransObj2DRotate*)pObj)->mfRotate * -1.0);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SCALE :
+ {
+ const ::basegfx::B2DTuple& rScale = ((ImpSdXMLExpTransObj2DScale*)pObj)->maScale;
+ rFullTrans.scale(rScale.getX(), rScale.getY());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE :
+ {
+ const ::basegfx::B2DTuple& rTranslate = ((ImpSdXMLExpTransObj2DTranslate*)pObj)->maTranslate;
+ rFullTrans.translate(rTranslate.getX(), rTranslate.getY());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX :
+ {
+ rFullTrans.shearX(tan(((ImpSdXMLExpTransObj2DSkewX*)pObj)->mfSkewX));
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY :
+ {
+ rFullTrans.shearY(tan(((ImpSdXMLExpTransObj2DSkewY*)pObj)->mfSkewY));
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX :
+ {
+ rFullTrans *= ((ImpSdXMLExpTransObj2DMatrix*)pObj)->maMatrix;
+ break;
+ }
+ default :
+ {
+ DBG_ERROR("SdXMLImExTransform2D: impossible entry!");
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// base class of all 3D transform objects
+
+struct ImpSdXMLExpTransObj3DBase
+{
+ sal_uInt16 mnType;
+ ImpSdXMLExpTransObj3DBase(sal_uInt16 nType)
+ : mnType(nType) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// possible object types for 3D
+
+#define IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X 0x0000
+#define IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y 0x0001
+#define IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z 0x0002
+#define IMP_SDXMLEXP_TRANSOBJ3D_SCALE 0x0003
+#define IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE 0x0004
+#define IMP_SDXMLEXP_TRANSOBJ3D_MATRIX 0x0005
+
+//////////////////////////////////////////////////////////////////////////////
+// classes of objects, different sizes
+
+struct ImpSdXMLExpTransObj3DRotateX : public ImpSdXMLExpTransObj3DBase
+{
+ double mfRotateX;
+ ImpSdXMLExpTransObj3DRotateX(double fVal)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X), mfRotateX(fVal) {}
+};
+struct ImpSdXMLExpTransObj3DRotateY : public ImpSdXMLExpTransObj3DBase
+{
+ double mfRotateY;
+ ImpSdXMLExpTransObj3DRotateY(double fVal)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y), mfRotateY(fVal) {}
+};
+struct ImpSdXMLExpTransObj3DRotateZ : public ImpSdXMLExpTransObj3DBase
+{
+ double mfRotateZ;
+ ImpSdXMLExpTransObj3DRotateZ(double fVal)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z), mfRotateZ(fVal) {}
+};
+struct ImpSdXMLExpTransObj3DScale : public ImpSdXMLExpTransObj3DBase
+{
+ ::basegfx::B3DTuple maScale;
+ ImpSdXMLExpTransObj3DScale(const ::basegfx::B3DTuple& rNew)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_SCALE), maScale(rNew) {}
+};
+struct ImpSdXMLExpTransObj3DTranslate : public ImpSdXMLExpTransObj3DBase
+{
+ ::basegfx::B3DTuple maTranslate;
+ ImpSdXMLExpTransObj3DTranslate(const ::basegfx::B3DTuple& rNew)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE), maTranslate(rNew) {}
+};
+struct ImpSdXMLExpTransObj3DMatrix : public ImpSdXMLExpTransObj3DBase
+{
+ ::basegfx::B3DHomMatrix maMatrix;
+ ImpSdXMLExpTransObj3DMatrix(const ::basegfx::B3DHomMatrix& rNew)
+ : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_MATRIX), maMatrix(rNew) {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// delete all entries in list
+
+void SdXMLImExTransform3D::EmptyList()
+{
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj3DBase* pObj = maList[a];
+
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X :
+ {
+ delete (ImpSdXMLExpTransObj3DRotateX*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y :
+ {
+ delete (ImpSdXMLExpTransObj3DRotateY*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z :
+ {
+ delete (ImpSdXMLExpTransObj3DRotateZ*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_SCALE :
+ {
+ delete (ImpSdXMLExpTransObj3DScale*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE :
+ {
+ delete (ImpSdXMLExpTransObj3DTranslate*)pObj;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX :
+ {
+ delete (ImpSdXMLExpTransObj3DMatrix*)pObj;
+ break;
+ }
+ default :
+ {
+ DBG_ERROR("SdXMLImExTransform3D: impossible entry!");
+ break;
+ }
+ }
+ }
+
+ maList.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// add members
+
+void SdXMLImExTransform3D::AddRotateX(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateX(fNew));
+}
+
+void SdXMLImExTransform3D::AddRotateY(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateY(fNew));
+}
+
+void SdXMLImExTransform3D::AddRotateZ(double fNew)
+{
+ if(fNew != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateZ(fNew));
+}
+
+void SdXMLImExTransform3D::AddScale(const ::basegfx::B3DTuple& rNew)
+{
+ if(1.0 != rNew.getX() || 1.0 != rNew.getY() || 1.0 != rNew.getZ())
+ maList.push_back(new ImpSdXMLExpTransObj3DScale(rNew));
+}
+
+void SdXMLImExTransform3D::AddTranslate(const ::basegfx::B3DTuple& rNew)
+{
+ if(!rNew.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj3DTranslate(rNew));
+}
+
+void SdXMLImExTransform3D::AddMatrix(const ::basegfx::B3DHomMatrix& rNew)
+{
+ if(!rNew.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj3DMatrix(rNew));
+}
+
+void SdXMLImExTransform3D::AddHomogenMatrix(const drawing::HomogenMatrix& xHomMat)
+{
+ ::basegfx::B3DHomMatrix aExportMatrix;
+
+ aExportMatrix.set(0, 0, xHomMat.Line1.Column1);
+ aExportMatrix.set(0, 1, xHomMat.Line1.Column2);
+ aExportMatrix.set(0, 2, xHomMat.Line1.Column3);
+ aExportMatrix.set(0, 3, xHomMat.Line1.Column4);
+ aExportMatrix.set(1, 0, xHomMat.Line2.Column1);
+ aExportMatrix.set(1, 1, xHomMat.Line2.Column2);
+ aExportMatrix.set(1, 2, xHomMat.Line2.Column3);
+ aExportMatrix.set(1, 3, xHomMat.Line2.Column4);
+ aExportMatrix.set(2, 0, xHomMat.Line3.Column1);
+ aExportMatrix.set(2, 1, xHomMat.Line3.Column2);
+ aExportMatrix.set(2, 2, xHomMat.Line3.Column3);
+ aExportMatrix.set(2, 3, xHomMat.Line3.Column4);
+
+ AddMatrix(aExportMatrix);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// gen string for export
+const OUString& SdXMLImExTransform3D::GetExportString(const SvXMLUnitConverter& rConv)
+{
+ OUString aNewString;
+ OUString aClosingBrace(sal_Unicode(')'));
+ OUString aEmptySpace(sal_Unicode(' '));
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj3DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X :
+ {
+ aNewString += OUString::createFromAscii("rotatex (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DRotateX*)pObj)->mfRotateX);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y :
+ {
+ aNewString += OUString::createFromAscii("rotatey (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DRotateY*)pObj)->mfRotateY);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z :
+ {
+ aNewString += OUString::createFromAscii("rotatez (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DRotateZ*)pObj)->mfRotateZ);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_SCALE :
+ {
+ aNewString += OUString::createFromAscii("scale (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale.getX());
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale.getY());
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale.getZ());
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE :
+ {
+ aNewString += OUString::createFromAscii("translate (");
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate.getX(), true);
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate.getY(), true);
+ aNewString += aEmptySpace;
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate.getZ(), true);
+ aNewString += aClosingBrace;
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX :
+ {
+ aNewString += OUString::createFromAscii("matrix (");
+
+ // a
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 0));
+ aNewString += aEmptySpace;
+
+ // b
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 0));
+ aNewString += aEmptySpace;
+
+ // c
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 0));
+ aNewString += aEmptySpace;
+
+ // d
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 1));
+ aNewString += aEmptySpace;
+
+ // e
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 1));
+ aNewString += aEmptySpace;
+
+ // f
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 1));
+ aNewString += aEmptySpace;
+
+ // g
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 2));
+ aNewString += aEmptySpace;
+
+ // h
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 2));
+ aNewString += aEmptySpace;
+
+ // i
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 2));
+ aNewString += aEmptySpace;
+
+ // j
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(0, 3), true);
+ aNewString += aEmptySpace;
+
+ // k
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(1, 3), true);
+ aNewString += aEmptySpace;
+
+ // l
+ Imp_PutDoubleChar(aNewString, rConv, ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix.get(2, 3), true);
+
+ aNewString += aClosingBrace;
+ break;
+ }
+ default :
+ {
+ DBG_ERROR("SdXMLImExTransform3D: impossible entry!");
+ break;
+ }
+ }
+
+ // if not the last entry, add one space to next tag
+ if(a + 1UL != maList.size())
+ {
+ aNewString += aEmptySpace;
+ }
+ }
+
+ // fill string form OUString
+ msString = aNewString;
+
+ return msString;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// for Import: constructor with string, parses it and generates entries
+SdXMLImExTransform3D::SdXMLImExTransform3D(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ SetString(rNew, rConv);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sets new string, parses it and generates entries
+void SdXMLImExTransform3D::SetString(const OUString& rNew, const SvXMLUnitConverter& rConv)
+{
+ msString = rNew;
+ EmptyList();
+
+ if(msString.getLength())
+ {
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+
+ const OUString aString_rotatex(OUString::createFromAscii("rotatex"));
+ const OUString aString_rotatey(OUString::createFromAscii("rotatey"));
+ const OUString aString_rotatez(OUString::createFromAscii("rotatez"));
+ const OUString aString_scale(OUString::createFromAscii("scale"));
+ const OUString aString_translate(OUString::createFromAscii("translate"));
+ const OUString aString_matrix(OUString::createFromAscii("matrix"));
+
+ sal_Int32 nPos(0);
+
+ while(nPos < nLen)
+ {
+ // skip spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // look for tag
+ if(nPos < nLen)
+ {
+ if(nPos == aStr.indexOf(aString_rotatex, nPos))
+ {
+ double fValue(0.0);
+
+ nPos += 7;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateX(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_rotatey, nPos))
+ {
+ double fValue(0.0);
+
+ nPos += 7;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateY(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_rotatez, nPos))
+ {
+ double fValue(0.0);
+
+ nPos += 7;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ fValue = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, fValue);
+ if(fValue != 0.0)
+ maList.push_back(new ImpSdXMLExpTransObj3DRotateZ(fValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_scale, nPos))
+ {
+ ::basegfx::B3DTuple aValue(1.0, 1.0, 1.0);
+
+ nPos += 5;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX()));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY()));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setZ(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getZ()));
+
+ if(1.0 != aValue.getX() || 1.0 != aValue.getY() || 1.0 != aValue.getZ())
+ maList.push_back(new ImpSdXMLExpTransObj3DScale(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_translate, nPos))
+ {
+ ::basegfx::B3DTuple aValue;
+
+ nPos += 9;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+ aValue.setX(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getX(), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setY(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getY(), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ aValue.setZ(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.getZ(), true));
+
+ if(!aValue.equalZero())
+ maList.push_back(new ImpSdXMLExpTransObj3DTranslate(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else if(nPos == aStr.indexOf(aString_matrix, nPos))
+ {
+ ::basegfx::B3DHomMatrix aValue;
+
+ nPos += 6;
+ Imp_SkipSpacesAndOpeningBraces(aStr, nPos, nLen);
+
+ // a
+ aValue.set(0, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // b
+ aValue.set(1, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // c
+ aValue.set(2, 0, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 0)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // d
+ aValue.set(0, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // e
+ aValue.set(1, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // f
+ aValue.set(2, 1, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 1)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // g
+ aValue.set(0, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 2)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // h
+ aValue.set(1, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 2)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // i
+ aValue.set(2, 2, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 2)));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // j
+ aValue.set(0, 3, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(0, 3), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // k
+ aValue.set(1, 3, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(1, 3), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // l
+ aValue.set(2, 3, Imp_GetDoubleChar(aStr, nPos, nLen, rConv, aValue.get(2, 3), true));
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ if(!aValue.isIdentity())
+ maList.push_back(new ImpSdXMLExpTransObj3DMatrix(aValue));
+
+ Imp_SkipSpacesAndClosingBraces(aStr, nPos, nLen);
+ }
+ else
+ {
+ nPos++;
+ }
+ }
+ }
+ }
+}
+
+bool SdXMLImExTransform3D::GetFullHomogenTransform(com::sun::star::drawing::HomogenMatrix& xHomMat)
+{
+ ::basegfx::B3DHomMatrix aFullTransform;
+ GetFullTransform(aFullTransform);
+
+ if(!aFullTransform.isIdentity())
+ {
+ xHomMat.Line1.Column1 = aFullTransform.get(0, 0);
+ xHomMat.Line1.Column2 = aFullTransform.get(0, 1);
+ xHomMat.Line1.Column3 = aFullTransform.get(0, 2);
+ xHomMat.Line1.Column4 = aFullTransform.get(0, 3);
+
+ xHomMat.Line2.Column1 = aFullTransform.get(1, 0);
+ xHomMat.Line2.Column2 = aFullTransform.get(1, 1);
+ xHomMat.Line2.Column3 = aFullTransform.get(1, 2);
+ xHomMat.Line2.Column4 = aFullTransform.get(1, 3);
+
+ xHomMat.Line3.Column1 = aFullTransform.get(2, 0);
+ xHomMat.Line3.Column2 = aFullTransform.get(2, 1);
+ xHomMat.Line3.Column3 = aFullTransform.get(2, 2);
+ xHomMat.Line3.Column4 = aFullTransform.get(2, 3);
+
+ xHomMat.Line4.Column1 = aFullTransform.get(3, 0);
+ xHomMat.Line4.Column2 = aFullTransform.get(3, 1);
+ xHomMat.Line4.Column3 = aFullTransform.get(3, 2);
+ xHomMat.Line4.Column4 = aFullTransform.get(3, 3);
+
+ return true;
+ }
+
+ return false;
+}
+
+void SdXMLImExTransform3D::GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans)
+{
+ rFullTrans.identity();
+
+ const sal_uInt32 nCount = maList.size();
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ ImpSdXMLExpTransObj3DBase* pObj = maList[a];
+ switch(pObj->mnType)
+ {
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X :
+ {
+ rFullTrans.rotate(((ImpSdXMLExpTransObj3DRotateX*)pObj)->mfRotateX, 0.0, 0.0);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y :
+ {
+ rFullTrans.rotate(0.0, ((ImpSdXMLExpTransObj3DRotateY*)pObj)->mfRotateY, 0.0);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z :
+ {
+ rFullTrans.rotate(0.0, 0.0, ((ImpSdXMLExpTransObj3DRotateZ*)pObj)->mfRotateZ);
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_SCALE :
+ {
+ const ::basegfx::B3DTuple& rScale = ((ImpSdXMLExpTransObj3DScale*)pObj)->maScale;
+ rFullTrans.scale(rScale.getX(), rScale.getY(), rScale.getZ());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE :
+ {
+ const ::basegfx::B3DTuple& rTranslate = ((ImpSdXMLExpTransObj3DTranslate*)pObj)->maTranslate;
+ rFullTrans.translate(rTranslate.getX(), rTranslate.getY(), rTranslate.getZ());
+ break;
+ }
+ case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX :
+ {
+ rFullTrans *= ((ImpSdXMLExpTransObj3DMatrix*)pObj)->maMatrix;
+ break;
+ }
+ default :
+ {
+ DBG_ERROR("SdXMLImExTransform3D: impossible entry!");
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImExViewBox::SdXMLImExViewBox(sal_Int32 nX, sal_Int32 nY, sal_Int32 nW, sal_Int32 nH)
+: mnX( nX ),
+ mnY( nY ),
+ mnW( nW ),
+ mnH( nH )
+{
+}
+
+// #100617# Asked vincent hardy: svg:viewBox values may be double precision.
+SdXMLImExViewBox::SdXMLImExViewBox(const OUString& rNew, const SvXMLUnitConverter& rConv)
+: msString(rNew),
+ mnX( 0L ),
+ mnY( 0L ),
+ mnW( 1000L ),
+ mnH( 1000L )
+{
+ if(msString.getLength())
+ {
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
+
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // get mX, #100617# be prepared for doubles
+ mnX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnX));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mY, #100617# be prepared for doubles
+ mnY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnY));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mW, #100617# be prepared for doubles
+ mnW = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnW));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mH, #100617# be prepared for doubles
+ mnH = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnH));
+ }
+}
+
+const OUString& SdXMLImExViewBox::GetExportString()
+{
+ OUString aNewString;
+ OUString aEmptySpace(sal_Unicode(' '));
+
+ Imp_PutNumberChar(aNewString, mnX);
+ aNewString += aEmptySpace;
+
+ Imp_PutNumberChar(aNewString, mnY);
+ aNewString += aEmptySpace;
+
+ Imp_PutNumberChar(aNewString, mnW);
+ aNewString += aEmptySpace;
+
+ Imp_PutNumberChar(aNewString, mnH);
+
+ // set new string
+ msString = aNewString;
+
+ return msString;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImExPointsElement::SdXMLImExPointsElement(drawing::PointSequence* pPoints,
+ const SdXMLImExViewBox& rViewBox,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ // #96328#
+ const bool bClosed)
+: maPoly( 0L )
+{
+ DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExPointsElement(!)");
+
+ // add polygon to string
+ sal_Int32 nCnt(pPoints->getLength());
+
+ // #104076# Convert to string only when at last one point included
+ if(nCnt > 0)
+ {
+ OUString aNewString;
+ awt::Point* pArray = pPoints->getArray();
+
+ // last point same? Ignore it.
+ // #96328# ...but only when polygon is CLOSED
+ if(bClosed && (pArray->X == (pArray + (nCnt - 1))->X) && (pArray->Y == (pArray + (nCnt - 1))->Y))
+ nCnt--;
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != rViewBox.GetWidth()
+ || rObjectSize.Height != rViewBox.GetHeight());
+ bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
+
+ for(sal_Int32 a(0L); a < nCnt; a++)
+ {
+ // prepare coordinates
+ sal_Int32 nX( pArray->X - rObjectPos.X );
+ sal_Int32 nY( pArray->Y - rObjectPos.Y );
+
+ if(bScale && rObjectSize.Width && rObjectSize.Height)
+ {
+ nX = (nX * rViewBox.GetWidth()) / rObjectSize.Width;
+ nY = (nY * rViewBox.GetHeight()) / rObjectSize.Height;
+ }
+
+ if(bTranslate)
+ {
+ nX += rViewBox.GetX();
+ nY += rViewBox.GetY();
+ }
+
+ // X and comma
+ Imp_PutNumberChar(aNewString, nX);
+ aNewString += String(sal_Unicode(','));
+
+ // Y and space (not for last)
+ Imp_PutNumberChar(aNewString, nY);
+ if(a + 1 != nCnt)
+ aNewString += String(sal_Unicode(' '));
+
+ // next point
+ pArray++;
+ }
+
+ // set new string
+ msString = aNewString;
+ }
+}
+
+// #100617# svg:polyline or svg:polygon values may be double precision.
+SdXMLImExPointsElement::SdXMLImExPointsElement(const OUString& rNew,
+ const SdXMLImExViewBox& rViewBox,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ const SvXMLUnitConverter& rConv)
+: msString( rNew ),
+ maPoly( 0L )
+{
+ // convert string to polygon
+ const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
+ sal_Int32 nNumPoints(0L);
+
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // count points in first loop
+ while(nPos < nLen)
+ {
+ // skip number, #100617# be prepared for doubles
+ Imp_SkipDouble(aStr, nPos, nLen);
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // skip number, #100617# be prepared for doubles
+ Imp_SkipDouble(aStr, nPos, nLen);
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // one more point
+ nNumPoints++;
+ }
+
+ // second loop
+ if(nNumPoints)
+ {
+ nPos = 0L;
+ maPoly.realloc(1L);
+ drawing::PointSequence* pOuterSequence = maPoly.getArray();
+ pOuterSequence->realloc(nNumPoints);
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != rViewBox.GetWidth()
+ || rObjectSize.Height != rViewBox.GetHeight());
+ bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
+
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen)
+ {
+ // prepare new parameter pair
+ sal_Int32 nX(0L);
+ sal_Int32 nY(0L);
+
+ // get mX, #100617# be prepared for doubles
+ nX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nX));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mY, #100617# be prepared for doubles
+ nY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nY));
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // prepare parameters
+ if(bTranslate)
+ {
+ nX -= rViewBox.GetX();
+ nY -= rViewBox.GetY();
+ }
+
+ if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight() )
+ {
+ nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
+ nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
+ }
+
+ nX += rObjectPos.X;
+ nY += rObjectPos.Y;
+
+ // add new point
+ *pInnerSequence = awt::Point( nX, nY );
+ pInnerSequence++;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImExSvgDElement::SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox)
+: mrViewBox( rViewBox ),
+ mbIsClosed( false ),
+ mbIsCurve( false ),
+ mnLastX( 0L ),
+ mnLastY( 0L ),
+ maPoly( 0L ),
+ maFlag( 0L )
+{
+}
+
+void Imp_GetPrevPos(awt::Point*& pPrevPos1,
+ drawing::PolygonFlags& aPrevFlag1,
+ const bool bClosed, awt::Point* pPoints,
+ drawing::PolygonFlags* pFlags, const sal_Int32 nPos,
+ const sal_Int32 nCnt, const sal_Int32 nAdd)
+{
+ if(bClosed)
+ {
+ pPrevPos1 = pPoints + ((nPos + nCnt - nAdd) % nCnt);
+ aPrevFlag1 = *(pFlags + ((nPos + nCnt - nAdd) % nCnt));
+ }
+ else if(nPos > (nAdd - 1))
+ {
+ pPrevPos1 = pPoints + (nPos - nAdd);
+ aPrevFlag1 = *(pFlags + (nPos - nAdd));
+ }
+ else
+ pPrevPos1 = 0L;
+}
+
+void Imp_PrepareCoorExport(sal_Int32& nX, sal_Int32& nY,
+ const awt::Point* pPointArray, const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize, const SdXMLImExViewBox& mrViewBox,
+ const bool bScale, const bool bTranslate)
+{
+ nX = pPointArray->X - rObjectPos.X;
+ nY = pPointArray->Y - rObjectPos.Y;
+
+ if(bScale && rObjectSize.Width && rObjectSize.Height )
+ {
+ nX = (nX * mrViewBox.GetWidth()) / rObjectSize.Width;
+ nY = (nY * mrViewBox.GetHeight()) / rObjectSize.Height;
+ }
+
+ if(bTranslate)
+ {
+ nX += mrViewBox.GetX();
+ nY += mrViewBox.GetY();
+ }
+}
+
+//#define TEST_QUADRATIC_CURVES
+#ifdef TEST_QUADRATIC_CURVES
+// To be able to test quadratic curve code: The code concerning to
+// bDoTestHere can be used (see below). Construct shapes which have their control
+// points on equal coordinates. When these are written, they can be
+// forced to create correct 'Q' and 'T' statements using this flag.
+// These may then be tested for import/exporting.
+static bool bDoTestHere(true);
+#endif // TEST_QUADRATIC_CURVES
+
+void SdXMLImExSvgDElement::AddPolygon(
+ drawing::PointSequence* pPoints,
+ drawing::FlagSequence* pFlags,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ bool bClosed, bool bRelative)
+{
+ DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExSvgDElement(!)");
+
+ sal_Int32 nCnt(pPoints->getLength());
+
+ // #104076# Convert to string only when at last one point included
+ if(nCnt > 0)
+ {
+ // append polygon to string
+ OUString aNewString;
+ sal_Unicode aLastCommand = ' ';
+ awt::Point* pPointArray = pPoints->getArray();
+
+ // are the flags used at all? If not forget about them
+ if(pFlags)
+ {
+ sal_Int32 nFlagCnt(pFlags->getLength());
+
+ if(nFlagCnt)
+ {
+ bool bFlagsUsed(false);
+ drawing::PolygonFlags* pFlagArray = pFlags->getArray();
+
+ for(sal_Int32 a(0); !bFlagsUsed && a < nFlagCnt; a++)
+ if(drawing::PolygonFlags_NORMAL != *pFlagArray++)
+ bFlagsUsed = true;
+
+ if(!bFlagsUsed)
+ pFlags = 0L;
+ }
+ else
+ {
+ pFlags = 0L;
+ }
+ }
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
+ || rObjectSize.Height != mrViewBox.GetHeight());
+ bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
+
+ // #87202# rework of point reduction:
+ // Test for Last point same -> closed, ignore last point. Take
+ // some more circumstances in account when looking at curve segments.
+ drawing::PolygonFlags* pFlagArray = (pFlags) ? pFlags->getArray() : 0L;
+ if((pPointArray->X == (pPointArray + (nCnt - 1))->X) && (pPointArray->Y == (pPointArray + (nCnt - 1))->Y))
+ {
+ if(pFlags)
+ {
+ // point needs to be ignored if point before it is
+ // NO control point. Else the last point is needed
+ // for exporting the last segment of the curve. That means
+ // that the last and the first point will be saved double,
+ // but SVG does not support a better solution here.
+ if(nCnt >= 2 && drawing::PolygonFlags_CONTROL != *(pFlagArray + (nCnt - 2)))
+ {
+ nCnt--;
+ }
+ }
+ else
+ {
+ // no curve, ignore last point
+ nCnt--;
+ }
+ }
+
+ // bezier poly, handle curves
+ bool bDidWriteStart(false);
+
+ for(sal_Int32 a(0L); a < nCnt; a++)
+ {
+ if(!pFlags || drawing::PolygonFlags_CONTROL != *pFlagArray)
+ {
+ bool bDidWriteAsCurve(false);
+
+ if(bDidWriteStart)
+ {
+ if(pFlags)
+ {
+ // real curve point, get previous to see if it's a control point
+ awt::Point* pPrevPos1;
+ drawing::PolygonFlags aPrevFlag1;
+
+ Imp_GetPrevPos(pPrevPos1, aPrevFlag1, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 1);
+
+ if(pPrevPos1 && drawing::PolygonFlags_CONTROL == aPrevFlag1)
+ {
+ // get previous2 to see if it's a control point, too
+ awt::Point* pPrevPos2;
+ drawing::PolygonFlags aPrevFlag2;
+
+ Imp_GetPrevPos(pPrevPos2, aPrevFlag2, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 2);
+
+ if(pPrevPos2 && drawing::PolygonFlags_CONTROL == aPrevFlag2)
+ {
+ // get previous3 to see if it's a curve point and if,
+ // if it is fully symmetric or not
+ awt::Point* pPrevPos3;
+ drawing::PolygonFlags aPrevFlag3;
+
+ Imp_GetPrevPos(pPrevPos3, aPrevFlag3, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 3);
+
+ if(pPrevPos3)
+ {
+ // prepare coordinates
+ sal_Int32 nX, nY;
+
+ Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // #100617# test if this curve segment may be written as
+ // a quadratic bezier
+ // That's the case if both control points are in the same place
+ // when they are prolonged to the common quadratic control point
+ // Left: P = (3P1 - P0) / 2
+ // Right: P = (3P2 - P3) / 2
+ bool bIsQuadratic(false);
+ const bool bEnableSaveQuadratic(false);
+
+ sal_Int32 nPX_L(FRound((double)((3 * pPrevPos2->X) - pPrevPos3->X) / 2.0));
+ sal_Int32 nPY_L(FRound((double)((3 * pPrevPos2->Y) - pPrevPos3->Y) / 2.0));
+ sal_Int32 nPX_R(FRound((double)((3 * pPrevPos1->X) - pPointArray->X) / 2.0));
+ sal_Int32 nPY_R(FRound((double)((3 * pPrevPos1->Y) - pPointArray->Y) / 2.0));
+ sal_Int32 nDist(0);
+
+ if(nPX_L != nPX_R)
+ {
+ nDist += abs(nPX_L - nPX_R);
+ }
+
+ if(nPY_L != nPY_R)
+ {
+ nDist += abs(nPY_L - nPY_R);
+ }
+
+ if(nDist <= BORDER_INTEGERS_ARE_EQUAL)
+ {
+ if(bEnableSaveQuadratic)
+ {
+ bIsQuadratic = true;
+ }
+ }
+
+#ifdef TEST_QUADRATIC_CURVES
+ if(bDoTestHere)
+ {
+ bIsQuadratic = false;
+
+ if(pPrevPos1->X == pPrevPos2->X && pPrevPos1->Y == pPrevPos2->Y)
+ bIsQuadratic = true;
+ }
+#endif // TEST_QUADRATIC_CURVES
+
+ if(bIsQuadratic)
+ {
+#ifdef TEST_QUADRATIC_CURVES
+ if(bDoTestHere)
+ {
+ bool bPrevPointIsSymmetric(false);
+
+ if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
+ {
+ // get previous4 to see if it's a control point
+ awt::Point* pPrevPos4;
+ drawing::PolygonFlags aPrevFlag4;
+
+ Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 4);
+
+ if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+ {
+ // okay, prevPos3 is symmetric (c2) and prevPos4
+ // is existing control point, the 's' statement can be used
+ bPrevPointIsSymmetric = true;
+ }
+ }
+
+ if(bPrevPointIsSymmetric)
+ {
+ // write a shorthand/smooth quadratic curveto entry (T)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('t'))
+ aNewString += OUString(sal_Unicode('t'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('t');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('T'))
+ aNewString += OUString(sal_Unicode('T'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('T');
+ }
+ }
+ else
+ {
+ // prepare coordinates
+ sal_Int32 nX1, nY1;
+
+ Imp_PrepareCoorExport(nX1, nY1, pPrevPos1, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // write a quadratic curveto entry (Q)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('q'))
+ aNewString += OUString(sal_Unicode('q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('q');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('Q'))
+ aNewString += OUString(sal_Unicode('Q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1);
+ Imp_PutNumberCharWithSpace(aNewString, nY1);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('Q');
+ }
+ }
+ }
+ else
+ {
+#endif // TEST_QUADRATIC_CURVES
+ awt::Point aNewPoint(nPX_L, nPY_L);
+ bool bPrevPointIsSmooth(false);
+
+ if(drawing::PolygonFlags_SMOOTH == aPrevFlag3)
+ {
+ // get previous4 to see if it's a control point
+ awt::Point* pPrevPos4;
+ drawing::PolygonFlags aPrevFlag4;
+
+ Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 4);
+
+ if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+ {
+ // okay, prevPos3 is smooth (c1) and prevPos4
+ // is existing control point. Test if it's even symmetric
+ // and thus the 'T' statement may be used.
+ ::basegfx::B2DVector aVec1(pPrevPos4->X - pPrevPos3->X, pPrevPos4->Y - pPrevPos3->Y);
+ ::basegfx::B2DVector aVec2(aNewPoint.X - pPrevPos3->X, aNewPoint.Y - pPrevPos3->Y);
+ bool bSameLength(false);
+ bool bSameDirection(false);
+
+ // get vector values
+ Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+
+ if(bSameLength && bSameDirection)
+ bPrevPointIsSmooth = true;
+ }
+ }
+
+ if(bPrevPointIsSmooth)
+ {
+ // write a shorthand/smooth quadratic curveto entry (T)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('t'))
+ aNewString += String(sal_Unicode('t'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('t');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('T'))
+ aNewString += String(sal_Unicode('T'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('T');
+ }
+ }
+ else
+ {
+ // prepare coordinates
+ sal_Int32 nX1, nY1;
+
+ Imp_PrepareCoorExport(nX1, nY1, &aNewPoint, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // write a quadratic curveto entry (Q)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('q'))
+ aNewString += String(sal_Unicode('q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('q');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('Q'))
+ aNewString += String(sal_Unicode('Q'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1);
+ Imp_PutNumberCharWithSpace(aNewString, nY1);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('Q');
+ }
+ }
+#ifdef TEST_QUADRATIC_CURVES
+ }
+#endif // TEST_QUADRATIC_CURVES
+ }
+ else
+ {
+ bool bPrevPointIsSymmetric(false);
+
+ if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
+ {
+ // get previous4 to see if it's a control point
+ awt::Point* pPrevPos4;
+ drawing::PolygonFlags aPrevFlag4;
+
+ Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+ pFlags->getArray(), a, nCnt, 4);
+
+ if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+ {
+ // okay, prevPos3 is symmetric (c2) and prevPos4
+ // is existing control point, the 's' statement can be used
+ bPrevPointIsSymmetric = true;
+ }
+ }
+
+ // prepare coordinates
+ sal_Int32 nX2, nY2;
+
+ Imp_PrepareCoorExport(nX2, nY2, pPrevPos1, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ if(bPrevPointIsSymmetric)
+ {
+ // write a shorthand/smooth curveto entry (S)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('s'))
+ aNewString += String(sal_Unicode('s'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('s');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('S'))
+ aNewString += String(sal_Unicode('S'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX2);
+ Imp_PutNumberCharWithSpace(aNewString, nY2);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('S');
+ }
+ }
+ else
+ {
+ // prepare coordinates
+ sal_Int32 nX1, nY1;
+
+ Imp_PrepareCoorExport(nX1, nY1, pPrevPos2, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ // write a curveto entry (C)
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('c'))
+ aNewString += String(sal_Unicode('c'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('c');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('C'))
+ aNewString += String(sal_Unicode('C'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX1);
+ Imp_PutNumberCharWithSpace(aNewString, nY1);
+ Imp_PutNumberCharWithSpace(aNewString, nX2);
+ Imp_PutNumberCharWithSpace(aNewString, nY2);
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('C');
+ }
+ }
+ }
+
+ // remember that current point IS written
+ bDidWriteAsCurve = true;
+
+ // remember new last position
+ mnLastX = nX;
+ mnLastY = nY;
+ }
+ }
+ }
+ }
+ }
+
+ if(!bDidWriteAsCurve)
+ {
+ // current point not yet written, prepare coordinates
+ sal_Int32 nX, nY;
+
+ Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
+ mrViewBox, bScale, bTranslate);
+
+ if(bDidWriteStart)
+ {
+ // write as normal point
+ if(mnLastX == nX)
+ {
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('v'))
+ aNewString += String(sal_Unicode('v'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('v');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('V'))
+ aNewString += String(sal_Unicode('V'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('V');
+ }
+ }
+ else if(mnLastY == nY)
+ {
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('h'))
+ aNewString += String(sal_Unicode('h'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+
+ aLastCommand = sal_Unicode('h');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('H'))
+ aNewString += String(sal_Unicode('H'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+
+ aLastCommand = sal_Unicode('H');
+ }
+ }
+ else
+ {
+ if(bRelative)
+ {
+ if(aLastCommand != sal_Unicode('l'))
+ aNewString += String(sal_Unicode('l'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('l');
+ }
+ else
+ {
+ if(aLastCommand != sal_Unicode('L'))
+ aNewString += String(sal_Unicode('L'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('L');
+ }
+ }
+ }
+ else
+ {
+ // write as start point
+ if(bRelative)
+ {
+ aNewString += String(sal_Unicode('m'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+ Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+
+ aLastCommand = sal_Unicode('l');
+ }
+ else
+ {
+ aNewString += String(sal_Unicode('M'));
+
+ Imp_PutNumberCharWithSpace(aNewString, nX);
+ Imp_PutNumberCharWithSpace(aNewString, nY);
+
+ aLastCommand = sal_Unicode('L');
+ }
+
+ // remember start written
+ bDidWriteStart = true;
+ }
+
+ // remember new last position
+ mnLastX = nX;
+ mnLastY = nY;
+ }
+ }
+
+ // next point
+ pPointArray++;
+ pFlagArray++;
+ }
+
+ // close path if closed poly
+ if(bClosed)
+ {
+ if(bRelative)
+ aNewString += String(sal_Unicode('z'));
+ else
+ aNewString += String(sal_Unicode('Z'));
+ }
+
+ // append new string
+ msString += aNewString;
+ }
+}
+
+// #100617# Linear double reader
+double Imp_ImportDoubleAndSpaces(
+ double fRetval, const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
+{
+ fRetval = Imp_GetDoubleChar(rStr, rPos, nLen, rConv, fRetval);
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+ return fRetval;
+}
+
+// #100617# Allow to read doubles, too. This will need to be changed to
+// the usage of Imp_ImportDoubleAndSpaces(...). For now, this is sufficient
+// since the interface cannot transport doubles.
+sal_Int32 Imp_ImportNumberAndSpaces(
+ sal_Int32 nRetval, const OUString& rStr, sal_Int32& rPos,
+ const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
+{
+ nRetval = FRound(Imp_ImportDoubleAndSpaces(double(nRetval), rStr, rPos, nLen, rConv));
+ Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+ return nRetval;
+}
+
+void Imp_PrepareCoorImport(sal_Int32& nX, sal_Int32& nY,
+ const awt::Point& rObjectPos, const awt::Size& rObjectSize,
+ const SdXMLImExViewBox& rViewBox, const bool bScale, const bool bTranslate)
+{
+ if(bTranslate)
+ {
+ nX -= rViewBox.GetX();
+ nY -= rViewBox.GetY();
+ }
+
+ if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight())
+ {
+ nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
+ nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
+ }
+
+ nX += rObjectPos.X;
+ nY += rObjectPos.Y;
+}
+
+void Imp_AddExportPoints(sal_Int32 nX, sal_Int32 nY,
+ awt::Point* pPoints, drawing::PolygonFlags* pFlags,
+ const sal_Int32 nInnerIndex,
+ drawing::PolygonFlags eFlag)
+{
+ if(pPoints)
+ pPoints[nInnerIndex] = awt::Point( nX, nY );
+
+ if(pFlags)
+ pFlags[nInnerIndex] = eFlag;
+}
+
+void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection)
+{
+ const sal_Int32 nLen1(FRound(aVec1.getLength()));
+ const sal_Int32 nLen2(FRound(aVec2.getLength()));
+ aVec1.normalize();
+ aVec2.normalize();
+ aVec1 += aVec2;
+ const sal_Int32 nLen3(FRound(aVec1.getLength() * ((nLen1 + nLen2) / 2.0)));
+
+ bSameLength = (abs(nLen1 - nLen2) <= BORDER_INTEGERS_ARE_EQUAL);
+ bSameDirection = (nLen3 <= BORDER_INTEGERS_ARE_EQUAL);
+}
+
+void Imp_CorrectPolygonFlag(const sal_uInt32 nInnerIndex, const awt::Point* const pInnerSequence,
+ drawing::PolygonFlags* const pInnerFlags, const sal_Int32 nX1, const sal_Int32 nY1)
+{
+ if(nInnerIndex)
+ {
+ const awt::Point aPPrev1 = pInnerSequence[nInnerIndex - 1];
+
+ if(nInnerIndex > 1)
+ {
+ const awt::Point aPPrev2 = pInnerSequence[nInnerIndex - 2];
+ const drawing::PolygonFlags aFPrev2 = pInnerFlags[nInnerIndex - 2];
+ ::basegfx::B2DVector aVec1(aPPrev2.X - aPPrev1.X, aPPrev2.Y - aPPrev1.Y);
+ ::basegfx::B2DVector aVec2(nX1 - aPPrev1.X, nY1 - aPPrev1.Y);
+ bool bSameLength(false);
+ bool bSameDirection(false);
+
+ // get vector values
+ Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+
+ if(drawing::PolygonFlags_CONTROL == aFPrev2)
+ {
+ // point before is a control point
+ if(bSameDirection)
+ {
+ if(bSameLength)
+ {
+ // set to PolygonFlags_SYMMETRIC
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
+ }
+ else
+ {
+ // set to PolygonFlags_SMOOTH
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+ }
+ }
+ else
+ {
+ // set to PolygonFlags_NORMAL
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+ }
+ }
+ else
+ {
+ // point before is a simple curve point
+ if(bSameDirection)
+ {
+ // set to PolygonFlags_SMOOTH
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+ }
+ else
+ {
+ // set to PolygonFlags_NORMAL
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+ }
+ }
+ }
+ else
+ {
+ // no point before starpoint, set type to PolygonFlags_NORMAL
+ pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+ }
+ }
+}
+
+SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,
+ const SdXMLImExViewBox& rViewBox,
+ const awt::Point& rObjectPos,
+ const awt::Size& rObjectSize,
+ const SvXMLUnitConverter& rConv)
+: msString( rNew ),
+ mrViewBox( rViewBox ),
+ mbIsClosed( false ),
+ mbIsCurve( false ),
+ mnLastX( 0L ),
+ mnLastY( 0L ),
+ maPoly( 0L ),
+ maFlag( 0L )
+{
+ // convert string to polygon
+ const OUString aStr(msString.getStr(), msString.getLength());
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
+ sal_Int32 nNumPolys(0L);
+ bool bEllipticalArc(false);
+
+ // object size and ViewBox size different?
+ bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
+ || rObjectSize.Height != mrViewBox.GetHeight());
+ bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
+
+ // first loop: count polys and get flags
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen)
+ {
+ switch(aStr[nPos++])
+ {
+ case 'Z' :
+ case 'z' :
+ {
+ break;
+ }
+ case 'M' :
+ case 'm' :
+ {
+ nNumPolys++;
+ break;
+ }
+ case 'S' :
+ case 's' :
+ case 'C' :
+ case 'c' :
+ case 'Q' :
+ case 'q' :
+ case 'T' :
+ case 't' :
+ {
+ mbIsCurve = true;
+ break;
+ }
+ case 'L' :
+ case 'l' :
+ case 'H' :
+ case 'h' :
+ case 'V' :
+ case 'v' :
+ {
+ // normal, interpreted values. All okay.
+ break;
+ }
+ case 'A' :
+ case 'a' :
+ {
+ // Not yet interpreted value.
+ bEllipticalArc = true;
+ break;
+ }
+ }
+ }
+
+ DBG_ASSERT(!bEllipticalArc, "XMLIMP: non-interpreted tags in svg:d element!");
+
+ if(nNumPolys)
+ {
+ // alloc arrays
+ maPoly.realloc(nNumPolys);
+ if(IsCurve())
+ maFlag.realloc(nNumPolys);
+
+ // get outer sequences
+ drawing::PointSequence* pOuterSequence = maPoly.getArray();
+ drawing::FlagSequence* pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
+
+ // prepare new loop, count
+ sal_uInt32 nPointCount(0L);
+ nPos = 0;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# reset closed flag for next to be started polygon
+ mbIsClosed = false;
+
+ while(nPos < nLen)
+ {
+ switch(aStr[nPos])
+ {
+ case 'z' :
+ case 'Z' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# remember closed state of current polygon
+ mbIsClosed = true;
+
+ break;
+ }
+ case 'm' :
+ case 'M' :
+ {
+ // new poly starts, end-process current poly
+ if(nPointCount)
+ {
+ // #104076# If this partial polygon is closed, use one more point
+ // to represent that
+ if(mbIsClosed)
+ {
+ nPointCount++;
+ }
+
+ pOuterSequence->realloc(nPointCount);
+ pOuterSequence++;
+
+ if(pOuterFlags)
+ {
+ pOuterFlags->realloc(nPointCount);
+ pOuterFlags++;
+ }
+
+ // reset point count for next polygon
+ nPointCount = 0L;
+ }
+
+ // #104076# reset closed flag for next to be started polygon
+ mbIsClosed = false;
+
+ // NO break, continue in next case
+ }
+ case 'L' :
+ case 'l' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount++;
+ }
+ break;
+ }
+ case 'H' :
+ case 'h' :
+ case 'V' :
+ case 'v' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount++;
+ }
+ break;
+ }
+ case 'S' :
+ case 's' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount += 3;
+ }
+ break;
+ }
+ case 'C' :
+ case 'c' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ nPointCount += 3;
+ }
+ break;
+ }
+
+ // #100617# quadratic beziers, supported as cubic ones
+ case 'Q' :
+ case 'q' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+
+ // use three points since quadratic is imported as cubic
+ nPointCount += 3;
+ }
+ break;
+ }
+
+ // #100617# relative quadratic beziers, supported as cubic ones
+ case 'T' :
+ case 't' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+
+ // use three points since quadratic is imported as cubic
+ nPointCount += 3;
+ }
+ break;
+ }
+
+ // #100617# not yet supported: elliptical arc
+ case 'A' :
+ case 'a' :
+ {
+ DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!");
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ }
+ break;
+ }
+
+ default:
+ {
+ nPos++;
+ DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (unknown)!");
+ break;
+ }
+ }
+ }
+
+ // alloc last poly (when points used)
+ if(nPointCount)
+ {
+ // #104076# If this partial polygon is closed, use one more point
+ // to represent that
+ if(mbIsClosed)
+ {
+ nPointCount++;
+ }
+
+ pOuterSequence->realloc(nPointCount);
+ pOuterSequence++;
+
+ if(pOuterFlags)
+ {
+ pOuterFlags->realloc(nPointCount);
+ pOuterFlags++;
+ }
+ }
+
+ // set pointers back
+ pOuterSequence = maPoly.getArray();
+ pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
+ awt::Point* pNotSoInnerSequence = 0L;
+ drawing::PolygonFlags* pNotSoInnerFlags = 0L;
+ sal_uInt32 nInnerIndex(0L);
+
+ // prepare new loop, read points
+ nPos = 0;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# reset closed flag for next to be started polygon
+ mbIsClosed = false;
+
+ while(nPos < nLen)
+ {
+ bool bRelative(false);
+
+ switch(aStr[nPos])
+ {
+ case 'z' :
+ case 'Z' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ // #104076# remember closed state of current polygon
+ mbIsClosed = true;
+
+ // closed: add first point again
+ // sal_Int32 nX(pInnerSequence[0].X);
+ // sal_Int32 nY(pInnerSequence[0].Y);
+ // Imp_AddExportPoints(nX, nY, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+
+ break;
+ }
+
+ case 'm' :
+ {
+ bRelative = true;
+ }
+ case 'M' :
+ {
+ // #104076# end-process current poly
+ if(mbIsClosed)
+ {
+ if(pNotSoInnerSequence)
+ {
+ // closed: add first point again
+ sal_Int32 nX(pNotSoInnerSequence[0].X);
+ sal_Int32 nY(pNotSoInnerSequence[0].Y);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+
+ // reset closed flag for next to be started polygon
+ mbIsClosed = false;
+ }
+
+ // next poly
+ pNotSoInnerSequence = pOuterSequence->getArray();
+ pOuterSequence++;
+
+ if(pOuterFlags)
+ {
+ pNotSoInnerFlags = pOuterFlags->getArray();
+ pOuterFlags++;
+ }
+
+ nInnerIndex = 0L;
+
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 'l' :
+ {
+ bRelative = true;
+ }
+ case 'L' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 'h' :
+ {
+ bRelative = true;
+ }
+ case 'H' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(mnLastY);
+
+ if(bRelative)
+ nX += mnLastX;
+
+ // set last position
+ mnLastX = nX;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 'v' :
+ {
+ bRelative = true;
+ }
+ case 'V' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX(mnLastX);
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ nY += mnLastY;
+
+ // set last position
+ mnLastY = nY;
+
+ // calc transform and add point and flag
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ break;
+ }
+
+ case 's' :
+ {
+ bRelative = true;
+ }
+ case 'S' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX1;
+ sal_Int32 nY1;
+ sal_Int32 nX2(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY2(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX2 += mnLastX;
+ nY2 += mnLastY;
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC
+ // and the Point X1,Y1 can be constructed by mirroring the point before it.
+ nX1 = nX2;
+ nY1 = nY2;
+ if(nInnerIndex)
+ {
+ awt::Point aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1];
+
+ if(nInnerIndex > 1)
+ {
+ awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2];
+ nX1 = aPPrev1.X -(aPPrev2.X - aPPrev1.X);
+ nY1 = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y);
+ }
+
+ // set curve point to symmetric
+ pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
+ }
+
+ // add calculated control point
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ case 'c' :
+ {
+ bRelative = true;
+ }
+ case 'C' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nX1(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY1(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nX2(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY2(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX1 += mnLastX;
+ nY1 += mnLastY;
+ nX2 += mnLastX;
+ nY2 += mnLastY;
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nX1, nY1, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // correct polygon flag for previous point
+ Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ // #100617# quadratic beziers are imported as cubic
+ case 'q' :
+ {
+ bRelative = true;
+ }
+ case 'Q' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nXX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nYY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nXX += mnLastX;
+ nYY += mnLastY;
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nXX, nYY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // calculate X1,X2
+ awt::Point aPPrev1 = (nInnerIndex) ? pNotSoInnerSequence[nInnerIndex-1] : pNotSoInnerSequence[0];
+ sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0);
+ sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0);
+ sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0);
+ sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0);
+
+ // correct polygon flag for previous point
+ Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ // #100617# relative quadratic beziers are imported as cubic
+ case 't' :
+ {
+ bRelative = true;
+ }
+ case 'T' :
+ {
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ sal_Int32 nXX;
+ sal_Int32 nYY;
+ sal_Int32 nX(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+ sal_Int32 nY(Imp_ImportNumberAndSpaces(0L, aStr, nPos, nLen, rConv));
+
+ if(bRelative)
+ {
+ nX += mnLastX;
+ nY += mnLastY;
+ }
+
+ // set last position
+ mnLastX = nX;
+ mnLastY = nY;
+
+ // calc transform for new points
+ Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
+
+ // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC
+ // and the Point X1,Y1 can be constructed by mirroring the point before it.
+ nXX = nX;
+ nYY = nY;
+ awt::Point aPPrev1 = pNotSoInnerSequence[0];
+
+ if(nInnerIndex)
+ {
+ aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1];
+
+ if(nInnerIndex > 1)
+ {
+ awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2];
+ nXX = aPPrev1.X -(aPPrev2.X - aPPrev1.X);
+ nYY = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y);
+ }
+
+ // set curve point to smooth here, since length
+ // is changed and thus only c1 can be used.
+ pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+ }
+
+ // calculate X1,X2
+ sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0);
+ sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0);
+ sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0);
+ sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0);
+
+ // correct polygon flag for previous point
+ Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
+
+ // add new points and set flags
+ Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
+ }
+ break;
+ }
+
+ // #100617# not yet supported: elliptical arc
+ case 'A' :
+ case 'a' :
+ {
+ DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!");
+ nPos++;
+ Imp_SkipSpaces(aStr, nPos, nLen);
+
+ while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+ {
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
+ }
+ break;
+ }
+
+ default:
+ {
+ nPos++;
+ DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (unknown)!");
+ break;
+ }
+ }
+ }
+
+ // #104076# end-process closed state of last poly
+ if(mbIsClosed)
+ {
+ if(pNotSoInnerSequence)
+ {
+ // closed: add first point again
+ sal_Int32 nX(pNotSoInnerSequence[0].X);
+ sal_Int32 nY(pNotSoInnerSequence[0].Y);
+ Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
+ }
+ }
+
+ // #87202# If it's a curve and it's closed the last point maybe too much
+ // and just exported since SVG does not allow special handling of same
+ // start and end point, remove this last point.
+ // Evtl. correct the last curve flags, too.
+ if(IsCurve() && IsClosed())
+ {
+ // make one more loop over the PolyPolygon
+ pOuterSequence = maPoly.getArray();
+ pOuterFlags = maFlag.getArray();
+ sal_Int32 nOuterCnt(maPoly.getLength());
+
+ for(sal_Int32 a(0); a < nOuterCnt; a++)
+ {
+ // get Polygon pointers
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+ sal_Int32 nInnerCnt(pOuterSequence->getLength());
+
+ while( nInnerCnt >= 2
+ && ((pInnerSequence + (nInnerCnt - 2))->X == (pInnerSequence + (nInnerCnt - 1))->X)
+ && ((pInnerSequence + (nInnerCnt - 2))->Y == (pInnerSequence + (nInnerCnt - 1))->Y)
+ && drawing::PolygonFlags_CONTROL != *(pInnerFlags + (nInnerCnt - 2)))
+ {
+ // remove last point from array
+ pOuterSequence->realloc(nInnerCnt - 1);
+ pOuterFlags->realloc(nInnerCnt - 1);
+
+ // get new pointers
+ pInnerSequence = pOuterSequence->getArray();
+ pInnerFlags = pOuterFlags->getArray();
+ nInnerCnt = pOuterSequence->getLength();
+ }
+
+ // now evtl. correct the last curve flags
+ if(nInnerCnt >= 4)
+ {
+ if( pInnerSequence->X == (pInnerSequence + (nInnerCnt - 1))->X
+ && pInnerSequence->Y == (pInnerSequence + (nInnerCnt - 1))->Y
+ && drawing::PolygonFlags_CONTROL == *(pInnerFlags + 1)
+ && drawing::PolygonFlags_CONTROL == *(pInnerFlags + (nInnerCnt - 2)))
+ {
+ awt::Point aPrev = *(pInnerSequence + (nInnerCnt - 2));
+ awt::Point aCurr = *pInnerSequence;
+ awt::Point aNext = *(pInnerSequence + 1);
+ ::basegfx::B2DVector aVec1(aPrev.X - aCurr.X, aPrev.Y - aCurr.Y);
+ ::basegfx::B2DVector aVec2(aNext.X - aCurr.X, aNext.Y - aCurr.Y);
+ bool bSameLength(false);
+ bool bSameDirection(false);
+
+ // get vector values
+ Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+
+ // set correct flag value
+ if(bSameDirection)
+ {
+ if(bSameLength)
+ {
+ // set to PolygonFlags_SYMMETRIC
+ *pInnerFlags = drawing::PolygonFlags_SYMMETRIC;
+ *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SYMMETRIC;
+ }
+ else
+ {
+ // set to PolygonFlags_SMOOTH
+ *pInnerFlags = drawing::PolygonFlags_SMOOTH;
+ *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SMOOTH;
+ }
+ }
+ else
+ {
+ // set to PolygonFlags_NORMAL
+ *pInnerFlags = drawing::PolygonFlags_NORMAL;
+ *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_NORMAL;
+ }
+ }
+ }
+
+ // switch to next Polygon
+ pOuterSequence++;
+ pOuterFlags++;
+ }
+ }
+ }
+}
+
+// eof
diff --git a/xmloff/source/draw/ximp3dobject.cxx b/xmloff/source/draw/ximp3dobject.cxx
new file mode 100644
index 000000000000..230e083385fb
--- /dev/null
+++ b/xmloff/source/draw/ximp3dobject.cxx
@@ -0,0 +1,613 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <comphelper/extract.hxx>
+#include "ximp3dobject.hxx"
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include "xexptran.hxx"
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <xmloff/families.hxx>
+#include "ximpstyl.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DObjectContext, SdXMLShapeContext );
+
+SdXML3DObjectContext::SdXML3DObjectContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbSetTransform( FALSE )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DObjectAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DOBJECT_DRAWSTYLE_NAME:
+ {
+ maDrawStyleName = sValue;
+ break;
+ }
+ case XML_TOK_3DOBJECT_TRANSFORM:
+ {
+ SdXMLImExTransform3D aTransform(sValue, GetImport().GetMM100UnitConverter());
+ if(aTransform.NeedsAction())
+ mbSetTransform = aTransform.GetFullHomogenTransform(mxHomMat);
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DObjectContext::~SdXML3DObjectContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DObjectContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ if(mbSetTransform)
+ {
+ uno::Any aAny;
+ aAny <<= mxHomMat;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny);
+ }
+
+ // call parent
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DObjectContext::EndElement()
+{
+ // call parent
+ SdXMLShapeContext::EndElement();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/*
+void SdXML3DObjectContext::AddShape(uno::Reference< drawing::XShape >& xShape)
+{
+ if(xShape.is() && mxShapes.is())
+ {
+ // set shape local
+ mxShape = xShape;
+
+ // add new shape to parent
+ mxShapes->add( xShape );
+ }
+}
+*/
+//////////////////////////////////////////////////////////////////////////////
+/*
+void SdXML3DObjectContext::SetStyle()
+{
+ // set style on shape
+ if(maDrawStyleName.getLength() && mxShape.is())
+ {
+ const SvXMLStyleContext* pStyle = 0L;
+ sal_Bool bAutoStyle(FALSE);
+
+ if(GetImport().GetShapeImport()->GetAutoStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID, maDrawStyleName);
+
+ if(pStyle)
+ bAutoStyle = TRUE;
+
+ if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetStylesContext()->
+ FindStyleChildContext(XML_STYLE_FAMILY_SD_GRAPHICS_ID, maDrawStyleName);
+
+ if(pStyle && pStyle->ISA(XMLShapeStyleContext))
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle;
+
+ if(pDocStyle->GetStyle().is())
+ {
+ // set style on object
+ uno::Any aAny;
+ aAny <<= pDocStyle->GetStyle();
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny);
+ }
+
+ if(bAutoStyle)
+ {
+ // set PropertySet on object
+ pDocStyle->FillPropertySet(xPropSet);
+ }
+ }
+ }
+ }
+}
+*/
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DCubeObjectShapeContext, SdXML3DObjectContext);
+
+SdXML3DCubeObjectShapeContext::SdXML3DCubeObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DObjectContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maMinEdge(-2500.0, -2500.0, -2500.0),
+ maMaxEdge(2500.0, 2500.0, 2500.0),
+ mbMinEdgeUsed(FALSE),
+ mbMaxEdgeUsed(FALSE)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DCubeObjectAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DCUBEOBJ_MINEDGE:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maMinEdge)
+ {
+ maMinEdge = aNewVec;
+ mbMinEdgeUsed = TRUE;
+ }
+ break;
+ }
+ case XML_TOK_3DCUBEOBJ_MAXEDGE:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maMaxEdge)
+ {
+ maMaxEdge = aNewVec;
+ mbMaxEdgeUsed = TRUE;
+ }
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DCubeObjectShapeContext::~SdXML3DCubeObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DCubeObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create shape
+ AddShape( "com.sun.star.drawing.Shape3DCubeObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DObjectContext::StartElement(xAttrList);
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ drawing::Position3D aPosition3D;
+ drawing::Direction3D aDirection3D;
+
+ // convert from min, max to size to be set
+ maMaxEdge = maMaxEdge - maMinEdge;
+
+ aPosition3D.PositionX = maMinEdge.getX();
+ aPosition3D.PositionY = maMinEdge.getY();
+ aPosition3D.PositionZ = maMinEdge.getZ();
+
+ aDirection3D.DirectionX = maMaxEdge.getX();
+ aDirection3D.DirectionY = maMaxEdge.getY();
+ aDirection3D.DirectionZ = maMaxEdge.getZ();
+
+ uno::Any aAny;
+ aAny <<= aPosition3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny);
+ aAny <<= aDirection3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DCubeObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DObjectContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DSphereObjectShapeContext, SdXML3DObjectContext);
+
+SdXML3DSphereObjectShapeContext::SdXML3DSphereObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DObjectContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maCenter(0.0, 0.0, 0.0),
+ maSize(5000.0, 5000.0, 5000.0),
+ mbCenterUsed(FALSE),
+ mbSizeUsed(FALSE)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DSphereObjectAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DSPHEREOBJ_CENTER:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maCenter)
+ {
+ maCenter = aNewVec;
+ mbCenterUsed = TRUE;
+ }
+ break;
+ }
+ case XML_TOK_3DSPHEREOBJ_SIZE:
+ {
+ ::basegfx::B3DVector aNewVec;
+ GetImport().GetMM100UnitConverter().convertB3DVector(aNewVec, sValue);
+
+ if(aNewVec != maSize)
+ {
+ maSize = aNewVec;
+ mbSizeUsed = TRUE;
+ }
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DSphereObjectShapeContext::~SdXML3DSphereObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSphereObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create shape
+ AddShape( "com.sun.star.drawing.Shape3DSphereObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DObjectContext::StartElement(xAttrList);
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ drawing::Position3D aPosition3D;
+ drawing::Direction3D aDirection3D;
+
+ aPosition3D.PositionX = maCenter.getX();
+ aPosition3D.PositionY = maCenter.getY();
+ aPosition3D.PositionZ = maCenter.getZ();
+
+ aDirection3D.DirectionX = maSize.getX();
+ aDirection3D.DirectionY = maSize.getY();
+ aDirection3D.DirectionZ = maSize.getZ();
+
+ uno::Any aAny;
+ aAny <<= aPosition3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny);
+ aAny <<= aDirection3D;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSphereObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DObjectContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DPolygonBasedShapeContext, SdXML3DObjectContext );
+
+SdXML3DPolygonBasedShapeContext::SdXML3DPolygonBasedShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DObjectContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DPolygonBasedAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DPOLYGONBASED_VIEWBOX:
+ {
+ maViewBox = sValue;
+ break;
+ }
+ case XML_TOK_3DPOLYGONBASED_D:
+ {
+ maPoints = sValue;
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DPolygonBasedShapeContext::~SdXML3DPolygonBasedShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DPolygonBasedShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set parameters
+ if(maPoints.getLength() && maViewBox.getLength())
+ {
+ SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
+ awt::Point aMinPoint(aViewBox.GetX(), aViewBox.GetY());
+ awt::Size aMaxSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ SdXMLImExSvgDElement aPoints(maPoints, aViewBox,
+ aMinPoint, aMaxSize, GetImport().GetMM100UnitConverter());
+
+ // convert to double sequences
+ drawing::PointSequenceSequence& xPoSeSe =
+ (drawing::PointSequenceSequence&)aPoints.GetPointSequenceSequence();
+ sal_Int32 nOuterSequenceCount = xPoSeSe.getLength();
+ drawing::PointSequence* pInnerSequence = xPoSeSe.getArray();
+
+ drawing::PolyPolygonShape3D xPolyPolygon3D;
+ xPolyPolygon3D.SequenceX.realloc(nOuterSequenceCount);
+ xPolyPolygon3D.SequenceY.realloc(nOuterSequenceCount);
+ xPolyPolygon3D.SequenceZ.realloc(nOuterSequenceCount);
+ drawing::DoubleSequence* pOuterSequenceX = xPolyPolygon3D.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = xPolyPolygon3D.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = xPolyPolygon3D.SequenceZ.getArray();
+
+ for(sal_Int32 a(0L); a < nOuterSequenceCount; a++)
+ {
+ sal_Int32 nInnerSequenceCount(pInnerSequence->getLength());
+ awt::Point* pArray = pInnerSequence->getArray();
+
+ pOuterSequenceX->realloc(nInnerSequenceCount);
+ pOuterSequenceY->realloc(nInnerSequenceCount);
+ pOuterSequenceZ->realloc(nInnerSequenceCount);
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+ {
+ *pInnerSequenceX++ = pArray->X;
+ *pInnerSequenceY++ = pArray->Y;
+ *pInnerSequenceZ++ = 0.0;
+ pArray++;
+ }
+ pInnerSequence++;
+
+ pOuterSequenceX++;
+ pOuterSequenceY++;
+ pOuterSequenceZ++;
+ }
+
+ // set poly
+ uno::Any aAny;
+ aAny <<= xPolyPolygon3D;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")), aAny);
+ }
+
+ // call parent
+ SdXML3DObjectContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DPolygonBasedShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DObjectContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DLatheObjectShapeContext, SdXML3DPolygonBasedShapeContext);
+
+SdXML3DLatheObjectShapeContext::SdXML3DLatheObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DPolygonBasedShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DLatheObjectShapeContext::~SdXML3DLatheObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DLatheObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create shape
+ AddShape( "com.sun.star.drawing.Shape3DLatheObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DPolygonBasedShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DLatheObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DPolygonBasedShapeContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DExtrudeObjectShapeContext, SdXML3DPolygonBasedShapeContext);
+
+SdXML3DExtrudeObjectShapeContext::SdXML3DExtrudeObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXML3DPolygonBasedShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DExtrudeObjectShapeContext::~SdXML3DExtrudeObjectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DExtrudeObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ AddShape( "com.sun.star.drawing.Shape3DExtrudeObject" );
+ if(mxShape.is())
+ {
+ // add, set style and properties from base shape
+ SetStyle();
+ SdXML3DPolygonBasedShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DExtrudeObjectShapeContext::EndElement()
+{
+ // call parent
+ SdXML3DPolygonBasedShapeContext::EndElement();
+}
+
+// EOF
diff --git a/xmloff/source/draw/ximp3dobject.hxx b/xmloff/source/draw/ximp3dobject.hxx
new file mode 100644
index 000000000000..b81309d33530
--- /dev/null
+++ b/xmloff/source/draw/ximp3dobject.hxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMP3DOBJECT_HXX
+#define _XIMP3DOBJECT_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// common shape context
+
+class SdXML3DObjectContext : public SdXMLShapeContext
+{
+protected:
+ // the shape group this object should be created inside
+
+ com::sun::star::drawing::HomogenMatrix mxHomMat;
+ BOOL mbSetTransform;
+
+/*
+ void SetStyle();
+ void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape);
+*/
+public:
+ TYPEINFO();
+
+ SdXML3DObjectContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DObjectContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dcube context
+
+class SdXML3DCubeObjectShapeContext : public SdXML3DObjectContext
+{
+ ::basegfx::B3DVector maMinEdge;
+ ::basegfx::B3DVector maMaxEdge;
+ BOOL mbMinEdgeUsed;
+ BOOL mbMaxEdgeUsed;
+
+public:
+ TYPEINFO();
+
+ SdXML3DCubeObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DCubeObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dsphere context
+
+class SdXML3DSphereObjectShapeContext : public SdXML3DObjectContext
+{
+ ::basegfx::B3DVector maCenter;
+ ::basegfx::B3DVector maSize;
+ BOOL mbCenterUsed;
+ BOOL mbSizeUsed;
+
+public:
+ TYPEINFO();
+
+ SdXML3DSphereObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DSphereObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// polygonbased context
+
+class SdXML3DPolygonBasedShapeContext : public SdXML3DObjectContext
+{
+ rtl::OUString maPoints;
+ rtl::OUString maViewBox;
+
+public:
+ TYPEINFO();
+
+ SdXML3DPolygonBasedShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DPolygonBasedShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dlathe context
+
+class SdXML3DLatheObjectShapeContext : public SdXML3DPolygonBasedShapeContext
+{
+public:
+ TYPEINFO();
+
+ SdXML3DLatheObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DLatheObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dextrude context
+
+class SdXML3DExtrudeObjectShapeContext : public SdXML3DPolygonBasedShapeContext
+{
+public:
+ TYPEINFO();
+
+ SdXML3DExtrudeObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DExtrudeObjectShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+#endif // _XIMP3DOBJECT_HXX
diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx
new file mode 100644
index 000000000000..2f3c90278b6f
--- /dev/null
+++ b/xmloff/source/draw/ximp3dscene.cxx
@@ -0,0 +1,497 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximp3dscene.hxx"
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmlnmspe.hxx"
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include "eventimp.hxx"
+#include "descriptionimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dlight context
+
+SdXML3DLightContext::SdXML3DLightContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
+: SvXMLImportContext( rImport, nPrfx, rLName),
+ maDiffuseColor(0x00000000),
+ maDirection(0.0, 0.0, 1.0),
+ mbEnabled(FALSE),
+ mbSpecular(FALSE)
+{
+ // read attributes for the 3DScene
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DLightAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_3DLIGHT_DIFFUSE_COLOR:
+ {
+ GetImport().GetMM100UnitConverter().convertColor(maDiffuseColor, sValue);
+ break;
+ }
+ case XML_TOK_3DLIGHT_DIRECTION:
+ {
+ GetImport().GetMM100UnitConverter().convertB3DVector(maDirection, sValue);
+ break;
+ }
+ case XML_TOK_3DLIGHT_ENABLED:
+ {
+ GetImport().GetMM100UnitConverter().convertBool(mbEnabled, sValue);
+ break;
+ }
+ case XML_TOK_3DLIGHT_SPECULAR:
+ {
+ GetImport().GetMM100UnitConverter().convertBool(mbSpecular, sValue);
+ break;
+ }
+ }
+ }
+}
+
+SdXML3DLightContext::~SdXML3DLightContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXML3DSceneShapeContext, SdXMLShapeContext );
+
+SdXML3DSceneShapeContext::SdXML3DSceneShapeContext(
+ SvXMLImport& rImport,
+ USHORT nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShapes)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShapes ), SdXML3DSceneAttributesHelper( rImport )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DSceneShapeContext::~SdXML3DSceneShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSceneShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create new 3DScene shape and add it to rShapes, use it
+ // as base for the new 3DScene import
+ AddShape( "com.sun.star.drawing.Shape3DSceneObject" );
+ if( mxShape.is() )
+ {
+ SetStyle();
+
+ mxChilds = uno::Reference< drawing::XShapes >::query( mxShape );
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->pushGroupForSorting( mxChilds );
+
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ }
+
+ // read attributes for the 3DScene
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ processSceneAttribute( nPrefix, aLocalName, sValue );
+ }
+
+ // #91047# call parent function is missing here, added it
+ if(mxShape.is())
+ {
+ // call parent
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXML3DSceneShapeContext::EndElement()
+{
+ if(mxShape.is())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ setSceneAttributes( xPropSet );
+ }
+
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->popGroupAndSort();
+
+ // call parent
+ SdXMLShapeContext::EndElement();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXML3DSceneShapeContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0L;
+
+ // #i68101#
+ if( nPrefix == XML_NAMESPACE_SVG &&
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ // look for local light context first
+ else if(nPrefix == XML_NAMESPACE_DR3D && IsXMLToken( rLocalName, XML_LIGHT ) )
+ {
+ // dr3d:light inside dr3d:scene context
+ pContext = create3DLightContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ // call GroupChildContext function at common ShapeImport
+ if(!pContext)
+ {
+ pContext = GetImport().GetShapeImport()->Create3DSceneChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxChilds);
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ {
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+ }
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXML3DSceneAttributesHelper::SdXML3DSceneAttributesHelper( SvXMLImport& rImporter )
+: mrImport( rImporter ),
+ mbSetTransform( FALSE ),
+ mxPrjMode(drawing::ProjectionMode_PERSPECTIVE),
+ mnDistance(1000),
+ mnFocalLength(1000),
+ mnShadowSlant(0),
+ mxShadeMode(drawing::ShadeMode_SMOOTH),
+ maAmbientColor(0x00666666),
+ mbLightingMode(FALSE),
+ maVRP(0.0, 0.0, 1.0),
+ maVPN(0.0, 0.0, 1.0),
+ maVUP(0.0, 1.0, 0.0),
+ mbVRPUsed(FALSE),
+ mbVPNUsed(FALSE),
+ mbVUPUsed(FALSE)
+{
+}
+
+SdXML3DSceneAttributesHelper::~SdXML3DSceneAttributesHelper()
+{
+ // release remembered light contexts, they are no longer needed
+ while(maList.Count())
+ maList.Remove(maList.Count() - 1)->ReleaseRef();
+}
+
+/** creates a 3d ligth context and adds it to the internal list for later processing */
+SvXMLImportContext * SdXML3DSceneAttributesHelper::create3DLightContext( sal_uInt16 nPrfx, const rtl::OUString& rLName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLImportContext* pContext = new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList);
+
+ // remember SdXML3DLightContext for later evaluation
+ if(pContext)
+ {
+ pContext->AddRef();
+ maList.Insert((SdXML3DLightContext*)pContext, LIST_APPEND);
+ }
+
+ return pContext;
+}
+
+/** this should be called for each scene attribute */
+void SdXML3DSceneAttributesHelper::processSceneAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DR3D == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+ {
+ SdXMLImExTransform3D aTransform(rValue, mrImport.GetMM100UnitConverter());
+ if(aTransform.NeedsAction())
+ mbSetTransform = aTransform.GetFullHomogenTransform(mxHomMat);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_VRP ) )
+ {
+ ::basegfx::B3DVector aNewVec;
+ mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
+
+ if(aNewVec != maVRP)
+ {
+ maVRP = aNewVec;
+ mbVRPUsed = TRUE;
+ }
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_VPN ) )
+ {
+ ::basegfx::B3DVector aNewVec;
+ mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
+
+ if(aNewVec != maVPN)
+ {
+ maVPN = aNewVec;
+ mbVPNUsed = TRUE;
+ }
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_VUP ) )
+ {
+ ::basegfx::B3DVector aNewVec;
+ mrImport.GetMM100UnitConverter().convertB3DVector(aNewVec, rValue);
+
+ if(aNewVec != maVUP)
+ {
+ maVUP = aNewVec;
+ mbVUPUsed = TRUE;
+ }
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_PROJECTION ) )
+ {
+ if( IsXMLToken( rValue, XML_PARALLEL ) )
+ mxPrjMode = drawing::ProjectionMode_PARALLEL;
+ else
+ mxPrjMode = drawing::ProjectionMode_PERSPECTIVE;
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_DISTANCE ) )
+ {
+ mrImport.GetMM100UnitConverter().convertMeasure(mnDistance, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_FOCAL_LENGTH ) )
+ {
+ mrImport.GetMM100UnitConverter().convertMeasure(mnFocalLength, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_SHADOW_SLANT ) )
+ {
+ mrImport.GetMM100UnitConverter().convertNumber(mnShadowSlant, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_SHADE_MODE ) )
+ {
+ if( IsXMLToken( rValue, XML_FLAT ) )
+ mxShadeMode = drawing::ShadeMode_FLAT;
+ else if( IsXMLToken( rValue, XML_PHONG ) )
+ mxShadeMode = drawing::ShadeMode_PHONG;
+ else if( IsXMLToken( rValue, XML_GOURAUD ) )
+ mxShadeMode = drawing::ShadeMode_SMOOTH;
+ else
+ mxShadeMode = drawing::ShadeMode_DRAFT;
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_AMBIENT_COLOR ) )
+ {
+ mrImport.GetMM100UnitConverter().convertColor(maAmbientColor, rValue);
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_LIGHTING_MODE ) )
+ {
+ mrImport.GetMM100UnitConverter().convertBool(mbLightingMode, rValue);
+ return;
+ }
+ }
+}
+
+/** this sets the scene attributes at this propertyset */
+void SdXML3DSceneAttributesHelper::setSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
+{
+ uno::Any aAny;
+
+ // world transformation
+ if(mbSetTransform)
+ {
+ aAny <<= mxHomMat;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny);
+ }
+
+ // distance
+ aAny <<= mnDistance;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")), aAny);
+
+ // focalLength
+ aAny <<= mnFocalLength;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")), aAny);
+
+ // shadowSlant
+ aAny <<= (sal_Int16)mnShadowSlant;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")), aAny);
+
+ // shadeMode
+ aAny <<= mxShadeMode;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")), aAny);
+
+ // ambientColor
+ aAny <<= maAmbientColor.GetColor();
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")), aAny);
+
+ // lightingMode
+ aAny <<= mbLightingMode;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")), aAny);
+
+ if(maList.Count())
+ {
+ uno::Any aAny2;
+ uno::Any aAny3;
+
+ // set lights
+ for(sal_uInt32 a(0L); a < maList.Count(); a++)
+ {
+ SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList.GetObject(a);
+
+ // set anys
+ aAny <<= pCtx->GetDiffuseColor().GetColor();
+ drawing::Direction3D xLightDir;
+ xLightDir.DirectionX = pCtx->GetDirection().getX();
+ xLightDir.DirectionY = pCtx->GetDirection().getY();
+ xLightDir.DirectionZ = pCtx->GetDirection().getZ();
+ aAny2 <<= xLightDir;
+ aAny3 <<= pCtx->GetEnabled();
+
+ switch(a)
+ {
+ case 0:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor1")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection1")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn1")), aAny3);
+ break;
+ }
+ case 1:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor2")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection2")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn2")), aAny3);
+ break;
+ }
+ case 2:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor3")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection3")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn3")), aAny3);
+ break;
+ }
+ case 3:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor4")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection4")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn4")), aAny3);
+ break;
+ }
+ case 4:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor5")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection5")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn5")), aAny3);
+ break;
+ }
+ case 5:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor6")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection6")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn6")), aAny3);
+ break;
+ }
+ case 6:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor7")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection7")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn7")), aAny3);
+ break;
+ }
+ case 7:
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor8")), aAny);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection8")), aAny2);
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn8")), aAny3);
+ break;
+ }
+ }
+ }
+ }
+
+ // CameraGeometry and camera settings
+ drawing::CameraGeometry aCamGeo;
+ aCamGeo.vrp.PositionX = maVRP.getX();
+ aCamGeo.vrp.PositionY = maVRP.getY();
+ aCamGeo.vrp.PositionZ = maVRP.getZ();
+ aCamGeo.vpn.DirectionX = maVPN.getX();
+ aCamGeo.vpn.DirectionY = maVPN.getY();
+ aCamGeo.vpn.DirectionZ = maVPN.getZ();
+ aCamGeo.vup.DirectionX = maVUP.getX();
+ aCamGeo.vup.DirectionY = maVUP.getY();
+ aCamGeo.vup.DirectionZ = maVUP.getZ();
+ aAny <<= aCamGeo;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")), aAny);
+
+ // #91047# set drawing::ProjectionMode AFTER camera geometry is set
+ // projection "D3DScenePerspective" drawing::ProjectionMode
+ aAny <<= mxPrjMode;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")), aAny);
+}
diff --git a/xmloff/source/draw/ximp3dscene.hxx b/xmloff/source/draw/ximp3dscene.hxx
new file mode 100644
index 000000000000..f0ab566a68a7
--- /dev/null
+++ b/xmloff/source/draw/ximp3dscene.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMP3DSCENE_HXX
+#define _XIMP3DSCENE_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include <tools/color.hxx>
+#include <ximpshap.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// dr3d:3dscene context
+
+class SdXML3DSceneShapeContext : public SdXMLShapeContext, public SdXML3DSceneAttributesHelper
+{
+ // the shape group this group is working on
+ // this is the scene at the same time
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxChilds;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+protected:
+ void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew)
+ { mxChilds = rNew; }
+
+public:
+ TYPEINFO();
+
+ SdXML3DSceneShapeContext(
+ SvXMLImport& rImport,
+ USHORT nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXML3DSceneShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const
+ { return mxShapes; }
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext()
+ { return mxShapes; }
+};
+
+
+#endif // _XIMPGROUP_HXX
diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx
new file mode 100644
index 000000000000..af5fef0ff9dc
--- /dev/null
+++ b/xmloff/source/draw/ximpbody.cxx
@@ -0,0 +1,388 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximpbody.hxx"
+#include <xmloff/prstylei.hxx>
+#include "ximpnote.hxx"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include "ximpstyl.hxx"
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlprmap.hxx>
+#include <xmloff/families.hxx>
+#include "ximpshow.hxx"
+#include "PropertySetMerger.hxx"
+#include "animationimport.hxx"
+#include <tools/string.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
+ USHORT nPrfx, const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
+, mbHadSMILNodes( false )
+{
+ bool bHaveXmlId( false );
+ OUString sXmlId;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ USHORT nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetDrawPageAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_DRAWPAGE_NAME:
+ {
+ maName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_STYLE_NAME:
+ {
+ maStyleName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_MASTER_PAGE_NAME:
+ {
+ maMasterPageName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME:
+ {
+ maPageLayoutName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_USE_HEADER_NAME:
+ {
+ maUseHeaderDeclName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_USE_FOOTER_NAME:
+ {
+ maUseFooterDeclName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME:
+ {
+ maUseDateTimeDeclName = sValue;
+ break;
+ }
+ case XML_TOK_DRAWPAGE_DRAWID:
+ {
+ if (!bHaveXmlId) { sXmlId = sValue; }
+ }
+ break;
+ case XML_TOK_DRAWPAGE_XMLID:
+ {
+ sXmlId = sValue;
+ bHaveXmlId = true;
+ }
+ break;
+ case XML_TOK_DRAWPAGE_HREF:
+ {
+ maHREF = sValue;
+ break;
+ }
+ }
+ }
+
+ if (sXmlId.getLength())
+ {
+ uno::Reference< uno::XInterface > const xRef( rShapes.get() );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
+ GetImport().GetShapeImport()->startPage( rShapes );
+
+ uno::Reference< drawing::XDrawPage > xShapeDrawPage(rShapes, uno::UNO_QUERY);
+
+ // set PageName?
+ if(maName.getLength())
+ {
+ if(xShapeDrawPage.is())
+ {
+ uno::Reference < container::XNamed > xNamed(xShapeDrawPage, uno::UNO_QUERY);
+ if(xNamed.is())
+ xNamed->setName(maName);
+ }
+ }
+
+ // set MasterPage?
+ if(maMasterPageName.getLength())
+ {
+ // #85906# Code for setting masterpage needs complete rework
+ // since GetSdImport().GetMasterStylesContext() gives always ZERO
+ // because of content/style file split. Now the nechanism is to
+ // compare the wanted masterpage-name with the existing masterpages
+ // which were loaded and created in the styles section loading.
+ uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
+ uno::Reference < drawing::XMasterPageTarget > xDrawPage(rShapes, uno::UNO_QUERY);
+ uno::Reference< drawing::XDrawPage > xMasterPage;
+
+ if(xDrawPage.is() && xMasterPages.is())
+ {
+ sal_Bool bDone(FALSE);
+ OUString sDisplayName( rImport.GetStyleDisplayName(
+ XML_STYLE_FAMILY_MASTER_PAGE, maMasterPageName ) );
+
+ for(sal_Int32 a = 0; !bDone && a < xMasterPages->getCount(); a++)
+ {
+ uno::Any aAny(xMasterPages->getByIndex(a));
+ aAny >>= xMasterPage;
+
+ if(xMasterPage.is())
+ {
+ uno::Reference < container::XNamed > xMasterNamed(xMasterPage, uno::UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ OUString sMasterPageName = xMasterNamed->getName();
+
+ if(sMasterPageName.getLength() &&
+ sMasterPageName.equals(sDisplayName))
+ {
+ xDrawPage->setMasterPage(xMasterPage);
+ bDone = TRUE;
+ }
+ }
+ }
+ }
+
+ DBG_ASSERT( bDone, "xmloff::SdXMLDrawPageContext::SdXMLDrawPageContext(), could not find a slide master!" );
+ }
+ }
+
+ SetStyle( maStyleName );
+
+ if( maHREF.getLength() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xShapeDrawPage, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ sal_Int32 nIndex = maHREF.lastIndexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ OUString aFileName( maHREF.copy( 0, nIndex ) );
+ OUString aBookmarkName( maHREF.copy( nIndex+1 ) );
+
+ maHREF = GetImport().GetAbsoluteReference( aFileName );
+ maHREF += String( (sal_Unicode)'#' );
+ maHREF += aBookmarkName;
+ }
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ), uno::makeAny( maHREF ) );
+ }
+ }
+
+ SetLayout();
+
+ DeleteAllShapes();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLDrawPageContext::~SdXMLDrawPageContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLDrawPageContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0L;
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetDrawPageElemTokenMap();
+
+ // some special objects inside draw:page context
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_DRAWPAGE_NOTES:
+ {
+ if( GetSdImport().IsImpress() )
+ {
+ // get notes page
+ uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xPresPage.is())
+ {
+ uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
+ if(xNotesDrawPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
+ if(xNewShapes.is())
+ {
+ // presentation:notes inside draw:page context
+ pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
+ }
+ }
+ }
+ }
+ break;
+ }
+ case XML_TOK_DRAWPAGE_PAR:
+ case XML_TOK_DRAWPAGE_SEQ:
+ {
+ if( GetSdImport().IsImpress() )
+ {
+ uno::Reference< animations::XAnimationNodeSupplier > xNodeSupplier(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xNodeSupplier.is())
+ {
+ pContext = new xmloff::AnimationNodeContext( xNodeSupplier->getAnimationNode(), GetSdImport(), nPrefix, rLocalName, xAttrList );
+ mbHadSMILNodes = true;
+ }
+ }
+ break;
+ }
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+void SdXMLDrawPageContext::EndElement()
+{
+ SdXMLGenericPageContext::EndElement();
+ GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
+
+ if( mbHadSMILNodes )
+ {
+ uno::Reference< animations::XAnimationNodeSupplier > xNodeSupplier(GetLocalShapesContext(), uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xPageProps( GetLocalShapesContext(), uno::UNO_QUERY );
+ if(xNodeSupplier.is())
+ xmloff::AnimationNodeContext::postProcessRootNode( GetSdImport(), xNodeSupplier->getAnimationNode(), xPageProps );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLBodyContext::SdXMLBodyContext( SdXMLImport& rImport,
+ USHORT nPrfx, const OUString& rLocalName )
+: SvXMLImportContext( rImport, nPrfx, rLocalName )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLBodyContext::~SdXMLBodyContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLBodyContext::CreateChildContext(
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0L;
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetBodyElemTokenMap();
+
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_BODY_HEADER_DECL:
+ case XML_TOK_BODY_FOOTER_DECL:
+ case XML_TOK_BODY_DATE_TIME_DECL:
+ {
+ pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_BODY_PAGE:
+ {
+ // only read the first page in preview mode
+ if( (GetSdImport().GetNewPageCount() == 0) || !GetSdImport().IsPreview() )
+ {
+ // import this page
+ uno::Reference< drawing::XDrawPage > xNewDrawPage;
+ uno::Reference< drawing::XDrawPages > xDrawPages(GetSdImport().GetLocalDrawPages(), uno::UNO_QUERY);
+
+ if( !xDrawPages.is() )
+ break;
+
+ if(GetSdImport().GetNewPageCount() + 1 > xDrawPages->getCount())
+ {
+ // new page, create and insert
+ xNewDrawPage = xDrawPages->insertNewByIndex(xDrawPages->getCount());
+ }
+ else
+ {
+ // existing page, use it
+ uno::Any aAny(xDrawPages->getByIndex(GetSdImport().GetNewPageCount()));
+ aAny >>= xNewDrawPage;
+ }
+
+ // increment global import page counter
+ GetSdImport().IncrementNewPageCount();
+
+ if(xNewDrawPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNewDrawPage, uno::UNO_QUERY);
+ if(xNewShapes.is())
+ {
+ // draw:page inside office:body context
+ pContext = new SdXMLDrawPageContext(GetSdImport(), nPrefix, rLocalName, xAttrList,
+ xNewShapes);
+ }
+ }
+ }
+ break;
+ }
+ case XML_TOK_BODY_SETTINGS:
+ {
+ pContext = new SdXMLShowsContext( GetSdImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
diff --git a/xmloff/source/draw/ximpbody.hxx b/xmloff/source/draw/ximpbody.hxx
new file mode 100644
index 000000000000..de58459f2438
--- /dev/null
+++ b/xmloff/source/draw/ximpbody.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPBODY_HXX
+#define _XIMPBODY_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ximppage.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:page context
+
+class SdXMLDrawPageContext : public SdXMLGenericPageContext
+{
+ rtl::OUString maName;
+ rtl::OUString maMasterPageName;
+ rtl::OUString maStyleName;
+ rtl::OUString maHREF;
+
+ bool mbHadSMILNodes;
+public:
+ SdXMLDrawPageContext( SdXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLDrawPageContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:body context
+
+class SdXMLBodyContext : public SvXMLImportContext
+{
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ SdXMLBodyContext( SdXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLocalName );
+ virtual ~SdXMLBodyContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+
+#endif // _XIMPBODY_HXX
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
new file mode 100644
index 000000000000..98255edf68d0
--- /dev/null
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -0,0 +1,1383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximpcustomshape.hxx"
+#include "ximpshap.hxx"
+#include "xmlehelp.hxx"
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <xmloff/xmltoken.hxx>
+#include "EnhancedCustomShapeToken.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xexptran.hxx"
+#include "xmlerror.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <hash_map>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using namespace ::xmloff::EnhancedCustomShapeToken;
+
+TYPEINIT1( XMLEnhancedCustomShapeContext, SvXMLImportContext );
+
+XMLEnhancedCustomShapeContext::XMLEnhancedCustomShapeContext( SvXMLImport& rImport,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ std::vector< com::sun::star::beans::PropertyValue >& rCustomShapeGeometry ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrUnitConverter( rImport.GetMM100UnitConverter() ),
+ mrxShape( rxShape ),
+ mrCustomShapeGeometry( rCustomShapeGeometry )
+{
+}
+
+const SvXMLEnumMapEntry aXML_GluePointEnumMap[] =
+{
+ { XML_NONE, 0 },
+ { XML_SEGMENTS, 1 },
+ { XML_NONE, 2 },
+ { XML_RECTANGLE, 3 },
+ { XML_TOKEN_INVALID, 0 }
+};
+void GetBool( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Bool bAttrBool;
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= bAttrBool;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetInt32( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Int32 nAttrNumber;
+ if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= nAttrNumber;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDouble( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ double fAttrDouble;
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= fAttrDouble;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDistance( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ double fAttrDouble;
+ MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) );
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue, eSrcUnit, MAP_100TH_MM ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= fAttrDouble;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetString( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= rValue;
+ rDest.push_back( aProp );
+}
+
+void GetEnum( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp,
+ const SvXMLEnumMapEntry& rMap )
+{
+ USHORT eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, rValue, &rMap ) )
+ {
+ sal_Int16 nEnum = (sal_Int16)eKind;
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= nEnum;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDoublePercentage( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM );
+ if ( eSrcUnit == MAP_RELATIVE )
+ {
+ rtl_math_ConversionStatus eStatus;
+ double fAttrDouble = ::rtl::math::stringToDouble( rValue,
+ (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+ if ( eStatus == rtl_math_ConversionStatus_Ok )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= fAttrDouble;
+ rDest.push_back( aProp );
+ }
+ }
+}
+
+void GetB3DVector( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ ::basegfx::B3DVector aB3DVector;
+ if ( SvXMLUnitConverter::convertB3DVector( aB3DVector, rValue ) )
+ {
+ drawing::Direction3D aDirection3D( aB3DVector.getX(), aB3DVector.getY(), aB3DVector.getZ() );
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aDirection3D;
+ rDest.push_back( aProp );
+ }
+}
+
+sal_Bool GetEquationName( const rtl::OUString& rEquation, const sal_Int32 nStart, rtl::OUString& rEquationName )
+{
+ sal_Int32 nIndex = nStart;
+ while( nIndex < rEquation.getLength() )
+ {
+ sal_Unicode nChar = rEquation[ nIndex ];
+ if (
+ ( ( nChar >= 'a' ) && ( nChar <= 'z' ) )
+ || ( ( nChar >= 'A' ) && ( nChar <= 'Z' ) )
+ || ( ( nChar >= '0' ) && ( nChar <= '9' ) )
+ )
+ {
+ nIndex++;
+ }
+ else
+ break;
+ }
+ sal_Bool bValid = ( nIndex - nStart ) != 0;
+ if ( bValid )
+ rEquationName = rEquation.copy( nStart, nIndex - nStart );
+ return bValid;
+}
+
+sal_Bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, sal_Int32& nIndex, const rtl::OUString& rParaString )
+{
+ if ( nIndex >= rParaString.getLength() )
+ return sal_False;
+
+ sal_Bool bValid = sal_True;
+ sal_Bool bNumberRequired = sal_True;
+ sal_Bool bMustBePositiveWholeNumbered = sal_False;
+
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL;
+ if ( rParaString[ nIndex ] == (sal_Unicode)'$' )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT;
+ bMustBePositiveWholeNumbered = sal_True;
+ nIndex++;
+ }
+ else if ( rParaString[ nIndex ] == (sal_Unicode)'?' )
+ {
+ nIndex++;
+ bNumberRequired = sal_False;
+ rtl::OUString aEquationName;
+ bValid = GetEquationName( rParaString, nIndex, aEquationName );
+ if ( bValid )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION;
+ rParameter.Value <<= aEquationName;
+ nIndex += aEquationName.getLength();
+ }
+ }
+ else if ( rParaString[ nIndex ] > (sal_Unicode)'9' )
+ {
+ bNumberRequired = sal_False;
+ if ( rParaString.matchIgnoreAsciiCaseAsciiL( "left", 4, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT;
+ nIndex += 4;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "top", 3, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP;
+ nIndex += 3;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "right", 5, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT;
+ nIndex += 5;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "bottom", 6, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM;
+ nIndex += 6;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "xstretch", 8, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH;
+ nIndex += 8;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "ystretch", 8, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH;
+ nIndex += 8;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasstroke", 9, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE;
+ nIndex += 9;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasfill", 7, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL;
+ nIndex += 7;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "width", 5, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH;
+ nIndex += 5;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "height", 6, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT;
+ nIndex += 6;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logwidth", 8, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH;
+ nIndex += 8;
+ }
+ else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logheight", 9, nIndex ) )
+ {
+ rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT;
+ nIndex += 9;
+ }
+ else
+ bValid = sal_False;
+ }
+ if ( bValid )
+ {
+ if ( bNumberRequired )
+ {
+ sal_Int32 nStartIndex = nIndex;
+
+ sal_Bool bM = sal_False; // set if the value is negative
+ sal_Bool bE = sal_False; // set if a double is including a "E" statement
+ sal_Bool bEM = sal_False; // set if a double is including a "E-"statement
+ sal_Bool bDot = sal_False; // set if there is a dot included
+ sal_Bool bEnd = sal_False; // set for each value that can not be part of a double/integer
+
+ while( ( nIndex < rParaString.getLength() ) && bValid )
+ {
+ switch( rParaString[ nIndex ] )
+ {
+ case '.' :
+ {
+ if ( bMustBePositiveWholeNumbered )
+ bValid = sal_False;
+ else
+ {
+ if ( bDot )
+ bValid = sal_False;
+ else
+ bDot = sal_True;
+ }
+ }
+ break;
+ case '-' :
+ {
+ if ( bMustBePositiveWholeNumbered )
+ bValid = sal_False;
+ else
+ {
+ if ( nStartIndex == nIndex )
+ bM = sal_True;
+ else if ( bE )
+ bEM = sal_True;
+ else
+ bValid = sal_False;
+ }
+ }
+ break;
+
+ case 'e' :
+ case 'E' :
+ {
+ if ( bMustBePositiveWholeNumbered )
+ bEnd = sal_True;
+ else
+ {
+ if ( !bE )
+ bE = sal_True;
+ else
+ bEnd = sal_True;
+ }
+ }
+ break;
+ case '0' :
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' :
+ break;
+ default:
+ bEnd = sal_True;
+ }
+ if ( !bEnd )
+ nIndex++;
+ else
+ break;
+ }
+ if ( nIndex == nStartIndex )
+ bValid = sal_False;
+ if ( bValid )
+ {
+ rtl::OUString aNumber( rParaString.copy( nStartIndex, nIndex - nStartIndex ) );
+ if ( bE || bDot )
+ {
+ double fAttrDouble;
+ if ( SvXMLUnitConverter::convertDouble( fAttrDouble, aNumber ) )
+ rParameter.Value <<= fAttrDouble;
+ else
+ bValid = sal_False;
+ }
+ else
+ {
+ sal_Int32 nValue;
+ if ( SvXMLUnitConverter::convertNumber( nValue, aNumber ) )
+ rParameter.Value <<= nValue;
+ else
+ bValid = sal_False;
+ }
+ }
+ }
+ }
+ if ( bValid )
+ { // skipping white spaces
+ while( ( nIndex < rParaString.getLength() ) && rParaString[ nIndex ] == (sal_Unicode)' ' )
+ nIndex++;
+ }
+ return bValid;
+}
+
+void GetPosition3D( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:extrusion-viewpoint
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp,
+ SvXMLUnitConverter& rUnitConverter )
+{
+ drawing::Position3D aPosition3D;
+ if ( rUnitConverter.convertPosition3D( aPosition3D, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aPosition3D;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< double > vDirection;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ double fAttrDouble;
+ rtl::OUString aToken( rValue.getToken( 0, ',', nIndex ) );
+ if ( !SvXMLUnitConverter::convertDouble( fAttrDouble, aToken ) )
+ break;
+ else
+ vDirection.push_back( fAttrDouble );
+ }
+ while ( nIndex >= 0 );
+
+ if ( !vDirection.empty() )
+ {
+ uno::Sequence< double > aDirectionsSeq( vDirection.size() );
+ std::vector< double >::const_iterator aIter = vDirection.begin();
+ std::vector< double >::const_iterator aEnd = vDirection.end();
+ double* pValues = aDirectionsSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aDirectionsSeq;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetEnhancedParameter( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Int32 nIndex = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aParameter;
+ if ( GetNextParameter( aParameter, nIndex, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aParameter;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetEnhancedParameterPair( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ sal_Int32 nIndex = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair;
+ if ( GetNextParameter( aParameterPair.First, nIndex, rValue )
+ && GetNextParameter( aParameterPair.Second, nIndex, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aParameterPair;
+ rDest.push_back( aProp );
+ }
+}
+
+sal_Int32 GetEnhancedParameterPairSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-points
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vParameter;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameter;
+
+ sal_Int32 nIndex = 0;
+ while ( GetNextParameter( aParameter.First, nIndex, rValue )
+ && GetNextParameter( aParameter.Second, nIndex, rValue ) )
+ {
+ vParameter.push_back( aParameter );
+ }
+ if ( !vParameter.empty() )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aParameterSeq( vParameter.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aIter = vParameter.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aEnd = vParameter.end();
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair* pValues = aParameterSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aParameterSeq;
+ rDest.push_back( aProp );
+ }
+ return vParameter.size();
+}
+
+void GetEnhancedRectangleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:text-areas
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame > vTextFrame;
+ com::sun::star::drawing::EnhancedCustomShapeTextFrame aParameter;
+
+ sal_Int32 nIndex = 0;
+
+ while ( GetNextParameter( aParameter.TopLeft.First, nIndex, rValue )
+ && GetNextParameter( aParameter.TopLeft.Second, nIndex, rValue )
+ && GetNextParameter( aParameter.BottomRight.First, nIndex, rValue )
+ && GetNextParameter( aParameter.BottomRight.Second, nIndex, rValue ) )
+ {
+ vTextFrame.push_back( aParameter );
+ }
+ if ( !vTextFrame.empty() )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrameSeq( vTextFrame.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aIter = vTextFrame.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aEnd = vTextFrame.end();
+ com::sun::star::drawing::EnhancedCustomShapeTextFrame* pValues = aTextFrameSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aTextFrameSeq;
+ rDest.push_back( aProp );
+ }
+}
+
+void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:enhanced-path
+ const rtl::OUString& rValue )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vCoordinates;
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment > vSegments;
+
+ sal_Int32 nIndex = 0;
+ sal_Int32 nParameterCount = 0;
+
+ sal_Int32 nParametersNeeded = 1;
+ sal_Int16 nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+
+ sal_Bool bValid = sal_True;
+
+ while( bValid && ( nIndex < rValue.getLength() ) )
+ {
+ switch( rValue[ nIndex ] )
+ {
+ case 'M' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'L' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'C' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
+ nParametersNeeded = 3;
+ nIndex++;
+ }
+ break;
+ case 'Z' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'N' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'F' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'S' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'T' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
+ nParametersNeeded = 3;
+ nIndex++;
+ }
+ break;
+ case 'U' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
+ nParametersNeeded = 3;
+ nIndex++;
+ }
+ break;
+ case 'A' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'B' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'W' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'V' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
+ nParametersNeeded = 4;
+ nIndex++;
+ }
+ break;
+ case 'X' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'Y' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
+ nParametersNeeded = 1;
+ nIndex++;
+ }
+ break;
+ case 'Q' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO;
+ nParametersNeeded = 2;
+ nIndex++;
+ }
+ break;
+ case ' ' :
+ {
+ nIndex++;
+ }
+ break;
+
+ case '$' :
+ case '?' :
+ case '0' :
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' :
+ case '.' :
+ case '-' :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair;
+ if ( GetNextParameter( aPair.First, nIndex, rValue ) &&
+ GetNextParameter( aPair.Second, nIndex, rValue ) )
+ {
+ vCoordinates.push_back( aPair );
+ nParameterCount++;
+ }
+ else
+ bValid = sal_False;
+ }
+ break;
+ default:
+ nIndex++;
+ break;
+ }
+ if ( !nParameterCount && !nParametersNeeded )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
+ aSegment.Command = nLatestSegmentCommand;
+ aSegment.Count = 0;
+ vSegments.push_back( aSegment );
+ nParametersNeeded = 0x7fffffff;
+ }
+ else if ( nParameterCount >= nParametersNeeded )
+ {
+ // check if the last command is identical,
+ // if so, we just need to increment the count
+ if ( !vSegments.empty() && ( vSegments[ vSegments.size() - 1 ].Command == nLatestSegmentCommand ) )
+ vSegments[ vSegments.size() -1 ].Count++;
+ else
+ {
+ com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
+ aSegment.Command = nLatestSegmentCommand;
+ aSegment.Count = 1;
+ vSegments.push_back( aSegment );
+ }
+ nParameterCount = 0;
+ }
+ }
+ // adding the Coordinates property
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > seqCoordinates( vCoordinates.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesIter = vCoordinates.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesEnd = vCoordinates.end();
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair* pCoordinateValues = seqCoordinates.getArray();
+
+ while ( aCoordinatesIter != aCoordinatesEnd )
+ *pCoordinateValues++ = *aCoordinatesIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_Coordinates );
+ aProp.Value <<= seqCoordinates;
+ rDest.push_back( aProp );
+
+
+ // adding the Segments property
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments( vSegments.size() );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsIter = vSegments.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsEnd = vSegments.end();
+ com::sun::star::drawing::EnhancedCustomShapeSegment* pSegmentValues = seqSegments.getArray();
+
+ while ( aSegmentsIter != aSegmentsEnd )
+ *pSegmentValues++ = *aSegmentsIter++;
+
+ aProp.Name = EASGet( EAS_Segments );
+ aProp.Value <<= seqSegments;
+ rDest.push_back( aProp );
+}
+
+void GetAdjustmentValues( std::vector< com::sun::star::beans::PropertyValue >& rDest, // draw:adjustments
+ const rtl::OUString& rValue )
+{
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > vAdjustmentValue;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aParameter;
+ sal_Int32 nIndex = 0;
+ while ( GetNextParameter( aParameter, nIndex, rValue ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue aAdj;
+ if ( aParameter.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL )
+ {
+ aAdj.Value <<= aParameter.Value;
+ aAdj.State = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ aAdj.State = beans::PropertyState_DEFAULT_VALUE; // this should not be, but better than setting nothing
+
+ vAdjustmentValue.push_back( aAdj );
+ }
+
+ sal_Int32 nAdjustmentValues = vAdjustmentValue.size();
+ if ( nAdjustmentValues )
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( nAdjustmentValues );
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aIter = vAdjustmentValue.begin();
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aEnd = vAdjustmentValue.end();
+ com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue* pValues = aAdjustmentValues.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_AdjustmentValues );
+ aProp.Value <<= aAdjustmentValues;
+ rDest.push_back( aProp );
+ }
+}
+
+void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ sal_Int16 nLength = xAttrList->getLength();
+ if ( nLength )
+ {
+ sal_Int32 nAttrNumber;
+ for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
+ {
+ rtl::OUString aLocalName;
+ const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ /* sven fixme, this must be checked! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
+
+ switch( EASGet( aLocalName ) )
+ {
+ case EAS_type :
+ GetString( mrCustomShapeGeometry, rValue, EAS_Type );
+ break;
+ case EAS_mirror_horizontal :
+ GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredX );
+ break;
+ case EAS_mirror_vertical :
+ GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredY );
+ break;
+ case EAS_viewBox :
+ {
+ SdXMLImExViewBox aViewBox( rValue, GetImport().GetMM100UnitConverter() );
+ awt::Rectangle aRect( aViewBox.GetX(), aViewBox.GetY(), aViewBox.GetWidth(), aViewBox.GetHeight() );
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ViewBox );
+ aProp.Value <<= aRect;
+ mrCustomShapeGeometry.push_back( aProp );
+ }
+ break;
+ case EAS_text_rotate_angle :
+ GetDouble( mrCustomShapeGeometry, rValue, EAS_TextRotateAngle );
+ break;
+ case EAS_extrusion_allowed :
+ GetBool( maPath, rValue, EAS_ExtrusionAllowed );
+ break;
+ case EAS_text_path_allowed :
+ GetBool( maPath, rValue, EAS_TextPathAllowed );
+ break;
+ case EAS_concentric_gradient_fill_allowed :
+ GetBool( maPath, rValue, EAS_ConcentricGradientFillAllowed );
+ break;
+ case EAS_extrusion :
+ GetBool( maExtrusion, rValue, EAS_Extrusion );
+ break;
+ case EAS_extrusion_brightness :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Brightness );
+ break;
+ case EAS_extrusion_depth :
+ {
+ sal_Int32 nIndex = 0;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair;
+ com::sun::star::drawing::EnhancedCustomShapeParameter& rDepth = aParameterPair.First;
+ com::sun::star::drawing::EnhancedCustomShapeParameter& rFraction = aParameterPair.Second;
+ if ( GetNextParameter( rDepth, nIndex, rValue ) )
+ {
+ // try to catch the unit for the depth
+ MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) );
+
+ rtl::OUStringBuffer aUnitStr;
+ double fFactor = SvXMLExportHelper::GetConversionFactor( aUnitStr, MAP_100TH_MM, eSrcUnit );
+ if ( ( fFactor != 1.0 ) && ( fFactor != 0.0 ) )
+ {
+ double fDepth;
+ if ( rDepth.Value >>= fDepth )
+ {
+ fDepth /= fFactor;
+ rDepth.Value <<= fDepth;
+ }
+ }
+ if ( rValue.matchIgnoreAsciiCase( rtl::OUString( aUnitStr ), nIndex ) )
+ nIndex += aUnitStr.getLength();
+
+ // skipping white spaces
+ while( ( nIndex < rValue.getLength() ) && rValue[ nIndex ] == (sal_Unicode)' ' )
+ nIndex++;
+
+ if ( GetNextParameter( rFraction, nIndex, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_Depth );
+ aProp.Value <<= aParameterPair;
+ maExtrusion.push_back( aProp );
+ }
+ }
+ }
+ break;
+ case EAS_extrusion_diffusion :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Diffusion );
+ break;
+ case EAS_extrusion_number_of_line_segments :
+ GetInt32( maExtrusion, rValue, EAS_NumberOfLineSegments );
+ break;
+ case EAS_extrusion_light_face :
+ GetBool( maExtrusion, rValue, EAS_LightFace );
+ break;
+ case EAS_extrusion_first_light_harsh :
+ GetBool( maExtrusion, rValue, EAS_FirstLightHarsh );
+ break;
+ case EAS_extrusion_second_light_harsh :
+ GetBool( maExtrusion, rValue, EAS_SecondLightHarsh );
+ break;
+ case EAS_extrusion_first_light_level :
+ GetDoublePercentage( maExtrusion, rValue, EAS_FirstLightLevel );
+ break;
+ case EAS_extrusion_second_light_level :
+ GetDoublePercentage( maExtrusion, rValue, EAS_SecondLightLevel );
+ break;
+ case EAS_extrusion_first_light_direction :
+ GetB3DVector( maExtrusion, rValue, EAS_FirstLightDirection );
+ break;
+ case EAS_extrusion_second_light_direction :
+ GetB3DVector( maExtrusion, rValue, EAS_SecondLightDirection );
+ break;
+ case EAS_extrusion_metal :
+ GetBool( maExtrusion, rValue, EAS_Metal );
+ break;
+ case EAS_shade_mode :
+ {
+ drawing::ShadeMode eShadeMode( drawing::ShadeMode_FLAT );
+ if( IsXMLToken( rValue, XML_PHONG ) )
+ eShadeMode = drawing::ShadeMode_PHONG;
+ else if ( IsXMLToken( rValue, XML_GOURAUD ) )
+ eShadeMode = drawing::ShadeMode_SMOOTH;
+ else if ( IsXMLToken( rValue, XML_DRAFT ) )
+ eShadeMode = drawing::ShadeMode_DRAFT;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ShadeMode );
+ aProp.Value <<= eShadeMode;
+ maExtrusion.push_back( aProp );
+ }
+ break;
+ case EAS_extrusion_rotation_angle :
+ GetEnhancedParameterPair( maExtrusion, rValue, EAS_RotateAngle );
+ break;
+ case EAS_extrusion_rotation_center :
+ GetB3DVector( maExtrusion, rValue, EAS_RotationCenter );
+ break;
+ case EAS_extrusion_shininess :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Shininess );
+ break;
+ case EAS_extrusion_skew :
+ GetEnhancedParameterPair( maExtrusion, rValue, EAS_Skew );
+ break;
+ case EAS_extrusion_specularity :
+ GetDoublePercentage( maExtrusion, rValue, EAS_Specularity );
+ break;
+ case EAS_projection :
+ {
+ drawing::ProjectionMode eProjectionMode( drawing::ProjectionMode_PERSPECTIVE );
+ if( IsXMLToken( rValue, XML_PARALLEL ) )
+ eProjectionMode = drawing::ProjectionMode_PARALLEL;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ProjectionMode );
+ aProp.Value <<= eProjectionMode;
+ maExtrusion.push_back( aProp );
+ }
+ break;
+ case EAS_extrusion_viewpoint :
+ GetPosition3D( maExtrusion, rValue, EAS_ViewPoint, mrUnitConverter );
+ break;
+ case EAS_extrusion_origin :
+ GetEnhancedParameterPair( maExtrusion, rValue, EAS_Origin );
+ break;
+ case EAS_extrusion_color :
+ GetBool( maExtrusion, rValue, EAS_Color );
+ break;
+ case EAS_enhanced_path :
+ GetEnhancedPath( maPath, rValue );
+ break;
+ case EAS_path_stretchpoint_x :
+ {
+ if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_StretchX );
+ aProp.Value <<= nAttrNumber;
+ maPath.push_back( aProp );
+ }
+ }
+ break;
+ case EAS_path_stretchpoint_y :
+ {
+ if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) )
+ {
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_StretchY );
+ aProp.Value <<= nAttrNumber;
+ maPath.push_back( aProp );
+ }
+ }
+ break;
+ case EAS_text_areas :
+ GetEnhancedRectangleSequence( maPath, rValue, EAS_TextFrames );
+ break;
+ case EAS_glue_points :
+ {
+ sal_Int32 i, nPairs = GetEnhancedParameterPairSequence( maPath, rValue, EAS_GluePoints );
+ GetImport().GetShapeImport()->moveGluePointMapping( mrxShape, nPairs );
+ for ( i = 0; i < nPairs; i++ )
+ GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 4, i + 4 );
+ }
+ break;
+ case EAS_glue_point_type :
+ GetEnum( maPath, rValue, EAS_GluePointType, *aXML_GluePointEnumMap );
+ break;
+ case EAS_glue_point_leaving_directions :
+ GetDoubleSequence( maPath, rValue, EAS_GluePointLeavingDirections );
+ break;
+ case EAS_text_path :
+ GetBool( maTextPath, rValue, EAS_TextPath );
+ break;
+ case EAS_text_path_mode :
+ {
+ com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode( com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL );
+ if( IsXMLToken( rValue, XML_PATH ) )
+ eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH;
+ else if ( IsXMLToken( rValue, XML_SHAPE ) )
+ eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE;
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_TextPathMode );
+ aProp.Value <<= eTextPathMode;
+ maTextPath.push_back( aProp );
+ }
+ break;
+ case EAS_text_path_scale :
+ {
+ sal_Bool bScaleX = IsXMLToken( rValue, XML_SHAPE );
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( EAS_ScaleX );
+ aProp.Value <<= bScaleX;
+ maTextPath.push_back( aProp );
+ }
+ break;
+ case EAS_text_path_same_letter_heights :
+ GetBool( maTextPath, rValue, EAS_SameLetterHeights );
+ break;
+ case EAS_modifiers :
+ GetAdjustmentValues( mrCustomShapeGeometry, rValue );
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
+ const std::vector< beans::PropertyValues >& rElement,
+ const rtl::OUString& rElementName )
+{
+ if ( !rElement.empty() )
+ {
+ uno::Sequence< beans::PropertyValues > aPropSeq( rElement.size() );
+ std::vector< beans::PropertyValues >::const_iterator aIter = rElement.begin();
+ std::vector< beans::PropertyValues >::const_iterator aEnd = rElement.end();
+ beans::PropertyValues* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = rElementName;
+ aProp.Value <<= aPropSeq;
+ rPropVec.push_back( aProp );
+ }
+}
+
+void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
+ const std::vector< rtl::OUString >& rElement,
+ const rtl::OUString& rElementName )
+{
+ if ( !rElement.empty() )
+ {
+ uno::Sequence< rtl::OUString > aPropSeq( rElement.size() );
+ std::vector< rtl::OUString >::const_iterator aIter = rElement.begin();
+ std::vector< rtl::OUString >::const_iterator aEnd = rElement.end();
+ rtl::OUString* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = rElementName;
+ aProp.Value <<= aPropSeq;
+ rPropVec.push_back( aProp );
+ }
+}
+
+void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
+ const std::vector< com::sun::star::beans::PropertyValue >& rElement,
+ const rtl::OUString& rElementName )
+{
+ if ( !rElement.empty() )
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq( rElement.size() );
+ std::vector< beans::PropertyValue >::const_iterator aIter = rElement.begin();
+ std::vector< beans::PropertyValue >::const_iterator aEnd = rElement.end();
+ beans::PropertyValue* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ beans::PropertyValue aProp;
+ aProp.Name = rElementName;
+ aProp.Value <<= aPropSeq;
+ rPropVec.push_back( aProp );
+ }
+}
+
+typedef std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash, OUStringEqFunc> EquationHashMap;
+
+/* if rPara.Type is from type EnhancedCustomShapeParameterType::EQUATION, the name of the equation
+ will be converted from rtl::OUString to index */
+void CheckAndResolveEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rPara, EquationHashMap* pH )
+{
+ if ( rPara.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION )
+ {
+ rtl::OUString aEquationName;
+ if ( rPara.Value >>= aEquationName )
+ {
+ sal_Int32 nIndex = 0;
+ EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
+ if ( aHashIter != pH->end() )
+ nIndex = (*aHashIter).second;
+ rPara.Value <<= nIndex;
+ }
+ }
+}
+
+void XMLEnhancedCustomShapeContext::EndElement()
+{
+ // resolve properties that are indexing a Equation
+ if ( !maEquations.empty() )
+ {
+ // creating hash map containing the name and index of each equation
+ EquationHashMap* pH = new EquationHashMap;
+ std::vector< rtl::OUString >::iterator aEquationNameIter = maEquationNames.begin();
+ std::vector< rtl::OUString >::iterator aEquationNameEnd = maEquationNames.end();
+ while( aEquationNameIter != aEquationNameEnd )
+ {
+ (*pH)[ *aEquationNameIter ] = (sal_Int32)( aEquationNameIter - maEquationNames.begin() );
+ aEquationNameIter++;
+ }
+
+ // resolve equation
+ std::vector< rtl::OUString >::iterator aEquationIter = maEquations.begin();
+ std::vector< rtl::OUString >::iterator aEquationEnd = maEquations.end();
+ while( aEquationIter != aEquationEnd )
+ {
+ sal_Int32 nIndexOf = 0;
+ do
+ {
+ nIndexOf = aEquationIter->indexOf( '?', nIndexOf );
+ if ( nIndexOf != -1 )
+ {
+ rtl::OUString aEquationName;
+ if ( GetEquationName( *aEquationIter, nIndexOf + 1, aEquationName ) )
+ {
+ // copying first characters inclusive '?'
+ rtl::OUString aNew( aEquationIter->copy( 0, nIndexOf + 1 ) );
+ sal_Int32 nIndex = 0;
+ EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
+ if ( aHashIter != pH->end() )
+ nIndex = (*aHashIter).second;
+ aNew += rtl::OUString::valueOf( nIndex );
+ aNew += aEquationIter->copy( nIndexOf + aEquationName.getLength() + 1 );
+ *aEquationIter = aNew;
+ }
+ nIndexOf++;
+ }
+ }
+ while( nIndexOf != -1 );
+ aEquationIter++;
+ }
+
+ // Path
+ sal_Int32 i;
+ std::vector< beans::PropertyValue >::iterator aPathIter = maPath.begin();
+ std::vector< beans::PropertyValue >::iterator aPathEnd = maPath.end();
+ while ( aPathIter != aPathEnd )
+ {
+ switch( EASGet( aPathIter->Name ) )
+ {
+ case EAS_Coordinates :
+ case EAS_GluePoints :
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rSeq =
+ *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >*)
+ aPathIter->Value.getValue());
+ for ( i = 0; i < rSeq.getLength(); i++ )
+ {
+ CheckAndResolveEquationParameter( rSeq[ i ].First, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].Second, pH );
+ }
+ }
+ break;
+ case EAS_TextFrames :
+ {
+ uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >& rSeq =
+ *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >*)
+ aPathIter->Value.getValue());
+ for ( i = 0; i < rSeq.getLength(); i++ )
+ {
+ CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.First, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.Second, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.First, pH );
+ CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.Second, pH );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ aPathIter++;
+ }
+ std::vector< beans::PropertyValues >::iterator aHandleIter = maHandles.begin();
+ std::vector< beans::PropertyValues >::iterator aHandleEnd = maHandles.end();
+ while ( aHandleIter != aHandleEnd )
+ {
+ beans::PropertyValue* pValues = aHandleIter->getArray();
+ for ( i = 0; i < aHandleIter->getLength(); i++ )
+ {
+ switch( EASGet( pValues->Name ) )
+ {
+ case EAS_Position :
+ case EAS_RangeYMinimum :
+ case EAS_RangeYMaximum :
+ case EAS_RangeXMinimum :
+ case EAS_RangeXMaximum :
+ case EAS_RadiusRangeMinimum :
+ case EAS_RadiusRangeMaximum :
+ {
+ CheckAndResolveEquationParameter( *((com::sun::star::drawing::EnhancedCustomShapeParameter*)
+ pValues->Value.getValue()), pH );
+ }
+ break;
+ case EAS_Polar :
+ {
+ CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*)
+ pValues->Value.getValue())).First, pH );
+ CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*)
+ pValues->Value.getValue())).Second, pH );
+ }
+ break;
+ default:
+ break;
+ }
+ pValues++;
+ }
+ aHandleIter++;
+ }
+ delete pH;
+ }
+
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) );
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maPath, EASGet( EAS_Path ) );
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maTextPath, EASGet( EAS_TextPath ) );
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maEquations, EASGet( EAS_Equations ) );
+ if ( !maHandles.empty() )
+ SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maHandles, EASGet( EAS_Handles ) );
+}
+
+SvXMLImportContext* XMLEnhancedCustomShapeContext::CreateChildContext( USHORT nPrefix,const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList> & xAttrList )
+{
+ EnhancedCustomShapeTokenEnum aTokenEnum = EASGet( rLocalName );
+ if ( aTokenEnum == EAS_equation )
+ {
+ sal_Int16 nLength = xAttrList->getLength();
+ if ( nLength )
+ {
+ rtl::OUString aFormula;
+ rtl::OUString aFormulaName;
+ for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
+ {
+ rtl::OUString aLocalName;
+ const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
+
+ switch( EASGet( aLocalName ) )
+ {
+ case EAS_formula :
+ aFormula = rValue;
+ break;
+ case EAS_name :
+ aFormulaName = rValue;
+ break;
+ default:
+ break;
+ }
+ }
+ if ( aFormulaName.getLength() || aFormula.getLength() )
+ {
+ maEquations.push_back( aFormula );
+ maEquationNames.push_back( aFormulaName );
+ }
+ }
+ }
+ else if ( aTokenEnum == EAS_handle )
+ {
+ std::vector< com::sun::star::beans::PropertyValue > aHandle;
+ const sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
+ {
+ rtl::OUString aLocalName;
+ const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
+ /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
+ switch( EASGet( aLocalName ) )
+ {
+ case EAS_handle_mirror_vertical :
+ GetBool( aHandle, rValue, EAS_MirroredY );
+ break;
+ case EAS_handle_mirror_horizontal :
+ GetBool( aHandle, rValue, EAS_MirroredX );
+ break;
+ case EAS_handle_switched :
+ GetBool( aHandle, rValue, EAS_Switched );
+ break;
+ case EAS_handle_position :
+ GetEnhancedParameterPair( aHandle, rValue, EAS_Position );
+ break;
+ case EAS_handle_range_x_minimum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeXMinimum );
+ break;
+ case EAS_handle_range_x_maximum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeXMaximum );
+ break;
+ case EAS_handle_range_y_minimum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeYMinimum );
+ break;
+ case EAS_handle_range_y_maximum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RangeYMaximum );
+ break;
+ case EAS_handle_polar :
+ GetEnhancedParameterPair( aHandle, rValue, EAS_Polar );
+ break;
+ case EAS_handle_radius_range_minimum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMinimum );
+ break;
+ case EAS_handle_radius_range_maximum :
+ GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMaximum );
+ break;
+ default:
+ break;
+ }
+ }
+ beans::PropertyValues aPropSeq( aHandle.size() );
+ std::vector< beans::PropertyValue >::const_iterator aIter = aHandle.begin();
+ std::vector< beans::PropertyValue >::const_iterator aEnd = aHandle.end();
+ beans::PropertyValue* pValues = aPropSeq.getArray();
+
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ maHandles.push_back( aPropSeq );
+ }
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+}
diff --git a/xmloff/source/draw/ximpcustomshape.hxx b/xmloff/source/draw/ximpcustomshape.hxx
new file mode 100644
index 000000000000..8cb742838151
--- /dev/null
+++ b/xmloff/source/draw/ximpcustomshape.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XIMPCUSTOMSHAPE_HXX_
+#define _XMLOFF_XIMPCUSTOMSHAPE_HXX_
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#ifndef __com_sun_star_beans_PropertyValues_hpp__
+#include <com/sun/star/beans/PropertyValues.hpp>
+#endif
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XIndexContainer; }
+ namespace beans { class XPropertySet; }
+ namespace xml { namespace sax { class XAttributeList; } }
+} } }
+
+class SdXMLCustomShapeContext;
+class XMLEnhancedCustomShapeContext : public SvXMLImportContext
+{
+ SvXMLUnitConverter& mrUnitConverter;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& mrxShape;
+ std::vector< com::sun::star::beans::PropertyValue >& mrCustomShapeGeometry;
+
+ std::vector< com::sun::star::beans::PropertyValue > maExtrusion;
+ std::vector< com::sun::star::beans::PropertyValue > maPath;
+ std::vector< com::sun::star::beans::PropertyValue > maTextPath;
+ std::vector< com::sun::star::beans::PropertyValues > maHandles;
+ std::vector< rtl::OUString > maEquations;
+ std::vector< rtl::OUString > maEquationNames;
+
+public:
+
+ TYPEINFO();
+
+ XMLEnhancedCustomShapeContext( SvXMLImport& rImport, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName, std::vector< com::sun::star::beans::PropertyValue >& rCustomShapeGeometry );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ SvXMLImportContext *CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
+};
+
+#endif
diff --git a/xmloff/source/draw/ximpgrp.cxx b/xmloff/source/draw/ximpgrp.cxx
new file mode 100644
index 000000000000..8d88b77515e1
--- /dev/null
+++ b/xmloff/source/draw/ximpgrp.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include"xmlnmspe.hxx"
+#include "ximpgrp.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "ximpshap.hxx"
+#include "eventimp.hxx"
+#include "descriptionimp.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLGroupShapeContext, SvXMLImportContext );
+
+SdXMLGroupShapeContext::SdXMLGroupShapeContext(
+ SvXMLImport& rImport,
+ USHORT nPrfx, const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0L;
+
+ // #i68101#
+ if( nPrefix == XML_NAMESPACE_SVG &&
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
+ {
+ addGluePoint( xAttrList );
+ }
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxChilds);
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(
+ nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ // create new group shape and add it to rShapes, use it
+ // as base for the new group import
+ AddShape( "com.sun.star.drawing.GroupShape" );
+
+ if(mxShape.is())
+ {
+ SetStyle( false );
+
+ mxChilds = uno::Reference< drawing::XShapes >::query( mxShape );
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->pushGroupForSorting( mxChilds );
+ }
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGroupShapeContext::EndElement()
+{
+ if( mxChilds.is() )
+ GetImport().GetShapeImport()->popGroupAndSort();
+
+ SdXMLShapeContext::EndElement();
+}
+
+
diff --git a/xmloff/source/draw/ximpgrp.hxx b/xmloff/source/draw/ximpgrp.hxx
new file mode 100644
index 000000000000..1b4d0f043816
--- /dev/null
+++ b/xmloff/source/draw/ximpgrp.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPGROUP_HXX
+#define _XIMPGROUP_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:g context (RECURSIVE)
+
+class SdXMLGroupShapeContext : public SdXMLShapeContext
+{
+ // the shape group this group is working on
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxChilds;
+
+protected:
+ void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew)
+ { mxShapes = rNew; }
+
+public:
+ TYPEINFO();
+
+ SdXMLGroupShapeContext( SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLGroupShapeContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const
+ { return mxShapes; }
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext()
+ { return mxShapes; }
+};
+
+
+#endif // _XIMPGROUP_HXX
diff --git a/xmloff/source/draw/ximplink.cxx b/xmloff/source/draw/ximplink.cxx
new file mode 100644
index 000000000000..223b320e4f79
--- /dev/null
+++ b/xmloff/source/draw/ximplink.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include"xmlnmspe.hxx"
+#include "ximplink.hxx"
+#include <xmloff/xmltoken.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLShapeLinkContext, SvXMLImportContext );
+
+SdXMLShapeLinkContext::SdXMLShapeLinkContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes)
+: SvXMLShapeContext( rImport, nPrfx, rLocalName, false )
+, mxParent( rShapes )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ USHORT nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ msHyperlink = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLShapeLinkContext::~SdXMLShapeLinkContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLShapeLinkContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLShapeContext* pContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nPrefix, rLocalName, xAttrList, mxParent);
+
+ if( pContext )
+ {
+ pContext->setHyperlink( msHyperlink );
+ return pContext;
+ }
+
+ // call parent when no own context was created
+ return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeLinkContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttr )
+{
+ SvXMLImportContext::StartElement( xAttr );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeLinkContext::EndElement()
+{
+ SvXMLImportContext::EndElement();
+}
+
+
diff --git a/xmloff/source/draw/ximplink.hxx b/xmloff/source/draw/ximplink.hxx
new file mode 100644
index 000000000000..473ad0ce712a
--- /dev/null
+++ b/xmloff/source/draw/ximplink.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPLINK_HXX
+#define _XIMPLINK_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <tools/rtti.hxx>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:a context
+
+// this should have been a SvXMLImportContext but CreateGroupChildContext() returns
+// an unneeded derivation. Should be changed sometime during refactoring.
+
+class SdXMLShapeLinkContext : public SvXMLShapeContext
+{
+ // the parent shape group this link is placed in
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxParent;
+ rtl::OUString msHyperlink;
+
+public:
+ TYPEINFO();
+
+ SdXMLShapeLinkContext( SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLShapeLinkContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+};
+
+
+#endif // _XIMPLINK_HXX
diff --git a/xmloff/source/draw/ximpnote.cxx b/xmloff/source/draw/ximpnote.cxx
new file mode 100644
index 000000000000..43469ddf0f91
--- /dev/null
+++ b/xmloff/source/draw/ximpnote.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "ximpnote.hxx"
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
+ USHORT nPrfx, const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
+{
+ OUString sStyleName;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
+ {
+ msPageMasterName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_STYLE_NAME:
+ {
+ sStyleName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
+ {
+ maUseHeaderDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
+ {
+ maUseFooterDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
+ {
+ maUseDateTimeDeclName = sValue;
+ break;
+ }
+
+ }
+ }
+
+ SetStyle( sStyleName );
+
+ // now delete all up-to-now contained shapes from this notes page
+ uno::Reference< drawing::XShape > xShape;
+ while(rShapes->getCount())
+ {
+ rShapes->getByIndex(0L) >>= xShape;
+ if(xShape.is())
+ rShapes->remove(xShape);
+ }
+
+ // set page-master?
+ if(msPageMasterName.getLength())
+ {
+ SetPageMaster( msPageMasterName );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLNotesContext::~SdXMLNotesContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLNotesContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ // OK, notes page is set on base class, objects can be imported on notes page
+ SvXMLImportContext *pContext = 0L;
+
+ // some special objects inside presentation:notes context
+ // ...
+
+
+
+
+
+
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLNotesContext::EndElement()
+{
+ SdXMLGenericPageContext::EndElement();
+}
diff --git a/xmloff/source/draw/ximpnote.hxx b/xmloff/source/draw/ximpnote.hxx
new file mode 100644
index 000000000000..ca5f01acdd83
--- /dev/null
+++ b/xmloff/source/draw/ximpnote.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPNOTES_HXX
+#define _XIMPNOTES_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include "ximppage.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// presentation:notes context
+
+class SdXMLNotesContext : public SdXMLGenericPageContext
+{
+private:
+ rtl::OUString msPageMasterName;
+
+public:
+ SdXMLNotesContext( SdXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLNotesContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+};
+
+
+#endif // _XIMPNOTES_HXX
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
new file mode 100644
index 000000000000..6c715b5ad77a
--- /dev/null
+++ b/xmloff/source/draw/ximppage.cxx
@@ -0,0 +1,647 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "XMLNumberStylesImport.hxx"
+#include <xmloff/xmlstyle.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlstyle.hxx>
+#include "xmlnmspe.hxx"
+#include "ximppage.hxx"
+#include "ximpshap.hxx"
+#include "animimp.hxx"
+#include "XMLStringBufferImportContext.hxx"
+#include <xmloff/formsimp.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include "ximpstyl.hxx"
+#include <xmloff/prstylei.hxx>
+#include "PropertySetMerger.hxx"
+
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/xmluconv.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::office;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::geometry;
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class DrawAnnotationContext : public SvXMLImportContext
+{
+
+public:
+ DrawAnnotationContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess );
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+private:
+ Reference< XAnnotation > mxAnnotation;
+ Reference< XTextCursor > mxCursor;
+
+ OUStringBuffer maAuthorBuffer;
+ OUStringBuffer maDateBuffer;
+};
+
+DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess )
+: SvXMLImportContext( rImport, nPrfx, rLocalName )
+, mxAnnotation( xAnnotationAccess->createAndInsertAnnotation() )
+{
+ if( mxAnnotation.is() )
+ {
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ RealPoint2D aPosition;
+ RealSize2D aSize;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sValue( xAttrList->getValueByIndex( i ) );
+ OUString sAttrName( xAttrList->getNameByIndex( i ) );
+ OUString aLocalName;
+ switch( GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ) )
+ {
+ case XML_NAMESPACE_SVG:
+ if( IsXMLToken( aLocalName, XML_X ) )
+ {
+ sal_Int32 x;
+ GetImport().GetMM100UnitConverter().convertMeasure(x, sValue);
+ aPosition.X = static_cast<double>(x) / 100.0;
+ }
+ else if( IsXMLToken( aLocalName, XML_Y ) )
+ {
+ sal_Int32 y;
+ GetImport().GetMM100UnitConverter().convertMeasure(y, sValue);
+ aPosition.Y = static_cast<double>(y) / 100.0;
+ }
+ else if( IsXMLToken( aLocalName, XML_WIDTH ) )
+ {
+ sal_Int32 w;
+ GetImport().GetMM100UnitConverter().convertMeasure(w, sValue);
+ aSize.Width = static_cast<double>(w) / 100.0;
+ }
+ else if( IsXMLToken( aLocalName, XML_HEIGHT ) )
+ {
+ sal_Int32 h;
+ GetImport().GetMM100UnitConverter().convertMeasure(h, sValue);
+ aSize.Height = static_cast<double>(h) / 100.0;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ mxAnnotation->setPosition( aPosition );
+ mxAnnotation->setSize( aSize );
+ }
+}
+
+SvXMLImportContext * DrawAnnotationContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+{
+ SvXMLImportContext * pContext = NULL;
+
+ if( mxAnnotation.is() )
+ {
+ if( XML_NAMESPACE_DC == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CREATOR ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maAuthorBuffer);
+ else if( IsXMLToken( rLocalName, XML_DATE ) )
+ pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer);
+ }
+ else
+ {
+ // create text cursor on demand
+ if( !mxCursor.is() )
+ {
+ uno::Reference< text::XText > xText( mxAnnotation->getTextRange() );
+ if( xText.is() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
+ mxCursor = xText->createTextCursor();
+ if( mxCursor.is() )
+ xTxtImport->SetCursor( mxCursor );
+ }
+ }
+
+ // if we have a text cursor, lets try to import some text
+ if( mxCursor.is() )
+ {
+ pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+ }
+
+ // call parent for content
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+void DrawAnnotationContext::EndElement()
+{
+ if(mxCursor.is())
+ {
+ // delete addition newline
+ const OUString aEmpty;
+ mxCursor->gotoEnd( sal_False );
+ mxCursor->goLeft( 1, sal_True );
+ mxCursor->setString( aEmpty );
+
+ // reset cursor
+ GetImport().GetTextImport()->ResetCursor();
+ }
+
+ if( mxAnnotation.is() )
+ {
+ mxAnnotation->setAuthor( maAuthorBuffer.makeStringAndClear() );
+
+ DateTime aDateTime;
+ if(SvXMLUnitConverter::convertDateTime(aDateTime, maDateBuffer.makeStringAndClear()))
+ mxAnnotation->setDateTime(aDateTime);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLGenericPageContext, SvXMLImportContext );
+
+SdXMLGenericPageContext::SdXMLGenericPageContext(
+ SvXMLImport& rImport,
+ USHORT nPrfx, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList>& xAttrList,
+ Reference< drawing::XShapes >& rShapes)
+: SvXMLImportContext( rImport, nPrfx, rLocalName )
+, mxShapes( rShapes )
+, mxAnnotationAccess( rShapes, UNO_QUERY )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ USHORT nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if( (nPrefix == XML_NAMESPACE_DRAW) && IsXMLToken( aLocalName, XML_NAV_ORDER ) )
+ {
+ msNavOrder = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLGenericPageContext::~SdXMLGenericPageContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGenericPageContext::StartElement( const Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ GetImport().GetShapeImport()->pushGroupForSorting( mxShapes );
+
+ if( GetImport().IsFormsSupported() )
+ GetImport().GetFormImport()->startPage( Reference< drawing::XDrawPage >::query( mxShapes ) );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLGenericPageContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0L;
+
+ if( nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_ANIMATIONS ) )
+ {
+ pContext = new XMLAnimationsContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_FORMS ) )
+ {
+ if( GetImport().IsFormsSupported() )
+ pContext = GetImport().GetFormImport()->createOfficeFormsContext( GetImport(), nPrefix, rLocalName );
+ }
+ else if( ((nPrefix == XML_NAMESPACE_OFFICE) || (nPrefix == XML_NAMESPACE_OFFICE_EXT)) && IsXMLToken( rLocalName, XML_ANNOTATION ) )
+ {
+ if( mxAnnotationAccess.is() )
+ pContext = new DrawAnnotationContext( GetImport(), nPrefix, rLocalName, xAttrList, mxAnnotationAccess );
+ }
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxShapes);
+ }
+
+ // call parent when no own context was created
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGenericPageContext::EndElement()
+{
+ GetImport().GetShapeImport()->popGroupAndSort();
+
+ if( GetImport().IsFormsSupported() )
+ GetImport().GetFormImport()->endPage();
+
+ if( maUseHeaderDeclName.getLength() || maUseFooterDeclName.getLength() || maUseDateTimeDeclName.getLength() )
+ {
+ try
+ {
+ Reference <beans::XPropertySet> xSet(mxShapes, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+
+ if( maUseHeaderDeclName.getLength() )
+ {
+ const OUString aStrHeaderTextProp( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) );
+ if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
+ xSet->setPropertyValue( aStrHeaderTextProp,
+ makeAny( GetSdImport().GetHeaderDecl( maUseHeaderDeclName ) ) );
+ }
+
+ if( maUseFooterDeclName.getLength() )
+ {
+ const OUString aStrFooterTextProp( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) );
+ if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
+ xSet->setPropertyValue( aStrFooterTextProp,
+ makeAny( GetSdImport().GetFooterDecl( maUseFooterDeclName ) ) );
+ }
+
+ if( maUseDateTimeDeclName.getLength() )
+ {
+ const OUString aStrDateTimeTextProp( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) );
+ if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
+ {
+ sal_Bool bFixed;
+ OUString aDateTimeFormat;
+ const OUString aText( GetSdImport().GetDateTimeDecl( maUseDateTimeDeclName, bFixed, aDateTimeFormat ) );
+
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("IsDateTimeFixed") ),
+ makeAny( bFixed ) );
+
+ if( bFixed )
+ {
+ xSet->setPropertyValue( aStrDateTimeTextProp, makeAny( aText ) );
+ }
+ else if( aDateTimeFormat.getLength() )
+ {
+ const SdXMLStylesContext* pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetStylesContext() );
+ if( !pStyles )
+ pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetAutoStylesContext() );
+
+ if( pStyles )
+ {
+ const SdXMLNumberFormatImportContext* pSdNumStyle =
+ dynamic_cast< const SdXMLNumberFormatImportContext* >( pStyles->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, aDateTimeFormat, sal_True ) );
+
+ if( pSdNumStyle )
+ {
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("DateTimeFormat") ),
+ makeAny( pSdNumStyle->GetDrawKey() ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("xmloff::SdXMLGenericPageContext::EndElement(), unexpected exception cought!");
+ }
+ }
+
+ SetNavigationOrder();
+}
+
+void SdXMLGenericPageContext::SetStyle( rtl::OUString& rStyleName )
+{
+ // set PageProperties?
+ if(rStyleName.getLength())
+ {
+ try
+ {
+ const SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetAutoStylesContext();
+
+ if( pContext && pContext->ISA( SvXMLStyleContext ) )
+ {
+ const SdXMLStylesContext* pStyles = (SdXMLStylesContext*)pContext;
+ if(pStyles)
+ {
+ const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, rStyleName);
+
+ if(pStyle && pStyle->ISA(XMLPropStyleContext))
+ {
+ XMLPropStyleContext* pPropStyle = (XMLPropStyleContext*)pStyle;
+
+ Reference <beans::XPropertySet> xPropSet1(mxShapes, uno::UNO_QUERY);
+ if(xPropSet1.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( xPropSet1 );
+ Reference< beans::XPropertySet > xBackgroundSet;
+
+ const OUString aBackground(RTL_CONSTASCII_USTRINGPARAM("Background"));
+ if( xPropSet1->getPropertySetInfo()->hasPropertyByName( aBackground ) )
+ {
+ Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact(GetSdImport().GetModel(), uno::UNO_QUERY);
+ if(xServiceFact.is())
+ {
+ xBackgroundSet = Reference< beans::XPropertySet >::query(
+ xServiceFact->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Background"))));
+ }
+ }
+
+ if( xBackgroundSet.is() )
+ xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xBackgroundSet );
+ }
+
+ if(xPropSet.is())
+ {
+ pPropStyle->FillPropertySet(xPropSet);
+
+ if( xBackgroundSet.is() )
+ xPropSet1->setPropertyValue( aBackground, uno::makeAny( xBackgroundSet ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception )
+ {
+ DBG_ERROR( "SdXMLGenericPageContext::SetStyle(): uno::Exception catched!" );
+ }
+ }
+}
+
+void SdXMLGenericPageContext::SetLayout()
+{
+ // set PresentationPageLayout?
+ if(GetSdImport().IsImpress() && maPageLayoutName.getLength())
+ {
+ sal_Int32 nType = -1;
+
+ const SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
+
+ if( pContext && pContext->ISA( SvXMLStyleContext ) )
+ {
+ const SdXMLStylesContext* pStyles = (SdXMLStylesContext*)pContext;
+ if(pStyles)
+ {
+ const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext( XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID, maPageLayoutName);
+
+ if(pStyle && pStyle->ISA(SdXMLPresentationPageLayoutContext))
+ {
+ SdXMLPresentationPageLayoutContext* pLayout = (SdXMLPresentationPageLayoutContext*)pStyle;
+ nType = pLayout->GetTypeId();
+ }
+ }
+
+ }
+ if( -1 == nType )
+ {
+ Reference< container::XNameAccess > xPageLayouts( GetSdImport().getPageLayouts() );
+ if( xPageLayouts.is() )
+ {
+ if( xPageLayouts->hasByName( maPageLayoutName ) )
+ xPageLayouts->getByName( maPageLayoutName ) >>= nType;
+ }
+
+ }
+
+ if( -1 != nType )
+ {
+ Reference <beans::XPropertySet> xPropSet(mxShapes, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("Layout"));
+ Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aPropName ) )
+ xPropSet->setPropertyValue(aPropName, uno::makeAny( (sal_Int16)nType ) );
+ }
+ }
+ }
+}
+
+void SdXMLGenericPageContext::DeleteAllShapes()
+{
+ // now delete all up-to-now contained shapes; they have been created
+ // when setting the presentation page layout.
+ while(mxShapes->getCount())
+ {
+ Reference< drawing::XShape > xShape;
+ uno::Any aAny(mxShapes->getByIndex(0L));
+
+ aAny >>= xShape;
+
+ if(xShape.is())
+ {
+ mxShapes->remove(xShape);
+ }
+ }
+}
+
+void SdXMLGenericPageContext::SetPageMaster( OUString& rsPageMasterName )
+{
+ if( GetSdImport().GetShapeImport()->GetStylesContext() )
+ {
+ // look for PageMaster with this name
+
+ // #80012# GetStylesContext() replaced with GetAutoStylesContext()
+ const SvXMLStylesContext* pAutoStyles = GetSdImport().GetShapeImport()->GetAutoStylesContext();
+
+ const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID, rsPageMasterName) : NULL;
+
+ if(pStyle && pStyle->ISA(SdXMLPageMasterContext))
+ {
+ const SdXMLPageMasterContext* pPageMaster = (SdXMLPageMasterContext*)pStyle;
+ const SdXMLPageMasterStyleContext* pPageMasterContext = pPageMaster->GetPageMasterStyle();
+
+ if(pPageMasterContext)
+ {
+ Reference< drawing::XDrawPage > xMasterPage(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xMasterPage.is())
+ {
+ // set sizes for this masterpage
+ Reference <beans::XPropertySet> xPropSet(xMasterPage, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Any aAny;
+
+ aAny <<= pPageMasterContext->GetBorderBottom();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")), aAny);
+
+ aAny <<= pPageMasterContext->GetBorderLeft();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")), aAny);
+
+ aAny <<= pPageMasterContext->GetBorderRight();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")), aAny);
+
+ aAny <<= pPageMasterContext->GetBorderTop();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")), aAny);
+
+ aAny <<= pPageMasterContext->GetWidth();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Width")), aAny);
+
+ aAny <<= pPageMasterContext->GetHeight();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Height")), aAny);
+
+ aAny <<= pPageMasterContext->GetOrientation();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")), aAny);
+ }
+ }
+ }
+ }
+
+ }
+}
+
+class NavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
+{
+public:
+ NavigationOrderAccess( std::vector< Reference< XShape > >& rShapes );
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (RuntimeException);
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
+
+private:
+ std::vector< Reference< XShape > > maShapes;
+};
+
+NavigationOrderAccess::NavigationOrderAccess( std::vector< Reference< XShape > >& rShapes )
+{
+ maShapes.swap( rShapes );
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL NavigationOrderAccess::getCount( ) throw (RuntimeException)
+{
+ return static_cast< sal_Int32 >( maShapes.size() );
+}
+
+Any SAL_CALL NavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ if( (Index < 0) || (Index > getCount()) )
+ throw IndexOutOfBoundsException();
+
+ return Any( maShapes[Index] );
+}
+
+// XElementAccess
+Type SAL_CALL NavigationOrderAccess::getElementType( ) throw (RuntimeException)
+{
+ return XShape::static_type();
+}
+
+sal_Bool SAL_CALL NavigationOrderAccess::hasElements( ) throw (RuntimeException)
+{
+ return maShapes.empty() ? sal_False : sal_True;
+}
+
+void SdXMLGenericPageContext::SetNavigationOrder()
+{
+ if( msNavOrder.getLength() != 0 ) try
+ {
+ sal_uInt32 nIndex;
+ const sal_uInt32 nCount = static_cast< sal_uInt32 >( mxShapes->getCount() );
+ std::vector< Reference< XShape > > aShapes( nCount );
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper& rIdMapper = GetSdImport().getInterfaceToIdentifierMapper();
+ SvXMLTokenEnumerator aEnumerator( msNavOrder );
+ OUString sId;
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ if( !aEnumerator.getNextToken(sId) )
+ break;
+
+ aShapes[nIndex] = Reference< XShape >( rIdMapper.getReference( sId ), UNO_QUERY );
+ }
+
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ if( !aShapes[nIndex].is() )
+ {
+ DBG_ERROR("xmloff::SdXMLGenericPageContext::SetNavigationOrder(), draw:nav-order attribute incomplete!");
+ // todo: warning?
+ return;
+ }
+ }
+
+ Reference< XPropertySet > xSet( mxShapes, UNO_QUERY_THROW );
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ), Any( Reference< XIndexAccess >( new NavigationOrderAccess( aShapes ) ) ) );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR("xmloff::SdXMLGenericPageContext::SetNavigationOrder(), unexpected exception cought while importing shape navigation order!");
+ }
+}
diff --git a/xmloff/source/draw/ximppage.hxx b/xmloff/source/draw/ximppage.hxx
new file mode 100644
index 000000000000..8a3bff26f968
--- /dev/null
+++ b/xmloff/source/draw/ximppage.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPPAGE_HXX
+#define _XIMPPAGE_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <tools/rtti.hxx>
+#include "ximpshap.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:g context (RECURSIVE)
+
+class SdXMLGenericPageContext : public SvXMLImportContext
+{
+ // the shape group this group is working on
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxAnnotationAccess;
+
+protected:
+ rtl::OUString maPageLayoutName;
+ rtl::OUString maUseHeaderDeclName;
+ rtl::OUString maUseFooterDeclName;
+ rtl::OUString maUseDateTimeDeclName;
+ rtl::OUString msNavOrder;
+
+ void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew)
+ { mxShapes = rNew; }
+
+ /** sets the page style on this page */
+ void SetStyle( rtl::OUString& rStyleName );
+
+ /** sets the presentation layout at this page. It is used for drawing pages and for the handout master */
+ void SetLayout();
+
+ /** deletes all shapes on this drawing page */
+ void DeleteAllShapes();
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+ /** sets the properties from a page master style with the given name on this contexts page */
+ void SetPageMaster( rtl::OUString& rsPageMasterName );
+
+ void SetNavigationOrder();
+
+public:
+ TYPEINFO();
+
+ SdXMLGenericPageContext( SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLGenericPageContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext *CreateChildContext(
+ USHORT nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const
+ { return mxShapes; }
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext()
+ { return mxShapes; }
+};
+
+
+#endif // _XIMPGROUP_HXX
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
new file mode 100644
index 000000000000..a26806ce6c24
--- /dev/null
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -0,0 +1,3771 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/container/XIdentifierAccess.hpp>
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
+#include <com/sun/star/drawing/EscapeDirection.hpp>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/extract.hxx>
+#include "ximpshap.hxx"
+#include <xmloff/XMLBase64ImportContext.hxx>
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include "xexptran.hxx"
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include "PropertySetMerger.hxx"
+#include <xmloff/families.hxx>
+#include "ximpstyl.hxx"
+#include"xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "EnhancedCustomShapeToken.hxx"
+#include "XMLReplacementImageContext.hxx"
+#include "XMLImageMapContext.hxx"
+#include "sdpropls.hxx"
+#include "eventimp.hxx"
+
+#include "descriptionimp.hxx"
+#include "ximpcustomshape.hxx"
+#include "XMLEmbeddedObjectImportContext.hxx"
+#include "xmlerror.hxx"
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+
+// --> OD 2006-02-22 #b6382898#
+#include <com/sun/star/text/XTextDocument.hpp>
+// <--
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::xmloff::token;
+using namespace ::xmloff::EnhancedCustomShapeToken;
+
+SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[] =
+{
+ { XML_TOP_LEFT, drawing::Alignment_TOP_LEFT },
+ { XML_TOP, drawing::Alignment_TOP },
+ { XML_TOP_RIGHT, drawing::Alignment_TOP_RIGHT },
+ { XML_LEFT, drawing::Alignment_LEFT },
+ { XML_CENTER, drawing::Alignment_CENTER },
+ { XML_RIGHT, drawing::Alignment_RIGHT },
+ { XML_BOTTOM_LEFT, drawing::Alignment_BOTTOM_LEFT },
+ { XML_BOTTOM, drawing::Alignment_BOTTOM },
+ { XML_BOTTOM_RIGHT, drawing::Alignment_BOTTOM_RIGHT },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[] =
+{
+ { XML_AUTO, drawing::EscapeDirection_SMART },
+ { XML_LEFT, drawing::EscapeDirection_LEFT },
+ { XML_RIGHT, drawing::EscapeDirection_RIGHT },
+ { XML_UP, drawing::EscapeDirection_UP },
+ { XML_DOWN, drawing::EscapeDirection_DOWN },
+ { XML_HORIZONTAL, drawing::EscapeDirection_HORIZONTAL },
+ { XML_VERTICAL, drawing::EscapeDirection_VERTICAL },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static bool ImpIsEmptyURL( const ::rtl::OUString& rURL )
+{
+ if( rURL.getLength() == 0 )
+ return true;
+
+ // #i13140# Also compare against 'toplevel' URLs. which also
+ // result in empty filename strings.
+ if( 0 == rURL.compareToAscii( "#./" ) )
+ return true;
+
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SvXMLShapeContext, SvXMLImportContext );
+TYPEINIT1( SdXMLShapeContext, SvXMLShapeContext );
+
+SdXMLShapeContext::SdXMLShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SvXMLShapeContext( rImport, nPrfx, rLocalName, bTemporaryShape )
+, mxShapes( rShapes )
+, mxAttrList(xAttrList)
+, mbListContextPushed( false )
+, mnStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_ID)
+, mbIsPlaceholder(FALSE)
+, mbClearDefaultAttributes( true )
+, mbIsUserTransformed(FALSE)
+, mnZOrder(-1)
+, maSize(1, 1)
+, maPosition(0, 0)
+, mbVisible(true)
+, mbPrintable(true)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLShapeContext::~SdXMLShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLShapeContext::CreateChildContext( USHORT p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext * pContext = NULL;
+
+ // #i68101#
+ if( p_nPrefix == XML_NAMESPACE_SVG &&
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ {
+ pContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( p_nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ {
+ pContext = new SdXMLEventsContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ }
+ else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
+ {
+ addGluePoint( xAttrList );
+ }
+ else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_THUMBNAIL ) )
+ {
+ // search attributes for xlink:href
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_XLINK )
+ {
+ if( IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ maThumbnailURL = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // create text cursor on demand
+ if( !mxCursor.is() )
+ {
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ UniReference < XMLTextImportHelper > xTxtImport =
+ GetImport().GetTextImport();
+ mxOldCursor = xTxtImport->GetCursor();
+ mxCursor = xText->createTextCursor();
+ if( mxCursor.is() )
+ {
+ xTxtImport->SetCursor( mxCursor );
+ }
+
+ // remember old list item and block (#91964#) and reset them
+ // for the text frame
+ xTxtImport->PushListContext();
+ mbListContextPushed = true;
+ }
+ }
+
+ // if we have a text cursor, lets try to import some text
+ if( mxCursor.is() )
+ {
+ pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), p_nPrefix, rLocalName, xAttrList );
+ }
+ }
+
+ // call parent for content
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ // get the glue points container for this shape if its not already there
+ if( !mxGluePoints.is() )
+ {
+ uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY );
+ if( !xSupplier.is() )
+ return;
+
+ mxGluePoints = uno::Reference< container::XIdentifierContainer >::query( xSupplier->getGluePoints() );
+
+ if( !mxGluePoints.is() )
+ return;
+ }
+
+ drawing::GluePoint2 aGluePoint;
+ aGluePoint.IsUserDefined = sal_True;
+ aGluePoint.Position.X = 0;
+ aGluePoint.Position.Y = 0;
+ aGluePoint.Escape = drawing::EscapeDirection_SMART;
+ aGluePoint.PositionAlignment = drawing::Alignment_CENTER;
+ aGluePoint.IsRelative = sal_True;
+
+ sal_Int32 nId = -1;
+
+ // read attributes for the 3DScene
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ const OUString sValue( xAttrList->getValueByIndex( i ) );
+
+ if( nPrefix == XML_NAMESPACE_SVG )
+ {
+ if( IsXMLToken( aLocalName, XML_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.X, sValue);
+ }
+ else if( IsXMLToken( aLocalName, XML_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.Y, sValue);
+ }
+ }
+ else if( nPrefix == XML_NAMESPACE_DRAW )
+ {
+ if( IsXMLToken( aLocalName, XML_ID ) )
+ {
+ nId = sValue.toInt32();
+ }
+ else if( IsXMLToken( aLocalName, XML_ALIGN ) )
+ {
+ USHORT eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueAlignment_EnumMap ) )
+ {
+ aGluePoint.PositionAlignment = (drawing::Alignment)eKind;
+ aGluePoint.IsRelative = sal_False;
+ }
+ }
+ else if( IsXMLToken( aLocalName, XML_ESCAPE_DIRECTION ) )
+ {
+ USHORT eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueEscapeDirection_EnumMap ) )
+ {
+ aGluePoint.Escape = (drawing::EscapeDirection)eKind;
+ }
+ }
+ }
+ }
+
+ if( nId != -1 )
+ {
+ try
+ {
+ sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aGluePoint ) );
+ GetImport().GetShapeImport()->addGluePointMapping( mxShape, nId, nInternalId );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "exception during setting of glue points!");
+ }
+ }
+}
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+}
+
+void SdXMLShapeContext::EndElement()
+{
+ if(mxCursor.is())
+ {
+ // delete addition newline
+ const OUString aEmpty;
+ mxCursor->gotoEnd( sal_False );
+ mxCursor->goLeft( 1, sal_True );
+ mxCursor->setString( aEmpty );
+
+ // reset cursor
+ GetImport().GetTextImport()->ResetCursor();
+ }
+
+ if(mxOldCursor.is())
+ GetImport().GetTextImport()->SetCursor( mxOldCursor );
+
+ // reinstall old list item (if necessary) #91964#
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
+ }
+
+ if( msHyperlink.getLength() != 0 ) try
+ {
+ const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
+
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
+ if( xEventsSupplier.is() )
+ {
+ const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ const OUString sClickAction( RTL_CONSTASCII_USTRINGPARAM( "ClickAction" ) );
+
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
+
+ uno::Sequence< beans::PropertyValue > aProperties( 3 );
+ aProperties[0].Name = sEventType;
+ aProperties[0].Handle = -1;
+ aProperties[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
+ aProperties[0].State = beans::PropertyState_DIRECT_VALUE;
+
+ aProperties[1].Name = sClickAction;
+ aProperties[1].Handle = -1;
+ aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT;
+ aProperties[1].State = beans::PropertyState_DIRECT_VALUE;
+
+ aProperties[2].Name = sBookmark;
+ aProperties[2].Handle = -1;
+ aProperties[2].Value <<= msHyperlink;
+ aProperties[2].State = beans::PropertyState_DIRECT_VALUE;
+
+ const OUString sAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+ xEvents->replaceByName( sAPIEventName, Any( aProperties ) );
+ }
+ else
+ {
+ // in draw use the Bookmark property
+ Reference< beans::XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
+ xSet->setPropertyValue( sBookmark, Any( msHyperlink ) );
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ), Any( ::com::sun::star::presentation::ClickAction_DOCUMENT ) );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink!");
+ }
+
+ if( mxLockable.is() )
+ mxLockable->removeActionLock();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape)
+{
+ if(xShape.is())
+ {
+ // set shape local
+ mxShape = xShape;
+
+ if(maShapeName.getLength())
+ {
+ uno::Reference< container::XNamed > xNamed( mxShape, uno::UNO_QUERY );
+ if( xNamed.is() )
+ xNamed->setName( maShapeName );
+ }
+
+ UniReference< XMLShapeImportHelper > xImp( GetImport().GetShapeImport() );
+ xImp->addShape( xShape, mxAttrList, mxShapes );
+
+ if( mbClearDefaultAttributes )
+ {
+ uno::Reference<beans::XMultiPropertyStates> xMultiPropertyStates(xShape, uno::UNO_QUERY );
+ if (xMultiPropertyStates.is())
+ xMultiPropertyStates->setAllPropertiesToDefault();
+ }
+
+ if( !mbVisible || !mbPrintable ) try
+ {
+ uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY_THROW );
+ if( !mbVisible )
+ xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ), uno::Any( sal_False ) );
+
+ if( !mbPrintable )
+ xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ), uno::Any( sal_False ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "SdXMLShapeContext::AddShape(), exception caught!" );
+ }
+
+ // #107848#
+ if(!mbTemporaryShape && (!GetImport().HasTextImport()
+ || !GetImport().GetTextImport()->IsInsideDeleteContext()))
+ {
+ xImp->shapeWithZIndexAdded( xShape, mnZOrder );
+ }
+
+ if( maShapeId.getLength() )
+ {
+ uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef );
+ }
+
+ // #91065# count only if counting for shape import is enabled
+ if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled())
+ {
+ // #80365# increment progress bar at load once for each draw object
+ GetImport().GetProgressBarHelper()->Increment();
+ }
+ }
+
+ mxLockable = uno::Reference< document::XActionLockable >::query( xShape );
+
+ if( mxLockable.is() )
+ mxLockable->addActionLock();
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::AddShape(const char* pServiceName )
+{
+ uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY);
+ if(xServiceFact.is())
+ {
+ try
+ {
+ // --> OD 2006-02-22 #b6382898#
+ // Since fix for issue i33294 the Writer model doesn't support
+ // com.sun.star.drawing.OLE2Shape anymore.
+ // To handle Draw OLE objects it's decided to import these
+ // objects as com.sun.star.drawing.OLE2Shape and convert these
+ // objects after the import into com.sun.star.drawing.GraphicObjectShape.
+ uno::Reference< drawing::XShape > xShape;
+ if ( OUString::createFromAscii(pServiceName).compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 &&
+ uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
+ {
+ xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString::createFromAscii("com.sun.star.drawing.temporaryForXMLImportOLE2Shape")), uno::UNO_QUERY);
+ }
+ else
+ {
+ xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString::createFromAscii(pServiceName)), uno::UNO_QUERY);
+ }
+ // <--
+ if( xShape.is() )
+ AddShape( xShape );
+ }
+ catch( const uno::Exception& e )
+ {
+ uno::Sequence<rtl::OUString> aSeq( 1 );
+ aSeq[0] = OUString::createFromAscii(pServiceName);
+ GetImport().SetError( XMLERROR_FLAG_ERROR | XMLERROR_API,
+ aSeq, e.Message, NULL );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::SetTransformation()
+{
+ if(mxShape.is())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ ::basegfx::B2DHomMatrix aTransformation;
+
+ if(maSize.Width != 1 || maSize.Height != 1)
+ {
+ // take care there are no zeros used by error
+ if(0 == maSize.Width)
+ maSize.Width = 1;
+ if(0 == maSize.Height)
+ maSize.Height = 1;
+
+ // set global size. This should always be used.
+ aTransformation.scale(maSize.Width, maSize.Height);
+ }
+
+ if(maPosition.X != 0 || maPosition.Y != 0)
+ {
+ // if global position is used, add it to transformation
+ aTransformation.translate(maPosition.X, maPosition.Y);
+ }
+
+ if(mnTransform.NeedsAction())
+ {
+ // transformation is used, apply to object.
+ // NOTICE: The transformation is applied AFTER evtl. used
+ // global positioning and scaling is used, so any shear or
+ // rotate used herein is applied around the (0,0) position
+ // of the PAGE object !!!
+ ::basegfx::B2DHomMatrix aMat;
+ mnTransform.GetFullTransform(aMat);
+
+ // now add to transformation
+ aTransformation *= aMat;
+ }
+
+ // now set transformation for this object
+ uno::Any aAny;
+ drawing::HomogenMatrix3 aMatrix;
+
+ aMatrix.Line1.Column1 = aTransformation.get(0, 0);
+ aMatrix.Line1.Column2 = aTransformation.get(0, 1);
+ aMatrix.Line1.Column3 = aTransformation.get(0, 2);
+
+ aMatrix.Line2.Column1 = aTransformation.get(1, 0);
+ aMatrix.Line2.Column2 = aTransformation.get(1, 1);
+ aMatrix.Line2.Column3 = aTransformation.get(1, 2);
+
+ aMatrix.Line3.Column1 = aTransformation.get(2, 0);
+ aMatrix.Line3.Column2 = aTransformation.get(2, 1);
+ aMatrix.Line3.Column3 = aTransformation.get(2, 2);
+
+ aAny <<= aMatrix;
+
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")), aAny);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
+{
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( !xPropSet.is() )
+ return;
+
+ do
+ {
+ XMLPropStyleContext* pDocStyle = NULL;
+
+ // set style on shape
+ if(maDrawStyleName.getLength() == 0)
+ break;
+
+ const SvXMLStyleContext* pStyle = 0L;
+ sal_Bool bAutoStyle(FALSE);
+
+ if(GetImport().GetShapeImport()->GetAutoStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
+
+ if(pStyle)
+ bAutoStyle = TRUE;
+
+ if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
+
+ OUString aStyleName = maDrawStyleName;
+ uno::Reference< style::XStyle > xStyle;
+
+ if( pStyle && pStyle->ISA(XMLShapeStyleContext) )
+ {
+ pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle );
+
+ if( pDocStyle->GetStyle().is() )
+ {
+ xStyle = pDocStyle->GetStyle();
+ }
+ else
+ {
+ aStyleName = pDocStyle->GetParentName();
+ }
+ }
+
+ if( !xStyle.is() && aStyleName.getLength() )
+ {
+ try
+ {
+
+ uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier( GetImport().GetModel(), uno::UNO_QUERY );
+
+ if( xFamiliesSupplier.is() )
+ {
+ uno::Reference< container::XNameAccess > xFamilies( xFamiliesSupplier->getStyleFamilies() );
+ if( xFamilies.is() )
+ {
+
+ uno::Reference< container::XNameAccess > xFamily;
+
+ if( XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily )
+ {
+ aStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID,
+ aStyleName );
+ sal_Int32 nPos = aStyleName.lastIndexOf( sal_Unicode('-') );
+ if( -1 != nPos )
+ {
+ OUString aFamily( aStyleName.copy( 0, nPos ) );
+
+ xFamilies->getByName( aFamily ) >>= xFamily;
+ aStyleName = aStyleName.copy( nPos + 1 );
+ }
+ }
+ else
+ {
+ // get graphics familie
+ xFamilies->getByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ) ) >>= xFamily;
+ aStyleName = GetImport().GetStyleDisplayName(
+ XML_STYLE_FAMILY_SD_GRAPHICS_ID,
+ aStyleName );
+ }
+
+ if( xFamily.is() )
+ xFamily->getByName( aStyleName ) >>= xStyle;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "could not find style for shape!" );
+ }
+ }
+
+ if( bSupportsStyle && xStyle.is() )
+ {
+ try
+ {
+ // set style on object
+ uno::Any aAny;
+ aAny <<= xStyle;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny);
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "could not find style for shape!" );
+ }
+ }
+
+ // if this is an auto style, set its properties
+ if(bAutoStyle && pDocStyle)
+ {
+ // set PropertySet on object
+ pDocStyle->FillPropertySet(xPropSet);
+ }
+
+ } while(0);
+
+ // try to set text auto style
+ do
+ {
+ // set style on shape
+ if( 0 == maTextStyleName.getLength() )
+ break;
+
+ if( NULL == GetImport().GetShapeImport()->GetAutoStylesContext())
+ break;
+
+ const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH, maTextStyleName);
+ XMLPropStyleContext* pStyle = PTR_CAST( XMLPropStyleContext, pTempStyle ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice
+ if( pStyle == NULL )
+ break;
+
+ // set PropertySet on object
+ pStyle->FillPropertySet(xPropSet);
+
+ } while(0);
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+void SdXMLShapeContext::SetLayer()
+{
+ if( maLayerName.getLength() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maLayerName;
+
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LayerName")), aAny);
+ return;
+ }
+ }
+ catch( uno::Exception e )
+ {
+ }
+ }
+}
+
+void SdXMLShapeContext::SetThumbnail()
+{
+ if( 0 == maThumbnailURL.getLength() )
+ return;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( !xPropSet.is() )
+ return;
+
+ const OUString sProperty(RTL_CONSTASCII_USTRINGPARAM("ThumbnailGraphicURL"));
+
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sProperty ) )
+ {
+ // load the thumbnail graphic and export it to a wmf stream so we can set
+ // it at the api
+
+ const OUString aInternalURL( GetImport().ResolveGraphicObjectURL( maThumbnailURL, sal_False ) );
+ xPropSet->setPropertyValue( sProperty, uno::makeAny( aInternalURL ) );
+ }
+ }
+ catch( uno::Exception e )
+ {
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ bool bHaveXmlId( false );
+ if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) )
+ {
+ if( IsXMLToken( rLocalName, XML_ZINDEX ) )
+ {
+ mnZOrder = rValue.toInt32();
+ }
+ else if( IsXMLToken( rLocalName, XML_ID ) )
+ {
+ if (!bHaveXmlId) { maShapeId = rValue; };
+ }
+ else if( IsXMLToken( rLocalName, XML_NAME ) )
+ {
+ maShapeName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
+ {
+ maDrawStyleName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_TEXT_STYLE_NAME ) )
+ {
+ maTextStyleName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_LAYER ) )
+ {
+ maLayerName = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+ {
+ mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
+ }
+ else if( IsXMLToken( rLocalName, XML_DISPLAY ) )
+ {
+ mbVisible = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_SCREEN );
+ mbPrintable = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_PRINTER );
+ }
+ }
+ else if( XML_NAMESPACE_PRESENTATION == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_USER_TRANSFORMED ) )
+ {
+ mbIsUserTransformed = IsXMLToken( rValue, XML_TRUE );
+ }
+ else if( IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
+ {
+ mbIsPlaceholder = IsXMLToken( rValue, XML_TRUE );
+ if( mbIsPlaceholder )
+ mbClearDefaultAttributes = false;
+ }
+ else if( IsXMLToken( rLocalName, XML_CLASS ) )
+ {
+ maPresentationClass = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
+ {
+ maDrawStyleName = rValue;
+ mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+ }
+ }
+ else if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maPosition.X, rValue);
+ }
+ else if( IsXMLToken( rLocalName, XML_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maPosition.Y, rValue);
+ }
+ else if( IsXMLToken( rLocalName, XML_WIDTH ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maSize.Width, rValue);
+ if( maSize.Width > 0 )
+ maSize.Width += 1;
+ else if( maSize.Width < 0 )
+ maSize.Width -= 1;
+ }
+ else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maSize.Height, rValue);
+ if( maSize.Height > 0 )
+ maSize.Height += 1;
+ else if( maSize.Height < 0 )
+ maSize.Height -= 1;
+ }
+ else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+ {
+ // because of #85127# take svg:transform into account and hanle like
+ // draw:transform for compatibility
+ mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
+ }
+
+ // #i68101#
+ else if( IsXMLToken( rLocalName, XML_TITLE ) )
+ {
+ maShapeTitle = rValue;
+ }
+ else if( IsXMLToken( rLocalName, XML_DESC ) )
+ {
+ maShapeDescription = rValue;
+ }
+ }
+ else if( (XML_NAMESPACE_NONE == nPrefix) || (XML_NAMESPACE_XML == nPrefix) )
+ {
+ if( IsXMLToken( rLocalName, XML_ID ) )
+ {
+ maShapeId = rValue;
+ bHaveXmlId = true;
+ }
+ }
+}
+
+sal_Bool SdXMLShapeContext::isPresentationShape() const
+{
+ if( maPresentationClass.getLength() && (const_cast<SdXMLShapeContext*>(this))->GetImport().GetShapeImport()->IsPresentationShapesSupported() )
+ {
+ if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily)
+ {
+ return sal_True;
+ }
+
+ if( IsXMLToken( maPresentationClass, XML_HEADER ) || IsXMLToken( maPresentationClass, XML_FOOTER ) ||
+ IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) || IsXMLToken( maPresentationClass, XML_DATE_TIME ) )
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext );
+
+SdXMLRectShapeContext::SdXMLRectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnRadius( 0L )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLRectShapeContext::~SdXMLRectShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLRectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create rectangle shape
+ AddShape("com.sun.star.drawing.RectangleShape");
+ if(mxShape.is())
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ if(mnRadius)
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ try
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "exception during setting of corner radius!");
+ }
+ }
+ }
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////3////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLLineShapeContext, SdXMLShapeContext );
+
+SdXMLLineShapeContext::SdXMLLineShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnX1( 0L ),
+ mnY1( 0L ),
+ mnX2( 1L ),
+ mnY2( 1L )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLLineShapeContext::~SdXMLLineShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_X1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnX1, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnY1, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_X2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnX2, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnY2, rValue);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLLineShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // #85920# use SetTransformation() to handle import of simple lines.
+ // This is necessary to kake into account all anchor positions and
+ // other things. All shape imports use the same import schemata now.
+ // create necessary shape (Line Shape)
+ AddShape("com.sun.star.drawing.PolyLineShape");
+
+ if(mxShape.is())
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // get sizes and offsets
+ awt::Point aTopLeft(mnX1, mnY1);
+ awt::Point aBottomRight(mnX2, mnY2);
+
+ if(mnX1 > mnX2)
+ {
+ aTopLeft.X = mnX2;
+ aBottomRight.X = mnX1;
+ }
+
+ if(mnY1 > mnY2)
+ {
+ aTopLeft.Y = mnY2;
+ aBottomRight.Y = mnY1;
+ }
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ drawing::PointSequenceSequence aPolyPoly(1L);
+ drawing::PointSequence* pOuterSequence = aPolyPoly.getArray();
+ pOuterSequence->realloc(2L);
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ uno::Any aAny;
+
+ *pInnerSequence = awt::Point( mnX1 - aTopLeft.X, mnY1 - aTopLeft.Y);
+ pInnerSequence++;
+ *pInnerSequence = awt::Point( mnX2 - aTopLeft.X, mnY2 - aTopLeft.Y);
+
+ aAny <<= aPolyPoly;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+
+ // set sizes for transformation
+ maSize.Width = aBottomRight.X - aTopLeft.X;
+ maSize.Height = aBottomRight.Y - aTopLeft.Y;
+ maPosition.X = aTopLeft.X;
+ maPosition.Y = aTopLeft.Y;
+
+ // set pos, size, shear and rotate and get copy of matrix
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLEllipseShapeContext, SdXMLShapeContext );
+
+SdXMLEllipseShapeContext::SdXMLEllipseShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnCX( 0L ),
+ mnCY( 0L ),
+ mnRX( 1L ),
+ mnRY( 1L ),
+ meKind( drawing::CircleKind_FULL ),
+ mnStartAngle( 0 ),
+ mnEndAngle( 0 )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLEllipseShapeContext::~SdXMLEllipseShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_RX ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_RY ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRY, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CX ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnCX, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CY ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnCY, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_R ) )
+ {
+ // single radius, it's a circle and both radii are the same
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue);
+ mnRY = mnRX;
+ return;
+ }
+ }
+ else if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_KIND ) )
+ {
+ USHORT eKind;
+ if( SvXMLUnitConverter::convertEnum( eKind, rValue, aXML_CircleKind_EnumMap ) )
+ {
+ meKind = eKind;
+ }
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_START_ANGLE ) )
+ {
+ double dStartAngle;
+ if( SvXMLUnitConverter::convertDouble( dStartAngle, rValue ) )
+ mnStartAngle = (sal_Int32)(dStartAngle * 100.0);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_END_ANGLE ) )
+ {
+ double dEndAngle;
+ if( SvXMLUnitConverter::convertDouble( dEndAngle, rValue ) )
+ mnEndAngle = (sal_Int32)(dEndAngle * 100.0);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create rectangle shape
+ AddShape("com.sun.star.drawing.EllipseShape");
+ if(mxShape.is())
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ if( meKind != drawing::CircleKind_FULL )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Any aAny;
+ aAny <<= (drawing::CircleKind)meKind;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")), aAny );
+
+ aAny <<= mnStartAngle;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")), aAny );
+
+ aAny <<= mnEndAngle;
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")), aAny );
+ }
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPolygonShapeContext, SdXMLShapeContext );
+
+SdXMLPolygonShapeContext::SdXMLPolygonShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbClosed( bClosed )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPolygonShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
+ {
+ maViewBox = rValue;
+ return;
+ }
+ }
+ else if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_POINTS ) )
+ {
+ maPoints = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPolygonShapeContext::~SdXMLPolygonShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // Add, set Style and properties from base shape
+ if(mbClosed)
+ AddShape("com.sun.star.drawing.PolyPolygonShape");
+ else
+ AddShape("com.sun.star.drawing.PolyLineShape");
+
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ // set polygon
+ if(maPoints.getLength() && maViewBox.getLength())
+ {
+ SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
+ awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ if (maSize.Width != 0 && maSize.Height !=0)
+ {
+ aSize = maSize;
+ }
+ awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY());
+ SdXMLImExPointsElement aPoints(maPoints, aViewBox,
+ aPosition, aSize, GetImport().GetMM100UnitConverter());
+
+ uno::Any aAny;
+ aAny <<= aPoints.GetPointSequenceSequence();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+ }
+
+ // set pos, size, shear and rotate and get copy of matrix
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPathShapeContext, SdXMLShapeContext );
+
+SdXMLPathShapeContext::SdXMLPathShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbClosed( TRUE )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPathShapeContext::~SdXMLPathShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPathShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
+ {
+ maViewBox = rValue;
+ return;
+ }
+ else if( IsXMLToken( rLocalName, XML_D ) )
+ {
+ maD = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create polygon shape
+ if(maD.getLength())
+ {
+ // prepare some of the parameters
+ SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
+ awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+ awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY());
+ if (maSize.Width != 0 && maSize.Height !=0)
+ {
+ aSize = maSize;
+ }
+ SdXMLImExSvgDElement aPoints(maD, aViewBox,
+ aPosition, aSize, GetImport().GetMM100UnitConverter());
+
+ const char* pService;
+ // now create shape
+ if(aPoints.IsCurve())
+ {
+ if(aPoints.IsClosed())
+ {
+ pService = "com.sun.star.drawing.ClosedBezierShape";
+ }
+ else
+ {
+ pService = "com.sun.star.drawing.OpenBezierShape";
+ }
+ }
+ else
+ {
+ if(aPoints.IsClosed())
+ {
+ pService = "com.sun.star.drawing.PolyPolygonShape";
+ }
+ else
+ {
+ pService = "com.sun.star.drawing.PolyLineShape";
+ }
+ }
+
+ // Add, set Style and properties from base shape
+ AddShape(pService);
+
+ // #89344# test for mxShape.is() and not for mxShapes.is() to support
+ // shape import helper classes WITHOUT XShapes (member mxShapes). This
+ // is used by the writer.
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Any aAny;
+
+ // set svg:d
+ if(maD.getLength())
+ {
+ if(aPoints.IsCurve())
+ {
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aPoints.GetFlagSequenceSequence());
+
+ aAny <<= aSourcePolyPolygon;
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+ else
+ {
+ aAny <<= aPoints.GetPointSequenceSequence();
+ xPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny);
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLTextBoxShapeContext, SdXMLShapeContext );
+
+SdXMLTextBoxShapeContext::SdXMLTextBoxShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mnRadius(0)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLTextBoxShapeContext::~SdXMLTextBoxShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLTextBoxShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue);
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ // create textbox shape
+ sal_Bool bIsPresShape = sal_False;
+ bool bClearText = false;
+
+ const char *pService = NULL;
+
+ if( isPresentationShape() )
+ {
+ // check if the current document supports presentation shapes
+ if( GetImport().GetShapeImport()->IsPresentationShapesSupported() )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_SUBTITLE ))
+ {
+ // XmlShapeTypePresSubtitleShape
+ pService = "com.sun.star.presentation.SubtitleShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OUTLINE ) )
+ {
+ // XmlShapeTypePresOutlinerShape
+ pService = "com.sun.star.presentation.OutlinerShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_NOTES ) )
+ {
+ // XmlShapeTypePresNotesShape
+ pService = "com.sun.star.presentation.NotesShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_HEADER ) )
+ {
+ // XmlShapeTypePresHeaderShape
+ pService = "com.sun.star.presentation.HeaderShape";
+ bClearText = true;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_FOOTER ) )
+ {
+ // XmlShapeTypePresFooterShape
+ pService = "com.sun.star.presentation.FooterShape";
+ bClearText = true;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) )
+ {
+ // XmlShapeTypePresSlideNumberShape
+ pService = "com.sun.star.presentation.SlideNumberShape";
+ bClearText = true;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_DATE_TIME ) )
+ {
+ // XmlShapeTypePresDateTimeShape
+ pService = "com.sun.star.presentation.DateTimeShape";
+ bClearText = true;
+ }
+ else // IsXMLToken( maPresentationClass, XML_PRESENTATION_TITLE ) )
+ {
+ // XmlShapeTypePresTitleTextShape
+ pService = "com.sun.star.presentation.TitleTextShape";
+ }
+ bIsPresShape = TRUE;
+ }
+ }
+
+ if( NULL == pService )
+ {
+ // normal text shape
+ pService = "com.sun.star.drawing.TextShape";
+ }
+
+ // Add, set Style and properties from base shape
+ AddShape(pService);
+
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ if( bClearText )
+ {
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ OUString aEmpty;
+ xText->setString( aEmpty );
+ }
+
+ // set parameters on shape
+//A AW->CL: Eventually You need to strip scale and translate from the transformation
+//A to reach the same goal again.
+//A if(!bIsPresShape || mbIsUserTransformed)
+//A {
+//A // set pos and size on shape, this should remove binding
+//A // to pres object on masterpage
+//A SetSizeAndPosition();
+//A }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ if(mnRadius)
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ try
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "exception during setting of corner radius!");
+ }
+ }
+ }
+
+ SdXMLShapeContext::StartElement(mxAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLControlShapeContext, SdXMLShapeContext );
+
+SdXMLControlShapeContext::SdXMLControlShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLControlShapeContext::~SdXMLControlShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLControlShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CONTROL ) )
+ {
+ maFormId = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLControlShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Control shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.ControlShape");
+ if( mxShape.is() )
+ {
+ DBG_ASSERT( maFormId.getLength(), "draw:control without a form:id attribute!" );
+ if( maFormId.getLength() )
+ {
+#ifndef SVX_LIGHT
+ if( GetImport().IsFormsSupported() )
+ {
+ uno::Reference< awt::XControlModel > xControlModel( GetImport().GetFormImport()->lookupControl( maFormId ), uno::UNO_QUERY );
+ if( xControlModel.is() )
+ {
+ uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY );
+ if( xControl.is() )
+ xControl->setControl( xControlModel );
+
+ }
+ }
+#endif // #ifndef SVX_LIGHT
+ }
+
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLConnectorShapeContext, SdXMLShapeContext );
+
+SdXMLConnectorShapeContext::SdXMLConnectorShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maStart(0,0),
+ maEnd(1,1),
+ mnType( (USHORT)drawing::ConnectorType_STANDARD ),
+ mnStartGlueId(-1),
+ mnEndGlueId(-1),
+ mnDelta1(0),
+ mnDelta2(0),
+ mnDelta3(0)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLConnectorShapeContext::~SdXMLConnectorShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ {
+ if( IsXMLToken( rLocalName, XML_START_SHAPE ) )
+ {
+ maStartShapeId = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_START_GLUE_POINT ) )
+ {
+ mnStartGlueId = rValue.toInt32();
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_END_SHAPE ) )
+ {
+ maEndShapeId = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_END_GLUE_POINT ) )
+ {
+ mnEndGlueId = rValue.toInt32();
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_LINE_SKEW ) )
+ {
+ SvXMLTokenEnumerator aTokenEnum( rValue );
+ OUString aToken;
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnDelta1, aToken);
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnDelta2, aToken);
+ if( aTokenEnum.getNextToken( aToken ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnDelta3, aToken);
+ }
+ }
+ }
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_TYPE ) )
+ {
+ SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap );
+ return;
+ }
+ }
+ case XML_NAMESPACE_SVG:
+ {
+ if( IsXMLToken( rLocalName, XML_X1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_X2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_D ) )
+ {
+ SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
+ awt::Point aPoint( 0, 0 );
+ awt::Size aSize( 1, 1 );
+
+ SdXMLImExSvgDElement aPoints( rValue, aViewBox,
+ aPoint, aSize, GetImport().GetMM100UnitConverter() );
+
+ if ( aPoints.IsCurve() )
+ {
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aPoints.GetFlagSequenceSequence());
+ maPath <<= aSourcePolyPolygon;
+ }
+ else
+ {
+ const drawing::PointSequenceSequence& rOuterSeq = aPoints.GetPointSequenceSequence();
+ drawing::FlagSequenceSequence aFlagSeqSeq( rOuterSeq.getLength() );
+ for ( int a = 0; a < rOuterSeq.getLength(); a++ )
+ aFlagSeqSeq[ a ] = drawing::FlagSequence( rOuterSeq[ a ].getLength() );
+
+ drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
+ aPoints.GetPointSequenceSequence(),
+ aFlagSeqSeq );
+ maPath <<= aSourcePolyPolygon;
+ }
+ }
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // #107928#
+ // For security reasons, do not add empty connectors. There may have been an error in EA2
+ // that created empty, far set off connectors (e.g. 63 meters below top of document). This
+ // is not guaranteed, but it's definitely safe to not add empty connectors.
+ sal_Bool bDoAdd(sal_True);
+
+ if( 0 == maStartShapeId.getLength()
+ && 0 == maEndShapeId.getLength()
+ && maStart.X == maEnd.X
+ && maStart.Y == maEnd.Y
+ && 0 == mnDelta1
+ && 0 == mnDelta2
+ && 0 == mnDelta3
+ )
+ {
+ bDoAdd = sal_False;
+ }
+
+ if(bDoAdd)
+ {
+ // create Connector shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.ConnectorShape");
+ if(mxShape.is())
+ {
+ // add connection ids
+ if( maStartShapeId.getLength() )
+ GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_True, maStartShapeId, mnStartGlueId );
+ if( maEndShapeId.getLength() )
+ GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_False, maEndShapeId, mnEndGlueId );
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maStart;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny);
+
+ aAny <<= maEnd;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny );
+
+ aAny <<= (drawing::ConnectorType)mnType;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")), aAny );
+
+ aAny <<= mnDelta1;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")), aAny );
+
+ aAny <<= mnDelta2;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")), aAny );
+
+ aAny <<= mnDelta3;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")), aAny );
+ }
+ SetStyle();
+ SetLayer();
+
+ if ( maPath.hasValue() )
+ {
+ // --> OD #i115492#
+ // Ignore svg:d attribute for text documents created by OpenOffice.org
+ // versions before OOo 3.3, because these OOo versions are storing
+ // svg:d values not using the correct unit.
+ bool bApplySVGD( true );
+ if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
+ {
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
+ if ( GetImport().IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound &&
+ ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
+ ( nUPD == 680 ) || // OOo 2.x
+ ( nUPD == 300 ) || // OOo 3.0 - OOo 3.0.1
+ ( nUPD == 310 ) || // OOo 3.1 - OOo 3.1.1
+ ( nUPD == 320 ) ) ) ) // OOo 3.2 - OOo 3.2.1
+ {
+ bApplySVGD = false;
+ }
+ }
+
+ if ( bApplySVGD )
+ {
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath );
+ }
+ // <--
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLMeasureShapeContext, SdXMLShapeContext );
+
+SdXMLMeasureShapeContext::SdXMLMeasureShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maStart(0,0),
+ maEnd(1,1)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLMeasureShapeContext::~SdXMLMeasureShapeContext()
+{
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_SVG:
+ {
+ if( IsXMLToken( rLocalName, XML_X1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y1 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_X2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_Y2 ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue);
+ return;
+ }
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLMeasureShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Measure shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.MeasureShape");
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+ aAny <<= maStart;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny);
+
+ aAny <<= maEnd;
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny );
+ }
+
+ // delete pre created fields
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ const OUString aEmpty( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ xText->setString( aEmpty );
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+void SdXMLMeasureShapeContext::EndElement()
+{
+ do
+ {
+ // delete pre created fields
+ uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
+ if( !xText.is() )
+ break;
+
+ uno::Reference< text::XTextCursor > xCursor( xText->createTextCursor() );
+ if( !xCursor.is() )
+ break;
+
+ const OUString aEmpty;
+ xCursor->collapseToStart();
+ xCursor->goRight( 1, sal_True );
+ xCursor->setString( aEmpty );
+ }
+ while(0);
+
+ SdXMLShapeContext::EndElement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPageShapeContext, SdXMLShapeContext );
+
+SdXMLPageShapeContext::SdXMLPageShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), mnPageNumber(0)
+{
+ mbClearDefaultAttributes = false;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPageShapeContext::~SdXMLPageShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPageShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_PAGE_NUMBER ) )
+ {
+ mnPageNumber = rValue.toInt32();
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Page shape
+ // add, set style and properties from base shape
+
+ // #86163# take into account which type of PageShape needs to
+ // be constructed. It's an pres shape if presentation:XML_CLASS == XML_PRESENTATION_PAGE.
+ sal_Bool bIsPresentation = maPresentationClass.getLength() &&
+ GetImport().GetShapeImport()->IsPresentationShapesSupported();
+
+ uno::Reference< lang::XServiceInfo > xInfo( mxShapes, uno::UNO_QUERY );
+ const sal_Bool bIsOnHandoutPage = xInfo.is() && xInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutMasterPage")) );
+
+ if( bIsOnHandoutPage )
+ {
+ AddShape("com.sun.star.presentation.HandoutShape");
+ }
+ else
+ {
+ if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) )
+ {
+ bIsPresentation = FALSE;
+ }
+
+ if(bIsPresentation)
+ {
+ AddShape("com.sun.star.presentation.PageShape");
+ }
+ else
+ {
+ AddShape("com.sun.star.drawing.PageShape");
+ }
+ }
+
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
+ xPropSet->setPropertyValue(aPageNumberStr, uno::makeAny( mnPageNumber ));
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLCaptionShapeContext, SdXMLShapeContext );
+
+SdXMLCaptionShapeContext::SdXMLCaptionShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ // #86616# for correct edge rounding import mnRadius needs to be initialized
+ mnRadius( 0L )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLCaptionShapeContext::~SdXMLCaptionShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ // create Caption shape
+ // add, set style and properties from base shape
+ AddShape("com.sun.star.drawing.CaptionShape");
+ if( mxShape.is() )
+ {
+ SetStyle();
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ // SJ: If AutoGrowWidthItem is set, SetTransformation will lead to the wrong SnapRect
+ // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment
+ // is the default setting, so the top left reference point that is used by the caption point is
+ // no longer correct) There are two ways to solve this problem, temporarily disabling the
+ // autogrowwith as we are doing here or to apply the CaptionPoint after setting text
+ sal_Bool bIsAutoGrowWidth = sal_False;
+ if ( xProps.is() )
+ {
+ uno::Any aAny( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth") ) ) );
+ aAny >>= bIsAutoGrowWidth;
+
+ if ( bIsAutoGrowWidth )
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_False ) );
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ if( xProps.is() )
+ xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint")), uno::makeAny( maCaptionPoint ) );
+
+ if ( bIsAutoGrowWidth )
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_True ) );
+
+ if(mnRadius)
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ try
+ {
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "exception during setting of corner radius!");
+ }
+ }
+ }
+
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLCaptionShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_CAPTION_POINT_X ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.X, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CAPTION_POINT_Y ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.Y, rValue);
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
+ {
+ GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue);
+ return;
+ }
+ }
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLGraphicObjectShapeContext, SdXMLShapeContext );
+
+SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ maURL()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_XLINK == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maURL = rValue;
+ return;
+ }
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ // create graphic object shape
+ const char *pService;
+
+ if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) && GetImport().GetShapeImport()->IsPresentationShapesSupported() )
+ {
+ pService = "com.sun.star.presentation.GraphicObjectShape";
+ }
+ else
+ {
+ pService = "com.sun.star.drawing.GraphicObjectShape";
+ }
+
+ AddShape( pService );
+
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xPropset(mxShape, uno::UNO_QUERY);
+ if(xPropset.is())
+ {
+ // since OOo 1.x had no line or fill style for graphics, but may create
+ // documents with them, we have to override them here
+ sal_Int32 nUPD, nBuildId;
+ if( GetImport().getBuildIds( nUPD, nBuildId ) && (nUPD == 645) ) try
+ {
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), Any( FillStyle_NONE ) );
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), Any( LineStyle_NONE ) );
+ }
+ catch( Exception& )
+ {
+ }
+
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xPropset->getPropertySetInfo() );
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( mbIsPlaceholder ) );
+
+ if( !mbIsPlaceholder )
+ {
+ if( maURL.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= GetImport().ResolveGraphicObjectURL( maURL, GetImport().isGraphicLoadOnDemandSupported() );
+ try
+ {
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny );
+ xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny );
+ }
+ catch (lang::IllegalArgumentException const &)
+ {
+ }
+ }
+ }
+ }
+
+ if(mbIsUserTransformed)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(mxAttrList);
+ }
+}
+
+void SdXMLGraphicObjectShapeContext::EndElement()
+{
+ if( mxBase64Stream.is() )
+ {
+ OUString sURL( GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream ) );
+ if( sURL.getLength() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ const uno::Any aAny( uno::makeAny( sURL ) );
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny );
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny );
+ }
+ }
+ catch (lang::IllegalArgumentException const &)
+ {
+ }
+ }
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLGraphicObjectShapeContext::CreateChildContext(
+ USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ if( (XML_NAMESPACE_OFFICE == nPrefix) &&
+ xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) )
+ {
+ if( !maURL.getLength() && !mxBase64Stream.is() )
+ {
+ mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
+ if( mxBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ mxBase64Stream );
+ }
+ }
+
+ // delegate to parent class if no context could be created
+ if ( NULL == pContext )
+ pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName,
+ xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLGraphicObjectShapeContext::~SdXMLGraphicObjectShapeContext()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLChartShapeContext, SdXMLShapeContext );
+
+SdXMLChartShapeContext::SdXMLChartShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mpChartContext( NULL )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLChartShapeContext::~SdXMLChartShapeContext()
+{
+ if( mpChartContext )
+ delete mpChartContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+{
+ const sal_Bool bIsPresentation = isPresentationShape();
+
+ AddShape( bIsPresentation ? "com.sun.star.presentation.ChartShape" : "com.sun.star.drawing.OLE2Shape" );
+
+ if(mxShape.is())
+ {
+ SetStyle();
+ SetLayer();
+
+ if( !mbIsPlaceholder )
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ uno::Any aAny;
+
+ const OUString aCLSID( RTL_CONSTASCII_USTRINGPARAM("12DCAE26-281F-416F-a234-c3086127382e"));
+
+ aAny <<= aCLSID;
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), aAny );
+
+#ifndef SVX_LIGHT
+ aAny = xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) );
+ uno::Reference< frame::XModel > xChartModel;
+ if( aAny >>= xChartModel )
+ {
+ mpChartContext = GetImport().GetChartImport()->CreateChartContext( GetImport(), XML_NAMESPACE_SVG, GetXMLToken(XML_CHART), xChartModel, xAttrList );
+ }
+#endif
+ }
+ }
+
+ if(mbIsUserTransformed)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
+
+ if( mpChartContext )
+ mpChartContext->StartElement( xAttrList );
+ }
+}
+
+void SdXMLChartShapeContext::EndElement()
+{
+ if( mpChartContext )
+ mpChartContext->EndElement();
+
+ SdXMLShapeContext::EndElement();
+}
+
+void SdXMLChartShapeContext::Characters( const ::rtl::OUString& rChars )
+{
+ if( mpChartContext )
+ mpChartContext->Characters( rChars );
+}
+
+SvXMLImportContext * SdXMLChartShapeContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( mpChartContext )
+ return mpChartContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLObjectShapeContext, SdXMLShapeContext );
+
+SdXMLObjectShapeContext::SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+SdXMLObjectShapeContext::~SdXMLObjectShapeContext()
+{
+}
+
+void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ // #96717# in theorie, if we don't have a url we shouldn't even
+ // export this ole shape. But practical its to risky right now
+ // to change this so we better dispose this on load
+ //if( !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
+ // return;
+
+ // #100592# this BugFix prevents that a shape is created. CL
+ // is thinking about an alternative.
+ // #i13140# Check for more than empty string in maHref, there are
+ // other possibilities that maHref results in empty container
+ // storage names
+ if( !(GetImport().getImportFlags() & IMPORT_EMBEDDED) && !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
+ return;
+
+ const char* pService = "com.sun.star.drawing.OLE2Shape";
+
+ sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) )
+ {
+ pService = "com.sun.star.presentation.ChartShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
+ {
+ pService = "com.sun.star.presentation.CalcShape";
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ pService = "com.sun.star.presentation.OLE2Shape";
+ }
+ }
+
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ if( !mbIsPlaceholder && maHref.getLength() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ if( xProps.is() )
+ {
+ OUString aPersistName = GetImport().ResolveEmbeddedObjectURL( maHref, maCLSID );
+
+ if ( GetImport().IsPackageURL( maHref ) )
+ {
+ const OUString sURL(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ));
+
+ if ( aPersistName.compareTo( sURL, sURL.getLength() ) == 0 )
+ aPersistName = aPersistName.copy( sURL.getLength() );
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ),
+ uno::makeAny( aPersistName ) );
+ }
+ else
+ {
+ // this is OOo link object
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkURL" ) ),
+ uno::makeAny( aPersistName ) );
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ SetStyle();
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+void SdXMLObjectShapeContext::EndElement()
+{
+ // #100592#
+ if( mxBase64Stream.is() )
+ {
+ OUString aPersistName( GetImport().ResolveEmbeddedObjectURLFromBase64() );
+ const OUString sURL(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ));
+
+ aPersistName = aPersistName.copy( sURL.getLength() );
+
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+ if( xProps.is() )
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ), uno::makeAny( aPersistName ) );
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_CLASS_ID ) )
+ {
+ maCLSID = rValue;
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = rValue;
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+SvXMLImportContext* SdXMLObjectShapeContext::CreateChildContext(
+ USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ // #100592#
+ SvXMLImportContext* pContext = NULL;
+
+ if((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_BINARY_DATA))
+ {
+ mxBase64Stream = GetImport().GetStreamForEmbeddedObjectURLFromBase64();
+ if( mxBase64Stream.is() )
+ pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ mxBase64Stream );
+ }
+ else if( ((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_DOCUMENT)) ||
+ ((XML_NAMESPACE_MATH == nPrefix) && IsXMLToken(rLocalName, XML_MATH)) )
+ {
+ XMLEmbeddedObjectImportContext *pEContext =
+ new XMLEmbeddedObjectImportContext( GetImport(), nPrefix,
+ rLocalName, xAttrList );
+ maCLSID = pEContext->GetFilterCLSID();
+ if( maCLSID.getLength() != 0 )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( xPropSet.is() )
+ {
+ xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), uno::makeAny( maCLSID ) );
+
+ uno::Reference< lang::XComponent > xComp;
+ xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp;
+ DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
+ pEContext->SetComponent( xComp );
+ }
+ }
+ pContext = pEContext;
+ }
+
+ // delegate to parent class if no context could be created
+ if(!pContext)
+ pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLAppletShapeContext, SdXMLShapeContext );
+
+SdXMLAppletShapeContext::SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbIsScript( sal_False )
+{
+}
+
+SdXMLAppletShapeContext::~SdXMLAppletShapeContext()
+{
+}
+
+void SdXMLAppletShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ const char* pService = "com.sun.star.drawing.AppletShape";
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLAppletShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_APPLET_NAME ) )
+ {
+ maAppletName = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_CODE ) )
+ {
+ maAppletCode = rValue;
+ return;
+ }
+ if( IsXMLToken( rLocalName, XML_MAY_SCRIPT ) )
+ {
+ mbIsScript = IsXMLToken( rValue, XML_TRUE );
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = GetImport().GetAbsoluteReference(rValue);
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLAppletShapeContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+
+ if ( maSize.Width && maSize.Height )
+ {
+ // the visual area for applet must be set on loading
+ awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
+ aAny <<= aRect;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
+ }
+
+ if( maParams.getLength() )
+ {
+ aAny <<= maParams;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ), aAny );
+ }
+
+ if( maHref.getLength() )
+ {
+ aAny <<= maHref;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ), aAny );
+ }
+
+ if( maAppletName.getLength() )
+ {
+ aAny <<= maAppletName;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ), aAny );
+ }
+
+ if( mbIsScript )
+ {
+ aAny <<= mbIsScript;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ), aAny );
+
+ }
+
+ if( maAppletCode.getLength() )
+ {
+ aAny <<= maAppletCode;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ), aAny );
+ }
+
+ aAny <<= ::rtl::OUString( GetImport().GetDocumentBase() );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletDocBase" ) ), aAny );
+
+ SetThumbnail();
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+SvXMLImportContext * SdXMLAppletShapeContext::CreateChildContext( USHORT p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
+ {
+ OUString aParamName, aParamValue;
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ // now parse the attribute list and look for draw:name and draw:value
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ if( nPrefix == XML_NAMESPACE_DRAW )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ aParamName = aValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_VALUE ) )
+ {
+ aParamValue = aValue;
+ }
+ }
+ }
+
+ if( aParamName.getLength() )
+ {
+ sal_Int32 nIndex = maParams.getLength();
+ maParams.realloc( nIndex + 1 );
+ maParams[nIndex].Name = aParamName;
+ maParams[nIndex].Handle = -1;
+ maParams[nIndex].Value <<= aParamValue;
+ maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ }
+
+ return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ }
+
+ return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPluginShapeContext, SdXMLShapeContext );
+
+SdXMLPluginShapeContext::SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape) :
+SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+mbMedia( false )
+{
+}
+
+SdXMLPluginShapeContext::~SdXMLPluginShapeContext()
+{
+}
+
+void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList)
+{
+ // watch for MimeType attribute to see if we have a media object
+ for( sal_Int16 n = 0, nAttrCount = ( xAttrList.is() ? xAttrList->getLength() : 0 ); n < nAttrCount; ++n )
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( n ), &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) )
+ {
+ if( 0 == xAttrList->getValueByIndex( n ).compareToAscii( "application/vnd.sun.star.media" ) )
+ mbMedia = true;
+
+ // leave this loop
+ n = nAttrCount - 1;
+ }
+ }
+
+ const char* pService;
+
+ sal_Bool bIsPresShape = sal_False;
+
+ if( mbMedia )
+ {
+ pService = "com.sun.star.drawing.MediaShape";
+
+ bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ pService = "com.sun.star.presentation.MediaShape";
+ }
+ }
+ }
+ else
+ pService = "com.sun.star.drawing.PluginShape";
+
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLPluginShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_MIME_TYPE ) )
+ {
+ maMimeType = rValue;
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = GetImport().GetAbsoluteReference(rValue);
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLPluginShapeContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+
+ if ( maSize.Width && maSize.Height )
+ {
+ const rtl::OUString sVisibleArea( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) );
+ uno::Reference< beans::XPropertySetInfo > aXPropSetInfo( xProps->getPropertySetInfo() );
+ if ( !aXPropSetInfo.is() || aXPropSetInfo->hasPropertyByName( sVisibleArea ) )
+ {
+ // the visual area for a plugin must be set on loading
+ awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
+ aAny <<= aRect;
+ xProps->setPropertyValue( sVisibleArea, aAny );
+ }
+ }
+
+ if( !mbMedia )
+ {
+ // in case we have a plugin object
+ if( maParams.getLength() )
+ {
+ aAny <<= maParams;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ), aAny );
+ }
+
+ if( maMimeType.getLength() )
+ {
+ aAny <<= maMimeType;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ), aAny );
+ }
+
+ if( maHref.getLength() )
+ {
+ aAny <<= maHref;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ), aAny );
+ }
+ }
+ else
+ {
+ // in case we have a media object
+
+ OUString sTempRef;
+
+ // check for package URL
+ if( GetImport().IsPackageURL( maHref ) )
+ {
+ sTempRef = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ }
+
+ sTempRef += maHref;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), uno::makeAny( sTempRef ) );
+
+ for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam )
+ {
+ const OUString& rName = maParams[ nParam ].Name;
+
+ if( 0 == rName.compareToAscii( "Loop" ) )
+ {
+ OUString aValueStr;
+ maParams[ nParam ].Value >>= aValueStr;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) ),
+ uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) );
+ }
+ else if( 0 == rName.compareToAscii( "Mute" ) )
+ {
+ OUString aValueStr;
+ maParams[ nParam ].Value >>= aValueStr;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) ),
+ uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) );
+ }
+ else if( 0 == rName.compareToAscii( "VolumeDB" ) )
+ {
+ OUString aValueStr;
+ maParams[ nParam ].Value >>= aValueStr;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ),
+ uno::makeAny( static_cast< sal_Int16 >( aValueStr.toInt32() ) ) );
+ }
+ else if( 0 == rName.compareToAscii( "Zoom" ) )
+ {
+ OUString aZoomStr;
+ media::ZoomLevel eZoomLevel;
+
+ maParams[ nParam ].Value >>= aZoomStr;
+
+ if( 0 == aZoomStr.compareToAscii( "25%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_1_TO_4;
+ else if( 0 == aZoomStr.compareToAscii( "50%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_1_TO_2;
+ else if( 0 == aZoomStr.compareToAscii( "100%" ) )
+ eZoomLevel = media::ZoomLevel_ORIGINAL;
+ else if( 0 == aZoomStr.compareToAscii( "200%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_2_TO_1;
+ else if( 0 == aZoomStr.compareToAscii( "400%" ) )
+ eZoomLevel = media::ZoomLevel_ZOOM_4_TO_1;
+ else if( 0 == aZoomStr.compareToAscii( "fit" ) )
+ eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
+ else if( 0 == aZoomStr.compareToAscii( "fixedfit" ) )
+ eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT;
+ else if( 0 == aZoomStr.compareToAscii( "fullscreen" ) )
+ eZoomLevel = media::ZoomLevel_FULLSCREEN;
+ else
+ eZoomLevel = media::ZoomLevel_NOT_AVAILABLE;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), uno::makeAny( eZoomLevel ) );
+ }
+ }
+ }
+
+ SetThumbnail();
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+SvXMLImportContext * SdXMLPluginShapeContext::CreateChildContext( USHORT p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
+ {
+ OUString aParamName, aParamValue;
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ // now parse the attribute list and look for draw:name and draw:value
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex(a);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
+ const OUString aValue( xAttrList->getValueByIndex(a) );
+
+ if( nPrefix == XML_NAMESPACE_DRAW )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ aParamName = aValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_VALUE ) )
+ {
+ aParamValue = aValue;
+ }
+ }
+
+ if( aParamName.getLength() )
+ {
+ sal_Int32 nIndex = maParams.getLength();
+ maParams.realloc( nIndex + 1 );
+ maParams[nIndex].Name = aParamName;
+ maParams[nIndex].Handle = -1;
+ maParams[nIndex].Value <<= aParamValue;
+ maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ }
+
+ return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLFloatingFrameShapeContext, SdXMLShapeContext );
+
+SdXMLFloatingFrameShapeContext::SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+SdXMLFloatingFrameShapeContext::~SdXMLFloatingFrameShapeContext()
+{
+}
+
+void SdXMLFloatingFrameShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
+{
+ const char* pService = "com.sun.star.drawing.FrameShape";
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ uno::Any aAny;
+
+ if( maFrameName.getLength() )
+ {
+ aAny <<= maFrameName;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ), aAny );
+ }
+
+ if( maHref.getLength() )
+ {
+ aAny <<= maHref;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ), aAny );
+ }
+ }
+
+ SetStyle();
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLFloatingFrameShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_DRAW:
+ if( IsXMLToken( rLocalName, XML_FRAME_NAME ) )
+ {
+ maFrameName = rValue;
+ return;
+ }
+ break;
+ case XML_NAMESPACE_XLINK:
+ if( IsXMLToken( rLocalName, XML_HREF ) )
+ {
+ maHref = GetImport().GetAbsoluteReference(rValue);
+ return;
+ }
+ break;
+ }
+
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+void SdXMLFloatingFrameShapeContext::EndElement()
+{
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+
+ if( xProps.is() )
+ {
+ if ( maSize.Width && maSize.Height )
+ {
+ // the visual area for a floating frame must be set on loading
+ awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
+ uno::Any aAny;
+ aAny <<= aRect;
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
+ }
+ }
+
+ SetThumbnail();
+ SdXMLShapeContext::EndElement();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLFrameShapeContext, SdXMLShapeContext );
+
+SdXMLFrameShapeContext::SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
+ mbSupportsReplacement( sal_False )
+{
+ uno::Reference < util::XCloneable > xClone( xAttrList, uno::UNO_QUERY );
+ if( xClone.is() )
+ mxAttrList.set( xClone->createClone(), uno::UNO_QUERY );
+ else
+ mxAttrList = new SvXMLAttributeList( xAttrList );
+
+}
+
+SdXMLFrameShapeContext::~SdXMLFrameShapeContext()
+{
+}
+
+SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext * pContext = 0;
+
+ if( !mxImplContext.Is() )
+ {
+ pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
+
+ mxImplContext = pContext;
+ mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
+ IsXMLToken( rLocalName, XML_OBJECT_OLE );
+ }
+ else if( mbSupportsReplacement && !mxReplImplContext &&
+ XML_NAMESPACE_DRAW == nPrefix &&
+ IsXMLToken( rLocalName, XML_IMAGE ) )
+ {
+ // read replacement image
+ SvXMLImportContext *pImplContext = &mxImplContext;
+ SdXMLShapeContext *pSContext =
+ PTR_CAST( SdXMLShapeContext, pImplContext );
+ if( pSContext )
+ {
+ uno::Reference < beans::XPropertySet > xPropSet(
+ pSContext->getShape(), uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ pContext = new XMLReplacementImageContext( GetImport(),
+ nPrefix, rLocalName, xAttrList, xPropSet );
+ mxReplImplContext = pContext;
+ }
+ }
+ }
+ else if(
+ ( nPrefix == XML_NAMESPACE_SVG && // #i68101#
+ (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) ||
+ (nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) ||
+ (nPrefix == XML_NAMESPACE_DRAW && (IsXMLToken( rLocalName, XML_GLUE_POINT ) ||
+ IsXMLToken( rLocalName, XML_THUMBNAIL ) ) ) )
+ {
+ SvXMLImportContext *pImplContext = &mxImplContext;
+ pContext = PTR_CAST( SdXMLShapeContext, pImplContext )->CreateChildContext( nPrefix,
+ rLocalName, xAttrList );
+ }
+ else if ( (XML_NAMESPACE_DRAW == nPrefix) && IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
+ {
+ SdXMLShapeContext *pSContext = dynamic_cast< SdXMLShapeContext* >( &mxImplContext );
+ if( pSContext )
+ {
+ uno::Reference < beans::XPropertySet > xPropSet( pSContext->getShape(), uno::UNO_QUERY );
+ if (xPropSet.is())
+ {
+ pContext = new XMLImageMapContext(GetImport(), nPrefix, rLocalName, xPropSet);
+ }
+ }
+ }
+
+ // call parent for content
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+
+ return pContext;
+}
+
+void SdXMLFrameShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
+{
+ // ignore
+}
+
+void SdXMLFrameShapeContext::EndElement()
+{
+ if( !mxImplContext.Is() )
+ {
+ // now check if this is an empty presentation object
+ sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0;
+ for(sal_Int16 a(0); a < nAttrCount; a++)
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName);
+
+ if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ if( IsXMLToken( aLocalName, XML_PLACEHOLDER ) )
+ {
+ mbIsPlaceholder = IsXMLToken( mxAttrList->getValueByIndex(a), XML_TRUE );
+ }
+ else if( IsXMLToken( aLocalName, XML_CLASS ) )
+ {
+ maPresentationClass = mxAttrList->getValueByIndex(a);
+ }
+ }
+ }
+
+ if( (maPresentationClass.getLength() != 0) && mbIsPlaceholder )
+ {
+ uno::Reference< xml::sax::XAttributeList> xEmpty;
+
+ enum XMLTokenEnum eToken = XML_TEXT_BOX;
+
+ if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) )
+ {
+ eToken = XML_IMAGE;
+
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) )
+ {
+ eToken = XML_PAGE_THUMBNAIL;
+ }
+ else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) ||
+ IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ||
+ IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ eToken = XML_OBJECT;
+ }
+
+ mxImplContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+ GetImport(), XML_NAMESPACE_DRAW, GetXMLToken( eToken ), mxAttrList, mxShapes, xEmpty );
+
+ if( mxImplContext.Is() )
+ {
+ mxImplContext->StartElement( mxAttrList );
+ mxImplContext->EndElement();
+ }
+ }
+ }
+
+ mxImplContext = 0;
+ SdXMLShapeContext::EndElement();
+}
+
+void SdXMLFrameShapeContext::processAttribute( sal_uInt16,
+ const ::rtl::OUString&, const ::rtl::OUString& )
+{
+ // ignore
+}
+
+TYPEINIT1( SdXMLCustomShapeContext, SdXMLShapeContext );
+
+SdXMLCustomShapeContext::SdXMLCustomShapeContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape)
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLCustomShapeContext::~SdXMLCustomShapeContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLCustomShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_ENGINE ) )
+ {
+ maCustomShapeEngine = rValue;
+ return;
+ }
+ if ( IsXMLToken( rLocalName, XML_DATA ) )
+ {
+ maCustomShapeData = rValue;
+ return;
+ }
+ }
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // create rectangle shape
+ AddShape("com.sun.star.drawing.CustomShape");
+ if ( mxShape.is() )
+ {
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
+
+ // set pos, size, shear and rotate
+ SetTransformation();
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ if ( maCustomShapeEngine.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= maCustomShapeEngine;
+ xPropSet->setPropertyValue( EASGet( EAS_CustomShapeEngine ), aAny );
+ }
+ if ( maCustomShapeData.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= maCustomShapeData;
+ xPropSet->setPropertyValue( EASGet( EAS_CustomShapeData ), aAny );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "could not set enhanced customshape geometry" );
+ }
+ SdXMLShapeContext::StartElement(xAttrList);
+ }
+}
+
+void SdXMLCustomShapeContext::EndElement()
+{
+ if ( !maCustomShapeGeometry.empty() )
+ {
+ const rtl::OUString sCustomShapeGeometry ( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
+
+ // converting the vector to a sequence
+ uno::Sequence< beans::PropertyValue > aSeq( maCustomShapeGeometry.size() );
+ beans::PropertyValue* pValues = aSeq.getArray();
+ std::vector< beans::PropertyValue >::const_iterator aIter( maCustomShapeGeometry.begin() );
+ std::vector< beans::PropertyValue >::const_iterator aEnd( maCustomShapeGeometry.end() );
+ while ( aIter != aEnd )
+ *pValues++ = *aIter++;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Any aAny;
+ aAny <<= aSeq;
+ xPropSet->setPropertyValue( sCustomShapeGeometry, aAny );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "could not set enhanced customshape geometry" );
+ }
+
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ GetImport().getBuildIds( nUPD, nBuild );
+ if( ((nUPD >= 640 && nUPD <= 645) || (nUPD == 680)) && (nBuild <= 9221) )
+ {
+ Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( mxShape, UNO_QUERY );
+ if( xDefaulter.is() )
+ {
+ rtl::OUString aEmptyType;
+ xDefaulter->createCustomShapeDefaults( aEmptyType );
+ }
+ }
+ }
+
+ SdXMLShapeContext::EndElement();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLCustomShapeContext::CreateChildContext(
+ USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+ if ( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if ( IsXMLToken( rLocalName, XML_ENHANCED_GEOMETRY ) )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ pContext = new XMLEnhancedCustomShapeContext( GetImport(), mxShape, nPrefix, rLocalName, maCustomShapeGeometry );
+ }
+ }
+ // delegate to parent class if no context could be created
+ if ( NULL == pContext )
+ pContext = SdXMLShapeContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList);
+ return pContext;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLTableShapeContext, SdXMLShapeContext );
+
+SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes )
+: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, sal_False )
+{
+ memset( &maTemplateStylesUsed, 0, sizeof( maTemplateStylesUsed ) );
+}
+
+SdXMLTableShapeContext::~SdXMLTableShapeContext()
+{
+}
+
+void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+{
+ const char* pService = "com.sun.star.drawing.TableShape";
+
+ sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
+ {
+ pService = "com.sun.star.presentation.TableShape";
+ }
+ }
+
+ AddShape( pService );
+
+ if( mxShape.is() )
+ {
+ SetLayer();
+
+ uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
+
+ if(bIsPresShape)
+ {
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
+ SetStyle();
+
+ if( xProps.is() )
+ {
+ if( msTemplateStyleName.getLength() ) try
+ {
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetImport().GetModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("table" ) );
+ Reference< XNameAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+ Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ), Any( xTableStyle ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
+ }
+
+ const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
+ for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ )
+ {
+ try
+ {
+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
+ xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
+ }
+ }
+ }
+
+ GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
+
+ const rtl::Reference< XMLTableImport >& xTableImport( GetImport().GetShapeImport()->GetShapeTableImport() );
+ if( xTableImport.is() && xProps.is() )
+ {
+ uno::Reference< table::XColumnRowRange > xColumnRowRange(
+ xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ), uno::UNO_QUERY );
+
+ if( xColumnRowRange.is() )
+ mxTableImportContext = xTableImport->CreateTableContext( GetPrefix(), GetLocalName(), xColumnRowRange );
+
+ if( mxTableImportContext.Is() )
+ mxTableImportContext->StartElement( xAttrList );
+ }
+ }
+}
+
+void SdXMLTableShapeContext::EndElement()
+{
+ if( mxTableImportContext.Is() )
+ mxTableImportContext->EndElement();
+
+ SdXMLShapeContext::EndElement();
+
+ if( mxShape.is() )
+ {
+ // set pos, size, shear and rotate
+ SetTransformation();
+ }
+}
+
+// this is called from the parent group for each unparsed attribute in the attribute list
+void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ if( nPrefix == XML_NAMESPACE_TABLE )
+ {
+ if( IsXMLToken( rLocalName, XML_TEMPLATE_NAME ) )
+ {
+ msTemplateStyleName = rValue;
+ }
+ else
+ {
+ int i = 0;
+ const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
+ while( pEntry->msApiName && (i < 6) )
+ {
+ if( IsXMLToken( rLocalName, pEntry->meXMLName ) )
+ {
+ if( IsXMLToken( rValue, XML_TRUE ) )
+ maTemplateStylesUsed[i] = sal_True;
+ break;
+ }
+ pEntry++;
+ i++;
+ }
+ }
+ }
+ SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+}
+
+SvXMLImportContext* SdXMLTableShapeContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ if( mxTableImportContext.Is() && (nPrefix == XML_NAMESPACE_TABLE) )
+ return mxTableImportContext->CreateChildContext(nPrefix, rLocalName, xAttrList);
+ else
+ return SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+}
+
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
new file mode 100644
index 000000000000..bf15534fc260
--- /dev/null
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -0,0 +1,664 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPSHAPE_HXX
+#define _XIMPSHAPE_HXX
+
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <tools/rtti.hxx>
+#include "xexptran.hxx"
+
+#include <vector>
+#include <xmloff/shapeimport.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// common shape context
+
+class SdXMLShapeContext : public SvXMLShapeContext
+{
+protected:
+ // the shape group this object should be created inside
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > mxCursor;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > mxOldCursor;
+ com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList> mxAttrList;
+ com::sun::star::uno::Reference< com::sun::star::container::XIdentifierContainer > mxGluePoints;
+ com::sun::star::uno::Reference< com::sun::star::document::XActionLockable > mxLockable;
+
+ rtl::OUString maDrawStyleName;
+ rtl::OUString maTextStyleName;
+ rtl::OUString maPresentationClass;
+ rtl::OUString maShapeName;
+ rtl::OUString maThumbnailURL;
+
+ /// whether to restore list context (#91964#)
+ bool mbListContextPushed;
+
+ sal_uInt16 mnStyleFamily;
+ sal_uInt16 mnClass;
+ sal_Bool mbIsPlaceholder;
+ bool mbClearDefaultAttributes;
+ sal_Bool mbIsUserTransformed;
+ sal_Int32 mnZOrder;
+ rtl::OUString maShapeId;
+ rtl::OUString maLayerName;
+
+ // #i68101#
+ rtl::OUString maShapeTitle;
+ rtl::OUString maShapeDescription;
+
+ SdXMLImExTransform2D mnTransform;
+ com::sun::star::awt::Size maSize;
+ com::sun::star::awt::Point maPosition;
+
+ bool mbVisible;
+ bool mbPrintable;
+
+ /** if bSupportsStyle is false, auto styles will be set but not a style */
+ void SetStyle( bool bSupportsStyle = true );
+ void SetLayer();
+ void SetThumbnail();
+
+ void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape);
+ void AddShape(const char* pServiceName );
+ void SetTransformation();
+
+ SvXMLImport& GetImport() { return SvXMLImportContext::GetImport(); }
+ const SvXMLImport& GetImport() const { return SvXMLImportContext::GetImport(); }
+
+ void addGluePoint( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ sal_Bool isPresentationShape() const;
+
+public:
+ TYPEINFO();
+
+ SdXMLShapeContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLShapeContext();
+
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:rect context
+
+class SdXMLRectShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnRadius;
+
+public:
+ TYPEINFO();
+
+ SdXMLRectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLRectShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:line context
+
+class SdXMLLineShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnX1;
+ sal_Int32 mnY1;
+ sal_Int32 mnX2;
+ sal_Int32 mnY2;
+
+public:
+ TYPEINFO();
+
+ SdXMLLineShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLLineShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:ellipse and draw:circle context
+
+class SdXMLEllipseShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnCX;
+ sal_Int32 mnCY;
+ sal_Int32 mnRX;
+ sal_Int32 mnRY;
+
+ USHORT meKind;
+ sal_Int32 mnStartAngle;
+ sal_Int32 mnEndAngle;
+public:
+ TYPEINFO();
+
+ SdXMLEllipseShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLEllipseShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:polyline and draw:polygon context
+
+class SdXMLPolygonShapeContext : public SdXMLShapeContext
+{
+ rtl::OUString maPoints;
+ rtl::OUString maViewBox;
+ sal_Bool mbClosed;
+
+public:
+ TYPEINFO();
+
+ SdXMLPolygonShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape);
+ virtual ~SdXMLPolygonShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:path context
+
+class SdXMLPathShapeContext : public SdXMLShapeContext
+{
+ rtl::OUString maD;
+ rtl::OUString maViewBox;
+ sal_Bool mbClosed;
+
+public:
+ TYPEINFO();
+
+ SdXMLPathShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLPathShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:text-box context
+
+class SdXMLTextBoxShapeContext : public SdXMLShapeContext
+{
+ sal_Int32 mnRadius;
+
+public:
+ TYPEINFO();
+
+ SdXMLTextBoxShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLTextBoxShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:control context
+
+class SdXMLControlShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maFormId;
+
+public:
+ TYPEINFO();
+
+ SdXMLControlShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLControlShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:connector context
+
+class SdXMLConnectorShapeContext : public SdXMLShapeContext
+{
+private:
+ ::com::sun::star::awt::Point maStart;
+ ::com::sun::star::awt::Point maEnd;
+
+ USHORT mnType;
+
+ rtl::OUString maStartShapeId;
+ sal_Int32 mnStartGlueId;
+ rtl::OUString maEndShapeId;
+ sal_Int32 mnEndGlueId;
+
+ sal_Int32 mnDelta1;
+ sal_Int32 mnDelta2;
+ sal_Int32 mnDelta3;
+
+ com::sun::star::uno::Any maPath;
+
+public:
+ TYPEINFO();
+
+ SdXMLConnectorShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLConnectorShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:measure context
+
+class SdXMLMeasureShapeContext : public SdXMLShapeContext
+{
+private:
+ ::com::sun::star::awt::Point maStart;
+ ::com::sun::star::awt::Point maEnd;
+
+public:
+ TYPEINFO();
+
+ SdXMLMeasureShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLMeasureShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual void EndElement();
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:page context
+
+class SdXMLPageShapeContext : public SdXMLShapeContext
+{
+private:
+ sal_Int32 mnPageNumber;
+public:
+ TYPEINFO();
+
+ SdXMLPageShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLPageShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:caption context
+
+class SdXMLCaptionShapeContext : public SdXMLShapeContext
+{
+private:
+ com::sun::star::awt::Point maCaptionPoint;
+ sal_Int32 mnRadius;
+
+public:
+ TYPEINFO();
+
+ SdXMLCaptionShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLCaptionShapeContext();
+ virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:image context
+
+class SdXMLGraphicObjectShapeContext : public SdXMLShapeContext
+{
+private:
+ ::rtl::OUString maURL;
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
+
+public:
+ TYPEINFO();
+
+ SdXMLGraphicObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLGraphicObjectShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// chart:chart context
+
+class SdXMLChartShapeContext : public SdXMLShapeContext
+{
+ SvXMLImportContext* mpChartContext;
+
+public:
+ TYPEINFO();
+
+ SdXMLChartShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLChartShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:object and draw:object_ole context
+
+class SdXMLObjectShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maCLSID;
+ rtl::OUString maHref;
+
+ // #100592#
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > mxBase64Stream;
+
+public:
+ TYPEINFO();
+
+ SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLObjectShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ // #100592#
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:applet
+
+class SdXMLAppletShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maAppletName;
+ rtl::OUString maAppletCode;
+ rtl::OUString maHref;
+ sal_Bool mbIsScript;
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams;
+
+public:
+ TYPEINFO();
+
+ SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLAppletShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:plugin
+
+class SdXMLPluginShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maMimeType;
+ rtl::OUString maHref;
+ bool mbMedia;
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maParams;
+
+public:
+ TYPEINFO();
+
+ SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLPluginShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:floating-frame
+
+class SdXMLFloatingFrameShapeContext : public SdXMLShapeContext
+{
+private:
+ rtl::OUString maFrameName;
+ rtl::OUString maHref;
+
+public:
+ TYPEINFO();
+
+ SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLFloatingFrameShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:-frame
+
+class SdXMLFrameShapeContext : public SdXMLShapeContext
+{
+private:
+ sal_Bool mbSupportsReplacement;
+ SvXMLImportContextRef mxImplContext;
+ SvXMLImportContextRef mxReplImplContext;
+
+public:
+ TYPEINFO();
+
+ SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLFrameShapeContext();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+class SdXMLCustomShapeContext : public SdXMLShapeContext
+{
+
+protected :
+
+ rtl::OUString maCustomShapeEngine;
+ rtl::OUString maCustomShapeData;
+
+ std::vector< com::sun::star::beans::PropertyValue > maCustomShapeGeometry;
+
+public:
+
+ TYPEINFO();
+
+ SdXMLCustomShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
+ sal_Bool bTemporaryShape);
+ virtual ~SdXMLCustomShapeContext();
+
+ virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:table
+
+class SdXMLTableShapeContext : public SdXMLShapeContext
+{
+public:
+ TYPEINFO();
+
+ SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes );
+ virtual ~SdXMLTableShapeContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ // this is called from the parent group for each unparsed attribute in the attribute list
+ virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+
+private:
+ SvXMLImportContextRef mxTableImportContext;
+ rtl::OUString msTemplateStyleName;
+ sal_Bool maTemplateStylesUsed[6];
+};
+
+#endif // _XIMPSHAPE_HXX
diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx
new file mode 100644
index 000000000000..f5df8c58d6ba
--- /dev/null
+++ b/xmloff/source/draw/ximpshow.cxx
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <tools/debug.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <xmloff/xmltoken.hxx>
+#include <comphelper/extract.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "ximpshow.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::presentation;
+using namespace ::xmloff::token;
+
+///////////////////////////////////////////////////////////////////////
+
+class ShowsImpImpl
+{
+public:
+ Reference< XSingleServiceFactory > mxShowFactory;
+ Reference< XNameContainer > mxShows;
+ Reference< XPropertySet > mxPresProps;
+ Reference< XNameAccess > mxPages;
+ OUString maCustomShowName;
+ SdXMLImport& mrImport;
+
+ ShowsImpImpl( SdXMLImport& rImport )
+ : mrImport( rImport )
+ {}
+};
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLShowsContext, SvXMLImportContext );
+
+SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ mpImpl = new ShowsImpImpl( rImport );
+
+ Reference< XCustomPresentationSupplier > xShowsSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xShowsSupplier.is() )
+ {
+ mpImpl->mxShows = xShowsSupplier->getCustomPresentations();
+ mpImpl->mxShowFactory = Reference< XSingleServiceFactory >::query( mpImpl->mxShows );
+ }
+
+ Reference< XDrawPagesSupplier > xDrawPagesSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xDrawPagesSupplier.is() )
+ mpImpl->mxPages = Reference< XNameAccess >::query( xDrawPagesSupplier->getDrawPages() );
+
+ Reference< XPresentationSupplier > xPresentationSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xPresentationSupplier.is() )
+ mpImpl->mxPresProps = Reference< XPropertySet >::query( xPresentationSupplier->getPresentation() );
+
+
+ if( mpImpl->mxPresProps.is() )
+ {
+ sal_Bool bAll = sal_True;
+ uno::Any aAny;
+
+ // read attributes
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_START_PAGE ) )
+ {
+ aAny <<= sValue;
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ), aAny );
+ bAll = sal_False;
+ }
+ else if( IsXMLToken( aLocalName, XML_SHOW ) )
+ {
+ mpImpl->maCustomShowName = sValue;
+ bAll = sal_False;
+ }
+ else if( IsXMLToken( aLocalName, XML_PAUSE ) )
+ {
+ DateTime aTime;
+ if( !SvXMLUnitConverter::convertTime( aTime, sValue ) )
+ continue;
+
+ const sal_Int32 nMS = ( aTime.Hours * 60 + aTime.Minutes ) * 60 + aTime.Seconds;
+ aAny <<= nMS;
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_ANIMATIONS ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_ENABLED ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_STAY_ON_TOP ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_FORCE_MANUAL ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_ENDLESS ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_FULL_SCREEN ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_MOUSE_VISIBLE ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_START_WITH_NAVIGATOR ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_MOUSE_AS_PEN ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_TRANSITION_ON_CLICK ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_ENABLED ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ), aAny );
+ }
+ else if( IsXMLToken( aLocalName, XML_SHOW_LOGO ) )
+ {
+ aAny = bool2any( IsXMLToken( sValue, XML_TRUE ) );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ), aAny );
+ }
+ }
+ }
+ aAny = bool2any( bAll );
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ), aAny );
+ }
+}
+
+SdXMLShowsContext::~SdXMLShowsContext()
+{
+ if( mpImpl && mpImpl->maCustomShowName.getLength() )
+ {
+ uno::Any aAny;
+ aAny <<= mpImpl->maCustomShowName;
+ mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ), aAny );
+ }
+
+ delete mpImpl;
+}
+
+SvXMLImportContext * SdXMLShowsContext::CreateChildContext( USHORT p_nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ if( mpImpl && p_nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SHOW ) )
+ {
+ OUString aName;
+ OUString aPages;
+
+ // read attributes
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_PRESENTATION:
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ aName = sValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_PAGES ) )
+ {
+ aPages = sValue;
+ }
+ }
+ }
+
+ if( aName.getLength() != 0 && aPages.getLength() != 0 )
+ {
+ Reference< XIndexContainer > xShow( mpImpl->mxShowFactory->createInstance(), UNO_QUERY );
+ if( xShow.is() )
+ {
+ SvXMLTokenEnumerator aPageNames( aPages, sal_Unicode(',') );
+ OUString sPageName;
+ Any aAny;
+
+ while( aPageNames.getNextToken( sPageName ) )
+ {
+ if( !mpImpl->mxPages->hasByName( sPageName ) )
+ continue;
+
+ Reference< XDrawPage > xPage;
+ mpImpl->mxPages->getByName( sPageName ) >>= xPage;
+ if( xPage.is() )
+ {
+ aAny <<= xPage;
+ xShow->insertByIndex( xShow->getCount(), aAny );
+ }
+ }
+
+ aAny <<= xShow;
+
+ if( mpImpl->mxShows->hasByName( aName ) )
+ {
+ mpImpl->mxShows->replaceByName( aName, aAny );
+ }
+ else
+ {
+ mpImpl->mxShows->insertByName( aName, aAny );
+ }
+ }
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+}
+
diff --git a/xmloff/source/draw/ximpshow.hxx b/xmloff/source/draw/ximpshow.hxx
new file mode 100644
index 000000000000..399900711c46
--- /dev/null
+++ b/xmloff/source/draw/ximpshow.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XIMPSHOW_HXX
+#define _XMLOFF_XIMPSHOW_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+
+class ShowsImpImpl;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class SdXMLShowsContext : public SvXMLImportContext
+{
+ ShowsImpImpl* mpImpl;
+
+public:
+ TYPEINFO();
+
+ SdXMLShowsContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLShowsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_XIMPSHOW_HXX
+
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
new file mode 100644
index 000000000000..01f0fa0faf5c
--- /dev/null
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -0,0 +1,1692 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include "ximpstyl.hxx"
+#include <xmloff/XMLShapeStyleContext.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "ximpnote.hxx"
+#include <tools/debug.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
+#include <comphelper/namecontainer.hxx>
+#include <xmloff/xmlprcon.hxx>
+#include <xmloff/families.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <svl/zforlist.hxx>
+#include "PropertySetMerger.hxx"
+#include "sdpropls.hxx"
+#include "layerimp.hxx"
+#include <xmloff/XMLGraphicsDefaultStyle.hxx>
+#include "XMLNumberStylesImport.hxx"
+#include "xmlerror.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLDrawingPagePropertySetContext : public SvXMLPropertySetContext
+{
+public:
+
+ TYPEINFO();
+
+ SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap );
+
+ virtual ~SdXMLDrawingPagePropertySetContext();
+
+ using SvXMLPropertySetContext::CreateChildContext;
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp);
+};
+
+TYPEINIT1( SdXMLDrawingPagePropertySetContext, SvXMLPropertySetContext );
+
+SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap ) :
+ SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList,
+ XML_TYPE_PROP_DRAWING_PAGE, rProps, rMap )
+{
+}
+
+SdXMLDrawingPagePropertySetContext::~SdXMLDrawingPagePropertySetContext()
+{
+}
+
+SvXMLImportContext *SdXMLDrawingPagePropertySetContext::CreateChildContext(
+ sal_uInt16 p_nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp )
+{
+ SvXMLImportContext *pContext = 0;
+
+ switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
+ {
+ case CTF_PAGE_SOUND_URL:
+ {
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
+
+ if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ uno::Any aAny( GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) ) );
+ XMLPropertyState aPropState( rProp.mnIndex, aAny );
+ rProperties.push_back( aPropState );
+ }
+ }
+ break;
+ }
+ }
+
+ if( !pContext )
+ pContext = SvXMLPropertySetContext::CreateChildContext( p_nPrefix, rLocalName,
+ xAttrList,
+ rProperties, rProp );
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdXMLDrawingPageStyleContext : public XMLPropStyleContext
+{
+public:
+ TYPEINFO();
+
+ SdXMLDrawingPageStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID);
+ virtual ~SdXMLDrawingPageStyleContext();
+
+ SvXMLImportContext * CreateChildContext(
+ sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+
+ virtual void Finish( sal_Bool bOverwrite );
+
+ // #i35918#
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+};
+
+TYPEINIT1( SdXMLDrawingPageStyleContext, XMLPropStyleContext );
+
+SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ sal_uInt16 nFamily)
+: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily )
+{
+}
+
+SdXMLDrawingPageStyleContext::~SdXMLDrawingPageStyleContext()
+{
+}
+
+SvXMLImportContext *SdXMLDrawingPageStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new SdXMLDrawingPagePropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ GetProperties(),
+ xImpPrMap );
+ }
+
+ if( !pContext )
+ pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void SdXMLDrawingPageStyleContext::Finish( sal_Bool bOverwrite )
+{
+ XMLPropStyleContext::Finish( bOverwrite );
+
+ ::std::vector< XMLPropertyState > &rProperties = GetProperties();
+
+ const UniReference< XMLPropertySetMapper >& rImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
+
+ ::std::vector< XMLPropertyState >::iterator property = rProperties.begin();
+ for(; property != rProperties.end(); property++)
+ {
+ if( property->mnIndex == -1 )
+ continue;
+
+ sal_Int16 nContextID = rImpPrMap->GetEntryContextId(property->mnIndex);
+ switch( nContextID )
+ {
+ case CTF_DATE_TIME_FORMAT:
+ {
+ OUString sStyleName;
+ (*property).maValue >>= sStyleName;
+
+ sal_Int32 nStyle = 0;
+
+ SdXMLNumberFormatImportContext* pSdNumStyle =
+ PTR_CAST( SdXMLNumberFormatImportContext,
+ GetStyles()->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, sStyleName, sal_True ) );
+
+ if( pSdNumStyle )
+ nStyle = pSdNumStyle->GetDrawKey();
+
+ (*property).maValue <<= nStyle;
+ }
+ break;
+ }
+ }
+
+}
+
+// #i35918#
+void SdXMLDrawingPageStyleContext::FillPropertySet(
+ const Reference< beans::XPropertySet > & rPropSet )
+{
+ const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
+ struct _ContextID_Index_Pair aContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
+ {
+ { CTF_DASHNAME , -1 },
+ { CTF_LINESTARTNAME , -1 },
+ { CTF_LINEENDNAME , -1 },
+ { CTF_FILLGRADIENTNAME, -1 },
+ { CTF_FILLTRANSNAME , -1 },
+ { CTF_FILLHATCHNAME , -1 },
+ { CTF_FILLBITMAPNAME , -1 },
+ { -1, -1 }
+ };
+ static sal_uInt16 aFamilies[MAX_SPECIAL_DRAW_STYLES] =
+ {
+ XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_HATCH_ID,
+ XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
+ };
+
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ GetStyles()->GetImportPropertyMapper( GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+
+ Reference< beans::XPropertySetInfo > xInfo;
+ for( sal_uInt16 i=0; i<MAX_SPECIAL_DRAW_STYLES; i++ )
+ {
+ sal_Int32 nIndex = aContextIDs[i].nIndex;
+ if( nIndex != -1 )
+ {
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ OUString sStyleName;
+ rState.maValue >>= sStyleName;
+ sStyleName = GetImport().GetStyleDisplayName( aFamilies[i],
+ sStyleName );
+ // get property set mapper
+ UniReference<XMLPropertySetMapper> rPropMapper =
+ xImpPrMap->getPropertySetMapper();
+
+ // set property
+ const OUString& rPropertyName =
+ rPropMapper->GetEntryAPIName(rState.mnIndex);
+ if( !xInfo.is() )
+ xInfo = rPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPageMasterStyleContext, SvXMLStyleContext );
+
+SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID),
+ mnBorderBottom( 0L ),
+ mnBorderLeft( 0L ),
+ mnBorderRight( 0L ),
+ mnBorderTop( 0L ),
+ mnWidth( 0L ),
+ mnHeight( 0L ),
+ meOrientation(GetSdImport().IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
+{
+ // set family to something special at SvXMLStyleContext
+ // for differences in search-methods
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterStyleAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderTop, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderBottom, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderLeft, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderRight, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue);
+ break;
+ }
+ case XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION:
+ {
+ if( IsXMLToken( sValue, XML_PORTRAIT ) )
+ meOrientation = view::PaperOrientation_PORTRAIT;
+ else
+ meOrientation = view::PaperOrientation_LANDSCAPE;
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPageMasterStyleContext::~SdXMLPageMasterStyleContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPageMasterContext, SvXMLStyleContext );
+
+SdXMLPageMasterContext::SdXMLPageMasterContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID),
+ mpPageMasterStyle( 0L )
+{
+ // set family to something special at SvXMLStyleContext
+ // for differences in search-methods
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_PAGEMASTER_NAME:
+ {
+ msName = sValue;
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPageMasterContext::~SdXMLPageMasterContext()
+{
+ // release remembered contexts, they are no longer needed
+ if(mpPageMasterStyle)
+ {
+ mpPageMasterStyle->ReleaseRef();
+ mpPageMasterStyle = 0L;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
+ {
+ pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
+
+ // remember SdXMLPresentationPlaceholderContext for later evaluation
+ if(pContext)
+ {
+ pContext->AddRef();
+ DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)");
+ mpPageMasterStyle = (SdXMLPageMasterStyleContext*)pContext;
+ }
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLPresentationPageLayoutContext, SvXMLStyleContext );
+
+SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID),
+ mnTypeId( 20 ) // AUTOLAYOUT_NONE
+{
+ // set family to somethiong special at SvXMLStyleContext
+ // for differences in search-methods
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+
+ if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ msName = xAttrList->getValueByIndex( i );
+ }
+ }
+}
+
+SdXMLPresentationPageLayoutContext::~SdXMLPresentationPageLayoutContext()
+{
+}
+
+SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
+ {
+ // presentation:placeholder inside style:presentation-page-layout context
+ pContext = new SdXMLPresentationPlaceholderContext(
+ GetSdImport(), nPrefix, rLocalName, xAttrList);
+
+ // remember SdXMLPresentationPlaceholderContext for later evaluation
+ if(pContext)
+ {
+ pContext->AddRef();
+ maList.Insert((SdXMLPresentationPlaceholderContext*)pContext, LIST_APPEND);
+ }
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+void SdXMLPresentationPageLayoutContext::EndElement()
+{
+ // build presentation page layout type here
+ // calc mnTpeId due to content of maList
+ // at the moment only use number of types used there
+ if(maList.Count())
+ {
+ SdXMLPresentationPlaceholderContext* pObj0 = maList.GetObject(0);
+ if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("handout"))))
+ {
+ switch( maList.Count() )
+ {
+ case 1:
+ mnTypeId = 22; // AUTOLAYOUT_HANDOUT1
+ break;
+ case 2:
+ mnTypeId = 23; // AUTOLAYOUT_HANDOUT2
+ break;
+ case 3:
+ mnTypeId = 24; // AUTOLAYOUT_HANDOUT3
+ break;
+ case 4:
+ mnTypeId = 25; // AUTOLAYOUT_HANDOUT4
+ break;
+ case 9:
+ mnTypeId = 31; // AUTOLAYOUT_HANDOUT9
+ break;
+ default:
+ mnTypeId = 26; // AUTOLAYOUT_HANDOUT6
+ }
+ }
+ else
+ {
+ switch(maList.Count())
+ {
+ case 1:
+ {
+ if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("title"))))
+ {
+ mnTypeId = 19; // AUTOLAYOUT_ONLY_TITLE
+ }
+ else
+ {
+ mnTypeId = 32; // AUTOLAYOUT_ONLY_TEXT
+ }
+ break;
+ }
+ case 2:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle"))))
+ {
+ mnTypeId = 0; // AUTOLAYOUT_TITLE
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
+ {
+ mnTypeId = 1; // AUTOLAYOUT_ENUM
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
+ {
+ mnTypeId = 2; // AUTOLAYOUT_CHART
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("table"))))
+ {
+ mnTypeId = 8; // AUTOLAYOUT_TAB
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ mnTypeId = 11; // AUTOLAYOUT_OBJ
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
+ {
+ if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title"))))
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+ mnTypeId = 28;
+ }
+ else
+ {
+ // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
+ mnTypeId = 29;
+ }
+ }
+ else
+ {
+ mnTypeId = 21; // AUTOLAYOUT_NOTES
+ }
+ break;
+ }
+ case 3:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
+ SdXMLPresentationPlaceholderContext* pObj2 = maList.GetObject(2);
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
+ {
+ if(pObj2->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
+ {
+ mnTypeId = 3; // AUTOLAYOUT_2TEXT
+ }
+ else if(pObj2->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
+ {
+ mnTypeId = 4; // AUTOLAYOUT_TEXTCHART
+ }
+ else if(pObj2->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("graphic"))))
+ {
+ mnTypeId = 6; // AUTOLAYOUT_TEXTCLIP
+ }
+ else
+ {
+ if(pObj1->GetX() < pObj2->GetX())
+ {
+ mnTypeId = 10; // AUTOLAYOUT_TEXTOBJ -> outline left, object right
+ }
+ else
+ {
+ mnTypeId = 17; // AUTOLAYOUT_TEXTOVEROBJ -> outline top, object right
+ }
+ }
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
+ {
+ mnTypeId = 7; // AUTOLAYOUT_CHARTTEXT
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("graphic"))))
+ {
+ if(pObj2->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
+ {
+ // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
+ mnTypeId = 30;
+ }
+ else
+ {
+ mnTypeId = 9; // AUTOLAYOUT_CLIPTEXT
+ }
+ }
+ else if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
+ {
+ // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
+ mnTypeId = 27;
+ }
+ else
+ {
+ if(pObj1->GetX() < pObj2->GetX())
+ {
+ mnTypeId = 13; // AUTOLAYOUT_OBJTEXT -> left, right
+ }
+ else
+ {
+ mnTypeId = 14; // AUTOLAYOUT_OBJOVERTEXT -> top, bottom
+ }
+ }
+ break;
+ }
+ case 4:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
+ SdXMLPresentationPlaceholderContext* pObj2 = maList.GetObject(2);
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ if(pObj1->GetX() < pObj2->GetX())
+ {
+ mnTypeId = 16; // AUTOLAYOUT_2OBJOVERTEXT
+ }
+ else
+ {
+ mnTypeId = 15; // AUTOLAYOUT_2OBJTEXT
+ }
+ }
+ else
+ {
+ mnTypeId = 12; // AUTOLAYOUT_TEXT2OBJ
+ }
+ break;
+ }
+ case 5:
+ {
+ SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
+
+ if(pObj1->GetName().equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
+ {
+ mnTypeId = 18; // AUTOLAYOUT_4OBJ
+ }
+ else
+ {
+ mnTypeId = 33; // AUTOLAYOUT_4CLIPART
+ }
+ break;
+
+ }
+ case 7:
+ {
+ mnTypeId = 33; // AUTOLAYOUT_6CLIPART
+ break;
+ }
+ default:
+ {
+ mnTypeId = 20; // AUTOLAYOUT_NONE
+ break;
+ }
+ }
+ }
+
+ // release remembered contexts, they are no longer needed
+ while(maList.Count())
+ maList.Remove(maList.Count() - 1)->ReleaseRef();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPresentationPlaceholderContext::SdXMLPresentationPlaceholderContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx, const
+ OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList)
+: SvXMLImportContext( rImport, nPrfx, rLName),
+ mnX(0L),
+ mnY(0L),
+ mnWidth(1L),
+ mnHeight(1L)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPresentationPlaceholderAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME:
+ {
+ msName = sValue;
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_X:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnX, sValue);
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_Y:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnY, sValue);
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue);
+ break;
+ }
+ case XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT:
+ {
+ GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue);
+ break;
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLPresentationPlaceholderContext::~SdXMLPresentationPlaceholderContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLMasterPageContext, SdXMLGenericPageContext );
+
+SdXMLMasterPageContext::SdXMLMasterPageContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ uno::Reference< drawing::XShapes >& rShapes)
+: SdXMLGenericPageContext( rImport, nPrfx, rLName, xAttrList, rShapes )
+{
+ const sal_Bool bHandoutMaster = IsXMLToken( rLName, XML_HANDOUT_MASTER );
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
+
+ switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ {
+ case XML_TOK_MASTERPAGE_NAME:
+ {
+ msName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_DISPLAY_NAME:
+ {
+ msDisplayName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
+ {
+ msPageMasterName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_STYLE_NAME:
+ {
+ msStyleName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME:
+ {
+ maPageLayoutName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
+ {
+ maUseHeaderDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
+ {
+ maUseFooterDeclName = sValue;
+ break;
+ }
+ case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
+ {
+ maUseDateTimeDeclName = sValue;
+ break;
+ }
+ }
+ }
+
+ if( !msDisplayName.getLength() )
+ msDisplayName = msName;
+ else if( msDisplayName != msName )
+ GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, msName, msDisplayName );
+
+ GetImport().GetShapeImport()->startPage( GetLocalShapesContext() );
+
+ // set page name?
+ if(!bHandoutMaster && msDisplayName.getLength() && GetLocalShapesContext().is())
+ {
+ uno::Reference < container::XNamed > xNamed(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xNamed.is())
+ xNamed->setName(msDisplayName);
+ }
+
+ // set page-master?
+ if(msPageMasterName.getLength())
+ {
+ SetPageMaster( msPageMasterName );
+ }
+
+ SetStyle( msStyleName );
+
+ SetLayout();
+
+ DeleteAllShapes();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLMasterPageContext::~SdXMLMasterPageContext()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLMasterPageContext::EndElement()
+{
+ // set styles on master-page
+ if(msName.getLength() && GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
+ if( pContext && pContext->ISA( SvXMLStyleContext ) )
+ ((SdXMLStylesContext*)pContext)->SetMasterPageStyles(*this);
+ }
+
+ SdXMLGenericPageContext::EndElement();
+ GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+ const SvXMLTokenMap& rTokenMap = GetSdImport().GetMasterPageElemTokenMap();
+
+ // some special objects inside style:masterpage context
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MASTERPAGE_STYLE:
+ {
+ if(GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ // style:style inside master-page context -> presentation style
+ XMLShapeStyleContext* pNew = new XMLShapeStyleContext(
+ GetSdImport(), nPrefix, rLocalName, xAttrList,
+ *GetSdImport().GetShapeImport()->GetStylesContext(),
+ XML_STYLE_FAMILY_SD_PRESENTATION_ID);
+
+ // add this style to the outer StylesContext class for later processing
+ if(pNew)
+ {
+ pContext = pNew;
+ GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew);
+ }
+ }
+ break;
+ }
+ case XML_TOK_MASTERPAGE_NOTES:
+ {
+ if( GetSdImport().IsImpress() )
+ {
+ // get notes page
+ uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
+ if(xPresPage.is())
+ {
+ uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
+ if(xNotesDrawPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
+ if(xNewShapes.is())
+ {
+ // presentation:notes inside master-page context
+ pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLStylesContext, SvXMLStyleContext );
+
+SdXMLStylesContext::SdXMLStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ sal_Bool bIsAutoStyle)
+: SvXMLStylesContext(rImport, nPrfx, rLName, xAttrList),
+ mbIsAutoStyle(bIsAutoStyle)
+{
+ // #110680#
+ // Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference< lang::XMultiServiceFactory > xMSF = rImport.getServiceFactory();
+
+ mpNumFormatter = new SvNumberFormatter( xMSF, LANGUAGE_SYSTEM );
+
+ // #110680#
+ // mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter );
+ mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter, xMSF );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLStylesContext::~SdXMLStylesContext()
+{
+ delete mpNumFmtHelper;
+ delete mpNumFormatter;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLStyleContext* pContext = 0;
+ const SvXMLTokenMap& rStyleTokenMap = GetSdImport().GetStylesElemTokenMap();
+
+ switch(rStyleTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_STYLES_PAGE_MASTER:
+ {
+ // style:page-master inside office:styles context
+ pContext = new SdXMLPageMasterContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
+ break;
+ }
+ case XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT:
+ {
+ // style:presentation-page-layout inside office:styles context
+ pContext = new SdXMLPresentationPageLayoutContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
+ break;
+ }
+ }
+
+ if(!pContext)
+ {
+ const SvXMLTokenMap& rTokenMap = mpNumFmtHelper->GetStylesElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLES_DATE_STYLE:
+ case XML_TOK_STYLES_TIME_STYLE:
+ // number:date-style or number:time-style
+ pContext = new SdXMLNumberFormatImportContext( GetSdImport(), nPrefix, rLocalName, mpNumFmtHelper->getData(), nToken, xAttrList, *this );
+ break;
+
+ case XML_TOK_STYLES_NUMBER_STYLE:
+ case XML_TOK_STYLES_CURRENCY_STYLE:
+ case XML_TOK_STYLES_PERCENTAGE_STYLE:
+ case XML_TOK_STYLES_BOOLEAN_STYLE:
+ case XML_TOK_STYLES_TEXT_STYLE:
+ pContext = new SvXMLNumFormatContext( GetSdImport(), nPrefix, rLocalName,
+ mpNumFmtHelper->getData(), nToken, xAttrList, *this );
+ break;
+ }
+ }
+
+ if(!pContext && nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ if( IsXMLToken( rLocalName, XML_HEADER_DECL ) ||
+ IsXMLToken( rLocalName, XML_FOOTER_DECL ) ||
+ IsXMLToken( rLocalName, XML_DATE_TIME_DECL ) )
+ {
+ pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ }
+
+ if(!pContext && (nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken( rLocalName, XML_TABLE_TEMPLATE ) )
+ {
+ pContext = GetImport().GetShapeImport()->GetShapeTableImport()->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList );
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLStyleContext* pContext = 0;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
+ break;
+ case XML_STYLE_FAMILY_TABLE_CELL:
+ case XML_STYLE_FAMILY_TABLE_COLUMN:
+ case XML_STYLE_FAMILY_TABLE_ROW:
+ pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily );
+ break;
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext* pContext = 0;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
+ pContext = new XMLGraphicsDefaultStyle(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
+ break;
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sal_uInt16 SdXMLStylesContext::GetFamily( const OUString& rFamily ) const
+{
+// if(rFamily.getLength())
+// {
+// if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME))))
+// return XML_STYLE_FAMILY_SD_GRAPHICS_ID;
+//
+// if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME))))
+// return XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+//
+// if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_POOL_NAME))))
+// return XML_STYLE_FAMILY_SD_POOL_ID;
+//
+// if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME))))
+// return XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID;
+// }
+
+ // call base class
+ return SvXMLStylesContext::GetFamily(rFamily);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper(
+ sal_uInt16 nFamily) const
+{
+ UniReference < SvXMLImportPropertyMapper > xMapper;
+
+// if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily
+// || XML_STYLE_FAMILY_SD_PRESENTATION_ID == nFamily
+// || XML_STYLE_FAMILY_SD_POOL_ID == nFamily)
+// {
+// if(!xPropImpPropMapper.is())
+// {
+// UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
+// ((SdXMLStylesContext*)this)->xPropImpPropMapper =
+// new SvXMLImportPropertyMapper(aImpHelper->GetPropertySetMapper());
+// }
+// xMapper = xPropImpPropMapper;
+// return xMapper;
+// }
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ {
+ if(!xPresImpPropMapper.is())
+ {
+ UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
+ ((SdXMLStylesContext*)this)->xPresImpPropMapper =
+ aImpHelper->GetPresPagePropsMapper();
+ }
+ xMapper = xPresImpPropMapper;
+ break;
+ }
+
+ case XML_STYLE_FAMILY_TABLE_COLUMN:
+ case XML_STYLE_FAMILY_TABLE_ROW:
+ case XML_STYLE_FAMILY_TABLE_CELL:
+ {
+ const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() );
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break;
+ case XML_STYLE_FAMILY_TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break;
+ case XML_STYLE_FAMILY_TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break;
+ }
+ break;
+ }
+ }
+
+ // call base class
+ if( !xMapper.is() )
+ xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
+ return xMapper;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Process all style and object info
+//
+void SdXMLStylesContext::EndElement()
+{
+ if(mbIsAutoStyle)
+ {
+ // AutoStyles for text import
+ GetImport().GetTextImport()->SetAutoStyles( this );
+
+ // AutoStyles for chart
+ GetImport().GetChartImport()->SetAutoStylesContext( this );
+
+ // AutoStyles for forms
+ GetImport().GetFormImport()->setAutoStyleContext( this );
+
+ // associate AutoStyles with styles in preparation to setting Styles on shapes
+ for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+ if(pStyle && pStyle->ISA(XMLShapeStyleContext))
+ {
+ XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle;
+// pDocStyle->Filter();
+
+ SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext();
+ if( pStylesContext )
+ {
+ pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParentName());
+
+ if(pStyle && pStyle->ISA(XMLShapeStyleContext))
+ {
+ XMLShapeStyleContext* pParentStyle = (XMLShapeStyleContext*)pStyle;
+ if(pParentStyle->GetStyle().is())
+ {
+ pDocStyle->SetStyle(pParentStyle->GetStyle());
+ }
+ }
+ }
+ }
+ }
+
+ FinishStyles( false );
+ }
+ else
+ {
+ // Process styles list
+ ImpSetGraphicStyles();
+ ImpSetCellStyles();
+ GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles();
+
+ // put style infos in the info set for other components ( content import f.e. )
+ uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() );
+ if( xInfoSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
+
+ if( xInfoSetInfo->hasPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ) ) )
+ xInfoSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ), uno::makeAny( getPageLayouts() ) );
+ }
+
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// set master-page styles (all with family="presentation" and a special
+// prefix) on given master-page.
+//
+void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const
+{
+ UniString sPrefix(rMaster.GetDisplayName(), (sal_uInt16)rMaster.GetDisplayName().getLength());
+ sPrefix += sal_Unicode('-');
+
+ if(GetSdImport().GetLocalDocStyleFamilies().is() && GetSdImport().GetLocalDocStyleFamilies()->hasByName(rMaster.GetDisplayName())) try
+ {
+ uno::Reference< container::XNameAccess > xMasterPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW );
+ ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix);
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "xmloff::SdXMLStylesContext::SetMasterPageStyles(), exception caught!" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Process styles list:
+// set graphic styles (all with family="graphics"). Remember xStyle at list element.
+//
+void SdXMLStylesContext::ImpSetGraphicStyles() const
+{
+ if(GetSdImport().GetLocalDocStyleFamilies().is()) try
+ {
+ const OUString sGraphicStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")));
+ uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW );
+
+ UniString aPrefix;
+ ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, aPrefix);
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "xmloff::SdXMLStylesContext::ImpSetGraphicStyles(), exception caught!" );
+ }
+}
+
+void SdXMLStylesContext::ImpSetCellStyles() const
+{
+ if(GetSdImport().GetLocalDocStyleFamilies().is()) try
+ {
+ const OUString sCellStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("cell")));
+ uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW );
+
+ UniString aPrefix;
+ ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_TABLE_CELL, aPrefix);
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "xmloff::SdXMLStylesContext::ImpSetCellStyles(), exception caught!" );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
+//
+void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess >& xPageStyles, sal_uInt16 nFamily, const UniString& rPrefix) const
+{
+ xub_StrLen nPrefLen(rPrefix.Len());
+
+ sal_uInt32 a;
+
+ // set defaults
+ for( a = 0; a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+
+ if(nFamily == pStyle->GetFamily() && pStyle->IsDefaultStyle())
+ {
+ ((SvXMLStyleContext*)pStyle)->SetDefaults();
+ }
+ }
+
+ // create all styles and set properties
+ for( a = 0; a < GetStyleCount(); a++)
+ {
+ try
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+ if(nFamily == pStyle->GetFamily() && !pStyle->IsDefaultStyle())
+ {
+ OUString aStyleName(pStyle->GetDisplayName());
+ if( nPrefLen )
+ {
+ sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
+ if( (nPrefLen != nStylePrefLen) || (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
+ continue;
+
+ aStyleName = aStyleName.copy( nPrefLen );
+ }
+
+ uno::Reference< style::XStyle > xStyle;
+ if(xPageStyles->hasByName(aStyleName))
+ {
+ xPageStyles->getByName(aStyleName) >>= xStyle;
+
+ // set properties of existing styles to default
+ uno::Reference< beans::XPropertySet > xPropSet( xStyle, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
+ if( xPropSet.is() )
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ uno::Reference< beans::XPropertyState > xPropState( xStyle, uno::UNO_QUERY );
+
+ if( xPropState.is() )
+ {
+ UniReference < XMLPropertySetMapper > xPrMap;
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetImportPropertyMapper( nFamily );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xPrMap = xImpPrMap->getPropertySetMapper();
+ if( xPrMap.is() )
+ {
+ const sal_Int32 nCount = xPrMap->GetEntryCount();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ const OUString& rName = xPrMap->GetEntryAPIName( i );
+ if( xPropSetInfo->hasPropertyByName( rName ) && beans::PropertyState_DIRECT_VALUE == xPropState->getPropertyState( rName ) )
+ {
+ xPropState->setPropertyToDefault( rName );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // graphics style does not exist, create and add it
+ uno::Reference< lang::XSingleServiceFactory > xServiceFact(xPageStyles, uno::UNO_QUERY);
+ if(xServiceFact.is())
+ {
+ uno::Reference< style::XStyle > xNewStyle( xServiceFact->createInstance(), uno::UNO_QUERY);
+
+ if(xNewStyle.is())
+ {
+ // remember style
+ xStyle = xNewStyle;
+
+ // add new style to graphics style pool
+ uno::Reference< container::XNameContainer > xInsertContainer(xPageStyles, uno::UNO_QUERY);
+ if(xInsertContainer.is())
+ xInsertContainer->insertByName(aStyleName, uno::Any( xStyle ) );
+ }
+ }
+ }
+
+ if(xStyle.is())
+ {
+ // set properties at style
+ XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >( const_cast< SvXMLStyleContext* >( pStyle ) );
+ uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
+
+ if(xPropSet.is() && pPropStyle)
+ {
+ pPropStyle->FillPropertySet(xPropSet);
+ pPropStyle->SetStyle(xStyle);
+ }
+ }
+ }
+ }
+ catch( Exception& e)
+ {
+ uno::Sequence<OUString> aSeq(0);
+ const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+ }
+
+ // now set parents for all styles (when necessary)
+ for(a = 0L; a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+
+ if(pStyle && pStyle->GetName().getLength() && (nFamily == pStyle->GetFamily())) try
+ {
+ OUString aStyleName(pStyle->GetDisplayName());
+ if( nPrefLen )
+ {
+ sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
+ if( (nPrefLen != nStylePrefLen) || (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
+ continue;
+
+ aStyleName = aStyleName.copy( nPrefLen );
+ }
+
+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByName(aStyleName), UNO_QUERY );
+ if(xStyle.is())
+ {
+ // set parent style name
+ ::rtl::OUString sParentStyleDisplayName( const_cast< SvXMLImport& >( GetImport() ).GetStyleDisplayName( pStyle->GetFamily(), pStyle->GetParentName() ) );
+ if( nPrefLen )
+ {
+ sal_Int32 nStylePrefLen = sParentStyleDisplayName.lastIndexOf( sal_Unicode('-') ) + 1;
+ if( (nPrefLen != nStylePrefLen) || (sParentStyleDisplayName.compareTo( rPrefix, nPrefLen ) != 0) )
+ continue;
+
+ sParentStyleDisplayName = sParentStyleDisplayName.copy( nPrefLen );
+ }
+ xStyle->setParentStyle( sParentStyleDisplayName );
+ }
+ }
+ catch( Exception& e )
+ {
+ uno::Sequence<OUString> aSeq(0);
+ const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// helper function to create the uno component that hold the mappings from
+// xml auto layout name to internal autolayout id
+
+uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() const
+{
+ uno::Reference< container::XNameContainer > xLayouts( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
+
+ for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
+ {
+ const SvXMLStyleContext* pStyle = GetStyle(a);
+ if(pStyle && pStyle->ISA(SdXMLPresentationPageLayoutContext))
+ {
+ xLayouts->insertByName( pStyle->GetName(), uno::makeAny(
+ (sal_Int32)((SdXMLPresentationPageLayoutContext*)pStyle)->GetTypeId() ) );
+ }
+ }
+
+ return uno::Reference< container::XNameAccess >::query( xLayouts );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+//
+TYPEINIT1( SdXMLMasterStylesContext, SvXMLImportContext );
+
+SdXMLMasterStylesContext::SdXMLMasterStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName)
+: SvXMLImportContext( rImport, nPrfx, rLName)
+{
+}
+
+SdXMLMasterStylesContext::~SdXMLMasterStylesContext()
+{
+ while(maMasterPageList.Count())
+ maMasterPageList.Remove(maMasterPageList.Count() - 1)->ReleaseRef();
+}
+
+SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+{
+ SvXMLImportContext* pContext = 0;
+
+ if(nPrefix == XML_NAMESPACE_STYLE
+ && IsXMLToken( rLocalName, XML_MASTER_PAGE ) )
+ {
+ // style:masterpage inside office:styles context
+ uno::Reference< drawing::XDrawPage > xNewMasterPage;
+ uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
+
+ if( xMasterPages.is() )
+ {
+ if(GetSdImport().GetNewMasterPageCount() + 1 > xMasterPages->getCount())
+ {
+ // new page, create and insert
+ xNewMasterPage = xMasterPages->insertNewByIndex(xMasterPages->getCount());
+ }
+ else
+ {
+ // existing page, use it
+ xMasterPages->getByIndex(GetSdImport().GetNewMasterPageCount()) >>= xNewMasterPage;
+ }
+
+ // increment global import page counter
+ GetSdImport().IncrementNewMasterPageCount();
+
+ if(xNewMasterPage.is())
+ {
+ uno::Reference< drawing::XShapes > xNewShapes(xNewMasterPage, uno::UNO_QUERY);
+ if(xNewShapes.is() && GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ pContext = new SdXMLMasterPageContext(GetSdImport(),
+ nPrefix, rLocalName, xAttrList, xNewShapes);
+
+ if(pContext)
+ {
+ pContext->AddRef();
+ maMasterPageList.Insert((SdXMLMasterPageContext*)pContext, LIST_APPEND);
+ }
+ }
+ }
+ }
+ }
+ else if(nPrefix == XML_NAMESPACE_STYLE
+ && IsXMLToken( rLocalName, XML_HANDOUT_MASTER ) )
+ {
+ uno::Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetSdImport().GetModel(), uno::UNO_QUERY );
+ if( xHandoutSupp.is() )
+ {
+ uno::Reference< drawing::XShapes > xHandoutPage( xHandoutSupp->getHandoutMasterPage(), uno::UNO_QUERY );
+ if(xHandoutPage.is() && GetSdImport().GetShapeImport()->GetStylesContext())
+ {
+ pContext = new SdXMLMasterPageContext(GetSdImport(),
+ nPrefix, rLocalName, xAttrList, xHandoutPage);
+ }
+ }
+ }
+ else if( (nPrefix == XML_NAMESPACE_DRAW )&& IsXMLToken( rLocalName, XML_LAYER_SET ) )
+ {
+ pContext = new SdXMLLayerSetContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+
+ // call base class
+ if(!pContext)
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
+
+ return pContext;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SdXMLHeaderFooterDeclContext::SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
+: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList )
+{
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for(sal_Int16 i=0; i < nAttrCount; i++)
+ {
+ OUString aLocalName;
+ const OUString aValue( xAttrList->getValueByIndex(i) );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
+
+ if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ {
+ if( IsXMLToken( aLocalName, XML_NAME ) )
+ {
+ maStrName = aValue;
+ }
+ else if( IsXMLToken( aLocalName, XML_SOURCE ) )
+ {
+ mbFixed = IsXMLToken( aValue, XML_FIXED );
+ }
+ }
+ else if( nPrefix == XML_NAMESPACE_STYLE )
+ {
+ if( IsXMLToken( aLocalName, XML_DATA_STYLE_NAME ) )
+ {
+ maStrDateTimeFormat = aValue;
+ }
+ }
+ }
+}
+
+BOOL SdXMLHeaderFooterDeclContext::IsTransient() const
+{
+ return TRUE;
+}
+
+void SdXMLHeaderFooterDeclContext::EndElement()
+{
+ SdXMLImport& rImport = *dynamic_cast< SdXMLImport* >( &GetImport() );
+ if( IsXMLToken( GetLocalName(), XML_HEADER_DECL ) )
+ {
+ rImport.AddHeaderDecl( maStrName, maStrText );
+ }
+ else if( IsXMLToken( GetLocalName(), XML_FOOTER_DECL ) )
+ {
+ rImport.AddFooterDecl( maStrName, maStrText );
+ }
+ else if( IsXMLToken( GetLocalName(), XML_DATE_TIME_DECL ) )
+ {
+ rImport.AddDateTimeDecl( maStrName, maStrText, mbFixed, maStrDateTimeFormat );
+ }
+}
+
+void SdXMLHeaderFooterDeclContext::Characters( const ::rtl::OUString& rChars )
+{
+ maStrText += rChars;
+}
+
diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx
new file mode 100644
index 000000000000..df7e3358368f
--- /dev/null
+++ b/xmloff/source/draw/ximpstyl.hxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XIMPSTYLE_HXX
+#define _XIMPSTYLE_HXX
+
+#include <xmloff/xmlictxt.hxx>
+#include "sdxmlimp_impl.hxx"
+#include "ximppage.hxx"
+#include <xmloff/xmlstyle.hxx>
+#include <com/sun/star/view/PaperOrientation.hpp>
+
+class SvNumberFormatter;
+class SvXMLNumFmtHelper;
+
+//////////////////////////////////////////////////////////////////////////////
+// special style:style context inside style:page-master context
+
+class SdXMLPageMasterStyleContext: public SvXMLStyleContext
+{
+ sal_Int32 mnBorderBottom;
+ sal_Int32 mnBorderLeft;
+ sal_Int32 mnBorderRight;
+ sal_Int32 mnBorderTop;
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+ com::sun::star::view::PaperOrientation meOrientation;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLPageMasterStyleContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPageMasterStyleContext();
+
+ sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
+ sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
+ sal_Int32 GetBorderRight() const { return mnBorderRight; }
+ sal_Int32 GetBorderTop() const { return mnBorderTop; }
+ sal_Int32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetHeight() const { return mnHeight; }
+ com::sun::star::view::PaperOrientation GetOrientation() const { return meOrientation; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// style:page-master context
+
+class SdXMLPageMasterContext: public SvXMLStyleContext
+{
+ rtl::OUString msName;
+ SdXMLPageMasterStyleContext*mpPageMasterStyle;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLPageMasterContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPageMasterContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ const rtl::OUString& GetName() const { return msName; }
+ const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mpPageMasterStyle; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// style:masterpage context
+
+class SdXMLMasterPageContext: public SdXMLGenericPageContext
+{
+ rtl::OUString msPageMasterName;
+ rtl::OUString msName;
+ rtl::OUString msDisplayName;
+ rtl::OUString msStyleName;
+
+public:
+ TYPEINFO();
+
+ SdXMLMasterPageContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
+ virtual ~SdXMLMasterPageContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ const rtl::OUString& GetPageMasterName() const { return msPageMasterName; }
+ const rtl::OUString& GetEncodedName() const { return msName; }
+ const rtl::OUString& GetDisplayName() const { return msDisplayName; }
+
+};
+DECLARE_LIST(ImpMasterPageList, SdXMLMasterPageContext*)
+
+//////////////////////////////////////////////////////////////////////////////
+// presentation:placeholder context
+
+class SdXMLPresentationPlaceholderContext: public SvXMLImportContext
+{
+ rtl::OUString msName;
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ SdXMLPresentationPlaceholderContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPresentationPlaceholderContext();
+
+ const rtl::OUString& GetName() const { return msName; }
+ sal_Int32 GetX() const { return mnX; }
+ sal_Int32 GetY() const { return mnY; }
+ sal_Int32 GetWidth() const { return mnWidth; }
+ sal_Int32 GetHeight() const { return mnHeight; }
+};
+DECLARE_LIST(ImpPlaceholderList, SdXMLPresentationPlaceholderContext*)
+
+//////////////////////////////////////////////////////////////////////////////
+// style:presentation-page-layout context
+
+class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext
+{
+ rtl::OUString msName;
+ ImpPlaceholderList maList;
+ sal_uInt16 mnTypeId;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLPresentationPageLayoutContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+ virtual ~SdXMLPresentationPageLayoutContext();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+ sal_uInt16 GetTypeId() const { return mnTypeId; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:styles context
+
+class SdXMLStylesContext : public SvXMLStylesContext
+{
+ UniReference< SvXMLImportPropertyMapper > xPresImpPropMapper;
+ sal_Bool mbIsAutoStyle;
+ SvXMLNumFmtHelper* mpNumFmtHelper;
+ SvNumberFormatter* mpNumFormatter;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+ void ImpSetGraphicStyles() const;
+ void ImpSetCellStyles() const;
+ void ImpSetGraphicStyles( com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xPageStyles,
+ sal_uInt16 nFamily, const UniString& rPrefix) const;
+
+protected:
+ virtual SvXMLStyleContext* CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+
+ virtual SvXMLStyleContext *CreateStyleStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
+
+ virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
+ sal_uInt16 nFamily, sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+public:
+ TYPEINFO();
+
+ SdXMLStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
+ sal_Bool bIsAutoStyle);
+ virtual ~SdXMLStylesContext();
+
+ virtual sal_uInt16 GetFamily( const rtl::OUString& rFamily ) const;
+ virtual void EndElement();
+ virtual UniReference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const;
+
+ void SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getPageLayouts() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// office:master-styles context
+//
+class SdXMLMasterStylesContext : public SvXMLImportContext
+{
+ ImpMasterPageList maMasterPageList;
+
+ const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
+ SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
+
+public:
+ TYPEINFO();
+
+ SdXMLMasterStylesContext(
+ SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLName);
+ virtual ~SdXMLMasterStylesContext();
+
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ const ImpMasterPageList& GetMasterPageList() const { return maMasterPageList; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
+
+class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext
+{
+public:
+ SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual BOOL IsTransient() const;
+ virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+private:
+ ::rtl::OUString maStrName;
+ ::rtl::OUString maStrText;
+ ::rtl::OUString maStrDateTimeFormat;
+ sal_Bool mbFixed;
+};
+
+
+#endif // _XIMPSTYLE_HXX