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;
   }
 }
Example #2
0
 @Override
 public boolean processSelectInsert() {
   // 1 check if reference exists .. if yes then fail...
   // if no markhighlighted text with named reference
   // also store selected date to metadata
   // 1 - add reference mark
   OOComponentHelper ooDoc = getContainerPanel().getOoDocument();
   insertRefMark(ooDoc, ooDoc.getViewCursor(), this._debatetimeRefName_);
   // 2 - add metadata
   SimpleDateFormat formatter =
       new SimpleDateFormat(BungeniEditorProperties.getEditorProperty("metadataTimeFormat"));
   Object timeValue = this.dt_initdebate_timeofhansard.getValue();
   Date hansardTime = (Date) timeValue;
   final String strTimeOfHansard = formatter.format(hansardTime);
   com.sun.star.text.XTextSection currentSection = ooDoc.currentSection();
   HashMap<String, String> sectionMeta =
       new HashMap<String, String>() {
         {
           put(_debatetimeRefName_, strTimeOfHansard);
         }
       };
   ooDoc.setSectionMetadataAttributes(currentSection, sectionMeta);
   return true;
 }