Re: Looking for TextPortion, TextField clarifications

2018-03-13 Thread Jens Tröger
Thank you, Michael!

> > >   * What about the TextPortion types “TextFieldStart”, “TextFieldEnd",
> > > "TextFieldStartEnd"? I’ve seen them in documents, but can’t find
> > > documentation on them.
> 
> this is the "field-marks" horror, which is an attempt to preserve
> Word-like fields in Writer.

I can see these fields wrapping a reference to a footnote, but without
useful ref information in UNO.  Using the Writer app, these fields are
grey (as other valid references are) but nothing shows when I hover my
mouse-pointer over it (valid references would show the target).

> > >   * Calling getString() on a “TextFieldStart” returns a ^G and for
> > > “TextFieldEnd” a ^H. Their IsCollapsed property is False. What’s
> > > with that?
> 
> this is a bug in the horrible field-marks code - this implementation
> detail should never be visible in the API.

Is this bug going to be fixed at some point?  Will the fix make
reference information to the target available?

Thanks!
Jens

-- 
Jens Tröger
http://savage.light-speed.de/
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Looking for TextPortion, TextField clarifications

2017-11-28 Thread Michael Stahl
On 18.11.2017 00:49, Jens Tröger wrote:
> Some clarification:
> 
>>   * It seems that reference strings have somewhat different spaces:
>> “_Ref498096146 “ and “ _Ref498096146” are the same reference
>> (space after, space before) I assume?
> 
> The spacing seems to be inserted by calling getPresentation(). Using the
> SourceName and CurrentPresentation properties works ok.

probably this function; it's apparently possible to get 2 strings with a
hard-coded space in the middle, in your case sSetRefName is empty:

OUString SwGetRefField::GetFieldName() const
{
const OUString aName = GetTyp()->GetName();
if ( !aName.isEmpty() || !sSetRefName.isEmpty() )
{
return aName + " " + sSetRefName;
}
return Expand();
}

>>   * In MS Word, a field’s “code” can be something like { PAGEREF
>> _Ref498098146\h} (or NOTEREF, or REF). How are these reference
>> kinds represented in the OO object model?
> 
> I think a TextField’s GetReference service
> ,
> if available, contains the appropriate reference field sources
> .

yes.

> Although I don’t quite understand the difference between “bookmark” and
> “reference mark”.

they are quite different internally; bookmarks are inserted via
Insert->Bookmark, they have a name and can span multiple paragraph
breaks; reference marks are inserted via Insert->Cross-reference->Set
Reference, and it's restricted to inside one paragraph.

>>   * What about the TextPortion types “TextFieldStart”, “TextFieldEnd",
>> "TextFieldStartEnd"? I’ve seen them in documents, but can’t find
>> documentation on them.

this is the "field-marks" horror, which is an attempt to preserve
Word-like fields in Writer.

>>   * Calling getString() on a “TextFieldStart” returns a ^G and for
>> “TextFieldEnd” a ^H. Their IsCollapsed property is False. What’s
>> with that?

this is a bug in the horrible field-marks code - this implementation
detail should never be visible in the API.

>>   * Given the list of text field services
>> 
>> ,
>> how can I find of which “type” a TextField
>> 
>> 
>>  object
>> is? Should I really iterate over all services and check if an object
>> implements one (or more) of the services?

use XServiceInfo::getSupportedServiceNames() - this should return
text.TextContent, plus 2 spellings of the specific field service name
(there was some problem with those names and the "old" name is still
returned here for compatibility).
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Looking for TextPortion, TextField clarifications

2017-11-17 Thread Jens Tröger
Some clarification:

> It seems that reference strings have somewhat different spaces: 
> “_Ref498096146 “ and “ _Ref498096146” are the same reference (space after, 
> space before) I assume?

The spacing seems to be inserted by calling getPresentation(). Using the 
SourceName and CurrentPresentation properties works ok.

> In MS Word, a field’s “code” can be something like { PAGEREF _Ref498098146\h} 
> (or NOTEREF, or REF). How are these reference kinds represented in the OO 
> object model?

I think a TextField’s GetReference service 
,
 if available, contains the appropriate reference field sources 
.
 Although I don’t quite understand the difference between “bookmark” and 
“reference mark”.

Still trying to find information on the other questions though…
Jens___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice