2010-10-12 15:53:47 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project .
2000-09-18 16:07:07 +00:00
*
2012-11-12 17:21:24 +00:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at http : //mozilla.org/MPL/2.0/.
2000-09-18 16:07:07 +00:00
*
2012-11-12 17:21:24 +00:00
* This file incorporates work covered by the following license notice :
2000-09-18 16:07:07 +00:00
*
2012-11-12 17:21:24 +00:00
* Licensed to the Apache Software Foundation ( ASF ) under one or more
* contributor license agreements . See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership . The ASF licenses this file to you under the Apache
* License , Version 2.0 ( the " License " ) ; you may not use this file
* except in compliance with the License . You may obtain a copy of
* the License at http : //www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 16:07:07 +00:00
2010-02-22 18:27:09 +01:00
# include <memory>
2011-07-20 22:27:51 +02:00
# include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
2010-02-22 18:27:09 +01:00
# include <com/sun/star/presentation/ClickAction.hpp>
2001-11-27 13:14:16 +00:00
# include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
2001-03-08 13:33:34 +00:00
# include <com/sun/star/container/XChild.hpp>
2000-09-18 16:07:07 +00:00
# include <com/sun/star/text/XText.hpp>
# include <com/sun/star/chart/XChartDocument.hpp>
2001-02-08 13:45:43 +00:00
# include <com/sun/star/drawing/XControlShape.hpp>
2001-02-02 10:14:37 +00:00
# include <com/sun/star/style/XStyle.hpp>
2002-05-28 08:28:05 +00:00
# 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>
2008-03-12 09:35:17 +00:00
# include <com/sun/star/table/XColumnRowRange.hpp>
2007-06-27 14:06:04 +00:00
# include <xmloff/xmluconv.hxx>
2001-02-08 13:45:43 +00:00
# include "PropertySetMerger.hxx"
2007-06-27 14:06:04 +00:00
# include <xmloff/shapeexport.hxx>
2000-09-18 16:07:07 +00:00
# include "sdpropls.hxx"
2000-12-05 22:31:17 +00:00
# include "sdxmlexp_impl.hxx"
2007-06-27 14:06:04 +00:00
# include <xmloff/families.hxx>
2000-09-18 16:07:07 +00:00
# include <tools/debug.hxx>
2007-06-27 14:06:04 +00:00
# include <xmloff/contextid.hxx>
# include <xmloff/xmltoken.hxx>
2001-07-31 09:47:14 +00:00
# include <sot/clsids.hxx>
# include <tools/globname.hxx>
2002-11-06 09:35:40 +00:00
# include <com/sun/star/beans/XPropertyState.hpp>
2005-04-12 15:46:04 +00:00
# include <comphelper/processfactory.hxx>
# include <com/sun/star/lang/XMultiServiceFactory.hpp>
# include <com/sun/star/drawing/XCustomShapeEngine.hpp>
2010-04-16 23:04:00 +02:00
# include "xmloff/xmlnmspe.hxx"
2000-11-26 18:48:02 +00:00
2008-03-12 09:35:17 +00:00
using : : rtl : : OUString ;
using : : rtl : : OUStringBuffer ;
2000-09-18 16:07:07 +00:00
using namespace : : com : : sun : : star ;
2001-06-15 09:37:08 +00:00
using namespace : : xmloff : : token ;
2000-09-18 16:07:07 +00:00
//////////////////////////////////////////////////////////////////////////////
2000-11-07 12:33:09 +00:00
XMLShapeExport : : XMLShapeExport ( SvXMLExport & rExp ,
SvXMLExportPropertyMapper * pExtMapper )
2006-06-19 17:12:03 +00:00
: mrExport ( rExp ) ,
2000-11-26 18:48:02 +00:00
mnNextUniqueShapeId ( 1 ) ,
2009-12-31 15:49:52 +01:00
maShapesInfos ( ) ,
maCurrentShapesIter ( maShapesInfos . end ( ) ) ,
2001-01-19 15:25:18 +00:00
mbExportLayer ( sal_False ) ,
2010-11-10 13:50:33 +08:00
// #88546# init to sal_False
2006-06-19 17:12:03 +00:00
mbHandleProgressBar ( sal_False ) ,
2012-06-02 08:58:21 -05:00
msZIndex ( " ZOrder " ) ,
msPrintable ( " Printable " ) ,
msVisible ( " Visible " ) ,
msEmptyPres ( " IsEmptyPresentationObject " ) ,
msModel ( " Model " ) ,
msStartShape ( " StartShape " ) ,
msEndShape ( " EndShape " ) ,
msOnClick ( " OnClick " ) ,
msEventType ( " EventType " ) ,
msPresentation ( " Presentation " ) ,
msMacroName ( " MacroName " ) ,
msScript ( " Script " ) ,
msLibrary ( " Library " ) ,
msClickAction ( " ClickAction " ) ,
msBookmark ( " Bookmark " ) ,
msEffect ( " Effect " ) ,
msPlayFull ( " PlayFull " ) ,
msVerb ( " Verb " ) ,
msSoundURL ( " SoundURL " ) ,
msSpeed ( " Speed " ) ,
msStarBasic ( " StarBasic " )
2000-09-18 16:07:07 +00:00
{
// construct PropertyHandlerFactory
2006-06-19 17:12:03 +00:00
mxSdPropHdlFactory = new XMLSdPropHdlFactory ( mrExport . GetModel ( ) , rExp ) ;
2000-09-18 16:07:07 +00:00
// construct PropertySetMapper
2006-06-19 17:12:03 +00:00
mxPropertySetMapper = CreateShapePropMapper ( mrExport ) ;
2000-11-07 12:33:09 +00:00
if ( pExtMapper )
{
UniReference < SvXMLExportPropertyMapper > xExtMapper ( pExtMapper ) ;
2006-06-19 17:12:03 +00:00
mxPropertySetMapper - > ChainExportMapper ( xExtMapper ) ;
2000-11-07 12:33:09 +00:00
}
2000-09-18 16:07:07 +00:00
2001-06-01 11:32:48 +00:00
/*
2000-12-05 22:31:17 +00:00
// chain text attributes
2001-02-27 15:09:08 +00:00
xPropertySetMapper - > ChainExportMapper ( XMLTextParagraphExport : : CreateParaExtPropMapper ( rExp ) ) ;
2001-06-01 11:32:48 +00:00
*/
2000-12-05 22:31:17 +00:00
2006-06-19 17:12:03 +00:00
mrExport . GetAutoStylePool ( ) - > AddFamily (
2000-09-18 16:07:07 +00:00
XML_STYLE_FAMILY_SD_GRAPHICS_ID ,
2012-06-02 08:58:21 -05:00
OUString ( XML_STYLE_FAMILY_SD_GRAPHICS_NAME ) ,
2000-09-18 16:07:07 +00:00
GetPropertySetMapper ( ) ,
2012-06-02 08:58:21 -05:00
OUString ( XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX ) ) ;
2006-06-19 17:12:03 +00:00
mrExport . GetAutoStylePool ( ) - > AddFamily (
2000-09-18 16:07:07 +00:00
XML_STYLE_FAMILY_SD_PRESENTATION_ID ,
2012-06-02 08:58:21 -05:00
OUString ( XML_STYLE_FAMILY_SD_PRESENTATION_NAME ) ,
2000-09-18 16:07:07 +00:00
GetPropertySetMapper ( ) ,
2012-06-02 08:58:21 -05:00
OUString ( XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX ) ) ;
2001-02-02 10:14:37 +00:00
maCurrentInfo = maShapeInfos . end ( ) ;
2008-03-12 09:35:17 +00:00
// create table export helper and let him add his families in time
GetShapeTableExport ( ) ;
2000-09-18 16:07:07 +00:00
}
2001-02-02 10:14:37 +00:00
///////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
XMLShapeExport : : ~ XMLShapeExport ( )
{
}
2001-02-02 10:14:37 +00:00
///////////////////////////////////////////////////////////////////////
2005-04-12 15:46:04 +00:00
// 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 ;
2012-06-02 08:58:21 -05:00
xSet - > getPropertyValue ( OUString ( " CustomShapeEngine " ) ) > > = aEngine ;
2012-01-25 17:00:07 -02:00
if ( aEngine . isEmpty ( ) )
2012-06-02 08:58:21 -05:00
aEngine = OUString ( " com.sun.star.drawing.EnhancedCustomShapeEngine " ) ;
2005-04-12 15:46:04 +00:00
uno : : Reference < lang : : XMultiServiceFactory > xFactory ( : : comphelper : : getProcessServiceFactory ( ) ) ;
2011-02-17 10:32:07 +01:00
2012-01-25 17:00:07 -02:00
if ( ! aEngine . isEmpty ( ) & & xFactory . is ( ) )
2005-04-12 15:46:04 +00:00
{
uno : : Sequence < uno : : Any > aArgument ( 1 ) ;
uno : : Sequence < beans : : PropertyValue > aPropValues ( 2 ) ;
2012-06-02 08:58:21 -05:00
aPropValues [ 0 ] . Name = rtl : : OUString ( " CustomShape " ) ;
2005-04-12 15:46:04 +00:00
aPropValues [ 0 ] . Value < < = xShape ;
sal_Bool bForceGroupWithText = sal_True ;
2012-06-02 08:58:21 -05:00
aPropValues [ 1 ] . Name = rtl : : OUString ( " ForceGroupWithText " ) ;
2005-04-12 15:46:04 +00:00
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 ;
}
2000-09-18 16:07:07 +00:00
// This method collects all automatic styles for the given XShape
2005-04-12 15:46:04 +00:00
void XMLShapeExport : : collectShapeAutoStyles ( const uno : : Reference < drawing : : XShape > & xShape )
2000-09-18 16:07:07 +00:00
{
2001-03-08 13:33:34 +00:00
if ( maCurrentShapesIter = = maShapesInfos . end ( ) )
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()! " ) ;
2001-03-08 13:33:34 +00:00
return ;
}
sal_Int32 nZIndex = 0 ;
uno : : Reference < beans : : XPropertySet > xSet ( xShape , uno : : UNO_QUERY ) ;
if ( xSet . is ( ) )
xSet - > getPropertyValue ( msZIndex ) > > = nZIndex ;
2002-04-17 10:42:15 +00:00
ImplXMLShapeExportInfoVector & aShapeInfoVector = ( * maCurrentShapesIter ) . second ;
2004-11-26 18:33:11 +00:00
if ( ( sal_Int32 ) aShapeInfoVector . size ( ) < = nZIndex )
2002-04-17 10:42:15 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape " ) ;
2002-04-17 10:42:15 +00:00
return ;
}
ImplXMLShapeExportInfo & aShapeInfo = aShapeInfoVector [ nZIndex ] ;
2001-02-02 10:14:37 +00:00
2005-04-12 15:46:04 +00:00
uno : : Reference < drawing : : XShape > xCustomShapeReplacement = checkForCustomShapeReplacement ( xShape ) ;
if ( xCustomShapeReplacement . is ( ) )
aShapeInfo . xCustomShapeReplacement = xCustomShapeReplacement ;
2001-07-27 09:16:23 +00:00
// -----------------------------
// first compute the shapes type
// -----------------------------
ImpCalcShapeType ( xShape , aShapeInfo . meShapeType ) ;
2012-11-12 17:21:24 +00:00
// #i118485# enabled XmlShapeTypeDrawChartShape and XmlShapeTypeDrawOLE2Shape
// to have text
2002-11-04 11:38:51 +00:00
const bool bObjSupportsText =
2001-06-01 11:32:48 +00:00
aShapeInfo . meShapeType ! = XmlShapeTypePresChartShape & &
aShapeInfo . meShapeType ! = XmlShapeTypePresOLE2Shape & &
2008-03-12 09:35:17 +00:00
aShapeInfo . meShapeType ! = XmlShapeTypeDrawSheetShape & &
aShapeInfo . meShapeType ! = XmlShapeTypePresSheetShape & &
2001-06-01 11:32:48 +00:00
aShapeInfo . meShapeType ! = XmlShapeTypeDraw3DSceneObject & &
aShapeInfo . meShapeType ! = XmlShapeTypeDraw3DCubeObject & &
aShapeInfo . meShapeType ! = XmlShapeTypeDraw3DSphereObject & &
aShapeInfo . meShapeType ! = XmlShapeTypeDraw3DLatheObject & &
2002-11-04 11:38:51 +00:00
aShapeInfo . meShapeType ! = XmlShapeTypeDraw3DExtrudeObject & &
aShapeInfo . meShapeType ! = XmlShapeTypeDrawPageShape & &
aShapeInfo . meShapeType ! = XmlShapeTypePresPageShape & &
aShapeInfo . meShapeType ! = XmlShapeTypeDrawGroupShape ;
const bool bObjSupportsStyle =
aShapeInfo . meShapeType ! = XmlShapeTypeDrawGroupShape ;
2001-06-01 11:32:48 +00:00
2001-06-27 14:23:12 +00:00
sal_Bool bIsEmptyPresObj = sal_False ;
uno : : Reference < beans : : XPropertySet > xPropSet ( xShape , uno : : UNO_QUERY ) ;
2005-04-12 15:46:04 +00:00
if ( aShapeInfo . xCustomShapeReplacement . is ( ) )
xPropSet . clear ( ) ;
2001-06-27 14:23:12 +00:00
// ----------------
// prep text styles
// ----------------
if ( xPropSet . is ( ) & & bObjSupportsText )
{
uno : : Reference < text : : XText > xText ( xShape , uno : : UNO_QUERY ) ;
2012-01-25 17:00:07 -02:00
if ( xText . is ( ) & & ! xText - > getString ( ) . isEmpty ( ) )
2001-06-27 14:23:12 +00:00
{
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 ) ;
}
}
}
2001-02-02 10:14:37 +00:00
// ------------------------------
// compute the shape parent style
// ------------------------------
2003-03-27 17:21:03 +00:00
if ( xPropSet . is ( ) )
2000-09-18 16:07:07 +00:00
{
2006-06-19 17:12:03 +00:00
uno : : Reference < beans : : XPropertySetInfo > xPropertySetInfo ( xPropSet - > getPropertySetInfo ( ) ) ;
2001-02-02 10:14:37 +00:00
OUString aParentName ;
uno : : Reference < style : : XStyle > xStyle ;
2003-03-27 17:21:03 +00:00
if ( bObjSupportsStyle )
2001-02-02 10:14:37 +00:00
{
2012-06-02 08:58:21 -05:00
if ( xPropertySetInfo . is ( ) & & xPropertySetInfo - > hasPropertyByName ( OUString ( " Style " ) ) )
xPropSet - > getPropertyValue ( OUString ( " Style " ) ) > > = xStyle ;
2001-02-02 10:14:37 +00:00
2003-03-27 17:21:03 +00:00
if ( xStyle . is ( ) )
2001-02-02 10:14:37 +00:00
{
2003-03-27 17:21:03 +00:00
// get family ID
uno : : Reference < beans : : XPropertySet > xStylePropSet ( xStyle , uno : : UNO_QUERY ) ;
DBG_ASSERT ( xStylePropSet . is ( ) , " style without a XPropertySet? " ) ;
2005-05-13 06:56:46 +00:00
try
2003-03-27 17:21:03 +00:00
{
2005-05-13 06:56:46 +00:00
if ( xStylePropSet . is ( ) )
{
OUString aFamilyName ;
2012-06-02 08:58:21 -05:00
xStylePropSet - > getPropertyValue ( OUString ( " Family " ) ) > > = aFamilyName ;
2012-04-06 14:09:04 +02:00
if ( ! aFamilyName . isEmpty ( ) & & aFamilyName ! = " graphics " )
2005-05-13 06:56:46 +00:00
aShapeInfo . mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID ;
}
}
2011-06-16 00:26:29 +01:00
catch ( const beans : : UnknownPropertyException & )
2005-05-13 06:56:46 +00:00
{
// Ignored.
DBG_ASSERT ( false ,
" XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property " ) ;
2003-03-27 17:21:03 +00:00
}
// get parent-style name
if ( XML_STYLE_FAMILY_SD_PRESENTATION_ID = = aShapeInfo . mnFamily )
{
aParentName = msPresentationStylePrefix ;
}
aParentName + = xStyle - > getName ( ) ;
2001-02-02 10:14:37 +00:00
}
}
2000-09-18 16:07:07 +00:00
// filter propset
2001-06-27 14:23:12 +00:00
std : : vector < XMLPropertyState > xPropStates ;
2000-09-18 16:07:07 +00:00
2001-06-27 14:23:12 +00:00
sal_Int32 nCount = 0 ;
2002-07-19 11:50:55 +00:00
if ( ( ! bIsEmptyPresObj | | ( aShapeInfo . meShapeType ! = XmlShapeTypePresPageShape ) ) )
2001-05-28 14:13:43 +00:00
{
2001-06-27 14:23:12 +00:00
xPropStates = GetPropertySetMapper ( ) - > Filter ( xPropSet ) ;
2001-05-28 14:13:43 +00:00
2001-06-27 14:23:12 +00:00
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 ( ) )
2001-05-28 14:13:43 +00:00
{
2001-06-27 14:23:12 +00:00
uno : : Reference < beans : : XPropertySet > xControlModel ( xControl - > getControl ( ) , uno : : UNO_QUERY ) ;
DBG_ASSERT ( xControlModel . is ( ) , " XMLShapeExport::collectShapeAutoStyles: no control model on the control shape! " ) ;
2006-06-19 17:12:03 +00:00
: : rtl : : OUString sNumberStyle = mrExport . GetFormExport ( ) - > getControlNumberStyle ( xControlModel ) ;
2012-01-25 17:00:07 -02:00
if ( ! sNumberStyle . isEmpty ( ) )
2001-06-27 14:23:12 +00:00
{
sal_Int32 nIndex = GetPropertySetMapper ( ) - > getPropertySetMapper ( ) - > FindEntryIndex ( CTF_SD_CONTROL_SHAPE_DATA_STYLE ) ;
2008-12-16 13:30:53 +00:00
// TODO : this retrieval of the index could be moved into the ctor, holding the index
2001-06-27 14:23:12 +00:00
// 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 ) ;
}
2001-05-28 14:13:43 +00:00
}
}
2001-06-27 14:23:12 +00:00
std : : vector < XMLPropertyState > : : iterator aIter = xPropStates . begin ( ) ;
std : : vector < XMLPropertyState > : : iterator aEnd = xPropStates . end ( ) ;
while ( aIter ! = aEnd )
{
if ( aIter - > mnIndex ! = - 1 )
nCount + + ;
2010-12-23 15:05:01 +00:00
+ + aIter ;
2001-06-27 14:23:12 +00:00
}
2001-02-02 10:14:37 +00:00
}
if ( nCount = = 0 )
{
// no hard attributes, use parent style name for export
aShapeInfo . msStyleName = aParentName ;
}
else
2000-09-18 16:07:07 +00:00
{
// there are filtered properties -> hard attributes
// try to find this style in AutoStylePool
2006-06-19 17:12:03 +00:00
aShapeInfo . msStyleName = mrExport . GetAutoStylePool ( ) - > Find ( aShapeInfo . mnFamily , aParentName , xPropStates ) ;
2000-09-18 16:07:07 +00:00
2012-01-25 17:00:07 -02:00
if ( aShapeInfo . msStyleName . isEmpty ( ) )
2000-09-18 16:07:07 +00:00
{
// Style did not exist, add it to AutoStalePool
2006-06-19 17:12:03 +00:00
aShapeInfo . msStyleName = mrExport . GetAutoStylePool ( ) - > Add ( aShapeInfo . mnFamily , aParentName , xPropStates ) ;
2000-09-18 16:07:07 +00:00
}
}
2001-06-01 11:32:48 +00:00
// optionaly generate auto style for text attributes
2001-11-30 13:12:36 +00:00
if ( ( ! bIsEmptyPresObj | | ( aShapeInfo . meShapeType ! = XmlShapeTypePresPageShape ) ) & & bObjSupportsText )
2001-06-01 11:32:48 +00:00
{
xPropStates = GetExport ( ) . GetTextParagraphExport ( ) - > GetParagraphPropertyMapper ( ) - > Filter ( xPropSet ) ;
2002-11-06 09:35:40 +00:00
// ----------------------------------------------------------------------
// yet more additionally, we need to care for the ParaAdjust property
if ( XmlShapeTypeDrawControlShape = = aShapeInfo . meShapeType )
{
uno : : Reference < beans : : XPropertySetInfo > xPropSetInfo ( xPropSet - > getPropertySetInfo ( ) ) ;
2005-01-21 15:49:08 +00:00
uno : : Reference < beans : : XPropertyState > xPropState ( xPropSet , uno : : UNO_QUERY ) ;
if ( xPropSetInfo . is ( ) & & xPropState . is ( ) )
2002-11-06 09:35:40 +00:00
{
2005-01-21 15:49:08 +00:00
// 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"
2012-06-02 08:58:21 -05:00
static const : : rtl : : OUString s_sParaAdjustPropertyName ( " ParaAdjust " ) ;
2005-01-21 15:49:08 +00:00
if ( xPropSetInfo - > hasPropertyByName ( s_sParaAdjustPropertyName )
& & ( beans : : PropertyState_DEFAULT_VALUE = = xPropState - > getPropertyState ( s_sParaAdjustPropertyName ) )
)
2002-11-06 09:35:40 +00:00
{
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 ) ;
}
}
}
// ----------------------------------------------------------------------
2001-06-01 11:32:48 +00:00
nCount = 0 ;
2001-06-27 14:23:12 +00:00
std : : vector < XMLPropertyState > : : iterator aIter = xPropStates . begin ( ) ;
std : : vector < XMLPropertyState > : : iterator aEnd = xPropStates . end ( ) ;
2001-06-01 11:32:48 +00:00
while ( aIter ! = aEnd )
{
if ( aIter - > mnIndex ! = - 1 )
nCount + + ;
2010-12-23 15:05:01 +00:00
+ + aIter ;
2001-06-01 11:32:48 +00:00
}
if ( nCount )
{
const OUString aEmpty ;
2006-06-19 17:12:03 +00:00
aShapeInfo . msTextStyleName = mrExport . GetAutoStylePool ( ) - > Find ( XML_STYLE_FAMILY_TEXT_PARAGRAPH , aEmpty , xPropStates ) ;
2012-01-25 17:00:07 -02:00
if ( aShapeInfo . msTextStyleName . isEmpty ( ) )
2001-06-01 11:32:48 +00:00
{
// Style did not exist, add it to AutoStalePool
2006-06-19 17:12:03 +00:00
aShapeInfo . msTextStyleName = mrExport . GetAutoStylePool ( ) - > Add ( XML_STYLE_FAMILY_TEXT_PARAGRAPH , aEmpty , xPropStates ) ;
2001-06-01 11:32:48 +00:00
}
}
}
2000-09-18 16:07:07 +00:00
}
2002-06-17 13:14:39 +00:00
// ----------------------------------------
// prepare animation informations if needed
// ----------------------------------------
if ( mxAnimationsExporter . is ( ) )
2006-06-19 17:12:03 +00:00
mxAnimationsExporter - > prepare ( xShape , mrExport ) ;
2002-06-17 13:14:39 +00:00
2008-03-12 09:35:17 +00:00
// check for special shapes
switch ( aShapeInfo . meShapeType )
2000-11-26 18:48:02 +00:00
{
2008-03-12 09:35:17 +00:00
case XmlShapeTypeDrawConnectorShape :
{
uno : : Reference < uno : : XInterface > xConnection ;
2000-11-26 18:48:02 +00:00
2008-03-12 09:35:17 +00:00
// create shape ids for export later
xPropSet - > getPropertyValue ( msStartShape ) > > = xConnection ;
if ( xConnection . is ( ) )
mrExport . getInterfaceToIdentifierMapper ( ) . registerReference ( xConnection ) ;
2004-11-26 18:33:11 +00:00
2008-03-12 09:35:17 +00:00
xPropSet - > getPropertyValue ( msEndShape ) > > = xConnection ;
if ( xConnection . is ( ) )
mrExport . getInterfaceToIdentifierMapper ( ) . registerReference ( xConnection ) ;
break ;
}
2010-02-24 13:11:19 +01:00
case XmlShapeTypePresTableShape :
2008-03-12 09:35:17 +00:00
case XmlShapeTypeDrawTableShape :
{
try
{
uno : : Reference < table : : XColumnRowRange > xRange ( xSet - > getPropertyValue ( msModel ) , uno : : UNO_QUERY_THROW ) ;
GetShapeTableExport ( ) - > collectTableAutoStyles ( xRange ) ;
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2008-03-12 09:35:17 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table! " ) ;
2008-03-12 09:35:17 +00:00
}
break ;
}
default :
break ;
2000-11-26 18:48:02 +00:00
}
2001-02-02 10:14:37 +00:00
maShapeInfos . push_back ( aShapeInfo ) ;
maCurrentInfo = maShapeInfos . begin ( ) ;
// -----------------------------------------------------
// check for shape collections (group shape or 3d scene)
// and collect contained shapes style infos
// -----------------------------------------------------
2005-04-12 15:46:04 +00:00
const uno : : Reference < drawing : : XShape > & xCollection = aShapeInfo . xCustomShapeReplacement . is ( )
? aShapeInfo . xCustomShapeReplacement : xShape ;
2001-02-02 10:14:37 +00:00
{
2005-04-12 15:46:04 +00:00
uno : : Reference < drawing : : XShapes > xShapes ( xCollection , uno : : UNO_QUERY ) ;
2001-02-02 10:14:37 +00:00
if ( xShapes . is ( ) )
{
collectShapesAutoStyles ( xShapes ) ;
}
}
2000-09-18 16:07:07 +00:00
}
2001-02-02 10:14:37 +00:00
///////////////////////////////////////////////////////////////////////
2008-06-13 08:18:48 +00:00
namespace
{
class NewTextListsHelper
{
public :
NewTextListsHelper ( SvXMLExport & rExp )
: mrExport ( rExp )
{
mrExport . GetTextParagraphExport ( ) - > PushNewTextListsHelper ( ) ;
}
~ NewTextListsHelper ( )
{
mrExport . GetTextParagraphExport ( ) - > PopTextListsHelper ( ) ;
}
private :
SvXMLExport & mrExport ;
} ;
}
2000-09-18 16:07:07 +00:00
// This method exports the given XShape
2000-11-06 11:58:31 +00:00
void XMLShapeExport : : exportShape ( const uno : : Reference < drawing : : XShape > & xShape ,
sal_Int32 nFeatures /* = SEF_DEFAULT */ ,
2004-11-09 11:15:51 +00:00
com : : sun : : star : : awt : : Point * pRefPoint /* = NULL */ ,
SvXMLAttributeList * pAttrList /* = NULL */ )
2000-09-18 16:07:07 +00:00
{
2001-03-08 13:33:34 +00:00
if ( maCurrentShapesIter = = maShapesInfos . end ( ) )
2000-09-18 16:07:07 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::exportShape(): no auto styles where collected before export " ) ;
2001-02-02 10:14:37 +00:00
return ;
}
2001-03-08 13:33:34 +00:00
sal_Int32 nZIndex = 0 ;
uno : : Reference < beans : : XPropertySet > xSet ( xShape , uno : : UNO_QUERY ) ;
2010-02-22 18:27:09 +01:00
: : 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 ;
2012-06-02 08:58:21 -05:00
xSet - > getPropertyValue ( OUString ( " OnClick " ) ) > > = eAction ;
2010-02-22 18:27:09 +01:00
if ( ( eAction = = presentation : : ClickAction_DOCUMENT ) | |
( eAction = = presentation : : ClickAction_BOOKMARK ) )
{
OUString sURL ;
xSet - > getPropertyValue ( msBookmark ) > > = sURL ;
2012-01-25 17:00:07 -02:00
if ( ! sURL . isEmpty ( ) )
2010-02-22 18:27:09 +01:00
{
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 ) ) ;
}
}
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2010-02-22 18:27:09 +01:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::exportShape(): exception during hyperlink export " ) ;
2010-02-22 18:27:09 +01:00
}
2001-03-08 13:33:34 +00:00
if ( xSet . is ( ) )
xSet - > getPropertyValue ( msZIndex ) > > = nZIndex ;
2002-04-17 10:42:15 +00:00
ImplXMLShapeExportInfoVector & aShapeInfoVector = ( * maCurrentShapesIter ) . second ;
2004-11-26 18:33:11 +00:00
if ( ( sal_Int32 ) aShapeInfoVector . size ( ) < = nZIndex )
2002-04-17 10:42:15 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::exportShape(): no shape info collected for a given shape " ) ;
2002-04-17 10:42:15 +00:00
return ;
}
2008-06-13 08:18:48 +00:00
NewTextListsHelper aNewTextListsHelper ( mrExport ) ;
2002-04-17 10:42:15 +00:00
const ImplXMLShapeExportInfo & aShapeInfo = aShapeInfoVector [ nZIndex ] ;
2001-03-08 13:33:34 +00:00
2005-04-12 15:46:04 +00:00
2009-07-10 14:03:42 +02:00
# ifdef DBG_UTIL
2001-03-08 13:33:34 +00:00
// ---------------------------------------
// 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() " ) ;
}
2000-09-18 16:07:07 +00:00
2001-02-02 10:14:37 +00:00
// -----------------------------
// first compute the shapes type
// -----------------------------
{
2000-09-18 16:07:07 +00:00
XmlShapeType eShapeType ( XmlShapeTypeNotYetSet ) ;
2001-02-02 10:14:37 +00:00
ImpCalcShapeType ( xShape , eShapeType ) ;
2000-11-26 18:48:02 +00:00
2001-02-02 10:14:37 +00:00
DBG_ASSERT ( eShapeType = = aShapeInfo . meShapeType , " exportShape callings do not correspond to collectShapeAutoStyles calls! " ) ;
}
# endif
2001-02-02 11:21:59 +00:00
// ----------------------------------------
// collect animation informations if needed
// ----------------------------------------
if ( mxAnimationsExporter . is ( ) )
2006-06-19 17:12:03 +00:00
mxAnimationsExporter - > collect ( xShape , mrExport ) ;
2001-02-02 11:21:59 +00:00
2010-11-09 01:42:14 +05:00
/* Export shapes name if he has one (#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 .
*/
2001-02-02 10:14:37 +00:00
{
2006-03-27 09:04:25 +00:00
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 ( ) ) )
2000-12-07 17:45:57 +00:00
{
2006-03-27 09:04:25 +00:00
uno : : Reference < container : : XNamed > xNamed ( xShape , uno : : UNO_QUERY ) ;
if ( xNamed . is ( ) )
{
const OUString aName ( xNamed - > getName ( ) ) ;
2012-01-25 17:00:07 -02:00
if ( ! aName . isEmpty ( ) )
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_NAME , aName ) ;
2006-03-27 09:04:25 +00:00
}
2000-12-07 17:45:57 +00:00
}
2001-02-02 10:14:37 +00:00
}
// ------------------
// export style name
// ------------------
2012-01-25 17:00:07 -02:00
if ( ! aShapeInfo . msStyleName . isEmpty ( ) )
2001-02-02 10:14:37 +00:00
{
if ( XML_STYLE_FAMILY_SD_GRAPHICS_ID = = aShapeInfo . mnFamily )
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_STYLE_NAME , mrExport . EncodeStyleName ( aShapeInfo . msStyleName ) ) ;
2000-12-07 17:45:57 +00:00
else
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_PRESENTATION , XML_STYLE_NAME , mrExport . EncodeStyleName ( aShapeInfo . msStyleName ) ) ;
2001-02-02 10:14:37 +00:00
}
2001-06-01 11:32:48 +00:00
// ------------------
// export text style name
// ------------------
2012-01-25 17:00:07 -02:00
if ( ! aShapeInfo . msTextStyleName . isEmpty ( ) )
2001-06-01 11:32:48 +00:00
{
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_TEXT_STYLE_NAME , aShapeInfo . msTextStyleName ) ;
2001-06-01 11:32:48 +00:00
}
2001-02-02 10:14:37 +00:00
// --------------------------
// export shapes id if needed
// --------------------------
{
2004-11-26 18:33:11 +00:00
uno : : Reference < uno : : XInterface > xRef ( xShape , uno : : UNO_QUERY ) ;
2006-06-19 17:12:03 +00:00
const OUString & rShapeId = mrExport . getInterfaceToIdentifierMapper ( ) . getIdentifier ( xRef ) ;
2012-01-25 17:00:07 -02:00
if ( ! rShapeId . isEmpty ( ) )
2010-04-19 18:27:16 +02:00
{
mrExport . AddAttributeIdLegacy ( XML_NAMESPACE_DRAW , rShapeId ) ;
}
2001-02-02 10:14:37 +00:00
}
// --------------------------
// export layer information
// --------------------------
if ( IsLayerExportEnabled ( ) )
{
2001-05-28 12:32:20 +00:00
// 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 ( ) )
2001-02-02 10:14:37 +00:00
{
2001-05-28 12:32:20 +00:00
try
{
uno : : Reference < beans : : XPropertySet > xProps ( xShape , uno : : UNO_QUERY ) ;
OUString aLayerName ;
2012-06-02 08:58:21 -05:00
xProps - > getPropertyValue ( OUString ( " LayerName " ) ) > > = aLayerName ;
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_LAYER , aLayerName ) ;
2001-02-02 10:14:37 +00:00
2001-05-28 12:32:20 +00:00
}
2011-08-11 09:42:02 +01:00
catch ( const uno : : Exception & )
2001-05-28 12:32:20 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " could not export layer name for shape! " ) ;
2001-05-28 12:32:20 +00:00
}
2001-02-02 10:14:37 +00:00
}
}
2010-03-02 19:50:13 +01:00
// export draw:display (do not export in ODF 1.2 or older)
if ( xSet . is ( ) & & ( mrExport . getDefaultVersion ( ) > SvtSaveOptions : : ODFVER_012 ) )
{
2010-03-04 16:38:48 +01:00
if ( aShapeInfo . meShapeType ! = XmlShapeTypeDrawPageShape & & aShapeInfo . meShapeType ! = XmlShapeTypePresPageShape & &
2011-01-07 17:09:35 +01:00
aShapeInfo . meShapeType ! = XmlShapeTypeHandoutShape & & aShapeInfo . meShapeType ! = XmlShapeTypeDrawChartShape )
2010-03-04 16:38:48 +01:00
2010-03-02 19:50:13 +01:00
try
{
sal_Bool bVisible = sal_True ;
sal_Bool bPrintable = sal_True ;
xSet - > getPropertyValue ( msVisible ) > > = bVisible ;
xSet - > getPropertyValue ( msPrintable ) > > = bPrintable ;
XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID ;
2010-03-04 16:38:48 +01:00
const unsigned short nDisplay = ( bVisible ? 2 : 0 ) | ( bPrintable ? 1 : 0 ) ;
switch ( nDisplay )
2010-03-02 19:50:13 +01:00
{
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 ) ;
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2010-03-02 19:50:13 +01:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::exportShape(), exception caught! " ) ;
2010-03-02 19:50:13 +01:00
}
}
2001-05-14 13:43:26 +00:00
// #82003# test export count
2001-10-01 10:44:14 +00:00
// #91587# ALWAYS increment since now ALL to be exported shapes are counted.
2006-06-19 17:12:03 +00:00
if ( mrExport . GetShapeExport ( ) - > IsHandleProgressBarEnabled ( ) )
2001-05-14 13:43:26 +00:00
{
2006-06-19 17:12:03 +00:00
mrExport . GetProgressBarHelper ( ) - > Increment ( ) ;
2001-05-14 13:43:26 +00:00
}
2002-05-28 08:28:05 +00:00
onExport ( xShape ) ;
2001-02-02 10:14:37 +00:00
// --------------------
// 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 :
2004-03-30 15:15:01 +00:00
case XmlShapeTypePresHeaderShape :
case XmlShapeTypePresFooterShape :
case XmlShapeTypePresSlideNumberShape :
case XmlShapeTypePresDateTimeShape :
2001-02-02 10:14:37 +00:00
{
ImpExportTextBoxShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
}
case XmlShapeTypeDrawGraphicObjectShape :
case XmlShapeTypePresGraphicObjectShape :
{
ImpExportGraphicObjectShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
}
case XmlShapeTypeDrawChartShape :
case XmlShapeTypePresChartShape :
{
2004-11-09 11:15:51 +00:00
ImpExportChartShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint , pAttrList ) ;
2001-02-02 10:14:37 +00:00
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 :
2008-03-12 09:35:17 +00:00
case XmlShapeTypeDrawSheetShape :
case XmlShapeTypePresSheetShape :
2001-02-02 10:14:37 +00:00
{
ImpExportOLE2Shape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
}
2010-02-23 00:23:09 +01:00
case XmlShapeTypePresTableShape :
2008-03-12 09:35:17 +00:00
case XmlShapeTypeDrawTableShape :
{
ImpExportTableShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
}
2001-02-02 10:14:37 +00:00
case XmlShapeTypeDrawPageShape :
case XmlShapeTypePresPageShape :
2001-05-28 12:32:20 +00:00
case XmlShapeTypeHandoutShape :
2001-02-02 10:14:37 +00:00
{
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 :
2000-12-07 17:45:57 +00:00
{
2001-02-02 10:14:37 +00:00
ImpExport3DSceneShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
2000-12-07 17:45:57 +00:00
}
2001-02-02 10:14:37 +00:00
case XmlShapeTypeDrawGroupShape :
{
// empty group
ImpExportGroupShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
}
case XmlShapeTypeDrawFrameShape :
2001-04-30 08:02:17 +00:00
{
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 ;
}
2004-04-02 12:53:00 +00:00
case XmlShapeTypeDrawCustomShape :
{
2005-04-12 15:46:04 +00:00
if ( aShapeInfo . xCustomShapeReplacement . is ( ) )
ImpExportGroupShape ( aShapeInfo . xCustomShapeReplacement , XmlShapeTypeDrawGroupShape , nFeatures , pRefPoint ) ;
else
ImpExportCustomShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
2004-04-02 12:53:00 +00:00
break ;
}
2010-02-23 00:23:09 +01:00
case XmlShapeTypePresMediaShape :
2004-08-12 07:50:03 +00:00
case XmlShapeTypeDrawMediaShape :
{
ImpExportMediaShape ( xShape , aShapeInfo . meShapeType , nFeatures , pRefPoint ) ;
break ;
}
2001-04-30 08:02:17 +00:00
case XmlShapeTypePresOrgChartShape :
2001-02-02 10:14:37 +00:00
case XmlShapeTypeUnknown :
case XmlShapeTypeNotYetSet :
default :
{
// this should never happen and is an error
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLEXP: WriteShape: unknown or unexpected type of shape in export! " ) ;
2001-02-02 10:14:37 +00:00
break ;
}
}
2002-02-14 06:13:57 +00:00
2010-02-22 18:27:09 +01:00
mpHyperlinkElement . reset ( ) ;
2002-02-14 06:13:57 +00:00
// #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
2006-06-19 17:12:03 +00:00
mrExport . CheckAttrList ( ) ; // asserts in non pro if we have attributes left
mrExport . ClearAttrList ( ) ; // clears the attributes
2001-02-02 10:14:37 +00:00
}
///////////////////////////////////////////////////////////////////////
// This method collects all automatic styles for the shapes inside the given XShapes collection
void XMLShapeExport : : collectShapesAutoStyles ( const uno : : Reference < drawing : : XShapes > & xShapes )
{
2001-03-08 13:33:34 +00:00
ShapesInfos : : iterator aOldCurrentShapesIter = maCurrentShapesIter ;
seekShapes ( xShapes ) ;
2001-02-02 10:14:37 +00:00
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 ) ;
2000-09-18 16:07:07 +00:00
}
2001-03-08 13:33:34 +00:00
maCurrentShapesIter = aOldCurrentShapesIter ;
2000-09-18 16:07:07 +00:00
}
2001-02-02 10:14:37 +00:00
///////////////////////////////////////////////////////////////////////
// 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 */ )
{
2001-03-08 13:33:34 +00:00
ShapesInfos : : iterator aOldCurrentShapesIter = maCurrentShapesIter ;
seekShapes ( xShapes ) ;
2001-02-02 10:14:37 +00:00
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 ) ;
}
2001-03-08 13:33:34 +00:00
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 ( ) ;
}
2001-02-02 10:14:37 +00:00
}
///////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
void XMLShapeExport : : exportAutoStyles ( )
{
// export all autostyle infos
// ...for graphic
{
GetExport ( ) . GetAutoStylePool ( ) - > exportXML (
2001-10-25 19:57:03 +00:00
XML_STYLE_FAMILY_SD_GRAPHICS_ID
, GetExport ( ) . GetDocHandler ( ) ,
2000-09-18 16:07:07 +00:00
GetExport ( ) . GetMM100UnitConverter ( ) ,
2001-10-25 19:57:03 +00:00
GetExport ( ) . GetNamespaceMap ( )
) ;
2000-09-18 16:07:07 +00:00
}
// ...for presentation
{
GetExport ( ) . GetAutoStylePool ( ) - > exportXML (
2001-10-25 19:57:03 +00:00
XML_STYLE_FAMILY_SD_PRESENTATION_ID
, GetExport ( ) . GetDocHandler ( ) ,
2000-09-18 16:07:07 +00:00
GetExport ( ) . GetMM100UnitConverter ( ) ,
2001-10-25 19:57:03 +00:00
GetExport ( ) . GetNamespaceMap ( )
) ;
2000-09-18 16:07:07 +00:00
}
2008-03-12 09:35:17 +00:00
if ( mxShapeTableExport . is ( ) )
mxShapeTableExport - > exportAutoStyles ( ) ;
2000-09-18 16:07:07 +00:00
}
2001-02-02 10:14:37 +00:00
///////////////////////////////////////////////////////////////////////
2001-01-11 15:29:06 +00:00
/// returns the export property mapper for external chaining
SvXMLExportPropertyMapper * XMLShapeExport : : CreateShapePropMapper (
SvXMLExport & rExport )
{
2005-09-05 13:54:30 +00:00
UniReference < XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory ( rExport . GetModel ( ) , rExport ) ;
2001-01-11 15:29:06 +00:00
UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper ( xFactory ) ;
2001-01-17 13:46:32 +00:00
SvXMLExportPropertyMapper * pResult =
2012-08-15 16:18:53 +02:00
new XMLShapeExportPropertyMapper ( xMapper , rExport ) ;
2001-01-17 13:46:32 +00:00
// chain text attributes
return pResult ;
2001-01-11 15:29:06 +00:00
}
2001-02-02 10:14:37 +00:00
///////////////////////////////////////////////////////////////////////
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 ; }
2006-12-12 14:49:10 +00:00
// #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 ; }
2001-02-02 10:14:37 +00:00
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 ; }
2006-12-12 14:49:10 +00:00
// #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape
2001-02-02 10:14:37 +00:00
else if ( aType . EqualsAscii ( " PolyPolygon " , 21 , 11 ) ) { eShapeType = XmlShapeTypeDrawPolyPolygonShape ; }
2006-12-12 14:49:10 +00:00
// #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape
2001-02-02 10:14:37 +00:00
else if ( aType . EqualsAscii ( " PolyLine " , 21 , 8 ) ) { eShapeType = XmlShapeTypeDrawPolyLineShape ; }
2006-12-12 14:49:10 +00:00
2001-02-02 10:14:37 +00:00
else if ( aType . EqualsAscii ( " OpenBezier " , 21 , 10 ) ) { eShapeType = XmlShapeTypeDrawOpenBezierShape ; }
else if ( aType . EqualsAscii ( " ClosedBezier " , 21 , 12 ) ) { eShapeType = XmlShapeTypeDrawClosedBezierShape ; }
2006-12-12 14:49:10 +00:00
// #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 ; }
2001-02-02 10:14:37 +00:00
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 ( ) )
{
2001-07-31 09:47:14 +00:00
rtl : : OUString sCLSID ;
2012-06-02 08:58:21 -05:00
if ( xPropSet - > getPropertyValue ( OUString ( " CLSID " ) ) > > = sCLSID )
2001-07-31 09:47:14 +00:00
{
2006-06-19 17:12:03 +00:00
if ( sCLSID . equals ( mrExport . GetChartExport ( ) - > getChartCLSID ( ) ) )
2001-07-31 09:47:14 +00:00
{
eShapeType = XmlShapeTypeDrawChartShape ;
}
2004-05-03 12:34:42 +00:00
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 ( ) ) )
)
2001-07-31 09:47:14 +00:00
{
2008-03-12 09:35:17 +00:00
eShapeType = XmlShapeTypeDrawSheetShape ;
2001-07-31 09:47:14 +00:00
}
else
{
// general OLE2 Object
}
}
2001-02-02 10:14:37 +00:00
}
}
else if ( aType . EqualsAscii ( " Page " , 21 , 4 ) ) { eShapeType = XmlShapeTypeDrawPageShape ; }
else if ( aType . EqualsAscii ( " Frame " , 21 , 5 ) ) { eShapeType = XmlShapeTypeDrawFrameShape ; }
2001-04-30 08:02:17 +00:00
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 ; }
2008-03-12 09:35:17 +00:00
else if ( aType . EqualsAscii ( " MediaShape " , 21 , 10 ) ) { eShapeType = XmlShapeTypeDrawMediaShape ; }
else if ( aType . EqualsAscii ( " TableShape " , 21 , 10 ) ) { eShapeType = XmlShapeTypeDrawTableShape ; }
2001-02-02 10:14:37 +00:00
// 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 ; }
2008-03-12 09:35:17 +00:00
else if ( aType . EqualsAscii ( " OLE2 " , 26 , 4 ) )
{
eShapeType = XmlShapeTypePresOLE2Shape ;
// get info about presentation shape
uno : : Reference < beans : : XPropertySet > xPropSet ( xShape , uno : : UNO_QUERY ) ;
2010-02-23 00:23:09 +01:00
if ( xPropSet . is ( ) ) try
2008-03-12 09:35:17 +00:00
{
rtl : : OUString sCLSID ;
2012-06-02 08:58:21 -05:00
if ( xPropSet - > getPropertyValue ( OUString ( " CLSID " ) ) > > = sCLSID )
2008-03-12 09:35:17 +00:00
{
if ( sCLSID . equals ( rtl : : OUString ( SvGlobalName ( SO3_SC_CLASSID ) . GetHexName ( ) ) ) | |
sCLSID . equals ( rtl : : OUString ( SvGlobalName ( BF_SO3_SC_CLASSID ) . GetHexName ( ) ) ) )
{
eShapeType = XmlShapeTypePresSheetShape ;
}
}
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2010-02-23 00:23:09 +01:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property? " ) ;
2010-02-23 00:23:09 +01:00
}
2008-03-12 09:35:17 +00:00
}
2001-02-02 10:14:37 +00:00
else if ( aType . EqualsAscii ( " Chart " , 26 , 5 ) ) { eShapeType = XmlShapeTypePresChartShape ; }
else if ( aType . EqualsAscii ( " OrgChart " , 26 , 8 ) ) { eShapeType = XmlShapeTypePresOrgChartShape ; }
2010-02-23 00:23:09 +01:00
else if ( aType . EqualsAscii ( " CalcShape " , 26 , 9 ) ) { eShapeType = XmlShapeTypePresSheetShape ; }
else if ( aType . EqualsAscii ( " TableShape " , 26 , 10 ) ) { eShapeType = XmlShapeTypePresTableShape ; }
2001-02-02 10:14:37 +00:00
else if ( aType . EqualsAscii ( " Notes " , 26 , 5 ) ) { eShapeType = XmlShapeTypePresNotesShape ; }
2001-05-28 12:32:20 +00:00
else if ( aType . EqualsAscii ( " HandoutShape " , 26 , 12 ) ) { eShapeType = XmlShapeTypeHandoutShape ; }
2004-03-30 15:15:01 +00:00
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 ; }
2010-02-25 18:04:05 +01:00
else if ( aType . EqualsAscii ( " MediaShape " , 26 , 10 ) ) { eShapeType = XmlShapeTypePresMediaShape ; }
2001-02-02 10:14:37 +00:00
}
}
}
}
///////////////////////////////////////////////////////////////////////
2001-05-31 10:18:38 +00:00
2001-07-24 16:06:10 +00:00
extern SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap [ ] ;
extern SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap [ ] ;
2001-05-31 10:18:38 +00:00
/** 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 ;
2001-06-11 13:01:00 +00:00
uno : : Reference < container : : XIdentifierAccess > xGluePoints ( xSupplier - > getGluePoints ( ) , uno : : UNO_QUERY ) ;
2001-05-31 10:18:38 +00:00
if ( ! xGluePoints . is ( ) )
return ;
drawing : : GluePoint2 aGluePoint ;
2001-06-11 13:01:00 +00:00
uno : : Sequence < sal_Int32 > aIdSequence ( xGluePoints - > getIdentifiers ( ) ) ;
const sal_Int32 nCount = aIdSequence . getLength ( ) ;
2001-05-31 10:18:38 +00:00
for ( sal_Int32 nIndex = 0 ; nIndex < nCount ; nIndex + + )
{
2001-06-11 13:01:00 +00:00
const sal_Int32 nIdentifier = aIdSequence [ nIndex ] ;
if ( ( xGluePoints - > getByIdentifier ( nIdentifier ) > > = aGluePoint ) & & aGluePoint . IsUserDefined )
2001-05-31 10:18:38 +00:00
{
// export only user defined glue points
2001-06-11 13:01:00 +00:00
const OUString sId ( OUString : : valueOf ( nIdentifier ) ) ;
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_ID , sId ) ;
2001-05-31 10:18:38 +00:00
2011-10-11 14:19:09 +02:00
mrExport . GetMM100UnitConverter ( ) . convertMeasureToXML ( msBuffer ,
aGluePoint . Position . X ) ;
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_SVG , XML_X , msBuffer . makeStringAndClear ( ) ) ;
2001-05-31 10:18:38 +00:00
2011-10-11 14:19:09 +02:00
mrExport . GetMM100UnitConverter ( ) . convertMeasureToXML ( msBuffer ,
aGluePoint . Position . Y ) ;
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_SVG , XML_Y , msBuffer . makeStringAndClear ( ) ) ;
2001-05-31 10:18:38 +00:00
if ( ! aGluePoint . IsRelative )
{
SvXMLUnitConverter : : convertEnum ( msBuffer , aGluePoint . PositionAlignment , aXML_GlueAlignment_EnumMap ) ;
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_ALIGN , msBuffer . makeStringAndClear ( ) ) ;
2001-05-31 10:18:38 +00:00
}
if ( aGluePoint . Escape ! = drawing : : EscapeDirection_SMART )
{
SvXMLUnitConverter : : convertEnum ( msBuffer , aGluePoint . Escape , aXML_GlueEscapeDirection_EnumMap ) ;
2006-06-19 17:12:03 +00:00
mrExport . AddAttribute ( XML_NAMESPACE_DRAW , XML_ESCAPE_DIRECTION , msBuffer . makeStringAndClear ( ) ) ;
2001-05-31 10:18:38 +00:00
}
2006-06-19 17:12:03 +00:00
SvXMLElementExport aEventsElemt ( mrExport , XML_NAMESPACE_DRAW , XML_GLUE_POINT , sal_True , sal_True ) ;
2001-05-31 10:18:38 +00:00
}
}
}
2001-11-27 13:14:16 +00:00
void XMLShapeExport : : ExportGraphicDefaults ( )
{
2006-06-19 17:12:03 +00:00
XMLStyleExport aStEx ( mrExport , OUString ( ) , mrExport . GetAutoStylePool ( ) . get ( ) ) ;
2001-11-27 13:14:16 +00:00
// construct PropertySetMapper
2006-06-19 17:12:03 +00:00
UniReference < SvXMLExportPropertyMapper > xPropertySetMapper ( CreateShapePropMapper ( mrExport ) ) ;
2002-01-11 11:18:09 +00:00
( ( XMLShapeExportPropertyMapper * ) xPropertySetMapper . get ( ) ) - > SetAutoStyles ( sal_False ) ;
2001-11-27 13:14:16 +00:00
// chain text attributes
2006-06-19 17:12:03 +00:00
xPropertySetMapper - > ChainExportMapper ( XMLTextParagraphExport : : CreateParaExtPropMapper ( mrExport ) ) ;
2005-01-27 10:26:13 +00:00
// chain special Writer/text frame default attributes
2006-06-19 17:12:03 +00:00
xPropertySetMapper - > ChainExportMapper ( XMLTextParagraphExport : : CreateParaDefaultExtPropMapper ( mrExport ) ) ;
2001-11-27 13:14:16 +00:00
// write graphic family default style
2006-06-19 17:12:03 +00:00
uno : : Reference < lang : : XMultiServiceFactory > xFact ( mrExport . GetModel ( ) , uno : : UNO_QUERY ) ;
2001-11-27 13:14:16 +00:00
if ( xFact . is ( ) )
{
try
{
2012-06-02 08:58:21 -05:00
uno : : Reference < beans : : XPropertySet > xDefaults ( xFact - > createInstance ( OUString ( " com.sun.star.drawing.Defaults " ) ) , uno : : UNO_QUERY ) ;
2001-11-27 13:14:16 +00:00
if ( xDefaults . is ( ) )
{
2012-06-02 08:58:21 -05:00
aStEx . exportDefaultStyle ( xDefaults , OUString ( XML_STYLE_FAMILY_SD_GRAPHICS_NAME ) , xPropertySetMapper ) ;
2001-11-27 13:14:16 +00:00
// write graphic family styles
2012-06-02 08:58:21 -05:00
aStEx . exportStyleFamily ( " graphics " , OUString ( XML_STYLE_FAMILY_SD_GRAPHICS_NAME ) , xPropertySetMapper , sal_False , XML_STYLE_FAMILY_SD_GRAPHICS_ID ) ;
2001-11-27 13:14:16 +00:00
}
}
2011-06-16 00:26:29 +01:00
catch ( const lang : : ServiceNotRegisteredException & )
2001-11-27 13:14:16 +00:00
{
}
}
2002-05-28 08:28:05 +00:00
}
2006-06-19 17:12:03 +00:00
void XMLShapeExport : : onExport ( const com : : sun : : star : : uno : : Reference < com : : sun : : star : : drawing : : XShape > & )
2002-05-28 08:28:05 +00:00
{
}
2008-03-12 09:35:17 +00:00
const rtl : : Reference < XMLTableExport > & XMLShapeExport : : GetShapeTableExport ( )
{
if ( ! mxShapeTableExport . is ( ) )
{
rtl : : Reference < XMLPropertyHandlerFactory > xFactory ( new XMLSdPropHdlFactory ( mrExport . GetModel ( ) , mrExport ) ) ;
2009-07-06 21:00:37 +00:00
UniReference < XMLPropertySetMapper > xMapper ( new XMLShapePropertySetMapper ( xFactory . get ( ) ) ) ;
2012-08-15 16:18:53 +02:00
rtl : : Reference < SvXMLExportPropertyMapper > xPropertySetMapper ( new XMLShapeExportPropertyMapper ( xMapper , mrExport ) ) ;
2008-03-12 09:35:17 +00:00
mxShapeTableExport = new XMLTableExport ( mrExport , xPropertySetMapper , xFactory ) ;
}
return mxShapeTableExport ;
}
2010-10-12 15:53:47 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */