diff options
author | Michael Brauer <mib@openoffice.org> | 2000-11-07 13:05:53 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2000-11-07 13:05:53 +0000 |
commit | 94e5b59cf841026e48cb3b0a38df885914d969f2 (patch) | |
tree | 6a97c6e2b2547aeaba0b29179c246970af6b8d50 /sw | |
parent | 938bb7fde8e6b02794d326f4d83926b39eb29105 (diff) |
shape import/export, remoce core api code
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/xml/makefile.mk | 10 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 231 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.hxx | 61 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmt.cxx | 21 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmte.cxx | 484 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 39 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.hxx | 8 | ||||
-rw-r--r-- | sw/source/filter/xml/xmliteme.cxx | 147 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlitemi.cxx | 268 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlitemm.cxx | 232 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltble.cxx | 85 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltbli.cxx | 26 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltbli.hxx | 17 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltext.cxx | 1518 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexte.hxx | 7 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexti.hxx | 125 |
16 files changed, 86 insertions, 3193 deletions
diff --git a/sw/source/filter/xml/makefile.mk b/sw/source/filter/xml/makefile.mk index 1534f01d5af9..c5801866364b 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.1.1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: hr $ $Date: 2000-09-18 17:14:59 $ +# last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -85,19 +85,16 @@ CXXFILES = \ xmlimp.cxx \ wrtxml.cxx \ xmlexp.cxx \ - xmlectxt.cxx \ xmltext.cxx \ xmltbli.cxx \ xmltble.cxx \ xmlfmt.cxx \ xmlfmte.cxx \ xmlmeta.cxx \ - xmlnum.cxx \ xmlitemm.cxx \ xmlitemi.cxx \ xmliteme.cxx \ swxmlat.cxx \ - hintlist.cxx \ xmlbrsh.cxx SLOFILES = \ @@ -105,19 +102,16 @@ SLOFILES = \ $(SLO)$/xmlimp.obj \ $(SLO)$/wrtxml.obj \ $(SLO)$/xmlexp.obj \ - $(SLO)$/xmlectxt.obj \ $(SLO)$/xmltext.obj \ $(SLO)$/xmltbli.obj \ $(SLO)$/xmltble.obj \ $(SLO)$/xmlfmt.obj \ $(SLO)$/xmlfmte.obj \ $(SLO)$/xmlmeta.obj \ - $(SLO)$/xmlnum.obj \ $(SLO)$/xmlitemm.obj \ $(SLO)$/xmlitemi.obj \ $(SLO)$/xmliteme.obj \ $(SLO)$/swxmlat.obj \ - $(SLO)$/hintlist.obj \ $(SLO)$/xmlbrsh.obj EXCEPTIONSFILES= \ diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 701916318a90..e9515be6fe39 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.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-20 11:19:43 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,12 +65,13 @@ #pragma hdrstop -#ifndef _NODE_HXX //autogen wg. SwTableNode -#include <node.hxx> +#ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP_ +#include <com/sun/star/text/XTextDocument.hpp> #endif -#ifndef _NDTXT_HXX //autogen wg. SwTxtNode -#include <ndtxt.hxx> +#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_ +#include <com/sun/star/text/XText.hpp> #endif + #ifndef _PAM_HXX //autogen wg. SwPaM #include <pam.hxx> #endif @@ -94,68 +95,20 @@ #include <docsh.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 _XMLOFF_NMSPMAP_HXX #include <xmloff/nmspmap.hxx> #endif - #ifndef _XMLOFF_XMLNMSPE_HXX #include <xmloff/xmlnmspe.hxx> #endif - #ifndef _XMLOFF_XMLKYWD_HXX #include <xmloff/xmlkywd.hxx> #endif - #ifndef _XMLOFF_XMLCNITM_HXX #include <xmloff/xmlcnitm.hxx> #endif -#ifndef _XMLOFF_XMLASTPL_HXX -#include <xmloff/xmlastpl.hxx> -#endif - -#ifndef _XMLOFF_TXTFLDE_HXX -#include <xmloff/txtflde.hxx> -#endif - -#ifndef _XMLOFF_XMLNUMFE_HXX -#include <xmloff/xmlnumfe.hxx> -#endif - -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#endif - -#ifndef _XMLOFF_TXTPARAE_HXX -#include <xmloff/txtparae.hxx> -#endif -#ifndef _XMLOFF_XMLASTPLP_HXX -#include <xmloff/xmlaustp.hxx> -#endif -#ifndef _XMLOFF_TXTPRMAP_HXX -#include <xmloff/txtprmap.hxx> -#endif -#ifndef _XMLOFF_FAMILIES_HXX_ -#include <xmloff/families.hxx> -#endif -//#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT -//#include <xmloff/XMLTextMasterPageExport.hxx> -//#endif - -#ifndef _XMLNUME_HXX -#include <xmlnume.hxx> -#endif -#ifndef _XMLFMTE_HXX -#include <xmlfmte.hxx> -#endif #ifndef _XMLTEXTE_HXX #include <xmltexte.hxx> #endif @@ -217,28 +170,13 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM, #ifdef XML_CORE_API pCurPaM( 0 ), pOrigPaM( &rPaM ), - pParaItemMapper( 0 ), #endif pTableItemMapper( 0 ), -#ifdef XML_CORE_API - pItemSetAutoStylePool( new SwXMLAutoStylePool ), - pListElements( 0 ), - pExportedLists( 0 ), -#endif pTableLines( 0 ), bExportWholeDoc( bExpWholeDoc ), bExportFirstTableOnly( bExpFirstTableOnly ), bShowProgress( bShowProg ) -#ifdef XML_CORE_API - , pTextFieldExport( 0 ), - pNumberFormatExport( 0 ) -#endif { -// _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_TEXT, sXML_np_text, -// sXML_n_text, XML_NAMESPACE_TEXT ); -// _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_TABLE, sXML_np_table, -// sXML_n_table, XML_NAMESPACE_TABLE ); - const SfxPoolItem* pItem; const SfxItemPool& rPool = pDoc->GetAttrPool(); sal_uInt16 nItems = rPool.GetItemCount( RES_UNKNOWNATR_CONTAINER ); @@ -285,38 +223,22 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM, ::StartProgress( STR_STATSTR_W4WWRITE, 0, pDoc->GetNodes().Count(), pDoc->GetDocShell() ); -#ifdef XML_CORE_API - Reference< util::XNumberFormatsSupplier > xNumFmtSupp( - pDoc->GetDocShell()->GetBaseModel(), UNO_QUERY); - pNumberFormatExport = new SvXMLNumFmtExport( rHandler, xNumFmtSupp ); - - pTextFieldExport = new XMLTextFieldExport( *this ); -#endif -// xMasterPageExport = new XMLTextMasterPageExport( *this ); - SfxObjectShell* pObjSh = pDoc->GetDocShell(); if( pObjSh ) pObjSh->UpdateDocInfoForSave(); // update information } -#ifndef XML_CORE_API XMLTextParagraphExport* SwXMLExport::CreateTextParagraphExport() { return new SwXMLTextParagraphExport( *this, *GetAutoStylePool().get() ); } -#endif +XMLShapeExport* SwXMLExport::CreateShapeExport() +{ + return new XMLShapeExport( *this, XMLTextParagraphExport::CreateShapeExtPropMapper( *this ) ); +} __EXPORT SwXMLExport::~SwXMLExport() { -#ifdef XML_CORE_API - delete pItemSetAutoStylePool; -#endif - -#ifdef XML_CORE_API - delete pTextFieldExport; - delete pNumberFormatExport; -#endif - if( bShowProgress ) ::EndProgress( pDoc->GetDocShell() ); @@ -329,9 +251,6 @@ __EXPORT SwXMLExport::~SwXMLExport() } #endif _FinitItemExport(); -#ifdef XML_CORE_API - _FinitNumRuleExport(); -#endif ASSERT( !pTableLines, "there are table columns infos left" ); } @@ -430,131 +349,3 @@ void SwXMLExport::ExportCurPaM( sal_Bool bExportWholePaM ) ExportListChange( aPrevNumInfo, aNextNumInfo ); } #endif - - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlexp.cxx,v 1.3 2000-10-20 11:19:43 mib Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.2 2000/10/12 17:30:28 mib - export of master pages - - Revision 1.1.1.1 2000/09/18 17:15:00 hr - initial import - - Revision 1.35 2000/09/18 16:05:05 willem.vandorp - OpenOffice header added. - - Revision 1.34 2000/09/18 11:58:02 mib - text frames/graphics import and export continued - - Revision 1.33 2000/08/15 11:55:56 kz - #65293# del. 2. Parameter - - Revision 1.32 2000/08/10 10:22:15 mib - #74404#: Adeptions to new XSL/XLink working draft - - Revision 1.31 2000/08/02 14:52:39 mib - text export continued - - Revision 1.30 2000/07/31 09:42:35 mib - text export continued - - Revision 1.29 2000/07/27 08:06:33 mib - text import continued - - Revision 1.28 2000/07/26 05:11:20 mib - text import/export continued - - Revision 1.27 2000/07/24 12:01:21 dvo - - field declarations now exported at content beginning - - Revision 1.26 2000/07/24 10:19:02 dvo - - textfield export for XML_CORE_API - - Revision 1.25 2000/07/21 12:55:15 mib - text import/export using StarOffice API - - Revision 1.24 2000/06/08 09:45:54 aw - changed to use functionality from xmloff project now - - Revision 1.23 2000/05/03 12:08:05 mib - unicode - - Revision 1.22 2000/03/13 14:33:44 mib - UNO3 - - Revision 1.21 2000/02/11 14:40:57 hr - #70473# changes for unicode ( patched by automated patchtool ) - - Revision 1.20 2000/02/07 10:03:28 mib - #70271#: tables - - Revision 1.19 2000/01/20 10:03:15 mib - #70271#: Lists reworked - - Revision 1.18 2000/01/12 15:00:22 mib - #70271#: lists - - Revision 1.17 2000/01/06 15:08:27 mib - #70271#:separation of text/layout, cond. styles, adaptions to wd-xlink-19991229 - - Revision 1.16 1999/12/06 14:49:49 mib - #70271#: office:version attribute - - Revision 1.15 1999/12/06 11:41:33 mib - #70258#: Container item for unkown attributes - - Revision 1.14 1999/11/26 11:08:59 mib - progress, export-flags - - Revision 1.13 1999/11/22 15:52:34 os - headers added - - Revision 1.12 1999/11/17 20:07:53 nn - document language - - Revision 1.11 1999/11/12 14:50:28 mib - meta import and export reactivated - - Revision 1.10 1999/11/10 15:08:09 mib - Import now uses XMLItemMapper - - Revision 1.9 1999/11/09 15:40:29 mib - Using XMLItemMapper for export - - Revision 1.8 1999/11/05 19:43:18 nn - _ExportMeta - - Revision 1.7 1999/10/26 13:34:30 mib - removed 'using namespace' from header files - - Revision 1.6 1999/10/08 11:47:09 mib - moved some file to SVTOOLS/SVX - - Revision 1.5 1999/09/22 11:56:47 mib - string -> wstring - - Revision 1.4 1999/08/17 14:28:22 MIB - namespace map methods renamed consistently - - - Rev 1.3 17 Aug 1999 16:28:22 MIB - namespace map methods renamed consistently - - Rev 1.2 13 Aug 1999 16:21:14 MIB - new base class XMLExport, styles and sections - - Rev 1.1 12 Aug 1999 18:05:20 MIB - Export ofSvxFontItem, SvxFontHeightItem and SvxLRSpaceItem - - Rev 1.0 12 Aug 1999 12:28:54 MIB - Initial revision. - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index 479fd6246adf..2151ba585caa 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlexp.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-20 11:19:43 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,10 +99,6 @@ class SwXMLTableLinesCache_Impl; class SwXMLTableColumnsSortByWidth_Impl; class SwXMLTableFrmFmtsSort_Impl; class SwTableNode; -#ifdef XML_CORE_API -class SvXMLNumFmtExport; -class XMLTextFieldExport; -#endif class XMLPropertySetMapper; //class XMLTextMasterPageExport; class SwXMLTextParagraphExport; @@ -119,20 +115,8 @@ class SwXMLExport : public SvXMLExport SvXMLUnitConverter *pTwipUnitConv; -#ifdef XML_CORE_API - SvXMLExportItemMapper *pParaItemMapper; -#endif SvXMLExportItemMapper *pTableItemMapper; -#ifdef XML_CORE_API - SwXMLAutoStylePool *pItemSetAutoStylePool; - OUStrings_Impl *pListElements; - OUStringsSort_Impl *pExportedLists; -#endif SwXMLTableLinesCache_Impl *pTableLines; -#ifdef XML_CORE_API - SvXMLNumFmtExport *pNumberFormatExport; - XMLTextFieldExport *pTextFieldExport; -#endif SvXMLItemMapEntriesRef xTableItemMap; SvXMLItemMapEntriesRef xTableRowItemMap; @@ -146,21 +130,6 @@ class SwXMLExport : public SvXMLExport void _InitItemExport(); void _FinitItemExport(); -#ifdef XML_CORE_API - void _FinitNumRuleExport(); - - void AddTextAutoStyle( const SfxPoolItem& rItem ); - void AddParaAutoStyle( const ::rtl::OUString& rParent, - const SfxItemSet& rItemSet ); - ::rtl::OUString FindTextAutoStyle( const SfxPoolItem& rItem ); - ::rtl::OUString FindParaAutoStyle( const ::rtl::OUString& rParent, - const SfxItemSet& rItemSet ); - - void ExportCurPaMAutoStyles( sal_Bool bExportWholePaM=sal_True ); - void ExportTxtNodeAutoStyles( const SwTxtNode& rTxtNd, xub_StrLen nStart, - xub_StrLen nEnd, sal_Bool bExportWholeNode ); - void ExportSectionAutoStyles( const SwSectionNode& rSectNd ); -#endif void ExportTableLinesAutoStyles( const SwTableLines& rLines, sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth, @@ -170,21 +139,9 @@ class SwXMLExport : public SvXMLExport SwXMLTableFrmFmtsSort_Impl& rExpCells, sal_Bool bTop=sal_False ); -#ifdef XML_CORE_API - void ExportCurPaM( sal_Bool bExportWholePaM=sal_True ); - void ExportTxtNode( const SwTxtNode& rTxtNd, xub_StrLen nStart, - xub_StrLen nEnd, sal_Bool bExportWholeNode ); - void ExportSection( const SwSectionNode& rSectNd ); -#endif void ExportFmt( const SwFmt& rFmt, const sal_Char *pFamily = 0 ); void ExportTableFmt( const SwFrmFmt& rFmt, sal_uInt32 nAbsWidth ); -#ifdef XML_CORE_API - void ExportNumRules( sal_Bool bAuto, sal_Bool bUsed ); - void ExportNodeNum( const SwNodeNum& rNdNum ); - void ExportListChange( const SwXMLNumRuleInfo& rPrvInfo, - const SwXMLNumRuleInfo& rNextInfo ); -#endif void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol ); void ExportTableBox( const SwTableBox& rBox, sal_uInt16 nColSpan ); @@ -205,11 +162,10 @@ class SwXMLExport : public SvXMLExport protected: -#ifndef XML_CORE_API virtual XMLTextParagraphExport* CreateTextParagraphExport(); virtual SvXMLAutoStylePoolP* CreateAutoStylePool(); virtual XMLPageExport* CreatePageExport(); -#endif + virtual XMLShapeExport* CreateShapeExport(); public: @@ -227,22 +183,11 @@ public: void ExportTableAutoStyles( const SwTableNode& rTblNd ); void ExportTable( const SwTableNode& rTblNd ); -#ifdef XML_CORE_API - SvXMLExportItemMapper& GetParaItemMapper() { return *pParaItemMapper; } -#endif SvXMLExportItemMapper& GetTableItemMapper() { return *pTableItemMapper; } const UniReference < XMLPropertySetMapper >& GetParaPropMapper() { return xParaPropMapper; } -#ifdef XML_CORE_API - SwXMLAutoStylePool& GetItemSetAutoStylePool() { return *pItemSetAutoStylePool; } -#endif - -#ifdef XML_CORE_API - SvXMLNumFmtExport& GetNumberFormatExport() { return *pNumberFormatExport; } - XMLTextFieldExport& GetTextFieldExport() { return *pTextFieldExport; } -#endif SwDoc& GetDoc() { return *pDoc; } }; diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 596ed311df19..3bb0ad431612 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlfmt.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: rt $ $Date: 2000-10-24 14:38:20 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -159,9 +159,6 @@ #ifndef _XMLIMP_HXX #include "xmlimp.hxx" #endif -#ifndef _XMLNUM_HXX -#include "xmlnum.hxx" -#endif #ifndef _XMLTBLI_HXX #include "xmltbli.hxx" #endif @@ -845,7 +842,8 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext( rLocalName, xAttrList, nFamily ); break; case XML_STYLE_FAMILY_SD_GRAPHICS_ID: - // HACK until CL is back again + // As long as there are no element items, we can use the text + // style class. pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName, xAttrList, *this ); break; @@ -908,10 +906,10 @@ UniReference < SvXMLImportPropertyMapper > SwXMLStylesContext_Impl::GetImportPro sal_uInt16 nFamily ) const { UniReference < SvXMLImportPropertyMapper > xMapper; - if( XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily ) - xMapper = ((SvXMLImport *)&GetImport())->GetTextImport() - ->GetFrameImportPropertySetMapper(); - else +// if( XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily ) +// xMapper = ((SvXMLImport *)&GetImport())->GetTextImport() +// ->GetFrameImportPropertySetMapper(); +// else xMapper = SvXMLStylesContext::GetImportPropertyMapper( nFamily ); return xMapper; @@ -1037,7 +1035,10 @@ void SwXMLImport::InsertStyles( sal_Bool bAuto ) sal_False ); if( bAuto && xAutoStyles.Is() ) + { GetTextImport()->SetAutoStyles( (SwXMLStylesContext_Impl *)&xAutoStyles ); + GetShapeImport()->SetAutoStylesContext( (SwXMLStylesContext_Impl *)&xAutoStyles ); + } } void SwXMLImport::FinishStyles() diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index 86ae73962b73..557fdd92495f 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.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mib $ $Date: 2000-10-20 11:19:43 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -176,12 +176,6 @@ #ifndef _XMLEXP_HXX #include "xmlexp.hxx" #endif -#ifndef _XMLECTXT_HXX -#include "xmlectxt.hxx" -#endif -#ifndef _XMLFMTE_HXX -#include "xmlfmte.hxx" -#endif #ifndef _XMLTEXTE_HXX #include "xmltexte.hxx" #endif @@ -195,11 +189,9 @@ #ifndef _XMLOFF_XMLUCONV_HXX #include <xmloff/xmluconv.hxx> #endif -#ifndef XML_CORE_API #ifndef _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX #include <xmloff/XMLTextListAutoStylePool.hxx> #endif -#endif #ifndef _COM_SUN_STAR_TEXT_XTEXTFIELD_HPP_ #include <com/sun/star/text/XTextField.hpp> @@ -303,8 +295,6 @@ void SwXMLExport::ExportFmt( const SwFmt& rFmt, const char *pFamily ) } } -#ifndef XML_CORE_API - SwXMLTextParagraphExport::SwXMLTextParagraphExport( SwXMLExport& rExp, SvXMLAutoStylePoolP& rAutoStylePool ) : @@ -414,301 +404,28 @@ void SwXMLTextParagraphExport::exportTextAutoStyles() { XMLTextParagraphExport::exportTextAutoStyles(); GetAutoStylePool().exportXML( XML_STYLE_FAMILY_SD_GRAPHICS_ID, - *GetAutoFramePropMapper().get(), GetExport().GetDocHandler(), GetExport().GetMM100UnitConverter(), GetExport().GetNamespaceMap() ); } -#endif void SwXMLExport::_ExportStyles( sal_Bool bUsed ) { -#ifdef XML_CORE_API - // text collections - SvStringsSort *pCollNames = bUsed ? new SvStringsSort : 0; - sal_uInt16 nCount = pDoc->GetTxtFmtColls()->Count(); - sal_uInt16 i; - for( i=0; i<nCount; i++ ) - { - const SwTxtFmtColl *pColl = (*pDoc->GetTxtFmtColls())[i]; - if( ( !bUsed || pDoc->IsUsed( *pColl ) ) && !pColl->IsDefault() ) - { - ExportFmt( *pColl ); - if( pCollNames ) - pCollNames->Insert( (String *)&pColl->GetName() ); - } - } - if( bUsed ) - { - // Even if some next styles have not been used, they have to be - // exported. - for( i = 0; i < nCount; i++ ) - { - const SwTxtFmtColl* pColl = (*pDoc->GetTxtFmtColls())[ i ]; - if( pColl != &pColl->GetNextTxtFmtColl() && - !pCollNames->Seek_Entry( - (String *)&pColl->GetNextTxtFmtColl().GetName() ) ) - { - ExportFmt( pColl->GetNextTxtFmtColl() ); - pCollNames->Insert( - (String *)&pColl->GetNextTxtFmtColl().GetName() ); - } - } - delete pCollNames; - } - - // char fmts - nCount = pDoc->GetCharFmts()->Count(); - for( i=0; i<nCount; i++ ) - { - const SwCharFmt *pFmt = (*pDoc->GetCharFmts())[i]; - if( ( !bUsed || pDoc->IsUsed( *pFmt ) ) && !pFmt->IsDefault() ) - ExportFmt( *pFmt ); - } - - // num rules - ExportNumRules( sal_False, bUsed ); -#else GetTextParagraphExport()->exportTextStyles( bUsed ); -#endif -} - -// --------------------------------------------------------------------- - -#ifdef XML_CORE_API -void SwXMLExport::AddTextAutoStyle( const SfxPoolItem& rItem ) -{ - SfxItemSet aItemSet( pDoc->GetAttrPool(), - RES_CHRATR_BEGIN, RES_CHRATR_END - 1, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END - 1, 0 ); - aItemSet.Put( rItem ); - pItemSetAutoStylePool->Add( SFX_STYLE_FAMILY_CHAR, aItemSet ); -} - -void SwXMLExport::AddParaAutoStyle( const OUString& rParent, - const SfxItemSet& rItemSet ) -{ - pItemSetAutoStylePool->Add( SFX_STYLE_FAMILY_PARA, - SwXStyleFamilies::GetProgrammaticName(rParent, SFX_STYLE_FAMILY_PARA ), - rItemSet ); -} - -OUString SwXMLExport::FindTextAutoStyle( const SfxPoolItem& rItem ) -{ - SfxItemSet aItemSet( pDoc->GetAttrPool(), - RES_CHRATR_BEGIN, RES_CHRATR_END - 1, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END - 1, 0 ); - aItemSet.Put( rItem ); - return pItemSetAutoStylePool->Find( SFX_STYLE_FAMILY_CHAR, aItemSet ); -} - -OUString SwXMLExport::FindParaAutoStyle( const OUString& rParent, - const SfxItemSet& rItemSet ) -{ - return pItemSetAutoStylePool->Find( - SFX_STYLE_FAMILY_PARA, - SwXStyleFamilies::GetProgrammaticName(rParent, SFX_STYLE_FAMILY_PARA ), - rItemSet ); -} - -void SwXMLExport::ExportTxtNodeAutoStyles( const SwTxtNode& rTxtNd, - xub_StrLen nStart, xub_StrLen nEnd, - sal_Bool bExportWholeNode ) -{ - const SfxItemSet *pItemSet = rTxtNd.GetpSwAttrSet(); - if( pItemSet ) - { - const SwFmtColl& rColl = rTxtNd.GetAnyFmtColl(); - OUString sParent( rColl.GetName() ); - AddParaAutoStyle( sParent, *pItemSet ); - - if( rTxtNd.GetCondFmtColl() && - &rColl != rTxtNd.GetFmtColl() ) - { - const SwFmtColl *pColl = rTxtNd.GetFmtColl(); - sParent = pColl->GetName(); - AddParaAutoStyle( sParent, *pItemSet ); - } - } - - xub_StrLen nPos = pCurPaM->GetPoint()->nContent.GetIndex(); - xub_StrLen nEndPos = rTxtNd.GetTxt().Len(); - if( pCurPaM->GetPoint()->nNode == pCurPaM->GetMark()->nNode ) - nEndPos = pCurPaM->GetMark()->nContent.GetIndex(); - - const SwpHints *pHints = rTxtNd.GetpSwpHints(); - sal_uInt16 nHintCount = pHints ? pHints->Count() : 0; - sal_uInt16 nHintPos = 0; - const SwTxtAttr * pTxtAttr = 0; - - if( nHintCount && nPos > *( pTxtAttr = (*pHints)[0] )->GetStart() ) - { - do - { - nHintPos++; - sal_uInt16 nWhich = pTxtAttr->Which(); - if( pTxtAttr->GetEnd() && - ( (nWhich >= RES_CHRATR_BEGIN && nWhich < RES_CHRATR_END) || - (nWhich >= RES_UNKNOWNATR_BEGIN && - nWhich < RES_UNKNOWNATR_END) ) ) - { - xub_StrLen nHtEnd = *pTxtAttr->GetEnd(), - nHtStt = *pTxtAttr->GetStart(); - if( (bExportWholeNode || nHtEnd > nPos) && - nHtEnd != nHtStt ) - { - AddTextAutoStyle( pTxtAttr->GetAttr() ); - } - } - - } - while( nHintPos < nHintCount && - nPos > *( pTxtAttr = (*pHints)[nHintPos ] )->GetStart() ); - } - - for( ; nPos < nEndPos; nPos++ ) - { - if( nHintPos < nHintCount && *pTxtAttr->GetStart() == nPos - && nPos != nEndPos ) - { - do - { - sal_uInt16 nWhich = pTxtAttr->Which(); - if( pTxtAttr->GetEnd() && *pTxtAttr->GetEnd() != nPos && - ( (nWhich >= RES_CHRATR_BEGIN && nWhich < RES_CHRATR_END) || - (nWhich >= RES_UNKNOWNATR_BEGIN && - nWhich < RES_UNKNOWNATR_END) ) ) - { - AddTextAutoStyle( pTxtAttr->GetAttr() ); - } else if( nWhich == RES_TXTATR_FIELD ) { - // text field found: export AutoStyle -#ifdef XML_CORE_API -// Reference < text::XTextField > xFld = new SwXTextField( -// ((const SwFmtFld&)pTxtAttr->GetAttr()), &GetDoc() ); -// -// GetTextFieldExport().ExportFieldAutoStyle( xFld ); -#endif - } - } - while( ++nHintPos < nHintCount && - nPos == *( pTxtAttr = (*pHints)[nHintPos] )->GetStart() ); - } - } -} - -void SwXMLExport::ExportSectionAutoStyles( const SwSectionNode& rSectNd ) -{ - SwNode *pStartNd = pDoc->GetNodes()[rSectNd.GetIndex() + 1]; - SwNode *pEndNd = pDoc->GetNodes()[rSectNd.EndOfSectionIndex() - 1]; - - { - SwXMLExpContext aContext( *this, *pStartNd, *pEndNd, 0, STRING_LEN ); - ExportCurPaMAutoStyles(); - } - - pCurPaM->GetPoint()->nNode = *rSectNd.EndOfSectionNode(); -} - -void SwXMLExport::ExportCurPaMAutoStyles( sal_Bool bExportWholePaM ) -{ - sal_Bool bFirstNode = sal_True; - sal_Bool bExportWholeNode = bExportWholePaM; - - while( pCurPaM->GetPoint()->nNode.GetIndex() < - pCurPaM->GetMark()->nNode.GetIndex() || - ( pCurPaM->GetPoint()->nNode.GetIndex() == - pCurPaM->GetMark()->nNode.GetIndex() && - pCurPaM->GetPoint()->nContent.GetIndex() <= - pCurPaM->GetMark()->nContent.GetIndex() ) ) - { - SwNode *pNd = pCurPaM->GetNode(); - - ASSERT( !(pNd->IsGrfNode() || pNd->IsOLENode()), - "SwXMLExport::exportCurPaM: grf or OLE node unexpected" ); - if( pNd->IsTxtNode() ) - { - SwTxtNode* pTxtNd = pNd->GetTxtNode(); - - if( !bFirstNode ) - pCurPaM->GetPoint()->nContent.Assign( pTxtNd, 0 ); - - ExportTxtNodeAutoStyles( *pTxtNd, 0, STRING_LEN, bExportWholeNode ); - } - else if( pNd->IsTableNode() ) - { - ExportTableAutoStyles( *pNd->GetTableNode() ); - } - else if( pNd->IsSectionNode() ) - { - ExportSectionAutoStyles( *pNd->GetSectionNode() ); - } - else if( pNd == &pDoc->GetNodes().GetEndOfContent() ) - break; - - pCurPaM->GetPoint()->nNode++; // next node - - // if not everything should be exported, the WriteAll flag must be - // set for all but the first and last node anyway. - bExportWholeNode = bExportWholePaM || - pCurPaM->GetPoint()->nNode.GetIndex() != - pCurPaM->GetMark()->nNode.GetIndex(); - bFirstNode = sal_False; - } } -#endif void SwXMLExport::_ExportAutoStyles() { -#ifdef XML_CORE_API - // export all PaMs - SwPaM *pPaM = pOrigPaM; - sal_Bool bContinue = sal_True; - do - { - // export PaM content - ExportCurPaMAutoStyles( bExportWholeDoc ); - - bContinue = pPaM->GetNext() != pOrigPaM; - - // the current PaM must be at the start if this loop finishes - pPaM = (SwPaM *)pPaM->GetNext(); - SetCurPaM( *pPaM, bExportWholeDoc, bExportFirstTableOnly ); - - } while( bContinue ); - - // text collections - ((SvXMLAutoStylePool *)pItemSetAutoStylePool)->exportXML( SFX_STYLE_FAMILY_PARA, - GetParaItemMapper(), - GetDocHandler(), - GetTwipUnitConverter(), - GetNamespaceMap() ); - - // char fmts - ((SvXMLAutoStylePool *)pItemSetAutoStylePool)->exportXML( SFX_STYLE_FAMILY_CHAR, - GetParaItemMapper(), - GetDocHandler(), - GetTwipUnitConverter(), - GetNamespaceMap() ); - - // num rules - ExportNumRules( sal_True, sal_False ); - - // text field styles -// GetNumberFormatExport().Export( GetNamespaceMap() ); - -#else Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); GetTextParagraphExport()->collectFrameBoundToPageAutoStyles(); GetTextParagraphExport()->collectTextAutoStyles( xText ); GetPageExport()->collectAutoStyles( sal_False ); + GetTextParagraphExport()->exportTextAutoStyles(); GetPageExport()->exportAutoStyles(); exportAutoDataStyles(); - -#endif - } XMLPageExport* SwXMLExport::CreatePageExport() @@ -722,33 +439,6 @@ void SwXMLExport::_ExportMasterStyles() } // --------------------------------------------------------------------- - -#ifdef XML_CORE_API -void SwXMLAutoStylePool::exportXML( SvXMLAttributeList& rAttrList, - SfxStyleFamily eFamily, const SfxItemSet& rItemSet, - const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const -{ - if( SFX_STYLE_FAMILY_PARA == eFamily ) - { - const SfxPoolItem *pItem; - if( SFX_ITEM_SET == rItemSet.GetItemState( RES_PARATR_NUMRULE, sal_False, - &pItem ) ) - { - OUString sName( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, - OUString::createFromAscii(sXML_list_style_name) ) ); - rAttrList.AddAttribute( sName, - OUString::createFromAscii( sXML_CDATA ), - ((const SwNumRuleItem *)pItem)->GetValue() ); - } - } -} - -SwXMLAutoStylePool::~SwXMLAutoStylePool() -{ -} -#else - class SwXMLAutoStylePoolP : public SvXMLAutoStylePoolP { SvXMLExport& rExport; @@ -836,171 +526,3 @@ SvXMLAutoStylePoolP* SwXMLExport::CreateAutoStylePool() { return new SwXMLAutoStylePoolP( *this ); } -#endif - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlfmte.cxx,v 1.5 2000-10-20 11:19:43 mib Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.4 2000/10/18 11:20:44 mib - master page import and export continued - - Revision 1.3 2000/10/12 17:30:28 mib - export of master pages - - Revision 1.2 2000/09/29 10:54:05 mib - export graphics styles again - - Revision 1.1.1.1 2000/09/18 17:15:00 hr - initial import - - Revision 1.23 2000/09/18 16:05:06 willem.vandorp - OpenOffice header added. - - Revision 1.22 2000/09/18 11:58:02 mib - text frames/graphics import and export continued - - Revision 1.21 2000/09/07 05:29:00 mib - #78555#: Search paragraph styles by programmatic name instead of UI name - - Revision 1.20 2000/08/24 11:16:41 mib - text import continued - - Revision 1.19 2000/08/21 11:02:50 dvo - - fixed data style export (for textfields) - - Revision 1.18 2000/08/10 10:22:16 mib - #74404#: Adeptions to new XSL/XLink working draft - - Revision 1.17 2000/08/02 14:52:39 mib - text export continued - - Revision 1.16 2000/07/31 09:42:35 mib - text export continued - - Revision 1.15 2000/07/27 08:06:34 mib - text import continued - - Revision 1.14 2000/07/26 05:11:20 mib - text import/export continued - - Revision 1.13 2000/07/24 10:19:02 dvo - - textfield export for XML_CORE_API - - Revision 1.12 2000/07/21 12:55:15 mib - text import/export using StarOffice API - - Revision 1.11 2000/07/10 06:58:49 mib - text styles - - Revision 1.10 2000/07/07 13:58:36 mib - text styles using StarOffice API - - Revision 1.9 2000/06/08 09:45:54 aw - changed to use functionality from xmloff project now - - Revision 1.8 2000/05/03 12:08:05 mib - unicode - - Revision 1.7 2000/03/13 14:33:44 mib - UNO3 - - Revision 1.6 2000/03/06 10:46:11 mib - #72585#: toInt32 - - Revision 1.5 2000/02/11 14:41:57 hr - #70473# changes for unicode ( patched by automated patchtool ) - - Revision 1.4 2000/02/07 10:03:28 mib - #70271#: tables - - Revision 1.3 2000/01/20 10:03:16 mib - #70271#: Lists reworked - - Revision 1.2 2000/01/12 15:00:23 mib - #70271#: lists - - Revision 1.1 2000/01/06 15:03:40 mib - #70271#:separation of text/layout, cond. styles, adaptions to wd-xlink-19991229 - - Revision 1.23 1999/12/13 08:28:25 mib - #70271#: Support for element items added - - Revision 1.22 1999/12/06 11:41:33 mib - #70258#: Container item for unkown attributes - - Revision 1.21 1999/11/26 11:13:57 mib - loading of styles only and insert mode - - Revision 1.20 1999/11/22 15:52:34 os - headers added - - Revision 1.19 1999/11/17 20:08:49 nn - document language - - Revision 1.18 1999/11/12 14:50:28 mib - meta import and export reactivated - - Revision 1.17 1999/11/12 11:43:03 mib - using item mapper, part iii - - Revision 1.16 1999/11/10 15:08:09 mib - Import now uses XMLItemMapper - - Revision 1.15 1999/11/09 15:40:08 mib - Using XMLItemMapper for export - - Revision 1.14 1999/11/05 19:44:11 nn - handle office:meta - - Revision 1.13 1999/11/01 11:38:50 mib - List style import - - Revision 1.12 1999/10/25 10:41:48 mib - Using new OUString ASCII methods - - Revision 1.11 1999/10/22 09:49:16 mib - List style export - - Revision 1.10 1999/10/15 12:37:05 mib - integrated SvXMLStyle into SvXMLStyleContext - - Revision 1.9 1999/10/08 11:47:45 mib - moved some file to SVTOOLS/SVX - - Revision 1.8 1999/10/01 13:02:51 mib - no comparisons between OUString and char* any longer - - Revision 1.7 1999/09/28 10:47:58 mib - char fmts again - - Revision 1.6 1999/09/28 08:31:15 mib - char fmts, hints - - Revision 1.5 1999/09/23 11:53:58 mib - i18n, token maps and hard paragraph attributes - - Revision 1.4 1999/09/22 11:56:57 mib - string -> wstring - - Revision 1.3 1999/08/19 12:57:42 MIB - attribute import added - - - Rev 1.2 19 Aug 1999 14:57:42 MIB - attribute import added - - Rev 1.1 18 Aug 1999 17:03:36 MIB - Style import - - Rev 1.0 13 Aug 1999 16:18:10 MIB - Initial revision. - - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index fffbdde73b42..5ba92efe3c9e 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.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mib $ $Date: 2000-10-18 11:20:44 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,45 +65,32 @@ #pragma hdrstop -#ifndef _PAM_HXX //autogen wg. SwPaM -#include <pam.hxx> +#ifndef _COM_SUN_STAR_TEXT_XTEXTRANGE_HPP_ +#include <com/sun/star/text/XTextRange.hpp> #endif - -#ifndef _XMLOFF_NMSPMAP_HXX -#include <xmloff/nmspmap.hxx> +#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_ +#include <com/sun/star/text/XText.hpp> #endif #ifndef _XMLOFF_XMLNMSPE_HXX #include <xmloff/xmlnmspe.hxx> #endif - -#ifndef _XMLOFF_I18NMAP_HXX -#include <xmloff/i18nmap.hxx> -#endif - #ifndef _XMLOFF_XMLTKMAP_HXX #include <xmloff/xmltkmap.hxx> #endif - #ifndef _XMLOFF_XMLKYWD_HXX #include <xmloff/xmlkywd.hxx> #endif - #ifndef _XMLOFF_XMLICTXT_HXX #include <xmloff/xmlictxt.hxx> #endif #ifndef _XMLOFF_TXTIMP_HXX #include <xmloff/txtimp.hxx> #endif - - -#ifndef _COM_SUN_STAR_TEXT_XTEXTRANGE_HPP_ -#include <com/sun/star/text/XTextRange.hpp> +#ifndef _XMLOFF_XMLTEXTSHAPEIMPORTHELPER_HXX_ +#include <xmloff/XMLTextShapeImportHelper.hxx> #endif -#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_ -#include <com/sun/star/text/XText.hpp> -#endif #ifndef _DOC_HXX #include <doc.hxx> #endif @@ -119,6 +106,10 @@ #ifndef _NDTXT_HXX #include <ndtxt.hxx> #endif +#ifndef _PAM_HXX //autogen wg. SwPaM +#include <pam.hxx> +#endif + #ifndef _XMLIMP_HXX #include "xmlimp.hxx" #endif @@ -468,3 +459,9 @@ SwXMLImport::~SwXMLImport() delete pTableElemTokenMap; _FinitItemImport(); } + + +XMLShapeImportHelper* SwXMLImport::CreateShapeImport() +{ + return new XMLTextShapeImportHelper( *this ); +} diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index 7531507ae854..307f6788d4d0 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -1,10 +1,10 @@ -/************************************************************************* +/************************************************************************ * * $RCSfile: xmlimp.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mib $ $Date: 2000-10-18 11:20:44 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -123,6 +123,8 @@ protected: virtual XMLTextImportHelper* CreateTextImport(); + virtual XMLShapeImportHelper* CreateShapeImport(); + public: SwXMLImport( SwDoc& rDoc, const SwPaM& rPaM, sal_Bool bLoadDoc, diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index e952d9fbd075..12147f4fdcef 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmliteme.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:59 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,9 +133,6 @@ #include "swrect.hxx" #endif -#ifndef _XMLDROPE_HXX -#include "xmldrope.hxx" -#endif #ifndef _XMLEXP_HXX #include "xmlexp.hxx" #endif @@ -144,95 +141,10 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -#ifdef XML_CORE_API -extern SvXMLItemMapEntry aXMLParaItemMap[]; -#endif extern SvXMLItemMapEntry aXMLTableItemMap[]; extern SvXMLItemMapEntry aXMLTableRowItemMap[]; extern SvXMLItemMapEntry aXMLTableCellItemMap[]; -#ifdef XML_CORE_API -class SwXMLTextItemMapper_Impl: public SvXMLExportItemMapper -{ -protected: - SvXMLUnitConverter& mrUnitConverter; - const Reference< xml::sax::XDocumentHandler > & mrHandler; - SvxXMLTabStopExport maTabStopExport; - -public: - - SwXMLTextItemMapper_Impl( - SvXMLItemMapEntriesRef rMapEntries, - SvXMLUnitConverter& rUnitConverter, - const Reference< xml::sax::XDocumentHandler > & rHandler ); - - virtual ~SwXMLTextItemMapper_Impl(); - - virtual void handleElementItem( - const Reference< xml::sax::XDocumentHandler > & rHandler, - const SvXMLItemMapEntry& rEntry, - const SfxPoolItem& rItem, - const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap, - const SfxItemSet& rSet, - sal_uInt16 nFlags ) const; -}; - -SwXMLTextItemMapper_Impl::SwXMLTextItemMapper_Impl( - SvXMLItemMapEntriesRef rMapEntries, - SvXMLUnitConverter& rUnitConverter, - const Reference< xml::sax::XDocumentHandler > & rHandler ) : - SvXMLExportItemMapper( rMapEntries ), - mrUnitConverter(rUnitConverter), - mrHandler( rHandler ), - maTabStopExport( rHandler, rUnitConverter ) -{ -} - -SwXMLTextItemMapper_Impl::~SwXMLTextItemMapper_Impl() -{ -} - -/** this method is called for every item that has the - MID_FLAG_ELEMENT_EXPORT flag set */ -void SwXMLTextItemMapper_Impl::handleElementItem( - const Reference< xml::sax::XDocumentHandler > & rHandler, - const SvXMLItemMapEntry& rEntry, - const SfxPoolItem& rItem, - const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap, - const SfxItemSet&, - sal_uInt16 ) const -{ - switch( rEntry.nWhichId ) - { - case RES_PARATR_TABSTOP: - { - SvxXMLTabStopExport aTabStopExport( rHandler, rUnitConverter ); - - Any aAny; - rItem.QueryValue( aAny, 0 ); - aTabStopExport.Export( aAny, rNamespaceMap ); - } - break; - case RES_PARATR_DROP: - { - SwXMLFmtDropExport aFmtDropExport( rHandler, rUnitConverter ); - aFmtDropExport.exportXML( (const SwFmtDrop&)rItem, rNamespaceMap ); - } - break; - case RES_BACKGROUND: - { - SwXMLBrushItemExport aBrushItemExport( rHandler, rUnitConverter ); - aBrushItemExport.exportXML( (const SvxBrushItem&)rItem, - rNamespaceMap ); - } - break; - } -} -#endif - -// ---------------------------------------------------------------------------- class SwXMLTableItemMapper_Impl: public SvXMLExportItemMapper { @@ -412,15 +324,6 @@ void SwXMLExport::_InitItemExport() pTwipUnitConv = new SvXMLUnitConverter( MAP_TWIP, GetMM100UnitConverter().getXMLMeasureUnit() ); -#ifdef XML_CORE_API - SvXMLItemMapEntriesRef xParaItemMap = - new SvXMLItemMapEntries( aXMLParaItemMap ); - - pParaItemMapper = new SwXMLTextItemMapper_Impl( xParaItemMap, - *pTwipUnitConv, - GetDocHandler() ); -#endif - xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); xTableRowItemMap = new SvXMLItemMapEntries( aXMLTableRowItemMap ); xTableCellItemMap = new SvXMLItemMapEntries( aXMLTableCellItemMap ); @@ -432,9 +335,6 @@ void SwXMLExport::_InitItemExport() void SwXMLExport::_FinitItemExport() { -#ifdef XML_CORE_API - delete pParaItemMapper; -#endif delete pTableItemMapper; delete pTwipUnitConv; } @@ -445,46 +345,3 @@ void SwXMLExport::ExportTableFmt( const SwFrmFmt& rFmt, sal_uInt32 nAbsWidth ) ->SetAbsWidth( nAbsWidth ); ExportFmt( rFmt, sXML_table ); } - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmliteme.cxx,v 1.1.1.1 2000-09-18 17:14:59 hr Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.10 2000/09/18 16:05:07 willem.vandorp - OpenOffice header added. - - Revision 1.9 2000/08/02 14:52:39 mib - text export continued - - Revision 1.8 2000/07/31 09:42:35 mib - text export continued - - Revision 1.7 2000/06/08 09:45:54 aw - changed to use functionality from xmloff project now - - Revision 1.6 2000/05/03 12:08:05 mib - unicode - - Revision 1.5 2000/03/13 14:33:44 mib - UNO3 - - Revision 1.4 2000/02/11 14:41:45 hr - #70473# changes for unicode ( patched by automated patchtool ) - - Revision 1.3 2000/02/07 10:03:28 mib - #70271#: tables - - Revision 1.2 2000/01/20 14:03:58 mib - #70271#: deletion of unit converter - - Revision 1.1 1999/12/14 07:32:49 mib - #70271#: XML import/export of drop cap/register/language item, splitted swxmlat - - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 4fae5b362f1f..3d57a4745709 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlitemi.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:15:00 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,14 +133,6 @@ #include <unomid.h> #endif -#ifndef _XMDROPI_HXX -#include "xmldropi.hxx" -#endif -#ifdef XML_CORE_API -#ifndef _XMLTBLI_HXX -#include "xmltbli.hxx" -#endif -#endif #ifndef _XMLIMP_HXX #include "xmlimp.hxx" #endif @@ -149,139 +141,11 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -#ifdef XML_CORE_API -extern SvXMLItemMapEntry aXMLParaItemMap[]; -#endif extern SvXMLItemMapEntry aXMLTableItemMap[]; extern SvXMLItemMapEntry aXMLTableColItemMap[]; extern SvXMLItemMapEntry aXMLTableRowItemMap[]; extern SvXMLItemMapEntry aXMLTableCellItemMap[]; -#ifdef XML_CORE_API -class SwXMLImportTextItemMapper_Impl: public SvXMLImportItemMapper -{ - SvI18NMap& rI18NMap; - SwDoc& rDoc; - -public: - - SwXMLImportTextItemMapper_Impl( SvXMLItemMapEntriesRef rMapEntries, - SwDoc& rD, SvI18NMap& rI18NMap ); - virtual ~SwXMLImportTextItemMapper_Impl(); - - virtual sal_Bool handleSpecialItem( const SvXMLItemMapEntry& rEntry, - SfxPoolItem& rItem, - SfxItemSet& rSet, - const OUString& rValue, - const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; - - virtual void finished( SfxItemSet& rSet ) const; -}; - -SwXMLImportTextItemMapper_Impl::SwXMLImportTextItemMapper_Impl( - SvXMLItemMapEntriesRef rMapEntries, - SwDoc& rD, SvI18NMap& rI18NM ) : - SvXMLImportItemMapper( rMapEntries, RES_UNKNOWNATR_CONTAINER), - rDoc( rD ), - rI18NMap( rI18NM ) -{ -} - -SwXMLImportTextItemMapper_Impl::~SwXMLImportTextItemMapper_Impl() -{ -} - -sal_Bool SwXMLImportTextItemMapper_Impl::handleSpecialItem( - const SvXMLItemMapEntry& rEntry, - SfxPoolItem& rItem, - SfxItemSet& rItemSet, - const OUString& rValue, - const SvXMLUnitConverter& rUnitConv, - const SvXMLNamespaceMap& ) const -{ - sal_Bool bRet = sal_False; - switch( rItem.Which() ) - { - case RES_TXTATR_CHARFMT: - DBG_ASSERT( !this, - "SwXMLImportTextItemMapper_Impl::handleSpecialItem: char fmt unexpected" ); - break; - - case RES_PARATR_NUMRULE: - if( rValue.getLength() ) - { - OUString sName( rI18NMap.Get( SFX_STYLE_FAMILY_PSEUDO, rValue ) ); - ((SwNumRuleItem&)rItem).SetValue( sName ); - bRet = sal_True; - } - break; - - case RES_CHRATR_LANGUAGE: - // If the item is not contained in the item set, its the default - // value. To set language and contry individually, we have to clear - // its value. - if( SFX_ITEM_SET != rItemSet.GetItemState( RES_CHRATR_LANGUAGE, - sal_False ) ) - { - ((SvxLanguageItem &)rItem).SetLanguage( LANGUAGE_NONE ); - } - bRet = rItem.importXML( rValue, rEntry.nMemberId, rUnitConv ); - break; - } - - return bRet; -} - -void SwXMLImportTextItemMapper_Impl::finished( SfxItemSet& rSet ) const -{ - const SfxPoolItem *pItem; - - if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_FONT, sal_False, - &pItem ) ) - { - const SvxFontItem *pFont = (const SvxFontItem *)pItem; - // delete font items that have no family name - if( 0 == pFont->GetFamilyName().Len() ) - rSet.ClearItem( RES_CHRATR_FONT ); - else if( RTL_TEXTENCODING_DONTKNOW == pFont->GetCharSet() ) - { - SvxFontItem aFont( *pFont ); - aFont.GetCharSet() = gsl_getSystemTextEncoding(); - rSet.Put( aFont ); - } - } - - // ensure that box item have a distance to a border. - if( SFX_ITEM_SET == rSet.GetItemState( RES_BOX, sal_False, &pItem ) ) - { - const SvxBoxItem *pBox = (const SvxBoxItem *)pItem; - sal_uInt16 aLines[4] = { BOX_LINE_TOP, BOX_LINE_BOTTOM, - BOX_LINE_LEFT, BOX_LINE_RIGHT }; - sal_uInt16 i; - for( i=0; i<4; i++ ) - { - if( pBox->GetLine( aLines[i] ) && - pBox->GetDistance( aLines[i] ) < MIN_BORDER_DIST ) - break; - } - if( i < 4 ) - { - SvxBoxItem aBox( *pBox ); - for( /*i=0*/; i<4; i++ ) // i points to the mod. line - { - if( aBox.GetLine( aLines[i] ) && - aBox.GetDistance( aLines[i] ) < MIN_BORDER_DIST ) - aBox.SetDistance( MIN_BORDER_DIST, aLines[i] ); - } - rSet.Put( aBox ); - } - } -} -#endif - -// --------------------------------------------------------------------- - class SwXMLImportTableItemMapper_Impl: public SvXMLImportItemMapper { @@ -375,10 +239,6 @@ void SwXMLImportTableItemMapper_Impl::finished( SfxItemSet& rSet ) const class SwXMLItemSetContext_Impl : public SvXMLItemSetContext { SvXMLImportContextRef xBackground; -#ifdef XML_CORE_API - SvXMLImportContextRef xTabStop; - SvXMLImportContextRef xDropCap; -#endif public: SwXMLItemSetContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, @@ -411,22 +271,6 @@ SwXMLItemSetContext_Impl::SwXMLItemSetContext_Impl( SwXMLItemSetContext_Impl::~SwXMLItemSetContext_Impl() { -#ifdef XML_CORE_API - if( xTabStop.Is() ) - { - Any aAny; - ((SvxXMLTabStopImportContext*)&xTabStop)->fillTabStops( aAny ); - SvxTabStopItem aTabStop( RES_PARATR_TABSTOP ); - ((SfxPoolItem *)&aTabStop)->PutValue( aAny, 0 ); - rItemSet.Put( aTabStop ); - } - if( xDropCap.Is() ) - { - const SwFmtDrop& rItem = - ((SwXMLFmtDropImportContext*)&xDropCap)->GetItem(); - rItemSet.Put( rItem ); - } -#endif if( xBackground.Is() ) { const SvxBrushItem& rItem = @@ -447,22 +291,6 @@ SvXMLImportContext *SwXMLItemSetContext_Impl::CreateChildContext( switch( rEntry.nWhichId ) { -#ifdef XML_CORE_API - case RES_PARATR_TABSTOP: - pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix, - rLocalName, rUnitConv ); - xTabStop = pContext; - break; - - case RES_PARATR_DROP: - pContext = new SwXMLFmtDropImportContext( (SwXMLImport&)GetImport(), - nPrefix, rLocalName, - xAttrList, rUnitConv, - RES_PARATR_DROP ); - xDropCap = pContext; - break; -#endif - case RES_BACKGROUND: { const SfxPoolItem *pItem; @@ -498,14 +326,6 @@ void SwXMLImport::_InitItemImport() { pTwipUnitConv = new SvXMLUnitConverter( MAP_TWIP, MAP_TWIP ); -#ifdef XML_CORE_API - SvXMLItemMapEntriesRef xParaItemMapEntries = - new SvXMLItemMapEntries( aXMLParaItemMap ); - - pParaItemMapper = new SwXMLImportTextItemMapper_Impl( xParaItemMapEntries, - GetDoc(), GetI18NMap() ); -#endif - xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); xTableColItemMap = new SvXMLItemMapEntries( aXMLTableColItemMap ); xTableRowItemMap = new SvXMLItemMapEntries( aXMLTableRowItemMap ); @@ -516,72 +336,31 @@ void SwXMLImport::_InitItemImport() void SwXMLImport::_FinitItemImport() { -#ifdef XML_CORE_API - delete pParaItemMapper; -#endif delete pTableItemMapper; delete pTwipUnitConv; } -#ifdef XML_CORE_API -SvXMLImportContext *SwXMLImport::CreateParaItemImportContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList, - SfxItemSet& rItemSet ) -{ - return new SwXMLItemSetContext_Impl( *this, nPrefix, rLocalName, - xAttrList, rItemSet, - GetParaItemMapper(), - GetTwipUnitConverter() ); -} -#endif - SvXMLImportContext *SwXMLImport::CreateTableItemImportContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList > & xAttrList, -#ifdef XML_CORE_API - sal_uInt16 nSubFamily, -#else sal_uInt16 nFamily, -#endif SfxItemSet& rItemSet ) { SvXMLItemMapEntriesRef xItemMap; -#ifdef XML_CORE_API - switch( nSubFamily ) -#else switch( nFamily ) -#endif { -#ifdef XML_CORE_API - case SW_STYLE_SUBFAMILY_TABLE: -#else case XML_STYLE_FAMILY_TABLE_TABLE: -#endif xItemMap = xTableItemMap; break; -#ifdef XML_CORE_API - case SW_STYLE_SUBFAMILY_TABLE_COL: -#else case XML_STYLE_FAMILY_TABLE_COLUMN: -#endif xItemMap = xTableColItemMap; break; -#ifdef XML_CORE_API - case SW_STYLE_SUBFAMILY_TABLE_LINE: -#else case XML_STYLE_FAMILY_TABLE_ROW: -#endif xItemMap = xTableRowItemMap; break; -#ifdef XML_CORE_API - case SW_STYLE_SUBFAMILY_TABLE_BOX: -#else case XML_STYLE_FAMILY_TABLE_CELL: -#endif xItemMap = xTableCellItemMap; break; } @@ -593,46 +372,3 @@ SvXMLImportContext *SwXMLImport::CreateTableItemImportContext( GetTableItemMapper(), GetTwipUnitConverter() ); } - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlitemi.cxx,v 1.1.1.1 2000-09-18 17:15:00 hr Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.11 2000/09/18 16:05:07 willem.vandorp - OpenOffice header added. - - Revision 1.10 2000/08/24 11:16:41 mib - text import continued - - Revision 1.9 2000/08/02 14:52:39 mib - text export continued - - Revision 1.8 2000/06/08 09:45:54 aw - changed to use functionality from xmloff project now - - Revision 1.7 2000/05/03 12:08:05 mib - unicode - - Revision 1.6 2000/03/13 14:33:44 mib - UNO3 - - Revision 1.5 2000/02/17 14:40:30 mib - #70271#: XML table import - - Revision 1.3 2000/01/20 14:03:57 mib - #70271#: deletion of unit converter - - Revision 1.2 2000/01/06 15:08:28 mib - #70271#:separation of text/layout, cond. styles, adaptions to wd-xlink-19991229 - - Revision 1.1 1999/12/14 07:32:58 mib - #70271#: XML import/export of drop cap/register/language item, splitted swxmlat - - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmlitemm.cxx b/sw/source/filter/xml/xmlitemm.cxx index e43cdaf63ae1..37f07f1f5511 100644 --- a/sw/source/filter/xml/xmlitemm.cxx +++ b/sw/source/filter/xml/xmlitemm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlitemm.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-18 11:20:44 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,191 +92,6 @@ #define M_E_SE( p, l, w, m ) \ { XML_NAMESPACE_##p, sXML_##l, w, MID_FLAG_SPECIAL_ITEM_EXPORT|m } -#ifdef XML_CORE_API -SvXMLItemMapEntry aXMLParaItemMap[] = -{ - // RES_CHRATR_CASEMAP - M_E( FO, font_variant, RES_CHRATR_CASEMAP, MID_CASEMAP_VARIANT ), - M_E( FO, text_transform, RES_CHRATR_CASEMAP, MID_CASEMAP_TRANS ), - // RES_CHRATR_COLOR - M_E( FO, color, RES_CHRATR_COLOR, 0 ), - // RES_CHRATR_CONTOUR - M_E( STYLE, text_outline, RES_CHRATR_CONTOUR, 0 ), - // RES_CHRATR_CROSSEDOUT - M_E( STYLE, text_crossing_out, RES_CHRATR_CROSSEDOUT, 0 ), - // RES_CHRATR_ESCAPEMENT - M_E( STYLE, text_position, RES_CHRATR_ESCAPEMENT, 0 ), - // RES_CHRATR_FONT - M_E( FO, font_family, RES_CHRATR_FONT, MID_FONT_FAMILY_NAME ), - M_E( STYLE, font_style_name, RES_CHRATR_FONT, MID_FONT_STYLE_NAME ), - M_E( STYLE, font_family_generic,RES_CHRATR_FONT, MID_FONT_FAMILY ), - M_E( STYLE, font_pitch, RES_CHRATR_FONT, MID_FONT_PITCH ), - M_E( STYLE, font_charset, RES_CHRATR_FONT, MID_FONT_CHAR_SET ), - // RES_CHRATR_FONTSIZE - M_E( FO, font_size, RES_CHRATR_FONTSIZE, 0 ), - // RES_CHRATR_KERNING - M_E( FO, letter_spacing, RES_CHRATR_KERNING, 0 ), - // RES_CHRATR_LANGUAGE - M_E_SI( FO, language, RES_CHRATR_LANGUAGE, MID_LANGUAGE ), - M_E_SI( FO, country, RES_CHRATR_LANGUAGE, MID_COUNTRY ), - // RES_CHRATR_POSTURE - M_E( FO, font_style, RES_CHRATR_POSTURE, 0 ), - // RES_CHRATR_PROPORTIONALFONTSIZE - // TODO: not used? - // RES_CHRATR_SHADOWED - M_E( FO, text_shadow, RES_CHRATR_SHADOWED, 0 ), - // RES_CHRATR_UNDERLINE - M_E( STYLE, text_underline, RES_CHRATR_UNDERLINE, 0 ), - // RES_CHRATR_WEIGHT - M_E( FO, font_weight, RES_CHRATR_WEIGHT, 0 ), - // RES_CHRATR_WORDLINEMODE - M_E( FO, score_spaces, RES_CHRATR_WORDLINEMODE, 0 ), - // RES_CHRATR_AUTOKERN - M_E( STYLE, letter_kerning, RES_CHRATR_AUTOKERN, 0 ), - // RES_CHRATR_BLINK - M_E( STYLE, text_blinking, RES_CHRATR_BLINK, 0 ), - // RES_CHRATR_NOHYPHEN - // TODO: not used? - // RES_CHRATR_NOLINEBREAK - // TODO: not used? - // RES_CHRATR_BACKGROUND - M_E( FO, text_background_color, RES_CHRATR_BACKGROUND, MID_BACK_COLOR ), - // RES_TXTATR_INETFMT - // TODO - // RES_TXTATR_REFMARK - // TODO - // RES_TXTATR_TOXMARK - // TODO - // RES_TXTATR_CHARFMT - M_E_SI( TEXT, style_name, RES_TXTATR_CHARFMT, 0 ), - // RES_TXTATR_FIELD - // TODO - // RES_TXTATR_FLYCNT - // TODO - // RES_TXTATR_FTN - // TODO - // RES_TXTATR_SOFTHYPH - // TODO - // RES_TXTATR_HARDBLANK - // TODO - - // RES_PARATR_LINESPACING - M_E( FO, line_height, RES_PARATR_LINESPACING, MID_LS_FIXED ), - M_E( STYLE, line_height_at_least, RES_PARATR_LINESPACING, MID_LS_MINIMUM ), - M_E( STYLE, line_spacing, RES_PARATR_LINESPACING, MID_LS_DISTANCE ), - // RES_PARATR_ADJUST - M_E( FO, text_align, RES_PARATR_ADJUST, MID_PARA_ADJUST ), - M_E( FO, text_align_last, RES_PARATR_ADJUST, MID_LAST_LINE_ADJUST ), - M_E( STYLE, justify_single_word,RES_PARATR_ADJUST, MID_EXPAND_SINGLE ), - // RES_PARATR_SPLIT - M_E( STYLE, break_inside, RES_PARATR_SPLIT, 0 ), - // RES_PARATR_ORPHANS - M_E( FO, orphans, RES_PARATR_ORPHANS, 0 ), - // RES_PARATR_WIDOWS - M_E( FO, widows, RES_PARATR_WIDOWS, 0 ), - // RES_PARATR_TABSTOP - M_E( STYLE, tabstop_tab_stops, RES_PARATR_TABSTOP, MID_FLAG_ELEMENT_ITEM ), - // RES_PARATR_HYPHENZONE - M_E( FO, hyphenate, RES_PARATR_HYPHENZONE, - MID_IS_HYPHEN ), - M_E( FO, hyphenation_remain_char_count, RES_PARATR_HYPHENZONE, - MID_HYPHEN_MIN_LEAD ), - M_E( FO, hyphenation_push_char_count, RES_PARATR_HYPHENZONE, - MID_HYPHEN_MIN_TRAIL ), - M_E( FO, hyphenation_ladder_count, RES_PARATR_HYPHENZONE, - MID_HYPHEN_MAX_HYPHENS ), - // RES_PARATR_DROP - M_E( STYLE, drop_cap, RES_PARATR_DROP, MID_FLAG_ELEMENT_ITEM ), - // RES_PARATR_REGISTER - M_E( STYLE, register_true, RES_PARATR_REGISTER, 0 ), - // RES_PARATR_NUMRULE - // not required - - // RES_FILL_ORDER - // not required - // RES_FRM_SIZE - // not required - // RES_PAPER_BIN - // not required - // RES_LR_SPACE - M_E( FO, margin_left, RES_LR_SPACE, MID_L_MARGIN ), - M_E( FO, margin_right, RES_LR_SPACE, MID_R_MARGIN ), - M_E( FO, text_indent, RES_LR_SPACE, MID_FIRST_LINE_INDENT ), - M_E( STYLE, auto_text_indent, RES_LR_SPACE, MID_FIRST_AUTO ), - // RES_UL_SPACE - M_E( FO, margin_top, RES_UL_SPACE, MID_UP_MARGIN ), - M_E( FO, margin_bottom, RES_UL_SPACE, MID_LO_MARGIN ), - // RES_PAGEDESC - M_E( STYLE, page_number, RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET), - // RES_BREAK - M_E( FO, break_before, RES_BREAK, MID_BREAK_BEFORE ), - M_E( FO, break_after, RES_BREAK, MID_BREAK_AFTER ), - // RES_CNTNT - // not required - // RES_HEADER - // not required - // RES_FOOTER - // not required - // RES_PRINT - // not required - // RES_OPAQUE - // not required - // RES_PROTECT - // not required - // RES_SURROUND - // not required - // RES_VERT_ORIENT - // not required - // RES_HORI_ORIENT - // not required - // RES_ANCHOR - // not required - // RES_BACKGROUND - M_E( FO, background_color, RES_BACKGROUND, MID_BACK_COLOR ), - M_E( STYLE, background_image, RES_BACKGROUND, MID_FLAG_ELEMENT_ITEM ), - // RES_BOX - M_E( STYLE, border_line_width, RES_BOX, ALL_BORDER_LINE_WIDTH ), - M_E( STYLE, border_line_width_left, RES_BOX, LEFT_BORDER_LINE_WIDTH ), - M_E( STYLE, border_line_width_right, RES_BOX, RIGHT_BORDER_LINE_WIDTH ), - M_E( STYLE, border_line_width_top, RES_BOX, TOP_BORDER_LINE_WIDTH ), - M_E( STYLE, border_line_width_bottom, RES_BOX, BOTTOM_BORDER_LINE_WIDTH ), - M_E( FO, padding, RES_BOX, ALL_BORDER_PADDING ), - M_E( FO, padding_left, RES_BOX, LEFT_BORDER_PADDING ), - M_E( FO, padding_right, RES_BOX, RIGHT_BORDER_PADDING ), - M_E( FO, padding_top, RES_BOX, TOP_BORDER_PADDING ), - M_E( FO, padding_bottom, RES_BOX, BOTTOM_BORDER_PADDING ), - M_E( FO, border, RES_BOX, ALL_BORDER ), - M_E( FO, border_left, RES_BOX, LEFT_BORDER ), - M_E( FO, border_right, RES_BOX, RIGHT_BORDER ), - M_E( FO, border_top, RES_BOX, TOP_BORDER ), - M_E( FO, border_bottom, RES_BOX, BOTTOM_BORDER ), - // RES_SHADOW - M_E( STYLE, shadow, RES_SHADOW, 0 ), - // RES_FRMMACRO - // not required - // RES_COL - // not required - // RES_KEEP - M_E( FO, keep_with_next, RES_KEEP, 0 ), - // RES_URL - // not required - // RES_EDIT_IN_READONLY - // not required - // RES_LAYOUT_SPLIT - // not required - // RES_CHAIN - // not required - // RES_LINENUMBER - // TODO - // RES_FTN_AT_TXTEND - // not required - // RES_END_AT_TXTEND - // not required - // RES_UNKNOWNATR_CONTAINER - M_E_SE( TEXT, xmlns, RES_UNKNOWNATR_CONTAINER, 0 ), - {0,0,0,0 } -}; -#endif SvXMLItemMapEntry aXMLTableItemMap[] = { @@ -509,46 +324,3 @@ SvXMLItemMapEntry aXMLTableCellItemMap[] = M_E_SE( TEXT, xmlns, RES_UNKNOWNATR_CONTAINER, 0 ), {0,0,0,0 } }; - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlitemm.cxx,v 1.3 2000-10-18 11:20:44 mib Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.2 2000/10/12 10:42:49 mib - #79090#: table:vertical-align -> fo:vertical-align - - Revision 1.1.1.1 2000/09/18 17:15:00 hr - initial import - - Revision 1.8 2000/09/18 16:05:07 willem.vandorp - OpenOffice header added. - - Revision 1.7 2000/08/24 11:16:41 mib - text import continued - - Revision 1.6 2000/08/10 10:22:16 mib - #74404#: Adeptions to new XSL/XLink working draft - - Revision 1.5 2000/06/08 09:45:54 aw - changed to use functionality from xmloff project now - - Revision 1.4 2000/02/17 14:40:30 mib - #70271#: XML table import - - Revision 1.3 2000/02/07 10:03:28 mib - #70271#: tables - - Revision 1.2 2000/01/12 15:00:23 mib - #70271#: lists - - Revision 1.1 1999/12/14 07:33:08 mib - #70271#: XML import/export of drop cap/register/language item, splitted swxmlat - - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 7f33e1b6ad98..84abf4b98ab3 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltble.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:15:00 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,9 +133,6 @@ #ifndef _XMLEXP_HXX #include "xmlexp.hxx" #endif -#ifndef _XMLECTXT_HXX -#include "xmlectxt.hxx" -#endif using namespace ::rtl; using namespace ::com::sun::star::uno; @@ -143,7 +140,6 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; -#ifndef XML_CORE_API Reference < XText > lcl_xml_CreateTableBoxText( const SwStartNode& rBoxSttNd ) { @@ -158,7 +154,6 @@ Reference < XText > lcl_xml_CreateTableBoxText( aPaM.GetMark() ); return xTextRange->getText(); } -#endif class SwXMLTableColumn_Impl : public SwWriteTableCol { @@ -675,25 +670,13 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, const SwStartNode *pBoxSttNd = pBox->GetSttNd(); if( pBoxSttNd ) { -#ifdef XML_CORE_API - SwNode *pStartNd = pDoc->GetNodes()[pBoxSttNd->GetIndex()+1]; - SwNode *pEndNd = - pDoc->GetNodes()[pBoxSttNd->EndOfSectionIndex()-1]; - SwXMLExpContext aContext( *this, *pStartNd, *pEndNd, - 0, STRING_LEN ); -#endif - SwFrmFmt *pFrmFmt = pBox->GetFrmFmt(); if( rExpCells.AddCell( *pFrmFmt, rNamePrefix, nOldCol, nLine, bTop) ) ExportFmt( *pFrmFmt, sXML_table_cell ); -#ifdef XML_CORE_API - ExportCurPaMAutoStyles(); -#else GetTextParagraphExport()->collectTextAutoStyles( lcl_xml_CreateTableBoxText( *pBoxSttNd ) ); -#endif } else { @@ -746,10 +729,6 @@ void SwXMLExport::ExportTableAutoStyles( const SwTableNode& rTblNd ) sName, aExpCols, aExpRows, aExpCells, sal_True ); } - -#ifdef XML_CORE_API - pCurPaM->GetPoint()->nNode = *rTblNd.EndOfSectionNode(); -#endif } // --------------------------------------------------------------------- @@ -783,16 +762,8 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox, sal_uInt16 nColSpan ) sXML_table_cell, sal_True, sal_True ); if( pBoxSttNd ) { -#ifdef XML_CORE_API - SwNode *pStartNd = pDoc->GetNodes()[pBoxSttNd->GetIndex()+1]; - SwNode *pEndNd = pDoc->GetNodes()[pBoxSttNd->EndOfSectionIndex()-1]; - SwXMLExpContext aContext( *this, *pStartNd, *pEndNd, - 0, STRING_LEN ); - ExportCurPaM(); -#else GetTextParagraphExport()->exportText( lcl_xml_CreateTableBoxText( *pBoxSttNd ) ); -#endif } else { @@ -990,13 +961,8 @@ void SwXMLExport::ExportTable( const SwTableNode& rTblNd ) ((SwTable &)rTbl).GetTabLines().ForEach( &lcl_xmltble_ClearName_Line, 0 ); } - -#ifdef XML_CORE_API - pCurPaM->GetPoint()->nNode = *rTblNd.EndOfSectionNode(); -#endif } -#ifndef XML_CORE_API void SwXMLTextParagraphExport::exportTable( const Reference < XTextContent > & rTextContent, sal_Bool bAutoStyles ) @@ -1036,50 +1002,3 @@ void SwXMLTextParagraphExport::exportTable( } } } -#endif - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmltble.cxx,v 1.1.1.1 2000-09-18 17:15:00 hr Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.11 2000/09/18 16:05:07 willem.vandorp - OpenOffice header added. - - Revision 1.10 2000/09/05 09:51:10 mib - #78063#: table lines cache is sorted now - - Revision 1.9 2000/07/31 09:42:35 mib - text export continued - - Revision 1.8 2000/07/21 12:55:15 mib - text import/export using StarOffice API - - Revision 1.7 2000/06/08 09:45:54 aw - changed to use functionality from xmloff project now - - Revision 1.6 2000/05/03 12:08:05 mib - unicode - - Revision 1.5 2000/03/13 14:33:44 mib - UNO3 - - Revision 1.4 2000/02/11 17:08:37 kz - #65293# cast Syntax - - Revision 1.3 2000/02/11 14:42:15 hr - #70473# changes for unicode ( patched by automated patchtool ) - - Revision 1.2 2000/02/08 06:47:09 mib - #70271#: remove temporary table cell format names - - Revision 1.1 2000/02/07 10:02:55 mib - #70271#: table export - - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index bc43c5c14d3f..3e98b44169ea 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltbli.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mib $ $Date: 2000-10-26 09:38:52 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,12 +135,6 @@ #include "unocrsr.hxx" #endif -#ifndef _XMLTEXTI_HXX -#include "xmltexti.hxx" -#endif -#ifndef _XMLNUM_HXX -#include "xmlnum.hxx" -#endif #ifndef _XMLIMP_HXX #include "xmlimp.hxx" #endif @@ -2064,6 +2058,8 @@ public: const Reference < XModel>& rModel, sal_Bool bInsertM, sal_Bool bStylesOnlyM ); ~SwXMLTextImportHelper(); + + virtual sal_Bool IsInHeaderFooter() const; }; SwXMLTextImportHelper::SwXMLTextImportHelper( @@ -2086,6 +2082,20 @@ SvXMLImportContext *SwXMLTextImportHelper::CreateTableChildContext( (SwXMLImport&)rImport, nPrefix, rLocalName, xAttrList ); } +sal_Bool SwXMLTextImportHelper::IsInHeaderFooter() const +{ + Reference<XUnoTunnel> xCrsrTunnel( + ((SwXMLTextImportHelper *)this)->GetCursor(), UNO_QUERY ); + ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + SwXTextCursor *pTxtCrsr = + (SwXTextCursor*)xCrsrTunnel->getSomething( + SwXTextCursor::getUnoTunnelId() ); + ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + SwDoc *pDoc = pTxtCrsr->GetDoc(); + + return pDoc->IsInHeaderFooter( pTxtCrsr->GetPaM()->GetPoint()->nNode ); +} + XMLTextImportHelper* SwXMLImport::CreateTextImport() { return new SwXMLTextImportHelper( GetModel(), IsInsertMode(), diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx index aec7789deecf..7aaa4da5800c 100644 --- a/sw/source/filter/xml/xmltbli.hxx +++ b/sw/source/filter/xml/xmltbli.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltbli.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2000-10-26 09:38:52 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,16 +87,6 @@ namespace com { namespace sun { namespace star { namespace text { class XTextCursor; } } } } -#ifdef XML_CORE_API -enum SwXMLStyleSubFamily -{ - SW_STYLE_SUBFAMILY_TABLE = 0x0001, - SW_STYLE_SUBFAMILY_TABLE_LINE = 0x0002, - SW_STYLE_SUBFAMILY_TABLE_BOX = 0x0004, - SW_STYLE_SUBFAMILY_TABLE_COL = 0x0008 -}; -#endif - class SwXMLTableContext : public XMLTextTableContext { @@ -105,12 +95,11 @@ class SwXMLTableContext : public XMLTextTableContext SvUShorts aColumnWidths; SvBools aColumnRelWidths; -#ifndef XML_CORE_API ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > xOldCursor; ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextContent > xTextContent; -#endif + SwXMLTableRows_Impl *pRows; SwTableNode *pTableNode; diff --git a/sw/source/filter/xml/xmltext.cxx b/sw/source/filter/xml/xmltext.cxx index 5dce75c62c77..5d2706fa59e6 100644 --- a/sw/source/filter/xml/xmltext.cxx +++ b/sw/source/filter/xml/xmltext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltext.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-18 11:20:44 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,784 +65,22 @@ #pragma hdrstop -#include "hintids.hxx" - -#ifndef _RTL_STRBUF_HXX_ -#include <rtl/strbuf.hxx> -#endif -#ifndef _RTL_USTRBUF_HXX_ -#include <rtl/ustrbuf.hxx> -#endif - -#ifndef _RSCSFX_HXX -#include <rsc/rscsfx.hxx> -#endif - -#ifndef _XMLOFF_NMSPMAP_HXX -#include <xmloff/nmspmap.hxx> -#endif - #ifndef _XMLOFF_XMLNMSPE_HXX #include <xmloff/xmlnmspe.hxx> #endif - -#ifndef _XMLOFF_I18NMAP_HXX -#include <xmloff/i18nmap.hxx> -#endif - -#ifndef _XMLOFF_XMLITEM_HXX -#include <xmloff/xmlitem.hxx> -#endif - -#ifndef _XMLOFF_XMLIMPIT_HXX -#include <xmloff/xmlimpit.hxx> -#endif - -#ifndef _XMLOFF_XMLITMPR_HXX -#include <xmloff/xmlexpit.hxx> -#endif - -#ifndef _XMLOFF_XMLKYWD_HXX -#include <xmloff/xmlkywd.hxx> -#endif - -#ifndef _XMLOFF_XMLASTPL_HXX -#include <xmloff/xmlastpl.hxx> -#endif -#ifndef _XMLOFF_TXTIMP_HXX -#include <xmloff/txtimp.hxx> -#endif - -#ifndef _XMLOFF_TXTFLDE_HXX -#include <xmloff/txtflde.hxx> -#endif - -#ifndef _XMLOFF_TXTVFLDI_HXX -//#include <xmloff/txtvfldi.hxx> -#endif - -#ifndef _UNOFIELD_HXX -#include <unofield.hxx> -#endif - -#ifndef _SVX_FONTITEM_HXX //autogen wg. SvxFontItem -#include <svx/fontitem.hxx> -#endif - -#ifndef _NDTXT_HXX //autogen wg. SwTxtNode -#include <ndtxt.hxx> -#endif -#ifndef _SECTION_HXX //autogen wg. SwSection -#include <section.hxx> -#endif -#ifndef _DOC_HXX //autogen wg. SwDoc -#include <doc.hxx> -#endif -#ifndef _PAM_HXX //autogen wg. SwPaM -#include <pam.hxx> -#endif -#ifndef _TXATBASE_HXX -#include <txatbase.hxx> -#endif -#ifndef _CHARATR_HXX -#include <charatr.hxx> -#endif -#ifndef _CHARFMT_HXX -#include <charfmt.hxx> -#endif -#ifndef _PARATR_HXX -#include <paratr.hxx> -#endif -#ifndef _FLDBAS_HXX -#include <fldbas.hxx> -#endif -#ifndef _FMTFLD_HXX -#include <fmtfld.hxx> -#endif -#ifndef _FCHRFMT_HXX -#include <fchrfmt.hxx> -#endif -#ifndef _UNOSTYLE_HXX -#include "unostyle.hxx" -#endif - -#ifndef _XMLECTXT_HXX -#include "xmlectxt.hxx" -#endif -#ifndef _HINTLIST_HXX -#include "hintlist.hxx" -#endif #ifndef _XMLIMP_HXX #include "xmlimp.hxx" #endif -#ifndef _XMLEXP_HXX -#include "xmlexp.hxx" -#endif -#ifndef _XMLNUM_HXX -#include "xmlnum.hxx" -#endif -#ifndef _XMLTBLI_HXX -#include "xmltbli.hxx" -#endif -#ifndef _XMLFMTE_HXX -#include "xmlfmte.hxx" -#endif -#ifndef _XMLTEXTI_HXX -#include "xmltexti.hxx" -#endif using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; -#ifdef XML_CORE_API -enum SwXMLTextPElemTokens -{ - XML_TOK_SW_SPAN, - XML_TOK_SW_TAB_STOP, - XML_TOK_SW_LINE_BREAK, - XML_TOK_SW_S, - XML_TOK_SW_P_ELEM_END=XML_TOK_UNKNOWN -}; - -static __FAR_DATA SvXMLTokenMapEntry aTextPElemTokenMap[] = -{ - { XML_NAMESPACE_TEXT, sXML_span, XML_TOK_SW_SPAN }, - { XML_NAMESPACE_TEXT, sXML_tab_stop, XML_TOK_SW_TAB_STOP }, - { XML_NAMESPACE_TEXT, sXML_line_break, XML_TOK_SW_LINE_BREAK }, - { XML_NAMESPACE_TEXT, sXML_s, XML_TOK_SW_S }, - XML_TOKEN_MAP_END -}; - -const SvXMLTokenMap& SwXMLImport::GetTextPElemTokenMap() -{ - if( !pTextPElemTokenMap ) - pTextPElemTokenMap = new SvXMLTokenMap( aTextPElemTokenMap ); - - return *pTextPElemTokenMap; -} - -// --------------------------------------------------------------------- - -class SwXMLHint_Impl -{ - SfxItemSet aItemSet; - xub_StrLen nStart; - xub_StrLen nEnd; - -public: - - SwXMLHint_Impl( SfxItemPool& rPool, xub_StrLen nPos ) : - aItemSet( rPool, RES_CHRATR_BEGIN, RES_CHRATR_END - 1, - RES_TXTATR_BEGIN, RES_TXTATR_END - 1, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END - 1, 0 ), - nStart( nPos ), - nEnd( nPos ) - {} - - SfxItemSet& GetItemSet() { return aItemSet; } - xub_StrLen GetStart() const { return nStart; } - xub_StrLen GetEnd() const { return nEnd; } - void SetEnd( xub_StrLen nPos ) { nEnd = nPos; } -}; - -typedef SwXMLHint_Impl *SwXMLHint_ImplPtr; -SV_DECL_PTRARR_DEL( SwXMLHints_Impl, SwXMLHint_ImplPtr, 5, 5 ) -SV_IMPL_PTRARR( SwXMLHints_Impl, SwXMLHint_ImplPtr ) - -// --------------------------------------------------------------------- - -class SwXMLImpCharContext_Impl : public SvXMLImportContext -{ -public: - - SwXMLImpCharContext_Impl( - SwXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, - sal_Unicode c, - sal_Bool bCount ); - - virtual ~SwXMLImpCharContext_Impl(); - - SwXMLImport& GetSwImport() { return (SwXMLImport&)GetImport(); } -}; - -SwXMLImpCharContext_Impl::SwXMLImpCharContext_Impl( - SwXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, - sal_Unicode c, - sal_Bool bCount ) : - SvXMLImportContext( rImport, nPrfx, rLName ) -{ - sal_uInt16 nCount = 1; - - if( bCount ) - { - 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( XML_NAMESPACE_TEXT == nPrefix && - aLocalName.compareToAscii( sXML_c ) == 0 ) - { - sal_Int32 nTmp = xAttrList->getValueByIndex(i).toInt32(); - if( nTmp > 0L ) - { - if( nTmp > USHRT_MAX ) - nCount = USHRT_MAX; - else - nCount = (sal_uInt16)nTmp; - } - } - } - } - - if( 1U == nCount ) - { - GetSwImport().GetDoc().Insert( GetSwImport().GetPaM(), c ); - } - else - { - OUStringBuffer sBuff( nCount ); - while( nCount-- ) - sBuff.append( c ); - - GetSwImport().GetDoc().Insert( GetSwImport().GetPaM(), - sBuff.makeStringAndClear() ); - } -} - -SwXMLImpCharContext_Impl::~SwXMLImpCharContext_Impl() -{ -} - // --------------------------------------------------------------------- -class SwXMLImpSpanContext_Impl : public SvXMLImportContext -{ - SwXMLHints_Impl& rHints; - SwXMLHint_Impl *pHint; - - sal_Bool& rIgnoreLeadingSpace; - -public: - - SwXMLImpSpanContext_Impl( - SwXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, - SwXMLHints_Impl& rHnts, - sal_Bool& rIgnLeadSpace ); - - virtual ~SwXMLImpSpanContext_Impl(); - - virtual SvXMLImportContext *CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ); - - virtual void Characters( const OUString& rChars ); - - SwXMLImport& GetSwImport() { return (SwXMLImport&)GetImport(); } -}; - -SwXMLImpSpanContext_Impl::SwXMLImpSpanContext_Impl( - SwXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, - SwXMLHints_Impl& rHnts, - sal_Bool& rIgnLeadSpace ) : - SvXMLImportContext( rImport, nPrfx, rLName ), - rHints( rHnts ), - rIgnoreLeadingSpace( rIgnLeadSpace ), - pHint( 0 ) -{ - OUString aStyleName; - - 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( XML_NAMESPACE_TEXT == nPrefix && - aLocalName.compareToAscii( sXML_style_name ) == 0 ) - aStyleName = xAttrList->getValueByIndex( i ); - } - - if( aStyleName.getLength() ) - { - SwDoc& rDoc = GetSwImport().GetDoc(); - - // try to find a matching automatic style - const SfxItemSet *pAutoItemSet = 0; - OUString sParentStyle; - if( GetSwImport().FindAutomaticStyle( SFX_STYLE_FAMILY_CHAR, - aStyleName, &pAutoItemSet, - &sParentStyle ) ) - { - aStyleName = sParentStyle; - } - - // if an automatic style has not been found or has been found and - // has a parent style, try to find this one. - SwCharFmt *pCharFmt = 0; - if( aStyleName.getLength() ) - { - const SvI18NMap& rI18NMap = GetSwImport().GetI18NMap(); - String sName( rI18NMap.Get( SFX_STYLE_FAMILY_CHAR, - aStyleName) ); - pCharFmt = rDoc.FindCharFmtByName( sName ); - } - - if( pAutoItemSet || pCharFmt ) - { - xub_StrLen nPos = - GetSwImport().GetPaM().GetPoint()->nContent.GetIndex(); - pHint = new SwXMLHint_Impl( rDoc.GetAttrPool(), nPos ); - rHints.Insert( pHint, rHints.Count() ); - if( pAutoItemSet ) - pHint->GetItemSet().Put( *pAutoItemSet ); - if( pCharFmt ) - { - SwFmtCharFmt aCharFmt( pCharFmt ); - pHint->GetItemSet().Put( aCharFmt ); - } - } - } -} - -SwXMLImpSpanContext_Impl::~SwXMLImpSpanContext_Impl() -{ - if( pHint ) - { - xub_StrLen nPos = - GetSwImport().GetPaM().GetPoint()->nContent.GetIndex(); - pHint->SetEnd( nPos ); - } -} - -SvXMLImportContext *SwXMLImpSpanContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) -{ - SvXMLImportContext *pContext = 0; - - const SvXMLTokenMap& rTokenMap = GetSwImport().GetTextPElemTokenMap(); - switch( rTokenMap.Get( nPrefix, rLocalName ) ) - { - case XML_TOK_SW_SPAN: - pContext = new SwXMLImpSpanContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - rHints, - rIgnoreLeadingSpace ); - break; - - case XML_TOK_SW_TAB_STOP: - pContext = new SwXMLImpCharContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - 0x0009, sal_False ); - rIgnoreLeadingSpace = sal_False; - break; - - case XML_TOK_SW_LINE_BREAK: - pContext = new SwXMLImpCharContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - 0x000A, sal_False ); - rIgnoreLeadingSpace = sal_False; - break; - - case XML_TOK_SW_S: - pContext = new SwXMLImpCharContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - 0x0020, sal_True ); - break; - - default: - // ignore unknown content - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - break; - } - - return pContext; -} - -void SwXMLImpSpanContext_Impl::Characters( const OUString& rChars ) -{ - sal_Int32 nLen = rChars.getLength(); - OUStringBuffer sChars( nLen ); - - for( sal_Int32 i=0; i < nLen; i++ ) - { - sal_Unicode c = rChars[i]; - switch( c ) - { - case 0x20: - case 0x09: - case 0x0a: - case 0x0d: - if( !rIgnoreLeadingSpace ) - sChars.append( (sal_Unicode)0x20 ); - rIgnoreLeadingSpace = sal_True; - break; - default: - rIgnoreLeadingSpace = sal_False; - sChars.append( c ); - break; - } - } - - GetSwImport().GetDoc().Insert( GetSwImport().GetPaM(), - sChars.makeStringAndClear() ); -} - -// --------------------------------------------------------------------- - -enum SwXMLTextPAttrTokens -{ - XML_TOK_SW_P_STYLE_NAME, - XML_TOK_SW_P_COND_STYLE_NAME, - XML_TOK_SW_P_LEVEL, - XML_TOK_SW_P_END=XML_TOK_UNKNOWN -}; - -static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] = -{ - { XML_NAMESPACE_TEXT, sXML_style_name, XML_TOK_SW_P_STYLE_NAME }, - { XML_NAMESPACE_TEXT, sXML_cond_style_name, - XML_TOK_SW_P_COND_STYLE_NAME }, - { XML_NAMESPACE_TEXT, sXML_level, XML_TOK_SW_P_LEVEL }, - XML_TOKEN_MAP_END -}; - -SwXMLParaContext::SwXMLParaContext( - SwXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, - sal_Bool bHead ) : - SvXMLImportContext( rImport, nPrfx, rLName ), - pItemSet( 0 ), - pHints( 0 ), - bIgnoreLeadingSpace( sal_True ), - bHeading( bHead ) -{ - const SvXMLTokenMap& rTokenMap = GetSwImport().GetTextPAttrTokenMap(); - - OUString aStyleName, aCondStyleName; - sal_uInt8 nOutlineLevel = NO_NUMBERING; - - 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_SW_P_STYLE_NAME: - aStyleName = rValue; - break; - case XML_TOK_SW_P_COND_STYLE_NAME: - aCondStyleName = rValue; - break; - case XML_TOK_SW_P_LEVEL: - { - sal_Int32 nTmp = rValue.toInt32() - 1L; - if( nTmp >= 0L ) - { - if( nTmp > MAXLEVEL ) - nTmp = MAXLEVEL; - nOutlineLevel = (sal_uInt8)nTmp; - } - } - - } - } - - if( aCondStyleName.getLength() ) - { - OUString sTmp( aStyleName ); - aStyleName = aCondStyleName; - aCondStyleName = sTmp; - } - - if( aStyleName.getLength() ) - { - const SfxItemSet *pAutoItemSet = 0; - OUString sParentStyle; - if( GetSwImport().FindAutomaticStyle( SFX_STYLE_FAMILY_PARA, - aStyleName, &pAutoItemSet, - &sParentStyle ) ) - { - aStyleName = sParentStyle; - } - - if( pAutoItemSet ) - { - if( !pItemSet ) - pItemSet = new SfxItemSet( GetSwImport().GetDoc().GetAttrPool(), - aTxtNodeSetRange ); - pItemSet->Put( *pAutoItemSet ); - } - - if( aStyleName.getLength() ) - { - const SvI18NMap& rI18NMap = GetSwImport().GetI18NMap(); - String sName( rI18NMap.Get( SFX_STYLE_FAMILY_PARA, aStyleName ) ); - SwDoc& rDoc = GetSwImport().GetDoc(); - SwTxtFmtColl *pColl = rDoc.FindTxtFmtCollByName( sName ); - if( pColl ) - { - sal_uInt8 nCollOutlineLevel = pColl->GetOutlineLevel(); - if( bHeading && !( GetSwImport().IsInsertMode() || - GetSwImport().IsStylesOnlyMode() ) && - NO_NUMBERING != nOutlineLevel && - ( NO_NUMBERING == nCollOutlineLevel || - GetRealLevel(nCollOutlineLevel) != nOutlineLevel ) ) - { - sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->Count(); - for( sal_uInt16 i=0; i<nArrLen; i++ ) - { - SwTxtFmtColl* pCur = (*rDoc.GetTxtFmtColls())[i]; - sal_uInt8 nCurLevel = pCur->GetOutlineLevel(); - if( nCurLevel != NO_NUMBERING && - GetRealLevel(nCurLevel) == nOutlineLevel ) - { - if( pColl != pCur ) - pCur->SetOutlineLevel( NO_NUMBERING ); - break; - } - } - pColl->SetOutlineLevel( nOutlineLevel ); - } - rDoc.SetTxtFmtColl( GetSwImport().GetPaM(), pColl ); - } - } - } -} - -SwXMLParaContext::~SwXMLParaContext() -{ -#ifndef PRODUCT - SwCntntNode *pTTTNd = GetSwImport().GetPaM().GetNode()->GetCntntNode(); -#endif - - // Start a new node. - SwDoc& rDoc = GetSwImport().GetDoc(); - rDoc.AppendTxtNode( *GetSwImport().GetPaM().GetPoint() ); - - // Create a "attribute" PaM and move it to the previous node. - SwPaM aPaM( GetSwImport().GetPaM() ); - aPaM.Move( fnMoveBackward, fnGoCntnt ); - aPaM.SetMark(); - SwCntntNode *pCNd = aPaM.GetNode()->GetCntntNode(); - ASSERT( pCNd, - "SwXMLParaContext::~SwXMLParaContext: no content node" ); -#ifndef PRODUCT - ASSERT( pTTTNd == pCNd, - "SwXMLParaContext::~SwXMLParaContext: wrong content node" ); - ASSERT( (const SwIndexReg*)pTTTNd == aPaM.GetPoint()->nContent.GetIdxReg(), - "SwXMLParaContext::~SwXMLParaContext: wrong content node" ); -#endif - - aPaM.GetPoint()->nContent.Assign( pCNd, 0 ); - - // Set paragraph attributes. - if( pItemSet ) - rDoc.Insert( aPaM, *pItemSet ); - delete pItemSet; - - // Set numbering rules - SwTxtNode *pTxtNd = pCNd->GetTxtNode(); - const SwNumRule *pNumRule = pTxtNd->GetNumRule(); - if( GetSwImport().IsInList() ) - { - SwXMLListBlockContext *pListBlock = GetSwImport().GetListBlock(); - String sStyleName( GetSwImport().GetI18NMap().Get( - SFX_STYLE_FAMILY_PSEUDO,pListBlock->GetStyleName()) ); - if( !pNumRule || - ( !pListBlock->HasGeneratedStyle() && - pNumRule->GetName() != sStyleName ) ) - { - rDoc.Insert( aPaM, SwNumRuleItem( sStyleName ) ); - pNumRule = pTxtNd->GetNumRule(); - } - - ASSERT( pNumRule, "SwXMLParaContext::~SwXMLParaContext: no num rule" ); - GetSwImport().SetUsed( *pNumRule ); - - SwXMLListItemContext *pListItem = GetSwImport().GetListItem(); - - sal_uInt8 nLevel = pListBlock->GetLevel() > MAXLEVEL - ? MAXLEVEL - : (sal_uInt8)pListBlock->GetLevel(); - if( !pListItem ) - nLevel |= NO_NUMLEVEL; - - SwNodeNum aNodeNum( nLevel ); - if( pListBlock->IsRestartNumbering() ) - { - aNodeNum.SetStart(); - pListBlock->ResetRestartNumbering(); - } - if( pListItem && pListItem->HasStartValue() ) - { - aNodeNum.SetSetValue( pListItem->GetStartValue() ); - } - - pTxtNd->UpdateNum( aNodeNum ); - - GetSwImport().SetListItem( 0 ); - } - else - { - // If the paragraph is not in a list but its style, remove it from - // the list. - if( pNumRule ) - rDoc.Insert( aPaM, SwNumRuleItem() ); - } - - if( pHints && pHints->Count() ) - { - for( sal_uInt16 i=0; i<pHints->Count(); i++ ) - { - SwXMLHint_Impl *pHint = (*pHints)[i]; - xub_StrLen nStt = pHint->GetStart(); - xub_StrLen nEnd = pHint->GetEnd(); - if( nStt != nEnd ) - { - aPaM.GetPoint()->nContent.Assign( pCNd, nEnd ); - aPaM.SetMark(); - aPaM.GetPoint()->nContent.Assign( pCNd, nStt ); - rDoc.Insert( aPaM, pHint->GetItemSet() ); - } - } - } - delete pHints; -} - -SvXMLImportContext *SwXMLParaContext::CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) -{ - SvXMLImportContext *pContext = 0; - - const SvXMLTokenMap& rTokenMap = GetSwImport().GetTextPElemTokenMap(); - switch( rTokenMap.Get( nPrefix, rLocalName ) ) - { - case XML_TOK_SW_SPAN: - if( !pHints ) - pHints = new SwXMLHints_Impl; - pContext = new SwXMLImpSpanContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - *pHints, bIgnoreLeadingSpace ); - break; - - case XML_TOK_SW_TAB_STOP: - pContext = new SwXMLImpCharContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - 0x0009, sal_False ); - bIgnoreLeadingSpace = sal_False; - break; - - case XML_TOK_SW_LINE_BREAK: - pContext = new SwXMLImpCharContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - 0x000A, sal_False ); - bIgnoreLeadingSpace = sal_False; - break; - - case XML_TOK_SW_S: - pContext = new SwXMLImpCharContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, - 0x0020, sal_True ); - break; - - default: - // ignore unknown content - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - break; - } - - return pContext; -} - -void SwXMLParaContext::Characters( const OUString& rChars ) -{ - sal_Int32 nLen = rChars.getLength(); - OUStringBuffer sChars( nLen ); - - for( sal_Int32 i=0; i < nLen; i++ ) - { - sal_Unicode c = rChars[ i ]; - switch( c ) - { - case 0x20: - case 0x09: - case 0x0a: - case 0x0d: - if( !bIgnoreLeadingSpace ) - sChars.append( (sal_Unicode)0x20 ); - bIgnoreLeadingSpace = sal_True; - break; - default: - bIgnoreLeadingSpace = sal_False; - sChars.append( c ); - break; - } - } - - GetSwImport().GetDoc().Insert( GetSwImport().GetPaM(), - sChars.makeStringAndClear() ); -} - -const SvXMLTokenMap& SwXMLImport::GetTextPAttrTokenMap() -{ - if( !pTextPAttrTokenMap ) - pTextPAttrTokenMap = new SvXMLTokenMap( aTextPAttrTokenMap ); - - return *pTextPAttrTokenMap; -} -#endif - -// --------------------------------------------------------------------- - -#ifdef XML_CORE_API -static __FAR_DATA SvXMLTokenMapEntry aBodyElemTokenMap[] = -{ - { XML_NAMESPACE_TEXT, sXML_p, XML_TOK_SW_P }, - { XML_NAMESPACE_TEXT, sXML_h, XML_TOK_SW_H }, - { XML_NAMESPACE_TEXT, sXML_ordered_list, XML_TOK_SW_ORDERED_LIST }, - { XML_NAMESPACE_TEXT, sXML_unordered_list, XML_TOK_SW_UNORDERED_LIST }, - { XML_NAMESPACE_TABLE,sXML_table, XML_TOK_TABLE_TABLE }, - { XML_NAMESPACE_TABLE,sXML_sub_table, XML_TOK_TABLE_SUBTABLE }, - XML_TOKEN_MAP_END -}; -#endif - class SwXMLBodyContext_Impl : public SvXMLImportContext { -#ifdef XML_CORE_API - const SwXMLImport& GetSwImport() const - { return (const SwXMLImport&)GetImport(); } -#endif SwXMLImport& GetSwImport() { return (SwXMLImport&)GetImport(); } public: @@ -875,37 +113,9 @@ SvXMLImportContext *SwXMLBodyContext_Impl::CreateChildContext( { SvXMLImportContext *pContext = 0; -#ifndef XML_CORE_API pContext = GetSwImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList, XML_TEXT_TYPE_BODY ); -#else - const SvXMLTokenMap& rTokenMap = GetSwImport().GetBodyElemTokenMap(); - sal_Bool bOrdered = sal_False; - sal_Bool bHeading = sal_False; - - switch( rTokenMap.Get( nPrefix, rLocalName ) ) - { - case XML_TOK_SW_H: - bHeading = sal_True; - case XML_TOK_SW_P: - pContext = new SwXMLParaContext( GetSwImport(),nPrefix, rLocalName, - xAttrList, bHeading ); - break; - case XML_TOK_SW_ORDERED_LIST: - bOrdered = sal_True; - case XML_TOK_SW_UNORDERED_LIST: - pContext = new SwXMLListBlockContext( GetSwImport(),nPrefix, rLocalName, - xAttrList, bOrdered ); - break; - case XML_TOK_TABLE_TABLE: - if( !GetSwImport().GetPaM().GetNode()->FindTableNode() ) - pContext = new SwXMLTableContext( GetSwImport(),nPrefix, rLocalName, - xAttrList ); - break; - } -#endif - if( !pContext ) pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); @@ -917,16 +127,6 @@ void SwXMLBodyContext_Impl::EndElement() GetImport().GetTextImport()->SetOutlineStyles(); } -#ifdef XML_CORE_API -const SvXMLTokenMap& SwXMLImport::GetBodyElemTokenMap() -{ - if( !pBodyElemTokenMap ) - pBodyElemTokenMap = new SvXMLTokenMap( aBodyElemTokenMap ); - - return *pBodyElemTokenMap; -} -#endif - SvXMLImportContext *SwXMLImport::CreateBodyContext( const OUString& rLocalName ) { @@ -941,717 +141,3 @@ SvXMLImportContext *SwXMLImport::CreateBodyContext( return pContext; } - -// --------------------------------------------------------------------- - -#ifdef XML_CORE_API -class SwXMLHintEndPosList : public SwHintEndPosList -{ - OUString sQSpan; - SwXMLExport& rExport; - -public: - - SwXMLHintEndPosList( SwXMLExport& rExp ); - ~SwXMLHintEndPosList(); - - void Insert( const SfxPoolItem& rItem, xub_StrLen nStart, xub_StrLen nEnd ); - - sal_Bool HasStartingOrEndingHints( xub_StrLen nPos ); - - sal_Bool ExportStartingHints( xub_StrLen nPos ); - sal_Bool ExportEndingHints( xub_StrLen nPos ); -}; - -SwXMLHintEndPosList::SwXMLHintEndPosList( SwXMLExport& rExp ) : - rExport( rExp ) -{ - OUString sLName( OUString::createFromAscii( sXML_span ) ); - sQSpan = rExp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TEXT, sLName ); -} - -SwXMLHintEndPosList::~SwXMLHintEndPosList() -{ -} - -void SwXMLHintEndPosList::Insert( const SfxPoolItem& rItem, - xub_StrLen nStart, xub_StrLen nEnd ) -{ - // empty hints will be ignored - if( nStart != nEnd ) - { - InsertHint( rItem, nStart, nEnd ); - } -} - -sal_Bool SwXMLHintEndPosList::ExportStartingHints( xub_StrLen nPos ) -{ - sal_Bool bRet = sal_False; - - // Hints in the start list are sorted ascending. - - sal_uInt16 nCount = GetStartingCount(); - for( sal_uInt16 i=0; i< nCount; i++ ) - { - SwHintSttEndPos *pPos = GetStartingHint( i ); - xub_StrLen nStart = pPos->GetStart(); - if( nStart > nPos ) - { - // This and all following hint will be started later - break; - } - else if( nStart == nPos ) - { - // export hint's start -// if( bIWSOutside ) -// rExport.GetDocHandler()->ignorableWhitespace( rExport.sWS ); - const SfxPoolItem& rItem = pPos->GetItem(); - if( (rItem.Which() >= RES_CHRATR_BEGIN && - rItem.Which() < RES_CHRATR_END) || - (rItem.Which() >= RES_UNKNOWNATR_BEGIN && - rItem.Which() < RES_UNKNOWNATR_END) ) - { - SfxItemSet aItemSet( rExport.GetDoc().GetAttrPool(), - RES_CHRATR_BEGIN, RES_CHRATR_END - 1, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END - 1, - 0 ); - aItemSet.Put( rItem ); - OUString sName( rExport.GetItemSetAutoStylePool().Find( - SFX_STYLE_FAMILY_CHAR, aItemSet ) ); - ASSERT( sName.getLength(), "no automatic style found" ); - if( sName.getLength() ) - rExport.AddAttribute( XML_NAMESPACE_TEXT, sXML_style_name, - sName ); - } - else - { - rExport.GetParaItemMapper().exportXML( - rExport.GetAttrList(), rItem, - rExport.GetTwipUnitConverter(), - rExport.GetNamespaceMap() ); - } - - rExport.GetDocHandler()->startElement( sQSpan, - rExport.GetXAttrList() ); - rExport.ClearAttrList(); - - bRet = sal_True; - } - } - - return bRet; -} - -sal_Bool SwXMLHintEndPosList::ExportEndingHints( xub_StrLen nPos ) -{ - sal_Bool bRet = sal_False; - - // Hints in the end list are sorted ascending - sal_uInt16 i=0; - while( i < GetEndingCount() ) - { - SwHintSttEndPos *pPos = GetEndingHint( i ); - xub_StrLen nEnd = pPos->GetEnd(); - - if( STRING_LEN==nPos || nEnd == nPos ) - { -// if( bIgnWS ) -// rExport.GetDocHandler()->ignorableWhitespace( rExport.sWS ); - rExport.GetDocHandler()->endElement( sQSpan ); - _RemoveHint( i ); - - bRet = sal_True; - } - else if( nEnd > nPos ) - { - // This and all hints that are following will be closed later - break; - } - else - { - // This hint should have been exported already! - ASSERT( nEnd >= nPos, - "SwXMLHintEndPosLst::OutEndAttrs: hint overseen" ); - i++; - } - } - - return bRet; -} - -sal_Bool SwXMLHintEndPosList::HasStartingOrEndingHints( xub_StrLen nPos ) -{ - sal_Bool bRet = sal_False; - - // Hints in the start list are sorted ascending. - - sal_uInt16 nCount = GetStartingCount(); - for( sal_uInt16 i=0; i< nCount; i++ ) - { - SwHintSttEndPos *pPos = GetStartingHint( i ); - xub_StrLen nStart = pPos->GetStart(); - if( nStart == nPos ) - { - bRet = sal_True; - break; - } - else if( nStart > nPos ) - { - // This and all following hint will be started later - break; - } - } - - if( !bRet ) - { - nCount = GetEndingCount(); - for( i=0; i < nCount; i++ ) - { - SwHintSttEndPos *pPos = GetEndingHint( i ); - xub_StrLen nEnd = pPos->GetEnd(); - - if( nEnd == nPos ) - { - bRet = sal_True; - break; - } - else if( nEnd > nPos ) - { - // This and all hints that are following will be closed later - break; - } - } - } - - return bRet; -} - -void SwXMLExport::ExportTxtNode( const SwTxtNode& rTxtNd, xub_StrLen nStart, - xub_StrLen nEnd, sal_Bool bExportWholeNode ) -{ - // <text:p ...> - CheckAttrList(); - - const SfxItemSet *pItemSet = rTxtNd.GetpSwAttrSet(); - - // text:style-name="..." - // If the text collection is a conditional style, the current style - // is written as style-name rather than the master style. - const SwFmtColl& rColl = rTxtNd.GetAnyFmtColl(); - OUString sStyleName( rColl.GetName() ); - if( pItemSet ) - sStyleName = FindParaAutoStyle( sStyleName, *pItemSet ); - else - sStyleName = SwXStyleFamilies::GetProgrammaticName( sStyleName, - SFX_STYLE_FAMILY_PARA ); - ASSERT( sStyleName.getLength(), "auto para style not found" ); - AddAttribute( XML_NAMESPACE_TEXT, sXML_style_name, sStyleName ); - - sal_uInt8 nOutlineLevel = ((const SwTxtFmtColl&)rColl).GetOutlineLevel(); - - // text:cond-style-name="..." - if( rTxtNd.GetCondFmtColl() ) - { - // master style - const SwFmtColl *pColl = rTxtNd.GetFmtColl(); - OUString sCondStyleName; - if( &rColl == pColl ) - { - sCondStyleName = sStyleName; - } - else - { - sCondStyleName = pColl->GetName(); - if( pItemSet ) - sCondStyleName = FindParaAutoStyle( sCondStyleName, *pItemSet ); - else - sCondStyleName = SwXStyleFamilies::GetProgrammaticName( - sCondStyleName, - SFX_STYLE_FAMILY_PARA ); - ASSERT( sCondStyleName.getLength(), "auto para style not found" ); - nOutlineLevel = ((const SwTxtFmtColl *)pColl)->GetOutlineLevel(); - } - AddAttribute( XML_NAMESPACE_TEXT, sXML_cond_style_name, - sCondStyleName ); - } - - if( NO_NUMBERING != nOutlineLevel ) - { - OUStringBuffer sTmp; - sTmp.append( GetRealLevel(nOutlineLevel)+1L ); - AddAttribute( XML_NAMESPACE_TEXT, sXML_level, - sTmp.makeStringAndClear() ); - } - - { - const sal_Char *pElem = - NO_NUMBERING == nOutlineLevel ? sXML_p : sXML_h; - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, pElem, sal_True, - sal_False ); - xub_StrLen nOffset = 0; - - const String& rText = rTxtNd.GetTxt(); - xub_StrLen nPos = pCurPaM->GetPoint()->nContent.GetIndex(); - xub_StrLen nEndPos = rText.Len(); - if( pCurPaM->GetPoint()->nNode == pCurPaM->GetMark()->nNode ) - nEndPos = pCurPaM->GetMark()->nContent.GetIndex(); - - const SwpHints *pHints = rTxtNd.GetpSwpHints(); - sal_uInt16 nHintCount = pHints ? pHints->Count() : 0; - sal_uInt16 nHintPos = 0; - SwXMLHintEndPosList aHintLst( *this ); - - // export all hints before the current text position - const SwTxtAttr * pTxtAttr = 0; - if( nHintCount && nPos > *( pTxtAttr = (*pHints)[0] )->GetStart() ) - { - do - { - nHintPos++; - - if( pTxtAttr->GetEnd() ) - { - DBG_ASSERT( RES_TXTATR_FIELD == pTxtAttr->Which(), - "ignore fields" ); - xub_StrLen nHtEnd = *pTxtAttr->GetEnd(), - nHtStt = *pTxtAttr->GetStart(); - if( (!bExportWholeNode && nHtEnd <= nPos) || - nHtEnd == nHtStt ) - continue; - - // add hint to hint list - if( bExportWholeNode ) - { - aHintLst.Insert( pTxtAttr->GetAttr(), nHtStt + nOffset, - nHtEnd + nOffset ); - } - else - { - xub_StrLen nTmpStt = nHtStt < nPos ? nPos : nHtStt; - xub_StrLen nTmpEnd = nHtEnd < nEndPos ? nHtEnd : nEndPos; - aHintLst.Insert( pTxtAttr->GetAttr(), nTmpStt + nOffset, - nTmpEnd + nOffset ); - } - } - - } - while( nHintPos < nHintCount && - nPos > *( pTxtAttr = (*pHints)[nHintPos ] )->GetStart() ); - } - - xub_StrLen nExpStartPos = nPos; - sal_Bool bCurrCharIsSpace = sal_False; - xub_StrLen nSpaceChars = 0; - for( ; nPos < nEndPos; nPos++ ) - { - sal_Bool bExpCharAsText = sal_True; - const SwTxtAttr * pTxtAttrWOEnd = 0; - if( nHintPos < nHintCount && *pTxtAttr->GetStart() == nPos - && nPos != nEndPos ) - { - do - { - if( pTxtAttr->GetEnd() ) - { - if( *pTxtAttr->GetEnd() != nPos ) - { - // insert hint into the hint list if its not - // empty - aHintLst.Insert( pTxtAttr->GetAttr(), - nPos + nOffset, - *pTxtAttr->GetEnd() + nOffset ); - } - } - else - { - // hints without end must be exported after all - // other hints that start at this position - ASSERT( !pTxtAttrWOEnd, - "SwXMLExport::ExportTxtNode: There is a hint already" ); - pTxtAttrWOEnd = pTxtAttr; - bExpCharAsText = sal_False; // ignore 0xff - } - } - while( ++nHintPos < nHintCount && - nPos == *( pTxtAttr = (*pHints)[nHintPos] )->GetStart() ); - } - - // Some characters require some extra work ... - sal_Bool bExpCharAsElement = sal_False; - sal_Bool bPrevCharIsSpace = bCurrCharIsSpace; - bCurrCharIsSpace = sal_False; - if( bExpCharAsText ) - { - switch( rText.GetChar(nPos) ) - { - case 0x0009: // Tab - case 0x000A: // LF - // These characters are exported as text. - bExpCharAsElement = sal_True; - bExpCharAsText = sal_False; - break; - case 0x0020: // Blank - if( bPrevCharIsSpace ) - { - // If the previous character is a space character, - // too, export a special space element. - bExpCharAsText = sal_False; - } - bCurrCharIsSpace = sal_True; - break; - } - } - - // If the current character is not exported as text or if there - // are hints starting or ending before the current position, - // the text that has not been exported by now has to be exported - // now. - if( nPos > nExpStartPos && - ( !bExpCharAsText || - aHintLst.HasStartingOrEndingHints( nPos+nOffset ) ) ) - { - ASSERT( 0==nSpaceChars, - "SwXMLExport::ExportTxtNode: pending spaces" ); - String sExp( rText.Copy( nExpStartPos, - nPos - nExpStartPos ) ); - GetDocHandler()->characters( sExp ); - nExpStartPos = nPos; - } - - // If there are spaces left that have not been exported and the - // current chracter is either not a space or there are some - // hints starting or ending, the pending spaces have to be - // exported now. - if( nSpaceChars > 0 && - ( !bCurrCharIsSpace || - aHintLst.HasStartingOrEndingHints( nPos+nOffset ) ) ) - { - ASSERT( nExpStartPos == nPos, - "SwXMLExport::ExportTxtNode: pending characters" ); - - if( nSpaceChars > 1 ) - { - OUStringBuffer sTmp; - sTmp.append( (sal_Int32)nSpaceChars ); - AddAttribute( XML_NAMESPACE_TEXT, sXML_c, - sTmp.makeStringAndClear() ); - } - - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, - sXML_s, sal_False, sal_False ); - - nSpaceChars = 0; - } - - // Before the text or tag of the current element, ending and - // starting hints have to be exported. - aHintLst.ExportEndingHints( nPos + nOffset ); - aHintLst.ExportStartingHints( nPos + nOffset ); - - // If the current character has to be exported as a special - // element, the elemnt will be exported now. - if( bExpCharAsElement ) - { - switch( rText.GetChar(nPos) ) - { - case 0x0009: // Tab - { - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, - sXML_tab_stop, sal_False, - sal_False ); - } - break; - case 0x000A: // LF - { - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, - sXML_line_break, sal_False, - sal_False ); - } - break; - } - } - if( pTxtAttrWOEnd ) - { - // TODO: This is a hack as long as if there is no field - // export. - if( RES_TXTATR_FIELD == pTxtAttrWOEnd->Which() ) - { - const SwField *pFld = - ((const SwFmtFld&)pTxtAttrWOEnd->GetAttr()).GetFld(); - if( pFld ) - { - GetDocHandler()->characters( pFld->Expand() ); - } -#ifdef XML_CORE_API -// Reference < XTextField > xFld = new SwXTextField( -// ((const SwFmtFld&)pTxtAttrWOEnd->GetAttr()), -// &GetDoc() ); -// -// GetTextFieldExport().ExportField( xFld ); -#endif - } - } - - // If the current character is a space, and the previous one - // is a space, too, the number of pending spaces is incremented - // only. - if( bCurrCharIsSpace && bPrevCharIsSpace ) - nSpaceChars++; - - // If the currect character is not exported as text, the start - // position for text is the position behind the current position. - if( !bExpCharAsText ) - { - ASSERT( nExpStartPos == nPos, "wrong export start pos" ); - nExpStartPos = nPos+1; - } - } - - // If there is some text left, it has to be exported now. - if( nExpStartPos < nEndPos ) - { - ASSERT( 0==nSpaceChars, - "SwXMLExport::ExportTxtNode: pending spaces " ); - String sExp( rText.Copy( nExpStartPos, nEndPos - nExpStartPos ) ); - GetDocHandler()->characters( sExp ); - } - - // If there are some spaces left, they have to be exported now. - if( nSpaceChars > 0 ) - { - if( nSpaceChars > 1 ) - { - OUStringBuffer sTmp; - sTmp.append( (sal_Int32)nSpaceChars ); - AddAttribute( XML_NAMESPACE_TEXT, sXML_c, - sTmp.makeStringAndClear() ); - } - - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, sXML_s, - sal_False, sal_False ); - } - - // The same applies to all hints that are currently open. - aHintLst.ExportEndingHints( STRING_LEN ); - } -} - -void SwXMLExport::ExportSection( const SwSectionNode& rSectNd ) -{ -#if 0 - const SwSection& rSection = rSectNd.GetSection(); - const SwSectionFmt *pSectFmt = rSection.GetFmt(); - ASSERT( pSectFmt, "SwXMLExport::ExportSection: section without a format?" ); - - // <text:section-desc ...> - CheckAttrList(); - - // text:name="..." - AddAttribute( XML_NAMESPACE_TEXT, sXML_name, S2WS(rSection.GetName()) ); - - // text:hidden="..." - if( rSection.IsHidden() ) - { - AddAttributeASCII( XML_NAMESPACE_TEXT, sXML_hidden, sXML_true ); - - // text:condition="..." - if( rSection.IsCondHidden() ) - { - AddAttribute( XML_NAMESPACE_TEXT, sXML_condition, - S2WS(rSection.GetCondition()) ); - } - } - - { - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, sXML_section_desc, - sal_True, sal_True ); -// TODO -// pSectionItemExport->Export( pSectFmt->GetAttrSet(), XML_ITEM_IGN_WS ); - } - - // <text:section ...> - CheckAttrList(); - - // text:name="..." - AddAttribute( XML_NAMESPACE_TEXT, sXML_section_name, - S2WS(rSection.GetName()) ); -#endif - - SwNode *pStartNd = pDoc->GetNodes()[rSectNd.GetIndex() + 1]; - SwNode *pEndNd = pDoc->GetNodes()[rSectNd.EndOfSectionIndex() - 1]; - - { -#if 0 - SvXMLElementExport aElem( *this, XML_NAMESPACE_TEXT, sXML_section, - sal_True, sal_True ); -#endif - SwXMLExpContext aContext( *this, *pStartNd, *pEndNd, 0, STRING_LEN ); - ExportCurPaM(); - } - - pCurPaM->GetPoint()->nNode = *rSectNd.EndOfSectionNode(); -} -#endif - -/************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmltext.cxx,v 1.3 2000-10-18 11:20:44 mib Exp $ - - Source Code Control System - Update - - $Log: not supported by cvs2svn $ - Revision 1.2 2000/09/27 06:15:11 mib - Setting outline styles at end of body - - Revision 1.1.1.1 2000/09/18 17:15:00 hr - initial import - - Revision 1.48 2000/09/18 16:05:08 willem.vandorp - OpenOffice header added. - - Revision 1.47 2000/09/18 11:58:03 mib - text frames/graphics import and export continued - - Revision 1.46 2000/08/24 11:16:42 mib - text import continued - - Revision 1.45 2000/08/10 10:22:16 mib - #74404#: Adeptions to new XSL/XLink working draft - - Revision 1.44 2000/08/04 11:39:54 dvo - - field declarations import removed from CORE API import - - Revision 1.43 2000/08/03 18:03:58 dvo - - variable field declarations import added - - Revision 1.42 2000/07/31 09:42:35 mib - text export continued - - Revision 1.41 2000/07/24 10:19:02 dvo - - textfield export for XML_CORE_API - - Revision 1.40 2000/07/21 12:55:15 mib - text import/export using StarOffice API - - Revision 1.39 2000/07/11 11:17:59 dvo - text field export added - - Revision 1.38 2000/06/08 09:45:55 aw - changed to use functionality from xmloff project now - - Revision 1.37 2000/05/24 12:08:11 mib - unicode bug fix - - Revision 1.36 2000/05/03 12:08:05 mib - unicode - - Revision 1.35 2000/03/13 14:33:45 mib - UNO3 - - Revision 1.34 2000/03/06 10:46:11 mib - #72585#: toInt32 - - Revision 1.33 2000/02/21 12:51:07 mib - #70271#: Export of section element removed - - Revision 1.32 2000/02/17 14:40:30 mib - #70271#: XML table import - - Revision 1.30 2000/01/27 08:59:02 mib - #70271#: outline numbering - - Revision 1.29 2000/01/20 10:03:16 mib - #70271#: Lists reworked - - Revision 1.28 2000/01/12 15:00:23 mib - #70271#: lists - - Revision 1.27 2000/01/06 15:08:28 mib - #70271#:separation of text/layout, cond. styles, adaptions to wd-xlink-19991229 - - Revision 1.26 1999/12/14 09:47:51 mib - #70271#: Export field content as text - - Revision 1.25 1999/12/13 08:29:07 mib - #70271#: Support for element items added, background and brush item - - Revision 1.24 1999/12/08 10:44:21 cl - #70271# added first support for importing tab-stops - - Revision 1.23 1999/12/06 11:41:33 mib - #70258#: Container item for unkown attributes - - Revision 1.22 1999/11/26 11:11:49 mib - export-flags, loading of styles only - - Revision 1.21 1999/11/19 15:27:59 mib - Opt: using C++ arrays instead of string buffers - - Revision 1.20 1999/11/12 11:43:03 mib - using item mapper, part iii - - Revision 1.19 1999/11/10 15:08:09 mib - Import now uses XMLItemMapper - - Revision 1.18 1999/11/09 15:40:08 mib - Using XMLItemMapper for export - - Revision 1.17 1999/11/03 11:13:50 mib - list style import continued - - Revision 1.16 1999/11/01 11:38:50 mib - List style import - - Revision 1.15 1999/10/26 13:33:50 mib - list styles continued - - Revision 1.14 1999/10/25 10:41:48 mib - Using new OUString ASCII methods - - Revision 1.13 1999/10/15 12:38:01 mib - XML_TOK_SW_LINE_FEED -> XML_TOK_SW_LINE_BREAK - - Revision 1.12 1999/10/08 11:47:56 mib - moved some file to SVTOOLS/SVX - - Revision 1.11 1999/10/06 06:48:06 mib - WS stripping - - Revision 1.10 1999/10/01 14:12:02 mib - tab, line break and space - - Revision 1.9 1999/09/28 10:47:05 mib - memory leak - - Revision 1.8 1999/09/28 08:31:47 mib - char fmts, hints - - Revision 1.7 1999/09/23 11:54:28 mib - i18n, token maps and hard paragraph attributes - - Revision 1.6 1999/09/22 11:57:46 mib - string -> wstring - - Revision 1.5 1999/08/18 15:03:38 MIB - Style import - - - Rev 1.4 18 Aug 1999 17:03:38 MIB - Style import - - Rev 1.3 17 Aug 1999 16:29:24 MIB - import of text nodes started - - Rev 1.2 13 Aug 1999 16:19:42 MIB - styles and sections - - Rev 1.1 12 Aug 1999 18:06:22 MIB - Export ofSvxFontItem, SvxFontHeightItem and SvxLRSpaceItem - - Rev 1.0 12 Aug 1999 12:29:28 MIB - Initial revision. - -*************************************************************************/ - diff --git a/sw/source/filter/xml/xmltexte.hxx b/sw/source/filter/xml/xmltexte.hxx index 55c488e88a7a..9c81b42166de 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2000-09-29 10:54:05 $ + * last change: $Author: mib $ $Date: 2000-11-07 14:05:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,6 @@ #ifndef _XMLTEXTE_HXX #define _XMLTEXTE_HXX -#ifndef XML_CORE_API - #ifndef _XMLOFF_TEXTPARAE_HXX_ #include <xmloff/txtparae.hxx> #endif @@ -96,7 +94,6 @@ public: SvXMLAutoStylePoolP& rAutoStylePool ); ~SwXMLTextParagraphExport(); }; -#endif #endif // _XMLTEXTE_HXX diff --git a/sw/source/filter/xml/xmltexti.hxx b/sw/source/filter/xml/xmltexti.hxx deleted file mode 100644 index f11faf0e4a77..000000000000 --- a/sw/source/filter/xml/xmltexti.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************* - * - * $RCSfile: xmltexti.hxx,v $ - * - * $Revision: 1.1.1.1 $ - * - * last change: $Author: hr $ $Date: 2000-09-18 17:15: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 _XMLTEXTI_HXX -#define _XMLTEXTI_HXX - -#ifndef _RTL_USTRING_HXX -#include <rtl/ustring.hxx> -#endif - -#ifndef _XMLOFF_XMLTKMAP_HXX -#include <xmloff/xmltkmap.hxx> -#endif - -#ifndef _XMLOFF_XMLICTXT_HXX -#include <xmloff/xmlictxt.hxx> -#endif - -#ifdef XML_CORE_API -class SfxItemSet; -class SwXMLHints_Impl; -class SwXMLImport; -namespace com { namespace sun { namespace star { namespace xml { - namespace sax { class XAttributeList; } } } } } - - -enum SwXMLBodyElemTokens -{ - XML_TOK_SW_P, - XML_TOK_SW_H, - XML_TOK_SW_ORDERED_LIST, - XML_TOK_SW_UNORDERED_LIST, - XML_TOK_TABLE_TABLE, - XML_TOK_TABLE_SUBTABLE, - XML_TOK_SW_ELEM_END=XML_TOK_UNKNOWN -}; - -class SwXMLParaContext : public SvXMLImportContext -{ - SfxItemSet *pItemSet; - SwXMLHints_Impl *pHints; - sal_Bool bIgnoreLeadingSpace; - sal_Bool bHeading; - -public: - - SwXMLParaContext( SwXMLImport& rImport, sal_uInt16 nPrfx, - const ::rtl::OUString& rLName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & xAttrList, - sal_Bool bHeading ); - - virtual ~SwXMLParaContext(); - - virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, - const ::rtl::OUString& rLocalName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); - - virtual void Characters( const ::rtl::OUString& rChars ); - - SwXMLImport& GetSwImport() { return (SwXMLImport&)GetImport(); } -}; -#endif - - -#endif // _XMLTEXTI_HXX |