diff options
author | Michael Brauer <mib@openoffice.org> | 2001-05-09 11:22:39 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2001-05-09 11:22:39 +0000 |
commit | 0c486bc0dd69ebcf3bac141a3a4e51711c96183d (patch) | |
tree | 08586cf668f872506e846b5fb244d358195c7eda /xmloff | |
parent | 116489fa264fb134a0611dfec8fd1b7349be258b (diff) |
Own Objects can be stored in plain file format
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/prj/d.lst | 2 | ||||
-rw-r--r-- | xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx | 215 | ||||
-rw-r--r-- | xmloff/source/core/XMLEmbeddedObjectImportContext.cxx | 305 | ||||
-rw-r--r-- | xmloff/source/core/makefile.mk | 12 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 107 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 534 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.hxx | 37 |
7 files changed, 955 insertions, 257 deletions
diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst index c11128180df6..8dbb55ddde97 100644 --- a/xmloff/prj/d.lst +++ b/xmloff/prj/d.lst @@ -101,6 +101,8 @@ hedabu: ..\inc\ImageStyle.hxx %_DEST%\inc%_EXT%\xmloff\ImageStyle.hxx hedabu: ..\inc\SettingsExportHelper.hxx %_DEST%\inc%_EXT%\xmloff\SettingsExportHelper.hxx hedabu: ..\inc\DocumentSettingsContext.hxx %_DEST%\inc%_EXT%\xmloff\DocumentSettingsContext.hxx hedabu: ..\inc\XMLGraphicsDefaultStyle.hxx %_DEST%\inc%_EXT%\xmloff\XMLGraphicsDefaultStyle.hxx +hedabu: ..\inc\XMLEmbeddedObjectExportFilter.hxx %_DEST%\inc%_EXT%\xmloff\XMLEmbeddedObjectExportFilter.hxx +hedabu: ..\inc\XMLFilterServiceNames.h %_DEST%\inc%_EXT%\xmloff\XMLFilterServiceNames.h ..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib%_EXT%\lib*static*.dylib ..\%__SRC%\misc\*staticdatamembers.cxx %_DEST%\inc%_EXT%\*staticdatamembers.cxx diff --git a/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx new file mode 100644 index 000000000000..dafa3842eac3 --- /dev/null +++ b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * $RCSfile: XMLEmbeddedObjectExportFilter.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2001-05-09 12:15:52 $ + * + * 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 _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX +#include "XMLEmbeddedObjectExportFilter.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + + +XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter() throw() +{ +} + +XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter( + const Reference< XDocumentHandler > & rHandler ) throw() : + xHandler( rHandler ), + xExtHandler( rHandler, UNO_QUERY ) +{ +} + +XMLEmbeddedObjectExportFilter::~XMLEmbeddedObjectExportFilter () throw() +{ +} + + +void SAL_CALL XMLEmbeddedObjectExportFilter::startDocument( void ) + throw( SAXException, RuntimeException ) +{ + // do nothing, filter this +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::endDocument( void ) + throw( SAXException, RuntimeException) +{ + // do nothing, filter this +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::startElement( + const OUString& rName, + const Reference< XAttributeList >& xAttrList ) + throw(SAXException, RuntimeException) +{ + xHandler->startElement( rName, xAttrList ); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::endElement( const OUString& rName ) + throw(SAXException, RuntimeException) +{ + xHandler->endElement( rName ); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::characters( const OUString& rChars ) + throw(SAXException, RuntimeException) +{ + xHandler->characters( rChars ); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::ignorableWhitespace( + const OUString& rWhitespaces ) + throw(SAXException, RuntimeException) +{ + xHandler->ignorableWhitespace( rWhitespaces ); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::processingInstruction( + const OUString& rTarget, + const OUString& rData ) + throw(SAXException, RuntimeException) +{ + xHandler->processingInstruction( rTarget, rData ); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::setDocumentLocator( + const Reference< XLocator >& rLocator ) + throw(SAXException, RuntimeException) +{ + xHandler->setDocumentLocator( rLocator ); +} + +// XExtendedDocumentHandler +void SAL_CALL XMLEmbeddedObjectExportFilter::startCDATA( void ) + throw(SAXException, RuntimeException) +{ + if( xExtHandler.is() ) + xExtHandler->startCDATA(); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::endCDATA( void ) + throw(RuntimeException) +{ + if( xExtHandler.is() ) + xExtHandler->endCDATA(); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::comment( const OUString& rComment ) + throw(SAXException, RuntimeException) +{ + if( xExtHandler.is() ) + xExtHandler->comment( rComment ); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::allowLineBreak( void ) + throw(SAXException, RuntimeException) +{ + if( xExtHandler.is() ) + xExtHandler->allowLineBreak(); +} + +void SAL_CALL XMLEmbeddedObjectExportFilter::unknown( const OUString& rString ) + throw(SAXException, RuntimeException) +{ + if( xExtHandler.is() ) + xExtHandler->unknown( rString ); +} + +// XInitialize +void SAL_CALL XMLEmbeddedObjectExportFilter::initialize( + const Sequence< Any >& aArguments ) + throw(Exception, RuntimeException) +{ + const sal_Int32 nAnyCount = aArguments.getLength(); + const Any* pAny = aArguments.getConstArray(); + + for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ ) + { + if( pAny->getValueType() == + ::getCppuType((const Reference< XDocumentHandler >*)0)) + { + *pAny >>= xHandler; + *pAny >>= xExtHandler; + } + } +} + +// XServiceInfo +OUString SAL_CALL XMLEmbeddedObjectExportFilter::getImplementationName() + throw(RuntimeException) +{ + OUString aStr; + return aStr; +} + +sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& ServiceName ) + throw(RuntimeException) +{ + return sal_False; +} + +Sequence< OUString > SAL_CALL XMLEmbeddedObjectExportFilter::getSupportedServiceNames( ) + throw(RuntimeException) +{ + Sequence< OUString > aSeq; + return aSeq; +} diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx new file mode 100644 index 000000000000..c4085a6daba6 --- /dev/null +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -0,0 +1,305 @@ +/************************************************************************* + * + * $RCSfile: XMLEmbeddedObjectImportContext.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2001-05-09 12:15:59 $ + * + * 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 _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_ +#include <com/sun/star/document/XImporter.hpp> +#endif + +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif + +#ifndef _XMLOFF_NMSPMAP_HXX +#include "nmspmap.hxx" +#endif +#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_XMLFILTERSERVICENAMES_H +#include "XMLFilterServiceNames.h" +#endif +#ifndef _XMLOFF_XMLEMBEDDEDOBJECTIMPORTCONTEXT_HXX +#include "XMLEmbeddedObjectImportContext.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::xml::sax; + +struct XMLServiceMapEntry_Impl +{ + const sal_Char *sClass; + sal_Int32 sClassLen; + const sal_Char *sFilterService; + sal_Int32 nFilterServiceLen; +}; + +#define SERVICE_MAP_ENTRY( cls, app ) \ + { sXML_##cls, sizeof(sXML_##cls)-1, \ + XML_IMPORT_FILTER_##app, sizeof(XML_IMPORT_FILTER_##app)-1 } + +const XMLServiceMapEntry_Impl aServiceMap[] = +{ + SERVICE_MAP_ENTRY( text, WRITER ), + SERVICE_MAP_ENTRY( online_text, WRITER ), + SERVICE_MAP_ENTRY( spreadsheet, CALC ), + SERVICE_MAP_ENTRY( drawing, DRAW ), + SERVICE_MAP_ENTRY( presentation, IMPRESS ), + SERVICE_MAP_ENTRY( chart, CHART ), + { 0, 0, 0, 0 } +}; + +class XMLEmbeddedObjectImportContext_Impl : public SvXMLImportContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XDocumentHandler > xHandler; + +public: + TYPEINFO(); + + XMLEmbeddedObjectImportContext_Impl( SvXMLImport& rImport, USHORT nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XDocumentHandler >& rHandler ); + + virtual ~XMLEmbeddedObjectImportContext_Impl(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +TYPEINIT1( XMLEmbeddedObjectImportContext_Impl, SvXMLImportContext ); + +XMLEmbeddedObjectImportContext_Impl::XMLEmbeddedObjectImportContext_Impl( + SvXMLImport& rImport, USHORT nPrfx, + const OUString& rLName, + const Reference< XDocumentHandler >& rHandler ) : + SvXMLImportContext( rImport, nPrfx, rLName ), + xHandler( rHandler ) +{ +} + +XMLEmbeddedObjectImportContext_Impl::~XMLEmbeddedObjectImportContext_Impl() +{ +} + +SvXMLImportContext *XMLEmbeddedObjectImportContext_Impl::CreateChildContext( + USHORT nPrefix, + const OUString& rLocalName, + const Reference< XAttributeList >& xAttrList ) +{ + return new XMLEmbeddedObjectImportContext_Impl( GetImport(), + nPrefix, rLocalName, + xHandler ); +} + +void XMLEmbeddedObjectImportContext_Impl::StartElement( + const Reference< XAttributeList >& xAttrList ) +{ + xHandler->startElement( GetImport().GetNamespaceMap().GetQNameByKey( + GetPrefix(), GetLocalName() ), + xAttrList ); +} + +void XMLEmbeddedObjectImportContext_Impl::EndElement() +{ + xHandler->endElement( GetImport().GetNamespaceMap().GetQNameByKey( + GetPrefix(), GetLocalName() ) ); +} + +void XMLEmbeddedObjectImportContext_Impl::Characters( const OUString& rChars ) +{ + xHandler->characters( rChars ); +} + +//----------------------------------------------------------------------------- + +TYPEINIT1( XMLEmbeddedObjectImportContext, SvXMLImportContext ); + +sal_Bool XMLEmbeddedObjectImportContext::SetComponent( + Reference< XComponent >& rComp ) +{ + if( !rComp.is() || !sFilterService.getLength() ) + return sal_False; + + Sequence<Any> aArgs( 0 ); + Reference< XMultiServiceFactory > xServiceFactory = + comphelper::getProcessServiceFactory(); + xHandler = Reference < XDocumentHandler >( + xServiceFactory->createInstanceWithArguments( sFilterService, aArgs), + UNO_QUERY); + + if( !xHandler.is() ) + return sal_False; + + Reference < XImporter > xImporter( xHandler, UNO_QUERY ); + xImporter->setTargetDocument( rComp ); + + return sal_True; +} + +XMLEmbeddedObjectImportContext::XMLEmbeddedObjectImportContext( + SvXMLImport& rImport, USHORT nPrfx, const OUString& rLName, + const Reference< XAttributeList >& xAttrList ) : + SvXMLImportContext( rImport, nPrfx, rLName ) +{ + if( nPrfx == XML_NAMESPACE_MATH && + rLName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_math ) ) ) + { + sFilterService = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_IMPORT_FILTER_MATH) ); + } + else if( nPrfx == XML_NAMESPACE_OFFICE && + rLName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_document ) ) ) + { + OUString sClass; + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); + if( nPrefix == XML_NAMESPACE_OFFICE && + aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_class ) ) ) + { + sClass = xAttrList->getValueByIndex( i ); + break; + } + } + + if( sClass.getLength() ) + { + const XMLServiceMapEntry_Impl *pEntry = aServiceMap; + while( pEntry->sClass ) + { + if( sClass.equalsAsciiL( pEntry->sClass, pEntry->sClassLen ) ) + { + sFilterService = OUString( pEntry->sFilterService, + pEntry->nFilterServiceLen, + RTL_TEXTENCODING_ASCII_US ); + break; + } + pEntry++; + } + } + } +} + +XMLEmbeddedObjectImportContext::~XMLEmbeddedObjectImportContext() +{ +} + +SvXMLImportContext *XMLEmbeddedObjectImportContext::CreateChildContext( + USHORT nPrefix, const OUString& rLocalName, + const Reference< XAttributeList >& xAttrList ) +{ + if( xHandler.is() ) + return new XMLEmbeddedObjectImportContext_Impl( GetImport(), + nPrefix, rLocalName, + xHandler ); + else + return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); +} + +void XMLEmbeddedObjectImportContext::StartElement( + const Reference< XAttributeList >& xAttrList ) +{ + if( xHandler.is() ) + { + xHandler->startDocument(); + xHandler->startElement( GetImport().GetNamespaceMap().GetQNameByKey( + GetPrefix(), GetLocalName() ), + xAttrList ); + } +} + +void XMLEmbeddedObjectImportContext::EndElement() +{ + if( xHandler.is() ) + { + xHandler->endElement( GetImport().GetNamespaceMap().GetQNameByKey( + GetPrefix(), GetLocalName() ) ); + xHandler->endDocument(); + } +} + +void XMLEmbeddedObjectImportContext::Characters( const ::rtl::OUString& rChars ) +{ + if( xHandler.is() ) + xHandler->characters( rChars ); +} + diff --git a/xmloff/source/core/makefile.mk b/xmloff/source/core/makefile.mk index 179ce656f9fc..a5f98f4d1650 100644 --- a/xmloff/source/core/makefile.mk +++ b/xmloff/source/core/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.10 $ +# $Revision: 1.11 $ # -# last change: $Author: sab $ $Date: 2001-03-11 15:54:05 $ +# last change: $Author: mib $ $Date: 2001-05-09 12:16:22 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -99,7 +99,9 @@ CXXFILES = \ ProgressBarHelper.cxx \ PropertySetMerger.cxx \ SettingsExportHelper.cxx \ - DocumentSettingsContext.cxx + DocumentSettingsContext.cxx \ + XMLEmbeddedObjectExportFilter.cxx \ + XMLEmbeddedObjectImportContext.cxx SLOFILES = \ $(SLO)$/facreg.obj \ @@ -118,7 +120,9 @@ SLOFILES = \ $(SLO)$/ProgressBarHelper.obj \ $(SLO)$/PropertySetMerger.obj \ $(SLO)$/SettingsExportHelper.obj \ - $(SLO)$/DocumentSettingsContext.obj + $(SLO)$/DocumentSettingsContext.obj \ + $(SLO)$/XMLEmbeddedObjectExportFilter.obj \ + $(SLO)$/XMLEmbeddedObjectImportContext.obj # --- Tagets ------------------------------------------------------- diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 71cc987ba935..6075e2e759b0 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlexp.cxx,v $ * - * $Revision: 1.62 $ + * $Revision: 1.63 $ * - * last change: $Author: mib $ $Date: 2001-05-07 06:03:01 $ + * last change: $Author: mib $ $Date: 2001-05-09 12:16:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,6 +75,9 @@ #ifndef _URLOBJ_HXX #include <tools/urlobj.hxx> #endif +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif #ifndef _XMLOFF_ATTRLIST_HXX #include "attrlist.hxx" @@ -168,6 +171,12 @@ #ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_ #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #endif +#ifndef _XMLOFF_XMLFILTERSERVICENAMES_H +#include "XMLFilterServiceNames.h" +#endif +#ifndef _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX +#include "XMLEmbeddedObjectExportFilter.hxx" +#endif using namespace ::rtl; using namespace ::osl; @@ -175,8 +184,42 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::xml::sax; + +sal_Char __READONLY_DATA sXML_1_0[] = "1.0"; + +#define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument" +#define XML_MODEL_SERVICE_CALC "com.sun.star.sheet.SpreadsheetDocument" +#define XML_MODEL_SERVICE_DRAW "com.sun.star.drawing.DrawingDocument" +#define XML_MODEL_SERVICE_IMPRESS "com.sun.star.presentation.PresentationDocument" +#define XML_MODEL_SERVICE_MATH "com.sun.star.formula.FormulaProperties" +#define XML_MODEL_SERVICE_CHART "com.sun.star.chart.ChartDocument" + +struct XMLServiceMapEntry_Impl +{ + const sal_Char *sModelService; + sal_Int32 nModelServiceLen; + const sal_Char *sFilterService; + sal_Int32 nFilterServiceLen; +}; -sal_Char __READONLY_DATA sXML_0_9[] = "0.9"; +#define SERVICE_MAP_ENTRY( app ) \ + { XML_MODEL_SERVICE_##app, sizeof(XML_MODEL_SERVICE_##app)-1, \ + XML_EXPORT_FILTER_##app, sizeof(XML_EXPORT_FILTER_##app)-1 } + +const XMLServiceMapEntry_Impl aServiceMap[] = +{ + SERVICE_MAP_ENTRY( WRITER ), + SERVICE_MAP_ENTRY( CALC ), + SERVICE_MAP_ENTRY( IMPRESS ),// Impress supports DrawingDocument, too, so + SERVICE_MAP_ENTRY( DRAW ), // it must appear before Draw + SERVICE_MAP_ENTRY( MATH ), + SERVICE_MAP_ENTRY( CHART ), + { 0, 0, 0, 0 } +}; void SvXMLExport::_InitCtor() { @@ -726,7 +769,7 @@ sal_uInt32 SvXMLExport::exportDoc( const sal_Char *pClass ) // office:version = ... if( !bExtended ) - AddAttributeASCII( XML_NAMESPACE_OFFICE, sXML_version, sXML_0_9 ); + AddAttributeASCII( XML_NAMESPACE_OFFICE, sXML_version, sXML_1_0 ); { char* pRootService; @@ -757,7 +800,8 @@ sal_uInt32 SvXMLExport::exportDoc( const sal_Char *pClass ) pRootService = sXML_document; } - if( xExtHandler.is() ) + if( (getExportFlags() && EXPORT_NODOCTYPE) == 0 && + xExtHandler.is() ) { OUStringBuffer aDocType( sizeof(sXML_xml_doctype_prefix) + @@ -1262,6 +1306,59 @@ sal_Int64 SAL_CALL SvXMLExport::getSomething( const uno::Sequence< sal_Int8 >& r return 0; } +sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp ) +{ + OUString sFilterService; + + Reference < lang::XServiceInfo > xServiceInfo( rComp, UNO_QUERY ); + if( xServiceInfo.is() ) + { + const XMLServiceMapEntry_Impl *pEntry = aServiceMap; + while( pEntry->sModelService ) + { + OUString sModelService( pEntry->sModelService, + pEntry->nModelServiceLen, + RTL_TEXTENCODING_ASCII_US ); + if( xServiceInfo->supportsService( sModelService ) ) + { + sFilterService = OUString( pEntry->sFilterService, + pEntry->nFilterServiceLen, + RTL_TEXTENCODING_ASCII_US ); + break; + } + pEntry++; + } + } + + OSL_ENSURE( sFilterService.getLength(), "no export filter for own object" ); + + if( !sFilterService.getLength() ) + return sal_False; + + Reference < XDocumentHandler > xHdl = + new XMLEmbeddedObjectExportFilter( xHandler ); + + Sequence < Any > aArgs( 1 ); + aArgs[0] <<= xHdl; + + Reference< lang::XMultiServiceFactory > xServiceFactory = + comphelper::getProcessServiceFactory(); + Reference< document::XExporter > xExporter( + xServiceFactory->createInstanceWithArguments( sFilterService, aArgs), + UNO_QUERY); + OSL_ENSURE( xExporter.is(), + "can't instantiate export filter component for own object" ); + if( !xExporter.is() ) + return sal_False; + + xExporter->setSourceDocument( rComp ); + + Reference<XFilter> xFilter( xExporter, UNO_QUERY ); + + Sequence < PropertyValue > aMediaDesc( 0 ); + return xFilter->filter( aMediaDesc ); +} + void SvXMLElementExport::StartElement( SvXMLExport& rExp, sal_uInt16 nPrefixKey, const OUString& rLName, diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index f2765b1cbeb3..64fc617ee51a 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLTextFrameContext.cxx,v $ * - * $Revision: 1.40 $ + * $Revision: 1.41 $ * - * last change: $Author: mib $ $Date: 2001-05-04 09:49:55 $ + * last change: $Author: mib $ $Date: 2001-05-09 12:17:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,6 +87,9 @@ #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP #include <com/sun/star/document/XEventsSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_DOCUMENT_XEMBEDDEDOBJECTSUPPLIER_HPP_ +#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> +#endif #ifndef _XMLOFF_XMLIMP_HXX #include "xmlimp.hxx" #endif @@ -105,6 +108,9 @@ #ifndef _XMLOFF_XMLANCHORTYPEPROPHDL_HXX #include "XMLAnchorTypePropHdl.hxx" #endif +#ifndef _XMLOFF_XMLEMBEDDEDOBJECTIMPORTCONTEXT_HXX +#include "XMLEmbeddedObjectImportContext.hxx" +#endif #ifndef _XMLOFF_PRSTYLEI_HXX_ #include "prstylei.hxx" #endif @@ -138,6 +144,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::document; using ::com::sun::star::document::XEventsSupplier; class XMLTextFrameDescContext_Impl : public SvXMLImportContext @@ -366,6 +373,242 @@ XMLTextFrameContourContext_Impl::~XMLTextFrameContourContext_Impl() TYPEINIT1( XMLTextFrameContext, SvXMLImportContext ); +void XMLTextFrameContext::Create( sal_Bool bLinked ) +{ + UniReference < XMLTextImportHelper > xTxtImport = + GetImport().GetTextImport(); + + switch ( nType) + { + case XML_TEXT_FRAME_OBJECT: + case XML_TEXT_FRAME_OBJECT_OLE: + if( bLinked ) + { + OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef, + OUString() ) ); + + if( sURL.getLength() ) + xPropSet = GetImport().GetTextImport() + ->createAndInsertOLEObject( GetImport(), sURL, + sStyleName, + nWidth, nHeight ); + } + else + { + OUString sURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.ServiceName:") ); + sURL += sFilterService; + xPropSet = GetImport().GetTextImport() + ->createAndInsertOLEObject( GetImport(), sURL, + sStyleName, + nWidth, nHeight ); + + } + break; + case XML_TEXT_FRAME_APPLET: + { + xPropSet = GetImport().GetTextImport() + ->createAndInsertApplet( sAppletName, sCode, + bMayScript, sHRef, + nWidth, nHeight); + break; + } + case XML_TEXT_FRAME_PLUGIN: + { + 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() ) + return; + + 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; + 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 + 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 ); + } + + 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 + UniReference < XMLTextImportHelper > xTxtImport = + GetImport().GetTextImport(); + sal_Bool bForceLoad = xTxtImport->IsInsertMode() || + xTxtImport->IsBlockMode() || + xTxtImport->IsStylesOnlyMode() || + xTxtImport->IsOrganizerMode(); + aAny <<= GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad ); + 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 ); + xTxtImport->InsertTextContent( xTxtCntnt ); + + Reference < XShape > xShape( xPropSet, UNO_QUERY ); + GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex ); + } + + if( XML_TEXT_FRAME_TEXTBOX == nType ) + { + xTxtImport->ConnectFrameChains( sName, sNextName, xPropSet ); + Reference < XTextFrame > xTxtFrame( xPropSet, UNO_QUERY ); + Reference < XText > xTxt = xTxtFrame->getText(); + xOldTextCursor = xTxtImport->GetCursor(); + xTxtImport->SetCursor( xTxt->createTextCursor() ); + } + +} + XMLTextFrameContext::XMLTextFrameContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, @@ -395,33 +638,21 @@ XMLTextFrameContext::XMLTextFrameContext( sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")), sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject")) { - OUString sName; - OUString sStyleName; - OUString sChainNextName; - OUString sHRef; - OUString sFilterName; - OUString sCode; - OUString sObject; - OUString sArchive; - OUString sMimeType; - OUString sFrameName; - OUString sAppletName; - - sal_Int32 nX = 0; - sal_Int32 nY = 0; - sal_Int32 nWidth = 0; - sal_Int32 nHeight = 0; - sal_Int32 nZIndex = -1; - sal_Int16 nPage = 0; - sal_Int16 nRotation = 0; - sal_Int16 nRelWidth = 0; - sal_Int16 nRelHeight = 0; - sal_Bool bMayScript = sal_False; - - - sal_Bool bMinHeight = sal_False; - sal_Bool bSyncWidth = sal_False; - sal_Bool bSyncHeight = sal_False; + nX = 0; + nY = 0; + nWidth = 0; + nHeight = 0; + nZIndex = -1; + nPage = 0; + nRotation = 0; + nRelWidth = 0; + nRelHeight = 0; + bMayScript = sal_False; + + bMinHeight = sal_False; + bSyncWidth = sal_False; + bSyncHeight = sal_False; + UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport(); const SvXMLTokenMap& rTokenMap = @@ -562,7 +793,7 @@ XMLTextFrameContext::XMLTextFrameContext( GetImport().GetMM100UnitConverter().convertNumber( nZIndex, rValue, -1 ); break; case XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME: - sChainNextName = rValue; + sNextName = rValue; break; case XML_TOK_TEXT_FRAME_HREF: sHRef = rValue; @@ -616,221 +847,7 @@ XMLTextFrameContext::XMLTextFrameContext( && !sHRef.getLength() ) return; // no URL: no image or OLE object - switch ( nType) - { - case XML_TEXT_FRAME_OBJECT: - case XML_TEXT_FRAME_OBJECT_OLE: - { - OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef, OUString() ) ); - - if( sURL.getLength() ) - xPropSet = GetImport().GetTextImport() - ->createAndInsertOLEObject( GetImport(), sURL, - sStyleName, - nWidth, nHeight ); - break; - } - case XML_TEXT_FRAME_APPLET: - { - xPropSet = GetImport().GetTextImport() - ->createAndInsertApplet( sAppletName, sCode, - bMayScript, sHRef, - nWidth, nHeight); - break; - } - case XML_TEXT_FRAME_PLUGIN: - { - 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() ) - return; - - 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; - 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 - if( nWidth > 0 ) - { - aAny <<= nWidth; - xPropSet->setPropertyValue( sWidth, aAny ); - } - if( nRelWidth > 0 || nWidth > 0 ) - { - aAny <<= nRelWidth; - xPropSet->setPropertyValue( sRelativeWidth, aAny ); - } - if( bSyncWidth || nWidth > 0 ) - { - aAny.setValue( &bSyncWidth, ::getBooleanCppuType() ); - xPropSet->setPropertyValue( sIsSyncWidthToHeight, aAny ); - } - - if( nHeight > 0 ) - { - 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 ); - } - 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 - UniReference < XMLTextImportHelper > xTxtImport = - GetImport().GetTextImport(); - sal_Bool bForceLoad = xTxtImport->IsInsertMode() || - xTxtImport->IsBlockMode() || - xTxtImport->IsStylesOnlyMode() || - xTxtImport->IsOrganizerMode(); - aAny <<= GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad ); - 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 ); - xTxtImport->InsertTextContent( xTxtCntnt ); - - Reference < XShape > xShape( xPropSet, UNO_QUERY ); - GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex ); - } - - 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() ); - } - + Create( sal_True ); } XMLTextFrameContext::~XMLTextFrameContext() @@ -926,6 +943,33 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( } // else: no object, no event import } + else if( XML_TEXT_FRAME_OBJECT == nType && + (XML_NAMESPACE_OFFICE == nPrefix && + rLocalName.equalsAsciiL(sXML_document, sizeof(sXML_document)-1)) || + (XML_NAMESPACE_MATH == nPrefix && + rLocalName.equalsAsciiL(sXML_math, sizeof(sXML_math)-1)) ) + { + if( !xPropSet.is() ) + { + 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" ); + pEContext->SetComponent( xEOS->getEmbeddedObject() ); + } + } + pContext = pEContext; + } + } if( !pContext && xOldTextCursor.is() ) // text-box pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList, diff --git a/xmloff/source/text/XMLTextFrameContext.hxx b/xmloff/source/text/XMLTextFrameContext.hxx index e1c48c6cd96f..559e88fc82a0 100644 --- a/xmloff/source/text/XMLTextFrameContext.hxx +++ b/xmloff/source/text/XMLTextFrameContext.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLTextFrameContext.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: mib $ $Date: 2001-04-25 13:35:19 $ + * last change: $Author: mib $ $Date: 2001-05-09 12:17:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,10 +112,41 @@ class XMLTextFrameContext : public SvXMLImportContext 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 sDesc; + ::rtl::OUString sFilterService; + + 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; - ParamMap aParamMap; + + sal_Bool bMayScript : 1; + sal_Bool bMinHeight : 1; + sal_Bool bSyncWidth : 1; + sal_Bool bSyncHeight : 1; + + void Create( sal_Bool bLinked ); public: |