the mysteriously inconsistent bAbsorb parameter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

the mysteriously inconsistent bAbsorb parameter

Michael Stahl-3

the XText interface is inconsistent in its definition of the bAbsorb
parameter of the methods insertString, insertControlCharacter and
insertTextContent.

the documentation for insertControlCharacter is silent on the matter.
insertString says:

http://api.openoffice.org/docs/common/ref/com/sun/star/text/XSimpleText.html#insertString

Parameter bAbsorb
    specifies whether the text spanned by xRange will be replaced. If true
then the content of xRange will be replaced by aString, otherwise aString
will be inserted at the beginning of xRange.


and insertTextContent:

http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html#insertTextContent

Parameter bAbsorb
    specifies whether the text spanned by xRange will be replaced. If true
then the content of xRange will be replaced by xContent, otherwise
xContent will be inserted at the end of xRange.


so for insertString, it is the beginning of xRange, but for
insertTextContent, it is the end of xRange.
apparently this inconsistency also confused the implementer of SwXText in
writer, because it consistently implements insertion at the start of the
range in all 3 methods:

http://svn.services.openoffice.org/opengrok/xref/DEV300_m54/sw/source/core/unocore/unotext.cxx#544

 544 xTempRange = xRange->getStart();


so, what to do?
fix the implementation in writer to be inconsistent to match the API
specification?
or fix the API specification to consistently refer to the start of xRange?

regards,
michael

--
"Measuring software productivity by lines of code is like measuring
 progress on an airplane by how much it weighs." -- Bill Gates


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: the mysteriously inconsistent bAbsorb parameter

Juergen Schmidt-3
Michael Stahl wrote:

> the XText interface is inconsistent in its definition of the bAbsorb
> parameter of the methods insertString, insertControlCharacter and
> insertTextContent.
>
> the documentation for insertControlCharacter is silent on the matter.
> insertString says:
>
> http://api.openoffice.org/docs/common/ref/com/sun/star/text/XSimpleText.html#insertString
>
> Parameter bAbsorb
>     specifies whether the text spanned by xRange will be replaced. If true
> then the content of xRange will be replaced by aString, otherwise aString
> will be inserted at the beginning of xRange.
>
>
> and insertTextContent:
>
> http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html#insertTextContent
>
> Parameter bAbsorb
>     specifies whether the text spanned by xRange will be replaced. If true
> then the content of xRange will be replaced by xContent, otherwise
> xContent will be inserted at the end of xRange.
>
>
> so for insertString, it is the beginning of xRange, but for
> insertTextContent, it is the end of xRange.
> apparently this inconsistency also confused the implementer of SwXText in
> writer, because it consistently implements insertion at the start of the
> range in all 3 methods:
>
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m54/sw/source/core/unocore/unotext.cxx#544
>
>  544 xTempRange = xRange->getStart();
>
>
> so, what to do?
> fix the implementation in writer to be inconsistent to match the API
> specification?
> or fix the API specification to consistently refer to the start of xRange?
>
i would prefer to change the API to bring it in a consistent state. It
sounds much more intuitive and cleaner to insert at the beginning in all
three methods.

But it's probably not so easy because this interface is used a lot, see
http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText-xref.html

You have to check some more places ... Maybe we should change it for OOo
4.0, i am not 100% sure.

Juergen


> regards,
> michael
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]