[Libreoffice-bugs] [Bug 135310] [META] Writer outline view bugs and enhancements

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Jul 30 12:29:53 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=135310

--- Comment #1 from steveh_66 at hotmail.com <steveh_66 at hotmail.com> ---
I was originally going to post this in issue 38093 I think it was, but I see it
was closed when I tried to submit it.  Possible solution to the fold/unfold or
collapse/expand problem I saw mentioned in a comment in that other issue post. 
Don't know if it will help or not, but here it is, apologies in advance for it
being a long post.
----------------------------------------------------------------

I am not really a programmer or that knowledgeable about the subject, just had
a possible solution to add to something I saw in one of the earlier comments
about folding/unfolding as it pertains to collapsing/expanding (to me, those 2
things are synonymous just different words for the same thing) the "detailed
text" under an element or heading or whatever.

When running a live disk of a Linux version, you can't add any software, so you
have to work with what you have.  There is a mind mapping program on the live
disk, but I don't care much for them as far as outlining purposes go.  I like a
nice linear flow of levels/sublevels and then adding in additional detail as I
go along or at a later date/time, and the mind mapper just seems very awkward
to me for doing this.

So, I came across an article about hiding/unhiding (folding/unfolding) text in
HTML documents.  It was an extremely easy form of handling the problem - you
just put a few lines (Less than 30, I think substantially less) of JavaScript
code into the <head></head> element of the webpage, then did an ordered or
unordered HTML list in your text editor.  Then you put a "parent ID" in say you
<li> tag of the <li></li> tags, and a "Child ID" in the <span> element start
tag (I think they were the same ID, if I remember correctly they HAD to be) and
put your "detailed text" where you expanded on the concept in the <span>
element or whatever and the "parent ID" snippet in the <li> 'header' or
whatever you might want to call it.  And voila, you were done.  The <li> text
itself became like a clickable link --- I would have to include HTML color code
in with the 'parent' element to change the color to actually distinguish them
from HTML links!

This worked OK, until you reach the point where you have 100s/1,000s of
elements in your outline.  Then the 'outline' became impossible to work with in
the text editor - because it didn't have code folding built in.  So, your
document became 10s and then 100s or more of pages long, and became impossible
to work with/'keep track of'.  So I gave up the method.

For years now I have just done the outlining in LO, using lists and hidden
text.  But this is a huge pain as well - right now I have it set up on both
computers, but any time I have to re-install Linux (every couple of years) I
forget how I got it to work and have to spend days searching forums, asking
questions, 'monkeying around' in LO, etc before I finally stumble across the
solution of how I got that to work.

And outlining in LO in this way has a further HUGE disadvantage.  You have to
'give up levels' in the list so that you can have your headers, and then the
detailed text in 'unnumbered list entries' or whatever they are called in LO. 
Another HUGE disadvantage to doing this is that LO (and OOo) both have no
'tabs' functionality in them - so you had to have at least 2 LO documents open
at once -- the story, article, etc you were working on in one document and the
outline in the other one.  And then another HUGE disadvantage of outlining in
LO this way; you can't drag and drop as stated earlier, or even insert
something in the best location for it (at least I never figured out how to do
it), you have to 'add it on' at the end of the list section/sub-section even
though that is a poor location for that entry.

I wish I could find the page where I learned this JavaScript trick, so that
that author could be given credit for their ingenious trick -- a short piece of
JavaScript in the <head> section, a "uniqueID" snippet each for parent and
child ID, and voila, you have collapse/expand features in HTML!

But I believe I do still have the JavaScript code and the snippets of
JavaScript for the child/parent IDs.  If it would not be too hard to convert
them over to UNO or LibreOffice Basic (or I see in the section for creating
macros that it has an entry for JavaScript so maybe JavaScript functionality is
already built into LO?) or whatever, then this seems like it could be an IDEAL
solution to the collapse/expand portion of the outlining problem being
discussed here.

So, if anyone thinks that this code could be used/repurposed in LO for the
collapse/expand function of outlining please let me know and I will post again
with the code.

P.S. : I decided my post was already long-winded enough I might as well just
post the code now and you can decide if it would be usable for this problem in
LO outlining.

JavaScript code for <head>

<head>

<script type="text/javascript">

function toggleShowHide(elementId) {

var element = document.getElementById(elementId);

if (element) {

if (element.style.display == "none")

element.style.display = "inline";

else

element.style.display = "none";

}

}

</script>

</head>

JavaScript 'parent ID' snippet :

<li onClick="toggleShowHide('UniqueID')">

JavaScript 'child ID' snippet :

<span id="UniqueID" style="display:none">

You will notice the parent ID is enclosed in ' ' and the child ID is enclosed
in " ".  Probably something required to get it to work in JavaScript - I don't
know JavaScript.  All you do is select UniqueID in both snippets, change them
to something that matches in both cases, say 'level1.1' and "level1.1", and you
are 'in business'!

I don't know if this will help at all or not, but I hope so.  I would like to
see an actual easy outlining functionality added to LO, I have even posted
about this and posted that code in 'bug issues' on both the OOo and LO bug
forums in the past, but I gave up when so many people were leaving negative
comments about "adding outlining to OOo/LO" saying "You can already do that
with Headings in the Navigator".  Maybe LO/Navigator Ninjas can, but as an
average everyday user I could never figure it out, always got disgusted with
it, and used my sub-optimal LO outlining technique I discussed earlier in this
post.  So I hope this helps.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200730/b7d912c0/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list