<div>hi Luke,</div><div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
I should have known better than to think it was that easy. :)</blockquote><div>I think it ought to be that easy... More documentation would speedup development and reduce bugs dramatically...</div><div>(Maybe we should write a few doxygen comments for EditEngine, if we figure out how it works).</div>
<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
I had a very bad solution that seemed to work but made the unit tests<br>not work.<br>I replaced SetText with:<br> SmGetActiveView()->GetEditWindow()->SelectAll();<br> SmGetActiveView()->GetEditWindow()->InsertText(formula);</blockquote>
</div><div>Why is this a bad solution ?</div><div>Any idea, why this doesn't work with the unit tests ?</div><div>It seems like it might be a fairly good solution... Unless undo/redo manages selections too... So that this becomes two steps ?</div>
<div><br></div><div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
I'm very sorry for bothering you with solutions that don't work.<br></blockquote><div>Don't be, it also happens to me... That's why the visual formula editor had bugs to begin with, and it's no unlikely that we'll find more :)</div>
<div>Besides if we don't propose patches, or partially working fixes... and discuss these we'll never get undo integration to work properly.</div></div><br clear="all">--<br>Regards Jonas Finnemann Jensen.<br>
<br><br><div class="gmail_quote">On Mon, Feb 14, 2011 at 01:13, Luke Dixon <span dir="ltr"><<a href="mailto:6b8b4567@gmail.com" target="_blank">6b8b4567@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Jonas,<br>
<div><br>
On Sun, 2011-02-13 at 21:44 +0100, Jonas Finnemann Jensen wrote:<br>
<br>
> It would be major step to get that issue fixed... And you're going the<br>
> right way, but your patch doesn't work if the formula is written in<br>
> multiple lines...<br>
> try, writing the formula 3+3+3 \n \n \n \n +4+4 (replace \n by line<br>
> break not NEWLINE but whitespace linebreak).<br>
> Then in visual editor delete +3, go into the command editor again and<br>
> back into the visual editor and notice that it now says 3+3+4+4+4+4.<br>
> The command editor will say { 3 + 3 + 4 + 4 } \n \n \n \n +4+4,<br>
> because the SetText(0, formula) only replaced the first paragraph...<br>
><br>
<br>
</div>Ah, I guess I got a bit too excited too quickly. I should have known<br>
better than to think it was that easy. :)<br>
<div><br>
><br>
> What I understand from editeng_8.cxx line 1621 (see [1]) is that the<br>
> number you pass in setText(0, formula), is the paragraph to be<br>
> replaced by the text...<br>
> The method signature is EditEngine::SetText( sal_uInt16 nPara, const<br>
> XubString& rTxt ), and it calls SelectParagraph(nPara)........<br>
> At least that's what I can decrypt from the sources... (I think I've<br>
> seen ROT13 variants that was easier to read).<br>
><br>
<br>
</div>Yeah, I saw nPara, and thought about it for a couple of seconds, figured<br>
that since SmNodeToTextVisitor puts it all on one line it would be okay.<br>
I thought that through badly :(<br>
<div><br>
><br>
> I have no idea how to solve this... Maybe we can<br>
> call EditEngine::UndoActionStart(USHORT nId) (see [2])<br>
> and EditEngine::UndoActionEnd(USHORT nId), before and after the called<br>
> to EditEngine::SetText(formula)...<br>
> But in that case I don't know if we can pass any value as nId, the<br>
> existing ones are defined in [3] (line 64).<br>
> The only place I can see EDITUNDO_INSERT used is to call<br>
> UndoActionStart/End and in one switch case where labels are<br>
> generated...<br>
><br>
<br>
</div>I had a very bad solution that seemed to work but made the unit tests<br>
not work.<br>
I replaced SetText with:<br>
SmGetActiveView()->GetEditWindow()->SelectAll();<br>
SmGetActiveView()->GetEditWindow()->InsertText(formula);<br>
<br>
but it would really need to be done properly.<br>
<div><br>
><br>
> We can probably enable the visual editor as an non-default editing<br>
> mode (i.e. activated from toolbar) once the formatting issue is<br>
> addressed... Then when we've integrated it properly, so that users of<br>
> the command editor doesn't feel any uncomfort, we can make it<br>
> default...<br>
> But as long as it discards formatting information (font, bold, color,<br>
> alignment, etc) we probably shouldn't enable it by default... Users<br>
> hate regressions, especially if it eats all their formatting<br>
> information without asking nicely first :)<br>
><br>
<br>
</div>Oh yeah, forgot about the formatting. Yes, I agree. I guess I just got a<br>
little excited.<br>
<br>
I'm very sorry for bothering you with solutions that don't work.<br>
Thanks for putting up with me. :)<br>
<br>
Regards,<br>
<font color="#888888">Luke<br>
<br>
<br>
</font></blockquote></div><br>