1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
31 import java
.io
.FileWriter
;
33 public class INIOutputter
37 String m_sNamePrefix
; // the HTML files used a suffix to build it's right name
40 * ls is the current line separator (carridge return)
44 public static INIOutputter
create( String _sOutputPath
, String _sHTMLFilename
, String _sNamePrefix
, String _sTitle
)
46 FileHelper
.makeDirectories("", _sOutputPath
);
47 INIOutputter a
= new INIOutputter();
48 String fs
= System
.getProperty("file.separator");
49 String sFilename
= _sOutputPath
+ fs
+ _sHTMLFilename
;
53 File outputFile
= new File(sFilename
);
54 a
.m_aOut
= new FileWriter(outputFile
.toString());
55 a
.ls
= System
.getProperty("line.separator");
57 catch (java
.io
.IOException e
)
60 GlobalLogWriter
.get().println("ERROR: Can't create INI Outputter");
63 a
.m_sFilename
= sFilename
;
64 a
.m_sNamePrefix
= _sNamePrefix
;
68 public String
getFilename() {return m_sFilename
;}
70 public void createHeader()
74 m_aOut
.write("; This file is automatically created by a convwatch run" + ls
);
75 m_aOut
.write("; " + ls
);
76 m_aOut
.write("; If you see this file in a browser you may have forgotten to set the follows in the property file" + ls
);
77 m_aOut
.write("; " + PropertyName
.DOC_COMPARATOR_HTML_OUTPUT_PREFIX
+ "=http://lla-1.germany/gfxcmp/cw.php?inifile=" + ls
);
78 m_aOut
.write("; Please check the documentation if you got confused." + ls
);
79 m_aOut
.write("; " + ls
);
80 m_aOut
.write("; " + ls
);
82 catch (java
.io
.IOException e
)
87 public void writeSection(String _sSectionName
)
91 m_aOut
.write("[" + _sSectionName
+ "]" + ls
);
94 catch (java
.io
.IOException e
)
99 public void writeValue(String _sName
, String _sValue
)
103 m_aOut
.write(_sName
+ "=" + _sValue
+ ls
);
106 catch (java
.io
.IOException e
)
111 public void startSection(int _nNumber
)
113 writeSection( "page" + String
.valueOf(_nNumber
));
123 catch (java
.io
.IOException e
)
128 public void checkLine(StatusHelper _aStatus
, boolean _bCurrentResult
)
132 m_aOut
.write( "oldgfx=" + _aStatus
.m_sOldGfx
+ ls
);
133 m_aOut
.write( "newgfx=" + _aStatus
.m_sNewGfx
+ ls
);
134 m_aOut
.write( "diffgfx=" + _aStatus
.m_sDiffGfx
+ ls
);
136 String sPercent
= String
.valueOf(_aStatus
.nPercent
) + "%";
137 if (_aStatus
.nPercent
> 0 && _aStatus
.nPercent
< 5)
139 sPercent
+= " (less 5% is ok)";
141 m_aOut
.write("percent=" + sPercent
+ ls
);
143 if (_aStatus
.m_sDiff_BM_Gfx
== null)
145 m_aOut
.write("BM=false" + ls
);
149 m_aOut
.write("BM=true" + ls
);
150 m_aOut
.write( "old_BM_gfx=" + _aStatus
.m_sOld_BM_Gfx
+ ls
);
151 m_aOut
.write( "new_BM_gfx=" + _aStatus
.m_sNew_BM_Gfx
+ ls
);
152 m_aOut
.write( "diff_BM_gfx=" + _aStatus
.m_sDiff_BM_Gfx
+ ls
);
154 String sPercent2
= String
.valueOf(_aStatus
.nPercent2
) + "%";
155 if (_aStatus
.nPercent2
> 0 && _aStatus
.nPercent2
< 5)
157 sPercent2
+= " (less 5% is ok)";
159 m_aOut
.write("percent2=" + sPercent2
+ ls
);
162 writeResult(_bCurrentResult
);
165 catch (java
.io
.IOException e
)
170 void writeResult(boolean _bCurrentResult
) throws java
.io
.IOException
172 // is the check positiv, in a defined range
175 m_aOut
.write("result=YES" + ls
);
179 m_aOut
.write("result=NO" + ls
);
183 public void checkDiffDiffLine(StatusHelper _aStatus
, boolean _bCurrentResult
)
187 m_aOut
.write( "oldgfx=" + _aStatus
.m_sOldGfx
+ ls
);
188 m_aOut
.write( "newgfx=" + _aStatus
.m_sNewGfx
+ ls
);
189 m_aOut
.write( "diffgfx=" + _aStatus
.m_sDiffGfx
+ ls
);
191 String sPercent
= String
.valueOf(_aStatus
.nPercent
) + "%";
192 // if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5)
194 // sPercent += " (less 5% is ok)";
196 m_aOut
.write("percent=" + sPercent
+ ls
);
198 // is the check positiv, in a defined range
199 writeResult(_bCurrentResult
);
202 catch (java
.io
.IOException e
)