private void handleSection(Section s, StringBuilder sb) { EnumMap<SIT, EnumMap<CIT, Boolean>> hp = null; if (s.getTitle() != null) hp = sectionHandling.get(SectionType.USER_SECTION.toString() + s.getTitle().toUpperCase()); if (hp == null) hp = sectionHandling.get( SectionType.SECTION_LEVEL.toString() + (s.getLevel() - levelModifier)); if (hp == null) hp = sectionHandling.get(SectionType.DEFAULT_SECTION.toString()); if (hp == null) { System.err.println( "Cannot get Handling Parameters for Section:\"" + s.getTitle() + "\" Level:" + s.getLevel()); return; } handleContent(s.getTitleElement(), hp.get(SIT.TITLE), sb); if (s.getClass() == SectionContainer.class) { if (hp.get(SIT.SUBS) != null) handleContent(s, hp.get(SIT.SUBS), sb); else for (Section ss : ((SectionContainer) s).getSubSections()) handleSection(ss, sb); } else { EnumMap<CIT, Boolean> hpx; hpx = hp.get(SIT.TABLE); if (hpx != null) for (Table t : s.getTables()) handleContent(t, hpx, sb); hpx = hp.get(SIT.NESTLIST); if (hpx != null) for (NestedList nl : s.getNestedLists()) handleContent(nl, hpx, sb); hpx = hp.get(SIT.PARA); if (hpx != null) for (Paragraph p : s.getParagraphs()) handleContent(p, hpx, sb); hpx = hp.get(SIT.DEFLIST); if (hpx != null) for (DefinitionList dl : s.getDefinitionLists()) handleContent(dl, hpx, sb); } }
/** adds section handling for a specified relative level... */ public void addSectionHandling(int level, EnumMap<SIT, EnumMap<CIT, Boolean>> sh) { sectionHandling.put(SectionType.SECTION_LEVEL.toString() + level, sh); }