Issue 52776 - Problem with XTextViewCursor and Image
Summary: Problem with XTextViewCursor and Image
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All Windows Server 2003
: P3 Trivial
Target Milestone: ---
Assignee: stephan.wunderlich
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-02 09:21 UTC by muifull
Modified: 2013-02-24 21:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description muifull 2005-08-02 09:21:49 UTC
Hi all,

I play with OfficeBean and Writer (OOo 2.0), and experience a problem.

I would like to create an embedded-image in the document and then 
position the viewCursor to a specified range.

The embedded-image did create successfully, but unfortunately, I could 
not ask the viewCursor to do anything after that. Whatever operations 
(gotoStart(), gotoRange(), goRight…) generated the following exception:

com.sun.star.uno.RuntimeException: no text selection

It seems like the viewCursor is trapped by the image and is no longer 
available. Here is my code:

// Create the image through the dispatch interface (component is an object 
subclass-ed from OOoBean)
OfficeCommand officeCommand = new OfficeCommand((short)10241);
officeCommand.appendParameter("FileName", imagePath);
officeCommand.appendParameter("FilterName", "<All formats>");
officeCommand.appendParameter("AsLink", new Boolean(false));
officeCommand.appendParameter("Style", "Graphics");
officeCommand.execute(component, component.getXURLTransformer(), 
component.getXDispatchProvider());

// Ask the viewCursor to go to the Start of the page
XTextViewCursorSupplier xTextViewCursorSupplier = 
(XTextViewCursorSupplier)UnoRuntime.queryInterface
(XTextViewCursorSupplier.class, 
component.getDocument().getCurrentController());
XTextViewCursor cursor = xTextViewCursorSupplier.getViewCursor();
cursor.gotoStart(false);

As I remember, the same set of operations worked fine with OOo1.1.x.

Could anyone please help me? Thanks in advance.

Best regards
MuiFull
Comment 1 stephan.wunderlich 2005-08-02 15:47:55 UTC
The RuntimeException appears because the textframe where the embedded graphic
should be positioned in is selected and therefore no TextViewCursor which would
make movements possible exists. To use the ViewCursor again for moving around,
you'll have to change the current selection by using the SelectionSupplier and
for example select the anchor of the textframe.
Comment 2 stephan.wunderlich 2005-08-04 11:11:24 UTC
closing