コード例 #1
0
 private boolean action_createSystemContainerFromSelection(
     OOComponentHelper ooDoc, String systemContainerName) {
   boolean bResult = false;
   try {
     XTextViewCursor xCursor = ooDocument.getViewCursor();
     XText xText = xCursor.getText();
     XTextContent xSectionContent = ooDocument.createTextSection(systemContainerName, (short) 1);
     xText.insertTextContent(xCursor, xSectionContent, true);
     bResult = true;
   } catch (com.sun.star.lang.IllegalArgumentException ex) {
     bResult = false;
     log.error("in addTextSection : " + ex.getLocalizedMessage(), ex);
   } finally {
     return bResult;
   }
 }
コード例 #2
0
 private boolean action_createRootSection(OOComponentHelper ooDoc, String sectionName) {
   boolean bResult = false;
   try {
     XText docText = ooDocument.getTextDocument().getText();
     XTextCursor docCursor = docText.createTextCursor();
     docCursor.gotoStart(false);
     docCursor.gotoEnd(true);
     XTextContent theContent = ooDocument.createTextSection(sectionName, (short) 1);
     docText.insertTextContent(docCursor, theContent, true);
     bResult = true;
   } catch (IllegalArgumentException ex) {
     log.error("in action_createRootSection :" + ex.getMessage());
     log.error("in action_createRootSection :" + CommonExceptionUtils.getStackTrace(ex));
   } finally {
     return bResult;
   }
 }