Bug Hunting Session
Bug 111957 - Change the way to define relative vs absolute URLs
Summary: Change the way to define relative vs absolute URLs
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-22 06:25 UTC by Mike Kaganski
Modified: 2019-10-17 16:17 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2017-08-22 06:25:54 UTC
Currently, LibreOffice has selectors under Options-Load/Save-General that define if links are saved relative or absolute: "Save URLs relative to file system" and "Save URLs relative to internet".

However, these are IMO absolutely backwards way to do it. We don't need to define how the different URLs are saved, but how they are *created*. We need a way to precisely control the type of a specific URL when it is created and at any later time, not some option that modifies all (possibly unknown to user) places in document at the saving time.

An existing link that was imported when a document was open should not change its type based on user's general settings when the edited document is saved, unless user has changed it explicitly. User should have means to define that some subset of links is relative, while another subset is absolute. And so on.

So, my proposal is specifically as follows.
1. Change the internal model representation of links in program to keep the type (relative/absolute) with the reference during the lifetime of the document model.
2. When a document is loaded, determine the type of each link (based on the link URL) and store in the field introduced in #1.
3. Change the currently-existing (above-mentioned) settings to "*Create* URLs relative to file system" and "*Create* URLs relative to internet" and make their function be effective for newly-created links only (at the creation time), so that one could toggle the setting, create some links of one type, then toggle the setting again and continue creating links of another type.
4. Add a UI for changing types of selected links. It might be a context menu entry or a toolbar button. The UI element must disable itself if the selected link cannot be made relative (e.g., the document we are editing is not saved yet, or the document path and link path point to different hosts).
5. Also add a command to mass-change all existing links type.
6. Expand the above functions to currently unsupported links, like the one in bug 47223.

This does not require to change the ODF standard, does not introduce any incompatibility, it just needs to change the program logic and enables much more flexible workflow.
Comment 1 m.a.riosv 2017-08-23 00:33:01 UTC
I absolutely agree, a major enhancement, brinning down walls for the future, but looks to me like a great challenge.
Comment 2 Cor Nouws 2017-08-23 07:42:29 UTC
Thanks Mike!

(In reply to Mike Kaganski from comment #0)

> 4. Add a UI for changing types of selected links. It might be a context menu
> entry or a toolbar button. The UI element must disable itself if the
> selected link cannot be made relative (e.g., the document we are editing is
> not saved yet, or the document path and link path point to different hosts).

Additional, in the dialog Hyperlink a check absolute/relative should be offered (of course showing the same behavior on links that cannot be relative).
Comment 3 Cor Nouws 2017-08-23 11:58:13 UTC
(In reply to Cor Nouws from comment #2)
> Additional, in the dialog Hyperlink a check absolute/relative should be
> offered (of course showing the same behavior on links that cannot be
> relative).

Additional2: one can also create links by

- Paste special > DDE
  In any case in a recent daily on Linux it work at least from
  - Calc to Writer - resulting in a table, and
  - Writer to Writer - resulting in a read only section
  Both links may be approached/edited via Edit > Links.

- Dragging from the Navigator
  If in the list below a file is opened, different than the one being
  edited, one can drag various elements to the active document.
  Drag Mode includes As Link and As Hyperlink.
  - in Writer one can drag (at least) headers and sections
    dragging as Link results in a protected section
    the links may be approached/edited via Edit > Links.
    dragging as Hyperlink results in a hyperlink
  - in Calc one can drag (at least) sheets and named ranges
    dragging as Hyperlink is the only one that I can select (in master)

NB 1. Edit > Links allows to edit linked images (local, web) and linked sections in other documents, and DDE links.

NB 2. On DDE links: https://bugs.documentfoundation.org/show_bug.cgi?id=109283#c7

NB 3. Not pretending to cover all details, but I think I have mentioned most)
Comment 4 peter josvai 2018-04-19 07:50:32 UTC
I am so! grateful for these suggestions.. :)

I only propose enhancements -- of this behavior -- in a separate "bug report" because this one is already complete and self-containing.

by enhancement suggestion was filed (now) as: "Bug 117098", and I referred to this  suggestion in it.

thank you, and thanks to the developers for LibreO and Writer !! :) 

Peter
Comment 5 Heiko Tietze 2018-04-19 12:34:04 UTC
General acceptance, so go for it. The less weird options we have the better.