--- a/sw/source/filter/xml/wrtxml.cxx +++ a/sw/source/filter/xml/wrtxml.cxx @@ -84,9 +84,8 @@ } -sal_uInt32 SwXMLWriter::_Write( SfxMedium* pTargetMedium ) +sal_uInt32 SwXMLWriter::_Write( const uno::Reference < task::XStatusIndicator >& xStatusIndicator, const rtl::OUString& aDocHierarchicalName ) { - DBG_ASSERT( pTargetMedium, "No medium is provided!" ); // Get service factory uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); @@ -187,50 +186,11 @@ xInfoSet->setPropertyValue( sTargetStorage, Any( xStg ) ); // create XStatusIndicator - uno::Reference xStatusIndicator; +// uno::Reference xStatusIndicator; uno::Any aAny; if (bShowProgress) { - // retrieve status indicator from the medium MediaDescriptor - if ( pTargetMedium ) - { - const SfxUnoAnyItem* pStatusBarItem = static_cast( - pTargetMedium->GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); - - if ( pStatusBarItem ) - pStatusBarItem->GetValue() >>= xStatusIndicator; - } - -// try -// { -// uno::Reference xModel( pDoc->GetDocShell()->GetModel()); -// if (xModel.is()) -// { -// uno::Sequence< beans::PropertyValue > xMediaDescr -// uno::Reference xController( -// xModel->getCurrentController()); -// if( xController.is()) -// { -// uno::Reference xFrame( xController->getFrame()); -// if( xFrame.is()) -// { -// uno::Reference xFactory( -// xFrame, uno::UNO_QUERY ); -// if( xFactory.is()) -// { -// xStatusIndicator = -// xFactory->createStatusIndicator(); -// } -// } -// } -// } -// } -// catch( const RuntimeException& ) -// { -// xStatusIndicator = 0; -// } - // set progress range and start status indicator sal_Int32 nProgressRange(1000000); if (xStatusIndicator.is()) @@ -246,6 +206,7 @@ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM("ProgressMax")); xInfoSet->setPropertyValue(sProgressMax, aAny); } + SvtSaveOptions aSaveOpt; OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")); sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() ); @@ -270,21 +231,13 @@ if( pDoc->GetDocPersist()->IsEmbedded() ) { OUString aName; - if ( pTargetMedium && pTargetMedium->GetItemSet() ) - { - const SfxStringItem* pDocHierarchItem = static_cast( - pTargetMedium->GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) ); - if ( pDocHierarchItem ) - aName = pDocHierarchItem->GetValue(); - } + if ( aDocHierarchicalName.getLength() ) + aName = aDocHierarchicalName; else aName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "dummyObjectName" ) ); - if( aName.getLength() ) - { - sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")); - xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); - } + sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")); + xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); } if( bBlock ) @@ -540,12 +493,23 @@ sal_uLong SwXMLWriter::WriteStorage() { - return _Write(); + return _Write( uno::Reference < task::XStatusIndicator >(), ::rtl::OUString() ); } sal_uLong SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) { - return _Write( &aTargetMedium ); + uno::Reference < task::XStatusIndicator > xStatusIndicator; + rtl::OUString aName; + const SfxUnoAnyItem* pStatusBarItem = static_cast( + aTargetMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); + if ( pStatusBarItem ) + pStatusBarItem->GetValue() >>= xStatusIndicator; + const SfxStringItem* pDocHierarchItem = static_cast( + aTargetMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) ); + if ( pDocHierarchItem ) + aName = pDocHierarchItem->GetValue(); + + return _Write( xStatusIndicator, aName ); } sal_uLong SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, --- a/sw/source/filter/xml/wrtxml.hxx +++ a/sw/source/filter/xml/wrtxml.hxx @@ -47,7 +47,7 @@ class SwXMLWriter : public StgWriter { - sal_uInt32 _Write( SfxMedium* pTargetMedium = NULL ); + sal_uInt32 _Write( const com::sun::star::uno::Reference < com::sun::star::task::XStatusIndicator>&, const rtl::OUString& ); using StgWriter::Write;