Bug 103278 - supportsService("com.sun.star.text.TextField.Input") in a .dot template not recognised
Summary: supportsService("com.sun.star.text.TextField.Input") in a .dot template not r...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
5.2.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:doc, needsDevAdvice
Depends on:
Blocks: DOC-Fields
  Show dependency treegraph
 
Reported: 2016-10-17 13:38 UTC by christer.bergstrom.se
Modified: 2022-09-06 16:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
An MS Word template (38.50 KB, application/msword)
2016-10-31 10:23 UTC, christer.bergstrom.se
Details
screen dump in OO writer (140.50 KB, application/msword)
2016-11-01 08:01 UTC, christer.bergstrom.se
Details

Note You need to log in before you can comment on or make changes to this bug.
Description christer.bergstrom.se 2016-10-17 13:38:59 UTC
Hi,

Windows 10, 64bit.

Have a template (.dot) made in MS Word. Have been using it for creating documents in both Word and openoffice for years without any problems. 

However, now when I want to switch to libreoffice instead of openoffice, this function fails.

Can't do oElement.getPropertyValue("Hint") either. It returns empty. Like I said, the exact same stuff works with openoffice (both .org and apache).

oFieldsEnum = oDocument.getTextFields().createEnumeration()
while oFieldsEnum.hasMoreElements()
  oElement = oFieldsEnum.nextElement()
...
...  
  // Fails in LO but works in OpenOffice. 
  oElement.supportsService("com.sun.star.text.TextField.Input")
  // Also fails (well, logical I guess since the above line fails too...)
  oElement.getPropertyValue("Hint")
...
...

Kind regards,
Christer B
Comment 1 Julien Nabet 2016-10-17 19:00:27 UTC
On which LO version are you?

FYI, last stable one is 5.2.2
Comment 2 christer.bergstrom.se 2016-10-18 06:41:39 UTC
Hi,
Downloaded yesterday, ie Oct 18th. Version is 5.2.1.2.
I also noticed that if you open up the Word template in Writer (GUI), and then bring up the context menu by right-clicking the bookmark(formfield), there's no 'Property' menu choice...  In openoffice, that menu choice is present.
/Christer
Comment 3 Julien Nabet 2016-10-18 07:06:45 UTC
Thank you for your feedback.
Since I don't have more question, I'll put it back to unconfirmed.
Comment 4 christer.bergstrom.se 2016-10-18 12:41:01 UTC
Some more info:
Although there are a number of fields in the template, the enumeration only finds one item, so that single item is probably not a textfield anyway - hence why supportsService fails. Seems the enum doesn't recognize any formfields at all...

Btw; same problem in C# :
XEnumeration xEnumTxtFields = xEnumTxtFieldsAccess.createEnumeration();
while (xEnumTxtFields.hasMoreElements()) {
  uno.Any xTextFld0 = xEnumTxtFields.nextElement();
  XTextField xTextFld = (XTextField)xTextFld0.Value;
  // Verify that field is an Input Field.
  if  ((((XServiceInfo)xTextFld).supportsService("com.sun.star.text.textfield.Input"))) {

It finds only one single item and it ain't no texfield...  

Again, this code has worked with openoffice for years. Actually, I think I even ran it successfully for a while in early LO - shortly after the separation from OOo.

/Christer
Comment 5 Buovjaga 2016-10-29 18:34:35 UTC
Could you share the .dot file publicly? If so, please attach it to the report.
Comment 6 christer.bergstrom.se 2016-10-31 10:23:04 UTC
Created attachment 128376 [details]
An MS Word template

Hi,
This template contains some bookmarks (formfields). Each bookmark has a property name("Hint") that I use for identifying the FF. When the template is opened in OpenOffice and the context menu is opened by right-clicking a bookmark, the 'Properties' menu choice is there. Not so in LO.
/Christer
Comment 7 Buovjaga 2016-10-31 17:00:59 UTC
(In reply to christer.bergstrom.se from comment #6)
> Created attachment 128376 [details]
> An MS Word template
> 
> Hi,
> This template contains some bookmarks (formfields). Each bookmark has a
> property name("Hint") that I use for identifying the FF. When the template
> is opened in OpenOffice and the context menu is opened by right-clicking a
> bookmark, the 'Properties' menu choice is there. Not so in LO.
> /Christer

I tried with LibreOffice 3.3, which is identical to the original OpenOffice and no "Properties" context menu item appears when clicking. Is this some recent addition by Apache OpenOffice?

What about your original problem? What should we do with the document to see this failing function you are talking about?

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 8 Buovjaga 2016-11-01 06:43:47 UTC
Áron from the QA team tried with Apache OpenOffice 4.1.3 and he did not see a "Properties" context menu entry either.

Christer: could you take a screenshot of the Properties menu entry in Apache OpenOffice while the context menu is open?

Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the screenshot.
Comment 9 christer.bergstrom.se 2016-11-01 08:01:54 UTC
Created attachment 128398 [details]
screen dump in OO writer
Comment 10 christer.bergstrom.se 2016-11-01 08:04:07 UTC
Howdy,

I re-installed openoffice last night and, I'm very sorry, but there's no Properties menu choice present - my mistake. VERY sorry about that. 
However, if you hover over a field with the mouse, the 'Hint' property is shown as a tooltip. And if you double-click the field, the edit field dialog is shown.
In that dialog, the field is shown as an Input field along with its Hint property.
This is not so in LO. Don't remember how it was in eg LO 3.3 though.

Nevertheless: The only reason I mentioned this about the menu choice was that I thought if LO didn't recognize the field inside the application (Writer), then that might have something to do with the real issue, ie that it doesn't work from C# or Basic. Please see my original report text.

Have attached another Word file for you showing the tooltip and edit dialog in OO Writer.

/Christer
Comment 11 Aron Budea 2016-11-01 09:37:52 UTC
I can confirm the described behavior is there in AOO 4.1.3. There's also a "Fields..." context menu upon right click, that might be the one you were thinking of.

None of these are in LO 3.3, though, so it could be a new feature in AOO that was developed after the split. I don't know if it was, or how it was supposed to be implemented in LibreOffice.
Comment 13 christer.bergstrom.se 2016-11-01 09:43:44 UTC
1.It's an old OOo feature.

2.About enumerating the fields, please see my original report text and comment #4.
Comment 14 christer.bergstrom.se 2016-11-01 15:11:57 UTC
Hi again Aron,
Yes, it's the 'Fields' menu item.
/Christer
Comment 15 Buovjaga 2016-11-02 07:53:52 UTC
Not seeing any Hint tooltip in 5.3. Let's set to NEW then, I guess.

Win 7 Pro 64-bit Version: 5.3.0.0.alpha1+
Build ID: 4b4abb73fcd7f2802e73102b3e7c30face8d309c
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; Layout Engine: old; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-10-31_02:54:50
Locale: fi-FI (fi_FI); Calc: group
Comment 16 christer.bergstrom.se 2016-11-02 08:02:56 UTC
No, that's right. There ain't no tooltip in Libre, but there is in OpenOffice. And then there is the 'Fields' dialog. Not there either in LO.

But first, please see the code (in original post and comment #4). 
It doesn't recognize the fields.
Comment 17 QA Administrators 2017-11-15 09:15:11 UTC Comment hidden (obsolete)
Comment 18 christer.bergstrom.se 2017-11-16 13:23:08 UTC
Hi,

Today, I've tested this again:

Help-About:
Version: 5.4.3.2 (x64)
Build ID: 92a7159f7e4af62137622921e809f8546db437e5
CPU threads: 4; OS: Windows 6.0; UI render: standard; 
Språkinställning: sv-SE (sv_SE); Calc: group


With OpenOffice it works fine - just as it always has. Am using the exact same Word template (.dot). It has two textfields. Running on different machines though (as you can't have both OpenOffice and LibreOffice installed on the same machine).

Libre:
oFieldsEnum = oDocument.getTextFields().createEnumeration()
Well, it stops here. oFieldsEnum  is invalid.

OpenOffice:
oFieldsEnum = oDocument.getTextFields().createEnumeration()
while oFieldsEnum.hasMoreElements()
  oElement = oFieldsEnum.nextElement()
...
...  
  // Fails in LO but works in OpenOffice. 
  oElement.supportsService("com.sun.star.text.TextField.Input")
  // Also fails (well, logical I guess since the above line fails too...)
  oElement.getPropertyValue("Hint")
...
Passes with flying colors.


Kind regards
Christer
Comment 19 QA Administrators 2018-11-17 03:47:32 UTC Comment hidden (obsolete)
Comment 20 christer.bergstrom.se 2018-11-28 10:56:20 UTC
Ok, just tested again with 6.0.7.3 (x64) Rel and it's still the same. 
As I wrote earlier, it was working fine in 3.3 and also works with latest version of openoffice.
Comment 21 christer.bergstrom.se 2018-11-28 12:22:45 UTC
...in short, it doesn't recognize:
.supportsService("com.sun.star.text.TextField.Input")
in a .dot-template.
/Christer
Comment 22 QA Administrators 2019-11-29 03:44:50 UTC Comment hidden (obsolete)
Comment 23 QA Administrators 2021-11-29 04:35:33 UTC Comment hidden (spam)