diff options
author | Michael Brauer <mib@openoffice.org> | 2001-03-02 15:49:56 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2001-03-02 15:49:56 +0000 |
commit | d636edda6de6e4e66c695d9f7a3d2cd46d857907 (patch) | |
tree | 070fee0a752f564bb5ea05a54746b48c7a80d25a /sw/source/filter/xml/xmlexp.cxx | |
parent | c3876094d346755883af19e98b33987e0c912b3b (diff) |
use different streams for content and styles
Diffstat (limited to 'sw/source/filter/xml/xmlexp.cxx')
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 127 |
1 files changed, 71 insertions, 56 deletions
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index e165409904c4..dfb65e7a1f67 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.25 $ + * $Revision: 1.26 $ * - * last change: $Author: dvo $ $Date: 2001-02-14 16:35:00 $ + * last change: $Author: mib $ $Date: 2001-03-02 16:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -247,8 +247,6 @@ sal_uInt32 SwXMLExport::exportDoc( const sal_Char *pClass ) if( !GetModel().is() ) return ERR_SWG_WRITE_ERROR; - GetTextParagraphExport()->SetBlockMode( bBlock ); - Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); @@ -263,36 +261,43 @@ sal_uInt32 SwXMLExport::exportDoc( const sal_Char *pClass ) return ERR_SWG_WRITE_ERROR; SwDoc *pDoc = pText->GetDoc(); - const SfxPoolItem* pItem; - const SfxItemPool& rPool = pDoc->GetAttrPool(); - sal_uInt16 nItems = rPool.GetItemCount( RES_UNKNOWNATR_CONTAINER ); + sal_Bool bExtended = sal_False; - for( sal_uInt16 i = 0; i < nItems; ++i ) + if( (getExportFlags() & (EXPORT_FONTDECLS|EXPORT_STYLES| + EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 ) { - if( 0 != (pItem = rPool.GetItem( RES_UNKNOWNATR_CONTAINER, i ) ) ) + GetTextParagraphExport()->SetBlockMode( bBlock ); + + const SfxPoolItem* pItem; + const SfxItemPool& rPool = pDoc->GetAttrPool(); + sal_uInt16 nItems = rPool.GetItemCount( RES_UNKNOWNATR_CONTAINER ); + for( sal_uInt16 i = 0; i < nItems; ++i ) { - const SvXMLAttrContainerItem *pUnknown = - (const SvXMLAttrContainerItem *)pItem; - if( (pUnknown->GetAttrCount() > 0) ) + if( 0 != (pItem = rPool.GetItem( RES_UNKNOWNATR_CONTAINER, i ) ) ) { - sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex(); - while( USHRT_MAX != nIdx ) + const SvXMLAttrContainerItem *pUnknown = + (const SvXMLAttrContainerItem *)pItem; + if( (pUnknown->GetAttrCount() > 0) ) { - const OUString& rPrefix = pUnknown->GetPrefix( nIdx ); - if( USHRT_MAX == - GetNamespaceMap().GetIndexByPrefix( rPrefix ) ) + sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex(); + while( USHRT_MAX != nIdx ) { - // Add namespace declaration for unknown attributes if - // there aren't existing ones for the prefix used by the - // attibutes - _GetNamespaceMap().Add( rPrefix, - pUnknown->GetNamespace( nIdx ), - XML_NAMESPACE_UNKNOWN ); + const OUString& rPrefix = pUnknown->GetPrefix( nIdx ); + if( USHRT_MAX == + GetNamespaceMap().GetIndexByPrefix( rPrefix ) ) + { + // Add namespace declaration for unknown attributes if + // there aren't existing ones for the prefix used by the + // attibutes + _GetNamespaceMap().Add( rPrefix, + pUnknown->GetNamespace( nIdx ), + XML_NAMESPACE_UNKNOWN ); + } + nIdx = pUnknown->GetNextNamespaceIndex( nIdx ); } - nIdx = pUnknown->GetNextNamespaceIndex( nIdx ); - } - bExtended = sal_True; + bExtended = sal_True; + } } } } @@ -311,11 +316,18 @@ sal_uInt32 SwXMLExport::exportDoc( const sal_Char *pClass ) SetCurPaM( rPaM, bExportWholeDoc, bExportFirstTableOnly ); #endif - // Update doc stat, so that correct values are exported and - // the progress works correctly. SwDocStat aDocStat( pDoc->GetDocStat() ); - if( aDocStat.bModified ) - pDoc->UpdateDocStat( aDocStat ); + if( (getExportFlags() & EXPORT_META) != 0 ) + { + // Update doc stat, so that correct values are exported and + // the progress works correctly. + if( aDocStat.bModified ) + pDoc->UpdateDocStat( aDocStat ); + + SfxObjectShell* pObjSh = pDoc->GetDocShell(); + if( pObjSh ) + pObjSh->UpdateDocInfoForSave(); // update information + } if( bShowProgress ) { nContentProgressStart = (sal_Int32)aDocStat.nPara / 2; @@ -324,29 +336,29 @@ sal_uInt32 SwXMLExport::exportDoc( const sal_Char *pClass ) pProgress->SetValue( 0 ); } - SfxObjectShell* pObjSh = pDoc->GetDocShell(); - if( pObjSh ) - pObjSh->UpdateDocInfoForSave(); // update information - - //Auf die Korrektheit der OrdNums sind wir schon angewiesen. - SdrModel* pModel = pDoc->GetDrawModel(); - if( pModel ) - pModel->GetPage( 0 )->RecalcObjOrdNums(); - - // switch redline mode - Reference<XPropertySet> xPropSet(GetModel(), UNO_QUERY); - OUString sShowChanges(RTL_CONSTASCII_USTRINGPARAM("ShowChanges")); sal_Bool bSaveShowRedline = sal_False; - if (xPropSet.is()) + Reference<XPropertySet> xPropSet; + OUString sShowChanges(RTL_CONSTASCII_USTRINGPARAM("ShowChanges")); + if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 ) { - // record old mode - Any aAny = xPropSet->getPropertyValue(sShowChanges); - bSaveShowRedline = *(sal_Bool*)aAny.getValue(); - - // set show = false - sal_Bool bTmp = sal_False; - aAny.setValue(&bTmp, ::getBooleanCppuType()); - xPropSet->setPropertyValue(sShowChanges, aAny); + //Auf die Korrektheit der OrdNums sind wir schon angewiesen. + SdrModel* pModel = pDoc->GetDrawModel(); + if( pModel ) + pModel->GetPage( 0 )->RecalcObjOrdNums(); + + // switch redline mode + xPropSet = Reference<XPropertySet>(GetModel(), UNO_QUERY); + if (xPropSet.is()) + { + // record old mode + Any aAny = xPropSet->getPropertyValue(sShowChanges); + bSaveShowRedline = *(sal_Bool*)aAny.getValue(); + + // set show = false + sal_Bool bTmp = sal_False; + aAny.setValue(&bTmp, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sShowChanges, aAny); + } } // adjust document class (pClass) @@ -369,12 +381,15 @@ sal_uInt32 SwXMLExport::exportDoc( const sal_Char *pClass ) sal_uInt32 nRet = SvXMLExport::exportDoc( pClass ); - // switch redline mode back - if (xPropSet.is()) + if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 ) { - Any aAny; - aAny.setValue(&bSaveShowRedline, ::getBooleanCppuType()); - xPropSet->setPropertyValue(sShowChanges, aAny); + // switch redline mode back + if (xPropSet.is()) + { + Any aAny; + aAny.setValue(&bSaveShowRedline, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sShowChanges, aAny); + } } #ifdef XML_CORE_API |