2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: XMLTextFrameContext.cxx,v $
|
|
|
|
*
|
2001-05-04 08:49:55 +00:00
|
|
|
* $Revision: 1.40 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2001-05-04 08:49:55 +00:00
|
|
|
* last change: $Author: mib $ $Date: 2001-05-04 09:49:55 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
|
|
|
|
#include <com/sun/star/text/TextContentAnchorType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_TEXT_XTEXTFRAME_HPP_
|
|
|
|
#include <com/sun/star/text/XTextFrame.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
|
|
|
|
#include <com/sun/star/container/XNamed.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HPP_
|
|
|
|
#include <com/sun/star/text/SizeType.hpp>
|
|
|
|
#endif
|
2000-12-06 10:41:56 +00:00
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_
|
|
|
|
#include <com/sun/star/drawing/XShape.hpp>
|
|
|
|
#endif
|
2001-01-30 12:10:00 +00:00
|
|
|
#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
|
|
|
|
#include <com/sun/star/document/XEventsSupplier.hpp>
|
2000-12-19 17:56:47 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _XMLOFF_XMLIMP_HXX
|
|
|
|
#include "xmlimp.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLNMSPE_HXX
|
|
|
|
#include "xmlnmspe.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLKYWD_HXX
|
|
|
|
#include "xmlkywd.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_NMSPMAP_HXX
|
|
|
|
#include "nmspmap.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLUCONV_HXX
|
|
|
|
#include "xmluconv.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLANCHORTYPEPROPHDL_HXX
|
|
|
|
#include "XMLAnchorTypePropHdl.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_PRSTYLEI_HXX_
|
|
|
|
#include "prstylei.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_I18NMAP_HXX
|
|
|
|
#include "i18nmap.hxx"
|
|
|
|
#endif
|
2000-11-16 12:23:56 +00:00
|
|
|
#ifndef _XEXPTRANSFORM_HXX
|
|
|
|
#include "xexptran.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_SHAPEIMPORT_HXX_
|
|
|
|
#include "shapeimport.hxx"
|
|
|
|
#endif
|
2000-12-19 17:56:47 +00:00
|
|
|
#ifndef _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX
|
|
|
|
#include "XMLEventsImportContext.hxx"
|
|
|
|
#endif
|
2001-03-29 15:26:25 +00:00
|
|
|
#ifndef _XMLOFF_XMLIMAGEMAPCONTEXT_HXX_
|
|
|
|
#include "XMLImageMapContext.hxx"
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#ifndef _XMLTEXTLISTBLOCKCONTEXT_HXX
|
|
|
|
#include "XMLTextFrameContext.hxx"
|
|
|
|
#endif
|
|
|
|
|
2000-12-19 17:56:47 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::rtl;
|
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-01-30 12:10:00 +00:00
|
|
|
using ::com::sun::star::document::XEventsSupplier;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
class XMLTextFrameDescContext_Impl : public SvXMLImportContext
|
|
|
|
{
|
|
|
|
OUString& rDesc;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
TYPEINFO();
|
|
|
|
|
|
|
|
XMLTextFrameDescContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
|
|
|
|
const ::rtl::OUString& rLName,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
|
|
|
|
OUString& rD );
|
|
|
|
virtual ~XMLTextFrameDescContext_Impl();
|
|
|
|
|
|
|
|
virtual void Characters( const OUString& rText );
|
|
|
|
};
|
|
|
|
|
|
|
|
TYPEINIT1( XMLTextFrameDescContext_Impl, SvXMLImportContext );
|
|
|
|
|
|
|
|
XMLTextFrameDescContext_Impl::XMLTextFrameDescContext_Impl(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx, const OUString& rLName,
|
|
|
|
const Reference< XAttributeList > & xAttrList,
|
|
|
|
OUString& rD ) :
|
|
|
|
SvXMLImportContext( rImport, nPrfx, rLName ),
|
|
|
|
rDesc( rD )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLTextFrameDescContext_Impl::~XMLTextFrameDescContext_Impl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void XMLTextFrameDescContext_Impl::Characters( const OUString& rText )
|
|
|
|
{
|
|
|
|
rDesc += rText;
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
};
|
|
|
|
TYPEINIT1( XMLTextFrameParam_Impl, SvXMLImportContext );
|
|
|
|
XMLTextFrameParam_Impl::~XMLTextFrameParam_Impl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
XMLTextFrameParam_Impl::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
|
|
|
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 );
|
|
|
|
if ( XML_NAMESPACE_DRAW == nPrefix && aLocalName.equalsAsciiL( sXML_value, sizeof(sXML_value) -1 ) )
|
2001-03-09 14:59:46 +00:00
|
|
|
{
|
|
|
|
sValue = rValue;
|
|
|
|
bFoundValue=sal_True;
|
|
|
|
}
|
2001-02-23 13:39:25 +00:00
|
|
|
else if ( XML_NAMESPACE_OFFICE == nPrefix && aLocalName.equalsAsciiL( sXML_name, sizeof( sXML_name) -1 ) )
|
2001-03-09 14:59:46 +00:00
|
|
|
sName = rValue;
|
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:
|
|
|
|
bAuto = rValue.equalsAsciiL( sXML_true, sizeof(sXML_true)-1 );
|
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
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TYPEINIT1( XMLTextFrameContext, SvXMLImportContext );
|
|
|
|
|
|
|
|
XMLTextFrameContext::XMLTextFrameContext(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrfx, const OUString& rLName,
|
|
|
|
const Reference< XAttributeList > & xAttrList,
|
|
|
|
TextContentAnchorType eATyp,
|
2001-02-23 13:39:25 +00:00
|
|
|
sal_uInt16 nNewType ) :
|
|
|
|
nType( nNewType ),
|
2001-04-25 12:35:19 +00:00
|
|
|
eAnchorType( eATyp ),
|
2000-09-18 16:07:07 +00:00
|
|
|
SvXMLImportContext( rImport, nPrfx, rLName ),
|
|
|
|
sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")),
|
|
|
|
sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")),
|
|
|
|
sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")),
|
|
|
|
sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight")),
|
|
|
|
sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType")),
|
2001-01-15 10:28:36 +00:00
|
|
|
sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight")),
|
|
|
|
sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth")),
|
2000-09-18 16:07:07 +00:00
|
|
|
sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")),
|
|
|
|
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")),
|
|
|
|
sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")),
|
2000-09-25 05:56:34 +00:00
|
|
|
sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")),
|
2000-12-18 12:25:02 +00:00
|
|
|
sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")),
|
2000-09-18 16:07:07 +00:00
|
|
|
sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")),
|
2000-10-12 14:34:21 +00:00
|
|
|
sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject"))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OUString sName;
|
|
|
|
OUString sStyleName;
|
|
|
|
OUString sChainNextName;
|
|
|
|
OUString sHRef;
|
|
|
|
OUString sFilterName;
|
2001-02-23 13:39:25 +00:00
|
|
|
OUString sCode;
|
|
|
|
OUString sObject;
|
|
|
|
OUString sArchive;
|
|
|
|
OUString sMimeType;
|
2001-03-21 09:01:02 +00:00
|
|
|
OUString sFrameName;
|
|
|
|
OUString sAppletName;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
sal_Int32 nX = 0;
|
|
|
|
sal_Int32 nY = 0;
|
|
|
|
sal_Int32 nWidth = 0;
|
|
|
|
sal_Int32 nHeight = 0;
|
2000-12-06 10:41:56 +00:00
|
|
|
sal_Int32 nZIndex = -1;
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Int16 nPage = 0;
|
2000-12-18 12:25:02 +00:00
|
|
|
sal_Int16 nRotation = 0;
|
2001-03-23 15:30:35 +00:00
|
|
|
sal_Int16 nRelWidth = 0;
|
|
|
|
sal_Int16 nRelHeight = 0;
|
2001-03-21 09:01:02 +00:00
|
|
|
sal_Bool bMayScript = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
2001-01-15 10:28:36 +00:00
|
|
|
sal_Bool bMinHeight = sal_False;
|
|
|
|
sal_Bool bSyncWidth = sal_False;
|
|
|
|
sal_Bool bSyncHeight = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
UniReference < XMLTextImportHelper > xTxtImport =
|
|
|
|
GetImport().GetTextImport();
|
|
|
|
const SvXMLTokenMap& rTokenMap =
|
|
|
|
xTxtImport->GetTextFrameAttrTokenMap();
|
|
|
|
|
|
|
|
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 );
|
|
|
|
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;
|
|
|
|
if( XMLAnchorTypePropHdl::convert( rValue,
|
|
|
|
GetImport().GetMM100UnitConverter(), eNew ) &&
|
|
|
|
( 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:
|
|
|
|
if( rValue.equalsAsciiL( sXML_scale, sizeof(sXML_scale)-1 ) )
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
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:
|
|
|
|
if( rValue.equalsAsciiL( sXML_scale, sizeof(sXML_scale)-1 ) )
|
|
|
|
{
|
|
|
|
bSyncHeight = sal_True;
|
|
|
|
}
|
|
|
|
else if( rValue.equalsAsciiL( sXML_scale_min,
|
|
|
|
sizeof(sXML_scale_min)-1 ) )
|
|
|
|
{
|
|
|
|
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:
|
|
|
|
sChainNextName = rValue;
|
|
|
|
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:
|
|
|
|
if ( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( sXML_true ) ) )
|
|
|
|
bMayScript = sal_True;
|
|
|
|
else
|
|
|
|
bMayScript = sal_False;
|
|
|
|
break;
|
|
|
|
case XML_TOK_TEXT_FRAME_MIME_TYPE:
|
|
|
|
sMimeType = rValue;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-09 14:59:46 +00:00
|
|
|
if( (XML_TEXT_FRAME_APPLET == nType || XML_TEXT_FRAME_PLUGIN == nType ||
|
2001-03-16 11:50:15 +00:00
|
|
|
XML_TEXT_FRAME_GRAPHIC == nType || XML_TEXT_FRAME_OBJECT == nType ||
|
|
|
|
XML_TEXT_FRAME_OBJECT_OLE == nType)
|
2000-11-27 12:37:09 +00:00
|
|
|
&& !sHRef.getLength() )
|
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-03-09 14:59:46 +00:00
|
|
|
switch ( nType)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-16 11:50:15 +00:00
|
|
|
case XML_TEXT_FRAME_OBJECT:
|
|
|
|
case XML_TEXT_FRAME_OBJECT_OLE:
|
2001-03-09 14:59:46 +00:00
|
|
|
{
|
2001-03-21 09:01:02 +00:00
|
|
|
OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef, OUString() ) );
|
2001-01-26 10:22:48 +00:00
|
|
|
|
2001-03-09 14:59:46 +00:00
|
|
|
if( sURL.getLength() )
|
2001-03-21 09:01:02 +00:00
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertOLEObject( GetImport(), sURL,
|
2001-03-21 12:40:51 +00:00
|
|
|
sStyleName,
|
2001-03-21 09:01:02 +00:00
|
|
|
nWidth, nHeight );
|
2001-03-09 14:59:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TEXT_FRAME_APPLET:
|
|
|
|
{
|
2001-03-21 09:01:02 +00:00
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertApplet( sAppletName, sCode,
|
|
|
|
bMayScript, sHRef,
|
|
|
|
nWidth, nHeight);
|
2001-03-09 14:59:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TEXT_FRAME_PLUGIN:
|
|
|
|
{
|
2001-03-21 09:01:02 +00:00
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertPlugin( sMimeType, sHRef,
|
|
|
|
nWidth, nHeight);
|
2001-02-23 13:39:25 +00:00
|
|
|
|
2001-03-09 14:59:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XML_TEXT_FRAME_FLOATING_FRAME:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-21 09:01:02 +00:00
|
|
|
xPropSet = GetImport().GetTextImport()
|
|
|
|
->createAndInsertFloatingFrame( sFrameName, sHRef,
|
|
|
|
sStyleName,
|
|
|
|
nWidth, nHeight);
|
2001-03-09 14:59:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(),
|
|
|
|
UNO_QUERY );
|
|
|
|
if( xFactory.is() )
|
2000-11-27 12:37:09 +00:00
|
|
|
{
|
2001-03-09 14:59:46 +00:00
|
|
|
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 );
|
2000-11-27 12:37:09 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !xPropSet.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
|
|
|
|
|
|
|
|
// set name
|
2001-03-21 09:01:02 +00:00
|
|
|
Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
|
|
|
|
if( xNamed.is() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-21 09:01:02 +00:00
|
|
|
OUString sOrigName( xNamed->getName() );
|
|
|
|
if( !sOrigName.getLength() ||
|
|
|
|
(sName.getLength() && sOrigName != sName) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OUString sOldName( sName );
|
|
|
|
sal_Int32 i = 0;
|
|
|
|
while( xTxtImport->HasFrameByName( sName ) )
|
|
|
|
{
|
|
|
|
sName = sOldName;
|
|
|
|
sName += OUString::valueOf( ++i );
|
|
|
|
}
|
|
|
|
xNamed->setName( sName );
|
|
|
|
if( sName != sOldName )
|
|
|
|
xTxtImport->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
|
|
|
|
sOldName, sName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// frame style
|
|
|
|
XMLPropStyleContext *pStyle = 0;
|
|
|
|
if( sStyleName.getLength() )
|
|
|
|
{
|
|
|
|
pStyle = xTxtImport->FindAutoFrameStyle( sStyleName );
|
|
|
|
if( pStyle )
|
|
|
|
sStyleName = pStyle->GetParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
Any aAny;
|
|
|
|
if( sStyleName.getLength() )
|
|
|
|
{
|
|
|
|
const Reference < XNameContainer > & rStyles =
|
|
|
|
xTxtImport->GetFrameStyles();
|
|
|
|
if( rStyles.is() &&
|
|
|
|
rStyles->hasByName( sStyleName ) )
|
|
|
|
{
|
|
|
|
aAny <<= sStyleName;
|
|
|
|
xPropSet->setPropertyValue( sFrameStyleName, aAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// hard properties
|
|
|
|
if( pStyle )
|
|
|
|
pStyle->FillPropertySet( xPropSet );
|
|
|
|
|
|
|
|
// anchor type
|
|
|
|
aAny <<= eAnchorType;
|
|
|
|
xPropSet->setPropertyValue( sAnchorType, aAny );
|
|
|
|
|
|
|
|
|
|
|
|
// x and y
|
|
|
|
aAny <<= nX;
|
|
|
|
xPropSet->setPropertyValue( sHoriOrientPosition, aAny );
|
|
|
|
aAny <<= nY;
|
|
|
|
xPropSet->setPropertyValue( sVertOrientPosition, aAny );
|
|
|
|
|
|
|
|
// width
|
2001-01-15 10:28:36 +00:00
|
|
|
if( nWidth > 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-15 10:28:36 +00:00
|
|
|
aAny <<= nWidth;
|
|
|
|
xPropSet->setPropertyValue( sWidth, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-01-15 10:28:36 +00:00
|
|
|
if( nRelWidth > 0 || nWidth > 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-15 10:28:36 +00:00
|
|
|
aAny <<= nRelWidth;
|
|
|
|
xPropSet->setPropertyValue( sRelativeWidth, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-01-15 10:28:36 +00:00
|
|
|
if( bSyncWidth || nWidth > 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-15 10:28:36 +00:00
|
|
|
aAny.setValue( &bSyncWidth, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( sIsSyncWidthToHeight, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( nHeight > 0 )
|
|
|
|
{
|
2001-01-15 10:28:36 +00:00
|
|
|
aAny <<= nHeight;
|
|
|
|
xPropSet->setPropertyValue( sHeight, aAny );
|
|
|
|
}
|
|
|
|
if( nRelHeight > 0 || nHeight > 0 )
|
|
|
|
{
|
|
|
|
aAny <<= nRelHeight;
|
|
|
|
xPropSet->setPropertyValue( sRelativeHeight, aAny );
|
|
|
|
}
|
|
|
|
if( bSyncHeight || nHeight > 0 )
|
|
|
|
{
|
|
|
|
aAny.setValue( &bSyncHeight, ::getBooleanCppuType() );
|
|
|
|
xPropSet->setPropertyValue( sIsSyncHeightToWidth, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-01-17 10:01:19 +00:00
|
|
|
if( xPropSetInfo->hasPropertyByName( sSizeType ) &&
|
|
|
|
(bMinHeight || nHeight > 0 || nRelHeight > 0 ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-15 10:28:36 +00:00
|
|
|
sal_Int16 nSizeType =
|
|
|
|
(bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
|
|
|
|
: SizeType::FIX;
|
|
|
|
aAny <<= nSizeType;
|
|
|
|
xPropSet->setPropertyValue( sSizeType, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( XML_TEXT_FRAME_GRAPHIC == nType )
|
|
|
|
{
|
|
|
|
// URL
|
2001-03-02 13:08:50 +00:00
|
|
|
UniReference < XMLTextImportHelper > xTxtImport =
|
|
|
|
GetImport().GetTextImport();
|
|
|
|
sal_Bool bForceLoad = xTxtImport->IsInsertMode() ||
|
|
|
|
xTxtImport->IsBlockMode() ||
|
2001-03-06 10:17:30 +00:00
|
|
|
xTxtImport->IsStylesOnlyMode() ||
|
|
|
|
xTxtImport->IsOrganizerMode();
|
2001-03-02 13:08:50 +00:00
|
|
|
aAny <<= GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad );
|
2000-09-18 16:07:07 +00:00
|
|
|
xPropSet->setPropertyValue( sGraphicURL, aAny );
|
|
|
|
|
|
|
|
// filter name
|
|
|
|
aAny <<=sFilterName;
|
|
|
|
xPropSet->setPropertyValue( sGraphicFilter, aAny );
|
2000-12-18 12:25:02 +00:00
|
|
|
|
|
|
|
// rotation
|
|
|
|
aAny <<= nRotation;
|
|
|
|
xPropSet->setPropertyValue( sGraphicRotation, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-04-10 08:07:23 +00:00
|
|
|
// 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 );
|
|
|
|
}
|
|
|
|
|
2001-03-16 11:50:15 +00:00
|
|
|
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)
|
2000-11-27 12:37:09 +00:00
|
|
|
{
|
|
|
|
Reference < XTextContent > xTxtCntnt( xPropSet, UNO_QUERY );
|
|
|
|
xTxtImport->InsertTextContent( xTxtCntnt );
|
2000-12-06 10:41:56 +00:00
|
|
|
|
|
|
|
Reference < XShape > xShape( xPropSet, UNO_QUERY );
|
|
|
|
GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
|
2000-11-27 12:37:09 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( XML_TEXT_FRAME_TEXTBOX == nType )
|
|
|
|
{
|
|
|
|
xTxtImport->ConnectFrameChains( sName, sChainNextName, xPropSet );
|
|
|
|
Reference < XTextFrame > xTxtFrame( xPropSet, UNO_QUERY );
|
|
|
|
Reference < XText > xTxt = xTxtFrame->getText();
|
|
|
|
xOldTextCursor = xTxtImport->GetCursor();
|
|
|
|
xTxtImport->SetCursor( xTxt->createTextCursor() );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLTextFrameContext::~XMLTextFrameContext()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void XMLTextFrameContext::EndElement()
|
|
|
|
{
|
|
|
|
// alternative text
|
2001-02-23 13:39:25 +00:00
|
|
|
if( sDesc.getLength() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-23 13:39:25 +00:00
|
|
|
if ( xPropSet.is() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-23 13:39:25 +00:00
|
|
|
Reference< XPropertySetInfo > xPropSetInfo =
|
|
|
|
xPropSet->getPropertySetInfo();
|
|
|
|
if( xPropSetInfo->hasPropertyByName( sAlternativeText ) )
|
|
|
|
{
|
|
|
|
Any aAny;
|
|
|
|
aAny <<= sDesc;
|
|
|
|
xPropSet->setPropertyValue( sAlternativeText, aAny );
|
|
|
|
}
|
|
|
|
}
|
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-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
|
|
|
}
|
|
|
|
|
|
|
|
SvXMLImportContext *XMLTextFrameContext::CreateChildContext(
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName,
|
|
|
|
const Reference< XAttributeList > & xAttrList )
|
|
|
|
{
|
|
|
|
SvXMLImportContext *pContext = 0;
|
|
|
|
|
2000-09-29 12:33:43 +00:00
|
|
|
if( XML_NAMESPACE_SVG == nPrefix &&
|
2000-09-18 16:07:07 +00:00
|
|
|
rLocalName.equalsAsciiL( sXML_desc, sizeof(sXML_desc)-1 ) )
|
2000-11-16 12:23:56 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
pContext = new XMLTextFrameDescContext_Impl( GetImport(),
|
|
|
|
nPrefix, rLocalName,
|
|
|
|
xAttrList, sDesc );
|
2000-11-16 12:23:56 +00:00
|
|
|
}
|
|
|
|
else if( XML_NAMESPACE_DRAW == nPrefix )
|
|
|
|
{
|
2001-02-23 13:39:25 +00:00
|
|
|
if ( (nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN) &&
|
|
|
|
rLocalName.equalsAsciiL ( sXML_param, sizeof (sXML_param) -1 ) )
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2001-03-09 14:59:46 +00:00
|
|
|
else if( xPropSet.is() )
|
2000-11-16 12:23:56 +00:00
|
|
|
{
|
|
|
|
if( rLocalName.equalsAsciiL( sXML_contour_polygon,
|
|
|
|
sizeof(sXML_contour_polygon)-1 ) )
|
|
|
|
pContext = new XMLTextFrameContourContext_Impl( GetImport(),
|
|
|
|
nPrefix, rLocalName,
|
|
|
|
xAttrList, xPropSet, sal_False );
|
|
|
|
else if( rLocalName.equalsAsciiL( sXML_contour_path,
|
|
|
|
sizeof(sXML_contour_path)-1 ) )
|
|
|
|
pContext = new XMLTextFrameContourContext_Impl( GetImport(),
|
|
|
|
nPrefix, rLocalName,
|
|
|
|
xAttrList, xPropSet, sal_True );
|
2001-03-29 15:26:25 +00:00
|
|
|
else if ( rLocalName.equalsAsciiL( sXML_image_map,
|
|
|
|
sizeof(sXML_image_map)-1) &&
|
|
|
|
( nType == XML_TEXT_FRAME_TEXTBOX ||
|
|
|
|
nType == XML_TEXT_FRAME_GRAPHIC ||
|
|
|
|
nType == XML_TEXT_FRAME_OBJECT_OLE ) )
|
|
|
|
pContext = new XMLImageMapContext( GetImport(), nPrefix,
|
|
|
|
rLocalName, xPropSet );
|
2000-11-16 12:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 13:00:16 +00:00
|
|
|
else if( (XML_NAMESPACE_OFFICE == nPrefix) &&
|
2000-12-19 17:56:47 +00:00
|
|
|
rLocalName.equalsAsciiL(sXML_events, sizeof(sXML_events)-1) )
|
|
|
|
{
|
|
|
|
// do we still have the frame object?
|
|
|
|
if (xPropSet.is())
|
|
|
|
{
|
|
|
|
// is it an event supplier?
|
2001-01-30 12:10:00 +00:00
|
|
|
Reference<XEventsSupplier> xEventsSupplier(xPropSet, UNO_QUERY);
|
|
|
|
if (xEventsSupplier.is())
|
2000-12-19 17:56:47 +00:00
|
|
|
{
|
|
|
|
// OK, we have the events, so create the context
|
|
|
|
pContext = new XMLEventsImportContext(GetImport(), nPrefix,
|
2001-01-30 12:10:00 +00:00
|
|
|
rLocalName, xEventsSupplier);
|
2000-12-19 17:56:47 +00:00
|
|
|
}
|
|
|
|
// else: no events, no event import
|
|
|
|
}
|
|
|
|
// else: no object, no event import
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-26 07:10:55 +00:00
|
|
|
void XMLTextFrameContext::SetHyperlink( const OUString& rHRef,
|
|
|
|
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
|
|
|
|
2001-04-25 12:35:19 +00:00
|
|
|
Reference < XTextContent > XMLTextFrameContext::GetTextContent() const
|
|
|
|
{
|
|
|
|
return Reference < XTextContent >( xPropSet, UNO_QUERY );
|
|
|
|
}
|