My project in Writer treats text documents with a very simple structure: only a body text and a header. The header is protected, so the user cannot edit it. Only the body text is "editable".
Problem
However, the header is "selectable": i.e. by clicking upon it, the view cursor moves to the header. Which raises (in some macros) a problem:
Code: Select all
dim oViewCursor as object, oCursor as object
oViewCursor = oDoc.getCurrentController.getViewCursor
'Error if view cursor in header instead of in body text
oCursor = oDoc.Text.createTextCursorByRange(oViewCursor)
1. My first solution is intercepting the error and putting a message box asking the user to reposition the cursor in the body text before continuing. This is of course not very elegant, but for now it's okay.
2. A better solution is to re-select the body text as the "CurrentComponent". Anybody an idea how to achieve this?
3. The best solution is to make the header "unselectable", so the user cannot put the view cursor there, even when clicking upon it, maintaining the body text as the only possible "CurrentComponent". Any ideas?
Thanks in advance.