private boolean action_addSectionIntoSectionwithStyling( OOComponentHelper ooDoc, String parentSection, String newSectionName, long sectionBackColor, float sectionLeftMargin) { boolean bState = false; try { ExternalMacro AddSectionInsideSection = ExternalMacroFactory.getMacroDefinition("AddSectionInsideSectionWithStyle"); AddSectionInsideSection.addParameter(ooDoc.getComponent()); AddSectionInsideSection.addParameter(parentSection); AddSectionInsideSection.addParameter(newSectionName); AddSectionInsideSection.addParameter(sectionBackColor); AddSectionInsideSection.addParameter(sectionLeftMargin); ooDoc.executeMacro(AddSectionInsideSection.toString(), AddSectionInsideSection.getParams()); bState = true; } catch (Exception ex) { log.error("action_addSectionIntoSectionwithStyling: error : " + ex.getMessage()); // checkFieldsMessages.add(ex.getLocalizedMessage()); bState = false; } finally { return bState; } }
private boolean action_setInputFieldValue( OOComponentHelper ooDoc, String hintName, String strDebateDate, String unprotectSection) { boolean bState = false; try { ExternalMacro setFieldValue = ExternalMacroFactory.getMacroDefinition("SetReferenceInputFieldValue"); setFieldValue.addParameter(ooDoc.getComponent()); setFieldValue.addParameter(hintName); setFieldValue.addParameter(strDebateDate); setFieldValue.addParameter(unprotectSection); ooDoc.executeMacro(setFieldValue.toString(), setFieldValue.getParams()); bState = true; } catch (Exception ex) { log.error("action_addImageIntoSection: error : " + ex.getMessage()); // checkFieldsMessages.add(ex.getLocalizedMessage()); bState = false; } finally { return bState; } }
private boolean action_addDocIntoSection( OOComponentHelper ooDoc, String intoSection, String fragmentName) { boolean bState = false; try { ExternalMacro insertDocIntoSection = ExternalMacroFactory.getMacroDefinition("InsertDocumentIntoSection"); insertDocIntoSection.addParameter(ooDoc.getComponent()); insertDocIntoSection.addParameter(intoSection); insertDocIntoSection.addParameter(fragmentName); ooDoc.executeMacro(insertDocIntoSection.toString(), insertDocIntoSection.getParams()); bState = true; } catch (Exception ex) { log.error("action_addImageIntoSection: error : " + ex.getMessage()); // checkFieldsMessages.add(ex.getLocalizedMessage()); bState = false; } finally { return bState; } }
private boolean action_replaceTextWithField( OOComponentHelper ooDoc, String hintName, String hintPlaceholderValue) { boolean bState = false; try { ExternalMacro ReplaceTextWithField = ExternalMacroFactory.getMacroDefinition("ReplaceTextWithField"); ReplaceTextWithField.addParameter(ooDoc.getComponent()); ReplaceTextWithField.addParameter(hintName); ReplaceTextWithField.addParameter(hintPlaceholderValue); ooDoc.executeMacro(ReplaceTextWithField.toString(), ReplaceTextWithField.getParams()); bState = true; } catch (Exception ex) { log.error("action_replaceTextWithField: error : " + ex.getMessage()); // checkFieldsMessages.add(ex.getLocalizedMessage()); bState = false; } finally { return bState; } }
private boolean action_addImageIntoSection( OOComponentHelper ooDoc, String intoSection, String logoPath) { boolean bState = false; try { log.debug( "executing addImageIntoSection : intoSection = " + intoSection + " , logoPath = " + logoPath); ExternalMacro addImageIntoSection = ExternalMacroFactory.getMacroDefinition("AddImageIntoSection"); addImageIntoSection.addParameter(ooDoc.getComponent()); addImageIntoSection.addParameter(intoSection); addImageIntoSection.addParameter(logoPath); ooDoc.executeMacro(addImageIntoSection.toString(), addImageIntoSection.getParams()); bState = true; } catch (Exception ex) { log.error("action_addImageIntoSection: error : " + ex.getMessage()); // checkFieldsMessages.add(ex.getLocalizedMessage()); bState = false; } finally { return bState; } }
private boolean sectionInsertionAction() { String strDebateDate = "", strTimeOfHansard = "", strLogoPath = ""; Date dtDebate = dt_initdebate_hansarddate.getDate(); SimpleDateFormat df = new SimpleDateFormat("HH:mm"); strTimeOfHansard = df.format((Date) dt_initdebate_timeofhansard.getValue()); SimpleDateFormat formatter = new SimpleDateFormat("MMMM dd yyyy"); strDebateDate = formatter.format(dtDebate); strLogoPath = m_strLogoPath; long sectionBackColor = 0xffffff; float sectionLeftMargin = (float) .2; log.debug("section left margin : " + sectionLeftMargin); // get the parent section name of this action // query action parents to find the parent of this action // String parentSectionName = ExternalMacro AddSectionInsideSection = ExternalMacroFactory.getMacroDefinition("AddSectionInsideSectionWithStyle"); AddSectionInsideSection.addParameter(ooDocument.getComponent()); AddSectionInsideSection.addParameter(BungeniEditorPropertiesHelper.getDocumentRoot()); AddSectionInsideSection.addParameter(theAction.action_naming_convention()); AddSectionInsideSection.addParameter(sectionBackColor); AddSectionInsideSection.addParameter(sectionLeftMargin); ooDocument.executeMacro( AddSectionInsideSection.toString(), AddSectionInsideSection.getParams()); this.setSectionMetadataForAction(theAction.action_naming_convention(), theAction); // embed logo image ExternalMacro addImageIntoSection = ExternalMacroFactory.getMacroDefinition("AddImageIntoSection"); addImageIntoSection.addParameter(theAction.action_naming_convention()); addImageIntoSection.addParameter(m_strLogoPath); ooDocument.executeMacro(addImageIntoSection.toString(), addImageIntoSection.getParams()); // loading the related document ExternalMacro insertDocIntoSection = ExternalMacroFactory.getMacroDefinition("InsertDocumentIntoSection"); insertDocIntoSection.addParameter(ooDocument.getComponent()); insertDocIntoSection.addParameter(theAction.action_naming_convention()); insertDocIntoSection.addParameter(FragmentsFactory.getFragment("hansard_masthead")); ooDocument.executeMacro(insertDocIntoSection.toString(), insertDocIntoSection.getParams()); ExternalMacro setFieldValue = ExternalMacroFactory.getMacroDefinition("SetReferenceInputFieldValue"); setFieldValue.addParameter(new String("debaterecord_official_date")); setFieldValue.addParameter(strDebateDate); setFieldValue.addParameter(new String("int:masthead_datetime")); ooDocument.executeMacro(setFieldValue.toString(), setFieldValue.getParams()); setFieldValue.clearParams(); setFieldValue.addParameter(new String("debaterecord_official_time")); setFieldValue.addParameter(strTimeOfHansard); setFieldValue.addParameter(new String("int:masthead_datetime")); ooDocument.executeMacro(setFieldValue.toString(), setFieldValue.getParams()); ooDocMetadata meta = new ooDocMetadata(ooDocument); meta.AddProperty("Bungeni_DebateOfficialDate", strDebateDate); meta.AddProperty("Bungeni_DebateOfficialTime", strTimeOfHansard); enableButtons(true); // MessageBox.OK(parent, "Prayers section was successfully added"); return true; }
private boolean sectionEditAction() { // if section exists // update fields String containerSection = theAction.action_naming_convention(); if (ooDocument.hasSection(containerSection) && ooDocument.hasSection("int:masthead_datetime")) { // now edit the fields and set the new values String strDebateDate = "", strTimeOfHansard = ""; Date dtDebate = dt_initdebate_hansarddate.getDate(); SimpleDateFormat df = new SimpleDateFormat("HH:mm"); strTimeOfHansard = df.format((Date) dt_initdebate_timeofhansard.getValue()); // .getText(); SimpleDateFormat formatter = new SimpleDateFormat("MMMM dd yyyy"); strDebateDate = formatter.format(dtDebate); ExternalMacro setFieldValue = ExternalMacroFactory.getMacroDefinition("SetReferenceInputFieldValue"); setFieldValue.addParameter(new String("debaterecord_official_date")); setFieldValue.addParameter(strDebateDate); setFieldValue.addParameter(new String("int:masthead_datetime")); ooDocument.executeMacro(setFieldValue.toString(), setFieldValue.getParams()); setFieldValue.clearParams(); setFieldValue.addParameter(new String("debaterecord_official_time")); setFieldValue.addParameter(strTimeOfHansard); setFieldValue.addParameter(new String("int:masthead_datetime")); ooDocument.executeMacro(setFieldValue.toString(), setFieldValue.getParams()); // set date and time of hansard to document ooDocMetadata meta = new ooDocMetadata(ooDocument); meta.AddProperty("Bungeni_DebateOfficialDate", strDebateDate); meta.AddProperty("Bungeni_DebateOfficialTime", strTimeOfHansard); return true; } else { MessageBox.OK(parent, "There is no masthead section available for editing in this document!"); return false; } }