2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 22:20:40 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 22:20:40 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 22:20:40 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 22:20:40 +00:00
|
|
|
* $RCSfile: XMLTextFrameContext.cxx,v $
|
2008-10-01 06:34:11 +00:00
|
|
|
* $Revision: 1.75.34.1 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 22:20:40 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 22:20:40 +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 22:20:40 +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 22:20:40 +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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 10:13:00 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_xmloff.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#include <com/sun/star/text/TextContentAnchorType.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/text/XTextFrame.hpp>
|
|
|
|
#include <com/sun/star/container/XNamed.hpp>
|
|
|
|
#include <com/sun/star/text/SizeType.hpp>
|
2000-12-06 10:41:56 +00:00
|
|
|
#include <com/sun/star/drawing/XShape.hpp>
|
2001-01-30 12:10:00 +00:00
|
|
|
#include <com/sun/star/document/XEventsSupplier.hpp>
|
2001-05-09 11:22:39 +00:00
|
|
|
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
|
2001-05-18 12:58:34 +00:00
|
|
|
#include <com/sun/star/io/XOutputStream.hpp>
|
2001-10-16 09:56:37 +00:00
|
|
|
#include <com/sun/star/text/HoriOrientation.hpp>
|
|
|
|
#include <com/sun/star/text/VertOrientation.hpp>
|
2007-06-27 15:08:02 +00:00
|
|
|
#include <xmloff/xmlimp.hxx>
|
|
|
|
#include <xmloff/xmltoken.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "xmlnmspe.hxx"
|
|
|
|
#include "xmlkywd.hxx"
|
2007-06-27 15:08:02 +00:00
|
|
|
#include <xmloff/nmspmap.hxx>
|
|
|
|
#include <xmloff/xmluconv.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "XMLAnchorTypePropHdl.hxx"
|
2001-05-09 11:22:39 +00:00
|
|
|
#include "XMLEmbeddedObjectImportContext.hxx"
|
2007-06-27 15:08:02 +00:00
|
|
|
#include <xmloff/XMLBase64ImportContext.hxx>
|
2004-11-26 12:05:08 +00:00
|
|
|
#include "XMLReplacementImageContext.hxx"
|
2007-06-27 15:08:02 +00:00
|
|
|
#include <xmloff/prstylei.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "i18nmap.hxx"
|
2000-11-16 12:23:56 +00:00
|
|
|
#include "xexptran.hxx"
|
2007-06-27 15:08:02 +00:00
|
|
|
#include <xmloff/shapeimport.hxx>
|
|
|
|
#include <xmloff/XMLEventsImportContext.hxx>
|
2001-03-29 15:26:25 +00:00
|
|
|
#include "XMLImageMapContext.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "XMLTextFrameContext.hxx"
|
|
|
|
|
2001-07-25 12:29:47 +00:00
|
|
|
#include "XMLTextListBlockContext.hxx"
|
|
|
|
#include "XMLTextListItemContext.hxx"
|
2007-06-27 15:08:02 +00:00
|
|
|
#include <xmloff/attrlist.hxx>
|
2004-07-13 07:36:31 +00:00
|
|
|
#include <comphelper/stl_types.hxx>
|
2001-07-25 12:29:47 +00:00
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
#include <map>
|
2008-10-01 06:34:11 +00:00
|
|
|
|
2001-07-25 12:29:47 +00:00
|
|
|
|
2008-03-12 10:01:59 +00:00
|
|
|
using ::rtl::OUString;
|
|
|
|
using ::rtl::OUStringBuffer;
|
|
|
|
|
2000-11-16 12:23:56 +00:00
|
|
|
using namespace ::com::sun::star;
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::text;
|
|
|
|
using namespace ::com::sun::star::xml::sax;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::container;
|
2000-12-06 10:41:56 +00:00
|
|
|
using namespace ::com::sun::star::drawing;
|
2001-05-09 11:22:39 +00:00
|
|
|
using namespace ::com::sun::star::document;
|
2001-06-29 20:07:26 +00:00
|
|
|
using namespace ::xmloff::token;
|
2001-01-30 12:10:00 +00:00
|
|
|
using ::com::sun::star::document::XEventsSupplier;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
#define XML_TEXT_FRAME_TEXTBOX 1
|
|
|
|
#define XML_TEXT_FRAME_GRAPHIC 2
|
|
|
|
#define XML_TEXT_FRAME_OBJECT 3
|
|
|
|
#define XML_TEXT_FRAME_OBJECT_OLE 4
|
|
|
|
#define XML_TEXT_FRAME_APPLET 5
|
|
|
|
#define XML_TEXT_FRAME_PLUGIN 6
|
|
|
|
#define XML_TEXT_FRAME_FLOATING_FRAME 7
|
|
|
|
|
|
|
|
typedef ::std::map < const ::rtl::OUString, ::rtl::OUString, ::comphelper::UStringLess> ParamMap;
|
|
|
|
|
2002-10-31 09:26:33 +00:00
|
|
|
class XMLTextFrameContextHyperlink_Impl
|
|
|
|
{
|
|
|
|
OUString sHRef;
|
|
|
|
OUString sName;
|
|
|
|
OUString sTargetFrameName;
|
|
|
|
sal_Bool bMap;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
inline XMLTextFrameContextHyperlink_Impl( const OUString& rHRef,
|
|
|
|
const OUString& rName,
|
|
|
|
const OUString& rTargetFrameName,
|
|
|
|
sal_Bool bMap );
|
|
|
|
|
|
|
|
const OUString& GetHRef() const { return sHRef; }
|
|
|
|
const OUString& GetName() const { return sName; }
|
|
|
|
const OUString& GetTargetFrameName() const { return sTargetFrameName; }
|
|
|
|
sal_Bool GetMap() const { return bMap; }
|
|
|
|
};
|
|
|
|
|
|
|
|
inline XMLTextFrameContextHyperlink_Impl::XMLTextFrameContextHyperlink_Impl(
|
|
|
|
const OUString& rHRef, const OUString& rName,
|
|
|
|
const OUString& rTargetFrameName, sal_Bool bM ) :
|
|
|
|
sHRef( rHRef ),
|
|
|
|
sName( rName ),
|
|
|
|
sTargetFrameName( rTargetFrameName ),
|
|
|
|
bMap( bM )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
class XMLTextFrameTitleOrDescContext_Impl : public SvXMLImportContext
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-08-27 11:59:20 +00:00
|
|
|
OUString& mrTitleOrDesc;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
TYPEINFO();
|
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx,
|
|
|
|
const ::rtl::OUString& rLName,
|
|
|
|
OUString& rTitleOrDesc );
|
|
|
|
virtual ~XMLTextFrameTitleOrDescContext_Impl();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
virtual void Characters( const OUString& rText );
|
|
|
|
};
|
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
TYPEINIT1( XMLTextFrameTitleOrDescContext_Impl, SvXMLImportContext );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
XMLTextFrameTitleOrDescContext_Impl::XMLTextFrameTitleOrDescContext_Impl(
|
2000-09-18 16:07:07 +00:00
|
|
|
SvXMLImport& rImport,
|
2009-08-27 11:59:20 +00:00
|
|
|
sal_uInt16 nPrfx,
|
|
|
|
const OUString& rLName,
|
|
|
|
OUString& rTitleOrDesc )
|
|
|
|
: SvXMLImportContext( rImport, nPrfx, rLName )
|
|
|
|
, mrTitleOrDesc( rTitleOrDesc )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
XMLTextFrameTitleOrDescContext_Impl::~XMLTextFrameTitleOrDescContext_Impl()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
void XMLTextFrameTitleOrDescContext_Impl::Characters( const OUString& rText )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-08-27 11:59:20 +00:00
|
|
|
mrTitleOrDesc += rText;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2009-08-27 11:59:20 +00:00
|
|
|
// <--
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-16 12:23:56 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
2001-02-23 13:39:25 +00:00
|
|
|
class XMLTextFrameParam_Impl : public SvXMLImportContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
TYPEINFO();
|
|
|
|
|
|
|
|
XMLTextFrameParam_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
|
|
|
|
const ::rtl::OUString& rLName,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
|
2001-03-09 14:59:46 +00:00
|
|
|
sal_uInt16 nType,
|
|
|
|
ParamMap &rParamMap);
|
2001-02-23 13:39:25 +00:00
|
|
|
virtual ~XMLTextFrameParam_Impl();
|
|
|
|
};
|
2001-11-26 10:45:54 +00:00
|
|
|
|
2001-02-23 13:39:25 +00:00
|
|
|
TYPEINIT1( XMLTextFrameParam_Impl, SvXMLImportContext );
|
2001-11-26 10:45:54 +00:00
|
|
|
|
2001-02-23 13:39:25 +00:00
|
|
|
XMLTextFrameParam_Impl::~XMLTextFrameParam_Impl()
|
|
|
|
{
|
|
|
|
}
|
2001-11-26 10:45:54 +00:00
|
|
|
|
|
|
|
XMLTextFrameParam_Impl::XMLTextFrameParam_Impl(
|
|
|
|
SvXMLImport& rImport, sal_uInt16 nPrfx,
|
|
|
|
const ::rtl::OUString& rLName,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
2001-02-23 13:39:25 +00:00
|
|
|
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
|
2006-06-19 17:45:40 +00:00
|
|
|
sal_uInt16 /*nType*/,
|
2001-11-26 10:45:54 +00:00
|
|
|
ParamMap &rParamMap):
|
2001-02-23 13:39:25 +00:00
|
|
|
SvXMLImportContext( rImport, nPrfx, rLName )
|
|
|
|
{
|
|
|
|
OUString sName, sValue;
|
2001-03-09 14:59:46 +00:00
|
|
|
sal_Bool bFoundValue = sal_False; // to allow empty values
|
2001-02-23 13:39:25 +00:00
|
|
|
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
|
|
|
|
for( sal_Int16 i=0; i < nAttrCount; i++ )
|
|
|
|
{
|
|
|
|
const OUString& rAttrName = xAttrList->getNameByIndex( i );
|
|
|
|
const OUString& rValue = xAttrList->getValueByIndex( i );
|
|
|
|
|
|
|
|
OUString aLocalName;
|
|
|
|
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
|
2001-11-26 10:45:54 +00:00
|
|
|
if ( XML_NAMESPACE_DRAW == nPrefix )
|
2001-03-09 14:59:46 +00:00
|
|
|
{
|
2001-11-26 10:45:54 +00:00
|
|
|
if( IsXMLToken(aLocalName, XML_VALUE) )
|
|
|
|
{
|
|
|
|
sValue = rValue;
|
|
|
|
bFoundValue=sal_True;
|
|
|
|
}
|
|
|
|
else if( IsXMLToken(aLocalName, XML_NAME) )
|
|
|
|
{
|
|
|
|
sName = rValue;
|
|
|
|
}
|
2001-03-09 14:59:46 +00:00
|
|
|
}
|
2001-02-23 13:39:25 +00:00
|
|
|
}
|
2001-03-09 14:59:46 +00:00
|
|
|
if (sName.getLength() && bFoundValue )
|
|
|
|
rParamMap[sName] = sValue;
|
2001-02-23 13:39:25 +00:00
|
|
|
}
|
2000-11-16 12:23:56 +00:00
|
|
|
class XMLTextFrameContourContext_Impl : public SvXMLImportContext
|
|
|
|
{
|
|
|
|
Reference < XPropertySet > xPropSet;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
TYPEINFO();
|
|
|
|
|
|
|
|
XMLTextFrameContourContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
|
|
|
|
const ::rtl::OUString& rLName,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
|
|
|
|
const Reference < XPropertySet >& rPropSet,
|
|
|
|
sal_Bool bPath );
|
|
|
|
virtual ~XMLTextFrameContourContext_Impl();
|
|
|
|
};
|
|
|
|
|
|
|
|
TYPEINIT1( XMLTextFrameContourContext_Impl, SvXMLImportContext );
|
|
|
|
|
|
|
|
XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx, const OUString& rLName,
|
|
|
|
const Reference< XAttributeList > & xAttrList,
|
|
|
|
const Reference < XPropertySet >& rPropSet,
|
|
|
|
sal_Bool bPath ) :
|
|
|
|
SvXMLImportContext( rImport, nPrfx, rLName ),
|
|
|
|
xPropSet( rPropSet )
|
|
|
|
{
|
|
|
|
OUString sD, sPoints, sViewBox;
|
2001-05-04 08:49:55 +00:00
|
|
|
sal_Bool bPixelWidth = sal_False, bPixelHeight = sal_False;
|
|
|
|
sal_Bool bAuto = sal_False;
|
2001-02-12 11:20:34 +00:00
|
|
|
sal_Int32 nWidth = 0;
|
|
|
|
sal_Int32 nHeight = 0;
|
2000-11-16 12:23:56 +00:00
|
|
|
|
|
|
|
const SvXMLTokenMap& rTokenMap =
|
2001-03-29 07:26:44 +00:00
|
|
|
GetImport().GetTextImport()->GetTextContourAttrTokenMap();
|
2000-11-16 12:23:56 +00:00
|
|
|
|
|
|
|
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
|
|
|
|
for( sal_Int16 i=0; i < nAttrCount; i++ )
|
|
|
|
{
|
|
|
|
const OUString& rAttrName = xAttrList->getNameByIndex( i );
|
|
|
|
const OUString& rValue = xAttrList->getValueByIndex( i );
|
|
|
|
|
|
|
|
OUString aLocalName;
|
|
|
|
sal_uInt16 nPrefix =
|
|
|
|
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
|
|
|
|
&aLocalName );
|
2001-03-29 07:26:44 +00:00
|
|
|
switch( rTokenMap.Get( nPrefix, aLocalName ) )
|
2000-11-16 12:23:56 +00:00
|
|
|
{
|
2001-03-29 07:26:44 +00:00
|
|
|
case XML_TOK_TEXT_CONTOUR_VIEWBOX:
|
|
|
|
sViewBox = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_CONTOUR_D:
|
|
|
|
if( bPath )
|
2000-11-16 12:23:56 +00:00
|
|
|
sD = rValue;
|
2001-03-29 07:26:44 +00:00
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_CONTOUR_POINTS:
|
|
|
|
if( !bPath )
|
2000-11-16 12:23:56 +00:00
|
|
|
sPoints = rValue;
|
2001-03-29 07:26:44 +00:00
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_CONTOUR_WIDTH:
|
2001-05-04 08:49:55 +00:00
|
|
|
if( GetImport().GetMM100UnitConverter().convertMeasurePx( nWidth,
|
|
|
|
rValue) )
|
|
|
|
bPixelWidth = sal_True;
|
|
|
|
else
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
|
2001-03-29 07:26:44 +00:00
|
|
|
rValue);
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_CONTOUR_HEIGHT:
|
2001-05-04 08:49:55 +00:00
|
|
|
if( GetImport().GetMM100UnitConverter().convertMeasurePx( nHeight,
|
|
|
|
rValue) )
|
|
|
|
bPixelHeight = sal_True;
|
|
|
|
else
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
|
|
|
|
rValue);
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_CONTOUR_AUTO:
|
2001-06-29 20:07:26 +00:00
|
|
|
bAuto = IsXMLToken(rValue, XML_TRUE);
|
2001-03-29 07:26:44 +00:00
|
|
|
break;
|
2000-11-16 12:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString sContourPolyPolygon(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon") );
|
2001-05-04 08:49:55 +00:00
|
|
|
Reference < XPropertySetInfo > xPropSetInfo =
|
|
|
|
rPropSet->getPropertySetInfo();
|
|
|
|
if( xPropSetInfo->hasPropertyByName(
|
2000-11-16 12:23:56 +00:00
|
|
|
sContourPolyPolygon ) &&
|
2001-05-04 08:49:55 +00:00
|
|
|
nWidth > 0 && nHeight > 0 && bPixelWidth == bPixelHeight &&
|
|
|
|
(bPath ? sD : sPoints).getLength() )
|
2000-11-16 12:23:56 +00:00
|
|
|
{
|
|
|
|
awt::Point aPoint( 0, 0 );
|
|
|
|
awt::Size aSize( nWidth, nHeight );
|
|
|
|
SdXMLImExViewBox aViewBox( sViewBox,
|
|
|
|
GetImport().GetMM100UnitConverter());
|
|
|
|
Any aAny;
|
|
|
|
if( bPath )
|
|
|
|
{
|
|
|
|
SdXMLImExSvgDElement aPoints( sD, aViewBox, aPoint, aSize,
|
|
|
|
GetImport().GetMM100UnitConverter() );
|
|
|
|
aAny <<= aPoints.GetPointSequenceSequence();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SdXMLImExPointsElement aPoints( sPoints, aViewBox, aPoint, aSize,
|
|
|
|
GetImport().GetMM100UnitConverter() );
|
|
|
|
aAny <<= aPoints.GetPointSequenceSequence();
|
|
|
|
}
|
|
|
|
|
2001-05-04 08:49:55 +00:00
|
|
|
OUString sIsPixelContour(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM("IsPixelContour") );
|
2000-11-16 12:23:56 +00:00
|
|
|
xPropSet->setPropertyValue( sContourPolyPolygon, aAny );
|
2001-05-04 08:49:55 +00:00
|
|
|
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sIsPixelContour ) )
|
|
|
|
{
|
|
|
|
aAny.setValue( &bPixelWidth, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( sIsPixelContour, aAny );
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString sIsAutomaticContour(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour") );
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )
|
|
|
|
{
|
|
|
|
aAny.setValue( &bAuto, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( sIsAutomaticContour, aAny );
|
|
|
|
}
|
2000-11-16 12:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLTextFrameContourContext_Impl::~XMLTextFrameContourContext_Impl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
class XMLTextFrameContext_Impl : public SvXMLImportContext
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference <
|
|
|
|
::com::sun::star::text::XTextCursor > xOldTextCursor;
|
|
|
|
::com::sun::star::uno::Reference <
|
|
|
|
::com::sun::star::beans::XPropertySet > xPropSet;
|
|
|
|
::com::sun::star::uno::Reference <
|
|
|
|
::com::sun::star::io::XOutputStream > xBase64Stream;
|
|
|
|
|
|
|
|
/// old list item and block (#89891#)
|
2008-10-01 06:34:11 +00:00
|
|
|
bool mbListContextPushed;
|
2004-07-13 07:36:31 +00:00
|
|
|
|
|
|
|
const ::rtl::OUString sWidth;
|
|
|
|
const ::rtl::OUString sWidthType;
|
|
|
|
const ::rtl::OUString sRelativeWidth;
|
|
|
|
const ::rtl::OUString sHeight;
|
|
|
|
const ::rtl::OUString sRelativeHeight;
|
|
|
|
const ::rtl::OUString sSizeType;
|
|
|
|
const ::rtl::OUString sIsSyncWidthToHeight;
|
|
|
|
const ::rtl::OUString sIsSyncHeightToWidth;
|
|
|
|
const ::rtl::OUString sHoriOrient;
|
|
|
|
const ::rtl::OUString sHoriOrientPosition;
|
|
|
|
const ::rtl::OUString sVertOrient;
|
|
|
|
const ::rtl::OUString sVertOrientPosition;
|
|
|
|
const ::rtl::OUString sChainNextName;
|
|
|
|
const ::rtl::OUString sAnchorType;
|
|
|
|
const ::rtl::OUString sAnchorPageNo;
|
|
|
|
const ::rtl::OUString sGraphicURL;
|
|
|
|
const ::rtl::OUString sGraphicFilter;
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
// const ::rtl::OUString sAlternativeText;
|
|
|
|
const ::rtl::OUString sTitle;
|
|
|
|
const ::rtl::OUString sDescription;
|
|
|
|
// <--
|
2004-07-13 07:36:31 +00:00
|
|
|
const ::rtl::OUString sFrameStyleName;
|
|
|
|
const ::rtl::OUString sGraphicRotation;
|
|
|
|
const ::rtl::OUString sTextBoxServiceName;
|
|
|
|
const ::rtl::OUString sGraphicServiceName;
|
|
|
|
|
|
|
|
::rtl::OUString sName;
|
|
|
|
::rtl::OUString sStyleName;
|
|
|
|
::rtl::OUString sNextName;
|
|
|
|
::rtl::OUString sHRef;
|
|
|
|
::rtl::OUString sFilterName;
|
|
|
|
::rtl::OUString sCode;
|
|
|
|
::rtl::OUString sObject;
|
|
|
|
::rtl::OUString sArchive;
|
|
|
|
::rtl::OUString sMimeType;
|
|
|
|
::rtl::OUString sFrameName;
|
|
|
|
::rtl::OUString sAppletName;
|
|
|
|
::rtl::OUString sFilterService;
|
|
|
|
::rtl::OUString sBase64CharsLeft;
|
|
|
|
::rtl::OUString sTblName;
|
|
|
|
|
|
|
|
ParamMap aParamMap;
|
|
|
|
|
|
|
|
sal_Int32 nX;
|
|
|
|
sal_Int32 nY;
|
|
|
|
sal_Int32 nWidth;
|
|
|
|
sal_Int32 nHeight;
|
|
|
|
sal_Int32 nZIndex;
|
|
|
|
sal_Int16 nPage;
|
|
|
|
sal_Int16 nRotation;
|
|
|
|
sal_Int16 nRelWidth;
|
|
|
|
sal_Int16 nRelHeight;
|
|
|
|
|
|
|
|
sal_uInt16 nType;
|
|
|
|
::com::sun::star::text::TextContentAnchorType eAnchorType;
|
|
|
|
|
|
|
|
sal_Bool bMayScript : 1;
|
|
|
|
sal_Bool bMinWidth : 1;
|
|
|
|
sal_Bool bMinHeight : 1;
|
|
|
|
sal_Bool bSyncWidth : 1;
|
|
|
|
sal_Bool bSyncHeight : 1;
|
|
|
|
sal_Bool bCreateFailed : 1;
|
|
|
|
sal_Bool bOwnBase64Stream : 1;
|
|
|
|
|
|
|
|
void Create( sal_Bool bHRefOrBase64 );
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
TYPEINFO();
|
|
|
|
|
|
|
|
sal_Bool CreateIfNotThere();
|
|
|
|
|
|
|
|
XMLTextFrameContext_Impl( SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx,
|
|
|
|
const ::rtl::OUString& rLName,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::xml::sax::XAttributeList > & rAttrList,
|
|
|
|
::com::sun::star::text::TextContentAnchorType eAnchorType,
|
|
|
|
sal_uInt16 nType,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList );
|
|
|
|
virtual ~XMLTextFrameContext_Impl();
|
|
|
|
|
|
|
|
virtual void EndElement();
|
|
|
|
|
|
|
|
virtual void Characters( const ::rtl::OUString& rChars );
|
|
|
|
|
|
|
|
SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
|
|
|
|
const ::rtl::OUString& rLocalName,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::xml::sax::XAttributeList > & xAttrList );
|
|
|
|
|
|
|
|
void SetHyperlink( const ::rtl::OUString& rHRef,
|
|
|
|
const ::rtl::OUString& rName,
|
|
|
|
const ::rtl::OUString& rTargetFrameName,
|
|
|
|
sal_Bool bMap );
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
void SetTitle( const ::rtl::OUString& rTitle );
|
|
|
|
// <--
|
2004-07-13 07:36:31 +00:00
|
|
|
void SetDesc( const ::rtl::OUString& rDesc );
|
|
|
|
|
|
|
|
::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; }
|
|
|
|
|
|
|
|
const ::com::sun::star::uno::Reference <
|
|
|
|
::com::sun::star::beans::XPropertySet >& GetPropSet() { return xPropSet; }
|
|
|
|
};
|
|
|
|
|
|
|
|
TYPEINIT1( XMLTextFrameContext_Impl, SvXMLImportContext );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-06-19 17:45:40 +00:00
|
|
|
void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ )
|
2001-05-09 11:22:39 +00:00
|
|
|
{
|
2006-06-19 17:45:40 +00:00
|
|
|
UniReference < XMLTextImportHelper > xTextImportHelper =
|
2001-05-09 11:22:39 +00:00
|
|
|
GetImport().GetTextImport();
|
|
|
|
|
|
|
|
switch ( nType)
|
|
|
|
{
|
|
|
|
case XML_TEXT_FRAME_OBJECT:
|
|
|
|
case XML_TEXT_FRAME_OBJECT_OLE:
|
2005-01-27 10:09:50 +00:00
|
|
|
if( xBase64Stream.is() )
|
|
|
|
{
|
|
|
|
OUString sURL( GetImport().ResolveEmbeddedObjectURLFromBase64() );
|
|
|
|
if( sURL.getLength() )
|
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertOLEObject( GetImport(), sURL,
|
|
|
|
sStyleName,
|
|
|
|
sTblName,
|
|
|
|
nWidth, nHeight );
|
|
|
|
}
|
|
|
|
else if( sHRef.getLength() )
|
2001-05-09 11:22:39 +00:00
|
|
|
{
|
|
|
|
OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef,
|
|
|
|
OUString() ) );
|
|
|
|
|
2005-03-15 10:19:39 +00:00
|
|
|
if( GetImport().IsPackageURL( sHRef ) )
|
|
|
|
{
|
2001-05-09 11:22:39 +00:00
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertOLEObject( GetImport(), sURL,
|
|
|
|
sStyleName,
|
2001-06-28 12:21:55 +00:00
|
|
|
sTblName,
|
2001-05-09 11:22:39 +00:00
|
|
|
nWidth, nHeight );
|
2005-03-15 10:19:39 +00:00
|
|
|
}
|
2004-10-04 17:12:15 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// it should be an own OOo link that has no storage persistance
|
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertOOoLink( GetImport(),
|
2005-03-15 10:19:39 +00:00
|
|
|
sURL,
|
2004-10-04 17:12:15 +00:00
|
|
|
sStyleName,
|
|
|
|
sTblName,
|
|
|
|
nWidth, nHeight );
|
|
|
|
}
|
2001-05-09 11:22:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OUString sURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.ServiceName:") );
|
|
|
|
sURL += sFilterService;
|
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertOLEObject( GetImport(), sURL,
|
|
|
|
sStyleName,
|
2001-06-28 12:21:55 +00:00
|
|
|
sTblName,
|
2001-05-09 11:22:39 +00:00
|
|
|
nWidth, nHeight );
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XML_TEXT_FRAME_APPLET:
|
|
|
|
{
|
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertApplet( sAppletName, sCode,
|
|
|
|
bMayScript, sHRef,
|
|
|
|
nWidth, nHeight);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TEXT_FRAME_PLUGIN:
|
|
|
|
{
|
2005-01-11 11:06:31 +00:00
|
|
|
if(sHRef.getLength())
|
|
|
|
GetImport().GetAbsoluteReference(sHRef);
|
2001-05-09 11:22:39 +00:00
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertPlugin( sMimeType, sHRef,
|
|
|
|
nWidth, nHeight);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TEXT_FRAME_FLOATING_FRAME:
|
|
|
|
{
|
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertFloatingFrame( sFrameName, sHRef,
|
|
|
|
sStyleName,
|
|
|
|
nWidth, nHeight);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(),
|
|
|
|
UNO_QUERY );
|
|
|
|
if( xFactory.is() )
|
|
|
|
{
|
|
|
|
OUString sServiceName;
|
|
|
|
switch( nType )
|
|
|
|
{
|
|
|
|
case XML_TEXT_FRAME_TEXTBOX: sServiceName = sTextBoxServiceName; break;
|
|
|
|
case XML_TEXT_FRAME_GRAPHIC: sServiceName = sGraphicServiceName; break;
|
|
|
|
}
|
|
|
|
Reference<XInterface> xIfc = xFactory->createInstance( sServiceName );
|
|
|
|
DBG_ASSERT( xIfc.is(), "couldn't create frame" );
|
|
|
|
if( xIfc.is() )
|
|
|
|
xPropSet = Reference < XPropertySet >( xIfc, UNO_QUERY );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !xPropSet.is() )
|
2002-10-31 09:26:33 +00:00
|
|
|
{
|
|
|
|
bCreateFailed = sal_True;
|
2001-05-09 11:22:39 +00:00
|
|
|
return;
|
2002-10-31 09:26:33 +00:00
|
|
|
}
|
2001-05-09 11:22:39 +00:00
|
|
|
|
|
|
|
Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
|
|
|
|
|
|
|
|
// set name
|
|
|
|
Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
|
|
|
|
if( xNamed.is() )
|
|
|
|
{
|
|
|
|
OUString sOrigName( xNamed->getName() );
|
|
|
|
if( !sOrigName.getLength() ||
|
|
|
|
(sName.getLength() && sOrigName != sName) )
|
|
|
|
{
|
|
|
|
OUString sOldName( sName );
|
|
|
|
sal_Int32 i = 0;
|
2006-06-19 17:45:40 +00:00
|
|
|
while( xTextImportHelper->HasFrameByName( sName ) )
|
2001-05-09 11:22:39 +00:00
|
|
|
{
|
|
|
|
sName = sOldName;
|
|
|
|
sName += OUString::valueOf( ++i );
|
|
|
|
}
|
|
|
|
xNamed->setName( sName );
|
|
|
|
if( sName != sOldName )
|
2006-06-19 17:45:40 +00:00
|
|
|
xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
|
2001-05-09 11:22:39 +00:00
|
|
|
sOldName, sName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// frame style
|
|
|
|
XMLPropStyleContext *pStyle = 0;
|
|
|
|
if( sStyleName.getLength() )
|
|
|
|
{
|
2006-06-19 17:45:40 +00:00
|
|
|
pStyle = xTextImportHelper->FindAutoFrameStyle( sStyleName );
|
2001-05-09 11:22:39 +00:00
|
|
|
if( pStyle )
|
2004-11-26 12:05:08 +00:00
|
|
|
sStyleName = pStyle->GetParentName();
|
2001-05-09 11:22:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Any aAny;
|
|
|
|
if( sStyleName.getLength() )
|
|
|
|
{
|
2004-07-13 07:36:31 +00:00
|
|
|
OUString sDisplayStyleName( GetImport().GetStyleDisplayName(
|
|
|
|
XML_STYLE_FAMILY_SD_GRAPHICS_ID, sStyleName ) );
|
2001-05-09 11:22:39 +00:00
|
|
|
const Reference < XNameContainer > & rStyles =
|
2006-06-19 17:45:40 +00:00
|
|
|
xTextImportHelper->GetFrameStyles();
|
2001-05-09 11:22:39 +00:00
|
|
|
if( rStyles.is() &&
|
2004-07-13 07:36:31 +00:00
|
|
|
rStyles->hasByName( sDisplayStyleName ) )
|
2001-05-09 11:22:39 +00:00
|
|
|
{
|
2004-07-13 07:36:31 +00:00
|
|
|
aAny <<= sDisplayStyleName;
|
2001-05-09 11:22:39 +00:00
|
|
|
xPropSet->setPropertyValue( sFrameStyleName, aAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-10 16:06:40 +00:00
|
|
|
// anchor type (must be set before any other properties, because
|
|
|
|
// otherwise some orientations cannot be set or will be changed
|
|
|
|
// afterwards)
|
|
|
|
aAny <<= eAnchorType;
|
|
|
|
xPropSet->setPropertyValue( sAnchorType, aAny );
|
|
|
|
|
2001-05-09 11:22:39 +00:00
|
|
|
// hard properties
|
|
|
|
if( pStyle )
|
|
|
|
pStyle->FillPropertySet( xPropSet );
|
|
|
|
|
|
|
|
|
|
|
|
// x and y
|
2001-10-16 09:56:37 +00:00
|
|
|
sal_Int16 nHoriOrient = HoriOrientation::NONE;
|
|
|
|
aAny = xPropSet->getPropertyValue( sHoriOrient );
|
|
|
|
aAny >>= nHoriOrient;
|
|
|
|
if( HoriOrientation::NONE == nHoriOrient )
|
|
|
|
{
|
|
|
|
aAny <<= nX;
|
|
|
|
xPropSet->setPropertyValue( sHoriOrientPosition, aAny );
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int16 nVertOrient = VertOrientation::NONE;
|
|
|
|
aAny = xPropSet->getPropertyValue( sVertOrient );
|
|
|
|
aAny >>= nVertOrient;
|
|
|
|
if( VertOrientation::NONE == nVertOrient )
|
|
|
|
{
|
|
|
|
aAny <<= nY;
|
|
|
|
xPropSet->setPropertyValue( sVertOrientPosition, aAny );
|
|
|
|
}
|
2001-05-09 11:22:39 +00:00
|
|
|
|
|
|
|
// width
|
|
|
|
if( nWidth > 0 )
|
|
|
|
{
|
|
|
|
aAny <<= nWidth;
|
|
|
|
xPropSet->setPropertyValue( sWidth, aAny );
|
|
|
|
}
|
|
|
|
if( nRelWidth > 0 || nWidth > 0 )
|
|
|
|
{
|
|
|
|
aAny <<= nRelWidth;
|
|
|
|
xPropSet->setPropertyValue( sRelativeWidth, aAny );
|
|
|
|
}
|
|
|
|
if( bSyncWidth || nWidth > 0 )
|
|
|
|
{
|
|
|
|
sal_Bool bTmp = bSyncWidth;
|
|
|
|
aAny.setValue( &bTmp, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( sIsSyncWidthToHeight, aAny );
|
|
|
|
}
|
2004-05-18 14:04:35 +00:00
|
|
|
if( xPropSetInfo->hasPropertyByName( sWidthType ) &&
|
|
|
|
(bMinWidth || nWidth > 0 || nRelWidth > 0 ) )
|
|
|
|
{
|
|
|
|
sal_Int16 nSizeType =
|
|
|
|
(bMinWidth && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
|
|
|
|
: SizeType::FIX;
|
|
|
|
aAny <<= nSizeType;
|
|
|
|
xPropSet->setPropertyValue( sWidthType, aAny );
|
|
|
|
}
|
2001-05-09 11:22:39 +00:00
|
|
|
|
|
|
|
if( nHeight > 0 )
|
|
|
|
{
|
|
|
|
aAny <<= nHeight;
|
|
|
|
xPropSet->setPropertyValue( sHeight, aAny );
|
|
|
|
}
|
|
|
|
if( nRelHeight > 0 || nHeight > 0 )
|
|
|
|
{
|
|
|
|
aAny <<= nRelHeight;
|
|
|
|
xPropSet->setPropertyValue( sRelativeHeight, aAny );
|
|
|
|
}
|
|
|
|
if( bSyncHeight || nHeight > 0 )
|
|
|
|
{
|
|
|
|
sal_Bool bTmp = bSyncHeight;
|
|
|
|
aAny.setValue( &bTmp, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( sIsSyncHeightToWidth, aAny );
|
|
|
|
}
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sSizeType ) &&
|
|
|
|
(bMinHeight || nHeight > 0 || nRelHeight > 0 ) )
|
|
|
|
{
|
|
|
|
sal_Int16 nSizeType =
|
|
|
|
(bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
|
|
|
|
: SizeType::FIX;
|
|
|
|
aAny <<= nSizeType;
|
|
|
|
xPropSet->setPropertyValue( sSizeType, aAny );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( XML_TEXT_FRAME_GRAPHIC == nType )
|
|
|
|
{
|
|
|
|
// URL
|
2001-06-19 14:08:23 +00:00
|
|
|
OSL_ENSURE( sHRef.getLength() > 0 || xBase64Stream.is(),
|
|
|
|
"neither URL nor base64 image data given" );
|
2001-05-09 11:22:39 +00:00
|
|
|
UniReference < XMLTextImportHelper > xTxtImport =
|
|
|
|
GetImport().GetTextImport();
|
2001-06-19 14:08:23 +00:00
|
|
|
if( sHRef.getLength() )
|
|
|
|
{
|
|
|
|
sal_Bool bForceLoad = xTxtImport->IsInsertMode() ||
|
|
|
|
xTxtImport->IsBlockMode() ||
|
|
|
|
xTxtImport->IsStylesOnlyMode() ||
|
|
|
|
xTxtImport->IsOrganizerMode();
|
|
|
|
sHRef = GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad );
|
|
|
|
}
|
|
|
|
else if( xBase64Stream.is() )
|
|
|
|
{
|
|
|
|
sHRef = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
|
|
|
|
xBase64Stream = 0;
|
|
|
|
}
|
|
|
|
aAny <<= sHRef;
|
2001-05-09 11:22:39 +00:00
|
|
|
xPropSet->setPropertyValue( sGraphicURL, aAny );
|
|
|
|
|
|
|
|
// filter name
|
|
|
|
aAny <<=sFilterName;
|
|
|
|
xPropSet->setPropertyValue( sGraphicFilter, aAny );
|
|
|
|
|
|
|
|
// rotation
|
|
|
|
aAny <<= nRotation;
|
|
|
|
xPropSet->setPropertyValue( sGraphicRotation, aAny );
|
|
|
|
}
|
|
|
|
|
|
|
|
// page number (must be set after the frame is inserted, because it
|
|
|
|
// will be overwritten then inserting the frame.
|
|
|
|
if( TextContentAnchorType_AT_PAGE == eAnchorType && nPage > 0 )
|
|
|
|
{
|
|
|
|
aAny <<= nPage;
|
|
|
|
xPropSet->setPropertyValue( sAnchorPageNo, aAny );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( XML_TEXT_FRAME_OBJECT != nType &&
|
|
|
|
XML_TEXT_FRAME_OBJECT_OLE != nType &&
|
|
|
|
XML_TEXT_FRAME_APPLET != nType &&
|
|
|
|
XML_TEXT_FRAME_PLUGIN!= nType &&
|
|
|
|
XML_TEXT_FRAME_FLOATING_FRAME != nType)
|
|
|
|
{
|
|
|
|
Reference < XTextContent > xTxtCntnt( xPropSet, UNO_QUERY );
|
2006-06-19 17:45:40 +00:00
|
|
|
xTextImportHelper->InsertTextContent( xTxtCntnt );
|
2001-05-09 11:22:39 +00:00
|
|
|
}
|
|
|
|
|
2002-11-25 16:11:55 +00:00
|
|
|
Reference < XShape > xShape( xPropSet, UNO_QUERY );
|
2003-04-08 14:30:17 +00:00
|
|
|
|
|
|
|
// #107848#
|
|
|
|
// Make adding the shepe to Z-Ordering dependent from if we are
|
|
|
|
// inside a inside_deleted_section (redlining). That is necessary
|
|
|
|
// since the shape will be removed again later. It would lead to
|
|
|
|
// errors if it would stay inside the Z-Ordering. Thus, the
|
|
|
|
// easiest way to solve that conflict is to not add it here.
|
|
|
|
if(!GetImport().HasTextImport()
|
|
|
|
|| !GetImport().GetTextImport()->IsInsideDeleteContext())
|
|
|
|
{
|
|
|
|
GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
|
|
|
|
}
|
2002-11-25 16:11:55 +00:00
|
|
|
|
2001-05-09 11:22:39 +00:00
|
|
|
if( XML_TEXT_FRAME_TEXTBOX == nType )
|
|
|
|
{
|
2006-06-19 17:45:40 +00:00
|
|
|
xTextImportHelper->ConnectFrameChains( sName, sNextName, xPropSet );
|
2001-05-09 11:22:39 +00:00
|
|
|
Reference < XTextFrame > xTxtFrame( xPropSet, UNO_QUERY );
|
|
|
|
Reference < XText > xTxt = xTxtFrame->getText();
|
2006-06-19 17:45:40 +00:00
|
|
|
xOldTextCursor = xTextImportHelper->GetCursor();
|
|
|
|
xTextImportHelper->SetCursor( xTxt->createTextCursor() );
|
2001-07-25 12:29:47 +00:00
|
|
|
|
|
|
|
// remember old list item and block (#89892#) and reset them
|
|
|
|
// for the text frame
|
2008-10-01 06:34:11 +00:00
|
|
|
xTextImportHelper->PushListContext();
|
|
|
|
mbListContextPushed = true;
|
2001-05-09 11:22:39 +00:00
|
|
|
}
|
2002-10-31 09:26:33 +00:00
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
sal_Bool XMLTextFrameContext_Impl::CreateIfNotThere()
|
2002-10-31 09:26:33 +00:00
|
|
|
{
|
|
|
|
if( !xPropSet.is() &&
|
|
|
|
( XML_TEXT_FRAME_OBJECT_OLE == nType ||
|
|
|
|
XML_TEXT_FRAME_GRAPHIC == nType ) &&
|
|
|
|
xBase64Stream.is() && !bCreateFailed )
|
|
|
|
{
|
|
|
|
if( bOwnBase64Stream )
|
|
|
|
xBase64Stream->closeOutput();
|
|
|
|
Create( sal_True );
|
|
|
|
}
|
|
|
|
|
|
|
|
return xPropSet.is();
|
2001-05-09 11:22:39 +00:00
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
|
2000-09-18 16:07:07 +00:00
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx, const OUString& rLName,
|
2004-07-13 07:36:31 +00:00
|
|
|
const Reference< XAttributeList > & rAttrList,
|
2000-09-18 16:07:07 +00:00
|
|
|
TextContentAnchorType eATyp,
|
2004-07-13 07:36:31 +00:00
|
|
|
sal_uInt16 nNewType,
|
2006-06-19 17:45:40 +00:00
|
|
|
const Reference< XAttributeList > & rFrameAttrList )
|
|
|
|
: SvXMLImportContext( rImport, nPrfx, rLName )
|
2008-10-01 06:34:11 +00:00
|
|
|
, mbListContextPushed( false )
|
2006-06-19 17:45:40 +00:00
|
|
|
, sWidth(RTL_CONSTASCII_USTRINGPARAM("Width"))
|
|
|
|
, sWidthType(RTL_CONSTASCII_USTRINGPARAM("WidthType"))
|
|
|
|
, sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth"))
|
|
|
|
, sHeight(RTL_CONSTASCII_USTRINGPARAM("Height"))
|
|
|
|
, sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight"))
|
|
|
|
, sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType"))
|
|
|
|
, sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight"))
|
|
|
|
, sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth"))
|
|
|
|
, sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient"))
|
|
|
|
, sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition"))
|
|
|
|
, sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient"))
|
|
|
|
, sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition"))
|
|
|
|
, sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName"))
|
|
|
|
, sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType"))
|
|
|
|
, sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo"))
|
|
|
|
, sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))
|
|
|
|
, sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter"))
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
//, sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText"))
|
|
|
|
, sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
|
|
|
|
, sDescription(RTL_CONSTASCII_USTRINGPARAM("Description"))
|
|
|
|
// <--
|
2006-06-19 17:45:40 +00:00
|
|
|
, sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName"))
|
|
|
|
, sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation"))
|
|
|
|
, sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame"))
|
|
|
|
, sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject"))
|
|
|
|
, nType( nNewType )
|
|
|
|
, eAnchorType( eATyp )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-05-09 11:22:39 +00:00
|
|
|
nX = 0;
|
|
|
|
nY = 0;
|
|
|
|
nWidth = 0;
|
|
|
|
nHeight = 0;
|
|
|
|
nZIndex = -1;
|
|
|
|
nPage = 0;
|
|
|
|
nRotation = 0;
|
|
|
|
nRelWidth = 0;
|
|
|
|
nRelHeight = 0;
|
|
|
|
bMayScript = sal_False;
|
|
|
|
|
|
|
|
bMinHeight = sal_False;
|
2004-05-18 14:04:35 +00:00
|
|
|
bMinWidth = sal_False;
|
2001-05-09 11:22:39 +00:00
|
|
|
bSyncWidth = sal_False;
|
|
|
|
bSyncHeight = sal_False;
|
2002-10-31 09:26:33 +00:00
|
|
|
bCreateFailed = sal_False;
|
2001-06-19 14:08:23 +00:00
|
|
|
bOwnBase64Stream = sal_False;
|
2001-05-09 11:22:39 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
UniReference < XMLTextImportHelper > xTxtImport =
|
|
|
|
GetImport().GetTextImport();
|
|
|
|
const SvXMLTokenMap& rTokenMap =
|
|
|
|
xTxtImport->GetTextFrameAttrTokenMap();
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
|
|
|
|
sal_Int16 nTotalAttrCount = nAttrCount + (rFrameAttrList.is() ? rFrameAttrList->getLength() : 0);
|
|
|
|
for( sal_Int16 i=0; i < nTotalAttrCount; i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-07-13 07:36:31 +00:00
|
|
|
const OUString& rAttrName =
|
|
|
|
i < nAttrCount ? rAttrList->getNameByIndex( i ) : rFrameAttrList->getNameByIndex( i-nAttrCount );
|
|
|
|
const OUString& rValue =
|
|
|
|
i < nAttrCount ? rAttrList->getValueByIndex( i ): rFrameAttrList->getValueByIndex( i-nAttrCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
OUString aLocalName;
|
|
|
|
sal_uInt16 nPrefix =
|
|
|
|
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
|
|
|
|
&aLocalName );
|
|
|
|
switch( rTokenMap.Get( nPrefix, aLocalName ) )
|
|
|
|
{
|
|
|
|
case XML_TOK_TEXT_FRAME_STYLE_NAME:
|
|
|
|
sStyleName = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_NAME:
|
|
|
|
sName = rValue;
|
|
|
|
break;
|
2001-03-21 09:01:02 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_FRAME_NAME:
|
|
|
|
sFrameName = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_APPLET_NAME:
|
|
|
|
sAppletName = rValue;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_ANCHOR_TYPE:
|
|
|
|
if( TextContentAnchorType_AT_PARAGRAPH == eAnchorType ||
|
|
|
|
TextContentAnchorType_AT_CHARACTER == eAnchorType ||
|
|
|
|
TextContentAnchorType_AS_CHARACTER == eAnchorType )
|
|
|
|
{
|
2001-03-13 14:50:56 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
TextContentAnchorType eNew;
|
2006-10-12 13:53:32 +00:00
|
|
|
if( XMLAnchorTypePropHdl::convert( rValue, eNew ) &&
|
2000-09-18 16:07:07 +00:00
|
|
|
( TextContentAnchorType_AT_PARAGRAPH == eNew ||
|
|
|
|
TextContentAnchorType_AT_CHARACTER == eNew ||
|
2001-03-13 14:50:56 +00:00
|
|
|
TextContentAnchorType_AS_CHARACTER == eNew ||
|
|
|
|
TextContentAnchorType_AT_PAGE == eNew) )
|
2000-09-18 16:07:07 +00:00
|
|
|
eAnchorType = eNew;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER:
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
if( GetImport().GetMM100UnitConverter().
|
|
|
|
convertNumber( nTmp, rValue, 1, SHRT_MAX ) )
|
|
|
|
nPage = (sal_Int16)nTmp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_X:
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nX, rValue );
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_Y:
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nY, rValue );
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_WIDTH:
|
2001-01-15 10:28:36 +00:00
|
|
|
// relative widths are obsolete since SRC617. Remove them some day!
|
|
|
|
if( rValue.indexOf( '%' ) != -1 )
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
GetImport().GetMM100UnitConverter().convertPercent( nTmp,
|
|
|
|
rValue );
|
2001-03-23 15:30:35 +00:00
|
|
|
nRelWidth = (sal_Int16)nTmp;
|
2001-01-15 10:28:36 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
|
|
|
|
rValue, 0 );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
2001-01-15 10:28:36 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_REL_WIDTH:
|
2001-06-29 20:07:26 +00:00
|
|
|
if( IsXMLToken(rValue, XML_SCALE) )
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
bSyncWidth = sal_True;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
if( GetImport().GetMM100UnitConverter().
|
|
|
|
convertPercent( nTmp, rValue ) )
|
2001-03-23 15:30:35 +00:00
|
|
|
nRelWidth = (sal_Int16)nTmp;
|
2001-01-15 10:28:36 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
2004-05-18 14:04:35 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_MIN_WIDTH:
|
|
|
|
if( rValue.indexOf( '%' ) != -1 )
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
GetImport().GetMM100UnitConverter().convertPercent( nTmp,
|
|
|
|
rValue );
|
|
|
|
nRelWidth = (sal_Int16)nTmp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
|
|
|
|
rValue, 0 );
|
|
|
|
}
|
|
|
|
bMinWidth = sal_True;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_HEIGHT:
|
2001-01-15 10:28:36 +00:00
|
|
|
// relative heights are obsolete since SRC617. Remove them some day!
|
|
|
|
if( rValue.indexOf( '%' ) != -1 )
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
GetImport().GetMM100UnitConverter().convertPercent( nTmp,
|
|
|
|
rValue );
|
2001-03-23 15:30:35 +00:00
|
|
|
nRelHeight = (sal_Int16)nTmp;
|
2001-01-15 10:28:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
|
|
|
|
rValue, 0 );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_REL_HEIGHT:
|
2001-06-29 20:07:26 +00:00
|
|
|
if( IsXMLToken( rValue, XML_SCALE ) )
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
bSyncHeight = sal_True;
|
|
|
|
}
|
2001-06-29 20:07:26 +00:00
|
|
|
else if( IsXMLToken( rValue, XML_SCALE_MIN ) )
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
bSyncHeight = sal_True;
|
|
|
|
bMinHeight = sal_True;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
if( GetImport().GetMM100UnitConverter().
|
|
|
|
convertPercent( nTmp, rValue ) )
|
2001-03-23 15:30:35 +00:00
|
|
|
nRelHeight = (sal_Int16)nTmp;
|
2001-01-15 10:28:36 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_MIN_HEIGHT:
|
2001-01-15 10:28:36 +00:00
|
|
|
if( rValue.indexOf( '%' ) != -1 )
|
|
|
|
{
|
|
|
|
sal_Int32 nTmp;
|
|
|
|
GetImport().GetMM100UnitConverter().convertPercent( nTmp,
|
|
|
|
rValue );
|
2001-03-23 15:30:35 +00:00
|
|
|
nRelHeight = (sal_Int16)nTmp;
|
2001-01-15 10:28:36 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2001-01-15 10:28:36 +00:00
|
|
|
{
|
|
|
|
GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
|
|
|
|
rValue, 0 );
|
|
|
|
}
|
|
|
|
bMinHeight = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
2000-12-06 10:41:56 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_Z_INDEX:
|
|
|
|
GetImport().GetMM100UnitConverter().convertNumber( nZIndex, rValue, -1 );
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME:
|
2001-05-09 11:22:39 +00:00
|
|
|
sNextName = rValue;
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_HREF:
|
|
|
|
sHRef = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_FILTER_NAME:
|
|
|
|
sFilterName = rValue;
|
|
|
|
break;
|
2000-12-18 12:25:02 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_TRANSFORM:
|
|
|
|
{
|
|
|
|
OUString sValue( rValue );
|
|
|
|
sValue.trim();
|
|
|
|
const sal_Int32 nRotateLen = sizeof(sXML_rotate)-1;
|
|
|
|
sal_Int32 nLen = sValue.getLength();
|
|
|
|
if( nLen >= nRotateLen+3 &&
|
|
|
|
0 == sValue.compareToAscii( sXML_rotate, nRotateLen ) &&
|
|
|
|
'(' == sValue[nRotateLen] &&
|
|
|
|
')' == sValue[nLen-1] )
|
|
|
|
{
|
|
|
|
sValue = sValue.copy( nRotateLen+1, nLen-(nRotateLen+2) );
|
|
|
|
sValue.trim();
|
|
|
|
sal_Int32 nVal;
|
|
|
|
if( GetImport().GetMM100UnitConverter().convertNumber( nVal, sValue ) )
|
|
|
|
nRotation = (sal_Int16)(nVal % 360 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2001-02-23 13:39:25 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_CODE:
|
|
|
|
sCode = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_OBJECT:
|
|
|
|
sObject = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_ARCHIVE:
|
|
|
|
sArchive = rValue;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_MAY_SCRIPT:
|
2001-06-29 20:07:26 +00:00
|
|
|
bMayScript = IsXMLToken( rValue, XML_TRUE );
|
2001-02-23 13:39:25 +00:00
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_MIME_TYPE:
|
|
|
|
sMimeType = rValue;
|
|
|
|
break;
|
2001-06-28 12:21:55 +00:00
|
|
|
case XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE:
|
|
|
|
sTblName = rValue;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-12 06:35:19 +00:00
|
|
|
if( ( (XML_TEXT_FRAME_GRAPHIC == nType ||
|
2001-11-12 13:23:47 +00:00
|
|
|
XML_TEXT_FRAME_OBJECT == nType ||
|
|
|
|
XML_TEXT_FRAME_OBJECT_OLE == nType) &&
|
|
|
|
!sHRef.getLength() ) ||
|
2003-06-12 06:35:19 +00:00
|
|
|
( XML_TEXT_FRAME_APPLET == nType && !sCode.getLength() ) ||
|
|
|
|
( XML_TEXT_FRAME_PLUGIN == nType &&
|
|
|
|
sHRef.getLength() == 0 && sMimeType.getLength() == 0 ) )
|
2001-02-23 13:39:25 +00:00
|
|
|
return; // no URL: no image or OLE object
|
2000-11-16 12:50:03 +00:00
|
|
|
|
2001-05-09 11:22:39 +00:00
|
|
|
Create( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
XMLTextFrameContext_Impl::~XMLTextFrameContext_Impl()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
void XMLTextFrameContext_Impl::EndElement()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-10-31 09:26:33 +00:00
|
|
|
CreateIfNotThere();
|
2001-05-18 12:58:34 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if( xOldTextCursor.is() )
|
|
|
|
{
|
2001-03-09 06:23:23 +00:00
|
|
|
GetImport().GetTextImport()->DeleteParagraph();
|
2000-09-18 16:07:07 +00:00
|
|
|
GetImport().GetTextImport()->SetCursor( xOldTextCursor );
|
|
|
|
}
|
2001-07-25 12:29:47 +00:00
|
|
|
|
|
|
|
// reinstall old list item (if necessary) #89892#
|
2008-10-01 06:34:11 +00:00
|
|
|
if (mbListContextPushed) {
|
|
|
|
GetImport().GetTextImport()->PopListContext();
|
2001-07-25 12:29:47 +00:00
|
|
|
}
|
|
|
|
|
2001-03-09 14:59:46 +00:00
|
|
|
if (( nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN ) && xPropSet.is())
|
|
|
|
GetImport().GetTextImport()->endAppletOrPlugin( xPropSet, aParamMap);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
SvXMLImportContext *XMLTextFrameContext_Impl::CreateChildContext(
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
|
|
|
const Reference< XAttributeList > & xAttrList )
|
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = 0;
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
if( XML_NAMESPACE_DRAW == nPrefix )
|
2000-11-16 12:23:56 +00:00
|
|
|
{
|
2001-02-23 13:39:25 +00:00
|
|
|
if ( (nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN) &&
|
2001-06-29 20:07:26 +00:00
|
|
|
IsXMLToken( rLocalName, XML_PARAM ) )
|
2001-02-23 13:39:25 +00:00
|
|
|
{
|
|
|
|
pContext = new XMLTextFrameParam_Impl( GetImport(),
|
|
|
|
nPrefix, rLocalName,
|
2001-03-09 14:59:46 +00:00
|
|
|
xAttrList, nType, aParamMap );
|
2001-02-23 13:39:25 +00:00
|
|
|
}
|
2000-11-16 12:23:56 +00:00
|
|
|
}
|
2001-06-19 14:08:23 +00:00
|
|
|
else if( (XML_NAMESPACE_OFFICE == nPrefix) )
|
2000-12-19 17:56:47 +00:00
|
|
|
{
|
2004-07-13 07:36:31 +00:00
|
|
|
if( IsXMLToken( rLocalName, XML_BINARY_DATA ) )
|
2000-12-19 17:56:47 +00:00
|
|
|
{
|
2002-10-31 09:26:33 +00:00
|
|
|
if( !xPropSet.is() && !xBase64Stream.is() && !bCreateFailed )
|
2000-12-19 17:56:47 +00:00
|
|
|
{
|
2001-06-19 14:08:23 +00:00
|
|
|
switch( nType )
|
|
|
|
{
|
|
|
|
case XML_TEXT_FRAME_GRAPHIC:
|
2005-01-27 10:09:50 +00:00
|
|
|
xBase64Stream =
|
|
|
|
GetImport().GetStreamForGraphicObjectURLFromBase64();
|
2001-06-19 14:08:23 +00:00
|
|
|
break;
|
|
|
|
case XML_TEXT_FRAME_OBJECT_OLE:
|
|
|
|
xBase64Stream =
|
2005-01-27 10:09:50 +00:00
|
|
|
GetImport().GetStreamForEmbeddedObjectURLFromBase64();
|
2001-06-19 14:08:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( xBase64Stream.is() )
|
|
|
|
pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
|
|
|
|
rLocalName, xAttrList,
|
|
|
|
xBase64Stream );
|
2000-12-19 17:56:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-27 14:36:29 +00:00
|
|
|
// --> OD 2009-08-17 #i100480#
|
|
|
|
// correction of condition which also avoids warnings.
|
2001-06-20 07:42:01 +00:00
|
|
|
if( !pContext &&
|
2009-08-27 14:36:29 +00:00
|
|
|
( XML_TEXT_FRAME_OBJECT == nType &&
|
|
|
|
( ( XML_NAMESPACE_OFFICE == nPrefix &&
|
|
|
|
IsXMLToken( rLocalName, XML_DOCUMENT ) ) ||
|
|
|
|
( XML_NAMESPACE_MATH == nPrefix &&
|
|
|
|
IsXMLToken( rLocalName, XML_MATH ) ) ) ) )
|
|
|
|
// <--
|
2001-05-09 11:22:39 +00:00
|
|
|
{
|
2002-10-31 09:26:33 +00:00
|
|
|
if( !xPropSet.is() && !bCreateFailed )
|
2001-05-09 11:22:39 +00:00
|
|
|
{
|
|
|
|
XMLEmbeddedObjectImportContext *pEContext =
|
|
|
|
new XMLEmbeddedObjectImportContext( GetImport(), nPrefix,
|
|
|
|
rLocalName, xAttrList );
|
|
|
|
sFilterService = pEContext->GetFilterServiceName();
|
|
|
|
if( sFilterService.getLength() != 0 )
|
|
|
|
{
|
|
|
|
Create( sal_False );
|
|
|
|
if( xPropSet.is() )
|
|
|
|
{
|
|
|
|
Reference < XEmbeddedObjectSupplier > xEOS( xPropSet,
|
|
|
|
UNO_QUERY );
|
|
|
|
OSL_ENSURE( xEOS.is(),
|
|
|
|
"no embedded object supplier for own object" );
|
2001-10-10 14:57:21 +00:00
|
|
|
Reference<com::sun::star::lang::XComponent> aXComponent(xEOS->getEmbeddedObject());
|
|
|
|
pEContext->SetComponent( aXComponent );
|
2001-05-09 11:22:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pContext = pEContext;
|
|
|
|
}
|
|
|
|
}
|
2001-03-14 09:30:23 +00:00
|
|
|
if( !pContext && xOldTextCursor.is() ) // text-box
|
2000-09-18 16:07:07 +00:00
|
|
|
pContext = GetImport().GetTextImport()->CreateTextChildContext(
|
|
|
|
GetImport(), nPrefix, rLocalName, xAttrList,
|
|
|
|
XML_TEXT_TYPE_TEXTBOX );
|
|
|
|
|
|
|
|
if( !pContext )
|
|
|
|
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
|
|
|
|
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
void XMLTextFrameContext_Impl::Characters( const OUString& rChars )
|
2001-05-18 12:58:34 +00:00
|
|
|
{
|
2001-06-19 14:08:23 +00:00
|
|
|
if( ( XML_TEXT_FRAME_OBJECT_OLE == nType ||
|
|
|
|
XML_TEXT_FRAME_GRAPHIC == nType) &&
|
2002-10-31 09:26:33 +00:00
|
|
|
!xPropSet.is() && !bCreateFailed )
|
2001-05-18 12:58:34 +00:00
|
|
|
{
|
|
|
|
OUString sTrimmedChars( rChars. trim() );
|
|
|
|
if( sTrimmedChars.getLength() )
|
|
|
|
{
|
2002-10-31 09:26:33 +00:00
|
|
|
if( !xBase64Stream.is() )
|
2001-05-18 12:58:34 +00:00
|
|
|
{
|
2001-06-19 14:08:23 +00:00
|
|
|
if( XML_TEXT_FRAME_GRAPHIC == nType )
|
|
|
|
{
|
2005-01-27 10:09:50 +00:00
|
|
|
xBase64Stream =
|
|
|
|
GetImport().GetStreamForGraphicObjectURLFromBase64();
|
2001-06-19 14:08:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xBase64Stream =
|
2005-01-27 10:09:50 +00:00
|
|
|
GetImport().GetStreamForEmbeddedObjectURLFromBase64();
|
2001-06-19 14:08:23 +00:00
|
|
|
}
|
|
|
|
if( xBase64Stream.is() )
|
|
|
|
bOwnBase64Stream = sal_True;
|
2001-05-18 12:58:34 +00:00
|
|
|
}
|
2001-06-19 14:08:23 +00:00
|
|
|
if( bOwnBase64Stream && xBase64Stream.is() )
|
2001-05-18 12:58:34 +00:00
|
|
|
{
|
|
|
|
OUString sChars;
|
|
|
|
if( sBase64CharsLeft )
|
|
|
|
{
|
|
|
|
sChars = sBase64CharsLeft;
|
|
|
|
sChars += sTrimmedChars;
|
|
|
|
sBase64CharsLeft = OUString();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sChars = sTrimmedChars;
|
|
|
|
}
|
|
|
|
Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
|
|
|
|
sal_Int32 nCharsDecoded =
|
|
|
|
GetImport().GetMM100UnitConverter().
|
|
|
|
decodeBase64SomeChars( aBuffer, sChars );
|
2001-06-19 14:08:23 +00:00
|
|
|
xBase64Stream->writeBytes( aBuffer );
|
2001-05-18 12:58:34 +00:00
|
|
|
if( nCharsDecoded != sChars.getLength() )
|
|
|
|
sBase64CharsLeft = sChars.copy( nCharsDecoded );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef,
|
2000-09-26 07:10:55 +00:00
|
|
|
const OUString& rName,
|
|
|
|
const OUString& rTargetFrameName,
|
|
|
|
sal_Bool bMap )
|
|
|
|
{
|
|
|
|
if( !xPropSet.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
UniReference< XMLTextImportHelper > xTxtImp = GetImport().GetTextImport();
|
|
|
|
Reference < XPropertySetInfo > xPropSetInfo =
|
|
|
|
xPropSet->getPropertySetInfo();
|
|
|
|
if( !xPropSetInfo.is() ||
|
|
|
|
!xPropSetInfo->hasPropertyByName( xTxtImp->sHyperLinkURL ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
Any aAny;
|
|
|
|
aAny <<= rHRef;
|
|
|
|
xPropSet->setPropertyValue( xTxtImp->sHyperLinkURL, aAny );
|
|
|
|
|
|
|
|
if( xPropSetInfo->hasPropertyByName( xTxtImp->sHyperLinkName ) )
|
|
|
|
{
|
|
|
|
aAny <<= rName;
|
|
|
|
xPropSet->setPropertyValue( xTxtImp->sHyperLinkName, aAny );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( xPropSetInfo->hasPropertyByName( xTxtImp->sHyperLinkTarget ) )
|
|
|
|
{
|
|
|
|
aAny <<= rTargetFrameName;
|
|
|
|
xPropSet->setPropertyValue( xTxtImp->sHyperLinkTarget, aAny );
|
|
|
|
}
|
|
|
|
|
2000-11-20 12:01:35 +00:00
|
|
|
if( xPropSetInfo->hasPropertyByName( xTxtImp->sServerMap ) )
|
|
|
|
{
|
|
|
|
aAny.setValue( &bMap, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( xTxtImp->sServerMap, aAny );
|
|
|
|
}
|
2000-09-26 07:10:55 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
void XMLTextFrameContext_Impl::SetTitle( const OUString& rTitle )
|
|
|
|
{
|
|
|
|
if ( xPropSet.is() )
|
|
|
|
{
|
|
|
|
Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sTitle ) )
|
|
|
|
{
|
|
|
|
xPropSet->setPropertyValue( sTitle, makeAny( rTitle ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
void XMLTextFrameContext_Impl::SetDesc( const OUString& rDesc )
|
|
|
|
{
|
|
|
|
if ( xPropSet.is() )
|
|
|
|
{
|
2009-08-27 11:59:20 +00:00
|
|
|
Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sDescription ) )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
2009-08-27 11:59:20 +00:00
|
|
|
xPropSet->setPropertyValue( sDescription, makeAny( rDesc ) );
|
2004-07-13 07:36:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-27 11:59:20 +00:00
|
|
|
// <--
|
2004-07-13 07:36:31 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TYPEINIT1( XMLTextFrameContext, SvXMLImportContext );
|
|
|
|
|
|
|
|
sal_Bool XMLTextFrameContext::CreateIfNotThere()
|
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
SvXMLImportContext *pContext = &m_xImplContext;
|
|
|
|
XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
|
|
|
|
if( pImpl )
|
|
|
|
bRet = pImpl->CreateIfNotThere();
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool XMLTextFrameContext::CreateIfNotThere( ::com::sun::star::uno::Reference <
|
|
|
|
::com::sun::star::beans::XPropertySet >& rPropSet )
|
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = &m_xImplContext;
|
|
|
|
XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
|
|
|
|
if( pImpl )
|
|
|
|
{
|
|
|
|
if( pImpl->CreateIfNotThere() )
|
|
|
|
rPropSet = pImpl->GetPropSet();
|
|
|
|
}
|
|
|
|
|
|
|
|
return rPropSet.is();
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLTextFrameContext::XMLTextFrameContext(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx, const OUString& rLName,
|
|
|
|
const Reference< XAttributeList > & xAttrList,
|
2006-06-19 17:45:40 +00:00
|
|
|
TextContentAnchorType eATyp )
|
|
|
|
: SvXMLImportContext( rImport, nPrfx, rLName )
|
|
|
|
, m_xAttrList( new SvXMLAttributeList( xAttrList ) )
|
|
|
|
, m_pHyperlink( 0 )
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
, m_sTitle()
|
|
|
|
, m_sDesc()
|
|
|
|
// <--
|
2006-06-19 17:45:40 +00:00
|
|
|
, m_eDefaultAnchorType( eATyp )
|
2006-03-27 09:04:49 +00:00
|
|
|
// --> OD 2006-03-10 #i51726#
|
2006-06-19 17:45:40 +00:00
|
|
|
, m_HasAutomaticStyleWithoutParentStyle( sal_False )
|
2006-03-27 09:04:49 +00:00
|
|
|
// <--
|
2006-06-19 17:45:40 +00:00
|
|
|
, m_bSupportsReplacement( sal_False )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
|
|
|
|
for( sal_Int16 i=0; i < nAttrCount; i++ )
|
|
|
|
{
|
|
|
|
const OUString& rAttrName = xAttrList->getNameByIndex( i );
|
|
|
|
|
|
|
|
OUString aLocalName;
|
|
|
|
sal_uInt16 nPrefix =
|
|
|
|
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
|
2006-03-27 09:04:49 +00:00
|
|
|
// --> OD 2006-03-10 #i51726#
|
|
|
|
// New distinguish attribute between Writer objects and Draw objects is:
|
|
|
|
// Draw objects have an automatic style without a parent style
|
|
|
|
if ( XML_NAMESPACE_DRAW == nPrefix &&
|
|
|
|
IsXMLToken( aLocalName, XML_STYLE_NAME ) )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
2006-03-27 09:04:49 +00:00
|
|
|
OUString aStyleName = xAttrList->getValueByIndex( i );
|
|
|
|
if( aStyleName.getLength() )
|
|
|
|
{
|
|
|
|
UniReference < XMLTextImportHelper > xTxtImport =
|
|
|
|
GetImport().GetTextImport();
|
|
|
|
XMLPropStyleContext* pStyle( 0L );
|
|
|
|
pStyle = xTxtImport->FindAutoFrameStyle( aStyleName );
|
|
|
|
if ( pStyle && !pStyle->GetParentName().getLength() )
|
|
|
|
{
|
|
|
|
m_HasAutomaticStyleWithoutParentStyle = sal_True;
|
|
|
|
}
|
|
|
|
}
|
2004-07-13 07:36:31 +00:00
|
|
|
}
|
2006-03-27 09:04:49 +00:00
|
|
|
// <--
|
|
|
|
else if ( XML_NAMESPACE_TEXT == nPrefix &&
|
|
|
|
IsXMLToken( aLocalName, XML_ANCHOR_TYPE ) )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
TextContentAnchorType eNew;
|
|
|
|
if( XMLAnchorTypePropHdl::convert( xAttrList->getValueByIndex(i),
|
2006-10-12 13:53:32 +00:00
|
|
|
eNew ) &&
|
2004-07-13 07:36:31 +00:00
|
|
|
( TextContentAnchorType_AT_PARAGRAPH == eNew ||
|
|
|
|
TextContentAnchorType_AT_CHARACTER == eNew ||
|
|
|
|
TextContentAnchorType_AS_CHARACTER == eNew ||
|
|
|
|
TextContentAnchorType_AT_PAGE == eNew) )
|
|
|
|
m_eDefaultAnchorType = eNew;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLTextFrameContext::~XMLTextFrameContext()
|
|
|
|
{
|
|
|
|
delete m_pHyperlink;
|
|
|
|
}
|
|
|
|
|
|
|
|
void XMLTextFrameContext::EndElement()
|
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = &m_xImplContext;
|
|
|
|
XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
|
|
|
|
if( pImpl )
|
|
|
|
{
|
|
|
|
pImpl->CreateIfNotThere();
|
|
|
|
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
// // alternative text
|
|
|
|
// if( m_sDesc.getLength() )
|
|
|
|
// pImpl->SetDesc( m_sDesc );
|
|
|
|
// svg:title
|
|
|
|
if( m_sTitle.getLength() )
|
|
|
|
{
|
|
|
|
pImpl->SetTitle( m_sTitle );
|
|
|
|
}
|
2004-07-13 07:36:31 +00:00
|
|
|
if( m_sDesc.getLength() )
|
2009-08-27 11:59:20 +00:00
|
|
|
{
|
2004-07-13 07:36:31 +00:00
|
|
|
pImpl->SetDesc( m_sDesc );
|
2009-08-27 11:59:20 +00:00
|
|
|
}
|
|
|
|
// <--
|
2004-07-13 07:36:31 +00:00
|
|
|
|
|
|
|
if( m_pHyperlink )
|
|
|
|
{
|
|
|
|
pImpl->SetHyperlink( m_pHyperlink->GetHRef(), m_pHyperlink->GetName(),
|
|
|
|
m_pHyperlink->GetTargetFrameName(), m_pHyperlink->GetMap() );
|
|
|
|
delete m_pHyperlink;
|
|
|
|
m_pHyperlink = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *XMLTextFrameContext::CreateChildContext(
|
2006-06-19 17:45:40 +00:00
|
|
|
sal_uInt16 p_nPrefix,
|
2004-07-13 07:36:31 +00:00
|
|
|
const OUString& rLocalName,
|
|
|
|
const Reference< XAttributeList > & xAttrList )
|
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = 0;
|
|
|
|
|
|
|
|
if( !m_xImplContext.Is() )
|
|
|
|
{
|
|
|
|
// no child exists
|
2006-06-19 17:45:40 +00:00
|
|
|
if( XML_NAMESPACE_DRAW == p_nPrefix )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
sal_uInt16 nFrameType = USHRT_MAX;
|
|
|
|
if( IsXMLToken( rLocalName, XML_TEXT_BOX ) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_TEXTBOX;
|
|
|
|
else if( IsXMLToken( rLocalName, XML_IMAGE ) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_GRAPHIC;
|
|
|
|
else if( IsXMLToken( rLocalName, XML_OBJECT ) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_OBJECT;
|
|
|
|
else if( IsXMLToken( rLocalName, XML_OBJECT_OLE ) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_OBJECT_OLE;
|
|
|
|
else if( IsXMLToken( rLocalName, XML_APPLET) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_APPLET;
|
|
|
|
else if( IsXMLToken( rLocalName, XML_PLUGIN ) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_PLUGIN;
|
|
|
|
else if( IsXMLToken( rLocalName, XML_FLOATING_FRAME ) )
|
|
|
|
nFrameType = XML_TEXT_FRAME_FLOATING_FRAME;
|
|
|
|
|
|
|
|
if( USHRT_MAX != nFrameType )
|
|
|
|
{
|
2006-03-27 09:04:49 +00:00
|
|
|
// --> OD 2006-03-10 #i51726#
|
|
|
|
if ( ( XML_TEXT_FRAME_TEXTBOX == nFrameType ||
|
|
|
|
XML_TEXT_FRAME_GRAPHIC == nFrameType ) &&
|
|
|
|
m_HasAutomaticStyleWithoutParentStyle )
|
|
|
|
// <--
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
Reference < XShapes > xShapes;
|
|
|
|
pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
|
2006-06-19 17:45:40 +00:00
|
|
|
GetImport(), p_nPrefix, rLocalName, xAttrList, xShapes, m_xAttrList );
|
2004-07-13 07:36:31 +00:00
|
|
|
}
|
2004-08-12 07:51:02 +00:00
|
|
|
else if( XML_TEXT_FRAME_PLUGIN == nFrameType )
|
|
|
|
{
|
|
|
|
bool bMedia = false;
|
|
|
|
|
|
|
|
// check, 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" ) )
|
|
|
|
bMedia = true;
|
|
|
|
|
|
|
|
// leave this loop
|
|
|
|
n = nAttrCount - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bMedia )
|
|
|
|
{
|
|
|
|
Reference < XShapes > xShapes;
|
|
|
|
pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
|
2006-06-19 17:45:40 +00:00
|
|
|
GetImport(), p_nPrefix, rLocalName, xAttrList, xShapes, m_xAttrList );
|
2004-08-12 07:51:02 +00:00
|
|
|
}
|
|
|
|
}
|
2004-11-26 12:05:08 +00:00
|
|
|
else if( XML_TEXT_FRAME_OBJECT == nFrameType ||
|
|
|
|
XML_TEXT_FRAME_OBJECT_OLE == nFrameType )
|
|
|
|
{
|
|
|
|
m_bSupportsReplacement = sal_True;
|
|
|
|
}
|
2004-08-12 07:51:02 +00:00
|
|
|
|
|
|
|
if( !pContext )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
|
2006-06-19 17:45:40 +00:00
|
|
|
pContext = new XMLTextFrameContext_Impl( GetImport(), p_nPrefix,
|
2004-07-13 07:36:31 +00:00
|
|
|
rLocalName, xAttrList,
|
|
|
|
m_eDefaultAnchorType,
|
|
|
|
nFrameType,
|
|
|
|
m_xAttrList );
|
|
|
|
}
|
2004-08-12 07:51:02 +00:00
|
|
|
|
2004-07-13 07:36:31 +00:00
|
|
|
m_xImplContext = pContext;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-11-26 12:05:08 +00:00
|
|
|
else if( m_bSupportsReplacement && !m_xReplImplContext &&
|
2006-06-19 17:45:40 +00:00
|
|
|
XML_NAMESPACE_DRAW == p_nPrefix &&
|
2004-11-26 12:05:08 +00:00
|
|
|
IsXMLToken( rLocalName, XML_IMAGE ) )
|
|
|
|
{
|
|
|
|
// read replacement image
|
|
|
|
Reference < XPropertySet > xPropSet;
|
|
|
|
if( CreateIfNotThere( xPropSet ) )
|
|
|
|
{
|
|
|
|
pContext = new XMLReplacementImageContext( GetImport(),
|
2006-06-19 17:45:40 +00:00
|
|
|
p_nPrefix, rLocalName, xAttrList, xPropSet );
|
2004-11-26 12:05:08 +00:00
|
|
|
m_xReplImplContext = pContext;
|
|
|
|
}
|
|
|
|
}
|
2004-07-13 07:36:31 +00:00
|
|
|
else if( m_xImplContext->ISA( XMLTextFrameContext_Impl ) )
|
|
|
|
{
|
|
|
|
// the child is a writer frame
|
2008-06-06 08:27:53 +00:00
|
|
|
if( XML_NAMESPACE_SVG == p_nPrefix )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
2009-08-27 11:59:20 +00:00
|
|
|
// --> OD 2009-07-22 #i73249#
|
|
|
|
// bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion();
|
|
|
|
// if( IsXMLToken( rLocalName, bOld ? XML_DESC : XML_TITLE ) )
|
|
|
|
// pContext = new XMLTextFrameDescContext_Impl( GetImport(), p_nPrefix, rLocalName,
|
|
|
|
// xAttrList, m_sDesc );
|
|
|
|
const bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion();
|
|
|
|
if ( bOld )
|
|
|
|
{
|
|
|
|
if ( IsXMLToken( rLocalName, XML_DESC ) )
|
|
|
|
{
|
|
|
|
pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
|
|
|
|
p_nPrefix,
|
|
|
|
rLocalName,
|
|
|
|
m_sTitle );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( IsXMLToken( rLocalName, XML_TITLE ) )
|
|
|
|
{
|
|
|
|
pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
|
|
|
|
p_nPrefix,
|
|
|
|
rLocalName,
|
|
|
|
m_sTitle );
|
|
|
|
}
|
|
|
|
else if ( IsXMLToken( rLocalName, XML_DESC ) )
|
|
|
|
{
|
|
|
|
pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
|
|
|
|
p_nPrefix,
|
|
|
|
rLocalName,
|
|
|
|
m_sDesc );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
2004-07-13 07:36:31 +00:00
|
|
|
}
|
2006-06-19 17:45:40 +00:00
|
|
|
else if( XML_NAMESPACE_DRAW == p_nPrefix )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
Reference < XPropertySet > xPropSet;
|
|
|
|
if( IsXMLToken( rLocalName, XML_CONTOUR_POLYGON ) )
|
|
|
|
{
|
|
|
|
if( CreateIfNotThere( xPropSet ) )
|
2006-06-19 17:45:40 +00:00
|
|
|
pContext = new XMLTextFrameContourContext_Impl( GetImport(), p_nPrefix, rLocalName,
|
2004-07-13 07:36:31 +00:00
|
|
|
xAttrList, xPropSet, sal_False );
|
|
|
|
}
|
|
|
|
else if( IsXMLToken( rLocalName, XML_CONTOUR_PATH ) )
|
|
|
|
{
|
|
|
|
if( CreateIfNotThere( xPropSet ) )
|
2006-06-19 17:45:40 +00:00
|
|
|
pContext = new XMLTextFrameContourContext_Impl( GetImport(), p_nPrefix, rLocalName,
|
2004-07-13 07:36:31 +00:00
|
|
|
xAttrList, xPropSet, sal_True );
|
|
|
|
}
|
|
|
|
else if( IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
|
|
|
|
{
|
|
|
|
if( CreateIfNotThere( xPropSet ) )
|
2006-06-19 17:45:40 +00:00
|
|
|
pContext = new XMLImageMapContext( GetImport(), p_nPrefix, rLocalName, xPropSet );
|
2004-07-13 07:36:31 +00:00
|
|
|
}
|
|
|
|
}
|
2006-06-19 17:45:40 +00:00
|
|
|
else if( (XML_NAMESPACE_OFFICE == p_nPrefix) && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
|
2004-07-13 07:36:31 +00:00
|
|
|
{
|
|
|
|
// do we still have the frame object?
|
|
|
|
Reference < XPropertySet > xPropSet;
|
|
|
|
if( CreateIfNotThere( xPropSet ) )
|
|
|
|
{
|
|
|
|
// is it an event supplier?
|
|
|
|
Reference<XEventsSupplier> xEventsSupplier(xPropSet, UNO_QUERY);
|
|
|
|
if (xEventsSupplier.is())
|
|
|
|
{
|
|
|
|
// OK, we have the events, so create the context
|
2006-06-19 17:45:40 +00:00
|
|
|
pContext = new XMLEventsImportContext(GetImport(), p_nPrefix,
|
2004-07-13 07:36:31 +00:00
|
|
|
rLocalName, xEventsSupplier);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-12-19 16:27:43 +00:00
|
|
|
else if( p_nPrefix == XML_NAMESPACE_SVG && // #i68101#
|
|
|
|
(IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
|
|
|
|
{
|
|
|
|
pContext = m_xImplContext->CreateChildContext( p_nPrefix, rLocalName, xAttrList );
|
|
|
|
}
|
2004-07-13 07:36:31 +00:00
|
|
|
else
|
|
|
|
{
|
2006-12-19 16:27:43 +00:00
|
|
|
// the child is a drawing shape
|
2004-07-13 07:36:31 +00:00
|
|
|
pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
|
2006-06-19 17:45:40 +00:00
|
|
|
&m_xImplContext, p_nPrefix, rLocalName, xAttrList );
|
2004-07-13 07:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !pContext )
|
2006-06-19 17:45:40 +00:00
|
|
|
pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
|
2004-07-13 07:36:31 +00:00
|
|
|
|
|
|
|
return pContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
void XMLTextFrameContext::SetHyperlink( const OUString& rHRef,
|
|
|
|
const OUString& rName,
|
|
|
|
const OUString& rTargetFrameName,
|
|
|
|
sal_Bool bMap )
|
|
|
|
{
|
|
|
|
OSL_ENSURE( !m_pHyperlink, "recursive SetHyperlink call" );
|
|
|
|
delete m_pHyperlink;
|
|
|
|
m_pHyperlink = new XMLTextFrameContextHyperlink_Impl(
|
|
|
|
rHRef, rName, rTargetFrameName, bMap );
|
|
|
|
}
|
|
|
|
|
|
|
|
TextContentAnchorType XMLTextFrameContext::GetAnchorType() const
|
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = &m_xImplContext;
|
|
|
|
XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
|
|
|
|
if( pImpl )
|
|
|
|
return pImpl->GetAnchorType();
|
|
|
|
else
|
|
|
|
return m_eDefaultAnchorType;
|
|
|
|
}
|
|
|
|
|
2001-04-25 12:35:19 +00:00
|
|
|
Reference < XTextContent > XMLTextFrameContext::GetTextContent() const
|
|
|
|
{
|
2004-07-13 07:36:31 +00:00
|
|
|
Reference < XTextContent > xTxtCntnt;
|
|
|
|
SvXMLImportContext *pContext = &m_xImplContext;
|
|
|
|
XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
|
|
|
|
if( pImpl )
|
|
|
|
xTxtCntnt.set( pImpl->GetPropSet(), UNO_QUERY );
|
|
|
|
|
|
|
|
return xTxtCntnt;
|
2001-04-25 12:35:19 +00:00
|
|
|
}
|
2004-09-09 09:48:00 +00:00
|
|
|
|
|
|
|
// --> OD 2004-08-24 #33242#
|
|
|
|
Reference < XShape > XMLTextFrameContext::GetShape() const
|
|
|
|
{
|
|
|
|
Reference < XShape > xShape;
|
|
|
|
SvXMLImportContext* pContext = &m_xImplContext;
|
|
|
|
SvXMLShapeContext* pImpl = PTR_CAST( SvXMLShapeContext, pContext );
|
|
|
|
if ( pImpl )
|
|
|
|
{
|
|
|
|
xShape = pImpl->getShape();
|
|
|
|
}
|
|
|
|
|
|
|
|
return xShape;
|
|
|
|
}
|
|
|
|
// <--
|