Hi Mikhail,

Thanks for your reply and I hope you had a good vocation. :-)

I implemented XTempFile_createInstance and createServiceFactory_Static
following your suggestion but encountered an error. Could you have a
look at it and give me some advice? I keep running into type conversion
problems these days. :-[

PS: Thank you Michel, I will check the hidden class dependency thing out
in my spare time. :-)

Best Regards,
Felix.

Mikhail Voitenko 写道:
> Hi Felix,
>
> The creation of the context seems to cause the problem. I suppose, that
> the assertion in this situation means that the storage could not be
> created, and a temporary storage object can not be created without this
> service.
>
> I would suggest to try the following to get rid of the assertion:
>
> 1) Please implement XTempFile_createInstance in following way:
>
> css::uno::Reference< css::uno::XInterface > SAL_CALL
> XTempFile_createInstance(
>     css::uno::Reference< css::uno::XComponentContext > const & context)
>     SAL_THROW((css::uno::Exception))
> {
>     return static_cast< cppu::OWeakObject * >(new
> OTempFileService(context));
> }
>
> 2) Please implement createServiceFactory_Static in the following way:
>
> ::css::uno::Reference < ::css::lang::XSingleServiceFactory >
> OTempFileService::createServiceFactory_Static( ::css::uno::Reference <
> ::css::lang::XMultiServiceFactory > const & rServiceFactory )
> {
>       return cppu::createSingleComponentFactory ( XTempFile_createInstance,
> getImplementationName_Static(), getSupportedServiceNames_Static());
> }
>
> So the creation of the object looks to be close to the creation in the
> "Full" class implementation in the tests for the OPropertySerMixin.
>
> The difference to the old-style creation is that now the
> createSingleComponentFactory helper method is used, and this method let
> the first provided function pointer be called with the correct context
> while creating an object. We can discuss the details on the next meeting.
>
> Best Regards,
> Mikhail.
>
>
>
> Zhang Xiaofei wrote:
>   
>> Hello Mr. Loiseleur,
>>
>> Thank you very much for your suggestions, it seems that the second
>> problem was caused by a parameter disorder, it is gone after I adjusted
>> the statements
>> -from-
>> OTempFileService::getTypes( )
>> {
>> ...
>> static ::cppu::OTypeCollection aTypeCollection(
>> OTempFileBase::getTypes(),
>> ::getCppuType( ( const ::css::uno::Reference< ::css::beans::XPropertySet
>>     
>>> *)NULL ) );
>>>       
>> ...
>> }
>> -to-
>> OTempFileService::getTypes( )
>> {
>> ...
>> static ::cppu::OTypeCollection aTypeCollection(
>> ::getCppuType( ( const ::css::uno::Reference< ::css::beans::XPropertySet
>>     
>>> *)NULL ),
>>>       
>> OTempFileBase::getTypes() );
>> ...
>> }
>>
>> The first one is a bit more complex, I looked up the definition of class
>> PropertySetMixin() and did the following changes:
>> 1. In XTempFile.hxx, changed the declaration of ctor OTempFileService();
>> to OTempFileService(::css::uno::Reference<::css::io::XTempFile> context);
>> 2. In XTempFile.hxx, added another ctor
>> OTempFileService(OTempFileService &);
>> 3. In XTempFile.cxx, changed the definition of OTempFileService() to:
>> OTempFileService::OTempFileService(::css::uno::Reference<
>> ::css::uno::XComponentContext > const & context)
>> : mpStream( NULL )
>> , mbRemoveFile( sal_True )
>> , mbInClosed( sal_False )
>> , mbOutClosed( sal_False )
>> , mnCachedPos( 0 )
>> , mbHasCachedPos( sal_False )
>> ,::cppu::PropertySetMixin< ::css::io::XTempFile >(
>> context
>> , static_cast< Implements >( IMPLEMENTS_PROPERTY_SET |
>> IMPLEMENTS_FAST_PROPERTY_SET | IMPLEMENTS_PROPERTY_ACCESS )
>> , NULL )
>> {
>> mpTempFile = new ::utl::TempFile;
>> mpTempFile->EnableKillingFile( sal_True );
>> }
>> 4. In XTempFile.cxx, changed the definition of
>> XTempFile_createInstance() to:
>> ::css::uno::Reference < ::css::uno::XInterface >SAL_CALL
>> XTempFile_createInstance(
>> const ::css::uno::Reference< ::css::lang::XMultiServiceFactory > &
>> /*xMgr*/ )
>> {
>> return ::css::uno::Reference< ::css::uno::XInterface >(
>> ::cppu::defaultBootstrap_InitialComponentContext() );
>> }
>>
>> After the steps the first error is gone and compiled the unotools module
>> successfully.
>>
>> Nevertheless there's a new problem now: when I opened a new writer
>> document in the hacked version, a "Assertion Failed!"messagebox shows
>> this(for three times if "Ignore" is selected):
>> "Error: File xxxxxxx\sfx2\source\doc\objstor.cxx, Line 3039: The
>> document storage must be created!
>> (Yes=Abort / No=Ignore / Cancel=Debugger)"
>>
>> I have not found out how to solve the problem yet. Could somebody give
>> me some help?
>>
>> Best Regards,
>> Felix.
>>
>> Michel Loiseleur 写道:
>>     
>>> Zhang Xiaofei a écrit :
>>>   
>>>       
>>>> Hi Mikhail,
>>>>
>>>> Thanks for your last reply. I fixed the problems in your advice, and
>>>> some more during the compilation process, but there are still two
>>>> errors(as in error.log in the attachment), both of which seems to me
>>>> are originated from data type mismatches. Could you please tell me the
>>>> causes of and solutions to the errors?
>>>>     
>>>>         
>>> You have mainly 2 constructors problems.
>>>
>>> The first one is an inheritance problem. The class
>>> ::cppu::PropertySetMixin<css::io::XTempFile> from which you herit do not
>>> have any constructor without args. You need to find the appropriate
>>> constructor and call it in the implementation of your own class ctor.
>>> Something like this :
>>> OTempFileService::OTempFileService() :
>>> property1(init_args),
>>> property2(),
>>> ::cppu::PropertySetMixin<::com::sun::star::io::XTempFile>(init_args)
>>> {}
>>>
>>> The second one is because you give him a set of css::Type instead of a
>>> simple css::Type. That's what the compiler says :
>>>
>>> "cannot convert parameter 1 from 'com::sun::star::uno::Sequence<E>' to
>>> 'const com::sun::star::uno::Type &' with[E=com::sun::star::uno::Type]"
>>>
>>> The first parameters of your ctor is OTempFileBase::getTypes() which
>>> obviously returns a _sequence_ of css::Type. And you need a simple
>>> css::Type in this ctor.
>>>
>>> Possible Solution : Look in the ::cppu::TypeCollection class on how to
>>> add all thoses Types. But it seems you cannot add them during creation.
>>>
>>>
>>> My 2 cents, hope this helps, I haven't touched any of uno class yet.
>>> It's just advice from a C++ dev.
>>>
>>> Regards,
>>>   
>>>       
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   
build -- version: 1.151

=============
Building project unotools
=============
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/i18n
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/config
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/accessibility
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/misc
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/processfactory
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/property
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/streaming
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
-------------
/cygdrive/e/ooo_OOE680_m6_src/unotools/source/ucbhelper
dmake.exe: Executing shell macro: +echo %_cwd
dmake.exe: Executing shell macro: +echo %_4ver
------------------------------
Making: ..\..\wntmsci10.pro\slo\xtempfile.obj
c:\PROGRA~1\MICROS~1.NET\Vc7\bin\cl.exe -Zm500 -Zc:forScope -GR -c -nologo -Gs  
-Gy -Ob1 -Oxs -Oy- -Gd  -I.  -I..\..\wntmsci10.pro\inc\ucbhelp -I..\inc 
-I..\..\inc\inc -I..\..\inc\pch -I..\..\inc -I..\..\WIN\inc 
-I..\..\wntmsci10.pro\inc -I. 
-Ie:\ooo_ooe680_m6_src\solver\680\wntmsci10.pro\inc\stl 
-Ie:\ooo_ooe680_m6_src\solver\680\wntmsci10.pro\inc\external 
-Ie:\ooo_ooe680_m6_src\solver\680\wntmsci10.pro\inc 
-Ie:\ooo_ooe680_m6_src\solenv\wntmsci10\inc -Ie:\ooo_ooe680_m6_src\solenv\inc 
-Ie:\ooo_ooe680_m6_src\res 
-Ie:\ooo_ooe680_m6_src\solver\680\wntmsci10.pro\inc\stl 
-Id:\OOEnv\J2SDK1~1.2_0\include\win32 -Id:\OOEnv\J2SDK1~1.2_0\include 
-Id:\OOEnv\PSDK\include -Ic:\progra~1\micros~1.net\vc7\include 
-Id:\OOEnv\DXSDK2~1\include     
-Ie:\ooo_ooe680_m6_src\solver\680\wntmsci10.pro\inc\offuh -I. -I..\..\res -I. 
-GX -Wall -wd4061 -wd4063 -wd4127 -wd4191 -wd4217 -wd4250 -wd4251     -wd4275 
-wd4290 -wd4292 -wd4294 -wd4344 -wd4347 -wd4355 -wd4503 -wd4511     -wd4512 
-wd4514 -wd4611 -wd4619 -wd4625 -wd4626 -wd4640 -wd4675 -wd4686     -wd4710 
-wd4711 -wd4786 -wd4800 -wd4820   -DWNT -DWNT -DNT351 -DMSC -DM1310 -DINTEL 
-D_X86_=1 -DFULL_DESK -DSTLPORT_VERSION=400 -DWINVER=0x400 -D_WIN32_IE=0x400 
-D_MT -DCPPU_ENV=msci -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL 
-DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DEXCEPTIONS_ON -DCUI -DSOLAR_JAVA 
-DOOE680=OOE680   -DUNOTOOLS_DLLIMPLEMENTATION -DSHAREDLIB -D_DLL_ -DWIN32 
-D_MT -D_DLL -DWIN32 -D_MT -D_DLL -DMULTITHREAD  
-Fo..\..\wntmsci10.pro\slo\xtempfile.obj 
e:\ooo_OOE680_m6_src\unotools\source\ucbhelper\xtempfile.cxx

c:\PROGRA~1\MICROS~1.NET\Vc7\bin\cl.exe 
@C:\DOCUME~1\ZXF~1.CH2\LOCALS~1\Temp\mk1804_3771_7
xtempfile.cxx
e:\ooo_OOE680_m6_src\unotools\source\ucbhelper\XTempFile.cxx(483) : error 
C2664: 'com::sun::star::uno::Reference<interface_type>::Reference(const 
com::sun::star::uno::Reference<interface_type> &) throw()' : cannot convert 
parameter 1 from 'com::sun::star::uno::Reference<interface_type>' to 'const 
com::sun::star::uno::Reference<interface_type> &'
        with
        [
            interface_type=com::sun::star::lang::XSingleServiceFactory
        ]
        and
        [
            interface_type=com::sun::star::lang::XSingleComponentFactory
        ]
        and
        [
            interface_type=com::sun::star::lang::XSingleServiceFactory
        ]
        Reason: cannot convert from 
'com::sun::star::uno::Reference<interface_type>' to 'const 
com::sun::star::uno::Reference<interface_type>'
        with
        [
            interface_type=com::sun::star::lang::XSingleComponentFactory
        ]
        and
        [
            interface_type=com::sun::star::lang::XSingleServiceFactory
        ]
        No constructor could take the source type, or constructor overload 
resolution was ambiguous
'---* tg_merge.mk *---'
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to