Re: Bug 81720

2022-08-19 Thread Phillips Rogfield

Hello,

You are right that by putting the cursor to the left it writes normal 
text. It only happens when you put the cursor to the right of the field.


It is not necessary that the field is the last thing in a file. It is 
sufficient it is the last thing in a paragraph. In this case you won't 
be able to insert text after the field without expanding the field. At 
least it will be not so simple. You will have to press Enter, space, 
left arrow, backspace, right arrow, and type.


I also noticed an exception: if you don't select anything, and do Insert 
-> Cross Reference ->  Set Reference, type a name, press Insert and then 
Close, it will insert an empty reference (which I have no idea why it 
differs conceptually from a bookmark?). This empty reference will be not 
modifiable: nor by putting the cursor to the left nor to the right, the 
text of the reference will stay empty.


So exception aside, I think maybe a good compromise would be that, if 
the user put the cursor on the right of a field, and press "Esc", it 
will start to type outside of the field, without expanding the field? 
Would that work?


Best,

Phil

On 19/08/2022 16:04, Andrew Pitonyak wrote:
The general expected behavior in libre office, at least for me, is 
that if I place the cursor and start typing, that it will continue 
using the same attributes and properties of the character directly to 
the left of the cursor. So, if I have bold text, and I placed the 
cursor to the left of the bold text and I type, it will not be bold, 
it will be whatever is to the left of the cursor. If the cursor is 
immediately to the right of the bold text however then it will be bold.


In this case, I assume, but have not verified or checked in anyway,  
references are a field. So the intent of this is to make certain that 
when the cursor is sitting directly to the left or right of, whatever 
is typed does not end up inside of that field. One side effect of this 
I expect, is that if you have a field with only one character you will 
have no way of modifying the text inside the field unless there is 
some special case when the text of the field is selected. I did not 
even check, can I select the text in a field? So what if the selection 
is partially in a field?


I would never have considered this a bug, I would have just considered 
it an extension of expected behavior. The annoying part is that if the 
field is the last thing in a file you have no way to add text after 
the field unless you do it programmatically, but that is also true 
last I checked of text tables.


I hope other contributors to comments in the bugs are correct that it 
is an easy fix, but I am skeptical.


Get BlueMail for Android <https://bluemail.me>
On Aug 19, 2022, at 9:41 AM, Phillips Rogfield  
wrote:


Dear developers,

I would like to fix bug 81720
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.

Basically when you insert a ReferenceMark, if you put the cursor
at the edge of it (start or end), and type something, it will
expand on the reference mark instead of writing it as a “normal text”.

You can find how to reproduce it in comment 22
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.

I have set up my environment, but I’m not sure where is the code
that “checks” if something is a ReferenceMark, if anything.

Can you point me in the right direction, please?

Best,

Phil

​


Bug 81720

2022-08-19 Thread Phillips Rogfield

Dear developers,

I would like to fix bug 81720 
.


Basically when you insert a ReferenceMark, if you put the cursor at the 
edge of it (start or end), and type something, it will expand on the 
reference mark instead of writing it as a “normal text”.


You can find how to reproduce it in comment 22 
.


I have set up my environment, but I’m not sure where is the code that 
“checks” if something is a ReferenceMark, if anything.


Can you point me in the right direction, please?

Best,

Phil

​

Re: Fields for Zotero

2022-08-17 Thread Phillips Rogfield

Hi Michael,

thanks for your answer.

1.

   My current understanding is that the proposed
   |com.sun.star.text.TextField.Bibliography| is the implementation for
   “Insert -> Table of Contents and Index -> Bibliography Entry” of
   LibreOffice Writer.
   Is that right?
   If it is, then it would mean that LibreOffice would manage the
   citation process (insert citations and bibliography). Right?
   We don’t want that. We want Zotero to manage it instead. We want
   Zotero to tell LibreOffice what an inline citation looks like and
   what a bibliography looks like.
   The alternative would be to import the Zotero database in
   LibreOffice, and then tell LibreOffice what the correct citation
   style is, and keep the database updated when the Zotero database
   changes, and keep the citation style updated when it changes.
   That looks too cumbersome.
   But maybe I’m failing to understand the process, I have no
   experience with LibreOffice citation management. I have always used
   Zotero.

2.

   the other option is, you could insert this with arbitrary
   content via the Fieldmark service, and since about version 7.3
   this kind of works in the document model and can be stored as an
   ODF extension in addition to DOCX/RTF.

That sounds good, but the Fieldmark seems to lack documentation?

   however there is currently no implementation of /expanding/ the
   fieldmark, that is, there is no code to evaluate the fieldmark
   command and overwrite the fieldmark result.

I have no idea what that means.
I’m sorry for my lack of knowledge.
Does it mean that we can’t, from a LibreOffice Writer Java extension, 
retrieve the code of the fieldmark and tell LibreOffice what it should 
print instead of the code?
If so, on one hand it is exactly what we need, on the other hand it 
seems it is already working?

LibreOffice already shows the correct text, not the code.
I believe it shows the text in the tag |w:fldChar|, not the one in the 
tag |w:instrTex| (which contains the code).

Is that correct?

I hereby attach a document with a Zotero inline citation in the 
Microsoft Word “Fields” format, for reference. We can take it as a 
reference implementation.


Best.

On 16/08/2022 12:06, Michael Stahl wrote:


On 16.08.22 09:03, Phillips Rogfield wrote:

Hi Miklos,

thank you very much for your answer!

Let’s make sure we are on the same page here.

Zotero is already able to write its citation with LibreOffice.
To do so, it currently uses one of two methods, at user’s choice:
(1) ReferenceMarks, which are NOT compatible with Microsoft Word
(2) Bookmarks, which are SOMEHOW compatible with Microsoft Word, in 
the sense that you can’t put citations in footnotes, and they tend to 
break very easily.


Instead, the Zotero plugin for Microsoft Word uses:
(1) Fields, which are NOT compatible with LibreOffice
(2) Bookmarks, see above.

The point of this post is to allow the plugin for LibreOffice to use 
“Fields”.


In particular, I have to use the UNO interface to write the following 
in the |word/document.xml| file inside a .docx file:


|xml:space="preserve"> [some text here]
  w:rsidRPr="007C09F6">  w:hAnsi="Calibri" w:cs="Calibri"/>   [some text here] 
 |


would the |com.sun.star.text.TextField.Bibliography| interface allow 
me to write the above code?


kind of, there is code to export it as a CITATION field in 
DocxAttributeOutput::EndField_Impl in 
sw/source/filter/ww8/docxattributeoutput.cxx.


the other option is, you could insert this with arbitrary content via 
the Fieldmark service, and since about version 7.3 this kind of works 
in the document model and can be stored as an ODF extension in 
addition to DOCX/RTF.


however there is currently no implementation of *expanding* the 
fieldmark, that is, there is no code to evaluate the fieldmark command 
and overwrite the fieldmark result.


​

zotero_field.docx
Description: MS-Word 2007 document


Re: Fields for Zotero

2022-08-16 Thread Phillips Rogfield

Hi Miklos,

thank you very much for your answer!

Let’s make sure we are on the same page here.

Zotero is already able to write its citation with LibreOffice.
To do so, it currently uses one of two methods, at user’s choice:
(1) ReferenceMarks, which are NOT compatible with Microsoft Word
(2) Bookmarks, which are SOMEHOW compatible with Microsoft Word, in the 
sense that you can’t put citations in footnotes, and they tend to break 
very easily.


Instead, the Zotero plugin for Microsoft Word uses:
(1) Fields, which are NOT compatible with LibreOffice
(2) Bookmarks, see above.

The point of this post is to allow the plugin for LibreOffice to use 
“Fields”.


In particular, I have to use the UNO interface to write the following in 
the |word/document.xml| file inside a .docx file:


|xml:space="preserve"> [some text here]
   
  
  [some text here]w:fldCharType="end"/>  |


would the |com.sun.star.text.TextField.Bibliography| interface allow me 
to write the above code?


Best and thank you again.
Phillips.

On 16/08/2022 08:23, Miklos Vajna wrote:


Hi Phillips,On Mon, Aug 15, 2022 at 05:19:33PM +0200, Phillips Rogfield wrote:

Zotero<https://www.zotero.org/>  is a citation manager with a plugin 
forLibreOffice<https://github.com/zotero/zotero-libreoffice-integration>.I would like to 
implement Fields, that is, for the plugin to write citationusing Fields, as per this 
issue<https://github.com/zotero/zotero-libreoffice-integration/issues/39>.It looks like the 
relevant entry point is |com.sun.star.text.Fieldmark|,however I went to the IDL 
reference<https://api.libreoffice.org/docs/idl/ref/index.html>  and there seems to beno such 
class under |com.sun.star.text|.Is it undocumented? Can you point me in the right direction?

Fieldmarks are primarily for preserving fields imported from Word, soit's 
somewhat intentional that there is no UI / documentation on how tocreate 
them.Writer's bibliography UI creates bibliography fields instead, availableas 
the com.sun.star.text.TextField.Bibliography UNO service. Did youconsider going 
with that instead?Regards,Miklos


​

Fields for Zotero

2022-08-15 Thread Phillips Rogfield

Hello,

Zotero  is a citation manager with a plugin for 
LibreOffice .


I would like to implement Fields, that is, for the plugin to write 
citation using Fields, as per this issue 
.


It looks like the relevant entry point is |com.sun.star.text.Fieldmark|, 
however I went to the IDL reference 
 and there seems to 
be no such class under |com.sun.star.text|.


Is it undocumented? Can you point me in the right direction?

Best.

​