The bad format is obviously caused by your mail program.

I doubt that anyone will read the bad formatted mail, at least I can't
stand it. Sorry, it's too time consuming to read it.

Please try to repost your mail with a better mail program.

My recommendation would be Thunderbird
(http://www.mozilla.com/en-US/thunderbird/).

Best regards,
Mathias

[EMAIL PROTECTED] schrieb:

> Oh sorry!I don't know why the letter become so ugly.
>  
> Hello! 
>   I'm chensuchun.I'm a newbie in devloping filter.I implement a filter 
> for exporting and importing my own format file,whose format is based on 
> odt.But I get some problems about filter.
> the code of &nbsp;function filter( const Sequence< PropertyValue >& 
> rDescriptor ) is following:
> xDoc = uno::Reference< document::XStorageBasedDocument >( mxSrcDoc, 
> uno::UNO_QUERY );&nbsp; ///mxSrcDoc is set by setSourceDocument()
> ////save&nbsp;to a tmp storage use filter writer8
> &nbsp;&nbsp;xSourceStorage = uno::Reference< embed::XStorage >( 
> xStorageFactory->createInstance(),
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  uno::UNO_QUERY );
> &nbsp;&nbsp;uno::Sequence< beans::PropertyValue > afArgs( 1 );
> &nbsp;&nbsp;afArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" );
> &nbsp;&nbsp;afArgs[0].Value <<= ::rtl::OUString::createFromAscii( "writer8" );
> &nbsp;&nbsp;xDoc->storeToStorage( xSourceStorage, afArgs );
> ////add a sub storage to the&nbsp;&nbsp;xSourceStorage 
> const ::rtl::OUString aSubStorageName ( RTL_CONSTASCII_USTRINGPARAM ( 
> "SubStorage" ) );
> &nbsp;&nbsp;&nbsp;uno::Reference< embed::XStorage > xSubStorage = 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xSourceStorage->openStorageElement(
>  aSubStorageName, embed::ElementModes::WRITE );
> uno::Reference< beans::XPropertySet > xSubStoagePro( xSubStorage, 
> uno::UNO_QUERY );
> &nbsp;&nbsp;&nbsp;xSubStoagePro->setPropertyValue( 
> OUString::createFromAscii("MediaType"), 
> makeAny(OUString::createFromAscii("SubMediaType")) );
> ......
> ///create the target storage
> uno::Sequence< uno::Any > aArgs( 2 );
> &nbsp;aArgs[0] <<= aURL; ////get from rDescriptor&nbsp;
> &nbsp;aArgs[1] <<= embed::ElementModes::READWRITE;
> &nbsp;uno::Reference< embed::XStorage > xTargetStorage( 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xStorageFactory->createInstanceWithArguments(
>  aArgs ),
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  uno::UNO_QUERY );
> 
> ////copy to target storage and commit
> xSourceStorage->copyToStorage( xTargetStorage );
> &nbsp;&nbsp;&nbsp;bRet = sal_True;
> &nbsp;&nbsp;&nbsp;uno::Reference< XTransactedObject > xTransaction = 
> &nbsp;&nbsp;&nbsp;&nbsp;uno::Reference< XTransactedObject >( xTargetStorage, 
> UNO_QUERY );
> &nbsp;&nbsp;&nbsp;if( xTransaction.is() )
> &nbsp;&nbsp;&nbsp;&nbsp;xTransaction->commit();
> /////dispose them
> uno::Reference< lang::XComponent > xComponent1( xSourceStorage, 
> uno::UNO_QUERY );
> &nbsp;&nbsp;&nbsp;OSL_ENSURE( !xSourceStorage.is() || xComponent1.is(), 
> "Wrong storage implementation!" );
> &nbsp;&nbsp;&nbsp;if ( xComponent1.is() )
> &nbsp;&nbsp;&nbsp;&nbsp;xComponent1->dispose();
> &nbsp;&nbsp;&nbsp;uno::Reference< lang::XComponent > xComponent2( 
> xTargetStorage, uno::UNO_QUERY );
> &nbsp;&nbsp;&nbsp;OSL_ENSURE( !xTargetStorage.is() || xComponent2.is(), 
> "Wrong storage implementation!" );
> &nbsp;&nbsp;&nbsp;if ( xComponent2.is() )
> &nbsp;&nbsp;&nbsp;&nbsp;xComponent2->dispose();
> ////End
> After the execution of filter( const Sequence< PropertyValue >& rDescriptor ),
> the target file is created and the size of the file is about 7K.
> But after&nbsp; executing the following code in sal_Bool 
> SfxObjectShell::SaveTo_Impl:
> 
> &nbsp;&nbsp;// transfer data to its destinated location
> &nbsp;&nbsp;// the medium commits the storage or the stream it is based on
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegisterTransfer( rMedium );
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bOk = rMedium.Commit();
> the target file becomes 0K.
> Why?&nbsp;
> Is some thing wrong in my filter( const Sequence< PropertyValue >& 
> rDescriptor ) function?
> what should I do with the XStorage ?&nbsp;
> Any help and sugestion in identifying the missing pieces is appreciated.
> Thanks &nbsp;&nbsp;
> 
> -------------------------------------------------------------------
> 特价限量商品限时抢购,8元起!( 
> http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2007/mail_zhuiyu_20070620.html 
> )
> 
> ===================================================================
> 注册新浪2G免费邮箱( http://mail.sina.com.cn/chooseMode.html )


-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to