analyseCalc/analyseCalc/analyseCalc/analyseCalc/analyseCalc/src/AnalyseCalc/Classeur2.java

3179 lines
142 KiB
Java

package AnalyseCalc;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.TreeMap;
import AnalyseCalc.Classeur2.feuille.colonne;
import AnalyseCalc.Classeur2.feuille.graphic;
import AnalyseCalc.Classeur2.feuille.ligne;
import AnalyseCalc.Classeur2.feuille.ligne.cellule;
import calc.commandes;
import nodeAC.Ecriture;
import nodeAC.Ecriture.typeFichier;
import nodeAC.LecturesDossiers;
import nodeAC.constructionNodeAvecString;
import nodeAC.nodeAC;
/**
* Cette class permet de lire les feuilles de calcul de libreOffice Calc
* @author Pablo
*
*/
public class Classeur2 {
private int NbreFeuille=0;
private String Initial_Creator ="";
private String auteur ="";
private String dateCreation = "";
private String dateModification = "";
private String producteur="";
private TreeMap<Integer,feuille> Feuilles = new TreeMap<Integer,feuille>();
private String metaSujet="";
private String metaSujetContent="";
private static int nbmodification = 2000;
private static int nbcopier = 100;
private static boolean verification= true;
private static String analyse = "dossier";
public historique Histo = new historique();
private String communication="";
private String link="";
private String link2="";
private String linktitle="";
private String linktitle2="";
private String title="";
private TreeMap<String,String> nommageCellules = new TreeMap<String,String>();
public modification Modif = new modification();
/**
* Création des feuilles du classeur
* @param nod : nodeAC permettant de rechercher les feuilles "table:table"
* @throws CloneNotSupportedException
* @throws IOException
*/
public Classeur2(nodeAC nod, Integer indexStudent, typeFichier type) throws CloneNotSupportedException, IOException {
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
if(nod.getAttributs().get("bareme")!=null)calc.commandes.analyse_bareme = Double.valueOf(nod.getAttributs().get("bareme"));
if(nod.getAttributs().get("version")!=null)calc.commandes.version = nod.getAttributs().get("version");
if(nod.getAttributs().get("controleDateCreation")!=null)calc.commandes.analyse_controleDateCreation = Boolean.valueOf(nod.getAttributs().get("controleDateCreation"));
if(nod.getAttributs().get("presenceMetaSujet")!=null)calc.commandes.analyse_presenceMetaSujet = Boolean.valueOf(nod.getAttributs().get("presenceMetaSujet"));
if(nod.getAttributs().get("dateModification")!=null)calc.commandes.analyse_date = nod.getAttributs().get("dateModification");
if(nod.getAttributs().get("NbreFeuille")!=null) calc.commandes.analysis_nbr_feuilles = Integer.valueOf(nod.getAttributs().get("NbreFeuille"));
if(nod.getAttributs().get("auteur")!=null) calc.commandes.analyse_auteur = nod.getAttributs().get("auteur");
if(nod.getAttributs().get("baremeABC")!=null) calc.commandes.analyse_baremeABC = Boolean.valueOf(nod.getAttributs().get("baremeABC"));
if(nod.getAttributs().get("controle_Initial_Creator")!=null) calc.commandes.analyse_controle_Initial_Creator = Boolean.valueOf(nod.getAttributs().get("controle_Initial_Creator"));
if(nod.getAttributs().get("historiquePresent")!=null) calc.commandes.analyse_historiquePresent = Boolean.valueOf(nod.getAttributs().get("historiquePresent"));
if(nod.getAttributs().get("titre")!=null) calc.commandes.analyse_titre = nod.getAttributs().get("titre");
if(nod.getAttributs().get("filename")!=null) calc.commandes.analysis_filename = nod.getAttributs().get("filename");
if(nod.getAttributs().get("producteur")!=null) calc.commandes.analysis_producteur= nod.getAttributs().get("producteur");
if(nod.getAttributs().get("hash")!=null) calc.commandes.hash = nod.getAttributs().get("hash");
}
//Les meta-données pour tous les classeurs analyse et students
nodeAC nMeta = nod.retourneFirstEnfantsByName("office:meta");
if(nMeta!=null) {
nodeAC n = nMeta.retourneFirstEnfantsByName("meta:creation-date");
if(n!=null) {
dateCreation = n.getContenu().get(0);
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
calc.commandes.analyse_creationDate = dateCreation;
}
}
n = nMeta.retourneFirstEnfantsByName("dc:date");
if(n!=null) {
dateModification = n.getContenu().get(0);
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
calc.commandes.analyse_date = dateModification;
}
}
n = nMeta.retourneFirstEnfantsByName("meta:initial-creator");
if(n!=null) {
Initial_Creator = n.getContenu().get(0);
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
calc.commandes.analyse_Initial_Creator = Initial_Creator;
}
}
n = nMeta.retourneFirstEnfantsByName("dc:creator");
if(n!=null) {
auteur=n.getContenu().get(0);
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
calc.commandes.analyse_auteur = auteur;
}
}
n = nMeta.retourneFirstEnfantsByName("meta:generator");
if(n!=null) {
producteur=n.getContenu().get(0);
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
calc.commandes.analysis_producteur = producteur;
}
}
}
nodeAC n = nod.retourneFirstEnfantsByName("meta:user-defined");
if(n!=null) {
if(n.getAttributs().get("meta:name").equalsIgnoreCase("sujet")) {
metaSujet = n.getAttributs().get("meta:name");
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
calc.commandes.analyse_metaSujet=metaSujet;
}
metaSujetContent = n.retourneLesContenusEnfants("");
}
}
// historique
// ArrayList<nodeAC> histo = a.XMLName(a.getEC().getListeHistoriqueTableur().get(indexStudent), "table:cell-content-change");
// Histo.addhistorique(histo,a, indexStudent);
//feuilles. A partir des feuilles -> en partie lignes, cellules
ArrayList<nodeAC> feuilles = nod.retourneListEnfantsByName("table:table");
NbreFeuille = feuilles.size();
if(type.equals(Ecriture.typeFichier.fichier_analyse)) commandes.analysis_nbr_feuilles = NbreFeuille;
for(int i = 0 ; i<feuilles.size();i++) {
Feuilles.put(i,new feuille(feuilles.get(i), nod , indexStudent));
}
//nommage des cellules au niveau du classeur
ArrayList<nodeAC> nommage = nod.retourneListEnfantsByName("table:named-expressions");
if(nommage.size()>0) {
for(int i=0;i<nommage.size();i++) {
if(nommage.get(i).getParent().getNomElt().equals("office:spreadsheet")) {
for(int j = 0 ; j < nommage.get(i).getNodes().size(); j++) {
nommageCellules.put(nommage.get(i).getNodes().get(j).getAttributs().get("table:name"), nommage.get(i).getNodes().get(j).getAttributs().get("table:cell-range-address"));
}
}
}
}
}
/**
* Classeur vide
*/
public Classeur2() {
}
/**
* Obtient le type de disposition des fichiers étudiants
* @return
*/
public static String getAnalyse() {
return analyse;
}
/**
* Obtient l'historique
* @return
*/
public historique getHisto() {
return Histo;
}
/**
* Obtient le nombre de feuille dans le classeur
* @return
*/
public int getNbreFeuille() {
return NbreFeuille;
}
/**
* Modifie le nombre de feuille dans le classeur
* @param nbreFeuille
*/
public void setNbreFeuille(int nbreFeuille) {
NbreFeuille = nbreFeuille;
}
/**
* Obtient le nom de la meta donnees
* @return
*/
public String getMetaSujet() {
return metaSujet;
}
/**
* Modifie le nom de la meta donnees
* @param metaSujet
*/
public void setMetaSujet(String metaSujet) {
this.metaSujet = metaSujet;
}
/**
* Obtient la date de modification du classeur
* @return
*/
public String getDateModification() {
return dateModification;
}
/**
* Modifie la date de modification du classeur
* @param dateModification
*/
public void setDateModification(String dateModification) {
this.dateModification = dateModification;
}
/**
* Obtient le producteur du classeur
* @return
*/
public String getProducteur() {
return producteur;
}
/**
* modifie le producteur du classeur
* @param producteur
*/
public void setProducteur(String producteur) {
this.producteur = producteur;
}
/**
* Obtient la date e création du classeur
* @return
*/
public String getDateCreation() {
return dateCreation;
}
/**
* Modifie la date de création du classeur
* @param dateCreation
*/
public void setDateCreation(String dateCreation) {
this.dateCreation = dateCreation;
}
/**
* Obtient le créateur du classeur
* @return
*/
public String getInitial_Creator() {
return Initial_Creator;
}
/**
* Modifie le créateur du classeur
* @param initial_Creator
*/
public void setInitial_Creator(String initial_Creator) {
Initial_Creator = initial_Creator;
}
/**
* Obtient l'auteur de la dernière modification
* @return
*/
public String getAuteur() {
return auteur;
}
/**
* Modifie l'auteur de la dernière modification
* @param auteur
*/
public void setAuteur(String auteur) {
this.auteur = auteur;
}
/**
* Obtient le contenu de la meta donnees
* @return
*/
public String getMetaSujetContent() {
return metaSujetContent;
}
/**
* Modifie le contenu de la meta donnees
* @param metaSujetContent
*/
public void setMetaSujetContent(String metaSujetContent) {
this.metaSujetContent = metaSujetContent;
}
/**
* Obtient les feuilles du classeur
* @return
*/
public TreeMap<Integer, feuille> getFeuilles() {
return Feuilles;
}
/**
* Obtient le nombre de modification maximale
* @return
*/
public static int getNbmodification() {
return nbmodification;
}
/**
* Modifier le nombre de modifications maximale
* @param nbmodification
*/
public static void setNbmodification(int nbmodification) {
Classeur2.nbmodification = nbmodification;
}
/**
* Obtient le nombre de copier maximale
* @return
*/
public static int getNbcopier() {
return nbcopier;
}
/**
* Modifier le nombre de copier maximale
* @param nbcopier
*/
public static void setNbcopier(int nbcopier) {
Classeur2.nbcopier = nbcopier;
}
/**
* La verification du fichier
* @return
*/
public boolean isVerification() {
return verification;
}
/**
* Modifier la verification du fichier
* @param verification
*/
public void setVerification(boolean verification) {
this.verification = verification;
}
/**
* Retour le commentaire sur ce classeur
* @return
*/
public String getCommunication() {
return communication;
}
/**
* lien vers une vidéo ou vers un support de cours
* @return
*/
public String getLink() {
return link;
}
/**
* retourne le titre du lien
* @return
*/
public String getLinktitle() {
return linktitle;
}
/**
* retourne le titre du commentaire
* @return
*/
public String getTitle() {
return title;
}
/**
* retourne le lien 2
* @return
*/
public String getLink2() {
return link2;
}
/**
* retourne le titre du lien 2
* @return
*/
public String getLinktitle2() {
return linktitle2;
}
/**
* retourne le nommage des cellules
* @return
*/
public TreeMap<String, String> getNommageCellules() {
return nommageCellules;
}
/**
* Retourne une feuille en fonction de sont nom
* @param nameFeuille
* @return
*/
public feuille retourneFeuilleByName(String nameFeuille) {
for(int i = 0 ; i < this.Feuilles.size();i++) {
if(Feuilles.get(i).getNomFeuille().equalsIgnoreCase(nameFeuille)) {
return Feuilles.get(i);
}
}
return null;
}
/**
* Historique
* @author Pablo
*
*/
public class historique{
boolean empty = true;
private TreeMap<Long,String> dateModificationId = new TreeMap<Long,String>();
private HashMap<String,nodeAC> IdModifications = new HashMap<String,nodeAC>();
ArrayList<String> ListeIdSimultane = new ArrayList<String>();
ArrayList<String> ListeRefSimultane = new ArrayList<String>();
int NombreCopierColler = 0;
boolean Triche = false;
boolean TropModifications = false;
boolean TropCopier= false;
String Resultat="";
public historique() {
}
public void addhistorique(ArrayList<nodeAC> hist, Integer indexStudent ) {
LocalDateTime datetime1 = LocalDateTime.of(2017, 1, 14, 10, 34);
ZonedDateTime zonedDateTime = null;
long L1 = 0;
if(hist.size()>0) empty=false;
for(int i = 0 ; i < hist.size();i++) {
String id = hist.get(i).getAttributs().get("table:id");
String col = (hist.get(i).retourneFirstEnfantsByName("table:cell-address").getAttributs().get("table:column"));
String lig = (hist.get(i).retourneFirstEnfantsByName("table:cell-address").getAttributs().get("table:row"));
String tab = (hist.get(i).retourneFirstEnfantsByName("table:cell-address").getAttributs().get("table:table"));
String aut = (hist.get(i).retourneFirstEnfantsByName("dc:creator").getContenu().get(0));
String dat = (hist.get(i).retourneFirstEnfantsByName("dc:date").getContenu().get(0));
String ref = "tab"+tab+"Col"+col+"Lig"+lig+"-";
nodeAC c = hist.get(i).retourneFirstEnfantsByName("table:previous");
String idprevious = c.getAttributs().get("table:id");
nodeAC d = hist.get(i).retourneFirstEnfantsByName("table:change-track-table-cell");
String previousvalue = d.getAttributs().get("office:value");
String previousformula = d.getAttributs().get("table:formula");
String previousadress = d.getAttributs().get("table:cell-address");
L1=0;
if(dat!=null) if(id!=null) {
datetime1 = LocalDateTime.parse(dat);
zonedDateTime = ZonedDateTime.of(datetime1, ZoneId.systemDefault());
L1 = zonedDateTime.toInstant().toEpochMilli();
if(L1!=0) {
if(dateModificationId.get(L1)!=null) {
dateModificationId.put(L1, id+ " " +dateModificationId.get(L1));
}else {
dateModificationId.put(L1, id);
}
}
}
nodeAC e= new nodeAC();
e.getAttributs().put("Id", id);
e.getAttributs().put("ref", ref);
e.getAttributs().put("aut", aut);
e.getAttributs().put("dat", dat);
e.getAttributs().put("datlong", String.valueOf(L1));
if(idprevious!=null) e.getAttributs().put("idprevious", idprevious);
if(previousvalue!=null) e.getAttributs().put("previousvalue", previousvalue);
if(previousformula!=null) e.getAttributs().put("previousformula", previousformula);
if(previousadress!=null) e.getAttributs().put("previousadress", previousadress);
IdModifications.put(id, e);
}
if(IdModifications.size()>nbmodification) TropModifications=true;
NombreCopierColler = getNombreDeCopierColler();
}
public int getNombretotaldeModification(){
return IdModifications.size();
}
/**
*
* @return
*/
private int getNombreDeCopierColler() {
int compteur = 0;
long L = 0 ;
String newListe = "";
String ref = "";
for(Entry<Long,String> j : dateModificationId.entrySet() ) {
if(j.getKey()> L+10) { // regroupe avec un intervalle de temps de 100 ms
if(newListe.split(" ").length>1 && !newListe.isEmpty()) {
compteur++;
ListeIdSimultane.add(newListe); //liste des identifiants modifications simultanés
ListeRefSimultane.add(ref);
}
newListe="";
ref="";
}
L=j.getKey();
if(newListe.isEmpty()) {
newListe = j.getValue();
}else {
newListe = newListe+ " " + j.getValue();
}
String ListId[] = j.getValue().split(" ");
for(int i = 0 ; i < ListId.length; i++) {
String ref1 = IdModifications.get(ListId[i]).getAttributs().get("ref");
if(!ref.contains(ref1)) ref = ref + ref1;
}
}
if(compteur>nbcopier) TropCopier = true;
return compteur;
}
/**
*
* @param S
* @return
*/
public String getCopierCollerInterdit(Classeur2 S) {
for(int i = 0 ; i < ListeRefSimultane.size() ; i++) {
String a = ListeRefSimultane.get(i);
for(Entry<String,String> j : S.Modif.getModif().entrySet()) {
String ListeRef[] = j.getValue().split(" ");
for(int k = 0 ; k < ListeRef.length; k++) {
if(!ListeRef[k].isEmpty() && a.contains(ListeRef[k]) && !Resultat.contains(j.getKey())) {
Resultat = Resultat + j.getKey() + " ";
}
}
}
}
if(!Resultat.isEmpty()) Triche=true;
return Resultat;
}
public boolean isEmpty() {
return empty;
}
public TreeMap<Long, String> getDateModificationId() {
return dateModificationId;
}
public HashMap<String, nodeAC> getIdModifications() {
return IdModifications;
}
public int getNombreCopierColler() {
return NombreCopierColler;
}
public boolean isTriche() {
return Triche;
}
public boolean isTropModifications() {
return TropModifications;
}
public boolean isTropCopier() {
return TropCopier;
}
}
/**
* Permet de vérifier les modifications interdites
* @author pabr6
*
*/
public class modification{
TreeMap<String,String> modif = new TreeMap<String,String>();
TreeMap<String,String> message = new TreeMap<String,String>();
public modification() {
}
public void addModification(nodeAC N) {
String value ="";
String Id = N.getAttributs().get("id");
for(int j = 0 ; j < N.getNodes().size();j++) {
String ref = " tab"+ N.getNodes().get(j).getAttributs().get("table:table")+"Col"+N.getNodes().get(j).getAttributs().get("table:column")+"Lig"+N.getNodes().get(j).getAttributs().get("table:row")+"-";
value = value + ref;
message.put(ref,N.getNodes().get(j).getAttributs().get("message"));
}
modif.put(Id, value);
}
public TreeMap<String, String> getModif() {
return modif;
}
public void setModif(TreeMap<String, String> modif) {
this.modif = modif;
}
public TreeMap<String, String> getMessage() {
return message;
}
public void setMessage(TreeMap<String, String> message) {
this.message = message;
}
}
/*******************************************************
* Class feuille
* @author Pablo
*
*******************************************************/
public class feuille {
private String nomFeuille;
private String Poids= "1";
private String styleLigne ;
private String evaluer = "false";
private String communication ="";
private String link ="";
private String linktitle ="";
private TreeMap<Integer,colonne> colonnes = new TreeMap<Integer,colonne>();
private TreeMap<Integer,ligne> lignes = new TreeMap<Integer,ligne>();
private TreeMap<Integer,graphic> graphics = new TreeMap<Integer,graphic>();
private TreeMap<String,String> nommageCellulesFeuille = new TreeMap<String,String>();
/**
* Chargement du sujet
* @param fe
*/
public feuille(nodeAC fe) {
// chargement du sujet
if(fe.getAttributs().get("nomFeuille")!=null) nomFeuille=fe.getAttributs().get("nomFeuille");
if(fe.getAttributs().get("styleLigne")!=null) styleLigne=fe.getAttributs().get("styleLigne");
if(fe.getAttributs().get("Poids")!=null) Poids=fe.getAttributs().get("Poids");
if(fe.getAttributs().get("evaluer")!=null) evaluer=fe.getAttributs().get("evaluer");
if(fe.getAttributs().get("link")!=null) link=fe.getAttributs().get("link");
if(fe.getAttributs().get("linktitle")!=null) linktitle=fe.getAttributs().get("linktitle");
nodeAC comm = fe.retourneFirstEnfantsByName("communication");
if(!comm.isVide()) communication=comm.getContenu().get(0);
//nommage
for (Entry<String, String> j : nommageCellules.entrySet()) {
nommageCellulesFeuille.put(j.getKey(), j.getValue());
}
ArrayList<nodeAC> noms = fe.retourneListEnfantsByName("nommagecellulesfeuille");
for(int i=0; i < noms.size();i++) {
nommageCellulesFeuille.put(noms.get(i).getAttributs().get("name"),noms.get(i).getAttributs().get("cells"));
}
//colonnes chargement sujet
ArrayList<nodeAC> nods= fe.retourneListEnfantsByName("colonne");
for(int i = 0 ; i < nods.size();i++) {
colonnes.put( i , new colonne(nods.get(i),nods.get(i).getAttributs().get("RefColonne")));
}
nods.clear();
//lignes chargement sujet
nods= fe.retourneListEnfantsByName("ligne");
for(int i=0 ; i < nods.size();i++) {
lignes.put(i, new ligne(nods.get(i), nods.get(i).getAttributs().get("RefLigne")));
}
//graphics chargement sujet
nods= fe.retourneListEnfantsByName("graphic");
for(int i=0 ; i < nods.size();i++) {
graphics.put(i, new graphic(nods.get(i)));
}
}
/**
* Chargement d'une nouvelle feuille depuis le classeur
* @param fe
* @param XMLContent
* @param a
* @throws IOException
*/
public feuille(nodeAC fe, nodeAC nod, Integer indexStudent) throws IOException {
//Ajoute des variables pour l'évaluation
fe.getAttributs().put("poids","1");
fe.getAttributs().put("evaluer","false");
//Variable de nommage
// for (Entry<String, String> j : nommageCellules.entrySet()) {
// nommageCellulesFeuille.put(j.getKey(), j.getValue());
// }
ArrayList<nodeAC> nommage = fe.retourneListEnfantsByName("table:named-expressions");
if(nommage.size()>0) {
nommage = nommage.get(0).getNodes();
for(int i=0;i<nommage.size();i++) {
nommageCellulesFeuille.put(nommage.get(i).getAttributs().get("table:name"), nommage.get(i).getAttributs().get("table:cell-range-address"));
}
}
// chargement de la feuille et de son style
if(fe.getAttributs().get("table:name")!=null) {
nomFeuille=fe.getAttributs().get("table:name");
System.out.println("Nom de la feuille = " + nomFeuille);
}
if(fe.getAttributs().get("table:style-name")!=null) {
styleLigne = fe.getAttributs().get("table:style-name");
}
//colonnes chargement
ArrayList<nodeAC> nods = fe.retourneListEnfantsByName("table:table-column");
System.out.println("Nbre de colonne = " + nods.size());
//int numCol = 0;
int numRepeated = 0;
for(int i = 0 ; i < nods.size();i++) {
if(i>0) if(nods.get(i-1).getAttributs().get("table:number-columns-repeated")!=null) {
numRepeated=numRepeated+Integer.valueOf(nods.get(i-1).getAttributs().get("table:number-columns-repeated"))-1;
}
//numCol++;
colonnes.put( i , new colonne(nods.get(i),String.valueOf(i+1+numRepeated),nod));
}
//lignes chargement
nods=fe.retourneListEnfantsByName("table:table-row");
System.out.println("Nbre de ligne = " + nods.size());
int nombreRepetitionLigne = 0;
for(int i=0 ; i < nods.size();i++) {
if(i>0) if(lignes.get(i-1).getPropertiesRow().get("Repetition")!=null) {
if(lignes.get(i-1).getPropertiesRow().get("Repetition")!=null) nombreRepetitionLigne = nombreRepetitionLigne + Integer.valueOf(lignes.get(i-1).getPropertiesRow().get("Repetition"))-1;
}
lignes.put(i, new ligne(nods.get(i),String.valueOf(i+1+nombreRepetitionLigne),nod, indexStudent));
}
//graphics ancrer à la feuille chargement
nodeAC LesGraphics = fe.retourneFirstEnfantsByName("table:shapes");
if(LesGraphics!=null) {
ArrayList<nodeAC> A = LesGraphics.retourneListEnfantsByName("draw:frame");
System.out.println("Nbr de graphique = " + A.size());
for(int i = 0 ; i < A.size();i++) {
graphics.put(i, new graphic(A.get(i), nod, indexStudent));
}
}else {
System.out.println("Il n'y a pas de graphique");
}
}
/**
* Obtient le poids de la feuille
* @return
*/
public String getPoids() {
return Poids;
}
/**
* Obient evaluer
* @return
*/
public String getEvaluer() {
return evaluer;
}
/**
* Obtient le nom de la feuille
* @return
*/
public String getNomFeuille() {
return nomFeuille;
}
/**
* Modifie le nom de la feuille
* @param nomFeuille
*/
public void setNomFeuille(String nomFeuille) {
this.nomFeuille = nomFeuille;
}
/**
* Obtient le style de la feuille
* @return
*/
public String getStyleLigne() {
return styleLigne;
}
/**
* Modifie le style de la feuille
* @param style
*/
public void setStyleLigne(String style) {
this.styleLigne = style;
}
public TreeMap<Integer, colonne> getColonnes() {
return colonnes;
}
public TreeMap<Integer, ligne> getLignes() {
return lignes;
}
public TreeMap<Integer, graphic> getGraphics() {
return graphics;
}
/**
* Retourne la communication sur cette feuille
* @return
*/
public String getCommunication() {
return communication;
}
/**
* retourne le lien
* @return
*/
public String getLink() {
return link;
}
/**
* retourne le titre du lien
* @return
*/
public String getLinktitle() {
return linktitle;
}
/**
* Retourne une cellule en fonction du numéro de la colonne et du numéro de la ligne
* @param RefCol
* @param NumLigne
*/
public AnalyseCalc.Classeur2.feuille.ligne.cellule retourneCellule(Integer NumCol, Integer NumLigne) {
ligne lig = null;
for(int i =0 ; i < this.lignes.size();i++) {
if(Integer.valueOf(this.lignes.get(i).getRefLigne())==NumLigne) {
lig = this.lignes.get(i);
break;
}
if(Integer.valueOf(this.lignes.get(i).getRefLigne())>NumLigne) {
lig = this.lignes.get(i-1);
break;
}
}
if(lig!=null) {
for(int i = 0 ; i < lig.getCellules().size(); i ++) {
if(Integer.valueOf(lig.getCellules().get(i).getRefColonne())==NumCol) {
return lig.getCellules().get(i);
}
if(Integer.valueOf(lig.getCellules().get(i).getRefColonne())>NumCol) {
cellule cel = null;
if(i>0) {cel = lig.getCellules().get(i-1);} else {cel = lig.getCellules().get(i);}
colonne colcel = retourneColonne(String.valueOf(NumCol));
if(colcel!=null) {
cel.setRefColonne(colcel.getRefColonne());
cel.setRefColDansClasseur(colcel.getRefColDansClasseur());
cel.getPropertiesCell().put("LargeurColonne", colcel.propertiesColumn.get("LargeurColonne"));
return cel;
}else {
return cel;
}
}
if(i==lig.getCellules().size()-1) {
cellule cel = lig.getCellules().get(lig.getCellules().size()-1);
if(Integer.valueOf(cel.getRefColonne())==NumCol) {
return cel;
}else {
colonne colcel = retourneColonne(String.valueOf(NumCol));
if(colcel!=null) {
cel.setRefColonne(colcel.getRefColonne());
cel.setRefColDansClasseur(colcel.getRefColDansClasseur());
cel.getPropertiesCell().put("LargeurColonne", colcel.propertiesColumn.get("LargeurColonne"));
return cel;
}else {
return cel;
}
}
}
}
}
return null;
}
public TreeMap<String, String> getNommageCellulesFeuille() {
return nommageCellulesFeuille;
}
/**
* Retourne une cellule en fonction de la référence de la colonne et du numéro de la ligne
* @param RefCol
* @param NumLigne
* @return
*/
public AnalyseCalc.Classeur2.feuille.ligne.cellule retourneCellule(String Ref, Integer NumLigne) {
ligne lig = null;
int NumCol = ConvertirRefColonne(Ref);
for(int i =0 ; i < this.lignes.size();i++) {
if(Integer.valueOf(this.lignes.get(i).getRefLigne())==NumLigne) {
lig = this.lignes.get(i);
break;
}
if(Integer.valueOf(this.lignes.get(i).getRefLigne())>NumLigne) {
lig = this.lignes.get(i-1);
break;
}
}
for(int i = 0 ; i < lig.getCellules().size(); i ++) {
if(Integer.valueOf(lig.getCellules().get(i).getRefColonne())==NumCol) {
return lig.getCellules().get(i);
}
if(Integer.valueOf(lig.getCellules().get(i).getRefColonne())>NumCol) {
return lig.getCellules().get(i-1);
}
if(i==lig.getCellules().size()-1) {
return lig.getCellules().get(lig.getCellules().size()-1);
}
}
return null;
}
/**
* Obtient la ligne en fonction de la référence de la ligne
*/
public ligne retourneLigne(String RefLigne) {
for(int i = 0 ; i < lignes.size();i++) {
if(lignes.get(i).getRefLigne().equals(RefLigne)) return lignes.get(i);
if(Integer.valueOf(lignes.get(i).getRefLigne())>Integer.valueOf(RefLigne)) return lignes.get(i-1);
}
return null;
}
/**
* Obtient la colonne en fonction de la référence de la colonne
*/
public colonne retourneColonne(String RefC) {
int refColumn = Integer.valueOf(RefC);
int numColonne = 0;
for(int i = 0 ; i < colonnes.size();i++) {
if(colonnes.get(i).getRefColonne().equals(RefC)) return colonnes.get(i);
if(Integer.valueOf(colonnes.get(i).getRefColonne())<refColumn) numColonne = i;
}
if(numColonne!=0) return colonnes.get(numColonne);
return null;
}
/**
* Obtient le graphique en fonction du titre
* @param name
* @return
* @throws UnsupportedEncodingException
*/
public graphic retourneGraphicByName(String name) throws UnsupportedEncodingException {
for(int i = 0 ; i < graphics.size(); i++) {
String name2 = outils.outils.NetTexte(graphics.get(i).getTitreGraphique(),"");
if(name2.equals(name)) return graphics.get(i);
}
return null;
}
/**
* Retourne une ligne en fonction du numéro de la ligne
* @param NumLigne
* @return
*/
public ligne retourneLigne(Integer NumLigne) {
for(int i =0 ; i < this.lignes.size();i++) {
if(Integer.valueOf(this.lignes.get(i).getRefLigne())==NumLigne) {
return this.lignes.get(i);
}
if(Integer.valueOf(this.lignes.get(i).getRefLigne())>NumLigne) {
return this.lignes.get(i-1);
}
}
return null;
}
/**
* Retourne la nouvelle référence de la colonne sous forme d'un entier
* @param RefCol
* @return
*/
public Integer ConvertirRefColonne(String RefCol) {
RefCol = RefCol.toUpperCase();
int ascii1 = 0;
int ascii2 = 0;
int ascii3 = 0;
int longAlphabet = 26;
int newRefCol = 0;
char c1 = RefCol.charAt(0);
char c2 = RefCol.charAt(0);
char c3 = RefCol.charAt(0);
if(RefCol.length()==1) {
c1 = RefCol.charAt(0);
ascii1 = c1;
newRefCol = (ascii1 - 64);
}
if(RefCol.length()==2) {
c1 = RefCol.charAt(1);
c2 = RefCol.charAt(0);
ascii1 = c1;
ascii2 = c2;
newRefCol = (ascii1 - 64) + (ascii2-64)*longAlphabet ;
}
if(RefCol.length()==3) {
c1 = RefCol.charAt(2);
c2 = RefCol.charAt(1);
c3 = RefCol.charAt(0);
ascii1 = c1;
ascii2 = c2;
ascii3 = c3;
newRefCol = (ascii1 - 64) + (ascii2-64)*longAlphabet + (ascii3-64)*longAlphabet*longAlphabet ;
}
return newRefCol;
}
/**
* Convertir une référence numérique en référence alphabetique
* @param numCol
* @return
*/
public String ConvertirNumColonneEnString(Integer numCol) {
int nbreAlphabet1 = numCol / 26;
int reste = numCol % 26;
int nbreAlphabet2 = 0;
if(reste==0) nbreAlphabet1= nbreAlphabet1-1;
if(nbreAlphabet1>26) {
nbreAlphabet1 = (numCol /26) - 26;
nbreAlphabet2 = (numCol /26) / 26;
if(nbreAlphabet1==0) nbreAlphabet2 = nbreAlphabet2-1;
}
char C1 = "Z".charAt(0);
char C2 = "Z".charAt(0);
char C3 = "Z".charAt(0);
if(reste!=0) C1 = (char) (reste + 64);
if(nbreAlphabet1!=0) C2 = (char) (nbreAlphabet1 + 64);
if(nbreAlphabet2!=0) C3 = (char) (nbreAlphabet2 + 64);
if(nbreAlphabet1==0 && nbreAlphabet2==0) return String.valueOf(C1);
if(nbreAlphabet1>0 && nbreAlphabet1<27 && nbreAlphabet2==0) return String.valueOf(C2)+ String.valueOf(C1);
if(nbreAlphabet2>0) return String.valueOf(C3)+ String.valueOf(C2)+ String.valueOf(C1);
return null;
}
/******************************************************************
* Class colonne
* @author Pablo
*
******************************************************************/
public class colonne{
private String RefColonne = "";
private String RefColDansClasseur="";
private TreeMap<String,String> propertiesColumn = new TreeMap<String,String>();
/**
* Chargement du sujet
* @param col
* @param numColonne
*/
public colonne(nodeAC col, String numColonne) {
RefColonne=numColonne;
RefColDansClasseur = ConvertirNumColonneEnString(Integer.valueOf(RefColonne));
if (col.getAttributs().get("LargeurColonne")!=null) propertiesColumn.put("LargeurColonne", col.getAttributs().get("LargeurColonne"));
if (col.getAttributs().get("Style")!=null) propertiesColumn.put("Style", col.getAttributs().get("Style"));
if (col.getAttributs().get("StyleDefautCell")!=null) propertiesColumn.put("StyleDefautCell", col.getAttributs().get("StyleDefautCell"));
if (col.getAttributs().get("Repetition")!=null) propertiesColumn.put("Repetition", col.getAttributs().get("Repetition"));
if (col.getAttributs().get("Visible")!=null) propertiesColumn.put("Visible", col.getAttributs().get("Visible"));
}
/**
* Chargement d'un nouvelle colonne
* @param col
* @param numColonne
* @param XMLContent
* @param a
*/
public colonne(nodeAC col, String numColonne, nodeAC nod) {
RefColonne = numColonne;
RefColDansClasseur = ConvertirNumColonneEnString(Integer.valueOf(RefColonne));
// chargement
if (col.getAttributs().get("table:style-name")!=null) propertiesColumn.put("Style", col.getAttributs().get("table:style-name"));
if (col.getAttributs().get("table:default-cell-style-name")!=null) propertiesColumn.put("StyleDefautCell", col.getAttributs().get("table:default-cell-style-name"));
if (col.getAttributs().get("table:number-columns-repeated")!=null) propertiesColumn.put("Repetition", col.getAttributs().get("table:number-columns-repeated"));
if (col.getAttributs().get("table:visibility")!=null) propertiesColumn.put("Visible", col.getAttributs().get("table:visibility"));
ArrayList<nodeAC> s = nod.retourneListEnfantsByName("style:style", "style:name",propertiesColumn.get("Style"));
if(s.size()>0) {
nodeAC b = s.get(0).retourneFirstEnfantsByName("style:table-column-properties");
if(b.getAttributs().get("style:column-width")!=null) propertiesColumn.put("LargeurColonne",b.getAttributs().get("style:column-width"));
}
}
public String getRefColDansClasseur() {
return RefColDansClasseur;
}
public void setRefColDansClasseur(String refColDansClasseur) {
RefColDansClasseur = refColDansClasseur;
}
public String getRefColonne() {
return RefColonne;
}
public void setRefColonne(String refColonne) {
RefColonne = refColonne;
}
public TreeMap<String, String> getPropertiesColumn() {
return propertiesColumn;
}
public void setPropertiesColumn(TreeMap<String, String> propertiesColumn) {
this.propertiesColumn = propertiesColumn;
}
}
/********************************************
*
* @author Pablo
*
********************************************/
public class graphic{
private String evaluer = "false";
private String nomObjet = "";
private String TitreGraphique ="";
private String TitreNettoyer ="";
private String TitreAfficherFeedBack="";
private String type = "";
private String communication="";
private TreeMap<String,String> propertiesGraphic = new TreeMap<String,String>();
private TreeMap<String,String> titre = new TreeMap<String,String>();
private TreeMap<String,String> soustitre = new TreeMap<String,String>();
private TreeMap<String,String> legend = new TreeMap<String,String>();
private TreeMap<String,String> airegraphic = new TreeMap<String,String>();
private TreeMap<String,String> axeXprincipal = new TreeMap<String,String>();
private TreeMap<String,String> axeXsecondaire = new TreeMap<String,String>();
private TreeMap<String,String> axeYprincipal = new TreeMap<String,String>();
private TreeMap<String,String> axeYsecondaire = new TreeMap<String,String>();
private TreeMap<String,String> series = new TreeMap<String,String>();
public graphic(nodeAC nodeGraphic ) {
//chargement sujet
if(nodeGraphic.getAttributs().get("nomObjet")!=null) nomObjet = nodeGraphic.getAttributs().get("nomObjet");
if(nodeGraphic.getAttributs().get("type")!=null) type = nodeGraphic.getAttributs().get("type");
if(nodeGraphic.getAttributs().get("evaluer")!=null) evaluer = nodeGraphic.getAttributs().get("evaluer");
if(nodeGraphic.getAttributs().get("TitreGraphique")!=null) TitreAfficherFeedBack = nodeGraphic.getAttributs().get("TitreGraphique");
nodeAC b = nodeGraphic.retourneFirstEnfantsByName("communication");
if(b!=null) communication=b.getContenu().get(0);
b = nodeGraphic.retourneFirstEnfantsByName("propertiesGraphic");
if(b.getAttributs().get("Type")!=null) propertiesGraphic.put("Type", b.getAttributs().get("Type"));
if(b.getAttributs().get("style")!=null) propertiesGraphic.put("style", b.getAttributs().get("style"));
if(b.getAttributs().get("positionY")!=null) propertiesGraphic.put("positionY", b.getAttributs().get("positionY"));
if(b.getAttributs().get("positionX")!=null) propertiesGraphic.put("positionX", b.getAttributs().get("positionX"));
if(b.getAttributs().get("hauteur")!=null) propertiesGraphic.put("hauteur", b.getAttributs().get("hauteur"));
if(b.getAttributs().get("largeur")!=null) propertiesGraphic.put("largeur", b.getAttributs().get("largeur"));
if(b.getAttributs().get("texteStyle")!=null) propertiesGraphic.put("texteStyle", b.getAttributs().get("texteStyle"));
if(b.getAttributs().get("Data")!=null) propertiesGraphic.put("Data", b.getAttributs().get("Data"));
if(b.getAttributs().get("EpaisseurBordures")!=null) propertiesGraphic.put("EpaisseurBordures", b.getAttributs().get("EpaisseurBordures"));
if(b.getAttributs().get("TypeBordures")!=null) propertiesGraphic.put("TypeBordures", b.getAttributs().get("TypeBordures"));
if(b.getAttributs().get("CouleurBordures")!=null) propertiesGraphic.put("CouleurBordures", b.getAttributs().get("CouleurBordures"));
if(b.getAttributs().get("nom")!=null) propertiesGraphic.put("nom", b.getAttributs().get("nom"));
if(b.getAttributs().get("titreObjet")!=null) propertiesGraphic.put("titreObjet", b.getAttributs().get("titreObjet"));
if(b.getAttributs().get("description")!=null) propertiesGraphic.put("description", b.getAttributs().get("description"));
b = nodeGraphic.retourneFirstEnfantsByName("titre");
if(b.getAttributs().get("Style")!=null) titre.put("Style", b.getAttributs().get("Style"));
if(b.getAttributs().get("Titre")!=null) {
titre.put("Titre", b.getAttributs().get("Titre"));
TitreGraphique = titre.put("Titre", b.getAttributs().get("Titre"));
try {
TitreNettoyer = outils.outils.NetTexte(outils.outils.withoutPoint(TitreGraphique),"");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
if(b.getAttributs().get("Police")!=null) titre.put("Police", b.getAttributs().get("Police"));
if(b.getAttributs().get("PositionAutomatique")!=null) titre.put("PositionAutomatique", b.getAttributs().get("PositionAutomatique"));
if(b.getAttributs().get("StylePolice")!=null) titre.put("StylePolice", b.getAttributs().get("StylePolice"));
if(b.getAttributs().get("StylePoliceWeight")!=null) titre.put("StylePoliceWeight", b.getAttributs().get("StylePoliceWeight"));
if(b.getAttributs().get("TaillePolice")!=null) titre.put("TaillePolice", b.getAttributs().get("TaillePolice"));
if(b.getAttributs().get("Rotation")!=null) titre.put("Rotation", b.getAttributs().get("Rotation"));
if(b.getAttributs().get("EpaisseurSouslignement")!=null) titre.put("EpaisseurSouslignement", b.getAttributs().get("EpaisseurSouslignement"));
if(b.getAttributs().get("StyleSouslignement")!=null) titre.put("StyleSouslignement", b.getAttributs().get("StyleSouslignement"));
if(b.getAttributs().get("CouleurPolice")!=null) titre.put("CouleurPolice", b.getAttributs().get("CouleurPolice"));
if(b.getAttributs().get("OmbrePolice")!=null) titre.put("OmbrePolice", b.getAttributs().get("OmbrePolice"));
b = nodeGraphic.retourneFirstEnfantsByName("soustitre");
if(b.getAttributs().get("Style")!=null) soustitre.put("Style", b.getAttributs().get("Style"));
if(b.getAttributs().get("SousTitre")!=null) soustitre.put("SousTitre", b.getAttributs().get("SousTitre"));
if(b.getAttributs().get("PositionAutomatique")!=null) soustitre.put("PositionAutomatique", b.getAttributs().get("PositionAutomatique"));
if(b.getAttributs().get("StylePolice")!=null) soustitre.put("StylePolice", b.getAttributs().get("StylePolice"));
if(b.getAttributs().get("StylePoliceWeight")!=null) soustitre.put("StylePoliceWeight", b.getAttributs().get("StylePoliceWeight"));
if(b.getAttributs().get("TaillePolice")!=null) soustitre.put("TaillePolice", b.getAttributs().get("TaillePolice"));
if(b.getAttributs().get("Rotation")!=null) soustitre.put("Rotation", b.getAttributs().get("Rotation"));
if(b.getAttributs().get("SousTitre")!=null) soustitre.put("SousTitre", b.getAttributs().get("SousTitre"));
if(b.getAttributs().get("EpaisseurSouslignement")!=null) soustitre.put("EpaisseurSouslignement", b.getAttributs().get("EpaisseurSouslignement"));
if(b.getAttributs().get("StyleSouslignement")!=null) soustitre.put("StyleSouslignement", b.getAttributs().get("StyleSouslignement"));
if(b.getAttributs().get("CouleurPolice")!=null) soustitre.put("CouleurPolice", b.getAttributs().get("CouleurPolice"));
if(b.getAttributs().get("OmbrePolice")!=null) soustitre.put("OmbrePolice", b.getAttributs().get("OmbrePolice"));
b = nodeGraphic.retourneFirstEnfantsByName("airegraphic");
if(b.getAttributs().get("Style")!=null) airegraphic.put("Style", b.getAttributs().get("Style"));
if(b.getAttributs().get("hauteur")!=null) airegraphic.put("hauteur", b.getAttributs().get("hauteur"));
if(b.getAttributs().get("largeur")!=null) airegraphic.put("largeur", b.getAttributs().get("largeur"));
if(b.getAttributs().get("EtiquettesData")!=null) airegraphic.put("EtiquettesData", b.getAttributs().get("EtiquettesData"));
if(b.getAttributs().get("TableData")!=null) airegraphic.put("TableData", b.getAttributs().get("TableData"));
b = nodeGraphic.retourneFirstEnfantsByName("axeXprincipal");
addAxeSujet(b,axeXprincipal);
b = nodeGraphic.retourneFirstEnfantsByName("axeXsecondaire");
addAxeSujet(b,axeXsecondaire);
b = nodeGraphic.retourneFirstEnfantsByName("axeYprincipal");
addAxeSujet(b,axeYprincipal);
b = nodeGraphic.retourneFirstEnfantsByName("axeYsecondaire");
addAxeSujet(b,axeYsecondaire);
b = nodeGraphic.retourneFirstEnfantsByName("legend");
if(b.getAttributs().get("LegendPosition")!=null) legend.put("LegendPosition", b.getAttributs().get("LegendPosition"));
if(b.getAttributs().get("Style")!=null) legend.put("Style", b.getAttributs().get("Style"));
if(b.getAttributs().get("CouleurArrierePlan")!=null) legend.put("CouleurArrierePlan", b.getAttributs().get("CouleurArrierePlan"));
if(b.getAttributs().get("TypeArrierePlan")!=null) legend.put("TypeArrierePlan", b.getAttributs().get("TypeArrierePlan"));
if(b.getAttributs().get("CouleurBordure")!=null) legend.put("CouleurBordure", b.getAttributs().get("CouleurBordure"));
if(b.getAttributs().get("EpaisseurBordure")!=null) legend.put("EpaisseurBordure", b.getAttributs().get("EpaisseurBordure"));
if(b.getAttributs().get("TaillePolice")!=null) legend.put("TaillePolice", b.getAttributs().get("TaillePolice"));
if(b.getAttributs().get("StylePolice")!=null) legend.put("StylePolice", b.getAttributs().get("StylePolice"));
if(b.getAttributs().get("StylePoliceWeight")!=null) legend.put("StylePoliceWeight", b.getAttributs().get("StylePoliceWeight"));
if(b.getAttributs().get("Police")!=null) legend.put("Police", b.getAttributs().get("Police"));
b = nodeGraphic.retourneFirstEnfantsByName("series");
if(b.getAttributs().get("Serie_1_AfficheCategorieEtiquetteDeValeur")!=null) series.put("Serie_1_AfficheCategorieEtiquetteDeValeur", b.getAttributs().get("Serie_1_AfficheCategorieEtiquetteDeValeur"));
if(b.getAttributs().get("Serie_1_AfficheSymbolEtiquetteDeValeur")!=null) series.put("Serie_1_AfficheSymbolEtiquetteDeValeur", b.getAttributs().get("Serie_1_AfficheSymbolEtiquetteDeValeur"));
if(b.getAttributs().get("Serie_1_AxeAssocier")!=null) series.put("Serie_1_AxeAssocier", b.getAttributs().get("Serie_1_AxeAssocier"));
if(b.getAttributs().get("Serie_1_Bordures")!=null) series.put("Serie_1_Bordures", b.getAttributs().get("Serie_1_Bordures"));
if(b.getAttributs().get("Serie_1_Couleur")!=null) series.put("Serie_1_Couleur", b.getAttributs().get("Serie_1_Couleur"));
if(b.getAttributs().get("Serie_1_Data")!=null) series.put("Serie_1_Data", b.getAttributs().get("Serie_1_Data"));
if(b.getAttributs().get("Serie_1_DataLierAlaSource")!=null) series.put("Serie_1_DataLierAlaSource", b.getAttributs().get("Serie_1_DataLierAlaSource"));
if(b.getAttributs().get("Serie_1_FormatEtiquetteValeurSurGraphique")!=null) series.put("Serie_1_FormatEtiquetteValeurSurGraphique", b.getAttributs().get("Serie_1_FormatEtiquetteValeurSurGraphique"));
if(b.getAttributs().get("Serie_1_LabelData")!=null) series.put("Serie_1_LabelData", b.getAttributs().get("Serie_1_LabelData"));
if(b.getAttributs().get("Serie_1_Police")!=null) series.put("Serie_1_Police", b.getAttributs().get("Serie_1_Police"));
if(b.getAttributs().get("Serie_1_StylePolice")!=null) series.put("Serie_1_StylePolice", b.getAttributs().get("Serie_1_StylePolice"));
if(b.getAttributs().get("Serie_1_TaillePolice")!=null) series.put("Serie_1_TaillePolice", b.getAttributs().get("Serie_1_TaillePolice"));
if(b.getAttributs().get("Serie_1_Type")!=null) series.put("Serie_1_Type", b.getAttributs().get("Serie_1_Type"));
if(b.getAttributs().get("Serie_2_AfficheCategorieEtiquetteDeValeur")!=null) series.put("Serie_2_AfficheCategorieEtiquetteDeValeur", b.getAttributs().get("Serie_2_AfficheCategorieEtiquetteDeValeur"));
if(b.getAttributs().get("Serie_2_AfficheSymbolEtiquetteDeValeur")!=null) series.put("Serie_2_AfficheSymbolEtiquetteDeValeur", b.getAttributs().get("Serie_2_AfficheSymbolEtiquetteDeValeur"));
if(b.getAttributs().get("Serie_2_AxeAssocier")!=null) series.put("Serie_2_AxeAssocier", b.getAttributs().get("Serie_2_AxeAssocier"));
if(b.getAttributs().get("Serie_2_Bordures")!=null) series.put("Serie_2_Bordures", b.getAttributs().get("Serie_2_Bordures"));
if(b.getAttributs().get("Serie_2_Couleur")!=null) series.put("Serie_2_Couleur", b.getAttributs().get("Serie_2_Couleur"));
if(b.getAttributs().get("Serie_2_Data")!=null) series.put("Serie_2_Data", b.getAttributs().get("Serie_2_Data"));
if(b.getAttributs().get("Serie_2_DataLierAlaSource")!=null) series.put("Serie_2_DataLierAlaSource", b.getAttributs().get("Serie_2_DataLierAlaSource"));
if(b.getAttributs().get("Serie_2_FormatEtiquetteValeurSurGraphique")!=null) series.put("Serie_2_FormatEtiquetteValeurSurGraphique", b.getAttributs().get("Serie_2_FormatEtiquetteValeurSurGraphique"));
if(b.getAttributs().get("Serie_2_LabelData")!=null) series.put("Serie_2_LabelData", b.getAttributs().get("Serie_2_LabelData"));
if(b.getAttributs().get("Serie_2_Police")!=null) series.put("Serie_2_Police", b.getAttributs().get("Serie_2_Police"));
if(b.getAttributs().get("Serie_2_StylePolice")!=null) series.put("Serie_2_StylePolice", b.getAttributs().get("Serie_2_StylePolice"));
if(b.getAttributs().get("Serie_2_TaillePolice")!=null) series.put("Serie_2_TaillePolice", b.getAttributs().get("Serie_2_TaillePolice"));
if(b.getAttributs().get("Serie_2_Type")!=null) series.put("Serie_2_Type", b.getAttributs().get("Serie_2_Type"));
}
//Chargement
public graphic(nodeAC nodeGraphic,nodeAC nod, Integer indexStudent ) throws IOException {
if(nodeGraphic.getAttributs().get("draw:style-name")!=null) propertiesGraphic.put("Style", nodeGraphic.getAttributs().get("draw:style-name"));
if(nodeGraphic.getAttributs().get("svg:y")!=null) propertiesGraphic.put("positionY", nodeGraphic.getAttributs().get("svg:y"));
if(nodeGraphic.getAttributs().get("svg:x")!=null) propertiesGraphic.put("positionX", nodeGraphic.getAttributs().get("svg:x"));
if(nodeGraphic.getAttributs().get("svg:height")!=null) propertiesGraphic.put("hauteur", nodeGraphic.getAttributs().get("svg:height"));
if(nodeGraphic.getAttributs().get("svg:width")!=null) propertiesGraphic.put("largeur", nodeGraphic.getAttributs().get("svg:width"));
if(nodeGraphic.getAttributs().get("draw:text-style-name")!=null) propertiesGraphic.put("texteStyle", nodeGraphic.getAttributs().get("draw:text-style-name"));
if(nodeGraphic.getAttributs().get("draw:name")!=null) propertiesGraphic.put("nom", nodeGraphic.getAttributs().get("draw:name"));
//chargement
String numObjet[] = null;
nodeAC b = nodeGraphic.retourneFirstEnfantsByName("draw:object");
if(b.getAttributs().get("xlink:href")!=null) {
propertiesGraphic.put("nomObjet", b.getAttributs().get("xlink:href"));
nomObjet = b.getAttributs().get("xlink:href");
nomObjet = nomObjet.substring(nomObjet.lastIndexOf("/")+1, nomObjet.length());
numObjet = nomObjet.split(" ");
}
if(b.getAttributs().get("draw:notify-on-update-of-ranges")!=null) {
propertiesGraphic.put("Data", b.getAttributs().get("draw:notify-on-update-of-ranges"));
}
//TitreObjet
b = nodeGraphic.retourneFirstEnfantsByName("svg:title");
if(b!=null) {
propertiesGraphic.put("titreObjet", b.getContenu().get(0));
}
//Description
b = nodeGraphic.retourneFirstEnfantsByName("svg:desc");
if(b!=null) {
propertiesGraphic.put("description", b.getContenu().get(0));
}
//Style gri1, ...
ArrayList<nodeAC> C = nod.retourneListEnfantsByName("style:style", "style:name", propertiesGraphic.get("Style"));
System.out.println("C.size() = " + C.size());
System.out.println("propertiesGraphic.get(\"Style\") = " + propertiesGraphic.get("Style"));
if(C.size()>0) {
nodeAC b1 = C.get(0).retourneFirstEnfantsByName("style:graphic-properties");
if(b1!=null) {
if(b1.getAttributs().get("svg:stroke-width")!=null) propertiesGraphic.put("EpaisseurBordures", b1.getAttributs().get("svg:stroke-width"));
if(b1.getAttributs().get("draw:stroke")!=null) propertiesGraphic.put("TypeBordures", b1.getAttributs().get("draw:stroke"));
if(b1.getAttributs().get("svg:stroke-color")!=null) propertiesGraphic.put("CouleurBordures", b1.getAttributs().get("svg:stroke-color"));
if(b1.getAttributs().get("svg:stroke-color")!=null) propertiesGraphic.put("CouleurBordures", b1.getAttributs().get("svg:stroke-color"));
}
}
if(!nomObjet.isEmpty() && numObjet.length>1) {
ArrayList<nodeAC> XMLContentGraphic;
constructionNodeAvecString A = new constructionNodeAvecString();
nodeAC B = A.NewNode(LecturesDossiers.getEC().getListeObjetGraphicTableur().get(indexStudent));
Ecriture.ecritureNodeEnXML(B, "Objet", commandes.PathFilenameAnalysis, typeFichier.fichier_etudiant);
XMLContentGraphic = B.retourneListEnfantsByName("Object","num",numObjet[1]); //cloner
if(XMLContentGraphic.size()>0) {
// XMLContentGraphic = B.retourneListEnfantsByName("office:chart");
// System.out.println("XMLContentGraphic.size() = " + XMLContentGraphic.size());
// if(XMLContentGraphic.size()>0) {
System.out.println(XMLContentGraphic.get(0).toString());
ajouteProperties(XMLContentGraphic.get(0));
// }
}
}
}
/********
*
*/
//** Uniquement pour le chargement **
public void ajouteProperties(nodeAC nodeGraphic) {
nodeAC b = nodeGraphic.retourneFirstEnfantsByName("chart:chart");
if(b!=null) {
type = b.getAttributs().get("chart:class");
propertiesGraphic.put("Type", type );
}
// titre
b = nodeGraphic.retourneFirstEnfantsByName("chart:title");
if(b!=null) {
if(b.getAttributs().get("chart:style-name")!=null) titre.put("Style", b.getAttributs().get("chart:style-name"));
b = b.retourneFirstEnfantsByName("text:p");
if(b!=null) {
titre.put("Titre", b.retourneLesContenusEnfants(""));
TitreGraphique = titre.put("Titre", b.retourneLesContenusEnfants(""));
b = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", titre.get("Style"));
if(b!=null) {
nodeAC b2 = b.retourneFirstEnfantsByName("style:chart-properties");
if(b2!=null) {
if(b2.getAttributs().get("chart:auto-position")!=null) titre.put("PositionAutomatique", b2.getAttributs().get("chart:auto-position"));
if(b2.getAttributs().get("style:rotation-angle")!=null) titre.put("Rotation", b2.getAttributs().get("style:rotation-angle"));
}
b2 = b.retourneFirstEnfantsByName("style:text-properties");
if(b2!=null) {
if(b2.getAttributs().get("fo:font-size")!=null) titre.put("TaillePolice", b2.getAttributs().get("fo:font-size"));
if(b2.getAttributs().get("style:font-style-name")!=null) titre.put("StylePolice", b2.getAttributs().get("style:font-style-name"));
if(b2.getAttributs().get("fo:font-weight")!=null) titre.put("StylePoliceWeight", b2.getAttributs().get("fo:font-weight"));
if(b2.getAttributs().get("fo:font-family")!=null) titre.put("Police", b2.getAttributs().get("fo:font-family"));
if(b2.getAttributs().get("style:text-underline-style")!=null) titre.put("StyleSouslignement", b2.getAttributs().get("style:text-underline-style"));
if(b2.getAttributs().get("style:text-underline-width")!=null) titre.put("EpaisseurSouslignement", b2.getAttributs().get("style:text-underline-width"));
if(b2.getAttributs().get("fo:color")!=null) titre.put("CouleurPolice", b2.getAttributs().get("fo:color"));
if(b2.getAttributs().get("fo:text-shadow")!=null) titre.put("OmbrePolice", b2.getAttributs().get("fo:text-shadow"));
}
}
}
}
// sous-titre
b = nodeGraphic.retourneFirstEnfantsByName("chart:subtitle");
if(b!=null) {
if(b.getAttributs().get("chart:style-name")!=null) soustitre.put("Style", b.getAttributs().get("chart:style-name"));
b = b.retourneFirstEnfantsByName("text:p");
if(b!=null) {
soustitre.put("SousTitre", b.retourneLesContenusEnfants(""));
}
b = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", soustitre.get("Style"));
if(b!=null) {
nodeAC b2 = b.retourneFirstEnfantsByName("style:chart-properties");
System.out.println("style:chart-properties = " + b2.toString());
if(b2!=null) {
if(b2.getAttributs().get("chart:auto-position")!=null) soustitre.put("PositionAutomatique", b2.getAttributs().get("chart:auto-position"));
if(b2.getAttributs().get("style:rotation-angle")!=null) soustitre.put("Rotation", b2.getAttributs().get("style:rotation-angle"));
}
b2 = b.retourneFirstEnfantsByName("style:text-properties");
if(b2!=null) {
if(b2.getAttributs().get("fo:font-size")!=null) soustitre.put("TaillePolice", b2.getAttributs().get("fo:font-size"));
if(b2.getAttributs().get("style:font-style-name")!=null) soustitre.put("StylePolice", b2.getAttributs().get("style:font-style-name"));
if(b2.getAttributs().get("fo:font-weight")!=null) soustitre.put("StylePoliceWeight", b2.getAttributs().get("fo:font-weight"));
if(b2.getAttributs().get("fo:font-family")!=null) soustitre.put("Police", b2.getAttributs().get("fo:font-family"));
if(b2.getAttributs().get("style:text-underline-style")!=null) soustitre.put("StyleSouslignement", b2.getAttributs().get("style:text-underline-style"));
if(b2.getAttributs().get("style:text-underline-width")!=null) soustitre.put("EpaisseurSouslignement", b2.getAttributs().get("style:text-underline-width"));
if(b2.getAttributs().get("fo:color")!=null) soustitre.put("CouleurPolice", b2.getAttributs().get("fo:color"));
if(b2.getAttributs().get("fo:text-shadow")!=null) soustitre.put("OmbrePolice", b2.getAttributs().get("fo:text-shadow"));
}
}
}
//legend
b = nodeGraphic.retourneFirstEnfantsByName("chart:legend");
if(b!=null) {
if(b.getAttributs().get("chart:legend-position")!=null) legend.put("LegendPosition", b.getAttributs().get("chart:legend-position"));
if(b.getAttributs().get("chart:style-name")!=null) {
legend.put("Style", b.getAttributs().get("chart:style-name"));
b = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", legend.get("Style"));
if(b!=null) {
nodeAC b2 = b.retourneFirstEnfantsByName("style:graphic-properties");
if(b2!=null) {
if(b2.getAttributs().get("draw:fill-color")!=null) legend.put("CouleurArrierePlan", b2.getAttributs().get("draw:fill-color"));
if(b2.getAttributs().get("draw:fill")!=null) legend.put("TypeArrierePlan", b2.getAttributs().get("draw:fill"));
if(b2.getAttributs().get("svg:stroke-color")!=null) legend.put("CouleurBordure", b2.getAttributs().get("svg:stroke-color"));
if(b2.getAttributs().get("svg:stroke-width")!=null) legend.put("EpaisseurBordure", b2.getAttributs().get("svg:stroke-width"));
}
b2 = b.retourneFirstEnfantsByName("style:text-properties");
if(b2!=null) {
if(b2.getAttributs().get("fo:font-size")!=null) legend.put("TaillePolice", b2.getAttributs().get("fo:font-size"));
if(b2.getAttributs().get("style:font-style-name")!=null) legend.put("StylePolice", b2.getAttributs().get("style:font-style-name"));
if(b2.getAttributs().get("fo:font-weight")!=null) legend.put("StylePoliceWeight", b2.getAttributs().get("fo:font-weight"));
if(b2.getAttributs().get("fo:font-family")!=null) legend.put("Police", b2.getAttributs().get("fo:font-family"));
if(b2.getAttributs().get("style:text-underline-style")!=null) legend.put("StyleSouslignement", b2.getAttributs().get("style:text-underline-style"));
if(b2.getAttributs().get("style:text-underline-width")!=null) legend.put("EpaisseurSouslignement", b2.getAttributs().get("style:text-underline-width"));
if(b2.getAttributs().get("fo:color")!=null) legend.put("CouleurPolice", b2.getAttributs().get("fo:color"));
if(b2.getAttributs().get("fo:text-shadow")!=null) legend.put("OmbrePolice", b2.getAttributs().get("fo:text-shadow"));
}
}
}
}
// Aire
b = nodeGraphic.retourneFirstEnfantsByName("chart:plot-area");
if(b!=null) {
if(b.getAttributs().get("chart:style-name")!=null) airegraphic.put("Style", b.getAttributs().get("chart:style-name"));
if(b.getAttributs().get("svg:height")!=null) airegraphic.put("hauteur", b.getAttributs().get("svg:height"));
if(b.getAttributs().get("svg:width")!=null) airegraphic.put("largeur", b.getAttributs().get("svg:width"));
if(b.getAttributs().get("chart:data-source-has-labels")!=null) airegraphic.put("EtiquettesData", b.getAttributs().get("chart:data-source-has-labels"));
if(b.getAttributs().get("table:cell-range-address")!=null) airegraphic.put("TableData", b.getAttributs().get("table:cell-range-address"));
if(airegraphic.get("Style")!=null) {
nodeAC b1 = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name",airegraphic.get("Style"));
if(b1!=null) {
nodeAC b2 = b1.retourneFirstEnfantsByName("style:chart-properties");
if(b2!=null) {
if(b2.getAttributs().get("chart:data-label-number")!=null) airegraphic.put("FormatEtiquetteValeurSurGraphique", b2.getAttributs().get("chart:data-label-number"));
if(b2.getAttributs().get("chart:data-label-symbol")!=null) airegraphic.put("AfficheSymbolCommeEtiquetteDeValeur", b2.getAttributs().get("chart:data-label-symbol"));
if(b2.getAttributs().get("chart:data-label-text")!=null) airegraphic.put("AfficheCategorieCommeEtiquetteDeValeur", b2.getAttributs().get("chart:data-label-text"));
}
}
}
}
// les axes
ArrayList<nodeAC> C = nodeGraphic.retourneListEnfantsByName("chart:axis");
for(int i = 0 ; i < C.size();i++) {
// axe X principal
if(C.get(i).getAttributs().get("chart:name").equals("primary-x")) {
addAxeProperties(axeXprincipal,C.get(i),nodeGraphic);
}
// axe X secondaire
if(C.get(i).getAttributs().get("chart:name").equals("secondary-x")) {
addAxeProperties(axeXsecondaire,C.get(i),nodeGraphic);
}
// axe Y principal
if(C.get(i).getAttributs().get("chart:name").equals("primary-y")) {
addAxeProperties(axeYprincipal,C.get(i),nodeGraphic);
}
// axe Y secondaire
if(C.get(i).getAttributs().get("chart:name").equals("secondary-y")) {
addAxeProperties(axeYsecondaire,C.get(i),nodeGraphic);
}
}
// les series
C = nodeGraphic.retourneListEnfantsByName("chart:series");
for(int i = 0 ; i < C.size();i++) {
addSerieProperties(series, C.get(i), i+1, nodeGraphic);
}
}
private void addAxeSujet(nodeAC b, TreeMap<String, String> axe) {
//en premier lieu les valeurs par défauts
axe.put("AfficherGrillePrincipale", "false"); // à vérifier
axe.put("AfficherGrilleSecondaire", "false");
if(b.getAttributs().get("AfficheEtiquette")!=null) axe.put("AfficheEtiquette", b.getAttributs().get("AfficheEtiquette"));
if(b.getAttributs().get("AfficherGrillePrincipale")!=null) axe.put("AfficherGrillePrincipale", b.getAttributs().get("AfficherGrillePrincipale"));
if(b.getAttributs().get("AfficherGrilleSecondaire")!=null) axe.put("AfficherGrilleSecondaire", b.getAttributs().get("AfficherGrilleSecondaire"));
if(b.getAttributs().get("CouleurGrillePrincipale")!=null) axe.put("CouleurGrillePrincipale", b.getAttributs().get("CouleurGrillePrincipale"));
if(b.getAttributs().get("CouleurGrilleSecondaire")!=null) axe.put("CouleurGrilleSecondaire", b.getAttributs().get("CouleurGrilleSecondaire"));
if(b.getAttributs().get("CouleurMarque")!=null) axe.put("CouleurMarque", b.getAttributs().get("CouleurMarque"));
if(b.getAttributs().get("CouleurPoliceEtiquetteAxe")!=null) axe.put("CouleurPoliceEtiquetteAxe", b.getAttributs().get("CouleurPoliceEtiquetteAxe"));
if(b.getAttributs().get("CroiserAutreAxe")!=null) axe.put("CroiserAutreAxe", b.getAttributs().get("CroiserAutreAxe"));
if(b.getAttributs().get("Data")!=null) axe.put("Data", b.getAttributs().get("Data"));
if(b.getAttributs().get("Dimension")!=null) axe.put("Dimension", b.getAttributs().get("Dimension"));
if(b.getAttributs().get("EpaisseurGrillePrincipale")!=null) axe.put("EpaisseurGrillePrincipale", b.getAttributs().get("EpaisseurGrillePrincipale"));
if(b.getAttributs().get("EpaisseurGrilleSecondaire")!=null) axe.put("EpaisseurGrilleSecondaire", b.getAttributs().get("EpaisseurGrilleSecondaire"));
if(b.getAttributs().get("EpaisseurMarque")!=null) axe.put("EpaisseurMarque", b.getAttributs().get("EpaisseurMarque"));
if(b.getAttributs().get("EpaisseurSouslignementEtiquetteAxe")!=null) axe.put("EpaisseurSouslignementEtiquetteAxe", b.getAttributs().get("EpaisseurSouslignementEtiquetteAxe"));
if(b.getAttributs().get("FormatEtiquetteLierSource")!=null) axe.put("FormatEtiquetteLierSource", b.getAttributs().get("FormatEtiquetteLierSource"));
if(b.getAttributs().get("Format_1_DecimalPlaceNombre")!=null) axe.put("Format_1_DecimalPlaceNombre", b.getAttributs().get("Format_1_DecimalPlaceNombre"));
if(b.getAttributs().get("Format_1_MinimumDecimalNombre")!=null) axe.put("Format_1_MinimumDecimalNombre", b.getAttributs().get("Format_1_MinimumDecimalNombre"));
if(b.getAttributs().get("Format_1_CouleurNombre")!=null) axe.put("Format_1_CouleurNombre", b.getAttributs().get("Format_1_CouleurNombre"));
if(b.getAttributs().get("Format_2_CouleurNombre")!=null) axe.put("Format_2_CouleurNombre", b.getAttributs().get("Format_2_CouleurNombre"));
if(b.getAttributs().get("Format_2_MinimumDecimalNombre")!=null) axe.put("Format_2_MinimumDecimalNombre", b.getAttributs().get("Format_2_MinimumDecimalNombre"));
if(b.getAttributs().get("Format_2_DecimalPlaceNombre")!=null) axe.put("Format_2_DecimalPlaceNombre", b.getAttributs().get("Format_2_DecimalPlaceNombre"));
if(b.getAttributs().get("FormatCondition")!=null) axe.put("FormatCondition", b.getAttributs().get("FormatCondition"));
if(b.getAttributs().get("InverseDirection")!=null) axe.put("InverseDirection", b.getAttributs().get("InverseDirection"));
if(b.getAttributs().get("IntervallePrincipal")!=null) axe.put("IntervallePrincipal", b.getAttributs().get("IntervallePrincipal"));
if(b.getAttributs().get("Logarithmique")!=null) axe.put("Logarithmique", b.getAttributs().get("Logarithmique"));
if(b.getAttributs().get("MarquePrincipaleExterieur")!=null) axe.put("MarquePrincipaleExterieur", b.getAttributs().get("MarquePrincipaleExterieur"));
if(b.getAttributs().get("MarquePrincipaleInterieur")!=null) axe.put("MarquePrincipaleInterieur", b.getAttributs().get("MarquePrincipaleInterieur"));
if(b.getAttributs().get("MarqueSecondaireExterieur")!=null) axe.put("MarqueSecondaireExterieur", b.getAttributs().get("MarqueSecondaireExterieur"));
if(b.getAttributs().get("MarqueSecondaireInterieur")!=null) axe.put("MarqueSecondaireInterieur", b.getAttributs().get("MarqueSecondaireInterieur"));
if(b.getAttributs().get("Maximum")!=null) axe.put("Maximum", b.getAttributs().get("Maximum"));
if(b.getAttributs().get("Minium")!=null) axe.put("Minium", b.getAttributs().get("Minium"));
if(b.getAttributs().get("NombreIntervalleSecondaire")!=null) axe.put("NombreIntervalleSecondaire", b.getAttributs().get("NombreIntervalleSecondaire"));
if(b.getAttributs().get("OmbrePoliceEtiquetteAxe")!=null) axe.put("OmbrePoliceEtiquetteAxe", b.getAttributs().get("OmbrePoliceEtiquetteAxe"));
if(b.getAttributs().get("Origine")!=null) axe.put("Origine", b.getAttributs().get("Origine"));
if(b.getAttributs().get("PoliceTitreAxe")!=null) axe.put("PoliceTitreAxe", b.getAttributs().get("PoliceTitreAxe"));
if(b.getAttributs().get("PoliceEtiquetteAxe")!=null) axe.put("PoliceEtiquetteAxe", b.getAttributs().get("PoliceEtiquetteAxe"));
if(b.getAttributs().get("PositionEtiquette")!=null) axe.put("PositionEtiquette", b.getAttributs().get("PositionEtiquette"));
if(b.getAttributs().get("PositionMarque")!=null) axe.put("PositionMarque", b.getAttributs().get("PositionMarque"));
if(b.getAttributs().get("PositionAutomatiqueTitreAxe")!=null) axe.put("PositionAutomatiqueTitreAxe", b.getAttributs().get("PositionAutomatiqueTitreAxe"));
if(b.getAttributs().get("RotationEtiquette")!=null) axe.put("RotationEtiquette", b.getAttributs().get("RotationEtiquette"));
if(b.getAttributs().get("RotationTitreAxe")!=null) axe.put("RotationTitreAxe", b.getAttributs().get("RotationTitreAxe"));
if(b.getAttributs().get("TaillePoliceEtiquetteAxe")!=null) axe.put("TaillePoliceEtiquetteAxe", b.getAttributs().get("TaillePoliceEtiquetteAxe"));
if(b.getAttributs().get("TaillePoliceTitreAxe")!=null) axe.put("TaillePoliceTitreAxe", b.getAttributs().get("TaillePoliceTitreAxe"));
if(b.getAttributs().get("TitreAxe")!=null) axe.put("TitreAxe", b.getAttributs().get("TitreAxe"));
if(b.getAttributs().get("Type")!=null) axe.put("Type", b.getAttributs().get("Type"));
if(b.getAttributs().get("TypeTraitGrillePrincipale")!=null) axe.put("TypeTraitGrillePrincipale", b.getAttributs().get("TypeTraitGrillePrincipale"));
if(b.getAttributs().get("TypeTraitGrilleSecondaire")!=null) axe.put("TypeTraitGrilleSecondaire", b.getAttributs().get("TypeTraitGrilleSecondaire"));
if(b.getAttributs().get("Style")!=null) axe.put("Style", b.getAttributs().get("Style"));
if(b.getAttributs().get("StylePoliceTitreAxe")!=null) axe.put("StylePoliceTitreAxe", b.getAttributs().get("StylePoliceTitreAxe"));
if(b.getAttributs().get("StylePoliceEtiquetteAxe")!=null) axe.put("StylePoliceEtiquetteAxe", b.getAttributs().get("StylePoliceEtiquetteAxe"));
if(b.getAttributs().get("StyleSouslignementEtiquetteAxe")!=null) axe.put("StyleSouslignementEtiquetteAxe", b.getAttributs().get("StyleSouslignementEtiquetteAxe"));
}
/**
* Ajoute les differents parametres au axes
* @param axe
* @param b
* @param a
*/
public void addAxeProperties(TreeMap<String, String> axe, nodeAC nodeAxe , nodeAC nodeGraphic) {
// valeur par défaut
axe.put("AfficherGrillePrincipale", "false");
axe.put("AfficherGrilleSecondaire", "false");
axe.put("TitreAxe", nodeAxe.retourneLesContenusEnfants(""));
if(nodeAxe.getAttributs().get("chart:style-name")!=null) {
axe.put("Style", nodeAxe.getAttributs().get("chart:style-name"));
if(nodeAxe.getAttributs().get("chart:style-name")!=null) axe.put("Style", nodeAxe.getAttributs().get("chart:style-name"));
if(nodeAxe.getAttributs().get("chartooo:axis-type")!=null) axe.put("Type", nodeAxe.getAttributs().get("chartooo:axis-type"));
if(nodeAxe.getAttributs().get("chart:dimension")!=null) axe.put("Dimension", nodeAxe.getAttributs().get("chart:dimension"));
nodeAC b = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", axe.get("Style"));
if(b!=null) {
//format nombre
if(b.getAttributs().get("style:data-style-name")!=null) {
nodeAC b1 = nodeGraphic.retourneFirstEnfantsByName("number:number-style", "style:name", b.getAttributs().get("style:data-style-name"));
if(!b1.isVide()) {
nodeAC b2 = b1.retourneFirstEnfantsByName("style:text-properties");
if(b2.getAttributs().get("fo:color")!=null) axe.put("Format_1_CouleurNombre", b2.getAttributs().get("fo:color"));
b2 = b1.retourneFirstEnfantsByName("number:number");
if(b2.getAttributs().get("number:min-integer-digits")!=null) axe.put("Format_1_MinimumDigitNombre", b2.getAttributs().get("number:min-integer-digits"));
if(b2.getAttributs().get("loext:min-decimal-places")!=null) axe.put("Format_1_MinimumDecimalNombre", b2.getAttributs().get("loext:min-decimal-places"));
if(b2.getAttributs().get("number:decimal-places")!=null) axe.put("Format_1_DecimalPlaceNombre", b2.getAttributs().get("number:decimal-places"));
b2 = b1.retourneFirstEnfantsByName("style:map");
if(b2.getAttributs().get("style:condition")!=null) axe.put("FormatCondition", b2.getAttributs().get("style:condition"));
//format 2
if(b2.getAttributs().get("style:apply-style-name")!=null) {
b1 = nodeGraphic.retourneFirstEnfantsByName("number:number-style", "style:name", b2.getAttributs().get("style:apply-style-name"));
if(!b1.isVide()) {
b2 = b1.retourneFirstEnfantsByName("style:text-properties");
if(b2.getAttributs().get("fo:color")!=null) axe.put("Format_2_CouleurNombre", b2.getAttributs().get("fo:color"));
b2 = b1.retourneFirstEnfantsByName("number:number");
if(b2.getAttributs().get("number:min-integer-digits")!=null) axe.put("Format_2_MinimumDigitNombre", b2.getAttributs().get("number:min-integer-digits"));
if(b2.getAttributs().get("loext:min-decimal-places")!=null) axe.put("Format_2_MinimumDecimalNombre", b2.getAttributs().get("loext:min-decimal-places"));
if(b2.getAttributs().get("number:decimal-places")!=null) axe.put("Format_2_DecimalPlaceNombre", b2.getAttributs().get("number:decimal-places"));
}
}
}
}
nodeAC b2 = b.retourneFirstEnfantsByName("style:chart-properties");
if(b2!=null) {
if(b2.getAttributs().get("chart:interval-minor-divisor")!=null) axe.put("NombreIntervalleSecondaire", b2.getAttributs().get("chart:interval-minor-divisor"));
if(b2.getAttributs().get("chart:interval-major")!=null) axe.put("IntervallePrincipal", b2.getAttributs().get("chart:interval-major"));
if(b2.getAttributs().get("chart:origin")!=null) axe.put("Origine", b2.getAttributs().get("chart:origin"));
if(b2.getAttributs().get("chart:maximum")!=null) axe.put("Maximum", b2.getAttributs().get("chart:maximum"));
if(b2.getAttributs().get("chart:minimum")!=null) axe.put("Minium", b2.getAttributs().get("chart:minimum"));
if(b2.getAttributs().get("chart:axis-label-position")!=null) axe.put("PositionEtiquette", b2.getAttributs().get("chart:axis-label-position"));
if(b2.getAttributs().get("chart:axis-position")!=null) axe.put("CroiserAutreAxe", b2.getAttributs().get("chart:axis-position"));
if(b2.getAttributs().get("chart:display-label")!=null) axe.put("AfficheEtiquette", b2.getAttributs().get("chart:display-label"));
if(b2.getAttributs().get("chart:link-data-style-to-source")!=null) axe.put("FormatEtiquetteLierSource", b2.getAttributs().get("chart:link-data-style-to-source"));
if(b2.getAttributs().get("chart:reverse-direction")!=null) axe.put("InverseDirection", b2.getAttributs().get("chart:reverse-direction"));
if(b2.getAttributs().get("chart:logarithmic")!=null) axe.put("Logarithmique", b2.getAttributs().get("chart:logarithmic"));
if(b2.getAttributs().get("style:rotation-angle")!=null) axe.put("RotationEtiquette", b2.getAttributs().get("style:rotation-angle"));
if(b2.getAttributs().get("chart:tick-mark-position")!=null) axe.put("PositionMarque", b2.getAttributs().get("chart:tick-mark-position"));
if(b2.getAttributs().get("chart:tick-marks-minor-outer")!=null) axe.put("MarqueSecondaireExterieur", b2.getAttributs().get("chart:tick-marks-minor-outer"));
if(b2.getAttributs().get("chart:tick-marks-minor-inner")!=null) axe.put("MarqueSecondaireInterieur", b2.getAttributs().get("chart:tick-marks-minor-inner"));
if(b2.getAttributs().get("chart:tick-marks-major-outer")!=null) axe.put("MarquePrincipaleExterieur", b2.getAttributs().get("chart:tick-marks-major-outer"));
if(b2.getAttributs().get("chart:tick-marks-major-inner")!=null) axe.put("MarquePrincipaleInterieur", b2.getAttributs().get("chart:tick-marks-major-inner"));
}
b2 = b.retourneFirstEnfantsByName("style:graphic-properties");
if(b2!=null) {
if(b2.getAttributs().get("svg:stroke-color")!=null) axe.put("CouleurMarque", b2.getAttributs().get("svg:stroke-color"));
if(b2.getAttributs().get("svg:stroke-width")!=null) axe.put("EpaisseurMarque", b2.getAttributs().get("svg:stroke-width"));
}
b2 = b.retourneFirstEnfantsByName("style:text-properties");
if(b2!=null) {
if(b2.getAttributs().get("fo:font-size")!=null) axe.put("TaillePoliceEtiquetteAxe", b2.getAttributs().get("fo:font-size"));
if(b2.getAttributs().get("style:font-style-name")!=null) axe.put("StylePoliceEtiquetteAxe", b2.getAttributs().get("style:font-style-name"));
if(b2.getAttributs().get("fo:font-family")!=null) axe.put("PoliceEtiquetteAxe", b2.getAttributs().get("fo:font-family"));
if(b2.getAttributs().get("style:text-underline-style")!=null) axe.put("StyleSouslignementEtiquetteAxe", b2.getAttributs().get("style:text-underline-style"));
if(b2.getAttributs().get("style:text-underline-width")!=null) axe.put("EpaisseurSouslignementEtiquetteAxe", b2.getAttributs().get("style:text-underline-width"));
if(b2.getAttributs().get("fo:color")!=null) axe.put("CouleurPoliceEtiquetteAxe", b2.getAttributs().get("fo:color"));
if(b2.getAttributs().get("fo:text-shadow")!=null) axe.put("OmbrePoliceEtiquetteAxe", b2.getAttributs().get("fo:text-shadow"));
}
}
// titre axe
b = nodeAxe.retourneFirstEnfantsByName("chart:title");
if(b!=null) {
nodeAC b1 = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", b.getAttributs().get("chart:style-name"));
if(b1!=null) {
nodeAC b2 = b1.retourneFirstEnfantsByName("style:chart-properties");
if(b2!=null) {
if(b2.getAttributs().get("style:rotation-angle")!=null) axe.put("RotationTitreAxe", b2.getAttributs().get("style:rotation-angle"));
if(b2.getAttributs().get("chart:auto-position")!=null) axe.put("PositionAutomatiqueTitreAxe", b2.getAttributs().get("chart:auto-position"));
}
b2 = b1.retourneFirstEnfantsByName("style:text-properties");
if(b2!=null) {
if(b2.getAttributs().get("fo:font-size")!=null) axe.put("TaillePoliceTitreAxe", b2.getAttributs().get("fo:font-size"));
if(b2.getAttributs().get("fo:font-family")!=null) axe.put("PoliceTitreAxe", b2.getAttributs().get("fo:font-family"));
if(b2.getAttributs().get("style:font-style-name")!=null) axe.put("StylePoliceTitreAxe", b2.getAttributs().get("style:font-style-name"));
}
}
}
// données
b = nodeAxe.retourneFirstEnfantsByName("chart:categories");
if(b!=null) if(b.getAttributs().get("table:cell-range-address")!=null) axe.put("Data", b.getAttributs().get("table:cell-range-address"));
// grille
b = nodeAxe.retourneFirstEnfantsByName("chart:grid");
if(b!=null) {
if(b.getAttributs().get("chart:class")!=null) if(b.getAttributs().get("chart:class").equals("major")) {
axe.put("AfficherGrillePrincipale", "true");
nodeAC b1 = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", b.getAttributs().get("chart:style-name"));
if(b1!=null) {
nodeAC b2 = b1.retourneFirstEnfantsByName("style:graphic-properties");
if(b2!=null) {
if(b2.getAttributs().get("svg:stroke-color")!=null) axe.put("CouleurGrillePrincipale", b2.getAttributs().get("svg:stroke-color"));
if(b2.getAttributs().get("svg:stroke-width")!=null) axe.put("EpaisseurGrillePrincipale", b2.getAttributs().get("svg:stroke-width"));
if(b2.getAttributs().get("draw:stroke")!=null) axe.put("TypeTraitGrillePrincipale", b2.getAttributs().get("draw:stroke"));
}
}
}
if(b.getAttributs().get("chart:class")!=null) if(b.getAttributs().get("chart:class").equals("minor")) {
axe.put("AfficherGrilleSecondaire", "true");
nodeAC b1 = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", b.getAttributs().get("chart:style-name"));
if(b1!=null) {
nodeAC b2 = b1.retourneFirstEnfantsByName("style:graphic-properties");
if(b2!=null) {
if(b2.getAttributs().get("svg:stroke-color")!=null) axe.put("CouleurGrilleSecondaire", b2.getAttributs().get("svg:stroke-color"));
if(b2.getAttributs().get("svg:stroke-width")!=null) axe.put("EpaisseurGrilleSecondaire", b2.getAttributs().get("svg:stroke-width"));
if(b2.getAttributs().get("draw:stroke")!=null) axe.put("TypeTraitGrilleSecondaire", b2.getAttributs().get("draw:stroke"));
}
}
}
}
}
}
/**
*
* @param axe
* @param nodeAxe
* @param nodeGraphic
* @param a
*/
public void addSerieProperties(TreeMap<String, String> serie, nodeAC nodeSerie , Integer Num,nodeAC nodeGraphic) {
serie.put("Serie_"+ Num + "_Type",nodeSerie.getAttributs().get("chart:class"));
serie.put("Serie_"+ Num + "_LabelData",nodeSerie.getAttributs().get("chart:label-cell-address"));
serie.put("Serie_"+ Num + "_Data",nodeSerie.getAttributs().get("chart:values-cell-range-address"));
serie.put("Serie_"+ Num + "_AxeAssocier",nodeSerie.getAttributs().get("chart:attached-axis"));
nodeAC b1 = nodeGraphic.retourneFirstEnfantsByName("style:style", "style:name", nodeSerie.getAttributs().get("chart:style-name"));
if(b1!=null) {
nodeAC b2 = b1.retourneFirstEnfantsByName("style:chart-properties");
if(b2!=null) {
if(b2.getAttributs().get("chart:link-data-style-to-source")!=null) serie.put("Serie_"+ Num + "_DataLierAlaSource", b2.getAttributs().get("chart:link-data-style-to-source"));
if(b2.getAttributs().get("chart:data-label-symbol")!=null) serie.put("Serie_"+ Num + "_AfficheSymbolEtiquetteDeValeur", b2.getAttributs().get("chart:data-label-symbol"));
if(b2.getAttributs().get("chart:data-label-text")!=null) serie.put("Serie_"+ Num + "_AfficheCategorieEtiquetteDeValeur", b2.getAttributs().get("chart:data-label-text"));
if(b2.getAttributs().get("chart:data-label-number")!=null) serie.put("Serie_"+ Num + "_FormatEtiquetteValeurSurGraphique", b2.getAttributs().get("chart:data-label-number"));
}
b2 = b1.retourneFirstEnfantsByName("style:graphic-properties");
if(b2!=null) {
if(b2.getAttributs().get("draw:stroke")!=null) serie.put("Serie_"+ Num + "_Bordures", b2.getAttributs().get("draw:stroke"));
if(b2.getAttributs().get("draw:fill-color")!=null) serie.put("Serie_"+ Num + "_Couleur", b2.getAttributs().get("draw:fill-color"));
}
b2 = b1.retourneFirstEnfantsByName("style:text-properties");
if(b2!=null) {
if(b2.getAttributs().get("fo:font-size")!=null) serie.put("Serie_"+ Num + "_TaillePolice", b2.getAttributs().get("fo:font-size"));
if(b2.getAttributs().get("style:font-style-name")!=null) serie.put("Serie_"+ Num + "_StylePolice", b2.getAttributs().get("style:font-style-name"));
if(b2.getAttributs().get("fo:font-family")!=null) serie.put("Serie_"+ Num + "_Police", b2.getAttributs().get("fo:font-family"));
}
}
}
public String getTitreAfficherFeedBack() {
return TitreAfficherFeedBack;
}
public String getCommunication() {
return communication;
}
public TreeMap<String, String> getSeries() {
return series;
}
public TreeMap<String, String> getAiregraphic() {
return airegraphic;
}
public TreeMap<String, String> getSoustitre() {
return soustitre;
}
public TreeMap<String, String> getTitre() {
return titre;
}
public String getTitreGraphique() {
return TitreGraphique;
}
public String getTitreNettoyer() {
return TitreNettoyer;
}
public TreeMap<String, String> getLegend() {
return legend;
}
public TreeMap<String, String> getAxeXprincipal() {
return axeXprincipal;
}
public TreeMap<String, String> getAxeYprincipal() {
return axeYprincipal;
}
public TreeMap<String, String> getAxeXsecondaire() {
return axeXsecondaire;
}
public TreeMap<String, String> getAxeYsecondaire() {
return axeYsecondaire;
}
public String getEvaluer() {
return evaluer;
}
public String getType() {
return type;
}
public TreeMap<String, String> getPropertiesGraphic() {
return propertiesGraphic;
}
public void setPropertiesGraphic(TreeMap<String, String> propertiesGraphic) {
this.propertiesGraphic = propertiesGraphic;
}
public String getNomObjet() {
return nomObjet;
}
}
/*******************************************
* Class ligne
* @author Pablo
*
*******************************************/
public class ligne{
private String RefLigne ;
private String evaluer = "false";
private String communication ="";
private String titre="";
private boolean saut = false;
private String styletitrePrincipale = "H1";
private TreeMap<String,String> propertiesRow = new TreeMap<String,String>();
private TreeMap<Integer,cellule> cellules = new TreeMap<Integer,cellule>();
/**
* Chargement du sujet
* @param nodeLigne
* @param numLigne
*/
public ligne(nodeAC nodeLigne, String numLigne) {
//lecture sujet (propertiesRow)
RefLigne = numLigne;
nodeAC properties = nodeLigne.retourneFirstEnfantsByName("propertiesRow");
if(properties.getAttributs().get("Style")!=null) propertiesRow.put("Style", properties.getAttributs().get("Style"));
if(properties.getAttributs().get("HauteurLigne")!=null) propertiesRow.put("HauteurLigne", properties.getAttributs().get("HauteurLigne"));
if(properties.getAttributs().get("RefLigne")!=null) propertiesRow.put("RefLigne", properties.getAttributs().get("RefLigne"));
if(properties.getAttributs().get("evaluer")!=null) propertiesRow.put("evaluer", properties.getAttributs().get("evaluer"));
if(properties.getAttributs().get("styletitre")!=null) propertiesRow.put("styletitre", properties.getAttributs().get("styletitre"));
nodeAC comm = nodeLigne.retourneFirstEnfantsByName("communication");
if(!comm.isVide()) communication=comm.retourneLesContenusEnfants("");
//lecture sujet les attributs de la ligne
if(nodeLigne.getAttributs().get("evaluer")!=null) evaluer=nodeLigne.getAttributs().get("evaluer");
if(nodeLigne.getAttributs().get("titre")!=null) titre=nodeLigne.getAttributs().get("titre");
if(nodeLigne.getAttributs().get("saut")!=null) saut=Boolean.valueOf(nodeLigne.getAttributs().get("saut"));
if(nodeLigne.getAttributs().get("styletitre")!=null) styletitrePrincipale=nodeLigne.getAttributs().get("styletitre");
// les cellules de la ligne
ArrayList<nodeAC> cels = nodeLigne.retourneListEnfantsByName("cellule");
for(int i = 0 ; i < cels.size();i++) {
cellules.put(i , new cellule(cels.get(i),numLigne,cels.get(i).getAttributs().get("RefColonne")));
}
}
/**
* Chragement d'une nouvelle ligne
* @param nodeLigne : nodeAC de la ligne actuelle
* @param numLigne : numéro de la ligne
* @param XMLContent
* @param a
* @throws IOException
*/
public ligne(nodeAC nodeLigne, String numLigne,nodeAC nod, Integer indexStudent) throws IOException {
RefLigne= numLigne;
int numeroLigne = Integer.valueOf(numLigne);
// chargement
if(nodeLigne.getAttributs().get("table:style-name")!=null) propertiesRow.put("Style", nodeLigne.getAttributs().get("table:style-name"));
if(nodeLigne.getAttributs().get("table:number-rows-repeated")!=null) propertiesRow.put("Repetition", nodeLigne.getAttributs().get("table:number-rows-repeated"));
propertiesRow.put("RefLigne", numLigne);
//chargement
propertiesRow.put("evaluer", "false");
//Le style pour obtenir la hauteur de la ligne
ArrayList<nodeAC> cels = nod.retourneListEnfantsByName("style:style", "style:name", propertiesRow.get("Style"));
if(cels.size()>0) {
nodeAC b = cels.get(0).retourneFirstEnfantsByName("style:table-row-properties");
if(b!=null) {
if(b.getAttributs().get("style:row-height")!=null) propertiesRow.put("HauteurLigne",b.getAttributs().get("style:row-height"));
}
}
// chargement d'une nouvelle cellule
cels = nodeLigne.retourneListEnfantsByName("table:table-cell"); // cels sont les cellules de la ligne actuelle
int nombreRepetitioncolonne = 0; // concerne les cellules de la ligne actuelle (pas suivante)
int nombreRepetitionligne = 0;
for(int i = 0 ; i < cels.size();i++) {
if(i>0) if(cellules.get(i-1).propertiesCell.get("RepetitionColumn")!=null || cellules.get(i-1).propertiesCell.get("FusionColumn")!=null ) {
if(cellules.get(i-1).propertiesCell.get("RepetitionColumn")!=null ) nombreRepetitioncolonne = nombreRepetitioncolonne + Integer.valueOf(cellules.get(i-1).propertiesCell.get("RepetitionColumn"))-1;
if(cellules.get(i-1).propertiesCell.get("FusionColumn")!=null ) nombreRepetitioncolonne = nombreRepetitioncolonne + Integer.valueOf(cellules.get(i-1).propertiesCell.get("FusionColumn"))-1;
}
//Fusion des lignes et des colonnes
if(numeroLigne>1) {
for(int k = 0; k < lignes.size();k++) {
if(Integer.valueOf(lignes.get(k).getRefLigne())<numeroLigne) {
if(lignes.get(k).getCellules().size()>0) {
for(int l = 0 ; l < lignes.get(k).getCellules().size();l++) {
if(Integer.valueOf(lignes.get(k).getCellules().get(l).getRefColonne())<=i+1) {
cellule ce = lignes.get(k).getCellules().get(l);
String fusLigne = ce.getPropertiesCell().get("FusionRow");
if(fusLigne!=null) {
if(Integer.valueOf(fusLigne)>1) {
nombreRepetitioncolonne=0;
int decalageColonne = Integer.valueOf(lignes.get(k).getCellules().get(l).getRefColonne())-Integer.valueOf(ce.getRefColonne());
int line = Integer.valueOf(ce.getRefLigne());
if(numeroLigne<line+Integer.valueOf(fusLigne)) {
nombreRepetitioncolonne=nombreRepetitioncolonne+Integer.valueOf(ce.getPropertiesCell().get("FusionColumn"))-decalageColonne;
fusLigne="";
}
}
}
}
}
}
}
}
}
cellules.put(i , new cellule(cels.get(i),String.valueOf(numeroLigne + nombreRepetitionligne),String.valueOf(i+1+nombreRepetitioncolonne),nod,indexStudent));
}
}
public String getRefLigne() {
return RefLigne;
}
public void setRefLigne(String refLigne) {
RefLigne = refLigne;
}
public TreeMap<String, String> getPropertiesRow() {
return propertiesRow;
}
public TreeMap<Integer, cellule> getCellules() {
return cellules;
}
public String getEvaluer() {
return evaluer;
}
public String getCommunication() {
return communication;
}
public String getTitre() {
return titre;
}
public boolean isSaut() {
return saut;
}
public String getStyletitrePrincipale() {
return styletitrePrincipale;
}
/*********************************************
* Class cellule
* @author Pablo
*
********************************************/
public class cellule{
private String evaluer = "false";
private String refLigne;
private String refColonne;
private String RefColDansClasseur;
private String RefLigDansClasseur;
private String styletitre = "H1";
private boolean Menu = true;
private boolean FusionLigne = false;
private boolean saut = false;
private String titre="";
private validation val = new validation();
private TreeMap<String,String> propertiesCell = new TreeMap<String,String>();
private graphic Graph = null;
/**
* Sujet
* @param cel
* @param numLigne
* @param numColonne
*/
public cellule(nodeAC cel,String numLigne,String numColonne) {
refLigne = numLigne;
refColonne = numColonne;
RefColDansClasseur = ConvertirNumColonneEnString(Integer.valueOf(refColonne));
RefLigDansClasseur = refLigne;
valeurParDefault();
nodeAC c = cel.retourneFirstEnfantsByName("propertiesCell");
if(c.getAttributs().get("Style")!=null) propertiesCell.put("Style",c.getAttributs().get("Style"));
if(c.getAttributs().get("TypeValue")!=null) propertiesCell.put("TypeValue",c.getAttributs().get("TypeValue"));
if(c.getAttributs().get("DateValue")!=null) propertiesCell.put("DateValue",c.getAttributs().get("DateValue"));
if(c.getAttributs().get("NomValidation")!=null) propertiesCell.put("NomValidation",c.getAttributs().get("NomValidation"));
if(c.getAttributs().get("Format_NombreMiniDigit")!=null) propertiesCell.put("Format_NombreMiniDigit",c.getAttributs().get("Format_NombreMiniDigit"));
if(c.getAttributs().get("Format_NombreDecimale")!=null) propertiesCell.put("Format_NombreDecimale",c.getAttributs().get("Format_NombreDecimale"));
if(c.getAttributs().get("Format_DateJour")!=null) propertiesCell.put("Format_DateJour",c.getAttributs().get("Format_DateJour"));
if(c.getAttributs().get("Format_DateMois")!=null) propertiesCell.put("Format_DateMois",c.getAttributs().get("Format_DateMois"));
if(c.getAttributs().get("Format_DateAnnee")!=null) propertiesCell.put("Format_DateAnnee",c.getAttributs().get("Format_DateAnnee"));
if(c.getAttributs().get("Format_DateJourText")!=null) propertiesCell.put("Format_DateJourText",c.getAttributs().get("Format_DateJourText"));
if(c.getAttributs().get("Format_DateTexte")!=null) propertiesCell.put("Format_DateTexte",c.getAttributs().get("Format_DateTexte"));
if(c.getAttributs().get("Format_NotationScientifique")!=null) propertiesCell.put("Format_NotationScientifique",c.getAttributs().get("Format_NotationScientifique"));
if(c.getAttributs().get("Format_SigneExposant")!=null) propertiesCell.put("Format_SigneExposant",c.getAttributs().get("Format_SigneExposant"));
if(c.getAttributs().get("Format_IntervalleExposant")!=null) propertiesCell.put("Format_IntervalleExposant",c.getAttributs().get("Format_IntervalleExposant"));
if(c.getAttributs().get("Format_NombreMiniDigitExposant")!=null) propertiesCell.put("Format_NombreMiniDigitExposant",c.getAttributs().get("Format_NombreMiniDigitExposant"));
if(c.getAttributs().get("Format_NombreMiniEntierValeur")!=null) propertiesCell.put("Format_NombreMiniEntierValeur",c.getAttributs().get("Format_NombreMiniEntierValeur"));
if(c.getAttributs().get("Format_NombreMiniDecimale")!=null) propertiesCell.put("Format_NombreMiniDecimale",c.getAttributs().get("Format_NombreMiniDecimale"));
if(c.getAttributs().get("Format_NombreDecimale")!=null) propertiesCell.put("Format_NombreDecimale",c.getAttributs().get("Format_NombreDecimale"));
if(c.getAttributs().get("Format_Fraction")!=null) propertiesCell.put("Format_Fraction",c.getAttributs().get("Format_Fraction"));
if(c.getAttributs().get("Format_NombreMiniEntierValeur")!=null) propertiesCell.put("Format_NombreMiniEntierValeur",c.getAttributs().get("Format_NombreMiniEntierValeur"));
if(c.getAttributs().get("Format_NombreMaxDenominateur")!=null) propertiesCell.put("Format_NombreMaxDenominateur",c.getAttributs().get("Format_NombreMaxDenominateur"));
if(c.getAttributs().get("Format_NombreMiniDigitDenominateur")!=null) propertiesCell.put("Format_NombreMiniDigitDenominateur",c.getAttributs().get("Format_NombreMiniDigitDenominateur"));
if(c.getAttributs().get("Format_NombreMaxEntierValeur")!=null) propertiesCell.put("Format_NombreMaxEntierValeur",c.getAttributs().get("Format_NombreMaxEntierValeur"));
if(c.getAttributs().get("Format_NombreMaxNumerateur")!=null) propertiesCell.put("Format_NombreMaxNumerateur",c.getAttributs().get("Format_NombreMaxNumerateur"));
if(c.getAttributs().get("Format_NombreMiniDigitNumerateur")!=null) propertiesCell.put("Format_NombreMiniDigitNumerateur",c.getAttributs().get("Format_NombreMiniDigitNumerateur"));
if(c.getAttributs().get("Device")!=null) propertiesCell.put("Device",c.getAttributs().get("Device"));
if(c.getAttributs().get("Symbol-Unit")!=null) propertiesCell.put("Symbol-Unit",c.getAttributs().get("Symbol-Unit"));
if(c.getAttributs().get("Formule")!=null) propertiesCell.put("Formule",c.getAttributs().get("Formule"));
if(c.getAttributs().get("FormuleMatrixLigne")!=null) propertiesCell.put("FormuleMatrixLigne",c.getAttributs().get("FormuleMatrixLigne"));
if(c.getAttributs().get("FormuleMatrixColonne")!=null) propertiesCell.put("FormuleMatrixColonne",c.getAttributs().get("FormuleMatrixColonne"));
if(c.getAttributs().get("FusionColumn")!=null) propertiesCell.put("FusionColumn",c.getAttributs().get("FusionColumn"));
if(c.getAttributs().get("FusionRow")!=null) propertiesCell.put("FusionRow",c.getAttributs().get("FusionRow"));
if(c.getAttributs().get("AjusteLeTexte")!=null) propertiesCell.put("AjusteLeTexte",c.getAttributs().get("AjusteLeTexte"));
if(c.getAttributs().get("BordureHaute")!=null) propertiesCell.put("BordureHaute",c.getAttributs().get("BordureHaute"));
if(c.getAttributs().get("BordureDroite")!=null) propertiesCell.put("BordureDroite",c.getAttributs().get("BordureDroite"));
if(c.getAttributs().get("BordureGauche")!=null) propertiesCell.put("BordureGauche",c.getAttributs().get("BordureGauche"));
if(c.getAttributs().get("BordureBasse")!=null) propertiesCell.put("BordureBasse",c.getAttributs().get("BordureBasse"));
if(c.getAttributs().get("CouleurArrierPlan")!=null) propertiesCell.put("CouleurArrierPlan",c.getAttributs().get("CouleurArrierPlan"));
if(c.getAttributs().get("CouleurPolice")!=null) propertiesCell.put("CouleurPolice",c.getAttributs().get("CouleurPolice"));
if(c.getAttributs().get("AlignementVertical")!=null) propertiesCell.put("AlignementVertical",c.getAttributs().get("AlignementVertical"));
if(c.getAttributs().get("Bordures")!=null) propertiesCell.put("Bordures",c.getAttributs().get("Bordures"));
if(c.getAttributs().get("AlignementText")!=null) propertiesCell.put("AlignementText",c.getAttributs().get("AlignementText"));
if(c.getAttributs().get("MargeGauche")!=null) propertiesCell.put("MargeGauche",c.getAttributs().get("MargeGauche"));
if(c.getAttributs().get("CouleurRemplissage")!=null) propertiesCell.put("CouleurRemplissage",c.getAttributs().get("CouleurRemplissage"));
if(c.getAttributs().get("Police")!=null) propertiesCell.put("Police",c.getAttributs().get("Police"));
if(c.getAttributs().get("FontEpaisseur")!=null) propertiesCell.put("FontEpaisseur",c.getAttributs().get("fo:font-weight"));
if(c.getAttributs().get("RepetitionColumn")!=null) propertiesCell.put("RepetitionColumn",c.getAttributs().get("RepetitionColumn"));
if(c.getAttributs().get("contenuCell")!=null) propertiesCell.put("contenuCell",c.getAttributs().get("contenuCell"));
if(c.getAttributs().get("xlink:type")!=null) propertiesCell.put("xlink:type",c.getAttributs().get("xlink:type"));
if(c.getAttributs().get("xlink:ref")!=null) propertiesCell.put("xlink:ref",c.getAttributs().get("xlink:ref"));
if(c.getAttributs().get("LargeurColonne")!=null) propertiesCell.put("LargeurColonne",c.getAttributs().get("LargeurColonne"));
if(cel.getAttributs().get("evaluer")!=null) evaluer = cel.getAttributs().get("evaluer");
if(cel.getAttributs().get("menu")!=null) Menu = Boolean.valueOf(cel.getAttributs().get("menu"));
if(cel.getAttributs().get("styletitre")!=null) styletitre = cel.getAttributs().get("styletitre");
if(cel.getAttributs().get("saut")!=null) saut = Boolean.valueOf(cel.getAttributs().get("saut"));
if(cel.getAttributs().get("titre")!=null) titre = cel.getAttributs().get("titre");
// validation pour le sujet
nodeAC nods = cel.retourneFirstEnfantsByName("validation");
if(!nods.isVide()) val.ajouteValidationProperties(nods);
}
/**
* Chargement d'un nouvelle cellule
* @param cel
* @param numLigne
* @param numColonne
* @param XMLContent
* @param a
* @throws IOException
*/
public cellule(nodeAC cel,String numLigne,String numColonne,nodeAC nod, Integer indexStudent) throws IOException {
refLigne = numLigne;
refColonne = numColonne;
RefColDansClasseur = ConvertirNumColonneEnString(Integer.valueOf(refColonne));
RefLigDansClasseur = refLigne;
valeurParDefault();
propertiesCell.put("Style",cel.getAttributs().get("table:style-name"));
if(cel.getAttributs().get("table:style-name")!=null) propertiesCell.put("Style",cel.getAttributs().get("table:style-name"));
if(cel.getAttributs().get("calcext:value-type")!=null) propertiesCell.put("TypeValue",cel.getAttributs().get("calcext:value-type"));
if(cel.getAttributs().get("office:currency")!=null) propertiesCell.put("Devise",cel.getAttributs().get("office:currency"));
if(cel.getAttributs().get("office:date-value")!=null) propertiesCell.put("DateValue",cel.getAttributs().get("office:date-value"));
if(cel.getAttributs().get("table:content-validation-name")!=null) propertiesCell.put("NomValidation",cel.getAttributs().get("table:content-validation-name"));
if(cel.getAttributs().get("table:formula")!=null) propertiesCell.put("Formule",cel.getAttributs().get("table:formula"));
if(cel.getAttributs().get("table:number-matrix-rows-spanned")!=null) propertiesCell.put("FormuleMatrixLigne",cel.getAttributs().get("table:number-matrix-rows-spanned"));
if(cel.getAttributs().get("table:number-matrix-columns-spanned")!=null) propertiesCell.put("FormuleMatrixColonne",cel.getAttributs().get("table:number-matrix-columns-spanned"));
if(cel.getAttributs().get("table:number-columns-repeated")!=null) propertiesCell.put("RepetitionColumn",cel.getAttributs().get("table:number-columns-repeated"));
if(cel.getAttributs().get("table:number-columns-spanned")!=null) propertiesCell.put("FusionColumn",cel.getAttributs().get("table:number-columns-spanned"));
if(cel.getAttributs().get("table:number-rows-spanned")!=null) {
propertiesCell.put("FusionRow",cel.getAttributs().get("table:number-rows-spanned"));
FusionLigne=true;
}
colonne col = retourneColonne(refColonne);
if(col!=null) {
String LargeurColonne = col.getPropertiesColumn().get("LargeurColonne");
if(LargeurColonne!=null) if(!LargeurColonne.isEmpty()) propertiesCell.put("LargeurColonne",LargeurColonne);
}
nodeAC c = cel.retourneFirstEnfantsByName("text:p");
if(c!=null) {
propertiesCell.put("contenuCell", c.retourneLesContenusEnfants(""));
c = c.retourneFirstEnfantsByName("text:a");
if(c!=null) {
propertiesCell.put("TypeLien", c.getAttributs().get("xlink:type"));
propertiesCell.put("Lien", c.getAttributs().get("xlink:ref"));
}
}
// En premier lieu le style par défaut de la colonne
ArrayList<nodeAC> s1 = new ArrayList<nodeAC>();
if(col!=null) {
String st2 = col.getPropertiesColumn().get("Style");
s1 = nod.retourneListEnfantsByName("style:style", "style:name",st2);
if(s1.size()>0) {
nodeAC n1 = s1.get(0);
addProperties(n1);
}
st2 = col.getPropertiesColumn().get("StyleDefautCell");
s1 = nod.retourneListEnfantsByName("style:style", "style:name",st2);
if(s1.size()>0) {
nodeAC n1 = s1.get(0);
addProperties(n1);
}
}
// En seconde lieu le style de la cellule qui écrase le style de la colonne
s1 = nod.retourneListEnfantsByName("style:style", "style:name",propertiesCell.get("Style"));
if(s1.size()>0) {
nodeAC n1 = s1.get(0);
addProperties(n1);
//le style du format
String styleFormatData = n1.getAttributs().get("style:data-style-name");
if(styleFormatData!=null) {
s1 = nod.retourneListEnfantsByName("number:number-style", "style:name",styleFormatData);
if(s1.size()>0) {
n1 = s1.get(0);
addProperties(n1);
}
s1 = nod.retourneListEnfantsByName("number:date-style", "style:name",styleFormatData);
if(s1.size()>0) {
n1 = s1.get(0);
addProperties(n1);
}
s1 = nod.retourneListEnfantsByName("number:percentage-style", "style:name",styleFormatData);
if(s1.size()>0) {
n1 = s1.get(0);
addProperties(n1);
}
}
}
// validation de données
if(propertiesCell.get("NomValidation")!=null) {
ArrayList<nodeAC> v = nod.retourneListEnfantsByName("table:content-validation","table:name", propertiesCell.get("NomValidation"));
if(v.size()>0) val.ajouteValidationProperties(v.get(0));
}
// graphique ancrer à la cellule
c = cel.retourneFirstEnfantsByName("draw:frame");
if(c!=null) {
Graph = new graphic(c, nod, indexStudent);
}
}
/**
* Valeur par défaut
*/
public void valeurParDefault() {
propertiesCell.put("MargeGauche","default");
propertiesCell.put("AlignementText","default");
propertiesCell.put("CouleurPolice","default");
propertiesCell.put("FontTaille","default");
propertiesCell.put("AlignementVertical","default");
propertiesCell.put("AjusteLeTexte","default");
}
/**
* Ajoute des propriétés à partir des différents styles (cellule, colonne)
* @param n1
*/
public void addProperties(nodeAC n1) {
if(n1.getAttributs().get("style:data-style-name")!=null) getPropertiesCell().put("StyleDate",n1.getAttributs().get("style:data-style-name"));
if(n1.getAttributs().get("style:parent-style-name")!=null) getPropertiesCell().put("StyleParent",n1.getAttributs().get("style:parent-style-name"));
nodeAC n2 = n1.retourneFirstEnfantsByName("style:table-cell-properties");
if(n2!=null) {
if(n2.getAttributs().get("fo:border")!=null) {
getPropertiesCell().put("Bordures",n2.getAttributs().get("fo:border"));
getPropertiesCell().remove("BordureHaute");
getPropertiesCell().remove("BordureDroite");
getPropertiesCell().remove("BordureGauche");
getPropertiesCell().remove("BordureBasse");
}
if(n2.getAttributs().get("fo:border-top")!=null) { getPropertiesCell().put("BordureHaute",n2.getAttributs().get("fo:border-top"));getPropertiesCell().remove("Bordures");}
if(n2.getAttributs().get("fo:border-right")!=null) { getPropertiesCell().put("BordureDroite",n2.getAttributs().get("fo:border-right"));getPropertiesCell().remove("Bordures");}
if(n2.getAttributs().get("fo:border-left")!=null) { getPropertiesCell().put("BordureGauche",n2.getAttributs().get("fo:border-left"));getPropertiesCell().remove("Bordures");}
if(n2.getAttributs().get("fo:border-bottom")!=null) { getPropertiesCell().put("BordureBasse",n2.getAttributs().get("fo:border-bottom"));getPropertiesCell().remove("Bordures");}
if(n2.getAttributs().get("style:vertical-align")!=null) getPropertiesCell().put("AlignementVertical",n2.getAttributs().get("style:vertical-align"));
if(n2.getAttributs().get("fo:background-color")!=null) getPropertiesCell().put("CouleurArrierPlan",n2.getAttributs().get("fo:background-color"));
if(n2.getAttributs().get("fo:wrap-option")!=null) getPropertiesCell().put("AjusteLeTexte",n2.getAttributs().get("fo:wrap-option"));
}
n2 = n1.retourneFirstEnfantsByName("style:table-column-properties");
if(n2!=null) {
if(n2.getAttributs().get("style:column-width")!=null) getPropertiesCell().put("LargeurColonne",n2.getAttributs().get("style:column-width"));
}
n2 = n1.retourneFirstEnfantsByName("style:paragraph-properties");
if(n2!=null) {
if(n2.getAttributs().get("fo:margin-left")!=null) getPropertiesCell().put("MargeGauche",n2.getAttributs().get("fo:margin-left"));
if(n2.getAttributs().get("fo:text-align")!=null) getPropertiesCell().put("AlignementText",n2.getAttributs().get("fo:text-align"));
}
n2 = n1.retourneFirstEnfantsByName("style:text-properties");
if(n2!=null) {
if(n2.getAttributs().get("style:font-name")!=null) getPropertiesCell().put("Police",n2.getAttributs().get("style:font-name"));
if(n2.getAttributs().get("fo:color")!=null) getPropertiesCell().put("CouleurPolice",n2.getAttributs().get("fo:color"));
if(n2.getAttributs().get("fo:font-weight")!=null) getPropertiesCell().put("FontEpaisseur",n2.getAttributs().get("fo:font-weight"));
if(n2.getAttributs().get("fo:font-size")!=null) getPropertiesCell().put("FontTaille",n2.getAttributs().get("fo:font-size"));
}
n2 = n1.retourneFirstEnfantsByName("number:number");
if(n2!=null) {
if(n2.getAttributs().get("number:min-integer-digits")!=null) getPropertiesCell().put("Format_NombreMiniDigit",n2.getAttributs().get("number:min-integer-digits"));
if(n2.getAttributs().get("number:decimal-places")!=null) getPropertiesCell().put("Format_NombreDecimale",n2.getAttributs().get("number:decimal-places"));
n2 = n1.retourneFirstEnfantsByName("number:text");
if(n2!=null) if(n2.getContenu().size()>0) getPropertiesCell().put("Symbol-Unit",n2.getContenu().get(0));
}
n2 = n1.retourneFirstEnfantsByName("number:scientific-number");
if(n2!=null) {
getPropertiesCell().put("Format_NotationScientifique","true");
if(n2.getAttributs().get("loext:forced-exponent-sign")!=null) getPropertiesCell().put("Format_SigneExposant",n2.getAttributs().get("loext:forced-exponent-sign"));
if(n2.getAttributs().get("loext:exponent-interval")!=null) getPropertiesCell().put("Format_IntervalleExposant",n2.getAttributs().get("loext:exponent-interval"));
if(n2.getAttributs().get("number:min-exponent-digits")!=null) getPropertiesCell().put("Format_NombreMiniDigitExposant",n2.getAttributs().get("number:min-exponent-digits"));
if(n2.getAttributs().get("number:min-integer-digits")!=null) getPropertiesCell().put("Format_NombreMiniEntierValeur",n2.getAttributs().get("number:min-integer-digits"));
if(n2.getAttributs().get("loext:min-decimal-places")!=null) getPropertiesCell().put("Format_NombreMiniDecimale",n2.getAttributs().get("loext:min-decimal-places"));
if(n2.getAttributs().get("number:decimal-places")!=null) getPropertiesCell().put("Format_NombreDecimale",n2.getAttributs().get("number:decimal-places"));
}
n2 = n1.retourneFirstEnfantsByName("number:fraction");
if(n2!=null) {
getPropertiesCell().put("Format_Fraction","true");
if(n2.getAttributs().get("number:min-integer-digits")!=null) getPropertiesCell().put("Format_NombreMiniEntierValeur",n2.getAttributs().get("number:min-integer-digits"));
if(n2.getAttributs().get("loext:max-denominator-value")!=null) getPropertiesCell().put("Format_NombreMaxDenominateur",n2.getAttributs().get("loext:max-denominator-value"));
if(n2.getAttributs().get("number:min-denominator-digits")!=null) getPropertiesCell().put("Format_NombreMiniDigitDenominateur",n2.getAttributs().get("number:min-denominator-digits"));
if(n2.getAttributs().get("loext:max-numerator-digits")!=null) getPropertiesCell().put("Format_NombreMaxEntierValeur",n2.getAttributs().get("loext:max-numerator-digits"));
if(n2.getAttributs().get("loext:min-decimal-places")!=null) getPropertiesCell().put("Format_NombreMaxNumerateur",n2.getAttributs().get("loext:min-decimal-places"));
if(n2.getAttributs().get("number:min-numerator-digits")!=null) getPropertiesCell().put("Format_NombreMiniDigitNumerateur",n2.getAttributs().get("number:min-numerator-digits"));
}
n2 = n1.retourneFirstEnfantsByName("number:percentage-style");
if(n2!=null) {
if(n2.getAttributs().get("number:min-integer-digits")!=null) getPropertiesCell().put("Format_NombreMiniDigit",n2.getAttributs().get("number:min-integer-digits"));
if(n2.getAttributs().get("number:decimal-places")!=null) getPropertiesCell().put("Format_NombreDecimale",n2.getAttributs().get("number:decimal-places"));
}
if(n1.getAttributs().get("number:format-source")!=null) getPropertiesCell().put("Format_DateTexte",n1.getAttributs().get("number:format-source"));
n2 = n1.retourneFirstEnfantsByName("number:day");
if(n2!=null) {
if(n2.getAttributs().size()==0) getPropertiesCell().put("Format_DateJour","default");
if(n2.getAttributs().get("number:style")!=null) getPropertiesCell().put("Format_DateJour",n2.getAttributs().get("number:style"));
}
n2 = n1.retourneFirstEnfantsByName("number:day-of-week");
if(n2!=null) {
if(n2.getAttributs().get("number:style")!=null) getPropertiesCell().put("Format_DateJourText",n2.getAttributs().get("number:style"));
}
n2 = n1.retourneFirstEnfantsByName("number:month");
if(n2!=null) {
if(n2.getAttributs().get("number:style")!=null) getPropertiesCell().put("Format_DateMois",n2.getAttributs().get("number:style"));
if(n2.getAttributs().get("number:textual")!=null) getPropertiesCell().put("Format_DateMoisTextuel",n2.getAttributs().get("number:textual"));
}
n2 = n1.retourneFirstEnfantsByName("number:year");
if(n2!=null) {
if(n2.getAttributs().size()==0) getPropertiesCell().put("Format_DateAnnee","default");
if(n2.getAttributs().get("number:style")!=null) getPropertiesCell().put("Format_DateAnnee",n2.getAttributs().get("number:style"));
}
}
/**
* Constructeur cellule vide
*/
public cellule() {
}
public graphic getGraph() {
return Graph;
}
public String getEvaluer() {
return evaluer;
}
public boolean isMenu() {
return Menu;
}
public String getRefLigne() {
return refLigne;
}
public void setRefLigne(String refLigne) {
this.refLigne = refLigne;
}
public String getRefColonne() {
return refColonne;
}
public String getTitre() {
return titre;
}
public void setRefColonne(String refColonne) {
this.refColonne = refColonne;
}
public String getRefColDansClasseur() {
return RefColDansClasseur;
}
public void setRefColDansClasseur(String refColDansClasseur) {
RefColDansClasseur = refColDansClasseur;
}
public String getRefLigDansClasseur() {
return RefLigDansClasseur;
}
public validation getVal() {
return val;
}
public TreeMap<String, String> getPropertiesCell() {
return propertiesCell;
}
public void setVal(validation val) {
this.val = val;
}
public String getStyletitre() {
return styletitre;
}
public boolean isFusionLigne() {
return FusionLigne;
}
public void setFusionLigne(boolean fusionLigne) {
FusionLigne = fusionLigne;
}
public boolean isSaut() {
return saut;
}
/***************************************************
* Class validation de données
* @author Pablo
*
***************************************************/
public class validation{
private boolean evaluer = false;
private boolean saut = false;
private boolean empty = true;
private String styletitre = "H1";
private TreeMap<String,String> propertiesValidation = new TreeMap<String,String>();
public void ajouteValidationProperties(nodeAC v) {
//chargement
if(v.getAttributs().get("table:name")!=null) propertiesValidation.put("Nom", v.getAttributs().get("table:name"));
if(v.getAttributs().get("table:base-cell-address")!=null) propertiesValidation.put("StartCell", v.getAttributs().get("table:base-cell-address"));
if(v.getAttributs().get("table:allow-empty-cell")!=null) propertiesValidation.put("AutoriseVide", v.getAttributs().get("table:allow-empty-cell"));
if(v.getAttributs().get("table:condition")!=null) propertiesValidation.put("Condition", v.getAttributs().get("table:condition"));
nodeAC v1 = v.retourneFirstEnfantsByName("table:help-message");
if(v1.getAttributs().get("table:title")!=null) propertiesValidation.put("TitreHelp", v1.getAttributs().get("table:title"));
if(v1.getAttributs().get("table:display")!=null) propertiesValidation.put("AfficheHelp", v1.getAttributs().get("table:display"));
v1 = v1.retourneFirstEnfantsByName("text:p");
propertiesValidation.put("ContenuMessageHelp", v1.retourneLesContenusEnfants(""));
v1 = v.retourneFirstEnfantsByName("table:error-message");
if(v1.getAttributs().get("table:title")!=null) propertiesValidation.put("TitreError", v1.getAttributs().get("table:title"));
if(v1.getAttributs().get("table:display")!=null) propertiesValidation.put("AfficheError", v1.getAttributs().get("table:display"));
if(v1.getAttributs().get("table:message-type")!=null) propertiesValidation.put("TypeError", v1.getAttributs().get("table:message-type"));
v1 = v1.retourneFirstEnfantsByName("text:p");
propertiesValidation.put("ContenuMessageError", v1.retourneLesContenusEnfants(""));
//sujet
if(v.getAttributs().get("Nom")!=null) propertiesValidation.put("Nom", v.getAttributs().get("Nom"));
if(v.getAttributs().get("StartCell")!=null) propertiesValidation.put("StartCell", v.getAttributs().get("StartCell"));
if(v.getAttributs().get("AutoriseVide")!=null) propertiesValidation.put("AutoriseVide", v.getAttributs().get("AutoriseVide"));
if(v.getAttributs().get("Condition")!=null) propertiesValidation.put("Condition", v.getAttributs().get("Condition"));
if(v.getAttributs().get("TitreHelp")!=null) propertiesValidation.put("TitreHelp", v.getAttributs().get("TitreHelp"));
if(v.getAttributs().get("AfficheHelp")!=null) propertiesValidation.put("AfficheHelp", v.getAttributs().get("AfficheHelp"));
if(v.getAttributs().get("ContenuMessageHelp")!=null) propertiesValidation.put("ContenuMessageHelp", v.getAttributs().get("ContenuMessageHelp"));
if(v.getAttributs().get("TitreError")!=null) propertiesValidation.put("TitreError", v.getAttributs().get("TitreError"));
if(v.getAttributs().get("AfficheError")!=null) propertiesValidation.put("AfficheError", v.getAttributs().get("AfficheError"));
if(v.getAttributs().get("TypeError")!=null) propertiesValidation.put("TypeError", v.getAttributs().get("TypeError"));
if(v.getAttributs().get("ContenuMessageError")!=null) propertiesValidation.put("ContenuMessageError", v.getAttributs().get("ContenuMessageError"));
if(v.getAttributs().get("evaluer")!=null) evaluer = Boolean.valueOf(v.getAttributs().get("evaluer"));
if(v.getAttributs().get("styletitre")!=null) styletitre = v.getAttributs().get("styletitre");
if(v.getAttributs().get("saut")!=null) saut = Boolean.valueOf(v.getAttributs().get("saut"));
empty=false;
}
public validation() {
}
public String getStyletitre() {
return styletitre;
}
public boolean isEmpty() {
return empty;
}
public void setEmpty(boolean empty) {
this.empty = empty;
}
public TreeMap<String, String> getPropertiesValidation() {
return propertiesValidation;
}
public boolean isSaut() {
return saut;
}
public boolean isEvaluer() {
return evaluer;
}
} //validation
} //cellule
} // ligne
} // feuille
// /**
// * Ecriture des objets dans un fichier sans utiliser le JSON
// * @param patch
// * @throws IOException
// */
// public void ecritureClasseur(String patch) throws IOException {
// System.getProperty("file.encoding","UTF-8");
//
// Path outputFilePath = Paths.get(patch + "/codeFichier.xml");
// BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8);
//
// fichier.write("<!-- Pablo Rodriguez mai 2020 symbôles : ‽ ↕ ↑ ¦ → ⌂ -->\r\r");
// fichier.write("<!-- ‽5 doit se placer à la fin correspond à 5 points -->\r\r");
// fichier.write("<!-- ⌂ ne prend pas en compte les $ -->\r\r");
// fichier.write("<!-- ¬ ne prend pas en compte les espaces -->\r\r");
// fichier.write("<!-- ⌂¬ ou ¬⌂ ne prend pas en compte les dollars et les espaces -->\r\r");
// fichier.write("<!-- ¦ OU sans nettoyer le texte -->\r\r");
// fichier.write("<!-- ↕ OU avec nettoyage du texte (caractères spéciaux et CASE) -->\r\r");
// fichier.write("<!-- ↑ OU avec nettoyage numérique (1 à 9 et la CASE) -->\r\r");
// fichier.write("<!-- → étendu entre deux bornes numérique avec ou sans unité -->\r\r");
//
// fichier.newLine();
//
// fichier.write("<classeur ");
// fichier.write("metaSujet=\"" + calc.commandes.analyse_metaSujet + "\" ");
// fichier.write("metaSujetContent=\"" + metaSujetContent + "\" ");
// fichier.write("NbreFeuille=\"" + NbreFeuille + "\" progression=\"" + calc.commandes.analyse_progression + "\" analyse=\"" + analyse +"\" bareme=\"" + calc.commandes.analyse_bareme + "\" nbmodification=\"1000\" nbcopier=\"100\" verification=\"true\">\r");
// fichier.newLine();
// fichier.write("<communication link=\"\" linktitle=\"\" title=\"\"></communication>");
// fichier.newLine();
//
// // nommage des cellules
// for (Entry<String, String> j : nommageCellules.entrySet()) {
// fichier.write("<nommage name=\"" + j.getKey() + "\" cells=\"" + j.getValue() +"\"/>");
// fichier.newLine();
// }
//
//
// //feuille
// for (Entry<Integer, feuille> k : Feuilles.entrySet()) {
// fichier.newLine();
// fichier.write("<feuille nomFeuille=\"" + k.getValue().getNomFeuille() + "\" styleLigne=\"" + k.getValue().getStyleLigne() + "\" evaluer=\"" + k.getValue().getEvaluer() +"\" Poids=\"" + k.getValue().getPoids() + "\">\r");
// fichier.newLine();
// fichier.write("\t<communication></communication>\r");
// fichier.newLine();
//
// for (Entry<String, String> j : k.getValue().getNommageCellulesFeuille().entrySet()) {
// fichier.write("\t<nommagecellulesfeuille name=\"" + j.getKey() + "\" cells=\"" + j.getValue() +"\"/>");
// fichier.newLine();
// }
//
// //colonne
// for (Entry<Integer, colonne> k1 : k.getValue().getColonnes().entrySet()) {
// fichier.newLine();
// fichier.write("\t<colonne RefColonne=\"" + k1.getValue().getRefColonne() +"\" RefColDansClasseur=\"" + k1.getValue().getRefColDansClasseur() + "\"");
// for (Entry<String, String> k2 : k1.getValue().getPropertiesColumn().entrySet()) {
// fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
// }
// fichier.write("></colonne>\r");
// }
//
// //ligne
// for (Entry<Integer, ligne> k1 : k.getValue().getLignes().entrySet()) {
// fichier.newLine();
// fichier.write("\t<ligne RefLigne=\"" + k1.getValue().getRefLigne() + "\" evaluer=\"" + k1.getValue().getEvaluer() +"\" saut=\""+ k1.getValue().isSaut() + "\" styletitre=\"H1\">\r");
// fichier.newLine();
// fichier.write("\t\t<communication>" + k1.getValue().getCommunication() +"</communication>\r");
// fichier.newLine();
// fichier.write("\t\t<propertiesRow");
// for (Entry<String, String> k2 : k1.getValue().getPropertiesRow().entrySet()) {
// fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"") ;
// }
// fichier.write("></propertiesRow>\r");
//
// for (Entry<Integer, cellule> k2 : k1.getValue().getCellules().entrySet()) {
// fichier.newLine();
// fichier.write("\t\t<cellule evaluer=\""+ k2.getValue().getEvaluer() +"\" saut=\"false\" " + "styletitre=\"H1\" titre=\"\" menu=\"false\" RefLigne=\"" + k2.getValue().getRefLigne() + "\" RefLigDansClasseur=\""+ k2.getValue().getRefLigDansClasseur()
// + "\" RefColonne=\"" + k2.getValue().getRefColonne() + "\" RefColDansClasseur=\"" + k2.getValue().getRefColDansClasseur() + "\">\r" );
//
// fichier.write("\t\t\t<propertiesCell");
// for (Entry<String, String> k3 : k2.getValue().getPropertiesCell().entrySet()) {
// fichier.write(" " + k3.getKey() + "=\"" + k3.getValue() + "\"" ) ;
// }
// fichier.write("></propertiesCell>\r");
//
// fichier.newLine();
// fichier.write("\t\t\t<validation evaluer=\""+ k2.getValue().getVal().isEvaluer() + "\" saut=\"" + k2.getValue().getVal().isSaut() + "\" empty=\""+ k2.getValue().getVal().isEmpty() + "\" styletitre=\"H1\"");
// for (Entry<String, String> k3 : k2.getValue().getVal().getPropertiesValidation().entrySet()) {
// fichier.write(" " + k3.getKey() + "=\"" + k3.getValue() + "\"" ) ;
// }
// fichier.write("></validation>\r");
//
// fichier.newLine();
// if(k2.getValue().getGraph()!=null) {
// ecritureGraphique(fichier,k2.getValue().getGraph(),"\t\t");
// }
//
// fichier.write("\t\t</cellule>\r");
//
// }
//
// fichier.write("\t</ligne>\r");
// }
//
// //graphic
//
// for (Entry<Integer, graphic> k1 : k.getValue().getGraphics().entrySet()) {
// fichier.newLine();
// ecritureGraphique(fichier,k1.getValue(),"");
// }
//
//
// fichier.write("</feuille>\r");
// }
//
// fichier.write("</classeur>\r");
// fichier.close();
// }
public nodeAC convertClasseurToNode(Ecriture.typeFichier type) throws IOException {
StringBuilder fichier = new StringBuilder();
fichier.append("<classeur ");
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
fichier.append("titre=\"" + calc.commandes.analyse_titre+ "\" ");
fichier.append("progression=\"" + calc.commandes.analyse_progression + "\" ");
fichier.append("bareme=\"" + calc.commandes.analyse_bareme + "\" ");
fichier.append("metaSujet=\"" + calc.commandes.analyse_metaSujet + "\" ");
fichier.append("creationDate=\"" + calc.commandes.analyse_creationDate + "\" ");
fichier.append("controleDateCreation=\"" + calc.commandes.analyse_controleDateCreation + "\" ");
fichier.append("Initial_Creator=\"" + calc.commandes.analyse_Initial_Creator + "\" ");
fichier.append("controle_Initial_Creator=\"" + calc.commandes.analyse_controle_Initial_Creator + "\" ");
fichier.append("auteur=\"" + calc.commandes.analyse_auteur + "\" ");
fichier.append("version=\"" + calc.commandes.version + "\" ");
fichier.append("presenceMetaSujet=\"" + calc.commandes.analyse_presenceMetaSujet + "\" ");
fichier.append("dateModification=\"" + calc.commandes.analyse_date + "\" ");
fichier.append("NbreFeuille=\"" + calc.commandes.analysis_nbr_feuilles + "\" ");
fichier.append("baremeABC=\"" + calc.commandes.analyse_baremeABC + "\" ");
fichier.append("historiquePresent=\"" + calc.commandes.analyse_historiquePresent + "\" ");
fichier.append("filename=\"" + calc.commandes.analysis_filename + "\" ");
fichier.append("producteur=\"" + calc.commandes.analysis_producteur + "\" ");
fichier.append("hash=\"" + calc.commandes.hash + "\" ");
}else {
fichier.append("metaSujet=\"" + getMetaSujet()+ "\" ");
fichier.append("creationDate=\"" + getDateCreation() + "\" ");
fichier.append("dateModification=\"" + getDateModification() + "\" ");
fichier.append("NbreFeuille=\"" + getNbreFeuille() + "\" ");
fichier.append("Initial_Creator=\"" + getInitial_Creator() + "\" ");
fichier.append("producteur=\"" + getProducteur() + "\" ");
}
fichier.append("metaSujetContent=\"" + metaSujetContent + "\" ");
if(type.equals(Ecriture.typeFichier.fichier_analyse)) {
fichier.append("analyse=\"" + analyse +"\" nbmodification=\"1000\" nbcopier=\"100\" verification=\"true\">");
fichier.append("<communication link=\"\" linktitle=\"\" title=\"\"></communication>");
}
// nommage des cellules
for (Entry<String, String> j : nommageCellules.entrySet()) {
fichier.append("<nommage name=\"" + j.getKey() + "\" cells=\"" + j.getValue() +"\"/>");
}
//feuille
for (Entry<Integer, feuille> k : Feuilles.entrySet()) {
fichier.append("<feuille nomFeuille=\"" + k.getValue().getNomFeuille() + "\" styleLigne=\"" + k.getValue().getStyleLigne() + "\" evaluer=\"" + k.getValue().getEvaluer() +"\" Poids=\"" + k.getValue().getPoids() + "\">");
fichier.append("<communication></communication>");
for (Entry<String, String> j : k.getValue().getNommageCellulesFeuille().entrySet()) {
fichier.append("<nommagecellulesfeuille name=\"" + j.getKey() + "\" cells=\"" + j.getValue() +"\"/>");
}
//colonne
for (Entry<Integer, colonne> k1 : k.getValue().getColonnes().entrySet()) {
fichier.append("<colonne RefColonne=\"" + k1.getValue().getRefColonne() +"\" RefColDansClasseur=\"" + k1.getValue().getRefColDansClasseur() + "\"");
for (Entry<String, String> k2 : k1.getValue().getPropertiesColumn().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></colonne>");
}
//ligne
for (Entry<Integer, ligne> k1 : k.getValue().getLignes().entrySet()) {
fichier.append("<ligne RefLigne=\"" + k1.getValue().getRefLigne() + "\" evaluer=\"" + k1.getValue().getEvaluer() +"\" saut=\""+ k1.getValue().isSaut() + "\" styletitre=\"H1\">");
fichier.append("<communication>" + k1.getValue().getCommunication() +"</communication>");
fichier.append("<propertiesRow");
for (Entry<String, String> k2 : k1.getValue().getPropertiesRow().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"") ;
}
fichier.append("></propertiesRow>");
for (Entry<Integer, cellule> k2 : k1.getValue().getCellules().entrySet()) {
fichier.append("<cellule evaluer=\""+ k2.getValue().getEvaluer() +"\" saut=\"false\" " + "styletitre=\"H1\" titre=\"\" menu=\"false\" RefLigne=\"" + k2.getValue().getRefLigne() + "\" RefLigDansClasseur=\""+ k2.getValue().getRefLigDansClasseur()
+ "\" RefColonne=\"" + k2.getValue().getRefColonne() + "\" RefColDansClasseur=\"" + k2.getValue().getRefColDansClasseur() + "\">" );
fichier.append("<propertiesCell");
for (Entry<String, String> k3 : k2.getValue().getPropertiesCell().entrySet()) {
fichier.append(" " + k3.getKey() + "=\"" + k3.getValue() + "\"" ) ;
}
fichier.append("></propertiesCell>");
fichier.append("<validation evaluer=\""+ k2.getValue().getVal().isEvaluer() + "\" saut=\"" + k2.getValue().getVal().isSaut() + "\" empty=\""+ k2.getValue().getVal().isEmpty() + "\" styletitre=\"H1\"");
for (Entry<String, String> k3 : k2.getValue().getVal().getPropertiesValidation().entrySet()) {
fichier.append(" " + k3.getKey() + "=\"" + k3.getValue() + "\"" ) ;
}
fichier.append("></validation>");
if(k2.getValue().getGraph()!=null) {
ecritureGraphique(fichier,k2.getValue().getGraph(),"");
}
fichier.append("</cellule>");
}
fichier.append("</ligne>");
}
//graphic
for (Entry<Integer, graphic> k1 : k.getValue().getGraphics().entrySet()) {
ecritureGraphique(fichier,k1.getValue(),"");
}
fichier.append("</feuille>");
}
fichier.append("</classeur>");
constructionNodeAvecString A = new constructionNodeAvecString();
return A.NewNode(fichier.toString());
}
/**
*
* @param fichier
* @param k1
* @throws IOException
*/
private void ecritureGraphique(StringBuilder fichier, graphic k1, String prefix ) throws IOException {
fichier.append(prefix+"<graphic nomObjet=\"" + k1.getNomObjet()+ "\" type=\"" + k1.getType() + "\" TitreGraphique=\"" + k1.getTitreGraphique() + "\" evaluer=\"" + k1.getEvaluer() + "\">");
fichier.append("<communication></communication>" ) ;
fichier.append(prefix+"<propertiesGraphic");
for(Entry<String,String> k2 : k1.getPropertiesGraphic().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></propertiesGraphic>");
fichier.append(prefix+"<titre");
for(Entry<String,String> k2 : k1.getTitre().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></titre>");
fichier.append(prefix+"<soustitre");
for(Entry<String,String> k2 : k1.getSoustitre().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></soustitre>");
fichier.append(prefix+"<airegraphic");
for(Entry<String,String> k2 : k1.getAiregraphic().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></airegraphic>");
fichier.append(prefix+"<axeXprincipal");
for(Entry<String,String> k2 : k1.getAxeXprincipal().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></axeXprincipal>");
fichier.append(prefix+"<axeYprincipal");
for(Entry<String,String> k2 : k1.getAxeYprincipal().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></axeYprincipal>");
fichier.append(prefix+"<axeXsecondaire");
for(Entry<String,String> k2 : k1.getAxeXsecondaire().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></axeXsecondaire>");
fichier.append(prefix+"<axeYsecondaire");
for(Entry<String,String> k2 : k1.getAxeYsecondaire().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></axeYsecondaire>");
fichier.append(prefix+"<legend");
for(Entry<String,String> k2 : k1.getLegend().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></legend>");
fichier.append(prefix+"<series");
for(Entry<String,String> k2 : k1.getSeries().entrySet()) {
fichier.append(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.append("></series>");
fichier.append(prefix+"</graphic>");
}
private void ecritureGraphique(BufferedWriter fichier, graphic k1, String prefix ) throws IOException {
fichier.write(prefix+"\t<graphic nomObjet=\"" + k1.getNomObjet()+ "\" type=\"" + k1.getType() + "\" TitreGraphique=\"" + k1.getTitreGraphique() + "\" evaluer=\"" + k1.getEvaluer() + "\">\r");
fichier.newLine();
fichier.write("\t\t<communication></communication>" ) ;
fichier.newLine();
fichier.newLine();
fichier.write(prefix+"\t\t<propertiesGraphic");
for(Entry<String,String> k2 : k1.getPropertiesGraphic().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></propertiesGraphic>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<titre");
for(Entry<String,String> k2 : k1.getTitre().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></titre>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<soustitre");
for(Entry<String,String> k2 : k1.getSoustitre().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></soustitre>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<airegraphic");
for(Entry<String,String> k2 : k1.getAiregraphic().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></airegraphic>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<axeXprincipal");
for(Entry<String,String> k2 : k1.getAxeXprincipal().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></axeXprincipal>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<axeYprincipal");
for(Entry<String,String> k2 : k1.getAxeYprincipal().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></axeYprincipal>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<axeXsecondaire");
for(Entry<String,String> k2 : k1.getAxeXsecondaire().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></axeXsecondaire>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<axeYsecondaire");
for(Entry<String,String> k2 : k1.getAxeYsecondaire().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></axeYsecondaire>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<legend");
for(Entry<String,String> k2 : k1.getLegend().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></legend>\r");
fichier.newLine();
fichier.write(prefix+"\t\t<series");
for(Entry<String,String> k2 : k1.getSeries().entrySet()) {
fichier.write(" " + k2.getKey() + "=\"" + k2.getValue() + "\"" ) ;
}
fichier.write("></series>\r");
fichier.write(prefix+"\t</graphic>\r");
}
// /**
// * Constructeur pour le sujet
// * @param a
// * @return
// * @throws Exception
// */
// public Classeur2(String fichierResource, Boolean Erreur) throws Exception {
//
// if(Erreur) System.exit(0);
//
// ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// InputStream is = classLoader.getResourceAsStream(fichierResource+".xml");
//
// Reader initialReader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
// char[] arr = new char[8 * 1024];
// StringBuilder buffer = new StringBuilder();
// int numCharsRead;
// while ((numCharsRead = initialReader.read(arr, 0, arr.length)) != -1) {
// buffer.append(arr, 0, numCharsRead);
// }
// initialReader.close();
// // ! Important néttoyage du fichier avant lecture avec bXML
// String targetString = buffer.toString();
// targetString = targetString.replace("\r", "");
// targetString = targetString.replace("\n", "");
// targetString = targetString.replace("\t", "");
//
// // supprime les espaces multiples
// Pattern p = Pattern.compile(" {2,}");
// targetString = p.matcher(targetString).replaceAll(" ");
//
// // Lecture avec nodeAC
// constructionNodeAvecString A = new constructionNodeAvecString();
// nodeAC LeNodeSujet = A.NewNode(targetString);
//
//
// calc.commandes.analyse_metaSujet = LeNodeSujet.getAttributs().get("metaSujet");
// metaSujetContent = LeNodeSujet.getAttributs().get("metaSujetContent");
// NbreFeuille = Integer.valueOf(LeNodeSujet.getAttributs().get("NbreFeuille"));
// calc.commandes.analyse_progression = Double.valueOf(LeNodeSujet.getAttributs().get("progression"));
// if(calc.commandes.analyse_progression>99) calc.commandes.analyse_progression = 99;
// if(calc.commandes.analyse_progression<0.01) calc.commandes.analyse_progression = 0.01;
// analyse = LeNodeSujet.getAttributs().get("analyse");
//
// nodeAC comm = LeNodeSujet.retourneFirstEnfantsByName("communication");
// if(comm!=null) {
// communication=comm.getContenu().get(0);
// if(comm.getAttributs().get("link")!=null) link=comm.getAttributs().get("link");
// if(comm.getAttributs().get("linktitle")!=null) linktitle=comm.getAttributs().get("linktitle");
// if(comm.getAttributs().get("title")!=null) title=comm.getAttributs().get("title");
// if(comm.getAttributs().get("link2")!=null) link2=comm.getAttributs().get("link2");
// if(comm.getAttributs().get("linktitle2")!=null) linktitle2=comm.getAttributs().get("linktitle2");
// }
//
// ArrayList<nodeAC> nodes = LeNodeSujet.retourneListEnfantsByName("nommage");
// for(int i = 0 ; i< nodes.size() ; i ++) {
// nommageCellules.put(nodes.get(i).getAttributs().get("name"), nodes.get(i).getAttributs().get("cells"));
// }
//
// ArrayList<nodeAC> nodeFeuille = LeNodeSujet.retourneListEnfantsByName("feuille");
// for(int i = 0 ; i< nodeFeuille.size() ; i ++) {
// Feuilles.put(i, new feuille(nodeFeuille.get(i)));
// }
//
// }
//
// //Chargement d'un sujet à partir d'un fichier d'analyse
// public Classeur2(String nameFile) throws Exception {
//
// String targetString = "";
// //read file into stream, try-with-resources
//
// @SuppressWarnings("resource")
// BufferedReader br = new BufferedReader(
// new InputStreamReader(
// new FileInputStream(commandes.PathFilenameAnalysis + "/" + nameFile), "UTF-8"));
//
// String line;
// while ((line = br.readLine()) != null) {
// targetString = targetString + line;
// }
//
//
// if(!targetString.isEmpty()) {
// // ! Important néttoyage du fichier avant lecture avec bXML
// targetString = targetString.replace("\r", "");
// targetString = targetString.replace("\n", "");
// targetString = targetString.replace("\t", "");
// // supprime les espaces multiples
// Pattern p = Pattern.compile(" {2,}");
// targetString = p.matcher(targetString).replaceAll(" ");
//
// // supprime les espaces entre " et >
// p = Pattern.compile("\" {1,}>");
// targetString = p.matcher(targetString).replaceAll("\">");
//
//
// // Lecture avec NodeAC
// constructionNodeAvecString A = new constructionNodeAvecString();
// nodeAC LeNodeSujet = A.NewNode(targetString);
//
//
// calc.commandes.analyse_metaSujet = LeNodeSujet.getAttributs().get("metaSujet");
// metaSujetContent = LeNodeSujet.getAttributs().get("metaSujetContent");
// NbreFeuille = Integer.valueOf(LeNodeSujet.getAttributs().get("NbreFeuille"));
// calc.commandes.analyse_progression = Double.valueOf(LeNodeSujet.getAttributs().get("progression"));
// if(LeNodeSujet.getAttributs().get("bareme")!=null) {
// calc.commandes.analyse_bareme = (Double.valueOf(LeNodeSujet.getAttributs().get("bareme")));
// }
// if(LeNodeSujet.getAttributs().get("nbmodification")!=null) {
// nbmodification = Integer.valueOf(LeNodeSujet.getAttributs().get("nbmodification"));
// }
// if(LeNodeSujet.getAttributs().get("nbcopier")!=null) {
// nbcopier = Integer.valueOf(LeNodeSujet.getAttributs().get("nbcopier"));
// }
// if(LeNodeSujet.getAttributs().get("verification")!=null) {
// verification = Boolean.valueOf(LeNodeSujet.getAttributs().get("verification"));
// }
//
//
// if(calc.commandes.analyse_progression>99) calc.commandes.analyse_progression = 99;
// if(calc.commandes.analyse_progression<0.01) calc.commandes.analyse_progression = 0.01;
// analyse = LeNodeSujet.getAttributs().get("analyse");
//
// nodeAC comm = LeNodeSujet.retourneFirstEnfantsByName("communication");
// if(comm!=null) {
// communication=comm.getContenu().get(0);
// if(comm.getAttributs().get("link")!=null) link=comm.getAttributs().get("link");
// if(comm.getAttributs().get("linktitle")!=null) linktitle=comm.getAttributs().get("linktitle");
// if(comm.getAttributs().get("title")!=null) title=comm.getAttributs().get("title");
// if(comm.getAttributs().get("link2")!=null) link2=comm.getAttributs().get("link2");
// if(comm.getAttributs().get("linktitle2")!=null) linktitle2=comm.getAttributs().get("linktitle2");
// }
//
// ArrayList<nodeAC> nodes = LeNodeSujet.retourneListEnfantsByName("nommage");
// System.out.println("\t\t-->début lecture nommage des cellules");
// for(int i = 0 ; i< nodes.size() ; i ++) {
// nommageCellules.put(nodes.get(i).getAttributs().get("name"), nodes.get(i).getAttributs().get("cells"));
// }
// System.out.println("\t\t-->fin lecture nommage des cellules");
//
// System.out.println();
//
// ArrayList<nodeAC> nodeFeuille = LeNodeSujet.retourneListEnfantsByName("feuille");
// for(int i = 0 ; i< nodeFeuille.size() ; i ++) {
// System.out.println("\t\t-->début lecture feuille : " + nodeFeuille.get(i).getAttributs().get("nomFeuille"));
// Feuilles.put(i, new feuille(nodeFeuille.get(i)));
// System.out.println("\t\t-->fin lecture feuille : " + nodeFeuille.get(i).getAttributs().get("nomFeuille"));
// }
//
// ArrayList<nodeAC> modi= LeNodeSujet.retourneListEnfantsByName("modification");
// if(modi.size()>0) {
// System.out.println("\t\t-->début lecture modification simultané");
// if(Boolean.valueOf(modi.get(0).getAttributs().get("evaluer"))){
// for(int i = 0 ; i< modi.get(0).getNodes().size() ; i ++) {
// Modif.addModification(modi.get(0).getNodes().get(i));
// }
// }
// }
//
//
// }
//
//
// }
//
}