2010-10-12 15:53:47 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 16:07:07 +00:00
/*************************************************************************
*
2008-04-10 20:56:36 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
2000-09-18 16:07:07 +00:00
*
2010-02-12 15:01:35 +01:00
* Copyright 2000 , 2010 Oracle and / or its affiliates .
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:56:36 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:56:36 +00:00
* This file is part of OpenOffice . org .
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:56:36 +00:00
* 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 .
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:56:36 +00:00
* 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 ) .
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:56:36 +00:00
* 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 .
2000-09-18 16:07:07 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2001-01-18 13:53:32 +00:00
# include <tools/debug.hxx>
2008-07-07 12:27:52 +00:00
# include <com/sun/star/document/XEventsSupplier.hpp>
# include <com/sun/star/container/XNameReplace.hpp>
# include <com/sun/star/presentation/ClickAction.hpp>
2006-04-26 19:43:42 +00:00
# include <com/sun/star/drawing/FillStyle.hpp>
# include <com/sun/star/drawing/LineStyle.hpp>
2011-07-20 22:27:51 +02:00
# include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
2001-05-31 10:18:38 +00:00
# include <com/sun/star/drawing/XGluePointsSupplier.hpp>
2001-06-11 12:46:30 +00:00
# include <com/sun/star/container/XIdentifierAccess.hpp>
2001-05-31 10:18:38 +00:00
# include <com/sun/star/drawing/GluePoint2.hpp>
# include <com/sun/star/drawing/Alignment.hpp>
# include <com/sun/star/drawing/EscapeDirection.hpp>
2004-08-12 07:50:35 +00:00
# include <com/sun/star/media/ZoomLevel.hpp>
2005-02-25 08:23:23 +00:00
# include <com/sun/star/awt/Rectangle.hpp>
2008-03-12 09:38:48 +00:00
# include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
# include <com/sun/star/container/XNameAccess.hpp>
2001-03-16 13:37:07 +00:00
# include <comphelper/extract.hxx>
2000-09-18 16:07:07 +00:00
# include "ximpshap.hxx"
2007-06-27 14:11:25 +00:00
# include <xmloff/XMLBase64ImportContext.hxx>
# include <xmloff/XMLShapeStyleContext.hxx>
# include <xmloff/xmluconv.hxx>
2001-02-21 17:04:45 +00:00
# include <com/sun/star/container/XNamed.hpp>
2000-12-20 15:17:17 +00:00
# include <com/sun/star/drawing/CircleKind.hpp>
2000-09-18 16:07:07 +00:00
# include <com/sun/star/beans/XPropertySet.hpp>
2001-01-18 13:53:32 +00:00
# include <com/sun/star/awt/XControlModel.hpp>
# include <com/sun/star/drawing/XControlShape.hpp>
2000-09-18 16:07:07 +00:00
# include <com/sun/star/drawing/PointSequenceSequence.hpp>
# include <com/sun/star/drawing/PointSequence.hpp>
2001-05-28 12:32:20 +00:00
# include <com/sun/star/lang/XServiceInfo.hpp>
2004-07-13 07:26:37 +00:00
# include <com/sun/star/util/XCloneable.hpp>
2004-11-26 13:59:16 +00:00
# include <com/sun/star/beans/XMultiPropertyStates.hpp>
2000-09-18 16:07:07 +00:00
# include "xexptran.hxx"
# include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
2005-04-18 10:12:44 +00:00
# include <com/sun/star/beans/XPropertySetInfo.hpp>
2000-11-26 18:48:02 +00:00
# include <com/sun/star/drawing/ConnectorType.hpp>
2001-02-09 12:38:53 +00:00
# include <com/sun/star/drawing/HomogenMatrix3.hpp>
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
# include <sax/tools/converter.hxx>
2001-02-08 13:45:43 +00:00
# include "PropertySetMerger.hxx"
2007-06-27 14:11:25 +00:00
# include <xmloff/families.hxx>
2000-09-18 16:07:07 +00:00
# include "ximpstyl.hxx"
2010-04-16 23:04:00 +02:00
# include"xmloff / xmlnmspe.hxx"
2007-06-27 14:11:25 +00:00
# include <xmloff/xmltoken.hxx>
2004-04-02 12:53:51 +00:00
# include "EnhancedCustomShapeToken.hxx"
2004-11-26 12:00:41 +00:00
# include "XMLReplacementImageContext.hxx"
2001-03-29 15:48:43 +00:00
# include "XMLImageMapContext.hxx"
2000-11-26 18:48:02 +00:00
# include "sdpropls.hxx"
2001-02-07 15:26:36 +00:00
# include "eventimp.hxx"
2006-12-19 16:27:16 +00:00
# include "descriptionimp.hxx"
2004-04-02 12:53:51 +00:00
# include "ximpcustomshape.hxx"
2002-06-27 10:09:52 +00:00
# include "XMLEmbeddedObjectImportContext.hxx"
2010-04-16 23:04:00 +02:00
# include "xmloff/xmlerror.hxx"
2006-11-14 13:16:34 +00:00
# include <basegfx/matrix/b2dhommatrix.hxx>
2007-11-01 14:21:56 +00:00
# include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
2006-03-06 12:41:58 +00:00
# include <com/sun/star/text/XTextDocument.hpp>
2008-03-12 09:38:48 +00:00
using : : rtl : : OUString ;
using : : rtl : : OUStringBuffer ;
2000-09-18 16:07:07 +00:00
using namespace : : com : : sun : : star ;
2006-04-26 19:43:42 +00:00
using namespace : : com : : sun : : star : : uno ;
using namespace : : com : : sun : : star : : drawing ;
2008-03-12 09:38:48 +00:00
using namespace : : com : : sun : : star : : style ;
using namespace : : com : : sun : : star : : container ;
2008-07-07 12:27:52 +00:00
using namespace : : com : : sun : : star : : document ;
2001-06-29 20:07:26 +00:00
using namespace : : xmloff : : token ;
2004-04-02 12:53:51 +00:00
using namespace : : xmloff : : EnhancedCustomShapeToken ;
2000-09-18 16:07:07 +00:00
2001-07-24 16:06:10 +00:00
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 }
} ;
2001-05-31 10:18:38 +00:00
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2003-04-24 13:51:47 +00:00
static bool ImpIsEmptyURL ( const : : rtl : : OUString & rURL )
{
2012-01-25 17:00:07 -02:00
if ( rURL . isEmpty ( ) )
2003-04-24 13:51:47 +00:00
return true ;
// #i13140# Also compare against 'toplevel' URLs. which also
// result in empty filename strings.
if ( 0 = = rURL . compareToAscii ( " #./ " ) )
return true ;
return false ;
}
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2004-06-28 12:53:12 +00:00
TYPEINIT1 ( SvXMLShapeContext , SvXMLImportContext ) ;
TYPEINIT1 ( SdXMLShapeContext , SvXMLShapeContext ) ;
2000-09-18 16:07:07 +00:00
SdXMLShapeContext : : SdXMLShapeContext (
SvXMLImport & rImport ,
sal_uInt16 nPrfx ,
const OUString & rLocalName ,
const com : : sun : : star : : uno : : Reference < com : : sun : : star : : xml : : sax : : XAttributeList > & xAttrList ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
2006-02-27 15:35:02 +00:00
: SvXMLShapeContext ( rImport , nPrfx , rLocalName , bTemporaryShape )
, mxShapes ( rShapes )
2006-06-19 17:15:11 +00:00
, mxAttrList ( xAttrList )
2008-10-01 06:34:11 +00:00
, mbListContextPushed ( false )
2006-02-27 15:35:02 +00:00
, mnStyleFamily ( XML_STYLE_FAMILY_SD_GRAPHICS_ID )
2010-11-10 13:50:33 +08:00
, mbIsPlaceholder ( sal_False )
2006-06-19 17:15:11 +00:00
, mbClearDefaultAttributes ( true )
2010-11-10 13:50:33 +08:00
, mbIsUserTransformed ( sal_False )
2006-02-27 15:35:02 +00:00
, mnZOrder ( - 1 )
, maSize ( 1 , 1 )
2006-06-19 17:15:11 +00:00
, maPosition ( 0 , 0 )
2010-03-02 19:50:13 +01:00
, mbVisible ( true )
, mbPrintable ( true )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLShapeContext : : ~ SdXMLShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2010-11-10 13:50:33 +08:00
SvXMLImportContext * SdXMLShapeContext : : CreateChildContext ( sal_uInt16 p_nPrefix ,
2000-09-18 16:07:07 +00:00
const OUString & rLocalName ,
const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
2001-02-07 15:26:36 +00:00
SvXMLImportContext * pContext = NULL ;
2006-12-19 16:27:16 +00:00
// #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 ) )
2001-02-07 15:26:36 +00:00
{
2006-06-19 17:15:11 +00:00
pContext = new SdXMLEventsContext ( GetImport ( ) , p_nPrefix , rLocalName , xAttrList , mxShape ) ;
2001-02-07 15:26:36 +00:00
}
2006-06-19 17:15:11 +00:00
else if ( p_nPrefix = = XML_NAMESPACE_DRAW & & IsXMLToken ( rLocalName , XML_GLUE_POINT ) )
2001-05-31 10:18:38 +00:00
{
addGluePoint ( xAttrList ) ;
}
2006-06-19 17:15:11 +00:00
else if ( p_nPrefix = = XML_NAMESPACE_DRAW & & IsXMLToken ( rLocalName , XML_THUMBNAIL ) )
2001-06-14 15:50:57 +00:00
{
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( aLocalName , XML_HREF ) )
2001-06-14 15:50:57 +00:00
{
2001-07-02 12:24:00 +00:00
maThumbnailURL = xAttrList - > getValueByIndex ( i ) ;
2001-06-14 15:50:57 +00:00
break ;
}
}
}
}
2001-02-07 15:26:36 +00:00
else
2000-09-18 16:07:07 +00:00
{
2001-02-07 15:26:36 +00:00
// create text cursor on demand
if ( ! mxCursor . is ( ) )
2000-09-18 16:07:07 +00:00
{
2001-02-07 15:26:36 +00:00
uno : : Reference < text : : XText > xText ( mxShape , uno : : UNO_QUERY ) ;
if ( xText . is ( ) )
2000-09-18 16:07:07 +00:00
{
2001-09-07 05:06:55 +00:00
UniReference < XMLTextImportHelper > xTxtImport =
GetImport ( ) . GetTextImport ( ) ;
mxOldCursor = xTxtImport - > GetCursor ( ) ;
2001-02-07 15:26:36 +00:00
mxCursor = xText - > createTextCursor ( ) ;
if ( mxCursor . is ( ) )
{
2001-09-07 05:06:55 +00:00
xTxtImport - > SetCursor ( mxCursor ) ;
2001-02-07 15:26:36 +00:00
}
2001-09-07 05:06:55 +00:00
// remember old list item and block (#91964#) and reset them
// for the text frame
2008-10-01 06:34:11 +00:00
xTxtImport - > PushListContext ( ) ;
mbListContextPushed = true ;
2000-09-18 16:07:07 +00:00
}
}
2001-02-07 15:26:36 +00:00
// if we have a text cursor, lets try to import some text
if ( mxCursor . is ( ) )
{
pContext = GetImport ( ) . GetTextImport ( ) - > CreateTextChildContext (
2006-06-19 17:15:11 +00:00
GetImport ( ) , p_nPrefix , rLocalName , xAttrList ) ;
2001-02-07 15:26:36 +00:00
}
2000-09-18 16:07:07 +00:00
}
// call parent for content
if ( ! pContext )
2006-06-19 17:15:11 +00:00
pContext = SvXMLImportContext : : CreateChildContext ( p_nPrefix , rLocalName , xAttrList ) ;
2000-09-18 16:07:07 +00:00
return pContext ;
}
2001-05-31 10:18:38 +00:00
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 ;
2001-06-19 13:53:22 +00:00
mxGluePoints = uno : : Reference < container : : XIdentifierContainer > : : query ( xSupplier - > getGluePoints ( ) ) ;
2001-05-31 10:18:38 +00:00
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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( aLocalName , XML_X ) )
2001-05-31 10:18:38 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
aGluePoint . Position . X , sValue ) ;
2001-05-31 10:18:38 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( aLocalName , XML_Y ) )
2001-05-31 10:18:38 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
aGluePoint . Position . Y , sValue ) ;
2001-05-31 10:18:38 +00:00
}
}
else if ( nPrefix = = XML_NAMESPACE_DRAW )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( aLocalName , XML_ID ) )
2001-05-31 10:18:38 +00:00
{
nId = sValue . toInt32 ( ) ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( aLocalName , XML_ALIGN ) )
2001-05-31 10:18:38 +00:00
{
2010-11-10 13:50:33 +08:00
sal_uInt16 eKind ;
2001-05-31 10:18:38 +00:00
if ( SvXMLUnitConverter : : convertEnum ( eKind , sValue , aXML_GlueAlignment_EnumMap ) )
{
aGluePoint . PositionAlignment = ( drawing : : Alignment ) eKind ;
aGluePoint . IsRelative = sal_False ;
}
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( aLocalName , XML_ESCAPE_DIRECTION ) )
2001-05-31 10:18:38 +00:00
{
2010-11-10 13:50:33 +08:00
sal_uInt16 eKind ;
2001-05-31 10:18:38 +00:00
if ( SvXMLUnitConverter : : convertEnum ( eKind , sValue , aXML_GlueEscapeDirection_EnumMap ) )
{
aGluePoint . Escape = ( drawing : : EscapeDirection ) eKind ;
}
}
}
}
if ( nId ! = - 1 )
{
try
{
2001-06-19 13:53:22 +00:00
sal_Int32 nInternalId = mxGluePoints - > insert ( uno : : makeAny ( aGluePoint ) ) ;
GetImport ( ) . GetShapeImport ( ) - > addGluePointMapping ( mxShape , nId , nInternalId ) ;
2001-05-31 10:18:38 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-05-31 10:18:38 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " exception during setting of glue points! " ) ;
2001-05-31 10:18:38 +00:00
}
}
}
2000-09-18 16:07:07 +00:00
//////////////////////////////////////////////////////////////////////////////
2006-06-19 17:15:11 +00:00
void SdXMLShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
GetImport ( ) . GetShapeImport ( ) - > finishShape ( mxShape , mxAttrList , mxShapes ) ;
2000-09-18 16:07:07 +00:00
}
2004-06-28 12:53:12 +00:00
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#
2008-10-01 06:34:11 +00:00
if ( mbListContextPushed ) {
GetImport ( ) . GetTextImport ( ) - > PopListContext ( ) ;
2004-06-28 12:53:12 +00:00
}
2012-01-25 17:00:07 -02:00
if ( ! msHyperlink . isEmpty ( ) ) try
2008-07-07 12:27:52 +00:00
{
2010-10-06 10:16:27 +01:00
uno : : Reference < beans : : XPropertySet > xProp ( mxShape , uno : : UNO_QUERY ) ;
2012-06-02 08:58:21 -05:00
rtl : : OUString sLink ( " Hyperlink " ) ;
2010-10-06 10:16:27 +01:00
if ( xProp . is ( ) & & xProp - > getPropertySetInfo ( ) - > hasPropertyByName ( sLink ) )
xProp - > setPropertyValue ( sLink , uno : : Any ( msHyperlink ) ) ;
Reference < XEventsSupplier > xEventsSupplier ( mxShape , UNO_QUERY_THROW ) ;
2012-06-02 08:58:21 -05:00
const OUString sBookmark ( " Bookmark " ) ;
2008-07-07 12:27:52 +00:00
2010-02-22 18:27:09 +01:00
if ( xEventsSupplier . is ( ) )
{
2012-06-02 08:58:21 -05:00
const OUString sEventType ( " EventType " ) ;
const OUString sClickAction ( " ClickAction " ) ;
2010-02-22 18:27:09 +01:00
Reference < XNameReplace > xEvents ( xEventsSupplier - > getEvents ( ) , UNO_QUERY_THROW ) ;
uno : : Sequence < beans : : PropertyValue > aProperties ( 3 ) ;
aProperties [ 0 ] . Name = sEventType ;
aProperties [ 0 ] . Handle = - 1 ;
2012-06-02 08:58:21 -05:00
aProperties [ 0 ] . Value < < = OUString ( " Presentation " ) ;
2010-02-22 18:27:09 +01:00
aProperties [ 0 ] . State = beans : : PropertyState_DIRECT_VALUE ;
2008-07-07 12:27:52 +00:00
2010-02-22 18:27:09 +01:00
aProperties [ 1 ] . Name = sClickAction ;
aProperties [ 1 ] . Handle = - 1 ;
aProperties [ 1 ] . Value < < = : : com : : sun : : star : : presentation : : ClickAction_DOCUMENT ;
aProperties [ 1 ] . State = beans : : PropertyState_DIRECT_VALUE ;
2008-07-07 12:27:52 +00:00
2010-02-22 18:27:09 +01:00
aProperties [ 2 ] . Name = sBookmark ;
aProperties [ 2 ] . Handle = - 1 ;
aProperties [ 2 ] . Value < < = msHyperlink ;
aProperties [ 2 ] . State = beans : : PropertyState_DIRECT_VALUE ;
2008-07-07 12:27:52 +00:00
2012-06-02 08:58:21 -05:00
const OUString sAPIEventName ( " OnClick " ) ;
2010-02-22 18:27:09 +01:00
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 ) ) ;
2012-06-02 08:58:21 -05:00
xSet - > setPropertyValue ( OUString ( " OnClick " ) , Any ( : : com : : sun : : star : : presentation : : ClickAction_DOCUMENT ) ) ;
2010-02-22 18:27:09 +01:00
}
2008-07-07 12:27:52 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const Exception & )
2008-07-07 12:27:52 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink! " ) ;
2008-07-07 12:27:52 +00:00
}
2004-06-28 12:53:12 +00:00
if ( mxLockable . is ( ) )
mxLockable - > removeActionLock ( ) ;
}
2000-09-18 16:07:07 +00:00
//////////////////////////////////////////////////////////////////////////////
void SdXMLShapeContext : : AddShape ( uno : : Reference < drawing : : XShape > & xShape )
{
2000-11-06 11:08:07 +00:00
if ( xShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
// set shape local
mxShape = xShape ;
2012-01-25 17:00:07 -02:00
if ( ! maShapeName . isEmpty ( ) )
2000-11-16 15:31:37 +00:00
{
uno : : Reference < container : : XNamed > xNamed ( mxShape , uno : : UNO_QUERY ) ;
if ( xNamed . is ( ) )
xNamed - > setName ( maShapeName ) ;
}
2000-12-13 18:16:42 +00:00
UniReference < XMLShapeImportHelper > xImp ( GetImport ( ) . GetShapeImport ( ) ) ;
xImp - > addShape ( xShape , mxAttrList , mxShapes ) ;
2003-04-08 14:29:37 +00:00
2006-02-27 15:35:02 +00:00
if ( mbClearDefaultAttributes )
2006-02-09 13:03:11 +00:00
{
uno : : Reference < beans : : XMultiPropertyStates > xMultiPropertyStates ( xShape , uno : : UNO_QUERY ) ;
if ( xMultiPropertyStates . is ( ) )
xMultiPropertyStates - > setAllPropertiesToDefault ( ) ;
}
2010-03-02 19:50:13 +01:00
if ( ! mbVisible | | ! mbPrintable ) try
{
uno : : Reference < beans : : XPropertySet > xSet ( xShape , uno : : UNO_QUERY_THROW ) ;
if ( ! mbVisible )
2012-06-02 08:58:21 -05:00
xSet - > setPropertyValue ( rtl : : OUString ( " Visible " ) , uno : : Any ( sal_False ) ) ;
2010-03-02 19:50:13 +01:00
if ( ! mbPrintable )
2012-06-02 08:58:21 -05:00
xSet - > setPropertyValue ( rtl : : OUString ( " Printable " ) , uno : : Any ( sal_False ) ) ;
2010-03-02 19:50:13 +01:00
}
2011-06-16 00:26:29 +01:00
catch ( const Exception & )
2010-03-02 19:50:13 +01:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " SdXMLShapeContext::AddShape(), exception caught! " ) ;
2010-03-02 19:50:13 +01:00
}
2003-04-08 14:29:37 +00:00
// #107848#
2004-10-22 06:55:13 +00:00
if ( ! mbTemporaryShape & & ( ! GetImport ( ) . HasTextImport ( )
| | ! GetImport ( ) . GetTextImport ( ) - > IsInsideDeleteContext ( ) ) )
2003-04-08 14:29:37 +00:00
{
xImp - > shapeWithZIndexAdded ( xShape , mnZOrder ) ;
}
2000-12-13 18:16:42 +00:00
2012-01-25 17:00:07 -02:00
if ( ! maShapeId . isEmpty ( ) )
2004-11-26 18:34:06 +00:00
{
uno : : Reference < uno : : XInterface > xRef ( xShape , uno : : UNO_QUERY ) ;
GetImport ( ) . getInterfaceToIdentifierMapper ( ) . registerReference ( maShapeId , xRef ) ;
}
2001-07-31 15:31:45 +00:00
2001-08-16 09:39:38 +00:00
// #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 ( ) ;
}
2000-12-13 18:16:42 +00:00
}
2001-07-30 13:19:26 +00:00
mxLockable = uno : : Reference < document : : XActionLockable > : : query ( xShape ) ;
if ( mxLockable . is ( ) )
mxLockable - > addActionLock ( ) ;
2000-12-13 18:16:42 +00:00
}
//////////////////////////////////////////////////////////////////////////////
void SdXMLShapeContext : : AddShape ( const char * pServiceName )
{
uno : : Reference < lang : : XMultiServiceFactory > xServiceFact ( GetImport ( ) . GetModel ( ) , uno : : UNO_QUERY ) ;
if ( xServiceFact . is ( ) )
{
2005-01-27 10:26:44 +00:00
try
{
2010-11-09 01:42:14 +05:00
/* 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 .
*/
2006-03-06 12:41:58 +00:00
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 ( ) )
{
2012-06-02 08:58:21 -05:00
xShape = uno : : Reference < drawing : : XShape > ( xServiceFact - > createInstance ( OUString ( " com.sun.star.drawing.temporaryForXMLImportOLE2Shape " ) ) , uno : : UNO_QUERY ) ;
2006-03-06 12:41:58 +00:00
}
else
{
xShape = uno : : Reference < drawing : : XShape > ( xServiceFact - > createInstance ( OUString : : createFromAscii ( pServiceName ) ) , uno : : UNO_QUERY ) ;
}
2005-01-27 10:26:44 +00:00
if ( xShape . is ( ) )
AddShape ( xShape ) ;
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & e )
2005-01-27 10:26:44 +00:00
{
uno : : Sequence < rtl : : OUString > aSeq ( 1 ) ;
aSeq [ 0 ] = OUString : : createFromAscii ( pServiceName ) ;
GetImport ( ) . SetError ( XMLERROR_FLAG_ERROR | XMLERROR_API ,
aSeq , e . Message , NULL ) ;
}
2000-12-13 18:16:42 +00:00
}
}
//////////////////////////////////////////////////////////////////////////////
2001-02-09 12:38:53 +00:00
void SdXMLShapeContext : : SetTransformation ( )
2000-12-13 18:16:42 +00:00
{
2001-02-22 11:27:36 +00:00
if ( mxShape . is ( ) )
2000-12-13 18:16:42 +00:00
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
2006-11-14 13:16:34 +00:00
: : basegfx : : B2DHomMatrix aTransformation ;
2001-02-09 12:38:53 +00:00
2001-02-22 11:27:36 +00:00
if ( maSize . Width ! = 1 | | maSize . Height ! = 1 )
{
2001-02-22 16:06:04 +00:00
// take care there are no zeros used by error
if ( 0 = = maSize . Width )
maSize . Width = 1 ;
if ( 0 = = maSize . Height )
maSize . Height = 1 ;
2001-02-22 11:27:36 +00:00
// set global size. This should always be used.
2006-11-14 13:16:34 +00:00
aTransformation . scale ( maSize . Width , maSize . Height ) ;
2001-02-22 11:27:36 +00:00
}
2001-02-09 12:38:53 +00:00
2001-02-22 11:27:36 +00:00
if ( maPosition . X ! = 0 | | maPosition . Y ! = 0 )
{
// if global position is used, add it to transformation
2006-11-14 13:16:34 +00:00
aTransformation . translate ( maPosition . X , maPosition . Y ) ;
2001-02-22 11:27:36 +00:00
}
2001-02-09 12:38:53 +00:00
2001-02-22 11:27:36 +00:00
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 !!!
2006-11-14 13:16:34 +00:00
: : basegfx : : B2DHomMatrix aMat ;
2001-02-22 11:27:36 +00:00
mnTransform . GetFullTransform ( aMat ) ;
// now add to transformation
aTransformation * = aMat ;
}
2001-02-09 12:38:53 +00:00
2001-02-22 11:27:36 +00:00
// now set transformation for this object
2000-12-13 18:16:42 +00:00
uno : : Any aAny ;
2001-02-22 11:27:36 +00:00
drawing : : HomogenMatrix3 aMatrix ;
2006-11-14 13:16:34 +00:00
aMatrix . Line1 . Column1 = aTransformation . get ( 0 , 0 ) ;
aMatrix . Line1 . Column2 = aTransformation . get ( 0 , 1 ) ;
aMatrix . Line1 . Column3 = aTransformation . get ( 0 , 2 ) ;
2001-02-22 11:27:36 +00:00
2006-11-14 13:16:34 +00:00
aMatrix . Line2 . Column1 = aTransformation . get ( 1 , 0 ) ;
aMatrix . Line2 . Column2 = aTransformation . get ( 1 , 1 ) ;
aMatrix . Line2 . Column3 = aTransformation . get ( 1 , 2 ) ;
2001-02-22 11:27:36 +00:00
2006-11-14 13:16:34 +00:00
aMatrix . Line3 . Column1 = aTransformation . get ( 2 , 0 ) ;
aMatrix . Line3 . Column2 = aTransformation . get ( 2 , 1 ) ;
aMatrix . Line3 . Column3 = aTransformation . get ( 2 , 2 ) ;
2001-02-22 11:27:36 +00:00
2001-02-09 12:38:53 +00:00
aAny < < = aMatrix ;
2000-12-13 18:16:42 +00:00
xPropSet - > setPropertyValue (
2012-06-02 08:58:21 -05:00
OUString ( " Transformation " ) , aAny ) ;
2000-12-13 18:16:42 +00:00
}
2000-09-18 16:07:07 +00:00
}
}
//////////////////////////////////////////////////////////////////////////////
2003-03-27 17:21:03 +00:00
void SdXMLShapeContext : : SetStyle ( bool bSupportsStyle /* = true */ )
2000-09-18 16:07:07 +00:00
{
2001-03-01 15:31:32 +00:00
try
2000-09-18 16:07:07 +00:00
{
2001-06-01 11:32:48 +00:00
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( ! xPropSet . is ( ) )
return ;
2001-03-01 15:31:32 +00:00
do
{
XMLPropStyleContext * pDocStyle = NULL ;
2001-02-08 13:45:43 +00:00
2001-03-01 15:31:32 +00:00
// set style on shape
2012-01-25 17:00:07 -02:00
if ( maDrawStyleName . isEmpty ( ) )
2001-03-01 15:31:32 +00:00
break ;
2000-09-18 16:07:07 +00:00
2001-03-01 15:31:32 +00:00
const SvXMLStyleContext * pStyle = 0L ;
2010-11-10 13:50:33 +08:00
sal_Bool bAutoStyle ( sal_False ) ;
2000-09-18 16:07:07 +00:00
2001-03-01 15:31:32 +00:00
if ( GetImport ( ) . GetShapeImport ( ) - > GetAutoStylesContext ( ) )
pStyle = GetImport ( ) . GetShapeImport ( ) - > GetAutoStylesContext ( ) - > FindStyleChildContext ( mnStyleFamily , maDrawStyleName ) ;
2001-02-08 13:45:43 +00:00
2001-03-01 15:31:32 +00:00
if ( pStyle )
2010-11-10 13:50:33 +08:00
bAutoStyle = sal_True ;
2001-02-08 13:45:43 +00:00
2001-03-01 15:31:32 +00:00
if ( ! pStyle & & GetImport ( ) . GetShapeImport ( ) - > GetStylesContext ( ) )
pStyle = GetImport ( ) . GetShapeImport ( ) - > GetStylesContext ( ) - > FindStyleChildContext ( mnStyleFamily , maDrawStyleName ) ;
2000-09-18 16:07:07 +00:00
2001-03-01 15:31:32 +00:00
OUString aStyleName = maDrawStyleName ;
uno : : Reference < style : : XStyle > xStyle ;
2001-02-08 13:45:43 +00:00
2001-03-01 15:31:32 +00:00
if ( pStyle & & pStyle - > ISA ( XMLShapeStyleContext ) )
{
pDocStyle = PTR_CAST ( XMLShapeStyleContext , pStyle ) ;
if ( pDocStyle - > GetStyle ( ) . is ( ) )
{
xStyle = pDocStyle - > GetStyle ( ) ;
}
else
{
2004-11-26 12:00:41 +00:00
aStyleName = pDocStyle - > GetParentName ( ) ;
2001-03-01 15:31:32 +00:00
}
}
2000-09-18 16:07:07 +00:00
2012-01-25 17:00:07 -02:00
if ( ! xStyle . is ( ) & & ! aStyleName . isEmpty ( ) )
2001-03-01 15:31:32 +00:00
{
2003-03-27 17:21:03 +00:00
try
2001-03-01 15:31:32 +00:00
{
2003-03-27 17:21:03 +00:00
uno : : Reference < style : : XStyleFamiliesSupplier > xFamiliesSupplier ( GetImport ( ) . GetModel ( ) , uno : : UNO_QUERY ) ;
2001-09-28 13:29:19 +00:00
2003-03-27 17:21:03 +00:00
if ( xFamiliesSupplier . is ( ) )
{
uno : : Reference < container : : XNameAccess > xFamilies ( xFamiliesSupplier - > getStyleFamilies ( ) ) ;
if ( xFamilies . is ( ) )
2001-09-28 13:29:19 +00:00
{
2003-03-27 17:21:03 +00:00
uno : : Reference < container : : XNameAccess > xFamily ;
if ( XML_STYLE_FAMILY_SD_PRESENTATION_ID = = mnStyleFamily )
{
2004-07-13 07:26:37 +00:00
aStyleName = GetImport ( ) . GetStyleDisplayName (
XML_STYLE_FAMILY_SD_PRESENTATION_ID ,
aStyleName ) ;
2003-03-27 17:21:03 +00:00
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
{
2004-07-13 07:26:37 +00:00
// get graphics familie
2012-06-02 08:58:21 -05:00
xFamilies - > getByName ( OUString ( " graphics " ) ) > > = xFamily ;
2004-07-13 07:26:37 +00:00
aStyleName = GetImport ( ) . GetStyleDisplayName (
XML_STYLE_FAMILY_SD_GRAPHICS_ID ,
aStyleName ) ;
2002-11-25 12:13:11 +00:00
}
2001-09-28 13:29:19 +00:00
2003-03-27 17:21:03 +00:00
if ( xFamily . is ( ) )
xFamily - > getByName ( aStyleName ) > > = xStyle ;
}
2001-09-28 13:29:19 +00:00
}
2001-03-01 15:31:32 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2003-03-27 17:21:03 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " could not find style for shape! " ) ;
2003-03-27 17:21:03 +00:00
}
2001-03-01 15:31:32 +00:00
}
2003-03-27 17:21:03 +00:00
if ( bSupportsStyle & & xStyle . is ( ) )
2001-03-01 15:31:32 +00:00
{
try
{
// set style on object
uno : : Any aAny ;
aAny < < = xStyle ;
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " Style " ) , aAny ) ;
2001-03-01 15:31:32 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-03-01 15:31:32 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " could not find style for shape! " ) ;
2001-03-01 15:31:32 +00:00
}
}
2001-02-08 13:45:43 +00:00
2001-03-01 15:31:32 +00:00
// if this is an auto style, set its properties
if ( bAutoStyle & & pDocStyle )
{
// set PropertySet on object
pDocStyle - > FillPropertySet ( xPropSet ) ;
}
} while ( 0 ) ;
2001-06-01 11:32:48 +00:00
// try to set text auto style
do
{
// set style on shape
2012-01-25 17:00:07 -02:00
if ( maTextStyleName . isEmpty ( ) )
2001-06-01 11:32:48 +00:00
break ;
if ( NULL = = GetImport ( ) . GetShapeImport ( ) - > GetAutoStylesContext ( ) )
break ;
2008-03-05 15:46:41 +00:00
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
2001-06-01 11:32:48 +00:00
if ( pStyle = = NULL )
break ;
// set PropertySet on object
pStyle - > FillPropertySet ( xPropSet ) ;
} while ( 0 ) ;
2001-03-01 15:31:32 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-03-01 15:31:32 +00:00
{
}
2000-09-18 16:07:07 +00:00
}
2001-01-19 15:25:18 +00:00
void SdXMLShapeContext : : SetLayer ( )
{
2012-01-25 17:00:07 -02:00
if ( ! maLayerName . isEmpty ( ) )
2001-01-19 15:25:18 +00:00
{
try
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
uno : : Any aAny ;
aAny < < = maLayerName ;
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " LayerName " ) , aAny ) ;
2001-01-19 15:25:18 +00:00
return ;
}
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-01-19 15:25:18 +00:00
{
}
}
}
2001-06-14 15:50:57 +00:00
void SdXMLShapeContext : : SetThumbnail ( )
{
2012-01-25 17:00:07 -02:00
if ( maThumbnailURL . isEmpty ( ) )
2001-06-14 15:50:57 +00:00
return ;
try
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( ! xPropSet . is ( ) )
return ;
2012-06-02 08:58:21 -05:00
const OUString sProperty ( " ThumbnailGraphicURL " ) ;
2001-06-14 15:50:57 +00:00
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 ) ) ;
}
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-06-14 15:50:57 +00:00
{
}
}
2000-11-23 17:30:39 +00:00
// 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 )
{
2010-04-19 18:27:16 +02:00
bool bHaveXmlId ( false ) ;
2010-03-02 19:50:13 +01:00
if ( ( XML_NAMESPACE_DRAW = = nPrefix ) | | ( XML_NAMESPACE_DRAW_EXT = = nPrefix ) )
2000-11-23 17:30:39 +00:00
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_ZINDEX ) )
2000-11-23 17:30:39 +00:00
{
mnZOrder = rValue . toInt32 ( ) ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_ID ) )
2000-12-13 18:16:42 +00:00
{
2010-04-19 18:27:16 +02:00
if ( ! bHaveXmlId ) { maShapeId = rValue ; } ;
2000-12-13 18:16:42 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_NAME ) )
2000-11-26 18:48:02 +00:00
{
2000-12-13 18:16:42 +00:00
maShapeName = rValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_STYLE_NAME ) )
2000-12-13 18:16:42 +00:00
{
maDrawStyleName = rValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_TEXT_STYLE_NAME ) )
2001-06-01 11:32:48 +00:00
{
maTextStyleName = rValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_LAYER ) )
2001-01-19 15:25:18 +00:00
{
maLayerName = rValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_TRANSFORM ) )
2001-02-26 09:26:58 +00:00
{
mnTransform . SetString ( rValue , GetImport ( ) . GetMM100UnitConverter ( ) ) ;
}
2010-03-02 19:50:13 +01:00
else if ( IsXMLToken ( rLocalName , XML_DISPLAY ) )
{
mbVisible = IsXMLToken ( rValue , XML_ALWAYS ) | | IsXMLToken ( rValue , XML_SCREEN ) ;
mbPrintable = IsXMLToken ( rValue , XML_ALWAYS ) | | IsXMLToken ( rValue , XML_PRINTER ) ;
}
2000-12-13 18:16:42 +00:00
}
else if ( XML_NAMESPACE_PRESENTATION = = nPrefix )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_USER_TRANSFORMED ) )
2000-12-13 18:16:42 +00:00
{
2001-06-29 20:07:26 +00:00
mbIsUserTransformed = IsXMLToken ( rValue , XML_TRUE ) ;
2000-12-13 18:16:42 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_PLACEHOLDER ) )
2000-12-13 18:16:42 +00:00
{
2001-06-29 20:07:26 +00:00
mbIsPlaceholder = IsXMLToken ( rValue , XML_TRUE ) ;
2006-02-27 15:35:02 +00:00
if ( mbIsPlaceholder )
mbClearDefaultAttributes = false ;
2000-12-13 18:16:42 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_CLASS ) )
2000-12-13 18:16:42 +00:00
{
maPresentationClass = rValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_STYLE_NAME ) )
2000-12-13 18:16:42 +00:00
{
maDrawStyleName = rValue ;
mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID ;
}
}
else if ( XML_NAMESPACE_SVG = = nPrefix )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X ) )
2001-02-22 11:27:36 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maPosition . X , rValue ) ;
2001-02-22 11:27:36 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_Y ) )
2001-02-22 11:27:36 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maPosition . Y , rValue ) ;
2001-02-22 11:27:36 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_WIDTH ) )
2001-02-22 11:27:36 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maSize . Width , rValue ) ;
2004-11-17 09:35:17 +00:00
if ( maSize . Width > 0 )
maSize . Width + = 1 ;
else if ( maSize . Width < 0 )
maSize . Width - = 1 ;
2001-02-22 11:27:36 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_HEIGHT ) )
2001-02-22 11:27:36 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maSize . Height , rValue ) ;
2004-11-17 09:35:17 +00:00
if ( maSize . Height > 0 )
maSize . Height + = 1 ;
else if ( maSize . Height < 0 )
maSize . Height - = 1 ;
2001-02-22 11:27:36 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_TRANSFORM ) )
2001-04-04 15:55:50 +00:00
{
// because of #85127# take svg:transform into account and hanle like
// draw:transform for compatibility
mnTransform . SetString ( rValue , GetImport ( ) . GetMM100UnitConverter ( ) ) ;
}
2006-12-19 16:27:16 +00:00
// #i68101#
else if ( IsXMLToken ( rLocalName , XML_TITLE ) )
{
maShapeTitle = rValue ;
}
else if ( IsXMLToken ( rLocalName , XML_DESC ) )
{
maShapeDescription = rValue ;
}
2000-11-23 17:30:39 +00:00
}
2008-07-07 12:27:52 +00:00
else if ( ( XML_NAMESPACE_NONE = = nPrefix ) | | ( XML_NAMESPACE_XML = = nPrefix ) )
2007-06-27 14:33:18 +00:00
{
if ( IsXMLToken ( rLocalName , XML_ID ) )
{
maShapeId = rValue ;
2010-04-19 18:27:16 +02:00
bHaveXmlId = true ;
2007-06-27 14:33:18 +00:00
}
}
2000-11-23 17:30:39 +00:00
}
2001-12-14 13:06:48 +00:00
sal_Bool SdXMLShapeContext : : isPresentationShape ( ) const
{
2012-01-25 17:00:07 -02:00
if ( ! maPresentationClass . isEmpty ( ) & & ( const_cast < SdXMLShapeContext * > ( this ) ) - > GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) )
2005-09-23 09:39:21 +00:00
{
if ( XML_STYLE_FAMILY_SD_PRESENTATION_ID = = mnStyleFamily )
{
return sal_True ;
}
2001-12-14 13:06:48 +00:00
2005-09-23 09:39:21 +00:00
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 ;
}
2001-12-14 13:06:48 +00:00
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-09-18 16:07:07 +00:00
mnRadius ( 0L )
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLRectShapeContext : : ~ SdXMLRectShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2000-12-13 18:16:42 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CORNER_RADIUS ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnRadius , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
void SdXMLRectShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// create rectangle shape
2000-12-13 18:16:42 +00:00
AddShape ( " com.sun.star.drawing.RectangleShape " ) ;
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
// Add, set Style and properties from base shape
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-09-18 16:07:07 +00:00
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
if ( mnRadius )
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
2000-09-18 16:07:07 +00:00
{
2001-12-06 16:42:19 +00:00
try
{
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CornerRadius " ) , uno : : makeAny ( mnRadius ) ) ;
2001-12-06 16:42:19 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-12-06 16:42:19 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " exception during setting of corner radius! " ) ;
2001-12-06 16:42:19 +00:00
}
2000-09-18 16:07:07 +00:00
}
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
2000-09-18 16:07:07 +00:00
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2004-08-12 07:50:35 +00:00
////////////////////////////////////////3////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-09-18 16:07:07 +00:00
mnX1 ( 0L ) ,
mnY1 ( 0L ) ,
mnX2 ( 1L ) ,
mnY2 ( 1L )
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLLineShapeContext : : ~ SdXMLLineShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2000-12-13 18:16:42 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X1 ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnX1 , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_Y1 ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnY1 , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X2 ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnX2 , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_Y2 ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnY2 , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
void SdXMLLineShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
2001-04-24 10:36:10 +00:00
// #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 " ) ;
2000-12-13 18:16:42 +00:00
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
// Add, set Style and properties from base shape
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-09-18 16:07:07 +00:00
2001-04-24 10:36:10 +00:00
// 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 ;
}
2000-12-13 18:16:42 +00:00
// 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 ;
2000-09-18 16:07:07 +00:00
2001-04-24 10:36:10 +00:00
* pInnerSequence = awt : : Point ( mnX1 - aTopLeft . X , mnY1 - aTopLeft . Y ) ;
2000-12-13 18:16:42 +00:00
pInnerSequence + + ;
2001-04-24 10:36:10 +00:00
* pInnerSequence = awt : : Point ( mnX2 - aTopLeft . X , mnY2 - aTopLeft . Y ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
aAny < < = aPolyPoly ;
xPropSet - > setPropertyValue (
2012-06-02 08:58:21 -05:00
OUString ( " Geometry " ) , aAny ) ;
2000-09-18 16:07:07 +00:00
}
2000-11-15 10:58:54 +00:00
2001-04-24 10:36:10 +00:00
// 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 ( ) ;
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
2000-09-18 16:07:07 +00:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-09-18 16:07:07 +00:00
mnCX ( 0L ) ,
mnCY ( 0L ) ,
mnRX ( 1L ) ,
2000-12-20 15:17:17 +00:00
mnRY ( 1L ) ,
meKind ( drawing : : CircleKind_FULL ) ,
mnStartAngle ( 0 ) ,
mnEndAngle ( 0 )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLEllipseShapeContext : : ~ SdXMLEllipseShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2000-12-13 18:16:42 +00:00
// 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 )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
if ( XML_NAMESPACE_SVG = = nPrefix )
2000-09-18 16:07:07 +00:00
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_RX ) )
2000-09-18 16:07:07 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnRX , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_RY ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnRY , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CX ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnCX , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CY ) )
2000-12-13 18:16:42 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnCY , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_R ) )
2000-12-13 18:16:42 +00:00
{
// single radius, it's a circle and both radii are the same
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnRX , rValue ) ;
2000-12-13 18:16:42 +00:00
mnRY = mnRX ;
return ;
2000-09-18 16:07:07 +00:00
}
}
2000-12-20 15:17:17 +00:00
else if ( XML_NAMESPACE_DRAW = = nPrefix )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_KIND ) )
2000-12-20 15:17:17 +00:00
{
2010-11-10 13:50:33 +08:00
sal_uInt16 eKind ;
2000-12-20 15:17:17 +00:00
if ( SvXMLUnitConverter : : convertEnum ( eKind , rValue , aXML_CircleKind_EnumMap ) )
{
meKind = eKind ;
}
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_START_ANGLE ) )
2000-12-20 15:17:17 +00:00
{
double dStartAngle ;
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
if ( : : sax : : Converter : : convertDouble ( dStartAngle , rValue ) )
2000-12-20 15:17:17 +00:00
mnStartAngle = ( sal_Int32 ) ( dStartAngle * 100.0 ) ;
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_END_ANGLE ) )
2000-12-20 15:17:17 +00:00
{
double dEndAngle ;
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
if ( : : sax : : Converter : : convertDouble ( dEndAngle , rValue ) )
2000-12-20 15:17:17 +00:00
mnEndAngle = ( sal_Int32 ) ( dEndAngle * 100.0 ) ;
return ;
}
}
2000-11-15 10:58:54 +00:00
2000-12-13 18:16:42 +00:00
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 ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-12-13 18:16:42 +00:00
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-12-13 18:16:42 +00:00
2000-12-20 15:17:17 +00:00
if ( meKind ! = drawing : : CircleKind_FULL )
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
uno : : Any aAny ;
aAny < < = ( drawing : : CircleKind ) meKind ;
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CircleKind " ) , aAny ) ;
2000-12-20 15:17:17 +00:00
aAny < < = mnStartAngle ;
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CircleStartAngle " ) , aAny ) ;
2000-12-20 15:17:17 +00:00
aAny < < = mnEndAngle ;
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CircleEndAngle " ) , aAny ) ;
2000-12-20 15:17:17 +00:00
}
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
2000-09-18 16:07:07 +00:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes , sal_Bool bClosed , sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-09-18 16:07:07 +00:00
mbClosed ( bClosed )
{
2000-12-13 18:16:42 +00:00
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_VIEWBOX ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
maViewBox = rValue ;
return ;
2000-09-18 16:07:07 +00:00
}
}
2000-12-13 18:16:42 +00:00
else if ( XML_NAMESPACE_DRAW = = nPrefix )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_POINTS ) )
2000-12-13 18:16:42 +00:00
{
maPoints = rValue ;
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
2000-09-18 16:07:07 +00:00
}
//////////////////////////////////////////////////////////////////////////////
SdXMLPolygonShapeContext : : ~ SdXMLPolygonShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
void SdXMLPolygonShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
2000-12-13 18:16:42 +00:00
// Add, set Style and properties from base shape
2001-02-01 11:17:05 +00:00
if ( mbClosed )
AddShape ( " com.sun.star.drawing.PolyPolygonShape " ) ;
else
AddShape ( " com.sun.star.drawing.PolyLineShape " ) ;
2000-12-13 18:16:42 +00:00
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
// set local parameters on shape
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
// set polygon
2012-01-25 17:00:07 -02:00
if ( ! maPoints . isEmpty ( ) & & ! maViewBox . isEmpty ( ) )
2000-12-13 18:16:42 +00:00
{
SdXMLImExViewBox aViewBox ( maViewBox , GetImport ( ) . GetMM100UnitConverter ( ) ) ;
2001-02-09 12:38:53 +00:00
awt : : Size aSize ( aViewBox . GetWidth ( ) , aViewBox . GetHeight ( ) ) ;
2005-01-31 10:47:34 +00:00
if ( maSize . Width ! = 0 & & maSize . Height ! = 0 )
{
aSize = maSize ;
}
2001-02-09 12:38:53 +00:00
awt : : Point aPosition ( aViewBox . GetX ( ) , aViewBox . GetY ( ) ) ;
SdXMLImExPointsElement aPoints ( maPoints , aViewBox ,
aPosition , aSize , GetImport ( ) . GetMM100UnitConverter ( ) ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
uno : : Any aAny ;
aAny < < = aPoints . GetPointSequenceSequence ( ) ;
xPropSet - > setPropertyValue (
2012-06-02 08:58:21 -05:00
OUString ( " Geometry " ) , aAny ) ;
2000-09-18 16:07:07 +00:00
}
}
2000-11-15 10:58:54 +00:00
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate and get copy of matrix
SetTransformation ( ) ;
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
2000-09-18 16:07:07 +00:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
2012-08-15 16:18:53 +02:00
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLPathShapeContext : : ~ SdXMLPathShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2000-12-13 18:16:42 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_VIEWBOX ) )
2000-12-13 18:16:42 +00:00
{
maViewBox = rValue ;
return ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rLocalName , XML_D ) )
2000-12-13 18:16:42 +00:00
{
maD = rValue ;
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
void SdXMLPathShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// create polygon shape
2012-01-25 17:00:07 -02:00
if ( ! maD . isEmpty ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
// prepare some of the parameters
SdXMLImExViewBox aViewBox ( maViewBox , GetImport ( ) . GetMM100UnitConverter ( ) ) ;
2001-02-09 12:38:53 +00:00
awt : : Size aSize ( aViewBox . GetWidth ( ) , aViewBox . GetHeight ( ) ) ;
awt : : Point aPosition ( aViewBox . GetX ( ) , aViewBox . GetY ( ) ) ;
2005-01-31 10:47:34 +00:00
if ( maSize . Width ! = 0 & & maSize . Height ! = 0 )
{
aSize = maSize ;
}
2012-03-26 12:55:44 +02:00
SdXMLImExSvgDElement aPoints ( maD , aViewBox , aPosition , aSize , GetImport ( ) ) ;
2000-09-18 16:07:07 +00:00
2006-06-19 17:15:11 +00:00
const char * pService ;
2000-12-13 18:16:42 +00:00
// now create shape
if ( aPoints . IsCurve ( ) )
{
if ( aPoints . IsClosed ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
pService = " com.sun.star.drawing.ClosedBezierShape " ;
2000-09-18 16:07:07 +00:00
}
else
{
2000-12-13 18:16:42 +00:00
pService = " com.sun.star.drawing.OpenBezierShape " ;
2000-09-18 16:07:07 +00:00
}
2000-12-13 18:16:42 +00:00
}
else
{
if ( aPoints . IsClosed ( ) )
{
pService = " com.sun.star.drawing.PolyPolygonShape " ;
}
else
{
pService = " com.sun.star.drawing.PolyLineShape " ;
}
}
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
// Add, set Style and properties from base shape
AddShape ( pService ) ;
2001-07-12 15:58:15 +00:00
// #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 ( ) )
2000-12-13 18:16:42 +00:00
{
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-12-13 18:16:42 +00:00
// set local parameters on shape
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
uno : : Any aAny ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
// set svg:d
2012-01-25 17:00:07 -02:00
if ( ! maD . isEmpty ( ) )
2000-12-13 18:16:42 +00:00
{
if ( aPoints . IsCurve ( ) )
{
drawing : : PolyPolygonBezierCoords aSourcePolyPolygon (
aPoints . GetPointSequenceSequence ( ) ,
aPoints . GetFlagSequenceSequence ( ) ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
aAny < < = aSourcePolyPolygon ;
xPropSet - > setPropertyValue (
2012-06-02 08:58:21 -05:00
OUString ( " Geometry " ) , aAny ) ;
2000-12-13 18:16:42 +00:00
}
else
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
aAny < < = aPoints . GetPointSequenceSequence ( ) ;
xPropSet - > setPropertyValue (
2012-06-02 08:58:21 -05:00
OUString ( " Geometry " ) , aAny ) ;
2000-09-18 16:07:07 +00:00
}
}
}
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
2000-09-18 16:07:07 +00:00
}
2000-12-13 18:16:42 +00:00
}
2000-09-18 16:07:07 +00:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2001-11-26 14:18:49 +00:00
mnRadius ( 0 )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLTextBoxShapeContext : : ~ SdXMLTextBoxShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2001-11-15 16:14:01 +00:00
// 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 ) )
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnRadius , rValue ) ;
2001-11-15 16:14:01 +00:00
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
//////////////////////////////////////////////////////////////////////////////
2004-07-13 07:26:37 +00:00
void SdXMLTextBoxShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & )
2000-09-18 16:07:07 +00:00
{
// create textbox shape
2004-03-30 15:16:54 +00:00
sal_Bool bIsPresShape = sal_False ;
bool bClearText = false ;
2000-12-13 18:16:42 +00:00
2006-06-19 17:15:11 +00:00
const char * pService = NULL ;
2000-09-18 16:07:07 +00:00
2001-12-14 13:06:48 +00:00
if ( isPresentationShape ( ) )
2000-12-13 18:16:42 +00:00
{
2001-11-08 14:44:42 +00:00
// check if the current document supports presentation shapes
if ( GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) )
2000-12-13 18:16:42 +00:00
{
2001-11-08 14:44:42 +00:00
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 " ;
}
2004-03-30 15:16:54 +00:00
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 ;
}
2001-11-08 14:44:42 +00:00
else // IsXMLToken( maPresentationClass, XML_PRESENTATION_TITLE ) )
{
// XmlShapeTypePresTitleTextShape
pService = " com.sun.star.presentation.TitleTextShape " ;
}
2010-11-10 13:50:33 +08:00
bIsPresShape = sal_True ;
2000-12-13 18:16:42 +00:00
}
}
2001-11-08 14:44:42 +00:00
if ( NULL = = pService )
2000-12-13 18:16:42 +00:00
{
// normal text shape
pService = " com.sun.star.drawing.TextShape " ;
}
// Add, set Style and properties from base shape
AddShape ( pService ) ;
if ( mxShape . is ( ) )
{
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
if ( bIsPresShape )
{
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
uno : : Reference < beans : : XPropertySetInfo > xPropsInfo ( xProps - > getPropertySetInfo ( ) ) ;
if ( xPropsInfo . is ( ) )
2000-11-06 11:08:07 +00:00
{
2012-06-02 08:58:21 -05:00
if ( ! mbIsPlaceholder & & xPropsInfo - > hasPropertyByName ( OUString ( " IsEmptyPresentationObject " ) ) )
xProps - > setPropertyValue ( OUString ( " IsEmptyPresentationObject " ) , : : cppu : : bool2any ( sal_False ) ) ;
2000-12-06 15:53:44 +00:00
2012-06-02 08:58:21 -05:00
if ( mbIsUserTransformed & & xPropsInfo - > hasPropertyByName ( OUString ( " IsPlaceholderDependent " ) ) )
xProps - > setPropertyValue ( OUString ( " IsPlaceholderDependent " ) , : : cppu : : bool2any ( sal_False ) ) ;
2000-11-06 11:08:07 +00:00
}
}
2000-12-13 18:16:42 +00:00
}
2000-09-18 16:07:07 +00:00
2004-03-30 15:16:54 +00:00
if ( bClearText )
{
uno : : Reference < text : : XText > xText ( mxShape , uno : : UNO_QUERY ) ;
OUString aEmpty ;
xText - > setString ( aEmpty ) ;
}
2000-12-13 18:16:42 +00:00
// set parameters on shape
2001-02-09 12:38:53 +00:00
//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 ( ) ;
2000-09-18 16:07:07 +00:00
2001-11-15 16:14:01 +00:00
if ( mnRadius )
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
2001-12-05 13:52:31 +00:00
try
{
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CornerRadius " ) , uno : : makeAny ( mnRadius ) ) ;
2001-12-05 13:52:31 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-12-05 13:52:31 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " exception during setting of corner radius! " ) ;
2001-12-05 13:52:31 +00:00
}
2001-11-15 16:14:01 +00:00
}
}
2004-07-13 07:26:37 +00:00
SdXMLShapeContext : : StartElement ( mxAttrList ) ;
2000-09-18 16:07:07 +00:00
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLControlShapeContext : : ~ SdXMLControlShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2001-01-18 13:53:32 +00:00
// 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 )
{
2004-07-13 07:26:37 +00:00
if ( XML_NAMESPACE_DRAW = = nPrefix )
2001-01-18 13:53:32 +00:00
{
2004-07-13 07:26:37 +00:00
if ( IsXMLToken ( rLocalName , XML_CONTROL ) )
2001-01-18 13:53:32 +00:00
{
maFormId = rValue ;
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
2000-09-18 16:07:07 +00:00
void SdXMLControlShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// create Control shape
2000-12-13 18:16:42 +00:00
// add, set style and properties from base shape
AddShape ( " com.sun.star.drawing.ControlShape " ) ;
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2012-01-25 17:00:07 -02:00
DBG_ASSERT ( ! maFormId . isEmpty ( ) , " draw:control without a form:id attribute! " ) ;
if ( ! maFormId . isEmpty ( ) )
2001-01-18 13:53:32 +00:00
{
2001-04-26 17:05:46 +00:00
if ( GetImport ( ) . IsFormsSupported ( ) )
2001-01-18 13:53:32 +00:00
{
2001-04-26 17:05:46 +00:00
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 ) ;
2001-01-18 13:53:32 +00:00
2001-04-26 17:05:46 +00:00
}
2001-01-18 13:53:32 +00:00
}
}
2001-04-19 11:00:46 +00:00
SetStyle ( ) ;
SetLayer ( ) ;
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
2000-09-18 16:07:07 +00:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-11-26 18:48:02 +00:00
maStart ( 0 , 0 ) ,
maEnd ( 1 , 1 ) ,
2010-11-10 13:50:33 +08:00
mnType ( ( sal_uInt16 ) drawing : : ConnectorType_STANDARD ) ,
2000-11-26 18:48:02 +00:00
mnStartGlueId ( - 1 ) ,
mnEndGlueId ( - 1 ) ,
mnDelta1 ( 0 ) ,
mnDelta2 ( 0 ) ,
mnDelta3 ( 0 )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLConnectorShapeContext : : ~ SdXMLConnectorShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2000-11-26 18:48:02 +00:00
// 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 :
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_START_SHAPE ) )
2000-11-26 18:48:02 +00:00
{
2004-11-26 18:34:06 +00:00
maStartShapeId = rValue ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_START_GLUE_POINT ) )
2000-11-26 18:48:02 +00:00
{
mnStartGlueId = rValue . toInt32 ( ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_END_SHAPE ) )
2000-11-26 18:48:02 +00:00
{
2004-11-26 18:34:06 +00:00
maEndShapeId = rValue ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_END_GLUE_POINT ) )
2000-11-26 18:48:02 +00:00
{
mnEndGlueId = rValue . toInt32 ( ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_LINE_SKEW ) )
2000-11-26 18:48:02 +00:00
{
SvXMLTokenEnumerator aTokenEnum ( rValue ) ;
OUString aToken ;
if ( aTokenEnum . getNextToken ( aToken ) )
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnDelta1 , aToken ) ;
2000-11-26 18:48:02 +00:00
if ( aTokenEnum . getNextToken ( aToken ) )
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnDelta2 , aToken ) ;
2000-11-26 18:48:02 +00:00
if ( aTokenEnum . getNextToken ( aToken ) )
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnDelta3 , aToken ) ;
2000-11-26 18:48:02 +00:00
}
}
}
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_TYPE ) )
2000-11-26 18:48:02 +00:00
{
SvXMLUnitConverter : : convertEnum ( mnType , rValue , aXML_ConnectionKind_EnumMap ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
}
case XML_NAMESPACE_SVG :
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X1 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maStart . X , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_Y1 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maStart . Y , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X2 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maEnd . X , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_Y2 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maEnd . Y , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2008-07-01 21:56:59 +00:00
if ( IsXMLToken ( rLocalName , XML_D ) )
{
SdXMLImExViewBox aViewBox ( 0 , 0 , 1 , 1 ) ;
awt : : Point aPoint ( 0 , 0 ) ;
awt : : Size aSize ( 1 , 1 ) ;
2012-03-26 12:55:44 +02:00
SdXMLImExSvgDElement aPoints ( rValue , aViewBox , aPoint , aSize , GetImport ( ) ) ;
2008-07-01 21:56:59 +00:00
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 ;
}
}
2000-11-26 18:48:02 +00:00
}
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
2000-11-26 18:48:02 +00:00
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
void SdXMLConnectorShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
2003-03-27 17:21:03 +00:00
// #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 ) ;
2012-01-25 17:00:07 -02:00
if ( maStartShapeId . isEmpty ( )
& & maEndShapeId . isEmpty ( )
2003-03-27 17:21:03 +00:00
& & maStart . X = = maEnd . X
& & maStart . Y = = maEnd . Y
& & 0 = = mnDelta1
& & 0 = = mnDelta2
& & 0 = = mnDelta3
)
2000-09-18 16:07:07 +00:00
{
2003-03-27 17:21:03 +00:00
bDoAdd = sal_False ;
}
2000-12-13 18:16:42 +00:00
2003-03-27 17:21:03 +00:00
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
2012-01-25 17:00:07 -02:00
if ( ! maStartShapeId . isEmpty ( ) )
2004-11-26 18:34:06 +00:00
GetImport ( ) . GetShapeImport ( ) - > addShapeConnection ( mxShape , sal_True , maStartShapeId , mnStartGlueId ) ;
2012-01-25 17:00:07 -02:00
if ( ! maEndShapeId . isEmpty ( ) )
2004-11-26 18:34:06 +00:00
GetImport ( ) . GetShapeImport ( ) - > addShapeConnection ( mxShape , sal_False , maEndShapeId , mnEndGlueId ) ;
2003-03-27 17:21:03 +00:00
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
{
uno : : Any aAny ;
aAny < < = maStart ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " StartPosition " ) , aAny ) ;
2000-11-26 18:48:02 +00:00
2003-03-27 17:21:03 +00:00
aAny < < = maEnd ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " EndPosition " ) , aAny ) ;
2000-11-26 18:48:02 +00:00
2003-03-27 17:21:03 +00:00
aAny < < = ( drawing : : ConnectorType ) mnType ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " EdgeKind " ) , aAny ) ;
2000-11-26 18:48:02 +00:00
2003-03-27 17:21:03 +00:00
aAny < < = mnDelta1 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " EdgeLine1Delta " ) , aAny ) ;
2000-11-26 18:48:02 +00:00
2003-03-27 17:21:03 +00:00
aAny < < = mnDelta2 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " EdgeLine2Delta " ) , aAny ) ;
2000-11-26 18:48:02 +00:00
2003-03-27 17:21:03 +00:00
aAny < < = mnDelta3 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " EdgeLine3Delta " ) , aAny ) ;
2003-03-27 17:21:03 +00:00
}
SetStyle ( ) ;
SetLayer ( ) ;
2000-11-15 10:58:54 +00:00
2008-07-01 21:56:59 +00:00
if ( maPath . hasValue ( ) )
2010-11-10 14:08:20 +01:00
{
2011-04-16 22:41:35 -03:00
// #i115492#
2010-11-10 14:08:20 +01:00
// 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 )
{
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " PolyPolygonBezier " ) , maPath ) ;
2010-11-10 14:08:20 +01:00
}
}
2008-07-01 21:56:59 +00:00
2003-03-27 17:21:03 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
2000-12-13 18:16:42 +00:00
}
2000-09-18 16:07:07 +00:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-11-26 18:48:02 +00:00
maStart ( 0 , 0 ) ,
maEnd ( 1 , 1 )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLMeasureShapeContext : : ~ SdXMLMeasureShapeContext ( )
{
}
2000-11-26 18:48:02 +00:00
// 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 :
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X1 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maStart . X , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_Y1 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maStart . Y , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_X2 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maEnd . X , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_Y2 ) )
2000-11-26 18:48:02 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maEnd . Y , rValue ) ;
2000-12-13 18:16:42 +00:00
return ;
2000-11-26 18:48:02 +00:00
}
}
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
2000-11-26 18:48:02 +00:00
}
2000-09-18 16:07:07 +00:00
//////////////////////////////////////////////////////////////////////////////
void SdXMLMeasureShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// create Measure shape
2000-12-13 18:16:42 +00:00
// add, set style and properties from base shape
AddShape ( " com.sun.star.drawing.MeasureShape " ) ;
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2006-12-19 16:27:16 +00:00
2000-12-13 18:16:42 +00:00
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
uno : : Any aAny ;
aAny < < = maStart ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " StartPosition " ) , aAny ) ;
2000-11-26 18:48:02 +00:00
2000-12-13 18:16:42 +00:00
aAny < < = maEnd ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " EndPosition " ) , aAny ) ;
2000-09-18 16:07:07 +00:00
}
2001-02-01 18:12:31 +00:00
// delete pre created fields
uno : : Reference < text : : XText > xText ( mxShape , uno : : UNO_QUERY ) ;
if ( xText . is ( ) )
{
2012-06-02 08:58:21 -05:00
const OUString aEmpty ( " " ) ;
2001-02-01 18:12:31 +00:00
xText - > setString ( aEmpty ) ;
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
2000-09-18 16:07:07 +00:00
}
}
2001-02-01 18:12:31 +00:00
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 ) ;
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2001-02-01 18:12:31 +00:00
}
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) , mnPageNumber ( 0 )
2000-09-18 16:07:07 +00:00
{
2006-02-27 15:35:02 +00:00
mbClearDefaultAttributes = false ;
2000-09-18 16:07:07 +00:00
}
//////////////////////////////////////////////////////////////////////////////
SdXMLPageShapeContext : : ~ SdXMLPageShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
2001-06-11 12:46:30 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_PAGE_NUMBER ) )
2001-06-11 12:46:30 +00:00
{
mnPageNumber = rValue . toInt32 ( ) ;
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
void SdXMLPageShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// create Page shape
2000-12-13 18:16:42 +00:00
// add, set style and properties from base shape
2001-05-02 10:45:25 +00:00
// #86163# take into account which type of PageShape needs to
2001-06-29 20:07:26 +00:00
// be constructed. It's an pres shape if presentation:XML_CLASS == XML_PRESENTATION_PAGE.
2012-01-25 17:00:07 -02:00
sal_Bool bIsPresentation = ! maPresentationClass . isEmpty ( ) & &
2002-10-17 13:40:18 +00:00
GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) ;
2001-05-02 10:45:25 +00:00
2001-05-28 12:32:20 +00:00
uno : : Reference < lang : : XServiceInfo > xInfo ( mxShapes , uno : : UNO_QUERY ) ;
2012-06-02 08:58:21 -05:00
const sal_Bool bIsOnHandoutPage = xInfo . is ( ) & & xInfo - > supportsService ( OUString ( " com.sun.star.presentation.HandoutMasterPage " ) ) ;
2001-05-02 10:45:25 +00:00
2001-05-28 12:32:20 +00:00
if ( bIsOnHandoutPage )
2001-05-02 10:45:25 +00:00
{
2001-05-28 12:32:20 +00:00
AddShape ( " com.sun.star.presentation.HandoutShape " ) ;
2001-05-02 10:45:25 +00:00
}
else
{
2001-11-08 14:44:42 +00:00
if ( bIsPresentation & & ! IsXMLToken ( maPresentationClass , XML_PRESENTATION_PAGE ) )
2001-05-28 12:32:20 +00:00
{
2010-11-10 13:50:33 +08:00
bIsPresentation = sal_False ;
2001-05-28 12:32:20 +00:00
}
if ( bIsPresentation )
{
AddShape ( " com.sun.star.presentation.PageShape " ) ;
}
else
{
AddShape ( " com.sun.star.drawing.PageShape " ) ;
}
2001-05-02 10:45:25 +00:00
}
2000-12-13 18:16:42 +00:00
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-12-06 15:53:44 +00:00
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-09-18 16:07:07 +00:00
2001-06-11 12:46:30 +00:00
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
uno : : Reference < beans : : XPropertySetInfo > xPropSetInfo ( xPropSet - > getPropertySetInfo ( ) ) ;
2012-06-02 08:58:21 -05:00
const OUString aPageNumberStr ( " PageNumber " ) ;
2001-06-11 12:46:30 +00:00
if ( xPropSetInfo . is ( ) & & xPropSetInfo - > hasPropertyByName ( aPageNumberStr ) )
xPropSet - > setPropertyValue ( aPageNumberStr , uno : : makeAny ( mnPageNumber ) ) ;
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
2000-09-18 16:07:07 +00:00
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2001-05-16 09:31:58 +00:00
// #86616# for correct edge rounding import mnRadius needs to be initialized
mnRadius ( 0L )
2000-09-18 16:07:07 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
SdXMLCaptionShapeContext : : ~ SdXMLCaptionShapeContext ( )
{
}
//////////////////////////////////////////////////////////////////////////////
void SdXMLCaptionShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// create Caption shape
2000-12-13 18:16:42 +00:00
// add, set style and properties from base shape
AddShape ( " com.sun.star.drawing.CaptionShape " ) ;
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-11-15 10:58:54 +00:00
2006-05-05 09:05:04 +00:00
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 ( ) )
{
2012-06-02 08:58:21 -05:00
uno : : Any aAny ( xProps - > getPropertyValue ( OUString ( " TextAutoGrowWidth " ) ) ) ;
2006-05-05 09:05:04 +00:00
aAny > > = bIsAutoGrowWidth ;
if ( bIsAutoGrowWidth )
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " TextAutoGrowWidth " ) , uno : : makeAny ( sal_False ) ) ;
2006-05-05 09:05:04 +00:00
}
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2001-05-07 13:35:39 +00:00
if ( xProps . is ( ) )
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " CaptionPoint " ) , uno : : makeAny ( maCaptionPoint ) ) ;
2001-05-07 13:35:39 +00:00
2006-05-05 09:05:04 +00:00
if ( bIsAutoGrowWidth )
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " TextAutoGrowWidth " ) , uno : : makeAny ( sal_True ) ) ;
2006-05-05 09:05:04 +00:00
2001-05-07 13:35:39 +00:00
if ( mnRadius )
{
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
{
2001-12-06 16:42:19 +00:00
try
{
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CornerRadius " ) , uno : : makeAny ( mnRadius ) ) ;
2001-12-06 16:42:19 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2001-12-06 16:42:19 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " exception during setting of corner radius! " ) ;
2001-12-06 16:42:19 +00:00
}
2001-05-07 13:35:39 +00:00
}
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
2000-09-18 16:07:07 +00:00
}
2001-05-07 13:35:39 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CAPTION_POINT_X ) )
2001-05-07 13:35:39 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maCaptionPoint . X , rValue ) ;
2001-05-07 13:35:39 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CAPTION_POINT_Y ) )
2001-05-07 13:35:39 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
maCaptionPoint . Y , rValue ) ;
2001-05-07 13:35:39 +00:00
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CORNER_RADIUS ) )
2001-05-07 13:35:39 +00:00
{
2011-10-11 14:19:09 +02:00
GetImport ( ) . GetMM100UnitConverter ( ) . convertMeasureToCore (
mnRadius , rValue ) ;
2001-05-07 13:35:39 +00:00
return ;
}
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-12-13 18:16:42 +00:00
maURL ( )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
}
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
// 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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_HREF ) )
2000-09-18 16:07:07 +00:00
{
2001-07-02 12:24:00 +00:00
maURL = rValue ;
2000-12-13 18:16:42 +00:00
return ;
2000-09-18 16:07:07 +00:00
}
}
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
//////////////////////////////////////////////////////////////////////////////
2004-07-13 07:26:37 +00:00
void SdXMLGraphicObjectShapeContext : : StartElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : xml : : sax : : XAttributeList > & )
2000-12-13 18:16:42 +00:00
{
2000-09-18 16:07:07 +00:00
// create graphic object shape
2006-06-19 17:15:11 +00:00
const char * pService ;
2001-04-30 08:02:17 +00:00
2001-11-08 14:44:42 +00:00
if ( IsXMLToken ( maPresentationClass , XML_GRAPHIC ) & & GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) )
2001-04-30 08:02:17 +00:00
{
pService = " com.sun.star.presentation.GraphicObjectShape " ;
}
else
{
pService = " com.sun.star.drawing.GraphicObjectShape " ;
}
AddShape ( pService ) ;
2000-12-13 18:16:42 +00:00
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2006-12-19 16:27:16 +00:00
2006-06-19 17:15:11 +00:00
uno : : Reference < beans : : XPropertySet > xPropset ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropset . is ( ) )
2000-09-18 16:07:07 +00:00
{
2006-04-26 19:43:42 +00:00
// 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
{
2012-06-02 08:58:21 -05:00
xPropset - > setPropertyValue ( OUString ( " FillStyle " ) , Any ( FillStyle_NONE ) ) ;
xPropset - > setPropertyValue ( OUString ( " LineStyle " ) , Any ( LineStyle_NONE ) ) ;
2006-04-26 19:43:42 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const Exception & )
2006-04-26 19:43:42 +00:00
{
}
2006-06-19 17:15:11 +00:00
uno : : Reference < beans : : XPropertySetInfo > xPropsInfo ( xPropset - > getPropertySetInfo ( ) ) ;
2012-06-02 08:58:21 -05:00
if ( xPropsInfo . is ( ) & & xPropsInfo - > hasPropertyByName ( OUString ( " IsEmptyPresentationObject " ) ) )
xPropset - > setPropertyValue ( OUString ( " IsEmptyPresentationObject " ) , : : cppu : : bool2any ( mbIsPlaceholder ) ) ;
2000-09-18 16:07:07 +00:00
2001-04-30 08:02:17 +00:00
if ( ! mbIsPlaceholder )
{
2012-01-25 17:00:07 -02:00
if ( ! maURL . isEmpty ( ) )
2000-12-13 18:16:42 +00:00
{
uno : : Any aAny ;
2008-02-26 12:37:09 +00:00
aAny < < = GetImport ( ) . ResolveGraphicObjectURL ( maURL , GetImport ( ) . isGraphicLoadOnDemandSupported ( ) ) ;
2000-12-13 18:16:42 +00:00
try
{
2012-06-02 08:58:21 -05:00
xPropset - > setPropertyValue ( OUString ( " GraphicURL " ) , aAny ) ;
xPropset - > setPropertyValue ( OUString ( " GraphicStreamURL " ) , aAny ) ;
2000-12-13 18:16:42 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const lang : : IllegalArgumentException & )
2000-09-18 16:07:07 +00:00
{
}
}
}
}
2000-12-06 15:53:44 +00:00
if ( mbIsUserTransformed )
{
2000-12-13 18:16:42 +00:00
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
2000-12-06 15:53:44 +00:00
if ( xProps . is ( ) )
{
uno : : Reference < beans : : XPropertySetInfo > xPropsInfo ( xProps - > getPropertySetInfo ( ) ) ;
if ( xPropsInfo . is ( ) )
{
2012-06-02 08:58:21 -05:00
if ( xPropsInfo - > hasPropertyByName ( OUString ( " IsPlaceholderDependent " ) ) )
xProps - > setPropertyValue ( OUString ( " IsPlaceholderDependent " ) , : : cppu : : bool2any ( sal_False ) ) ;
2000-12-06 15:53:44 +00:00
}
}
}
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-09-18 16:07:07 +00:00
2004-07-13 07:26:37 +00:00
SdXMLShapeContext : : StartElement ( mxAttrList ) ;
2000-09-18 16:07:07 +00:00
}
}
2001-08-09 13:09:49 +00:00
void SdXMLGraphicObjectShapeContext : : EndElement ( )
{
if ( mxBase64Stream . is ( ) )
{
OUString sURL ( GetImport ( ) . ResolveGraphicObjectURLFromBase64 ( mxBase64Stream ) ) ;
2012-01-25 17:00:07 -02:00
if ( ! sURL . isEmpty ( ) )
2001-08-09 13:09:49 +00:00
{
try
{
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
{
const uno : : Any aAny ( uno : : makeAny ( sURL ) ) ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " GraphicURL " ) , aAny ) ;
xProps - > setPropertyValue ( OUString ( " GraphicStreamURL " ) , aAny ) ;
2001-08-09 13:09:49 +00:00
}
}
2011-06-16 00:26:29 +01:00
catch ( const lang : : IllegalArgumentException & )
2001-08-09 13:09:49 +00:00
{
}
}
}
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2001-08-09 13:09:49 +00:00
}
2000-09-18 16:07:07 +00:00
//////////////////////////////////////////////////////////////////////////////
2001-03-29 15:48:43 +00:00
SvXMLImportContext * SdXMLGraphicObjectShapeContext : : CreateChildContext (
2010-11-10 13:50:33 +08:00
sal_uInt16 nPrefix , const : : rtl : : OUString & rLocalName ,
2001-03-29 15:48:43 +00:00
const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
SvXMLImportContext * pContext = NULL ;
2006-04-28 13:58:07 +00:00
if ( ( XML_NAMESPACE_OFFICE = = nPrefix ) & &
2001-08-09 13:09:49 +00:00
xmloff : : token : : IsXMLToken ( rLocalName , xmloff : : token : : XML_BINARY_DATA ) )
{
2012-01-25 17:00:07 -02:00
if ( maURL . isEmpty ( ) & & ! mxBase64Stream . is ( ) )
2001-08-09 13:09:49 +00:00
{
mxBase64Stream = GetImport ( ) . GetStreamForGraphicObjectURLFromBase64 ( ) ;
if ( mxBase64Stream . is ( ) )
pContext = new XMLBase64ImportContext ( GetImport ( ) , nPrefix ,
rLocalName , xAttrList ,
mxBase64Stream ) ;
}
}
2001-03-29 15:48:43 +00:00
// delegate to parent class if no context could be created
if ( NULL = = pContext )
pContext = SdXMLShapeContext : : CreateChildContext ( nPrefix , rLocalName ,
xAttrList ) ;
return pContext ;
}
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2000-09-18 16:07:07 +00:00
mpChartContext ( NULL )
{
2000-12-13 18:16:42 +00:00
}
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
//////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
SdXMLChartShapeContext : : ~ SdXMLChartShapeContext ( )
{
if ( mpChartContext )
delete mpChartContext ;
}
//////////////////////////////////////////////////////////////////////////////
void SdXMLChartShapeContext : : StartElement ( const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
2001-12-14 13:06:48 +00:00
const sal_Bool bIsPresentation = isPresentationShape ( ) ;
2001-11-08 14:44:42 +00:00
2000-12-13 18:16:42 +00:00
AddShape ( bIsPresentation ? " com.sun.star.presentation.ChartShape " : " com.sun.star.drawing.OLE2Shape " ) ;
if ( mxShape . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
SetStyle ( ) ;
2001-01-19 15:25:18 +00:00
SetLayer ( ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
if ( ! mbIsPlaceholder )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
2000-09-18 16:07:07 +00:00
{
2000-12-13 18:16:42 +00:00
uno : : Reference < beans : : XPropertySetInfo > xPropsInfo ( xProps - > getPropertySetInfo ( ) ) ;
2012-06-02 08:58:21 -05:00
if ( xPropsInfo . is ( ) & & xPropsInfo - > hasPropertyByName ( OUString ( " IsEmptyPresentationObject " ) ) )
xProps - > setPropertyValue ( OUString ( " IsEmptyPresentationObject " ) , : : cppu : : bool2any ( sal_False ) ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
uno : : Any aAny ;
2000-09-18 16:07:07 +00:00
2012-06-02 08:58:21 -05:00
const OUString aCLSID ( " 12DCAE26-281F-416F-a234-c3086127382e " ) ;
2001-02-27 11:53:38 +00:00
2000-12-13 18:16:42 +00:00
aAny < < = aCLSID ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " CLSID " ) , aAny ) ;
2000-09-18 16:07:07 +00:00
2012-06-02 08:58:21 -05:00
aAny = xProps - > getPropertyValue ( OUString ( " Model " ) ) ;
2000-12-13 18:16:42 +00:00
uno : : Reference < frame : : XModel > xChartModel ;
if ( aAny > > = xChartModel )
{
2001-06-29 20:07:26 +00:00
mpChartContext = GetImport ( ) . GetChartImport ( ) - > CreateChartContext ( GetImport ( ) , XML_NAMESPACE_SVG , GetXMLToken ( XML_CHART ) , xChartModel , xAttrList ) ;
2000-09-18 16:07:07 +00:00
}
}
}
2000-12-06 15:53:44 +00:00
if ( mbIsUserTransformed )
{
2000-12-13 18:16:42 +00:00
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
2000-12-06 15:53:44 +00:00
if ( xProps . is ( ) )
{
uno : : Reference < beans : : XPropertySetInfo > xPropsInfo ( xProps - > getPropertySetInfo ( ) ) ;
if ( xPropsInfo . is ( ) )
{
2012-06-02 08:58:21 -05:00
if ( xPropsInfo - > hasPropertyByName ( OUString ( " IsPlaceholderDependent " ) ) )
xProps - > setPropertyValue ( OUString ( " IsPlaceholderDependent " ) , : : cppu : : bool2any ( sal_False ) ) ;
2000-12-06 15:53:44 +00:00
}
}
}
2000-09-18 16:07:07 +00:00
2001-02-09 12:38:53 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
2000-09-18 16:07:07 +00:00
2000-12-13 18:16:42 +00:00
SdXMLShapeContext : : StartElement ( xAttrList ) ;
2000-11-15 10:58:54 +00:00
2000-12-13 18:16:42 +00:00
if ( mpChartContext )
mpChartContext - > StartElement ( xAttrList ) ;
}
2000-09-18 16:07:07 +00:00
}
void SdXMLChartShapeContext : : EndElement ( )
{
if ( mpChartContext )
mpChartContext - > EndElement ( ) ;
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2000-09-18 16:07:07 +00:00
}
void SdXMLChartShapeContext : : Characters ( const : : rtl : : OUString & rChars )
{
if ( mpChartContext )
2000-10-26 08:59:25 +00:00
mpChartContext - > Characters ( rChars ) ;
2000-09-18 16:07:07 +00:00
}
2010-11-10 13:50:33 +08:00
SvXMLImportContext * SdXMLChartShapeContext : : CreateChildContext ( sal_uInt16 nPrefix , const : : rtl : : OUString & rLocalName ,
2000-10-26 08:59:25 +00:00
const com : : sun : : star : : uno : : Reference < com : : sun : : star : : xml : : sax : : XAttributeList > & xAttrList )
{
if ( mpChartContext )
return mpChartContext - > CreateChildContext ( nPrefix , rLocalName , xAttrList ) ;
return NULL ;
}
2000-09-18 16:07:07 +00:00
2001-02-21 17:04:45 +00:00
//////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
com : : sun : : star : : uno : : Reference < com : : sun : : star : : drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape )
2001-02-21 17:04:45 +00:00
{
}
SdXMLObjectShapeContext : : ~ SdXMLObjectShapeContext ( )
{
}
2004-07-13 07:26:37 +00:00
void SdXMLObjectShapeContext : : StartElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : xml : : sax : : XAttributeList > & )
2001-02-21 17:04:45 +00:00
{
2002-01-18 15:36:12 +00:00
// #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
2003-04-24 13:51:47 +00:00
//if( !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
2002-06-27 10:09:52 +00:00
// return;
// #100592# this BugFix prevents that a shape is created. CL
// is thinking about an alternative.
2003-04-24 13:51:47 +00:00
// #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 ) )
2002-01-18 15:36:12 +00:00
return ;
2006-06-19 17:15:11 +00:00
const char * pService = " com.sun.star.drawing.OLE2Shape " ;
2001-02-21 17:04:45 +00:00
2012-01-25 17:00:07 -02:00
sal_Bool bIsPresShape = ! maPresentationClass . isEmpty ( ) & & GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) ;
2001-11-08 14:44:42 +00:00
2001-02-21 17:04:45 +00:00
if ( bIsPresShape )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( maPresentationClass , XML_PRESENTATION_CHART ) )
2001-02-21 17:04:45 +00:00
{
pService = " com.sun.star.presentation.ChartShape " ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( maPresentationClass , XML_PRESENTATION_TABLE ) )
2001-02-21 17:04:45 +00:00
{
2010-02-23 00:23:09 +01:00
pService = " com.sun.star.presentation.CalcShape " ;
2001-02-21 17:04:45 +00:00
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( maPresentationClass , XML_PRESENTATION_OBJECT ) )
2001-02-21 17:04:45 +00:00
{
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 ( ) )
{
2012-06-02 08:58:21 -05:00
if ( ! mbIsPlaceholder & & xPropsInfo - > hasPropertyByName ( OUString ( " IsEmptyPresentationObject " ) ) )
xProps - > setPropertyValue ( OUString ( " IsEmptyPresentationObject " ) , : : cppu : : bool2any ( sal_False ) ) ;
2001-02-21 17:04:45 +00:00
2012-06-02 08:58:21 -05:00
if ( mbIsUserTransformed & & xPropsInfo - > hasPropertyByName ( OUString ( " IsPlaceholderDependent " ) ) )
xProps - > setPropertyValue ( OUString ( " IsPlaceholderDependent " ) , : : cppu : : bool2any ( sal_False ) ) ;
2001-02-21 17:04:45 +00:00
}
}
}
2012-01-25 17:00:07 -02:00
if ( ! mbIsPlaceholder & & ! maHref . isEmpty ( ) )
2001-02-21 17:04:45 +00:00
{
2001-09-13 10:41:52 +00:00
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
2001-02-21 17:04:45 +00:00
{
2004-10-04 17:11:28 +00:00
OUString aPersistName = GetImport ( ) . ResolveEmbeddedObjectURL ( maHref , maCLSID ) ;
2001-09-13 10:41:52 +00:00
2005-03-15 10:19:24 +00:00
if ( GetImport ( ) . IsPackageURL ( maHref ) )
2004-10-04 17:11:28 +00:00
{
2012-06-02 08:58:21 -05:00
const OUString sURL ( " vnd.sun.star.EmbeddedObject: " ) ;
2004-10-04 17:11:28 +00:00
2005-03-15 10:19:24 +00:00
if ( aPersistName . compareTo ( sURL , sURL . getLength ( ) ) = = 0 )
aPersistName = aPersistName . copy ( sURL . getLength ( ) ) ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " PersistName " ) ,
2005-03-15 10:19:24 +00:00
uno : : makeAny ( aPersistName ) ) ;
2004-10-04 17:11:28 +00:00
}
else
{
// this is OOo link object
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " LinkURL " ) ,
2005-03-15 10:19:24 +00:00
uno : : makeAny ( aPersistName ) ) ;
2004-10-04 17:11:28 +00:00
}
2001-02-21 17:04:45 +00:00
}
}
// set pos, size, shear and rotate
SetTransformation ( ) ;
2001-05-03 08:32:14 +00:00
SetStyle ( ) ;
2001-03-06 10:23:45 +00:00
GetImport ( ) . GetShapeImport ( ) - > finishShape ( mxShape , mxAttrList , mxShapes ) ;
2001-02-21 17:04:45 +00:00
}
}
2001-06-14 15:50:57 +00:00
void SdXMLObjectShapeContext : : EndElement ( )
{
2002-06-27 10:09:52 +00:00
// #100592#
if ( mxBase64Stream . is ( ) )
{
2005-01-27 10:09:32 +00:00
OUString aPersistName ( GetImport ( ) . ResolveEmbeddedObjectURLFromBase64 ( ) ) ;
2012-06-02 08:58:21 -05:00
const OUString sURL ( " vnd.sun.star.EmbeddedObject: " ) ;
2002-06-27 10:09:52 +00:00
aPersistName = aPersistName . copy ( sURL . getLength ( ) ) ;
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " PersistName " ) , uno : : makeAny ( aPersistName ) ) ;
2002-06-27 10:09:52 +00:00
}
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2001-06-14 15:50:57 +00:00
}
2001-02-21 17:04:45 +00:00
// 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 :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CLASS_ID ) )
2001-02-21 17:04:45 +00:00
{
maCLSID = rValue ;
return ;
}
break ;
case XML_NAMESPACE_XLINK :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_HREF ) )
2001-02-21 17:04:45 +00:00
{
2001-07-02 12:24:00 +00:00
maHref = rValue ;
2001-02-21 17:04:45 +00:00
return ;
}
break ;
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
2001-04-30 08:02:17 +00:00
2002-06-27 10:09:52 +00:00
SvXMLImportContext * SdXMLObjectShapeContext : : CreateChildContext (
2010-11-10 13:50:33 +08:00
sal_uInt16 nPrefix , const : : rtl : : OUString & rLocalName ,
2002-06-27 10:09:52 +00:00
const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
// #100592#
SvXMLImportContext * pContext = NULL ;
2003-12-01 09:14:16 +00:00
if ( ( XML_NAMESPACE_OFFICE = = nPrefix ) & & IsXMLToken ( rLocalName , XML_BINARY_DATA ) )
2002-06-27 10:09:52 +00:00
{
2005-01-27 10:09:32 +00:00
mxBase64Stream = GetImport ( ) . GetStreamForEmbeddedObjectURLFromBase64 ( ) ;
2003-12-01 09:14:16 +00:00
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 ( ) ;
2012-01-25 17:00:07 -02:00
if ( ! maCLSID . isEmpty ( ) )
2002-06-27 10:09:52 +00:00
{
2003-12-01 09:14:16 +00:00
uno : : Reference < beans : : XPropertySet > xPropSet ( mxShape , uno : : UNO_QUERY ) ;
if ( xPropSet . is ( ) )
2002-06-27 10:09:52 +00:00
{
2012-06-02 08:58:21 -05:00
xPropSet - > setPropertyValue ( OUString ( " CLSID " ) , uno : : makeAny ( maCLSID ) ) ;
2002-06-27 10:09:52 +00:00
2003-12-01 09:14:16 +00:00
uno : : Reference < lang : : XComponent > xComp ;
2012-06-02 08:58:21 -05:00
xPropSet - > getPropertyValue ( OUString ( " Model " ) ) > > = xComp ;
2003-12-01 09:14:16 +00:00
DBG_ASSERT ( xComp . is ( ) , " no xModel for own OLE format " ) ;
pEContext - > SetComponent ( xComp ) ;
2002-06-27 10:09:52 +00:00
}
}
2003-12-01 09:14:16 +00:00
pContext = pEContext ;
2002-06-27 10:09:52 +00:00
}
// delegate to parent class if no context could be created
if ( ! pContext )
pContext = SdXMLShapeContext : : CreateChildContext ( nPrefix , rLocalName , xAttrList ) ;
return pContext ;
}
2001-04-30 08:02:17 +00:00
//////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
com : : sun : : star : : uno : : Reference < com : : sun : : star : : drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2001-04-30 08:02:17 +00:00
mbIsScript ( sal_False )
{
}
SdXMLAppletShapeContext : : ~ SdXMLAppletShapeContext ( )
{
}
2004-07-13 07:26:37 +00:00
void SdXMLAppletShapeContext : : StartElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : xml : : sax : : XAttributeList > & )
2001-04-30 08:02:17 +00:00
{
2006-06-19 17:15:11 +00:00
const char * pService = " com.sun.star.drawing.AppletShape " ;
2001-04-30 08:02:17 +00:00
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 :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_APPLET_NAME ) )
2001-04-30 08:02:17 +00:00
{
maAppletName = rValue ;
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_CODE ) )
2001-04-30 08:02:17 +00:00
{
maAppletCode = rValue ;
return ;
}
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_MAY_SCRIPT ) )
2001-04-30 08:02:17 +00:00
{
2001-06-29 20:07:26 +00:00
mbIsScript = IsXMLToken ( rValue , XML_TRUE ) ;
2001-04-30 08:02:17 +00:00
return ;
}
break ;
case XML_NAMESPACE_XLINK :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_HREF ) )
2001-04-30 08:02:17 +00:00
{
2001-06-27 13:56:38 +00:00
maHref = GetImport ( ) . GetAbsoluteReference ( rValue ) ;
2001-04-30 08:02:17 +00:00
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 ;
2005-02-25 08:23:23 +00:00
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 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " VisibleArea " ) , aAny ) ;
2005-02-25 08:23:23 +00:00
}
2001-04-30 08:02:17 +00:00
if ( maParams . getLength ( ) )
{
aAny < < = maParams ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " AppletCommands " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
2012-01-25 17:00:07 -02:00
if ( ! maHref . isEmpty ( ) )
2001-04-30 08:02:17 +00:00
{
aAny < < = maHref ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " AppletCodeBase " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
2012-01-25 17:00:07 -02:00
if ( ! maAppletName . isEmpty ( ) )
2001-04-30 08:02:17 +00:00
{
aAny < < = maAppletName ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " AppletName " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
if ( mbIsScript )
{
aAny < < = mbIsScript ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " AppletIsScript " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
2012-01-25 17:00:07 -02:00
if ( ! maAppletCode . isEmpty ( ) )
2001-04-30 08:02:17 +00:00
{
aAny < < = maAppletCode ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " AppletCode " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
2001-06-14 15:50:57 +00:00
2005-02-21 15:36:04 +00:00
aAny < < = : : rtl : : OUString ( GetImport ( ) . GetDocumentBase ( ) ) ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " AppletDocBase " ) , aAny ) ;
2005-02-21 15:36:04 +00:00
2001-06-14 15:50:57 +00:00
SetThumbnail ( ) ;
2001-04-30 08:02:17 +00:00
}
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2001-04-30 08:02:17 +00:00
}
2010-11-10 13:50:33 +08:00
SvXMLImportContext * SdXMLAppletShapeContext : : CreateChildContext ( sal_uInt16 p_nPrefix , const : : rtl : : OUString & rLocalName , const com : : sun : : star : : uno : : Reference < com : : sun : : star : : xml : : sax : : XAttributeList > & xAttrList )
2001-04-30 08:02:17 +00:00
{
2006-06-19 17:15:11 +00:00
if ( p_nPrefix = = XML_NAMESPACE_DRAW & & IsXMLToken ( rLocalName , XML_PARAM ) )
2001-04-30 08:02:17 +00:00
{
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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( aLocalName , XML_NAME ) )
2001-04-30 08:02:17 +00:00
{
aParamName = aValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( aLocalName , XML_VALUE ) )
2001-04-30 08:02:17 +00:00
{
aParamValue = aValue ;
}
}
2001-11-15 10:18:46 +00:00
}
2001-04-30 08:02:17 +00:00
2012-01-25 17:00:07 -02:00
if ( ! aParamName . isEmpty ( ) )
2001-11-15 10:18:46 +00:00
{
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 ;
2001-04-30 08:02:17 +00:00
}
2006-06-19 17:15:11 +00:00
return new SvXMLImportContext ( GetImport ( ) , p_nPrefix , rLocalName ) ;
2001-04-30 08:02:17 +00:00
}
2006-06-19 17:15:11 +00:00
return SdXMLShapeContext : : CreateChildContext ( p_nPrefix , rLocalName , xAttrList ) ;
2001-04-30 08:02:17 +00:00
}
//////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
com : : sun : : star : : uno : : Reference < com : : sun : : star : : drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape ) :
SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
2004-08-12 07:50:35 +00:00
mbMedia ( false )
2001-04-30 08:02:17 +00:00
{
}
SdXMLPluginShapeContext : : ~ SdXMLPluginShapeContext ( )
{
}
2004-08-12 07:50:35 +00:00
void SdXMLPluginShapeContext : : StartElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : xml : : sax : : XAttributeList > & xAttrList )
2001-04-30 08:02:17 +00:00
{
2004-08-12 07:50:35 +00:00
// 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 ;
}
}
2006-06-19 17:15:11 +00:00
const char * pService ;
2004-08-12 07:50:35 +00:00
2010-02-23 00:23:09 +01:00
sal_Bool bIsPresShape = sal_False ;
2004-08-12 07:50:35 +00:00
if ( mbMedia )
2010-02-23 00:23:09 +01:00
{
2004-08-12 07:50:35 +00:00
pService = " com.sun.star.drawing.MediaShape " ;
2010-02-23 00:23:09 +01:00
2012-01-25 17:00:07 -02:00
bIsPresShape = ! maPresentationClass . isEmpty ( ) & & GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) ;
2010-02-23 00:23:09 +01:00
if ( bIsPresShape )
{
if ( IsXMLToken ( maPresentationClass , XML_PRESENTATION_OBJECT ) )
{
pService = " com.sun.star.presentation.MediaShape " ;
}
}
}
2004-08-12 07:50:35 +00:00
else
pService = " com.sun.star.drawing.PluginShape " ;
2001-04-30 08:02:17 +00:00
AddShape ( pService ) ;
if ( mxShape . is ( ) )
{
SetLayer ( ) ;
2010-02-23 00:23:09 +01:00
if ( bIsPresShape )
{
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
if ( xProps . is ( ) )
{
uno : : Reference < beans : : XPropertySetInfo > xPropsInfo ( xProps - > getPropertySetInfo ( ) ) ;
if ( xPropsInfo . is ( ) )
{
2012-06-02 08:58:21 -05:00
if ( ! mbIsPlaceholder & & xPropsInfo - > hasPropertyByName ( OUString ( " IsEmptyPresentationObject " ) ) )
xProps - > setPropertyValue ( OUString ( " IsEmptyPresentationObject " ) , : : cppu : : bool2any ( sal_False ) ) ;
2010-02-23 00:23:09 +01:00
2012-06-02 08:58:21 -05:00
if ( mbIsUserTransformed & & xPropsInfo - > hasPropertyByName ( OUString ( " IsPlaceholderDependent " ) ) )
xProps - > setPropertyValue ( OUString ( " IsPlaceholderDependent " ) , : : cppu : : bool2any ( sal_False ) ) ;
2010-02-23 00:23:09 +01:00
}
}
}
2001-04-30 08:02:17 +00:00
// set pos, size, shear and rotate
SetTransformation ( ) ;
GetImport ( ) . GetShapeImport ( ) - > finishShape ( mxShape , mxAttrList , mxShapes ) ;
}
}
2011-12-03 00:00:08 +01:00
static : : rtl : : OUString
lcl_GetMediaReference ( SvXMLImport const & rImport , : : rtl : : OUString const & rURL )
{
if ( rImport . IsPackageURL ( rURL ) )
{
2012-06-02 08:58:21 -05:00
return : : rtl : : OUString ( " vnd.sun.star.Package: " ) + rURL ;
2011-12-03 00:00:08 +01:00
}
else
{
return rImport . GetAbsoluteReference ( rURL ) ;
}
}
2001-04-30 08:02:17 +00:00
// 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 :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_MIME_TYPE ) )
2001-04-30 08:02:17 +00:00
{
maMimeType = rValue ;
return ;
}
break ;
case XML_NAMESPACE_XLINK :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_HREF ) )
2001-04-30 08:02:17 +00:00
{
2011-12-03 00:00:08 +01:00
maHref = lcl_GetMediaReference ( GetImport ( ) , rValue ) ;
2001-04-30 08:02:17 +00:00
return ;
}
break ;
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
void SdXMLPluginShapeContext : : EndElement ( )
{
uno : : Reference < beans : : XPropertySet > xProps ( mxShape , uno : : UNO_QUERY ) ;
2004-08-12 07:50:35 +00:00
2001-04-30 08:02:17 +00:00
if ( xProps . is ( ) )
{
uno : : Any aAny ;
2005-02-25 08:23:23 +00:00
if ( maSize . Width & & maSize . Height )
{
2012-06-02 08:58:21 -05:00
const rtl : : OUString sVisibleArea ( " VisibleArea " ) ;
2005-04-18 10:12:44 +00:00
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 ) ;
}
2005-02-25 08:23:23 +00:00
}
2004-08-12 07:50:35 +00:00
if ( ! mbMedia )
2001-04-30 08:02:17 +00:00
{
2004-08-12 07:50:35 +00:00
// in case we have a plugin object
if ( maParams . getLength ( ) )
{
aAny < < = maParams ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " PluginCommands " ) , aAny ) ;
2004-08-12 07:50:35 +00:00
}
2001-04-30 08:02:17 +00:00
2012-01-25 17:00:07 -02:00
if ( ! maMimeType . isEmpty ( ) )
2004-08-12 07:50:35 +00:00
{
aAny < < = maMimeType ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " PluginMimeType " ) , aAny ) ;
2004-08-12 07:50:35 +00:00
}
2001-04-30 08:02:17 +00:00
2012-01-25 17:00:07 -02:00
if ( ! maHref . isEmpty ( ) )
2004-08-12 07:50:35 +00:00
{
aAny < < = maHref ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " PluginURL " ) , aAny ) ;
2004-08-12 07:50:35 +00:00
}
}
else
2001-04-30 08:02:17 +00:00
{
2004-08-12 07:50:35 +00:00
// in case we have a media object
2011-12-03 00:00:08 +01:00
xProps - > setPropertyValue (
2012-06-02 08:58:21 -05:00
OUString ( " MediaURL " ) ,
2011-12-03 00:00:08 +01:00
uno : : makeAny ( maHref ) ) ;
2004-08-12 07:50:35 +00:00
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 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " Loop " ) ,
2004-08-12 07:50:35 +00:00
uno : : makeAny ( static_cast < sal_Bool > ( 0 = = aValueStr . compareToAscii ( " true " ) ) ) ) ;
}
else if ( 0 = = rName . compareToAscii ( " Mute " ) )
{
OUString aValueStr ;
maParams [ nParam ] . Value > > = aValueStr ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " Mute " ) ,
2004-08-12 07:50:35 +00:00
uno : : makeAny ( static_cast < sal_Bool > ( 0 = = aValueStr . compareToAscii ( " true " ) ) ) ) ;
}
else if ( 0 = = rName . compareToAscii ( " VolumeDB " ) )
{
OUString aValueStr ;
maParams [ nParam ] . Value > > = aValueStr ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " VolumeDB " ) ,
2004-08-12 07:50:35 +00:00
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 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " Zoom " ) , uno : : makeAny ( eZoomLevel ) ) ;
2004-08-12 07:50:35 +00:00
}
}
2001-04-30 08:02:17 +00:00
}
2001-06-14 15:50:57 +00:00
SetThumbnail ( ) ;
2001-04-30 08:02:17 +00:00
}
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2001-04-30 08:02:17 +00:00
}
2010-11-10 13:50:33 +08:00
SvXMLImportContext * SdXMLPluginShapeContext : : CreateChildContext ( sal_uInt16 p_nPrefix , const : : rtl : : OUString & rLocalName , const com : : sun : : star : : uno : : Reference < com : : sun : : star : : xml : : sax : : XAttributeList > & xAttrList )
2001-04-30 08:02:17 +00:00
{
2006-06-19 17:15:11 +00:00
if ( p_nPrefix = = XML_NAMESPACE_DRAW & & IsXMLToken ( rLocalName , XML_PARAM ) )
2001-04-30 08:02:17 +00:00
{
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 )
{
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( aLocalName , XML_NAME ) )
2001-04-30 08:02:17 +00:00
{
aParamName = aValue ;
}
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( aLocalName , XML_VALUE ) )
2001-04-30 08:02:17 +00:00
{
aParamValue = aValue ;
}
}
2012-01-25 17:00:07 -02:00
if ( ! aParamName . isEmpty ( ) )
2001-04-30 08:02:17 +00:00
{
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 ;
}
}
2006-06-19 17:15:11 +00:00
return new SvXMLImportContext ( GetImport ( ) , p_nPrefix , rLocalName ) ;
2001-04-30 08:02:17 +00:00
}
2006-06-19 17:15:11 +00:00
return SdXMLShapeContext : : CreateChildContext ( p_nPrefix , rLocalName , xAttrList ) ;
2001-04-30 08:02:17 +00:00
}
//////////////////////////////////////////////////////////////////////////////
2004-07-13 07:26:37 +00:00
TYPEINIT1 ( SdXMLFloatingFrameShapeContext , SdXMLShapeContext ) ;
2001-04-30 08:02:17 +00:00
2004-07-13 07:26:37 +00:00
SdXMLFloatingFrameShapeContext : : SdXMLFloatingFrameShapeContext ( SvXMLImport & rImport , sal_uInt16 nPrfx ,
2001-04-30 08:02:17 +00:00
const rtl : : OUString & rLocalName ,
const com : : sun : : star : : uno : : Reference < com : : sun : : star : : xml : : sax : : XAttributeList > & xAttrList ,
2004-10-22 06:55:13 +00:00
com : : sun : : star : : uno : : Reference < com : : sun : : star : : drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape )
2001-04-30 08:02:17 +00:00
{
}
2004-07-13 07:26:37 +00:00
SdXMLFloatingFrameShapeContext : : ~ SdXMLFloatingFrameShapeContext ( )
2001-04-30 08:02:17 +00:00
{
}
2004-07-13 07:26:37 +00:00
void SdXMLFloatingFrameShapeContext : : StartElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : xml : : sax : : XAttributeList > & )
2001-04-30 08:02:17 +00:00
{
2006-06-19 17:15:11 +00:00
const char * pService = " com.sun.star.drawing.FrameShape " ;
2001-04-30 08:02:17 +00:00
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 ;
2012-01-25 17:00:07 -02:00
if ( ! maFrameName . isEmpty ( ) )
2001-04-30 08:02:17 +00:00
{
aAny < < = maFrameName ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " FrameName " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
2012-01-25 17:00:07 -02:00
if ( ! maHref . isEmpty ( ) )
2001-04-30 08:02:17 +00:00
{
aAny < < = maHref ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " FrameURL " ) , aAny ) ;
2001-04-30 08:02:17 +00:00
}
}
SetStyle ( ) ;
2001-06-14 15:50:57 +00:00
2001-04-30 08:02:17 +00:00
GetImport ( ) . GetShapeImport ( ) - > finishShape ( mxShape , mxAttrList , mxShapes ) ;
}
}
// this is called from the parent group for each unparsed attribute in the attribute list
2004-07-13 07:26:37 +00:00
void SdXMLFloatingFrameShapeContext : : processAttribute ( sal_uInt16 nPrefix , const : : rtl : : OUString & rLocalName , const : : rtl : : OUString & rValue )
2001-04-30 08:02:17 +00:00
{
switch ( nPrefix )
{
case XML_NAMESPACE_DRAW :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_FRAME_NAME ) )
2001-04-30 08:02:17 +00:00
{
maFrameName = rValue ;
return ;
}
break ;
case XML_NAMESPACE_XLINK :
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rLocalName , XML_HREF ) )
2001-04-30 08:02:17 +00:00
{
2001-06-27 13:56:38 +00:00
maHref = GetImport ( ) . GetAbsoluteReference ( rValue ) ;
2001-04-30 08:02:17 +00:00
return ;
}
break ;
}
SdXMLShapeContext : : processAttribute ( nPrefix , rLocalName , rValue ) ;
}
2004-07-13 07:26:37 +00:00
void SdXMLFloatingFrameShapeContext : : EndElement ( )
2001-06-14 15:50:57 +00:00
{
2005-02-25 08:23:23 +00:00
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 ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " VisibleArea " ) , aAny ) ;
2005-02-25 08:23:23 +00:00
}
}
2001-06-14 15:50:57 +00:00
SetThumbnail ( ) ;
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2001-06-14 15:50:57 +00:00
}
2004-04-02 12:53:51 +00:00
2004-07-13 07:26:37 +00:00
//////////////////////////////////////////////////////////////////////////////
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 ,
2004-10-22 06:55:13 +00:00
com : : sun : : star : : uno : : Reference < com : : sun : : star : : drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
2004-11-26 12:00:41 +00:00
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape ) ,
mbSupportsReplacement ( sal_False )
2004-07-13 07:26:37 +00:00
{
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 ( )
{
}
2010-11-10 13:50:33 +08:00
SvXMLImportContext * SdXMLFrameShapeContext : : CreateChildContext ( sal_uInt16 nPrefix ,
2004-07-13 07:26:37 +00:00
const OUString & rLocalName ,
const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
{
SvXMLImportContext * pContext = 0 ;
if ( ! mxImplContext . Is ( ) )
{
2010-10-06 10:16:27 +01:00
SvXMLShapeContext * pShapeContext = GetImport ( ) . GetShapeImport ( ) - > CreateFrameChildContext (
2004-07-13 07:26:37 +00:00
GetImport ( ) , nPrefix , rLocalName , xAttrList , mxShapes , mxAttrList ) ;
2004-08-20 07:14:27 +00:00
2010-10-06 10:16:27 +01:00
pContext = pShapeContext ;
// propagate the hyperlink to child context
2012-01-25 17:00:07 -02:00
if ( ! msHyperlink . isEmpty ( ) )
2010-10-06 10:16:27 +01:00
pShapeContext - > setHyperlink ( msHyperlink ) ;
2004-08-20 07:14:27 +00:00
mxImplContext = pContext ;
2004-11-26 12:00:41 +00:00
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 ;
}
}
2004-07-13 07:26:37 +00:00
}
2006-12-19 16:27:16 +00:00
else if (
( nPrefix = = XML_NAMESPACE_SVG & & // #i68101#
( IsXMLToken ( rLocalName , XML_TITLE ) | | IsXMLToken ( rLocalName , XML_DESC ) ) ) | |
( nPrefix = = XML_NAMESPACE_OFFICE & & IsXMLToken ( rLocalName , XML_EVENT_LISTENERS ) ) | |
2004-07-13 07:26:37 +00:00
( 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 ) ;
}
2006-04-28 13:58:07 +00:00
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 ) ;
}
}
}
2004-07-13 07:26:37 +00:00
// 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 ( )
{
2007-04-16 12:12:28 +00:00
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 ) ;
}
}
}
2012-01-25 17:00:07 -02:00
if ( ( ! maPresentationClass . isEmpty ( ) ) & & mbIsPlaceholder )
2007-04-16 12:12:28 +00:00
{
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 ( ) ;
}
}
}
2004-07-13 07:26:37 +00:00
mxImplContext = 0 ;
SdXMLShapeContext : : EndElement ( ) ;
}
2006-06-19 17:15:11 +00:00
void SdXMLFrameShapeContext : : processAttribute ( sal_uInt16 ,
const : : rtl : : OUString & , const : : rtl : : OUString & )
2004-07-13 07:26:37 +00:00
{
// ignore
}
2004-04-02 12:53:51 +00:00
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 ,
2004-10-22 06:55:13 +00:00
uno : : Reference < drawing : : XShapes > & rShapes ,
sal_Bool bTemporaryShape )
: SdXMLShapeContext ( rImport , nPrfx , rLocalName , xAttrList , rShapes , bTemporaryShape )
2004-04-02 12:53:51 +00:00
{
}
//////////////////////////////////////////////////////////////////////////////
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 ( ) )
{
2012-01-25 17:00:07 -02:00
if ( ! maCustomShapeEngine . isEmpty ( ) )
2004-04-02 12:53:51 +00:00
{
uno : : Any aAny ;
aAny < < = maCustomShapeEngine ;
xPropSet - > setPropertyValue ( EASGet ( EAS_CustomShapeEngine ) , aAny ) ;
}
2012-01-25 17:00:07 -02:00
if ( ! maCustomShapeData . isEmpty ( ) )
2004-04-02 12:53:51 +00:00
{
uno : : Any aAny ;
aAny < < = maCustomShapeData ;
xPropSet - > setPropertyValue ( EASGet ( EAS_CustomShapeData ) , aAny ) ;
}
}
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2004-04-02 12:53:51 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " could not set enhanced customshape geometry " ) ;
2004-04-02 12:53:51 +00:00
}
SdXMLShapeContext : : StartElement ( xAttrList ) ;
}
}
void SdXMLCustomShapeContext : : EndElement ( )
{
2009-04-23 10:42:05 +00:00
if ( ! maCustomShapeGeometry . empty ( ) )
2004-04-02 12:53:51 +00:00
{
2012-06-02 08:58:21 -05:00
const rtl : : OUString sCustomShapeGeometry ( " CustomShapeGeometry " ) ;
2004-04-02 12:53:51 +00:00
// 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 ) ;
}
}
2011-06-16 00:26:29 +01:00
catch ( const uno : : Exception & )
2004-04-02 12:53:51 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " could not set enhanced customshape geometry " ) ;
2004-04-02 12:53:51 +00:00
}
2007-11-01 14:21:56 +00:00
sal_Int32 nUPD ( 0 ) ;
sal_Int32 nBuild ( 0 ) ;
GetImport ( ) . getBuildIds ( nUPD , nBuild ) ;
2008-07-01 12:24:31 +00:00
if ( ( ( nUPD > = 640 & & nUPD < = 645 ) | | ( nUPD = = 680 ) ) & & ( nBuild < = 9221 ) )
2007-11-01 14:21:56 +00:00
{
Reference < drawing : : XEnhancedCustomShapeDefaulter > xDefaulter ( mxShape , UNO_QUERY ) ;
if ( xDefaulter . is ( ) )
{
rtl : : OUString aEmptyType ;
xDefaulter - > createCustomShapeDefaults ( aEmptyType ) ;
}
}
2004-04-02 12:53:51 +00:00
}
2004-06-28 12:53:12 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2004-04-02 12:53:51 +00:00
}
//////////////////////////////////////////////////////////////////////////////
SvXMLImportContext * SdXMLCustomShapeContext : : CreateChildContext (
2010-11-10 13:50:33 +08:00
sal_uInt16 nPrefix , const : : rtl : : OUString & rLocalName ,
2004-04-02 12:53:51 +00:00
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 ( ) )
2005-04-12 15:53:18 +00:00
pContext = new XMLEnhancedCustomShapeContext ( GetImport ( ) , mxShape , nPrefix , rLocalName , maCustomShapeGeometry ) ;
2004-04-02 12:53:51 +00:00
}
}
// delegate to parent class if no context could be created
if ( NULL = = pContext )
pContext = SdXMLShapeContext : : CreateChildContext ( nPrefix , rLocalName ,
xAttrList ) ;
return pContext ;
}
2008-03-12 09:38:48 +00:00
///////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
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 " ;
2012-01-25 17:00:07 -02:00
sal_Bool bIsPresShape = ! maPresentationClass . isEmpty ( ) & & GetImport ( ) . GetShapeImport ( ) - > IsPresentationShapesSupported ( ) ;
2008-03-12 09:38:48 +00:00
if ( bIsPresShape )
{
if ( IsXMLToken ( maPresentationClass , XML_PRESENTATION_TABLE ) )
{
pService = " com.sun.star.presentation.TableShape " ;
}
}
2010-02-23 00:23:09 +01:00
2008-03-12 09:38:48 +00:00
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 ( ) )
{
2012-06-02 08:58:21 -05:00
if ( ! mbIsPlaceholder & & xPropsInfo - > hasPropertyByName ( OUString ( " IsEmptyPresentationObject " ) ) )
xProps - > setPropertyValue ( OUString ( " IsEmptyPresentationObject " ) , : : cppu : : bool2any ( sal_False ) ) ;
2008-03-12 09:38:48 +00:00
2012-06-02 08:58:21 -05:00
if ( mbIsUserTransformed & & xPropsInfo - > hasPropertyByName ( OUString ( " IsPlaceholderDependent " ) ) )
xProps - > setPropertyValue ( OUString ( " IsPlaceholderDependent " ) , : : cppu : : bool2any ( sal_False ) ) ;
2008-03-12 09:38:48 +00:00
}
}
}
SetStyle ( ) ;
if ( xProps . is ( ) )
{
2012-01-25 17:00:07 -02:00
if ( ! msTemplateStyleName . isEmpty ( ) ) try
2008-03-12 09:38:48 +00:00
{
Reference < XStyleFamiliesSupplier > xFamiliesSupp ( GetImport ( ) . GetModel ( ) , UNO_QUERY_THROW ) ;
Reference < XNameAccess > xFamilies ( xFamiliesSupp - > getStyleFamilies ( ) ) ;
2012-06-02 08:58:21 -05:00
const OUString sFamilyName ( " table " ) ;
2008-03-12 09:38:48 +00:00
Reference < XNameAccess > xTableFamily ( xFamilies - > getByName ( sFamilyName ) , UNO_QUERY_THROW ) ;
Reference < XStyle > xTableStyle ( xTableFamily - > getByName ( msTemplateStyleName ) , UNO_QUERY_THROW ) ;
2012-06-02 08:58:21 -05:00
xProps - > setPropertyValue ( OUString ( " TableTemplate " ) , Any ( xTableStyle ) ) ;
2008-03-12 09:38:48 +00:00
}
2011-06-16 00:26:29 +01:00
catch ( const Exception & )
2008-03-12 09:38:48 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " SdXMLTableShapeContext::StartElement(), exception caught! " ) ;
2008-03-12 09:38:48 +00:00
}
const XMLPropertyMapEntry * pEntry = & aXMLTableShapeAttributes [ 0 ] ;
CWS-TOOLING: integrate CWS impress172
2009-07-30 15:29:39 +0200 cl r274492 : #i102921# remove reference to inssrc.obj which was moved to svx
2009-07-29 11:40:35 +0200 wg r274445 : i103869
2009-07-22 14:39:13 +0200 sj r274241 : #i102713# fixed cloud shape
2009-07-07 15:28:04 +0200 sj r273800 : fixed build problem
2009-07-07 13:27:13 +0200 cl r273792 : #i102921# moved insert col/rows dialog to svx
2009-07-07 10:36:05 +0200 cl r273782 : fixed compiler warnings
2009-07-02 10:40:21 +0200 sj r273626 : fixed build problem
2009-07-02 10:27:56 +0200 cl r273624 : fixed merge problem
2009-07-02 10:27:19 +0200 cl r273623 : fixed compiler warning
2009-07-01 10:04:58 +0200 cl r273550 : CWS-TOOLING: rebase CWS impress172 to trunk@273468 (milestone: DEV300:m51)
2009-06-30 16:22:02 +0200 cl r273518 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:46 +0200 cl r273517 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:28 +0200 cl r273516 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:49 +0200 cl r273515 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:28 +0200 cl r273514 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:17:38 +0200 cl r273513 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:45:44 +0200 cl r273511 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:37:16 +0200 cl r273510 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:33:47 +0200 cl r273509 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:32:10 +0200 cl r273508 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:30:05 +0200 cl r273507 : #i102921# added insert table row/col dialog for impress tables
2009-06-29 12:32:42 +0200 sj r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names
2009-06-24 15:17:59 +0200 sj r273349 : #158636# fixed text range hyperlink to first/last slide
2009-06-22 13:18:30 +0200 sj r273224 : #158651# fixed header footer import
2009-06-19 15:18:24 +0200 sj r273160 : #158614# default text of presentation objects now cleared
2009-06-16 15:54:19 +0200 sj r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack
2009-06-15 16:26:26 +0200 sj r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-15 16:25:26 +0200 sj r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-12 13:17:32 +0200 sj r272915 : #i102713# fixed cloud shape
2009-06-10 18:36:58 +0200 sj r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-08 19:52:28 +0200 sj r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-04 15:28:32 +0200 cl r272640 : #i102358# applied patch to remove warnings
2009-06-04 14:39:45 +0200 cl r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents
2009-06-03 18:21:26 +0200 sj r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects
2009-06-03 15:47:27 +0200 cl r272583 : #i101817# added color collection based on scribus
2009-06-03 14:43:59 +0200 cl r272580 : #i102163# use weak ref to SdrObject instead of listening to the model
2009-06-03 12:39:29 +0200 cl r272556 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 12:27:00 +0200 cl r272555 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 11:33:44 +0200 cl r272553 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:59 +0200 cl r272552 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:22 +0200 cl r272551 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-02 18:41:07 +0200 sj r272527 : #i28358# applied patch (better conversion of dotted lines)
2009-06-02 11:52:13 +0200 cl r272491 : #i98668# applied patch to fix possible endless loop if exception occours
2009-05-28 17:02:55 +0200 sj r272416 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:25 +0200 sj r272415 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:10 +0200 sj r272414 : #i102336# retaining graphic file names unchanged
2009-05-25 12:43:58 +0200 sj r272232 : #i102069# added patch from thb (fixed rotated group objects)
2009-08-05 17:01:07 +00:00
for ( int i = 0 ; pEntry - > msApiName & & ( i < 6 ) ; i + + , pEntry + + )
2008-03-12 09:38:48 +00:00
{
CWS-TOOLING: integrate CWS impress172
2009-07-30 15:29:39 +0200 cl r274492 : #i102921# remove reference to inssrc.obj which was moved to svx
2009-07-29 11:40:35 +0200 wg r274445 : i103869
2009-07-22 14:39:13 +0200 sj r274241 : #i102713# fixed cloud shape
2009-07-07 15:28:04 +0200 sj r273800 : fixed build problem
2009-07-07 13:27:13 +0200 cl r273792 : #i102921# moved insert col/rows dialog to svx
2009-07-07 10:36:05 +0200 cl r273782 : fixed compiler warnings
2009-07-02 10:40:21 +0200 sj r273626 : fixed build problem
2009-07-02 10:27:56 +0200 cl r273624 : fixed merge problem
2009-07-02 10:27:19 +0200 cl r273623 : fixed compiler warning
2009-07-01 10:04:58 +0200 cl r273550 : CWS-TOOLING: rebase CWS impress172 to trunk@273468 (milestone: DEV300:m51)
2009-06-30 16:22:02 +0200 cl r273518 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:46 +0200 cl r273517 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:28 +0200 cl r273516 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:49 +0200 cl r273515 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:28 +0200 cl r273514 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:17:38 +0200 cl r273513 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:45:44 +0200 cl r273511 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:37:16 +0200 cl r273510 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:33:47 +0200 cl r273509 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:32:10 +0200 cl r273508 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:30:05 +0200 cl r273507 : #i102921# added insert table row/col dialog for impress tables
2009-06-29 12:32:42 +0200 sj r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names
2009-06-24 15:17:59 +0200 sj r273349 : #158636# fixed text range hyperlink to first/last slide
2009-06-22 13:18:30 +0200 sj r273224 : #158651# fixed header footer import
2009-06-19 15:18:24 +0200 sj r273160 : #158614# default text of presentation objects now cleared
2009-06-16 15:54:19 +0200 sj r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack
2009-06-15 16:26:26 +0200 sj r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-15 16:25:26 +0200 sj r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-12 13:17:32 +0200 sj r272915 : #i102713# fixed cloud shape
2009-06-10 18:36:58 +0200 sj r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-08 19:52:28 +0200 sj r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-04 15:28:32 +0200 cl r272640 : #i102358# applied patch to remove warnings
2009-06-04 14:39:45 +0200 cl r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents
2009-06-03 18:21:26 +0200 sj r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects
2009-06-03 15:47:27 +0200 cl r272583 : #i101817# added color collection based on scribus
2009-06-03 14:43:59 +0200 cl r272580 : #i102163# use weak ref to SdrObject instead of listening to the model
2009-06-03 12:39:29 +0200 cl r272556 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 12:27:00 +0200 cl r272555 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 11:33:44 +0200 cl r272553 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:59 +0200 cl r272552 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:22 +0200 cl r272551 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-02 18:41:07 +0200 sj r272527 : #i28358# applied patch (better conversion of dotted lines)
2009-06-02 11:52:13 +0200 cl r272491 : #i98668# applied patch to fix possible endless loop if exception occours
2009-05-28 17:02:55 +0200 sj r272416 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:25 +0200 sj r272415 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:10 +0200 sj r272414 : #i102336# retaining graphic file names unchanged
2009-05-25 12:43:58 +0200 sj r272232 : #i102069# added patch from thb (fixed rotated group objects)
2009-08-05 17:01:07 +00:00
try
{
const OUString sAPIPropertyName ( OUString ( pEntry - > msApiName , pEntry - > nApiNameLength , RTL_TEXTENCODING_ASCII_US ) ) ;
xProps - > setPropertyValue ( sAPIPropertyName , Any ( maTemplateStylesUsed [ i ] ) ) ;
}
2011-06-16 00:26:29 +01:00
catch ( const Exception & )
CWS-TOOLING: integrate CWS impress172
2009-07-30 15:29:39 +0200 cl r274492 : #i102921# remove reference to inssrc.obj which was moved to svx
2009-07-29 11:40:35 +0200 wg r274445 : i103869
2009-07-22 14:39:13 +0200 sj r274241 : #i102713# fixed cloud shape
2009-07-07 15:28:04 +0200 sj r273800 : fixed build problem
2009-07-07 13:27:13 +0200 cl r273792 : #i102921# moved insert col/rows dialog to svx
2009-07-07 10:36:05 +0200 cl r273782 : fixed compiler warnings
2009-07-02 10:40:21 +0200 sj r273626 : fixed build problem
2009-07-02 10:27:56 +0200 cl r273624 : fixed merge problem
2009-07-02 10:27:19 +0200 cl r273623 : fixed compiler warning
2009-07-01 10:04:58 +0200 cl r273550 : CWS-TOOLING: rebase CWS impress172 to trunk@273468 (milestone: DEV300:m51)
2009-06-30 16:22:02 +0200 cl r273518 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:46 +0200 cl r273517 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:28 +0200 cl r273516 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:49 +0200 cl r273515 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:28 +0200 cl r273514 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:17:38 +0200 cl r273513 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:45:44 +0200 cl r273511 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:37:16 +0200 cl r273510 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:33:47 +0200 cl r273509 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:32:10 +0200 cl r273508 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:30:05 +0200 cl r273507 : #i102921# added insert table row/col dialog for impress tables
2009-06-29 12:32:42 +0200 sj r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names
2009-06-24 15:17:59 +0200 sj r273349 : #158636# fixed text range hyperlink to first/last slide
2009-06-22 13:18:30 +0200 sj r273224 : #158651# fixed header footer import
2009-06-19 15:18:24 +0200 sj r273160 : #158614# default text of presentation objects now cleared
2009-06-16 15:54:19 +0200 sj r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack
2009-06-15 16:26:26 +0200 sj r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-15 16:25:26 +0200 sj r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-12 13:17:32 +0200 sj r272915 : #i102713# fixed cloud shape
2009-06-10 18:36:58 +0200 sj r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-08 19:52:28 +0200 sj r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-04 15:28:32 +0200 cl r272640 : #i102358# applied patch to remove warnings
2009-06-04 14:39:45 +0200 cl r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents
2009-06-03 18:21:26 +0200 sj r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects
2009-06-03 15:47:27 +0200 cl r272583 : #i101817# added color collection based on scribus
2009-06-03 14:43:59 +0200 cl r272580 : #i102163# use weak ref to SdrObject instead of listening to the model
2009-06-03 12:39:29 +0200 cl r272556 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 12:27:00 +0200 cl r272555 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 11:33:44 +0200 cl r272553 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:59 +0200 cl r272552 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:22 +0200 cl r272551 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-02 18:41:07 +0200 sj r272527 : #i28358# applied patch (better conversion of dotted lines)
2009-06-02 11:52:13 +0200 cl r272491 : #i98668# applied patch to fix possible endless loop if exception occours
2009-05-28 17:02:55 +0200 sj r272416 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:25 +0200 sj r272415 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:10 +0200 sj r272414 : #i102336# retaining graphic file names unchanged
2009-05-25 12:43:58 +0200 sj r272232 : #i102069# added patch from thb (fixed rotated group objects)
2009-08-05 17:01:07 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL ( " SdXMLTableShapeContext::StartElement(), exception caught! " ) ;
CWS-TOOLING: integrate CWS impress172
2009-07-30 15:29:39 +0200 cl r274492 : #i102921# remove reference to inssrc.obj which was moved to svx
2009-07-29 11:40:35 +0200 wg r274445 : i103869
2009-07-22 14:39:13 +0200 sj r274241 : #i102713# fixed cloud shape
2009-07-07 15:28:04 +0200 sj r273800 : fixed build problem
2009-07-07 13:27:13 +0200 cl r273792 : #i102921# moved insert col/rows dialog to svx
2009-07-07 10:36:05 +0200 cl r273782 : fixed compiler warnings
2009-07-02 10:40:21 +0200 sj r273626 : fixed build problem
2009-07-02 10:27:56 +0200 cl r273624 : fixed merge problem
2009-07-02 10:27:19 +0200 cl r273623 : fixed compiler warning
2009-07-01 10:04:58 +0200 cl r273550 : CWS-TOOLING: rebase CWS impress172 to trunk@273468 (milestone: DEV300:m51)
2009-06-30 16:22:02 +0200 cl r273518 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:46 +0200 cl r273517 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:28 +0200 cl r273516 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:49 +0200 cl r273515 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:28 +0200 cl r273514 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:17:38 +0200 cl r273513 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:45:44 +0200 cl r273511 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:37:16 +0200 cl r273510 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:33:47 +0200 cl r273509 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:32:10 +0200 cl r273508 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:30:05 +0200 cl r273507 : #i102921# added insert table row/col dialog for impress tables
2009-06-29 12:32:42 +0200 sj r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names
2009-06-24 15:17:59 +0200 sj r273349 : #158636# fixed text range hyperlink to first/last slide
2009-06-22 13:18:30 +0200 sj r273224 : #158651# fixed header footer import
2009-06-19 15:18:24 +0200 sj r273160 : #158614# default text of presentation objects now cleared
2009-06-16 15:54:19 +0200 sj r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack
2009-06-15 16:26:26 +0200 sj r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-15 16:25:26 +0200 sj r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-12 13:17:32 +0200 sj r272915 : #i102713# fixed cloud shape
2009-06-10 18:36:58 +0200 sj r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-08 19:52:28 +0200 sj r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-04 15:28:32 +0200 cl r272640 : #i102358# applied patch to remove warnings
2009-06-04 14:39:45 +0200 cl r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents
2009-06-03 18:21:26 +0200 sj r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects
2009-06-03 15:47:27 +0200 cl r272583 : #i101817# added color collection based on scribus
2009-06-03 14:43:59 +0200 cl r272580 : #i102163# use weak ref to SdrObject instead of listening to the model
2009-06-03 12:39:29 +0200 cl r272556 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 12:27:00 +0200 cl r272555 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 11:33:44 +0200 cl r272553 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:59 +0200 cl r272552 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:22 +0200 cl r272551 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-02 18:41:07 +0200 sj r272527 : #i28358# applied patch (better conversion of dotted lines)
2009-06-02 11:52:13 +0200 cl r272491 : #i98668# applied patch to fix possible endless loop if exception occours
2009-05-28 17:02:55 +0200 sj r272416 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:25 +0200 sj r272415 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:10 +0200 sj r272414 : #i102336# retaining graphic file names unchanged
2009-05-25 12:43:58 +0200 sj r272232 : #i102069# added patch from thb (fixed rotated group objects)
2009-08-05 17:01:07 +00:00
}
2008-03-12 09:38:48 +00:00
}
}
GetImport ( ) . GetShapeImport ( ) - > finishShape ( mxShape , mxAttrList , mxShapes ) ;
const rtl : : Reference < XMLTableImport > & xTableImport ( GetImport ( ) . GetShapeImport ( ) - > GetShapeTableImport ( ) ) ;
if ( xTableImport . is ( ) & & xProps . is ( ) )
{
uno : : Reference < table : : XColumnRowRange > xColumnRowRange (
2012-06-02 08:58:21 -05:00
xProps - > getPropertyValue ( OUString ( " Model " ) ) , uno : : UNO_QUERY ) ;
2008-03-12 09:38:48 +00:00
if ( xColumnRowRange . is ( ) )
mxTableImportContext = xTableImport - > CreateTableContext ( GetPrefix ( ) , GetLocalName ( ) , xColumnRowRange ) ;
if ( mxTableImportContext . Is ( ) )
mxTableImportContext - > StartElement ( xAttrList ) ;
}
}
}
void SdXMLTableShapeContext : : EndElement ( )
{
if ( mxTableImportContext . Is ( ) )
mxTableImportContext - > EndElement ( ) ;
2008-09-29 11:29:16 +00:00
SdXMLShapeContext : : EndElement ( ) ;
2008-03-12 09:38:48 +00:00
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 ) ;
}
2010-11-10 13:50:33 +08:00
SvXMLImportContext * SdXMLTableShapeContext : : CreateChildContext ( sal_uInt16 nPrefix , const : : rtl : : OUString & rLocalName , const uno : : Reference < xml : : sax : : XAttributeList > & xAttrList )
2008-03-12 09:38:48 +00:00
{
2010-02-22 16:56:21 +01:00
if ( mxTableImportContext . Is ( ) & & ( nPrefix = = XML_NAMESPACE_TABLE ) )
2008-03-12 09:38:48 +00:00
return mxTableImportContext - > CreateChildContext ( nPrefix , rLocalName , xAttrList ) ;
else
return SdXMLShapeContext : : CreateChildContext ( nPrefix , rLocalName , xAttrList ) ;
}
2010-10-12 15:53:47 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */