/*
 * frmMain.java
 *
 */

package OOXMLconvert;

import java.io.File;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;

/**
 *
 * @author  ferou
 */
public class frmMain extends javax.swing.JFrame {

	/** Creates new form frmMain */
    public frmMain() {
        initComponents();
		loadFormatPreservingLevel();
		loadHTMLTagsForHeading();
		loadCssConnectionTypes();
		loadDefaults();
    }
	
	private String getParams() {
		try {
			String paramString = "";
			
			// input docx subor
			String inputDocx = jTextField1.getText();
			if (!inputDocx.trim().isEmpty()) {
				paramString += " -i \"" + inputDocx + "\"";
			}
			else {
				JOptionPane.showMessageDialog(null, "Chýba súbor na skonvertovanie!","Chyba",JOptionPane.ERROR_MESSAGE);
				return null;
			}
			
			// output xhtml subor
			String outputXhtml = jTextField2.getText();
			if (!outputXhtml.trim().isEmpty()) {
				paramString += " -o \"" + outputXhtml + "\"";
			}
			else {
				JOptionPane.showMessageDialog(null, "Neurčili ste kam sa má skonvertovaný súbor uložiť!","Chyba",JOptionPane.ERROR_MESSAGE);
				return null;
			}
			
			// relativna cesta k adresaru s vystupnym css suborom
			String cssAdresar = jTextField5.getText();
			if (!cssAdresar.trim().isEmpty()) {
				paramString += " -co \"" + cssAdresar + "\"";
			}
			
			// relativna cesta k adresaru s vystupnymi obrazkami
			String imgAdresar = jTextField4.getText();
			if (!imgAdresar.trim().isEmpty()) {
				paramString += " -io \"" + imgAdresar + "\"";
			}
			
			// uroven zachovania formatovania
			ComboBoxModel model = jComboBox1.getModel();
			PresentationMap pm = (PresentationMap)model.getSelectedItem();
			int formatLevel = Functions.intValDef(pm.get("value"),0);
			paramString += " -fl " + formatLevel;
			
			// prenasat obrazky?
			char preserveImg = 'y';
			if (!jCheckBox1.isSelected()) {
				preserveImg = 'n';
			}
			paramString += " -pi " + preserveImg;
			
			// zistovat ostatne informacie o obrazkoch iba ak sa maju prenasat
			if (preserveImg == 'y') {
				// kvalita JPEG kompresie obrazkov
				int jpegQualityLevel = jSlider1.getValue();
				paramString += " -jq " + jpegQualityLevel;
			}
			
			// vyuzit heuristiku na nadpisy?
			char heuristicH = 'y';
			if (!jCheckBox2.isSelected()) {
				heuristicH = 'n';
			}
			paramString += " -hh " + heuristicH;
			
			// zistovat ostatne informacie o nadpisoch iba ak sa maju zistovat
			if (heuristicH == 'y') {
				// default HTML tag pre nadpis
				ComboBoxModel model2 = jComboBox2.getModel();
				PresentationMap pm2 = (PresentationMap)model2.getSelectedItem();
				String htmlTagForHeading = pm2.get("value").toString();
				paramString += " -ht " + htmlTagForHeading;
			}

			// nazov stylu pre nadpis
			String headingStyleName = "";
			headingStyleName = jTextField6.getText().trim();
			if (!headingStyleName.isEmpty()) {
				paramString += " -hs1 \"" + headingStyleName + "\"";
			}
			headingStyleName = jTextField7.getText().trim();
			if (!headingStyleName.isEmpty()) {
				paramString += " -hs2 \"" + headingStyleName + "\"";
			}
			headingStyleName = jTextField8.getText().trim();
			if (!headingStyleName.isEmpty()) {
				paramString += " -hs3 \"" + headingStyleName + "\"";
			}

			// prenasat footnotes?
			char preserveFootnotes = 'y';
			if (!jCheckBox3.isSelected()) {
				preserveFootnotes = 'n';
			}
			paramString += " -pf " + preserveFootnotes;

			// prenasat endnotes?
			char preserveEndnotes = 'y';
			if (!jCheckBox4.isSelected()) {
				preserveEndnotes = 'n';
			}
			paramString += " -pe " + preserveEndnotes;

			// css prepojenia
			ComboBoxModel model3 = jComboBox3.getModel();
			PresentationMap pm3 = (PresentationMap)model3.getSelectedItem();
			int cssConnectionType = Functions.intValDef(pm3.get("value"),0);
			paramString += " -ct \"" + cssConnectionType + "\"";
			// input css subor
			if (cssConnectionType > 0) {
				String cssSubor = jTextField3.getText();
				if (!cssSubor.trim().isEmpty()) {
					paramString += " -ci \"" + cssSubor + "\"";
				}
				else {
					JOptionPane.showMessageDialog(null, "Neurčili ste kde sa nachádza zdrojový CSS súbor!","Chyba",JOptionPane.ERROR_MESSAGE);
					return null;
				}
				if (cssConnectionType > 1) {
					//b i u s horny dolny 9 - 14
					String cssB = jTextField9.getText().trim();
					if (!cssB.isEmpty()) {
						paramString += " -cssb \"" + cssB + "\"";
					}
					String cssI = jTextField10.getText().trim();
					if (!cssI.isEmpty()) {
						paramString += " -cssi \"" + cssI + "\"";
					}
					String cssU = jTextField11.getText().trim();
					if (!cssU.isEmpty()) {
						paramString += " -cssu \"" + cssU + "\"";
					}
					String cssS = jTextField12.getText().trim();
					if (!cssS.isEmpty()) {
						paramString += " -csss \"" + cssS + "\"";
					}
					String cssUI = jTextField13.getText().trim();
					if (!cssUI.isEmpty()) {
						paramString += " -cssui \"" + cssUI + "\"";
					}
					String cssLI = jTextField14.getText().trim();
					if (!cssLI.isEmpty()) {
						paramString += " -cssli \"" + cssLI + "\"";
					}
				}
			}
			
			return paramString;
		}
		catch (Exception e) {
			System.err.println(this.getClass().getName() + " (getParams): " + e.toString());
			return null;
		}
	}
	
	/**
	 * Funkcia pripraví ComboBox s úrovňami zachovania formátovania
	 */
	private void loadFormatPreservingLevel() {
		try {
			DefaultComboBoxModel model = new DefaultComboBoxModel();
			PresentationMap pm1 = new PresentationMap("text");
			pm1.put("text", "žiadne formátovanie");
			pm1.put("value", "0");
			model.addElement(pm1);
			PresentationMap pm2 = new PresentationMap("text");
			pm2.put("text", "základné formátovanie");
			pm2.put("value", "1");
			model.addElement(pm2);
			PresentationMap pm3 = new PresentationMap("text");
			pm3.put("text", "rozšírené formátovanie");
			pm3.put("value", "2");
			model.addElement(pm3);
			jComboBox1.setModel(model);
			jComboBox1.setSelectedItem(pm2);
		}
		catch (Exception e) {
			System.err.println(this.getClass().getName() + " (loadFormatPreservingLevel): " + e.toString());
		}
	}
	
	/**
	 * Funkcia pripraví ComboBox s typmi prepojenia s existujucim CSS
	 */
	private void loadCssConnectionTypes() {
		try {
			DefaultComboBoxModel model = new DefaultComboBoxModel();
			PresentationMap pm1 = new PresentationMap("text");
			pm1.put("text", "žiadne prepojenie");
			pm1.put("value", "0");
			model.addElement(pm1);
			PresentationMap pm2 = new PresentationMap("text");
			pm2.put("text", "štýly pridať do CSS");
			pm2.put("value", "1");
			model.addElement(pm2);
			PresentationMap pm3 = new PresentationMap("text");
			pm3.put("text", "prepojiť na CSS");
			pm3.put("value", "2");
			model.addElement(pm3);
			jComboBox3.setModel(model);
			jComboBox3.setSelectedItem(pm1);
		}
		catch (Exception e) {
			System.err.println(this.getClass().getName() + " (loadCssConnectionTypes): " + e.toString());
		}
	}
	
	/**
	 * Funkcia pripraví ComboBox s HTML tagmi pre nadpis
	 */
	private void loadHTMLTagsForHeading() {
		try {
			DefaultComboBoxModel model = new DefaultComboBoxModel();
			PresentationMap pm1 = new PresentationMap("text");
			pm1.put("text", "H1");
			pm1.put("value", "h1");
			model.addElement(pm1);
			PresentationMap pm2 = new PresentationMap("text");
			pm2.put("text", "H2");
			pm2.put("value", "h2");
			model.addElement(pm2);
			PresentationMap pm3 = new PresentationMap("text");
			pm3.put("text", "H3");
			pm3.put("value", "h3");
			model.addElement(pm3);
			jComboBox2.setModel(model);
		}
		catch (Exception e) {
			System.err.println(this.getClass().getName() + " (loadHTMLTagsForHeading): " + e.toString());
		}
	}
	
	/**
	 * Funkcia načíta defaultné nastavenia.
	 */
	private void loadDefaults() {
		try {
			jTextField4.setText("pics/");
			jTextField5.setText("styles/");
			jTextField6.setText("heading1");
			jTextField7.setText("heading2");
			jTextField8.setText("heading3");
			jCheckBox2.setSelected(false);
			jCheckBox2ActionPerformed(null);
		}
		catch (Exception e) {
			System.err.println(this.getClass().getName() + " (loadDefaults): " + e.toString());
		}
	}

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jTextField1 = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jButton4 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextField5 = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jPanel4 = new javax.swing.JPanel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jLabel7 = new javax.swing.JLabel();
        jSlider1 = new javax.swing.JSlider();
        jLabel8 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jCheckBox2 = new javax.swing.JCheckBox();
        jLabel9 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jLabel11 = new javax.swing.JLabel();
        jTextField7 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jCheckBox3 = new javax.swing.JCheckBox();
        jCheckBox4 = new javax.swing.JCheckBox();
        jPanel2 = new javax.swing.JPanel();
        jTextField3 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jButton5 = new javax.swing.JButton();
        jComboBox3 = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jTextField9 = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jTextField10 = new javax.swing.JTextField();
        jTextField11 = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jTextField12 = new javax.swing.JTextField();
        jTextField13 = new javax.swing.JTextField();
        jTextField14 = new javax.swing.JTextField();
        jButton6 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("konverzia DOCX na XHTML");
        setResizable(false);

        jButton1.setText("Konvertuj");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Koniec");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jTextField1.setEditable(false);

        jButton3.setText("Vybrať súbor");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel1.setText("Vstupný súbor na skonvertovanie:");

        jLabel2.setText("Výstupné XHTML uložiť do:");

        jTextField2.setEditable(false);

        jButton4.setText("Vybrať súbor");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel4.setText("Relatívna cesta k obrázkom:");

        jLabel5.setText("Relatívna cesta k CSS:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3))
                    .addComponent(jLabel2)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton4))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextField5)
                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(29, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton3)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(135, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Zdroj a cieľ", jPanel1);

        jLabel6.setText("Úroveň prenášania pôvodného formátovania:");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "žiadne formátovanie", "základné formátovanie", "rozšírené formátovanie" }));

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Obrázky"));

        jCheckBox1.setSelected(true);
        jCheckBox1.setText("prenášať obrázky");
        jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox1ActionPerformed(evt);
            }
        });

        jLabel7.setText("Kvalita JPEG obrázkov:");

        jSlider1.setMajorTickSpacing(10);
        jSlider1.setMinorTickSpacing(5);
        jSlider1.setPaintTicks(true);
        jSlider1.setValue(80);
        jSlider1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSlider1StateChanged(evt);
            }
        });

        jLabel8.setText("80%");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox1)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
                .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jCheckBox1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Nadpisy"));

        jCheckBox2.setSelected(true);
        jCheckBox2.setText("využiť heuristiku na rozoznávanie nadpisov");
        jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox2ActionPerformed(evt);
            }
        });

        jLabel9.setText("Názov štýlu pre nadpis úrovne 1:");

        jLabel10.setText("Default HTML tag pre nadpis:");

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "H1", "H2", "H3" }));

        jLabel11.setText("Názov štýlu pre nadpis úrovne 2:");

        jLabel12.setText("Názov štýlu pre nadpis úrovne 3:");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jCheckBox2)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField7))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField8)))
                .addContainerGap(39, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jCheckBox2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Základné nastavenia", jPanel3);

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Poznámky"));

        jCheckBox3.setText("prenášať footnotes");
        jCheckBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox3ActionPerformed(evt);
            }
        });

        jCheckBox4.setText("prenášať endnotes");
        jCheckBox4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox3)
                    .addComponent(jCheckBox4))
                .addContainerGap(234, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(jCheckBox3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox4))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Prepojenie s CSS"));

        jTextField3.setEditable(false);

        jLabel3.setText("Externé CSS:");

        jButton5.setText("Vybrať súbor");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox3ActionPerformed(evt);
            }
        });

        jLabel13.setText("Spôsob prepojenia:");

        jLabel14.setText("hrubý font:");

        jLabel15.setText("kurzíva:");

        jLabel16.setText("podčiarknutie:");

        jLabel17.setText("dolný index:");

        jLabel18.setText("horný index:");

        jLabel19.setText("prečiarknutie:");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel3)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButton5)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(jLabel13)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel16)
                            .addComponent(jLabel14)
                            .addComponent(jLabel15))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel19)
                            .addComponent(jLabel18))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(10, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel19)
                            .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel18)
                            .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Rozšírené nastavenia", jPanel6);

        jButton6.setText("Zobraz parametre");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(49, 49, 49)
                        .addComponent(jButton1)
                        .addGap(18, 18, 18)
                        .addComponent(jButton6)
                        .addGap(18, 18, 18)
                        .addComponent(jButton2)))
                .addGap(9, 9, 9))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton6)
                    .addComponent(jButton1)
                    .addComponent(jButton2)))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-427)/2, (screenSize.height-418)/2, 427, 418);
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// konvertuj	
	try {
		String params = getParams();
		if (params != null) {
			String convertCmd = "java -jar OOXMLconvert.jar" + params;
			//System.out.println(convertCmd);
			frmExec frm = new frmExec();
			frm.setVisible(true);
			frm.convert(convertCmd);
		}
	}
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jButton1ActionPerformed): " + e.toString());
	}
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// koniec
	System.exit(0);
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
	try {
		// vybratie XHTML ciela
		JFileChooser fc = new JFileChooser();
		fc.setFileFilter(new FileNameExtensionFilter("HTML súbory", "html", "htm"));
		File lastDir = new File((String)Functions.readLocalProperty("lastHtmlDir", ""));
		if (lastDir.isDirectory()) {
			fc.setCurrentDirectory(lastDir);
		}
		File xhtmlSubor = null;
		fc.setDialogType(JFileChooser.SAVE_DIALOG);
		boolean end = false;
		do {
			if (fc.showDialog(this, "Uložiť ako...") == JFileChooser.APPROVE_OPTION) {
				xhtmlSubor = fc.getSelectedFile();
				if (xhtmlSubor != null) {
					if (xhtmlSubor.isFile()) {
						if (JOptionPane.showConfirmDialog(this, "Súbor už existuje. Chcete ho prepísať?", "HTML výstup", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
							end = true;
						}
					}
					else {
						end = true;
					}
				}
				else {
					end = true;
				}
			}
			else {
				end = true;
			}
		} while (!end);
		if (xhtmlSubor != null) {
			String filename = xhtmlSubor.getPath();
			int pos = filename.lastIndexOf('.');
			if (pos > 0) {
				String ext = filename.substring(pos).toLowerCase();
				if ((!ext.equals(".htm")) && (!ext.equals(".html"))) {
					filename = filename + ".html";
				}
			}
			else {
				filename = filename + ".html";
			}
			jTextField2.setText(filename);
			Functions.writeLocalProperty("lastHtmlDir", xhtmlSubor.getParent());
		}
		else {
			//jTextField2.setText("");
		}
	}
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jButton4ActionPerformed): " + e.toString());
	}
}//GEN-LAST:event_jButton4ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
	try {
		// vybratie DOCX zdroja
		JFileChooser fc = new JFileChooser();
		fc.setFileFilter(new FileNameExtensionFilter("DOCX súbory", "docx"));
		File lastDir = new File((String)Functions.readLocalProperty("lastDocxDir", ""));
		if (lastDir.isDirectory()) {
			fc.setCurrentDirectory(lastDir);
		}
		File docxSubor = null;
		if (fc.showDialog(this, "Otvoriť") == JFileChooser.APPROVE_OPTION) {
			docxSubor = fc.getSelectedFile();
		}
		if (docxSubor != null && docxSubor.exists()) {
			jTextField1.setText(docxSubor.getPath());
			Functions.writeLocalProperty("lastDocxDir", docxSubor.getParent());
		}
		else {
			//jTextField1.setText("");
		}
	}
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jButton3ActionPerformed): " + e.toString());
	}
}//GEN-LAST:event_jButton3ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
	try {//GEN-LAST:event_jButton5ActionPerformed
		// vybratie externeho CSS zdroja
		JFileChooser fc = new JFileChooser();
		fc.setFileFilter(new FileNameExtensionFilter("CSS súbory", "css"));
		File lastDir = new File((String)Functions.readLocalProperty("lastCSSDir", ""));
		if (lastDir.isDirectory()) {
			fc.setCurrentDirectory(lastDir);
		}
		File cssSubor = null;
		if (fc.showDialog(this, "Otvoriť") == JFileChooser.APPROVE_OPTION) {
			cssSubor = fc.getSelectedFile();
		}
		if (cssSubor != null && cssSubor.exists()) {
			jTextField3.setText(cssSubor.getPath());
			Functions.writeLocalProperty("lastCSSDir", cssSubor.getParent());
		}
		else {
			//jTextField1.setText("");
		}
	}
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jButton5ActionPerformed): " + e.toString());
	}
}

private void jSlider1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSlider1StateChanged
// zmena posuvnika kvality kompresie JPEG
	try {
		if (jSlider1.getValue() == 0) {
			// ak je vybrana hodnota 0, tak nastav 1 (0 byt nemoze, ale ak je na slideri min = 1, tak ticks su skarede)
			jSlider1.setValue(1);
		}
		jLabel8.setText(jSlider1.getValue() + "%");
	}
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jSlider1StateChanged): " + e.toString());
	}
}//GEN-LAST:event_jSlider1StateChanged

private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
// kliknutie na prenasat obrazky checkbox
	try {
		if (jCheckBox1.isSelected()) {
			jSlider1.setEnabled(true);
		}
		else {
			jSlider1.setEnabled(false);
		}
	}//GEN-LAST:event_jCheckBox1ActionPerformed
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jCheckBox1ActionPerformed): " + e.toString());
	}
}

private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed
// klinutie na pouzivanie heuristiky na rozoznavanie nadpisov
	try {
		if (jCheckBox2.isSelected()) {
			jComboBox2.setEnabled(true);
		}
		else {
			jComboBox2.setEnabled(false);
		}
	}
	catch (Exception e) {
		System.err.println(this.getClass().getName() + " (jCheckBox1ActionPerformed): " + e.toString());
	}
}//GEN-LAST:event_jCheckBox2ActionPerformed

private void jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jCheckBox3ActionPerformed

private void jCheckBox4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jCheckBox4ActionPerformed

private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed
// zmena typu prepojenia s CSS
	int cssConnectionType = Functions.intValDef(((PresentationMap)jComboBox3.getSelectedItem()).get("value"),0);
	switch (cssConnectionType) {
		case 0:
			jTextField3.setText("");
			jButton5.setEnabled(false);
			jTextField9.setEnabled(false);
			jTextField10.setEnabled(false);
			jTextField11.setEnabled(false);
			jTextField12.setEnabled(false);
			jTextField13.setEnabled(false);
			jTextField14.setEnabled(false);
			break;
		case 1:
			jButton5.setEnabled(true);
			jTextField9.setEnabled(false);
			jTextField10.setEnabled(false);
			jTextField11.setEnabled(false);
			jTextField12.setEnabled(false);
			jTextField13.setEnabled(false);
			jTextField14.setEnabled(false);
			break;
		case 2:
			jButton5.setEnabled(true);
			jTextField9.setEnabled(true);
			jTextField10.setEnabled(true);
			jTextField11.setEnabled(true);
			jTextField12.setEnabled(true);
			jTextField13.setEnabled(true);
			jTextField14.setEnabled(true);
			break;
	}
}//GEN-LAST:event_jComboBox3ActionPerformed

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// zobraz parametre
	String params = getParams();
	if (params != null) {
		String convertCmd = "java -jar OOXMLconvert.jar" + params;
		frmShowParams frm = new frmShowParams();
		frm.setVisible(true);
		frm.showParams(convertCmd);
	}
}//GEN-LAST:event_jButton6ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    private javax.swing.JCheckBox jCheckBox4;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JSlider jSlider1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField10;
    private javax.swing.JTextField jTextField11;
    private javax.swing.JTextField jTextField12;
    private javax.swing.JTextField jTextField13;
    private javax.swing.JTextField jTextField14;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    // End of variables declaration//GEN-END:variables

}
