| View previous topic :: View next topic |
| Author |
Message |
ivan_zderadicka Newbie

Joined: 27 Sep 2004 Posts: 2
|
Posted: Mon Sep 27, 2004 12:41 am Post subject: Problem with applying text attributes to text shape |
|
|
Hi,
I have a problem with apllining multiple text attribute changes to the text shape (in Impress), which is being actually edited in the application.
Everything works fine when object is just "selected", but when text editing is going on all changes to text attributes done in macro are ignored ( more correctly except last change done in macro, which become visible when text shape is deselected and thus editing is ended).
It looks like the component is not listening to changes done in macro, while it is opened for editing.
My question now is - how to make it listen to the changes? Or other solution would b how programatically change mode of selected text shape from text editing to "normal" selection" and then back to editing (with cursor on the same place as it was before).
Thanks in advance for any ideas.
Kind regards
Ivan |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Mon Sep 27, 2004 5:55 am Post subject: |
|
|
Hi Ivan, I cannot imagine why the format you change via the API should not be staying after the textshape has lost the current focus.
Can you please give some code?
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
ivan_zderadicka Newbie

Joined: 27 Sep 2004 Posts: 2
|
Posted: Wed Sep 29, 2004 3:38 am Post subject: |
|
|
Here is the code:
Sub changeFont(delta)
doc= ThisComponent
cnt = doc.getCurrentController()
sel= cnt.getSelection()
if isNull(sel) or isEmpty(sel) then
MsgBox "No text shape sellected"
end
endif
pg = cnt.getCurrentPage()
shape = sel.getByIndex(0)
if not hasUnoInterfaces(shape, "com.sun.star.text.XText") then
MsgBox "selected object is not text shape"
end
endif
cur = shape.createTextCursor()
cur.gotoStart(false)
while cur.goRight(1, true)
size= cur.getPropertyValue("CharHeight")
cur.setPropertyValue("CharHeight",(size + delta))
cur.collapseToEnd()
wend
End Sub
But the same afect was when I was trying something more simple - like set CharWeight and CharHeight - only last chage appers if selecdtion is in "text editing" mode, if "normal" object selection is active then everything works fine. |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Wed Sep 29, 2004 7:26 am Post subject: Re: Problem with applying text attributes to text shape |
|
|
| ivan_zderadicka wrote: | | works fine when object is just "selected", but when text editing is going on all changes to text attributes done in macro are ignored ( more correctly except last change done in macro, which become visible when text shape is deselected and thus editing is ended). |
That is the behavior I get.
| ivan_zderadicka wrote: | | how programatically change mode of selected text shape from text editing to "normal" selection" and then back to editing (with cursor on the same place as it was before). |
I tried this, but no success.....
| Code: | Sub Main
changeFont( 20 )
End Sub
Sub changeFont(delta)
doc= ThisComponent
cnt = doc.getCurrentController()
sel= cnt.getSelection()
if isNull(sel) or isEmpty(sel) then
MsgBox "No text shape sellected"
end
endif
pg = cnt.getCurrentPage()
shape = sel.getByIndex(0)
if not hasUnoInterfaces(shape, "com.sun.star.text.XText") then
MsgBox "selected object is not text shape"
end
endif
'-----Danny's Changes ------
' Just create an empty shape collection of no shapes.
' Thus, nothing will be selected on the drawing.
oShapeCollection = createUnoService( "com.sun.star.drawing.ShapeCollection" )
cnt.select( oShapeCollection )
'exit sub
cnt.select( sel )
'-----Danny's Changes ------
cur = shape.createTextCursor()
cur.gotoStart(false)
while cur.goRight(1, true)
size= cur.getPropertyValue("CharHeight")
cur.setPropertyValue("CharHeight",(size + delta))
cur.collapseToEnd()
wend
End Sub
|
_________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
gpiroux General User

Joined: 05 Jan 2005 Posts: 36 Location: Belgium
|
Posted: Mon Apr 18, 2005 12:34 pm Post subject: |
|
|
Hello...
no new idea ? I have the same problem with OOo1.1.4
Is there the same problem with 2.0 ?
regards, geoffroy |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3622 Location: Columbus, Ohio, USA
|
Posted: Tue Apr 19, 2005 5:01 am Post subject: |
|
|
I can only guess as to the problem, but I suspect that it is because the user interface is holding a copy of the properties, which are applied back into the object when the user interface stops editing the object. If nothing else works, I recommend that you try using a dispatch to remove the focus (no, I do not know how to do that) and then try to make your changes. Anything that will cause the UI to refresh AND to remove the focus will probably suffice. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
|