Hi Rick,

rick cameron escribió:
Hi

I am just starting to learn about the OOo APIs. I have managed to get a very simple Java program that uses Bootstrap.bootstrap and XComponentContext.getServiceManager working, and noticed that when I run it a couple of new processes start (soffice.exe and soffice.bin).

I haven't managed to get a C++ program working yet, so don't know what happens in that case.

the "same", that is for the C++ bridge there is also a simple bootstrap
mechanism (IIRC broken in the three layer OOo, so test it with OOo 2.4 [also IIRC it's already fixed, or they are working in fixing this]):

        Reference< XComponentContext > rContext;
        Reference< XMultiComponentFactory > rMCF;
        try
        {
                // get the remote office component context
                rContext = Reference< XComponentContext > ( ::cppu::bootstrap() 
);
                cout << "Connected to a running office ..." << endl;

                // get the remote office service manager
                rMCF = Reference< XMultiComponentFactory > (
rContext->getServiceManager() );
                cout << "The service manager is available!" << endl;

        }
        catch( ::cppu::BootstrapException & e )
        {
                cerr << "caught BootstrapException: "
                        << GET_STR( e.getMessage() )
                        << '\n';
                throw e;
        }
        catch( Exception e)
        {
                cerr << "caught UNO exception: "
                        << GET_STR( e.Message )
                        << '\n';
                throw e;
        }


Is it possible to use OOo objects in the calling process?

from the component context you get the service manager to instantiate objects:


        Reference< XComponentContext > rContext;
        Reference< XMultiComponentFactory > rMCF;

        //... bootstap

        try
        {
                Reference< XInterface > rDesktop = 
rMCF->createInstanceWithContext(
                        OUString( 
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ),
                        rContext);
                Reference< XComponentLoader > rComponentLoader ( rDesktop, 
UNO_QUERY );

Reference< XComponent > xSpreadsheetComponent = rComponentLoader->loadComponentFromURL(
                        OUString( RTL_CONSTASCII_USTRINGPARAM( 
"private:factory/scalc" ) ),
                        OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ),
                        sal_Int32( 0 ),
                        Sequence<PropertyValue>());

Reference< XSpreadsheetDocument > xSpreadsheetDocument ( xSpreadsheetComponent, UNO_QUERY );

Reference< XSpreadsheets > xSpreadsheets = xSpreadsheetDocument->getSheets(); xSpreadsheets->insertNewByName( OUString::createFromAscii( "MySheet" ), sal_Int16( 0 ) );

        //...
        }//...

In particular I want to create a spreadsheet object, cause it to load a .xls file, then explore the values & formulas in the spreadsheet. I won't need to display the spreadsheet.

before jumping there, read the first chapters of the Dev's Guide, at least

#  First Steps
#  Professional UNO
#  Advanced UNO
#  Office Development

and if you want to develop components/extensions

#  Writing UNO Components
#  Extensions

and only then jump to the document specific chapters

#  Text Documents
#  Spreadsheet Documents
#  Drawing Documents and Presentation Documents
...


It's a long road.

Regards
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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

Reply via email to