I had a method of hiding/unhiding text. Don’t remember if I used 2 functions, 2 variables or 1 function and one variable. Then, I assigned a macro to each. I used it mostly for outlining with hidden text, since (as far as I know there is no easy way to do that in Writer, they been talking it to death in LibreOffice and OpenOffice and the argument goes back and forth, for years with different bug or issue reports - don’t remember which, not really relevant here for this question anyway).
I mostly used it in numbered lists or whatever. I would hit my macro key at the end of the list entry, and it would place a field. The field would have a 9 or a 0 in a box (9 to hide, 0 [or I think any other number to unhide]) and it would place a ‘field box’ or whatever you call it in that spot, with a 9 in the box and you could change it to 0 or whatever if you wanted to.
Then, I would select the text in the unnumbered list entry below it, and select all the way up until it was selected up to behind that ‘field box’ or whatever that was showing the 9 (or 0) in it, and hit my other macro. If the field box had the 9 in it, that text was automatically hidden, if it was zero then it wasn’t hidden. But as soon as I double-clicked the ‘field box’ and changed it from 9 to 0, voila - the text was unhidden. If I double-clicked the ‘field box’ again and entered 0, then voila, the text was unhidden.
Anyway, I don’t remember how I set things up to get these 2 functions, variables or function & variable set-up so that they worked in this manner. I set it up years ago, and I am sure I had help from someone on how to do this. My system recently crashed, so I am having to set everything up again, and since I didn’t set it up myself and someone gave me help on how to do the arrangement of this method I can’t remember how to do the setup. Whether a function or variable, I think I remember part of the Condition box (I think it was) having ==9 in it. I don’t remember if there was anything in front of the ==9 or not though, and as I said it was set up so long ago there is no way I can remember how I set it up. Now that I think about it, I think the condition or whatever was hide==9 maybe?
So, I hope someone that reads this will have an idea of what I am talking about, and how to make that work. I am sure the question could have been clearer, but I just can’t think of how to have made it clearer. I am tired, so my apologies, and I hope someone can figure out what I am talking about and how I would set it up. Thanks for any assistance anyone can give me on getting this method back.
Edit :
Here is the text from the BASIC macro file. Maybe someone could look at this and figure out how I did the persistent variable and persistent hidden section? Then I could do that and assign a macro key to them pretty easily :
REM ***** BASIC *****
Sub Main
End Sub
sub HideText
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(5) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Type"
args1(0).Value = 8
args1(1).Name = "SubType"
args1(1).Value = 2
args1(2).Name = "Name"
args1(2).Value = "Hide"
args1(3).Name = "Content"
args1(3).Value = "9"
args1(4).Name = "Format"
args1(4).Value = 10000
args1(5).Name = "Separator"
args1(5).Value = " "
dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args1())
end sub
sub HideSection
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(6) as new com.sun.star.beans.PropertyValue
args1(0).Name = "RegionName"
args1(0).Value = "Section4"
args1(1).Name = "RegionCondition"
args1(1).Value = "Hide==9"
args1(2).Name = "RegionHidden"
args1(2).Value = true
args1(3).Name = "RegionProtect"
args1(3).Value = false
args1(4).Name = "LinkName"
args1(4).Value = ""
args1(5).Name = "FilterName"
args1(5).Value = ""
args1(6).Name = "SubRegion"
args1(6).Value = ""
dispatcher.executeDispatch(document, ".uno:InsertSection", "", 0, args1())
end sub
Hope this might be useful for someone to hep me figure out how I did the persistent variable and section. From there, assigning it as a macro (if I need to) and then assigning that to a keyboard shortcut should be pretty straightforward. Thanks
Edit2 : I have been trying to use the techniques described by ajlittoz, in his answer and comments. So far I am having no luck getting it to work, I guess I am just missing something somewhere. I don’t know if this has any bearing on the question, but I am using a live disc so I cannot update LO, and the version it is running is 4.2.3.3 – maybe that has something to do with why I can’t get it to work using ajlittoz methods?