diff options
-rw-r--r-- | sw/inc/docsh.hxx | 9 | ||||
-rw-r--r-- | sw/source/filter/xml/makefile.mk | 6 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/xml/wrtxml.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 106 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmte.cxx | 244 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.hxx | 14 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexte.cxx | 250 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexte.hxx | 18 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexti.cxx | 66 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexti.hxx | 8 |
12 files changed, 402 insertions, 353 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index c8a06275906d..e0f3186d6bf4 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: docsh.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jp $ $Date: 2000-11-01 10:14:33 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:42:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -218,6 +218,7 @@ public: // globaler IO virtual BOOL Save(); + inline BOOL SaveAsChilds( SvStorage *pStor ); // fuer VorlagenPI virtual SfxStyleSheetBasePool* GetStyleSheetPool(); @@ -305,4 +306,8 @@ public: BOOL bUnoCall ); }; +inline BOOL SwDocShell::SaveAsChilds( SvStorage *pStor ) +{ + return SfxInPlaceObject::SaveAsChilds( pStor ); +} #endif diff --git a/sw/source/filter/xml/makefile.mk b/sw/source/filter/xml/makefile.mk index 846880406182..39d56e137f32 100644 --- a/sw/source/filter/xml/makefile.mk +++ b/sw/source/filter/xml/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: ab $ $Date: 2000-11-28 11:40:36 $ +# last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -86,6 +86,7 @@ CXXFILES = \ wrtxml.cxx \ xmlexp.cxx \ xmltext.cxx \ + xmltexte.cxx \ xmltexti.cxx \ xmltbli.cxx \ xmltble.cxx \ @@ -105,6 +106,7 @@ SLOFILES = \ $(SLO)$/wrtxml.obj \ $(SLO)$/xmlexp.obj \ $(SLO)$/xmltext.obj \ + $(SLO)$/xmltexte.obj \ $(SLO)$/xmltexti.obj \ $(SLO)$/xmltbli.obj \ $(SLO)$/xmltble.obj \ diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 6a50fe103ecb..2f19e4584311 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -2,9 +2,9 @@ * * $RCSfile: swxml.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mib $ $Date: 2000-12-06 08:39:34 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -238,7 +238,7 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName ) // get filter Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLImport( rDoc, rPaM, bLoadDoc, bInsert, nStyleFamilyMask, - xModel, xEmbeddedGraphicExport ); + xModel, xEmbeddedGraphicExport, pStorage ); // connect parser and filter Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY ); @@ -282,6 +282,9 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName ) /************************************************************************* $Log: not supported by cvs2svn $ + Revision 1.6 2000/12/06 08:39:34 mib + #81388#: Content stream now is called Content.xml + Revision 1.5 2000/12/02 10:57:15 mib #80795#: use packages diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 1e15d97e0059..366a8b95050b 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtxml.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: mib $ $Date: 2000-12-06 08:39:34 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -203,6 +203,10 @@ sal_uInt32 SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, if( xDocStream.Is() ) xDocStream->Commit(); + if( pStorage ) + pDoc->GetDocShell()->SaveAsChilds( pStorage ); + + if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); xEmbeddedGraphicExport = 0; @@ -226,11 +230,14 @@ void GetXMLWriter( const String& rName, WriterRef& xRet ) Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/wrtxml.cxx,v 1.8 2000-12-06 08:39:34 mib Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/wrtxml.cxx,v 1.9 2001-01-03 11:40:56 mib Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.8 2000/12/06 08:39:34 mib + #81388#: Content stream now is called Content.xml + Revision 1.7 2000/12/02 10:57:15 mib #80795#: use packages diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index b52bcfabaeec..14b6e4b460d6 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlexp.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: mib $ $Date: 2000-12-06 14:25:52 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,24 +72,6 @@ #include <com/sun/star/text/XText.hpp> #endif -#ifndef _PAM_HXX //autogen wg. SwPaM -#include <pam.hxx> -#endif -#ifndef _DOC_HXX //autogen wg. SwDoc -#include <doc.hxx> -#endif -#ifndef _MDIEXP_HXX -#include <mdiexp.hxx> // ...Percent() -#endif -#ifndef _STATSTR_HRC -#include <statstr.hrc> // ResId fuer Statusleiste -#endif -#ifndef _SHL_HXX //autogen wg. SHL_WRITER -#include <tools/shl.hxx> -#endif -#ifndef _SWMODULE_HXX //autogen wg. SW_MOD -#include <swmodule.hxx> -#endif #ifndef _SVDMODEL_HXX #include <svx/svdmodel.hxx> #endif @@ -97,19 +79,6 @@ #include <svx/svdpage.hxx> #endif -#ifndef _SWDOCSH_HXX -#include <docsh.hxx> -#endif -#ifndef _DOCSTAT_HXX -#include "docstat.hxx" -#endif -#ifndef _NDOLE_HXX -#include "ndole.hxx" -#endif -#ifndef _NDGRF_HXX -#include "ndgrf.hxx" -#endif - #ifndef _XMLOFF_NMSPMAP_HXX #include <xmloff/nmspmap.hxx> #endif @@ -125,8 +94,21 @@ #ifndef _XMLOFF_PROGRESSBARHELPER_HXX #include <xmloff/ProgressBarHelper.hxx> #endif -#ifndef _UNOFRAME_HXX -#include "unoframe.hxx" + +#ifndef _PAM_HXX //autogen wg. SwPaM +#include <pam.hxx> +#endif +#ifndef _DOC_HXX //autogen wg. SwDoc +#include <doc.hxx> +#endif +#ifndef _SWMODULE_HXX //autogen wg. SW_MOD +#include <swmodule.hxx> +#endif +#ifndef _SWDOCSH_HXX +#include <docsh.hxx> +#endif +#ifndef _DOCSTAT_HXX +#include <docstat.hxx> #endif #ifndef _XMLTEXTE_HXX @@ -137,12 +119,10 @@ #endif using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; #ifdef XML_CORE_API @@ -184,7 +164,7 @@ void SwXMLExport::SetCurPaM( SwPaM& rPaM, sal_Bool bWhole, sal_Bool bTabOnly ) SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM, const OUString& rFileName, - const Reference< xml::sax::XDocumentHandler > & rHandler, + const Reference< XDocumentHandler > & rHandler, const Reference< XIndexContainer > & rEmbeddedGrfObjs, sal_Bool bExpWholeDoc, sal_Bool bExpFirstTableOnly, sal_Bool bShowProg, SvStorage *pPkg ) : @@ -405,50 +385,4 @@ void SwXMLExport::ExportCurPaM( sal_Bool bExportWholePaM ) } #endif -const SwNoTxtNode *SwXMLTextParagraphExport::GetNoTxtNode( - const Reference < XPropertySet >& rPropSet ) -{ - Reference<XUnoTunnel> xCrsrTunnel( rPropSet, UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" ); - SwXFrame *pFrame = - (SwXFrame *)xCrsrTunnel->getSomething( - SwXFrame::getUnoTunnelId() ); - ASSERT( pFrame, "SwXFrame missing" ); - SwFrmFmt *pFrmFmt = pFrame->GetFrmFmt(); - const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); - const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx(); - return pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetNoTxtNode(); -} - -#if 0 -OUString SwXMLTextParagraphExport::exportTextEmbeddedGraphic( - const Reference < XPropertySet >& rPropSet ) -{ - OUString aName; - const SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode(); - if( GRAPHIC_NONE != pGrfNd->GetGrf().GetType() ) - { - // Falls die Grafik bereits im Storage ist, ist der Stream-Name - // gesetzt. Dann brauchen wir sie nicht mehr zu speichern. - // oder es ist ein SaveAs, dann auf jedenfall kopieren - SvStorage *pPackage = ((SwXMLExport&)GetExport()).GetPackage(); - if( !pPackage || - !((SwGrfNode *)pGrfNd)->StoreGraphics( pPackage ) ) - { -// Warning( WARN_SWG_POOR_LOAD ); - } - else - aName = OUString( pGrfNd->GetStreamName() ); - } - return aName; -} -#endif - -OUString SwXMLTextParagraphExport::exportTextEmbeddedObject( - const Reference < XPropertySet >& rPropSet ) -{ - const SwOLENode *pOLENd = GetNoTxtNode( rPropSet )->GetOLENode(); - OUString aName( pOLENd->GetOLEObj().GetName() ); - return aName; -} diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index 329ac9fbcd67..37cd9db80172 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlfmte.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: mib $ $Date: 2000-12-02 10:57:15 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,72 +65,35 @@ #pragma hdrstop -#ifndef _HINTS_HXX //autogen wg. SwFmtChg -#include <hints.hxx> -#endif - #ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP_ #include <com/sun/star/text/XTextDocument.hpp> #endif -#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_ -#include <com/sun/star/text/XText.hpp> -#endif -#ifndef _RTL_USTRBUF_HXX_ -#include <rtl/ustrbuf.hxx> -#endif - -#ifndef _SVSTDARR_STRINGSSORT_DECL -#define _SVSTDARR_STRINGSSORT -#include <svtools/svstdarr.hxx> -#endif - #ifndef _XMLOFF_XMLNMSPE_HXX #include <xmloff/xmlnmspe.hxx> #endif - #ifndef _XMLOFF_ATTRLIST_HXX #include <xmloff/attrlist.hxx> #endif - -#ifndef _XMLOFF_XMLASTPL_HXX -#include <xmloff/xmlastpl.hxx> -#endif - #ifndef _XMLOFF_XMLITMPR_HXX #include <xmloff/xmlexpit.hxx> #endif - #ifndef _XMLOFF_XMLKYWD_HXX #include <xmloff/xmlkywd.hxx> #endif - #ifndef _XMLOFF_NMSPMAP_HXX #include <xmloff/nmspmap.hxx> #endif - -#ifndef _XMLOFF_TXTSTYLE_HXX -#include <xmloff/txtstyle.hxx> -#endif - -#ifndef _XMLOFF_XMLPROPERTYSETMAPPER_HXX -#include <xmloff/xmlprmap.hxx> -#endif -#ifndef _XMLOFF_XMLPROPMAPPINGTYPES_HXX -#include <xmloff/maptype.hxx> -#endif -#ifndef _XMLOFF_XMLTYPES_HXX -#include <xmloff/xmltypes.hxx> +#ifndef _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX +#include <xmloff/XMLTextListAutoStylePool.hxx> #endif -#ifndef _XMLOFF_TXTPARAE_HXX -#include <xmloff/txtparae.hxx> +#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT +#include <xmloff/XMLTextMasterPageExport.hxx> #endif + #ifndef _XMLOFF_TXTPRMAP_HXX #include <xmloff/txtprmap.hxx> #endif -#ifndef _XMLOFF_XMLEXPPR_HXX -#include <xmloff/xmlexppr.hxx> -#endif #ifndef _XMLOFF_XMLASTPLP_HXX #include <xmloff/xmlaustp.hxx> #endif @@ -144,93 +107,25 @@ #ifndef _FORMAT_HXX //autogen wg. SwFmt #include <format.hxx> #endif -#ifndef _FMTCOL_HXX //autogen wg. SwTxtFmtColl -#include <fmtcol.hxx> -#endif -#ifndef _CHARFMT_HXX //autogen wg. SwCharFmt -#include <charfmt.hxx> -#endif -#ifndef _PARATR_HXX -#include <paratr.hxx> -#endif #ifndef _FMTPDSC_HXX #include <fmtpdsc.hxx> #endif #ifndef _PAGEDESC_HXX #include <pagedesc.hxx> #endif - -#ifndef _DOC_HXX //autogen wg. SwDoc -#include <doc.hxx> -#endif -#include "docary.hxx" -#ifndef _NDTXT_HXX //autogen wg. SwTxtNode -#include <ndtxt.hxx> -#endif -#ifndef _SECTION_HXX //autogen wg. SwSection -#include <section.hxx> -#endif -#ifndef _PAM_HXX //autogen wg. SwPaM -#include <pam.hxx> -#endif -#ifndef _TXATBASE_HXX -#include <txatbase.hxx> -#endif -#ifndef _XMLEXP_HXX -#include "xmlexp.hxx" -#endif -#ifndef _XMLTEXTE_HXX -#include "xmltexte.hxx" -#endif - -#ifndef _SWDOCSH_HXX -#include "docsh.hxx" -#endif -#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ -#include <com/sun/star/frame/XModel.hpp> -#endif -#ifndef _XMLOFF_XMLUCONV_HXX -#include <xmloff/xmluconv.hxx> -#endif -#ifndef _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX -#include <xmloff/XMLTextListAutoStylePool.hxx> -#endif - -#ifndef _COM_SUN_STAR_TEXT_XTEXTFIELD_HPP_ -#include <com/sun/star/text/XTextField.hpp> -#endif - -#ifndef _UNOFIELD_HXX -#include <unofield.hxx> -#endif - -#ifndef _XMLOFF_TXTFLDE_HXX -#include <xmloff/txtflde.hxx> -#endif - -#ifndef _XMLOFF_XMLNUMFE_HXX -#include <xmloff/xmlnumfe.hxx> -#endif -#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT -#include <xmloff/XMLTextMasterPageExport.hxx> -#endif - #ifndef _UNOSTYLE_HXX -#include "unostyle.hxx" +#include <unostyle.hxx> #endif - #ifndef _CELLATR_HXX -#include "cellatr.hxx" +#include <cellatr.hxx> #endif +#ifndef _XMLEXP_HXX +#include "xmlexp.hxx" +#endif -using namespace rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::xml::sax; -using namespace ::com::sun::star::style; -using namespace ::com::sun::star::frame; +using namespace ::rtl; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::text; void SwXMLExport::ExportFmt( const SwFmt& rFmt, const char *pFamily ) @@ -326,119 +221,6 @@ void SwXMLExport::ExportFmt( const SwFmt& rFmt, const char *pFamily ) } } -SwXMLTextParagraphExport::SwXMLTextParagraphExport( - SwXMLExport& rExp, - SvXMLAutoStylePoolP& rAutoStylePool ) : - XMLTextParagraphExport( rExp, rAutoStylePool ), - sTextTable( RTL_CONSTASCII_USTRINGPARAM( "TextTable" ) ) -{ -} - -SwXMLTextParagraphExport::~SwXMLTextParagraphExport() -{ -} - -void SwXMLTextParagraphExport::exportStyleContent( - const Reference< XStyle > & rStyle ) -{ - - const SwXStyle* pStyle = 0; - Reference<XUnoTunnel> xStyleTunnel( rStyle, UNO_QUERY); - if( xStyleTunnel.is() ) - { - pStyle = (SwXStyle*)xStyleTunnel->getSomething( - SwXStyle::getUnoTunnelId() ); - } - if( pStyle && SFX_STYLE_FAMILY_PARA == pStyle->GetFamily() ) - { - const SwDoc& rDoc = ((SwXMLExport&)GetExport()).GetDoc(); - const SwTxtFmtColl *pColl = - rDoc.FindTxtFmtCollByName( SwXStyleFamilies::GetUIName( pStyle->GetStyleName(), SFX_STYLE_FAMILY_PARA ) ); - ASSERT( pColl, "There is the text collection?" ); - if( pColl && RES_CONDTXTFMTCOLL == pColl->Which() ) - { - const SwFmtCollConditions& rConditions = - ((const SwConditionTxtFmtColl *)pColl)->GetCondColls(); - for( sal_uInt16 i=0; i < rConditions.Count(); i++ ) - { - const SwCollCondition& rCond = *rConditions[i]; - - const sal_Char *pFunc = 0; - OUStringBuffer sBuffer( 20 ); - switch( rCond.GetCondition() ) - { - case PARA_IN_LIST: - pFunc = sXML_list_level; - sBuffer.append( (sal_Int32)(rCond.GetSubCondition()+1) ); - break; - case PARA_IN_OUTLINE: - pFunc = sXML_outline_level; - sBuffer.append( (sal_Int32)(rCond.GetSubCondition()+1) ); - break; - case PARA_IN_FRAME: - pFunc = sXML_text_box; - break; - case PARA_IN_TABLEHEAD: - pFunc = sXML_table_header; - break; - case PARA_IN_TABLEBODY: - pFunc = sXML_table; - break; - case PARA_IN_SECTION: - pFunc = sXML_section; - break; - case PARA_IN_FOOTENOTE: - pFunc = sXML_footnote; - break; - case PARA_IN_FOOTER: - pFunc = sXML_footer; - break; - case PARA_IN_HEADER: - pFunc = sXML_header; - break; - case PARA_IN_ENDNOTE: - pFunc = sXML_endnote; - break; - } - OUString sVal( sBuffer.makeStringAndClear() ); - - DBG_ASSERT( pFunc, "SwXMLExport::ExportFmt: unknon condition" ); - if( pFunc ) - { - sBuffer.appendAscii( pFunc ); - sBuffer.append( (sal_Unicode)'(' ); - sBuffer.append( (sal_Unicode)')' ); - if( sVal.getLength() ) - { - sBuffer.append( (sal_Unicode)'=' ); - sBuffer.append( sVal ); - } - - GetExport().AddAttribute( XML_NAMESPACE_STYLE, - sXML_condition, - sBuffer.makeStringAndClear() ); - const String& rName = - SwXStyleFamilies::GetProgrammaticName( - rCond.GetTxtFmtColl()->GetName(), - SFX_STYLE_FAMILY_PARA ); - GetExport().AddAttribute( XML_NAMESPACE_STYLE, - sXML_apply_style_name, rName ); - SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, - sXML_map, sal_True, sal_True ); - } - } - } - } -} - -void SwXMLTextParagraphExport::exportTextAutoStyles() -{ - XMLTextParagraphExport::exportTextAutoStyles(); - GetAutoStylePool().exportXML( XML_STYLE_FAMILY_SD_GRAPHICS_ID, - GetExport().GetDocHandler(), - GetExport().GetMM100UnitConverter(), - GetExport().GetNamespaceMap() ); -} void SwXMLExport::_ExportStyles( sal_Bool bUsed ) { diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 902db5184ae0..4da011c13fbd 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlimp.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: mib $ $Date: 2000-12-15 12:14:46 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -264,8 +264,9 @@ SwXMLImport::SwXMLImport( sal_Bool bLDoc, sal_Bool bInsertMode, sal_uInt16 nStyleFamMask, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel, - const ::com::sun::star::uno::Reference< - ::com::sun::star::container::XIndexContainer > & rEGO ) : + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexContainer > & rEGO, + SvStorage *pPkg ) : SvXMLImport( rModel, rEGO ), bLoadDoc( bLDoc ), bInsert( bInsertMode ), @@ -276,7 +277,8 @@ SwXMLImport::SwXMLImport( pSttNdIdx( 0 ), bProgressValid( sal_False ), bShowProgress( sal_True ), - nProgress( 0 ) + nProgress( 0 ), + xPackage( pPkg ) { _InitItemImport(); diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index be312f66fe03..6e80a42b2219 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlimp.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: mib $ $Date: 2000-12-15 12:14:46 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,6 +62,10 @@ #ifndef _XMLIMP_HXX #define _XMLIMP_HXX +#ifndef _SVSTOR_HXX +#include <so3/svstor.hxx> +#endif + #ifndef _XMLOFF_XMLICTXT_HXX #include <xmloff/xmlictxt.hxx> #endif @@ -96,6 +100,7 @@ class SwXMLImport: public SvXMLImport SvXMLItemMapEntriesRef xTableColItemMap; SvXMLItemMapEntriesRef xTableRowItemMap; SvXMLItemMapEntriesRef xTableCellItemMap; + SvStorageRef xPackage; sal_uInt16 nStyleFamilyMask;// Mask of styles to load sal_Int32 nProgress; @@ -135,7 +140,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel, const ::com::sun::star::uno::Reference< - ::com::sun::star::container::XIndexContainer > & ); + ::com::sun::star::container::XIndexContainer > &, + SvStorage *pPkg ); ~SwXMLImport(); @@ -180,6 +186,8 @@ public: ::rtl::OUString *pParent=0 ) const; virtual void SetStatisticAttributes(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs); + + SvStorage *GetPackage() { return &xPackage; } }; inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx new file mode 100644 index 000000000000..ce221829ea1b --- /dev/null +++ b/sw/source/filter/xml/xmltexte.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * $RCSfile: xmltexte.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2001-01-03 11:41:33 $ + * + * 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): _______________________________________ + * + * + ************************************************************************/ + +#ifdef PRECOMPILED +#include "filt_pch.hxx" +#endif + +#pragma hdrstop + +#ifndef _IPOBJ_HXX +#include <so3/ipobj.hxx> +#endif + +#ifndef _XMLOFF_FAMILIES_HXX_ +#include <xmloff/families.hxx> +#endif +#ifndef _XMLOFF_XMLNMSPE_HXX +#include <xmloff/xmlnmspe.hxx> +#endif +#ifndef _XMLOFF_XMLKYWD_HXX +#include <xmloff/xmlkywd.hxx> +#endif + +#ifndef _DOC_HXX //autogen wg. SwDoc +#include <doc.hxx> +#endif +#ifndef _NDOLE_HXX +#include <ndole.hxx> +#endif +#ifndef _UNOSTYLE_HXX +#include <unostyle.hxx> +#endif +#ifndef _UNOFRAME_HXX +#include <unoframe.hxx> +#endif + +#ifndef _XMLEXP_HXX +#include "xmlexp.hxx" +#endif +#ifndef _XMLTEXTE_HXX +#include "xmltexte.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::style; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; + +// --------------------------------------------------------------------- + +SwNoTxtNode *SwXMLTextParagraphExport::GetNoTxtNode( + const Reference < XPropertySet >& rPropSet ) const +{ + Reference<XUnoTunnel> xCrsrTunnel( rPropSet, UNO_QUERY ); + ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" ); + SwXFrame *pFrame = + (SwXFrame *)xCrsrTunnel->getSomething( + SwXFrame::getUnoTunnelId() ); + ASSERT( pFrame, "SwXFrame missing" ); + SwFrmFmt *pFrmFmt = pFrame->GetFrmFmt(); + const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); + const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx(); + return pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetNoTxtNode(); +} + +void SwXMLTextParagraphExport::exportStyleContent( + const Reference< XStyle > & rStyle ) +{ + + const SwXStyle* pStyle = 0; + Reference<XUnoTunnel> xStyleTunnel( rStyle, UNO_QUERY); + if( xStyleTunnel.is() ) + { + pStyle = (SwXStyle*)xStyleTunnel->getSomething( + SwXStyle::getUnoTunnelId() ); + } + if( pStyle && SFX_STYLE_FAMILY_PARA == pStyle->GetFamily() ) + { + const SwDoc& rDoc = ((SwXMLExport&)GetExport()).GetDoc(); + const SwTxtFmtColl *pColl = + rDoc.FindTxtFmtCollByName( SwXStyleFamilies::GetUIName( pStyle->GetStyleName(), SFX_STYLE_FAMILY_PARA ) ); + ASSERT( pColl, "There is the text collection?" ); + if( pColl && RES_CONDTXTFMTCOLL == pColl->Which() ) + { + const SwFmtCollConditions& rConditions = + ((const SwConditionTxtFmtColl *)pColl)->GetCondColls(); + for( sal_uInt16 i=0; i < rConditions.Count(); i++ ) + { + const SwCollCondition& rCond = *rConditions[i]; + + const sal_Char *pFunc = 0; + OUStringBuffer sBuffer( 20 ); + switch( rCond.GetCondition() ) + { + case PARA_IN_LIST: + pFunc = sXML_list_level; + sBuffer.append( (sal_Int32)(rCond.GetSubCondition()+1) ); + break; + case PARA_IN_OUTLINE: + pFunc = sXML_outline_level; + sBuffer.append( (sal_Int32)(rCond.GetSubCondition()+1) ); + break; + case PARA_IN_FRAME: + pFunc = sXML_text_box; + break; + case PARA_IN_TABLEHEAD: + pFunc = sXML_table_header; + break; + case PARA_IN_TABLEBODY: + pFunc = sXML_table; + break; + case PARA_IN_SECTION: + pFunc = sXML_section; + break; + case PARA_IN_FOOTENOTE: + pFunc = sXML_footnote; + break; + case PARA_IN_FOOTER: + pFunc = sXML_footer; + break; + case PARA_IN_HEADER: + pFunc = sXML_header; + break; + case PARA_IN_ENDNOTE: + pFunc = sXML_endnote; + break; + } + OUString sVal( sBuffer.makeStringAndClear() ); + + DBG_ASSERT( pFunc, "SwXMLExport::ExportFmt: unknon condition" ); + if( pFunc ) + { + sBuffer.appendAscii( pFunc ); + sBuffer.append( (sal_Unicode)'(' ); + sBuffer.append( (sal_Unicode)')' ); + if( sVal.getLength() ) + { + sBuffer.append( (sal_Unicode)'=' ); + sBuffer.append( sVal ); + } + + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + sXML_condition, + sBuffer.makeStringAndClear() ); + const String& rName = + SwXStyleFamilies::GetProgrammaticName( + rCond.GetTxtFmtColl()->GetName(), + SFX_STYLE_FAMILY_PARA ); + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + sXML_apply_style_name, rName ); + SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, + sXML_map, sal_True, sal_True ); + } + } + } + } +} + +void SwXMLTextParagraphExport::exportTextAutoStyles() +{ + XMLTextParagraphExport::exportTextAutoStyles(); + GetAutoStylePool().exportXML( XML_STYLE_FAMILY_SD_GRAPHICS_ID, + GetExport().GetDocHandler(), + GetExport().GetMM100UnitConverter(), + GetExport().GetNamespaceMap() ); +} + +SwXMLTextParagraphExport::SwXMLTextParagraphExport( + SwXMLExport& rExp, + SvXMLAutoStylePoolP& rAutoStylePool ) : + XMLTextParagraphExport( rExp, rAutoStylePool ), + sTextTable( RTL_CONSTASCII_USTRINGPARAM( "TextTable" ) ) +{ +} + +SwXMLTextParagraphExport::~SwXMLTextParagraphExport() +{ +} + +void SwXMLTextParagraphExport::getTextEmbeddedObjectProperties( + const Reference < XPropertySet >& rPropSet, + OUString& rStreamName, + OUString& rClassId ) const +{ + SwOLENode *pOLENd = GetNoTxtNode( rPropSet )->GetOLENode(); + SwOLEObj& rOLEObj = pOLENd->GetOLEObj(); + + rStreamName = rOLEObj.GetName(); + const SvInPlaceObjectRef& rOLERef = rOLEObj.GetOleRef(); + rClassId = rOLERef->GetClassName().GetHexName(); +} diff --git a/sw/source/filter/xml/xmltexte.hxx b/sw/source/filter/xml/xmltexte.hxx index 582ab1785f58..c602d7d8766f 100644 --- a/sw/source/filter/xml/xmltexte.hxx +++ b/sw/source/filter/xml/xmltexte.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltexte.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mib $ $Date: 2000-12-02 10:57:15 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ class SwXMLExport; class SvXMLAutoStylePoolP; +class SwNoTxtNode; namespace com { namespace sun { namespace star { namespace style { class XStyle; } } } } @@ -76,9 +77,9 @@ class SwXMLTextParagraphExport : public XMLTextParagraphExport { const ::rtl::OUString sTextTable; - const SwNoTxtNode *GetNoTxtNode( + SwNoTxtNode *GetNoTxtNode( const ::com::sun::star::uno::Reference < - ::com::sun::star::beans::XPropertySet >& rPropSet ); + ::com::sun::star::beans::XPropertySet >& rPropSet ) const; protected: virtual void exportStyleContent( @@ -98,12 +99,11 @@ public: SvXMLAutoStylePoolP& rAutoStylePool ); ~SwXMLTextParagraphExport(); -// virtual ::rtl::OUString exportTextEmbeddedGraphic( -// const ::com::sun::star::uno::Reference < -// ::com::sun::star::beans::XPropertySet >& rPropSet ); - virtual ::rtl::OUString exportTextEmbeddedObject( + virtual void getTextEmbeddedObjectProperties( const ::com::sun::star::uno::Reference < - ::com::sun::star::beans::XPropertySet >& rPropSet ); + ::com::sun::star::beans::XPropertySet >& rPropSet, + ::rtl::OUString& rStreamName, + ::rtl::OUString& rClassId ) const; }; diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index b5a04ca95c58..1fd726cebcc5 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltexti.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mib $ $Date: 2000-11-27 13:41:51 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,12 @@ #pragma hdrstop +#ifndef _SO_CLSIDS_HXX +#include <so3/clsids.hxx> +#endif +#ifndef _EMBOBJ_HXX +#include <so3/embobj.hxx> +#endif #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> #endif @@ -83,6 +89,9 @@ #ifndef _UNOCOLL_HXX #include "unocoll.hxx" #endif +#ifndef _SW3IO_HXX +#include <sw3io.hxx> +#endif #ifndef _XMLIMP_HXX #include "xmlimp.hxx" @@ -138,9 +147,25 @@ sal_Bool SwXMLTextImportHelper::IsInHeaderFooter() const return pDoc->IsInHeaderFooter( pTxtCrsr->GetPaM()->GetPoint()->nNode ); } -Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( const OUString& rHRef ) +Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( + SvXMLImport& rImport, + const OUString& rHRef, + const OUString& rClassId ) { - String aObjName( rHRef ); + Reference < XPropertySet > xPropSet; + + String aObjName; + if( 0 == rHRef.compareToAscii( "#./", 3 ) ) + aObjName = rHRef.copy( 3 ); + else if( rHRef.getLength() && '#' == rHRef[0] ) + aObjName = rHRef.copy( 1 ); + + if( !aObjName.Len() ) + return xPropSet; + + SvGlobalName aClassId; + if( !rClassId.getLength() || !aClassId.MakeId( rClassId ) ) + return xPropSet; Reference<XUnoTunnel> xCrsrTunnel( GetCursor(), UNO_QUERY ); ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); @@ -150,10 +175,39 @@ Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( const ASSERT( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = pTxtCrsr->GetDoc(); + SvStorage *pPackage = ((SwXMLImport&)rImport).GetPackage(); + if( !pPackage || !pDoc->GetPersist() ) + return xPropSet; + + String aSrcObjName( aObjName ); + SvPersistRef xDstDoc( pDoc->GetPersist() ); + SvStorageRef xDst( pDoc->GetPersist()->GetStorage() ); + + // Sind Objektname und Storagename eindeutig? + if( xDstDoc->GetObjectList() ) + { + for( ULONG i = 0; i < xDstDoc->GetObjectList()->Count(); i++ ) + { + SvInfoObject* pTst = xDstDoc->GetObjectList()->GetObject(i); + // TODO: unicode: is this correct? + if( aObjName.EqualsIgnoreCaseAscii( pTst->GetObjName() ) || + aObjName.EqualsIgnoreCaseAscii( pTst->GetStorageName() ) ) + { + aObjName = Sw3Io::UniqueName( xDst, "Obj" ); + break; + } + } + } + + if( !pPackage->CopyTo( aSrcObjName, xDst, aObjName ) ) + return xPropSet; + + SvInfoObjectRef xInfo = new SvEmbeddedInfoObject( aObjName, aClassId ); + pDoc->GetPersist()->Insert( xInfo ); + SwFrmFmt *pFrmFmt = pTxtCrsr->GetDoc()->InsertOLE( *pTxtCrsr->GetPaM(), aObjName ); - Reference < XPropertySet > xPropSet( SwXFrames::GetObject( *pFrmFmt, - FLYCNTTYPE_OLE ) ); + xPropSet = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE ); return xPropSet; } diff --git a/sw/source/filter/xml/xmltexti.hxx b/sw/source/filter/xml/xmltexti.hxx index 2750130bae50..b3448e3b9958 100644 --- a/sw/source/filter/xml/xmltexti.hxx +++ b/sw/source/filter/xml/xmltexti.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltexti.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-11-27 13:42:23 $ + * last change: $Author: mib $ $Date: 2001-01-03 11:40:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,7 +84,9 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - createAndInsertOLEObject( const ::rtl::OUString& rHRef ); + createAndInsertOLEObject( SvXMLImport& rImport, + const ::rtl::OUString& rHRef, + const ::rtl::OUString& rClassId ); virtual sal_Bool IsInHeaderFooter() const; }; |