incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mba...@apache.org
Subject svn commit: r1172353 - in /incubator/ooo/trunk/main/sw/source/filter/xml: wrtxml.cxx wrtxml.hxx
Date Sun, 18 Sep 2011 21:10:54 GMT
Author: mbauer
Date: Sun Sep 18 21:10:54 2011
New Revision: 1172353

URL: http://svn.apache.org/viewvc?rev=1172353&view=rev
Log:
cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium

Modified:
    incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.cxx
    incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.hxx

Modified: incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.cxx?rev=1172353&r1=1172352&r2=1172353&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.cxx Sun Sep 18 21:10:54 2011
@@ -85,9 +85,8 @@ __EXPORT SwXMLWriter::~SwXMLWriter()
 }
 
 
-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();
@@ -188,50 +187,11 @@ pGraphicHelper = SvXMLGraphicHelper::Cre
 	xInfoSet->setPropertyValue( sTargetStorage, Any( xStg ) );
 
 	// create XStatusIndicator
-	uno::Reference<task::XStatusIndicator> xStatusIndicator;
+//	uno::Reference<task::XStatusIndicator> xStatusIndicator;
 
 	uno::Any aAny;
 	if (bShowProgress)
 	{
-		// retrieve status indicator from the medium MediaDescriptor
-		if ( pTargetMedium )
-		{
-			const SfxUnoAnyItem* pStatusBarItem = static_cast<const SfxUnoAnyItem*>(
-               pTargetMedium->GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL)
);
-
-			if ( pStatusBarItem )
-				pStatusBarItem->GetValue() >>= xStatusIndicator;
-		}
-
-//		try
-//		{
-//			uno::Reference<frame::XModel> xModel( pDoc->GetDocShell()->GetModel());
-//			if (xModel.is())
-//			{
-//				uno::Sequence< beans::PropertyValue > xMediaDescr
-//				uno::Reference<frame::XController> xController(
-//					xModel->getCurrentController());
-//				if( xController.is())
-//				{
-//					uno::Reference<frame::XFrame> xFrame( xController->getFrame());
-//					if( xFrame.is())
-//					{
-//						uno::Reference<task::XStatusIndicatorFactory> 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())
@@ -247,6 +207,7 @@ pGraphicHelper = SvXMLGraphicHelper::Cre
 		OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM("ProgressMax"));
 		xInfoSet->setPropertyValue(sProgressMax, aAny);
 	}
+
 	SvtSaveOptions aSaveOpt;
 	OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
 	sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
@@ -271,21 +232,13 @@ pGraphicHelper = SvXMLGraphicHelper::Cre
 	if( SFX_CREATE_MODE_EMBEDDED == pDoc->GetDocShell()->GetCreateMode() )
 	{
 		OUString aName;
-		if ( pTargetMedium && pTargetMedium->GetItemSet() )
-		{
-			const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
-                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 )
@@ -541,12 +494,23 @@ pGraphicHelper = SvXMLGraphicHelper::Cre
 
 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<const SfxUnoAnyItem*>(
+       aTargetMedium.GetItemSet()->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
+	if ( pStatusBarItem )
+		pStatusBarItem->GetValue() >>= xStatusIndicator;
+	const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
+        aTargetMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
+	if ( pDocHierarchItem )
+		aName = pDocHierarchItem->GetValue();
+
+	return _Write( xStatusIndicator, aName );
 }
 
 sal_uLong SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed,

Modified: incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.hxx?rev=1172353&r1=1172352&r2=1172353&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/xml/wrtxml.hxx Sun Sep 18 21:10:54 2011
@@ -47,7 +47,7 @@ namespace com { namespace sun { namespac
 
 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;
 



Mime
View raw message