W2L custom config ui refactoring + some LaTeX and EPUB fixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@78 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2010-12-08 09:16:49 +00:00
parent a3a6b0befc
commit 84f4d5cb20
12 changed files with 834 additions and 917 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-10-30)
* Version 1.2 (2010-12-08)
*
*/
@ -159,7 +159,7 @@ public class Misc{
return n;
}
public static int min(int n, int m) { return n<m ? n : m; }
//public static int min(int n, int m) { return n<m ? n : m; }
public static String truncateLength(String sValue) {
if (sValue.endsWith("inch")) {
@ -201,6 +201,25 @@ public class Misc{
}
}
// Divide dividend by divisor and return the quotient as an integer percentage
// (never below 1% except if the dividend is zero)
public static final String divide(String sDividend, String sDivisor) {
if (sDividend.equals("0")) { return "0%"; }
if (sDivisor.equals("0")) { return "100%"; }
float fDividend=getFloat(sDividend.substring(0,sDividend.length()-2),1);
String sDividendUnit=sDividend.substring(sDividend.length()-2);
float fDivisor=getFloat(sDivisor.substring(0,sDivisor.length()-2),1);
String sDivisorUnit=sDivisor.substring(sDivisor.length()-2);
int nPercent = Math.round(100*fDividend*getUpi(sDivisorUnit)/fDivisor/getUpi(sDividendUnit));
if (nPercent>0) {
return Integer.toString(nPercent)+"%";
}
else {
return "1%";
}
}
public static final String multiply(String sPercent, String sLength){
if (sLength.equals("0")) { return "0"; }
float fPercent=getFloat(sPercent.substring(0,sPercent.length()-1),1);