You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Rajath Shashidhara <ra...@gmail.com> on 2013/06/03 21:10:25 UTC

Openoffice API - UCP

Hello,

After so much discussion, questions and effort, I have decided to approach
this in a more systematic manner.

Now, Before asking any more questions I'll read the documentation properly
starting from now.

My first question:
How to test my ucp?
How do I know if my ucp is called?
I added some dummy debug statements like System.out.println("***) in my
queryContent() method. I tried to access a file through open dialog with
address starting cmis://,
but nothing appeared on my terminal.
Also,
I built my office with --enable-category-b switch.
I'm not able to run the macro.
I dont know what is there in the Ariel's macro.

Sorry, for troubling with too many questions.
I want to get this properly.
Please help.
-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: Openoffice API - UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,

I wrote my own openoffice client application to test my ucp.
Code:
try {
            // get the remote office component context
            XComponentContext xContext = Bootstrap.bootstrap();
            if (xContext == null) {
                System.err.println("ERROR: Could not bootstrap default
Office.");
            }
            XMultiComponentFactory xmcf = xContext.getServiceManager();
            //XMultiServiceFactory xServiceFactory = (XMultiServiceFactory)
xContext.getServiceManager();
            XInterface xUCB;

            String keys[] = new String[2];
            keys[0] = "Local";
            keys[1] = "Office";

            xUCB = (XInterface)
xmcf.createInstanceWithArgumentsAndContext("com.sun.star.ucb.UniversalContentBroker",
keys,xContext);
            XContentIdentifierFactory xIDFactory =
(XContentIdentifierFactory)UnoRuntime.queryInterface(XContentIdentifierFactory.class,
xUCB);
            XContentProvider ucp =
(XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, xUCB);
            XContentIdentifier id =
xIDFactory.createContentIdentifier("cmis:///CMISUpload.odt");
            XContent cmisContent = ucp.queryContent(id);
            XCommandProcessor xcp =
(XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class,
cmisContent);
            System.out.println(cmisContent.getContentType());
            Command cmd = new Command();
            cmd.Name = "haha";
            cmd.Handle = 0;
            cmd.Argument = null;
            xcp.execute(cmd, 0, null);



cmd- "haha" was a test command.
I obtained the expected result.
Also getContentType() also produced the expected output.!


On Tue, Jun 4, 2013 at 1:39 AM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello,
>
> My print statements were not shown because .xcu configuration file was
> missing.
>
>
> On Tue, Jun 4, 2013 at 1:06 AM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> wrote:
>
>> Hello,
>> when macro security button is clicked this exception is raised:
>>
>> terminate called after throwing an instance of 'com::sun::star::loader::CannotActivateFactoryException'
>>
>>
>>
>>
>>
>> On Tue, Jun 4, 2013 at 12:40 AM, Rajath Shashidhara <
>> rajaths.rajaths@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> After so much discussion, questions and effort, I have decided to
>>> approach this in a more systematic manner.
>>>
>>> Now, Before asking any more questions I'll read the documentation
>>> properly starting from now.
>>>
>>> My first question:
>>> How to test my ucp?
>>> How do I know if my ucp is called?
>>> I added some dummy debug statements like System.out.println("***) in my
>>> queryContent() method. I tried to access a file through open dialog with
>>> address starting cmis://,
>>> but nothing appeared on my terminal.
>>> Also,
>>> I built my office with --enable-category-b switch.
>>> I'm not able to run the macro.
>>> I dont know what is there in the Ariel's macro.
>>>
>>> Sorry, for troubling with too many questions.
>>> I want to get this properly.
>>> Please help.
>>>  --
>>> Rajath S,
>>> M.Sc(Hons.) Physics,
>>> Birla Institute of Technology and Science - Pilani,
>>> Pilani
>>>
>>
>>
>>
>> --
>> Rajath S,
>> M.Sc(Hons.) Physics,
>> Birla Institute of Technology and Science - Pilani,
>> Pilani
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: Openoffice API - UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,

My print statements were not shown because .xcu configuration file was
missing.


On Tue, Jun 4, 2013 at 1:06 AM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello,
> when macro security button is clicked this exception is raised:
>
> terminate called after throwing an instance of 'com::sun::star::loader::CannotActivateFactoryException'
>
>
>
>
> On Tue, Jun 4, 2013 at 12:40 AM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> wrote:
>
>> Hello,
>>
>> After so much discussion, questions and effort, I have decided to
>> approach this in a more systematic manner.
>>
>> Now, Before asking any more questions I'll read the documentation
>> properly starting from now.
>>
>> My first question:
>> How to test my ucp?
>> How do I know if my ucp is called?
>> I added some dummy debug statements like System.out.println("***) in my
>> queryContent() method. I tried to access a file through open dialog with
>> address starting cmis://,
>> but nothing appeared on my terminal.
>> Also,
>> I built my office with --enable-category-b switch.
>> I'm not able to run the macro.
>> I dont know what is there in the Ariel's macro.
>>
>> Sorry, for troubling with too many questions.
>> I want to get this properly.
>> Please help.
>>  --
>> Rajath S,
>> M.Sc(Hons.) Physics,
>> Birla Institute of Technology and Science - Pilani,
>> Pilani
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: Openoffice API - UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,
when macro security button is clicked this exception is raised:

terminate called after throwing an instance of
'com::sun::star::loader::CannotActivateFactoryException'




On Tue, Jun 4, 2013 at 12:40 AM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello,
>
> After so much discussion, questions and effort, I have decided to approach
> this in a more systematic manner.
>
> Now, Before asking any more questions I'll read the documentation properly
> starting from now.
>
> My first question:
> How to test my ucp?
> How do I know if my ucp is called?
> I added some dummy debug statements like System.out.println("***) in my
> queryContent() method. I tried to access a file through open dialog with
> address starting cmis://,
> but nothing appeared on my terminal.
> Also,
> I built my office with --enable-category-b switch.
> I'm not able to run the macro.
> I dont know what is there in the Ariel's macro.
>
> Sorry, for troubling with too many questions.
> I want to get this properly.
> Please help.
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani