xref: /trunk/main/sw/source/filter/xml/xmlexp.cxx (revision 26ea3662)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_sw.hxx"
24 
25 #include <com/sun/star/text/XTextDocument.hpp>
26 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/container/XNameContainer.hpp>
29 #include <com/sun/star/container/XIndexContainer.hpp>
30 #include <com/sun/star/uno/RuntimeException.hpp>
31 #include <com/sun/star/xforms/XFormsSupplier.hpp>
32 #include <svx/svdmodel.hxx>
33 #include <svx/svdpage.hxx>
34 #include <svx/xmleohlp.hxx>
35 #include <svx/xmlgrhlp.hxx>
36 #include <editeng/eeitem.hxx>
37 #include <svx/svddef.hxx>
38 #include <xmloff/nmspmap.hxx>
39 #include <xmloff/xmlnmspe.hxx>
40 #include <editeng/xmlcnitm.hxx>
41 #include <xmloff/ProgressBarHelper.hxx>
42 #include <xmloff/xmluconv.hxx>
43 #include <xmloff/xformsexport.hxx>
44 #include <pam.hxx>
45 #include <doc.hxx>
46 #include <swmodule.hxx>
47 #include <docsh.hxx>
48 #include <viewsh.hxx>
49 #include <docstat.hxx>
50 #include <swerror.h>
51 #include <unotext.hxx>
52 #include <xmltexte.hxx>
53 #include <xmlexp.hxx>
54 #include <sfx2/viewsh.hxx>
55 #include <comphelper/processfactory.hxx>
56 #include <docary.hxx>
57 #include <editeng/unolingu.hxx>
58 #include <editeng/forbiddencharacterstable.hxx>
59 #include <ForbiddenCharactersEnum.hxx>
60 #include <vcl/svapp.hxx>
61 #include <vos/mutex.hxx>
62 #include <pausethreadstarting.hxx>
63 #include <drawdoc.hxx>
64 
65 using ::rtl::OUString;
66 using namespace ::com::sun::star;
67 using namespace ::com::sun::star::frame;
68 using namespace ::com::sun::star::lang;
69 using namespace ::com::sun::star::xml::sax;
70 using namespace ::com::sun::star::uno;
71 using namespace ::com::sun::star::text;
72 using namespace ::com::sun::star::container;
73 using namespace ::com::sun::star::document;
74 using namespace ::com::sun::star::drawing;
75 using namespace ::com::sun::star::beans;
76 using namespace ::com::sun::star::i18n;
77 using namespace ::com::sun::star::xforms;
78 using namespace ::xmloff::token;
79 
80 #ifdef XML_CORE_API
SetCurPaM(SwPaM & rPaM,sal_Bool bWhole,sal_Bool bTabOnly)81 void SwXMLExport::SetCurPaM( SwPaM& rPaM, sal_Bool bWhole, sal_Bool bTabOnly )
82 {
83 	if( !pCurPaM )
84 	{
85 		pCurPaM = new SwPaM( *rPaM.End(), *rPaM.Start() );
86 	}
87 	else
88 	{
89 		*pCurPaM->GetPoint() = *rPaM.Start();
90 		*pCurPaM->GetMark() = *rPaM.End();
91 	}
92 
93 	// Set PaM to table/section start node if whole doc should be exported
94 	if( bWhole )
95 	{
96 		SwTableNode *pTblNd = pCurPaM->GetNode()->FindTableNode();
97 		if( pTblNd )
98 		{
99 			pCurPaM->GetPoint()->nNode = *pTblNd;
100 
101 			if( bTabOnly )
102 				pCurPaM->GetMark()->nNode = *pTblNd->EndOfSectionNode();
103 		}
104 
105 		SwSectionNode * pSectNd = pCurPaM->GetNode()->FindSectionNode();
106 		while( pSectNd )
107 		{
108 			pCurPaM->GetPoint()->nNode = *pSectNd;
109 
110 			// SwSectionNode::FindSectionNode() returns the section node itself
111             pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
112 		}
113 	}
114 }
115 #endif
116 
117 // #110680#
SwXMLExport(const uno::Reference<lang::XMultiServiceFactory> xServiceFactory,sal_uInt16 nExportFlags)118 SwXMLExport::SwXMLExport(
119     const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
120 	sal_uInt16 nExportFlags)
121 :	SvXMLExport( xServiceFactory, MAP_INCH, XML_TEXT, nExportFlags ),
122 #ifdef XML_CORE_API
123 	pCurPaM( 0 ),
124 	pOrigPaM( &rPaM ),
125 #endif
126 	pTableItemMapper( 0 ),
127 	pTableLines( 0 ),
128 #ifdef XML_CORE_API
129 	bExportWholeDoc( bExpWholeDoc ),
130 	bExportFirstTableOnly( bExpFirstTableOnly ),
131 #endif
132 	bBlock( sal_False ),
133 	bShowProgress( sal_True ),
134 	sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
135 	sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
136 	sCell(RTL_CONSTASCII_USTRINGPARAM("Cell"))
137 {
138 	_InitItemExport();
139 }
140 
141 #ifdef XML_CORE_API
142 // #110680#
SwXMLExport(const uno::Reference<lang::XMultiServiceFactory> xServiceFactory,const Reference<XModel> & rModel,SwPaM & rPaM,const OUString & rFileName,const Reference<XDocumentHandler> & rHandler,const Reference<XGraphicObjectResolver> & rEmbeddedGrfObjs,sal_Bool bExpWholeDoc,sal_Bool bExpFirstTableOnly,sal_Bool bShowProg)143 SwXMLExport::SwXMLExport(
144     const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
145 	const Reference< XModel >& rModel,
146 	SwPaM& rPaM,
147 	const OUString& rFileName,
148 	const Reference< XDocumentHandler > & rHandler,
149 	const Reference< XGraphicObjectResolver > & rEmbeddedGrfObjs,
150 	sal_Bool bExpWholeDoc, sal_Bool bExpFirstTableOnly,
151 	sal_Bool bShowProg )
152 :	SvXMLExport( xServiceFactory, rFileName, rHandler, rModel, rEmbeddedGrfObjs,
153 				 SW_MOD()->GetMetric( rPaM.GetDoc()->get(IDocumentSettingAccess::HTML_MODE) ) ),
154 	pCurPaM( 0 ),
155 	pOrigPaM( &rPaM ),
156 	pTableItemMapper( 0 ),
157 	pTableLines( 0 ),
158 	bExportWholeDoc( bExpWholeDoc ),
159 	bExportFirstTableOnly( bExpFirstTableOnly ),
160 	bShowProgress( bShowProg ),
161 	sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
162 	sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
163 	sCell(RTL_CONSTASCII_USTRINGPARAM("Cell"))
164 {
165 	_InitItemExport();
166 }
167 #endif
168 
setBlockMode()169 void SwXMLExport::setBlockMode()
170 {
171 	bBlock = sal_True;
172 
173 }
174 
exportDoc(enum XMLTokenEnum eClass)175 sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
176 {
177 	if( !GetModel().is() )
178 		return ERR_SWG_WRITE_ERROR;
179 
180     // --> OD 2007-03-30 #i73788#
181     SwPauseThreadStarting aPauseThreadStarting;
182     // <--
183 
184 	Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
185 	Reference < XText > xText = xTextDoc->getText();
186 	Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
187 	ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
188 	if( !xTextTunnel.is() )
189 		return ERR_SWG_WRITE_ERROR;
190 
191     // from here, we use core interfaces -> lock Solar-Mutex (#91949#)
192 	vos::OGuard aGuard(Application::GetSolarMutex());
193 
194 	{
195         Reference<XPropertySet> rInfoSet = getExportInfo();
196         if( rInfoSet.is() )
197         {
198 			OUString sAutoTextMode(
199 				RTL_CONSTASCII_USTRINGPARAM("AutoTextMode"));
200             if( rInfoSet->getPropertySetInfo()->hasPropertyByName(
201 						sAutoTextMode ) )
202 			{
203 				Any aAny = rInfoSet->getPropertyValue(sAutoTextMode);
204 				if( aAny.getValueType() == ::getBooleanCppuType() &&
205 					*static_cast<const sal_Bool*>(aAny.getValue()) )
206 					setBlockMode();
207 			}
208         }
209 	}
210 
211 	SwXText *pText = reinterpret_cast< SwXText * >(
212 			sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
213 	ASSERT( pText, "SwXText missing" );
214 	if( !pText )
215 		return ERR_SWG_WRITE_ERROR;
216 
217 	SwDoc *pDoc = pText->GetDoc();
218 
219 	sal_Bool bExtended = sal_False;
220 	if( (getExportFlags() & (EXPORT_FONTDECLS|EXPORT_STYLES|
221 							 EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 )
222 	{
223 		GetTextParagraphExport()->SetBlockMode( bBlock );
224 
225 		const SfxPoolItem* pItem;
226 		const SfxItemPool& rPool = pDoc->GetAttrPool();
227 		sal_uInt16 aWhichIds[5] = { RES_UNKNOWNATR_CONTAINER,
228 									RES_TXTATR_UNKNOWN_CONTAINER,
229 									SDRATTR_XMLATTRIBUTES,
230 									EE_PARA_XMLATTRIBS,
231 									EE_CHAR_XMLATTRIBS };
232 
233 		sal_uInt16 nWhichIds = rPool.GetSecondaryPool() ? 5 : 2;
234 		for( sal_uInt16 j=0; j < nWhichIds; j++ )
235 		{
236 			sal_uInt16 nWhichId = aWhichIds[j];
237 			sal_uInt32 i=0, nItems = rPool.GetItemCount2( nWhichId );
238 			for( i = 0; i < nItems; ++i )
239 			{
240 				if( 0 != (pItem = rPool.GetItem2( nWhichId , i ) ) )
241 				{
242 					const SvXMLAttrContainerItem *pUnknown =
243 								PTR_CAST( SvXMLAttrContainerItem, pItem );
244 					ASSERT( pUnknown, "illegal attribute container item" );
245 					if( pUnknown && (pUnknown->GetAttrCount() > 0) )
246 					{
247 						sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex();
248 						while( USHRT_MAX != nIdx )
249 						{
250 							const OUString& rPrefix =
251 								pUnknown->GetPrefix( nIdx );
252 							_GetNamespaceMap().Add( rPrefix,
253 												pUnknown->GetNamespace( nIdx ),
254 												XML_NAMESPACE_UNKNOWN );
255 							nIdx = pUnknown->GetNextNamespaceIndex( nIdx );
256 						}
257 						bExtended = sal_True;
258 					}
259 				}
260 			}
261 		}
262 	}
263 
264 	MapUnit eUnit =
265 		SvXMLUnitConverter::GetMapUnit( SW_MOD()->GetMetric(pDoc->get(IDocumentSettingAccess::HTML_MODE)) );
266 	if( GetMM100UnitConverter().getXMLMeasureUnit() != eUnit )
267 	{
268 		GetMM100UnitConverter().setXMLMeasureUnit( eUnit );
269 		pTwipUnitConv->setXMLMeasureUnit( eUnit );
270 	}
271 
272 	SetExtended( bExtended );
273 
274 	SwDocStat aDocStat( pDoc->GetDocStat() );
275 	if( (getExportFlags() & EXPORT_META) != 0 )
276 	{
277 		// Update doc stat, so that correct values are exported and
278 		// the progress works correctly.
279 		if( aDocStat.bModified )
280 			pDoc->UpdateDocStat( aDocStat );
281 
282 		SfxObjectShell* pObjSh = pDoc->GetDocShell();
283 		if( pObjSh )
284 			pObjSh->UpdateDocInfoForSave();		// update information
285 	}
286 	if( bShowProgress )
287 	{
288 		ProgressBarHelper *pProgress = GetProgressBarHelper();
289 		if( -1 == pProgress->GetReference() )
290 		{
291 			// progress isn't initialized:
292 			// We assume that the whole doc is exported, and the following
293 			// durations:
294 			// - meta information: 2
295 			// - settings: 4 (TODO: not now!)
296 			// - styles (except page styles): 2
297 			// - page styles: 2 (TODO: not now!) + 2 for each paragraph
298 			// - paragraph: 2 (1 for automatic styles and one for content)
299 
300 			// If required, update doc stat, so that
301 			// the progress works correctly.
302 			if( aDocStat.bModified )
303 				pDoc->UpdateDocStat( aDocStat );
304 
305 			// count each item once, and then multiply by two to reach the
306 			// figures given above
307             // The styles in pDoc also count the default style that never
308             // gets exported -> subtract one.
309             sal_Int32 nRef = 1; // meta.xml
310 			nRef += pDoc->GetCharFmts()->Count() - 1;
311 			nRef += pDoc->GetFrmFmts()->Count() - 1;
312 			nRef += pDoc->GetTxtFmtColls()->Count() - 1;
313 //			nRef += pDoc->GetPageDescCnt();
314             nRef *= 2; // for the above styles, xmloff will increment by 2!
315             // #i93174#: count all paragraphs for the progress bar
316             nRef += aDocStat.nAllPara; // 1: only content, no autostyle
317             pProgress->SetReference( nRef );
318 			pProgress->SetValue( 0 );
319 		}
320 	}
321 
322 	if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 )
323 	{
324 		//Auf die Korrektheit der OrdNums sind wir schon angewiesen.
325 		SwDrawModel* pModel = pDoc->GetDrawModel();
326 		if( pModel )
327 			pModel->GetPage( 0 )->RecalcObjOrdNums();
328 	}
329 
330 	// adjust document class (eClass)
331 	if (pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT))
332 	{
333 		eClass = XML_TEXT_GLOBAL;
334 
335 		// additionally, we take care of the save-linked-sections-thingy
336         mbSaveLinkedSections = pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
337     }
338 	// MIB: 03/26/04: The Label information is saved in the settings, so
339 	// we don't need it here.
340 	// else: keep default pClass that we received
341 
342 	SvXMLGraphicHelper *pGraphicResolver = 0;
343 	if( !GetGraphicResolver().is() )
344 	{
345 		pGraphicResolver = SvXMLGraphicHelper::Create( GRAPHICHELPER_MODE_WRITE );
346 		Reference< XGraphicObjectResolver > xGraphicResolver( pGraphicResolver );
347 		SetGraphicResolver( xGraphicResolver );
348 	}
349 
350 	SvXMLEmbeddedObjectHelper *pEmbeddedResolver = 0;
351 	if( !GetEmbeddedResolver().is() )
352 	{
353         SfxObjectShell *pPersist = pDoc->GetPersist();
354 		if( pPersist )
355 		{
356 			pEmbeddedResolver = SvXMLEmbeddedObjectHelper::Create(
357 											*pPersist,
358 											EMBEDDEDOBJECTHELPER_MODE_WRITE );
359 			Reference< XEmbeddedObjectResolver > xEmbeddedResolver( pEmbeddedResolver );
360 			SetEmbeddedResolver( xEmbeddedResolver );
361 		}
362 	}
363 
364     // set redline mode if we export STYLES or CONTENT, unless redline
365     // mode is taken care of outside (through info XPropertySet)
366     sal_Bool bSaveRedline =
367         ( (getExportFlags() & (EXPORT_CONTENT|EXPORT_STYLES)) != 0 );
368     if( bSaveRedline )
369     {
370         // if the info property set has a ShowChanges property,
371         // then change tracking is taken care of on the outside,
372         // so we don't have to!
373         Reference<XPropertySet> rInfoSet = getExportInfo();
374         if( rInfoSet.is() )
375         {
376             OUString sShowChanges( RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
377             bSaveRedline = ! rInfoSet->getPropertySetInfo()->hasPropertyByName(
378                                                                 sShowChanges );
379         }
380     }
381     sal_uInt16 nRedlineMode = 0;
382     bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->GetRedlineMode() );
383     if( bSaveRedline )
384     {
385         // now save and switch redline mode
386         nRedlineMode = pDoc->GetRedlineMode();
387         pDoc->SetRedlineMode(
388 			     (RedlineMode_t)(( nRedlineMode & nsRedlineMode_t::REDLINE_SHOW_MASK ) | nsRedlineType_t::REDLINE_INSERT ));
389     }
390 
391  	sal_uInt32 nRet = SvXMLExport::exportDoc( eClass );
392 
393     // now we can restore the redline mode (if we changed it previously)
394     if( bSaveRedline )
395     {
396       pDoc->SetRedlineMode( (RedlineMode_t)(nRedlineMode ));
397     }
398 
399 
400 	if( pGraphicResolver )
401 		SvXMLGraphicHelper::Destroy( pGraphicResolver );
402 	if( pEmbeddedResolver )
403 	    SvXMLEmbeddedObjectHelper::Destroy( pEmbeddedResolver );
404 
405 	ASSERT( !pTableLines, "there are table columns infos left" );
406 
407 	return nRet;
408 }
409 
CreateTextParagraphExport()410 XMLTextParagraphExport* SwXMLExport::CreateTextParagraphExport()
411 {
412 	return new SwXMLTextParagraphExport( *this, *GetAutoStylePool().get() );
413 }
414 
CreateShapeExport()415 XMLShapeExport* SwXMLExport::CreateShapeExport()
416 {
417 	XMLShapeExport* pShapeExport = new XMLShapeExport( *this, XMLTextParagraphExport::CreateShapeExtPropMapper( *this ) );
418 	Reference < XDrawPageSupplier > xDPS( GetModel(), UNO_QUERY );
419 	if( xDPS.is() )
420 	{
421 	 	Reference < XShapes > xShapes( xDPS->getDrawPage(), UNO_QUERY );
422 		pShapeExport->seekShapes( xShapes );
423 	}
424 
425 	return pShapeExport;
426 }
427 
~SwXMLExport()428 __EXPORT SwXMLExport::~SwXMLExport()
429 {
430 	_FinitItemExport();
431 }
432 
433 
_ExportFontDecls()434 void SwXMLExport::_ExportFontDecls()
435 {
436 	GetFontAutoStylePool();	// make sure the pool is created
437 	SvXMLExport::_ExportFontDecls();
438 }
439 
440 #define NUM_EXPORTED_VIEW_SETTINGS 11
GetViewSettings(Sequence<PropertyValue> & aProps)441 void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
442 {
443 	Reference< XMultiServiceFactory > xServiceFactory =
444 			comphelper::getProcessServiceFactory();
445 	ASSERT( xServiceFactory.is(),
446 			"XMLReader::Read: got no service manager" );
447 	if( !xServiceFactory.is() )
448 		return;
449 
450 	aProps.realloc( NUM_EXPORTED_VIEW_SETTINGS );
451 	 // Currently exporting 9 properties
452     PropertyValue *pValue = aProps.getArray();
453     sal_Int32 nIndex = 0;
454 
455     Reference < XIndexContainer > xBox (xServiceFactory->createInstance
456             (OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), UNO_QUERY);
457     if (xBox.is() )
458 	{
459 		pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "Views") );
460 		pValue[nIndex++].Value <<= Reference < XIndexAccess > ( xBox, UNO_QUERY );
461 	}
462 
463 	Reference < XText > xText;
464 	SwXText *pText = 0;
465 
466 	if( GetModel().is() )
467     {
468 		Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
469 		xText = xTextDoc->getText();
470 		Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
471 		ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
472 		if( xTextTunnel.is() )
473 		{
474 			pText = reinterpret_cast< SwXText * >(
475 					sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId()) ));
476 			ASSERT( pText, "SwXText missing" );
477 		}
478 	}
479 
480 	if( !pText )
481     {
482         aProps.realloc(nIndex);
483 		return;
484     }
485 
486 	SwDoc *pDoc = pText->GetDoc();
487 	const Rectangle rRect =
488         pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT );
489     sal_Bool bTwip = pDoc->GetDocShell()->GetMapUnit ( ) == MAP_TWIP;
490 
491 	ASSERT ( bTwip, "Map unit for visible area is not in TWIPS!" );
492 
493     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") );
494     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Top() ) : rRect.Top();
495 
496     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaLeft") );
497     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Left() ) : rRect.Left();
498 
499     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaWidth") );
500     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.GetWidth() ) : rRect.GetWidth();
501 
502     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") );
503     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.GetHeight() ) : rRect.GetHeight();
504 
505     // "show redline mode" cannot simply be read from the document
506     // since it gets changed during execution. If it's in the info
507     // XPropertySet, we take it from there.
508     sal_Bool bShowRedlineChanges = bSavedShowChanges;
509     Reference<XPropertySet> xInfoSet( getExportInfo() );
510     if ( xInfoSet.is() )
511     {
512         OUString sShowChanges( RTL_CONSTASCII_USTRINGPARAM( "ShowChanges" ));
513         if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) )
514         {
515             bShowRedlineChanges = *(sal_Bool*) xInfoSet->
516                                    getPropertyValue( sShowChanges ).getValue();
517         }
518     }
519 
520     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ShowRedlineChanges") );
521     pValue[nIndex++].Value.setValue( &bShowRedlineChanges, ::getBooleanCppuType() );
522 
523     sal_Bool bInBrowse =  pDoc->get(IDocumentSettingAccess::BROWSE_MODE);
524     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "InBrowseMode") );
525     pValue[nIndex++].Value.setValue( &bInBrowse, ::getBooleanCppuType() );
526 
527 	if ( nIndex < NUM_EXPORTED_VIEW_SETTINGS )
528         aProps.realloc(nIndex);
529 }
530 #undef NUM_EXPORTED_VIEW_SETTINGS
531 
GetConfigurationSettings(Sequence<PropertyValue> & rProps)532 void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps)
533 {
534     Reference< XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
535     if( xFac.is() )
536     {
537         Reference< XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
538         if( xProps.is() )
539         {
540             // property CurrentDatabaseDataSource needs to be exported before CurrentDatabaseCommand and CurrentDatabaseCommandType
541             // in order to assure that AOO/OOo versions (before AOO 4.0.1) are able to apply the current database settings correct
542             // Thus, put CurrentDatabaseDataSource as the first one into the Sequence
543 //            SvXMLUnitConverter::convertPropertySet( rProps, xProps );
544             uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xProps->getPropertySetInfo();
545             if (xPropertySetInfo.is())
546             {
547                 uno::Sequence< beans::Property > aProps = xPropertySetInfo->getProperties();
548                 const sal_Int32 nCount(aProps.getLength());
549                 if (nCount)
550                 {
551                     rProps.realloc(nCount);
552                     beans::PropertyValue* pProps = rProps.getArray();
553 
554                     static ::rtl::OUString csCurrentDatabaseSource = ::rtl::OUString::createFromAscii("CurrentDatabaseDataSource");
555                     const sal_Bool bHasCurrentDatabaseSource = xPropertySetInfo->hasPropertyByName( csCurrentDatabaseSource );
556                     if ( bHasCurrentDatabaseSource )
557                     {
558                         beans::Property aProp = xPropertySetInfo->getPropertyByName( csCurrentDatabaseSource );
559                         pProps->Name = aProp.Name;
560                         pProps->Value = xProps->getPropertyValue(aProp.Name);
561                         ++pProps;
562                     }
563 
564                     for (sal_Int32 i = 0; i < nCount; i++ )
565                     {
566                         if ( bHasCurrentDatabaseSource
567                              && aProps[i].Name.compareTo( csCurrentDatabaseSource ) == 0 )
568                         {
569                             // nothing to do - already added as first item - see above
570                         }
571                         else
572                         {
573                             pProps->Name = aProps[i].Name;
574                             pProps->Value = xProps->getPropertyValue(aProps[i].Name);
575                             ++pProps;
576                         }
577                     }
578                 }
579             }
580         }
581     }
582 }
583 
GetDocumentSpecificSettings(::std::list<SettingsGroup> & _out_rSettings)584 sal_Int32 SwXMLExport::GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings )
585 {
586     // the only doc-specific settings group we know so far are the XForms settings
587     uno::Sequence<beans::PropertyValue> aXFormsSettings;
588     Reference< XFormsSupplier > xXFormsSupp( GetModel(), UNO_QUERY );
589     Reference< XNameAccess > xXForms;
590     if ( xXFormsSupp.is() )
591         xXForms = xXFormsSupp->getXForms().get();
592     if ( xXForms.is() )
593     {
594         getXFormsSettings( xXForms, aXFormsSettings );
595         _out_rSettings.push_back( SettingsGroup( XML_XFORM_MODEL_SETTINGS, aXFormsSettings ) );
596     }
597 
598     return aXFormsSettings.getLength() + SvXMLExport::GetDocumentSpecificSettings( _out_rSettings );
599 }
600 
SetBodyAttributes()601 void SwXMLExport::SetBodyAttributes()
602 {
603 	Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
604 	Reference < XText > xText = xTextDoc->getText();
605     // export use of soft page breaks
606     {
607         Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
608         ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
609         if( xTextTunnel.is() )
610         {
611             SwXText *pText = reinterpret_cast< SwXText * >(
612                     sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
613 	        ASSERT( pText, "SwXText missing" );
614             if( pText )
615             {
616                 SwDoc *pDoc = pText->GetDoc();
617                 if( pDoc && pDoc->GetCurrentViewShell() &&
618                     pDoc->GetCurrentViewShell()->GetPageCount() > 1 )
619                 {
620                     sal_Bool bValue = sal_True;
621                     rtl::OUStringBuffer sBuffer;
622                     GetMM100UnitConverter().convertBool(sBuffer, bValue);
623                     AddAttribute(XML_NAMESPACE_TEXT, XML_USE_SOFT_PAGE_BREAKS,
624                         sBuffer.makeStringAndClear());
625                 }
626             }
627         }
628     }
629 }
630 
631 
_ExportContent()632 void SwXMLExport::_ExportContent()
633 {
634 	// export forms
635 	Reference<XDrawPageSupplier> xDrawPageSupplier(GetModel(), UNO_QUERY);
636 	if (xDrawPageSupplier.is())
637 	{
638 		// export only if we actually have elements
639 		Reference<XDrawPage> xPage = xDrawPageSupplier->getDrawPage();
640 		if (xPage.is())
641 		{
642             // #103597# prevent export of form controls which are embedded in
643             // mute sections
644             Reference<XIndexAccess> xIAPage( xPage, UNO_QUERY );
645             GetTextParagraphExport()->PreventExportOfControlsInMuteSections(
646                 xIAPage, GetFormExport() );
647 
648             // #i36597# / 2004-12-13 / fs@openoffice.org
649             if ( GetFormExport()->pageContainsForms( xPage ) || GetFormExport()->documentContainsXForms() )
650 			{
651 				::xmloff::OOfficeFormsExport aOfficeForms(*this);
652 
653 				GetFormExport()->exportXForms();
654 
655 				GetFormExport()->seekPage(xPage);
656 				GetFormExport()->exportForms(xPage);
657 			}
658 		}
659 	}
660 
661 	Reference<XPropertySet> xPropSet(GetModel(), UNO_QUERY);
662 	if (xPropSet.is())
663 	{
664 		OUString sTwoDigitYear(RTL_CONSTASCII_USTRINGPARAM("TwoDigitYear"));
665 
666 		Any aAny = xPropSet->getPropertyValue( sTwoDigitYear );
667 		aAny <<= (sal_Int16)1930;
668 
669 		sal_Int16 nYear = 0;
670 		aAny >>= nYear;
671 		if (nYear != 1930 )
672 		{
673 			rtl::OUStringBuffer sBuffer;
674 			GetMM100UnitConverter().convertNumber(sBuffer, nYear);
675 			AddAttribute(XML_NAMESPACE_TABLE, XML_NULL_YEAR, sBuffer.makeStringAndClear());
676 			SvXMLElementExport aCalcSettings(*this, XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, sal_True, sal_True);
677 		}
678 	}
679 
680 	GetTextParagraphExport()->exportTrackedChanges( sal_False );
681 	GetTextParagraphExport()->exportTextDeclarations();
682 	Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
683 	Reference < XText > xText = xTextDoc->getText();
684 
685 	GetTextParagraphExport()->exportFramesBoundToPage( bShowProgress );
686 	GetTextParagraphExport()->exportText( xText, bShowProgress );
687 }
688 
689 
690 
691 //
692 // uno component registration
693 // helper functions for export service(s)
694 //
695 
696 // OOo
SwXMLExportOOO_getImplementationName()697 OUString SAL_CALL SwXMLExportOOO_getImplementationName() throw()
698 {
699 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
700 		"com.sun.star.comp.Writer.XMLExporter" ) );
701 }
702 
SwXMLExportOOO_getSupportedServiceNames()703 Sequence< OUString > SAL_CALL SwXMLExportOOO_getSupportedServiceNames()
704 	throw()
705 {
706 	const OUString aServiceName(SwXMLExportOOO_getImplementationName());
707 	const Sequence< OUString > aSeq( &aServiceName, 1 );
708 	return aSeq;
709 }
710 
SwXMLExportOOO_createInstance(const Reference<XMultiServiceFactory> & rSMgr)711 Reference< XInterface > SAL_CALL SwXMLExportOOO_createInstance(
712 		const Reference< XMultiServiceFactory > & rSMgr)
713 	throw( Exception )
714 {
715 	return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL);
716 }
717 
SwXMLExportStylesOOO_getImplementationName()718 OUString SAL_CALL SwXMLExportStylesOOO_getImplementationName() throw()
719 {
720 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
721 		"com.sun.star.comp.Writer.XMLStylesExporter" ) );
722 }
723 
SwXMLExportStylesOOO_getSupportedServiceNames()724 Sequence< OUString > SAL_CALL SwXMLExportStylesOOO_getSupportedServiceNames()
725 	throw()
726 {
727 	const OUString aServiceName(SwXMLExportStylesOOO_getImplementationName());
728 	const Sequence< OUString > aSeq( &aServiceName, 1 );
729 	return aSeq;
730 }
731 
SwXMLExportStylesOOO_createInstance(const Reference<XMultiServiceFactory> & rSMgr)732 Reference< XInterface > SAL_CALL SwXMLExportStylesOOO_createInstance(
733 		const Reference< XMultiServiceFactory > & rSMgr)
734 	throw( Exception )
735 {
736 	return (cppu::OWeakObject*)new SwXMLExport( rSMgr,
737 		EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES |
738 		EXPORT_FONTDECLS );
739 }
740 
SwXMLExportContentOOO_getImplementationName()741 OUString SAL_CALL SwXMLExportContentOOO_getImplementationName() throw()
742 {
743 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
744 		"com.sun.star.comp.Writer.XMLContentExporter" ) );
745 }
746 
SwXMLExportContentOOO_getSupportedServiceNames()747 Sequence< OUString > SAL_CALL SwXMLExportContentOOO_getSupportedServiceNames()
748 	throw()
749 {
750 	const OUString aServiceName(SwXMLExportContentOOO_getImplementationName());
751 	const Sequence< OUString > aSeq( &aServiceName, 1 );
752 	return aSeq;
753 }
754 
SwXMLExportContentOOO_createInstance(const Reference<XMultiServiceFactory> & rSMgr)755 Reference< XInterface > SAL_CALL SwXMLExportContentOOO_createInstance(
756 		const Reference< XMultiServiceFactory > & rSMgr)
757 	throw( Exception )
758 {
759 	return (cppu::OWeakObject*)new SwXMLExport(rSMgr,
760 		EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS |
761 		EXPORT_FONTDECLS );
762 }
763 
SwXMLExportMetaOOO_getImplementationName()764 OUString SAL_CALL SwXMLExportMetaOOO_getImplementationName() throw()
765 {
766 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
767 		"com.sun.star.comp.Writer.XMLMetaExporter" ) );
768 }
769 
SwXMLExportMetaOOO_getSupportedServiceNames()770 Sequence< OUString > SAL_CALL SwXMLExportMetaOOO_getSupportedServiceNames()
771 	throw()
772 {
773 	const OUString aServiceName(SwXMLExportMetaOOO_getImplementationName());
774 	const Sequence< OUString > aSeq( &aServiceName, 1 );
775 	return aSeq;
776 }
777 
SwXMLExportMetaOOO_createInstance(const Reference<XMultiServiceFactory> & rSMgr)778 Reference< XInterface > SAL_CALL SwXMLExportMetaOOO_createInstance(
779 		const Reference< XMultiServiceFactory > & rSMgr)
780 	throw( Exception )
781 {
782 	return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_META);
783 }
784 
SwXMLExportSettingsOOO_getImplementationName()785 OUString SAL_CALL SwXMLExportSettingsOOO_getImplementationName() throw()
786 {
787 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
788 		"com.sun.star.comp.Writer.XMLSettingsExporter" ) );
789 }
790 
SwXMLExportSettingsOOO_getSupportedServiceNames()791 Sequence< OUString > SAL_CALL SwXMLExportSettingsOOO_getSupportedServiceNames()
792 	throw()
793 {
794 	const OUString aServiceName(SwXMLExportSettingsOOO_getImplementationName());
795 	const Sequence< OUString > aSeq( &aServiceName, 1 );
796 	return aSeq;
797 }
798 
SwXMLExportSettingsOOO_createInstance(const Reference<XMultiServiceFactory> & rSMgr)799 Reference< XInterface > SAL_CALL SwXMLExportSettingsOOO_createInstance(
800 		const Reference< XMultiServiceFactory > & rSMgr)
801 	throw( Exception )
802 {
803 	return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_SETTINGS);
804 }
805 
806 // OASIS
SwXMLExport_getImplementationName()807 OUString SAL_CALL SwXMLExport_getImplementationName() throw()
808 {
809 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
810 		"com.sun.star.comp.Writer.XMLOasisExporter" ) );
811 }
812 
SwXMLExport_getSupportedServiceNames()813 Sequence< OUString > SAL_CALL SwXMLExport_getSupportedServiceNames()
814 	throw()
815 {
816 	const OUString aServiceName(SwXMLExport_getImplementationName());
817 	const Sequence< OUString > aSeq( &aServiceName, 1 );
818 	return aSeq;
819 }
820 
SwXMLExport_createInstance(const Reference<XMultiServiceFactory> & rSMgr)821 Reference< XInterface > SAL_CALL SwXMLExport_createInstance(
822 		const Reference< XMultiServiceFactory > & rSMgr)
823 	throw( Exception )
824 {
825 	return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL|EXPORT_OASIS);
826 }
827 
SwXMLExportStyles_getImplementationName()828 OUString SAL_CALL SwXMLExportStyles_getImplementationName() throw()
829 {
830 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
831 		"com.sun.star.comp.Writer.XMLOasisStylesExporter" ) );
832 }
833 
SwXMLExportStyles_getSupportedServiceNames()834 Sequence< OUString > SAL_CALL SwXMLExportStyles_getSupportedServiceNames()
835 	throw()
836 {
837 	const OUString aServiceName(SwXMLExportStyles_getImplementationName());
838 	const Sequence< OUString > aSeq( &aServiceName, 1 );
839 	return aSeq;
840 }
841 
SwXMLExportStyles_createInstance(const Reference<XMultiServiceFactory> & rSMgr)842 Reference< XInterface > SAL_CALL SwXMLExportStyles_createInstance(
843 		const Reference< XMultiServiceFactory > & rSMgr)
844 	throw( Exception )
845 {
846 	// #110680#
847 	//return (cppu::OWeakObject*)new SwXMLExport(
848 	//	EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES |
849 	//	EXPORT_FONTDECLS );
850 	return (cppu::OWeakObject*)new SwXMLExport( rSMgr,
851 		EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES |
852 		EXPORT_FONTDECLS|EXPORT_OASIS );
853 }
854 
SwXMLExportContent_getImplementationName()855 OUString SAL_CALL SwXMLExportContent_getImplementationName() throw()
856 {
857 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
858 		"com.sun.star.comp.Writer.XMLOasisContentExporter" ) );
859 }
860 
SwXMLExportContent_getSupportedServiceNames()861 Sequence< OUString > SAL_CALL SwXMLExportContent_getSupportedServiceNames()
862 	throw()
863 {
864 	const OUString aServiceName(SwXMLExportContent_getImplementationName());
865 	const Sequence< OUString > aSeq( &aServiceName, 1 );
866 	return aSeq;
867 }
868 
SwXMLExportContent_createInstance(const Reference<XMultiServiceFactory> & rSMgr)869 Reference< XInterface > SAL_CALL SwXMLExportContent_createInstance(
870 		const Reference< XMultiServiceFactory > & rSMgr)
871 	throw( Exception )
872 {
873 	// #110680#
874 	//return (cppu::OWeakObject*)new SwXMLExport(
875 	//	EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS |
876 	//	EXPORT_FONTDECLS );
877 	return (cppu::OWeakObject*)new SwXMLExport(
878 		rSMgr,
879 		EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS |
880 		EXPORT_FONTDECLS|EXPORT_OASIS );
881 }
882 
SwXMLExportMeta_getImplementationName()883 OUString SAL_CALL SwXMLExportMeta_getImplementationName() throw()
884 {
885 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
886 		"com.sun.star.comp.Writer.XMLOasisMetaExporter" ) );
887 }
888 
SwXMLExportMeta_getSupportedServiceNames()889 Sequence< OUString > SAL_CALL SwXMLExportMeta_getSupportedServiceNames()
890 	throw()
891 {
892 	const OUString aServiceName(SwXMLExportMeta_getImplementationName());
893 	const Sequence< OUString > aSeq( &aServiceName, 1 );
894 	return aSeq;
895 }
896 
SwXMLExportMeta_createInstance(const Reference<XMultiServiceFactory> & rSMgr)897 Reference< XInterface > SAL_CALL SwXMLExportMeta_createInstance(
898 		const Reference< XMultiServiceFactory > & rSMgr)
899 	throw( Exception )
900 {
901 	return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_META|EXPORT_OASIS);
902 }
903 
SwXMLExportSettings_getImplementationName()904 OUString SAL_CALL SwXMLExportSettings_getImplementationName() throw()
905 {
906 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
907 		"com.sun.star.comp.Writer.XMLOasisSettingsExporter" ) );
908 }
909 
SwXMLExportSettings_getSupportedServiceNames()910 Sequence< OUString > SAL_CALL SwXMLExportSettings_getSupportedServiceNames()
911 	throw()
912 {
913 	const OUString aServiceName(SwXMLExportSettings_getImplementationName());
914 	const Sequence< OUString > aSeq( &aServiceName, 1 );
915 	return aSeq;
916 }
917 
SwXMLExportSettings_createInstance(const Reference<XMultiServiceFactory> & rSMgr)918 Reference< XInterface > SAL_CALL SwXMLExportSettings_createInstance(
919 		const Reference< XMultiServiceFactory > & rSMgr)
920 	throw( Exception )
921 {
922 	return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_SETTINGS|EXPORT_OASIS);
923 }
924 
getUnoTunnelId()925 const Sequence< sal_Int8 > & SwXMLExport::getUnoTunnelId() throw()
926 {
927     static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
928 	return aSeq;
929 }
930 
getSomething(const Sequence<sal_Int8> & rId)931 sal_Int64 SAL_CALL SwXMLExport::getSomething( const Sequence< sal_Int8 >& rId )
932 	throw(RuntimeException)
933 {
934     if( rId.getLength() == 16
935         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
936 										rId.getConstArray(), 16 ) )
937     {
938 		return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
939     }
940 	return SvXMLExport::getSomething( rId );
941 }
942 
943 
944 // XServiceInfo
945 // override empty method from parent class
getImplementationName()946 OUString SAL_CALL SwXMLExport::getImplementationName()
947     throw(RuntimeException)
948 {
949     switch( getExportFlags() )
950     {
951         case EXPORT_ALL:
952             return SwXMLExport_getImplementationName();
953         case (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS):
954             return SwXMLExportStyles_getImplementationName();
955         case (EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS):
956             return SwXMLExportContent_getImplementationName();
957         case EXPORT_META:
958             return SwXMLExportMeta_getImplementationName();
959         case EXPORT_SETTINGS:
960             return SwXMLExportSettings_getImplementationName();
961         default:
962             // generic name for 'unknown' cases
963             return OUString( RTL_CONSTASCII_USTRINGPARAM(
964                 "com.sun.star.comp.Writer.SwXMLExport" ) );
965     }
966 }
967 
968 
969 #ifdef XML_CORE_API
ExportCurPaM(sal_Bool bExportWholePaM)970 void SwXMLExport::ExportCurPaM( sal_Bool bExportWholePaM )
971 {
972 	sal_Bool bFirstNode = sal_True;
973 	sal_Bool bExportWholeNode = bExportWholePaM;
974 
975 	SwXMLNumRuleInfo aPrevNumInfo;
976 	SwXMLNumRuleInfo aNextNumInfo;
977 
978 	while( pCurPaM->GetPoint()->nNode.GetIndex() <
979 								pCurPaM->GetMark()->nNode.GetIndex() ||
980 		   ( pCurPaM->GetPoint()->nNode.GetIndex() ==
981 								pCurPaM->GetMark()->nNode.GetIndex() &&
982 			 pCurPaM->GetPoint()->nContent.GetIndex() <=
983 								pCurPaM->GetMark()->nContent.GetIndex() ) )
984 	{
985 		SwNode *pNd = pCurPaM->GetNode();
986 
987 		aNextNumInfo.Set( *pNd );
988 		ExportListChange( aPrevNumInfo, aNextNumInfo );
989 
990 		ASSERT( !(pNd->IsGrfNode() || pNd->IsOLENode()),
991 				"SwXMLExport::exportCurPaM: grf or OLE node unexpected" );
992 		if( pNd->IsTxtNode() )
993 		{
994 			SwTxtNode* pTxtNd = pNd->GetTxtNode();
995 
996 			if( !bFirstNode )
997 				pCurPaM->GetPoint()->nContent.Assign( pTxtNd, 0 );
998 
999 			ExportTxtNode( *pTxtNd, 0, STRING_LEN, bExportWholeNode );
1000 		}
1001 		else if( pNd->IsTableNode() )
1002 		{
1003 			ExportTable( *pNd->GetTableNode() );
1004 		}
1005 		else if( pNd->IsSectionNode() )
1006 		{
1007 			ExportSection( *pNd->GetSectionNode() );
1008 		}
1009 		else if( pNd == &pDoc->GetNodes().GetEndOfContent() )
1010 			break;
1011 
1012 		pCurPaM->GetPoint()->nNode++; 	// next node
1013 
1014 		sal_uInt32 nPos = pCurPaM->GetPoint()->nNode.GetIndex();
1015 
1016 		// if not everything should be exported, the WriteAll flag must be
1017 		// set for all but the first and last node anyway.
1018 		bExportWholeNode = bExportWholePaM ||
1019 						   nPos != pCurPaM->GetMark()->nNode.GetIndex();
1020 		bFirstNode = sal_False;
1021 
1022 		aPrevNumInfo = aNextNumInfo;
1023 	}
1024 	aNextNumInfo.Reset();
1025 	ExportListChange( aPrevNumInfo, aNextNumInfo );
1026 }
1027 #endif
1028