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/09/05 15:57:32 UTC

XComponentLoader loadComponentfromURL Readonly

Hello,

I'm passing a propertyvalue, "readOnly"-true to loadComponentFromURL(), but
the openoffice is still not opening in readonly from.
What are the possible sources of error?

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

Re: XComponentLoader loadComponentfromURL Readonly

Posted by Jürgen Schmidt <jo...@gmail.com>.
On 9/5/13 5:37 PM, Rajath Shashidhara wrote:
> Hello Alexandro,
> 
> Here is what happens:
> Document is opened through the "Open" Dialog -> User asked if he wants to
> checkout -> If Yes - > Document is checkedout and displayed in read-write
> mode -> Save from Save dialog -> User checksin -> User is asked if he wants
> to checksout.
> 
> When the user chooses not to checkout(initially), the document is opened in
> readonly mode(the cursor cannot be placed in the document).
> 
> When the user doesn't checkout after checking in, the document is reopened
> in the same frame as readonly. Here, the cursor can be placed in the
> document but changes cannot be saved. (in a sense it is read-only because
> it cannot be saved. But, it creates confusion to the user because the
> cursor can  be placed and edited but save button remains deactivated).

It should be possible to switch the frame in readonly mode, you can do
ti via the UI (left to the PDF button). I don't think you have to reload
the whole document. Just make sure that your internal meta data reflect
the new version etc. But that can be optimized later.

In general I believe the workflow via the normal file dialog is possible
but it seems to be too complicate. But this can be changed later as well.

When I think about a sidebar where we can much better provide checkin
and checkout this will be the way to go for the future.

For using the file dialog I can think about a context menu to checkout a
document. Default is without checkout and readonly. But an open document
can than via sidebar checked out.

Save is somewhat special and I can think of a workflow where I can save
the document locally but all changes will be lost if I don't checkin
finally. If the document frame close or the office close the user will
be asked. But of course this is more work and some further investigation
is necessary to figure out how to do it best.

This is not scope of your project keeping in mind that only 2 weeks are
left. But we have an UCP where we can work with and that we can extend
...

Juergen

> 
> As far as code snippet is concerned:
> it is hard to point give the code as snippet because it is a ucb property.
> 
> I'll give the link to my code:
> https://github.com/rajaths589/CMISContentProvider.git
> 
> Code snipped for loadComponentFromURL:
> 
> XMultiComponentFactory xMCF = m_xContext.getServiceManager();
>         Object desktop =
> xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext);
>         XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class,
> desktop);
>         XFrame current_frame = xDesktop.getCurrentFrame();
>         XComponentLoader xComponentLoader =
> (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,
> desktop);
>         try
>         {
>             PropertyValue pv[] = new PropertyValue[1];
>             pv[0] = new PropertyValue();
>             pv[0].Name = "ReadOnly";
>             pv[0].Value = new Any(Type.BOOLEAN,true);
>             pv[0].Handle = -1;
> 
> xComponentLoader.loadComponentFromURL(manager.getCompleteURL(),current_frame.getName(),
> FrameSearchFlag.ALL, pv);
>         }
>         catch(Exception e)
>         {
>             log.info("what the hell is this");
>         }
> 
> Hope this helps.
> 
> 
> 
> On Thu, Sep 5, 2013 at 8:01 PM, Alexandro Colorado <jz...@oooes.org> wrote:
> 
>> Can you provide code snippet to be able to provide more quality answer. Is
>> there any other property value being defined and is that definition passing
>> through without problem.
>>
>> F
>> rom some of my search through the DevGuide, it seems that before Read only
>> was defined through a OpenFlag but that was instead repleaced with the own
>> ReadOnly property for the MediaDescriptor service.
>>
>> http://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents
>>
>>
>>
>>
>> On Thu, Sep 5, 2013 at 8:57 AM, Rajath Shashidhara <
>> rajaths.rajaths@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm passing a propertyvalue, "readOnly"-true to loadComponentFromURL(),
>> but
>>> the openoffice is still not opening in readonly from.
>>> What are the possible sources of error?
>>>
>>> --
>>> Rajath S,
>>> M.Sc(Hons.) Physics, B.E.(Hons.) Computer Science
>>> Birla Institute of Technology and Science - Pilani,
>>> Pilani
>>>
>>
>>
>>
>> --
>> Alexandro Colorado
>> Apache OpenOffice Contributor
>> http://www.openoffice.org
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


Re: XComponentLoader loadComponentfromURL Readonly

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

Here is what happens:
Document is opened through the "Open" Dialog -> User asked if he wants to
checkout -> If Yes - > Document is checkedout and displayed in read-write
mode -> Save from Save dialog -> User checksin -> User is asked if he wants
to checksout.

When the user chooses not to checkout(initially), the document is opened in
readonly mode(the cursor cannot be placed in the document).

When the user doesn't checkout after checking in, the document is reopened
in the same frame as readonly. Here, the cursor can be placed in the
document but changes cannot be saved. (in a sense it is read-only because
it cannot be saved. But, it creates confusion to the user because the
cursor can  be placed and edited but save button remains deactivated).

As far as code snippet is concerned:
it is hard to point give the code as snippet because it is a ucb property.

I'll give the link to my code:
https://github.com/rajaths589/CMISContentProvider.git

Code snipped for loadComponentFromURL:

XMultiComponentFactory xMCF = m_xContext.getServiceManager();
        Object desktop =
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext);
        XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class,
desktop);
        XFrame current_frame = xDesktop.getCurrentFrame();
        XComponentLoader xComponentLoader =
(XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,
desktop);
        try
        {
            PropertyValue pv[] = new PropertyValue[1];
            pv[0] = new PropertyValue();
            pv[0].Name = "ReadOnly";
            pv[0].Value = new Any(Type.BOOLEAN,true);
            pv[0].Handle = -1;

xComponentLoader.loadComponentFromURL(manager.getCompleteURL(),current_frame.getName(),
FrameSearchFlag.ALL, pv);
        }
        catch(Exception e)
        {
            log.info("what the hell is this");
        }

Hope this helps.



On Thu, Sep 5, 2013 at 8:01 PM, Alexandro Colorado <jz...@oooes.org> wrote:

> Can you provide code snippet to be able to provide more quality answer. Is
> there any other property value being defined and is that definition passing
> through without problem.
>
> F
> rom some of my search through the DevGuide, it seems that before Read only
> was defined through a OpenFlag but that was instead repleaced with the own
> ReadOnly property for the MediaDescriptor service.
>
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents
> 
>
>
>
> On Thu, Sep 5, 2013 at 8:57 AM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> wrote:
>
> > Hello,
> >
> > I'm passing a propertyvalue, "readOnly"-true to loadComponentFromURL(),
> but
> > the openoffice is still not opening in readonly from.
> > What are the possible sources of error?
> >
> > --
> > Rajath S,
> > M.Sc(Hons.) Physics, B.E.(Hons.) Computer Science
> > Birla Institute of Technology and Science - Pilani,
> > Pilani
> >
>
>
>
> --
> Alexandro Colorado
> Apache OpenOffice Contributor
> http://www.openoffice.org
>



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

Re: XComponentLoader loadComponentfromURL Readonly

Posted by Alexandro Colorado <jz...@oooes.org>.
Can you provide code snippet to be able to provide more quality answer. Is
there any other property value being defined and is that definition passing
through without problem.

F
​rom some of my search through the DevGuide, it seems that before Read only
was defined through a OpenFlag but that was instead repleaced with the own
ReadOnly property for the MediaDescriptor service.
http://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents
​



On Thu, Sep 5, 2013 at 8:57 AM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello,
>
> I'm passing a propertyvalue, "readOnly"-true to loadComponentFromURL(), but
> the openoffice is still not opening in readonly from.
> What are the possible sources of error?
>
> --
> Rajath S,
> M.Sc(Hons.) Physics, B.E.(Hons.) Computer Science
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Alexandro Colorado
Apache OpenOffice Contributor
http://www.openoffice.org