}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
- sb.append("[").append("HEADERFOOTER").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n");
+ sb.append('[').append("HEADERFOOTER").append("] (0x");
+ sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT)).append(")\n");
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
sb.append("[/").append("HEADERFOOTER").append("]\n");
return sb.toString();
if (biffName == null) {
biffName = "UNKNOWNRECORD";
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
- sb.append("[").append(biffName).append("] (0x");
- sb.append(Integer.toHexString(_sid).toUpperCase(Locale.ROOT) + ")\n");
+ sb.append('[').append(biffName).append("] (0x");
+ sb.append(Integer.toHexString(_sid).toUpperCase(Locale.ROOT)).append(")\n");
if (_rawData.length > 0) {
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
}
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("[").append("USERSVIEWBEGIN").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n");
+ sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT)).append(")\n");
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
sb.append("[/").append("USERSVIEWBEGIN").append("]\n");
return sb.toString();
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
- sb.append("[").append("USERSVIEWEND").append("] (0x");
- sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT) + ")\n");
+ sb.append('[').append("USERSVIEWEND").append("] (0x");
+ sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT)).append(")\n");
sb.append(" rawData=").append(HexDump.toHex(_rawData)).append("\n");
sb.append("[/").append("USERSVIEWEND").append("]\n");
return sb.toString();
public String toString()
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(" [Font Formatting]\n");
buffer.append(" .font height = ").append(getFontHeight()).append(" twips\n");
{
buffer.append(" .underline type is not modified\n");
}
- buffer.append(" .color index = ").append("0x"+Integer.toHexString(getFontColorIndex()).toUpperCase(Locale.ROOT)).append("\n");
+ buffer.append(" .color index = ").append("0x")
+ .append(Integer.toHexString(getFontColorIndex()).toUpperCase(Locale.ROOT)).append('\n');
buffer.append(" [/Font Formatting]\n");
return buffer.toString();
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.TextRun;
import org.apache.poi.sl.usermodel.TextRun.FieldType;
-import org.apache.poi.sl.usermodel.TextRun.TextCap;
import org.apache.poi.sl.usermodel.TextShape;
import org.apache.poi.sl.usermodel.TextShape.TextDirection;
+import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.Units;
-
public class DrawTextParagraph implements Drawable {
private static final POILogger LOG = POILogFactory.getLogger(DrawTextParagraph.class);
Slide<?,?> slide = (Slide<?,?>)graphics.getRenderingHint(Drawable.CURRENT_SLIDE);
return (slide == null) ? "" : Integer.toString(slide.getSlideNumber());
}
- StringBuilder buf = new StringBuilder();
- TextCap cap = tr.getTextCap();
- String tabs = null;
- for (char c : tr.getRawText().toCharArray()) {
- switch (c) {
- case '\t':
- if (tabs == null) {
- tabs = tab2space(tr);
- }
- buf.append(tabs);
- break;
- case '\u000b':
- buf.append('\n');
- break;
- default:
- switch (cap) {
- case ALL: c = Character.toUpperCase(c); break;
- case SMALL: c = Character.toLowerCase(c); break;
- case NONE: break;
- }
+ String txt = tr.getRawText();
+ txt.replace("\t", tab2space(tr)).replace("\u000b", "\n");
- buf.append(c);
- break;
- }
+ switch (tr.getTextCap()) {
+ case ALL: txt.toUpperCase(LocaleUtil.getUserLocale()); break;
+ case SMALL: txt.toLowerCase(LocaleUtil.getUserLocale()); break;
+ case NONE: break;
}
- return buf.toString();
+ return txt;
}
/**
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.sl.usermodel.TextRun;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.LocaleUtil;
import org.apache.poi.xslf.model.CharacterPropertyFetcher;
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
import org.apache.xmlbeans.XmlObject;
String txt = ((CTRegularTextRun)_r).getT();
- TextCap cap = getTextCap();
- StringBuilder buf = new StringBuilder();
- for(int i = 0; i < txt.length(); i++) {
- char c = txt.charAt(i);
- if(c == '\t') {
- // TODO: finish support for tabs
- buf.append(" ");
- } else {
- switch (cap){
- case ALL:
- buf.append(Character.toUpperCase(c));
- break;
- case SMALL:
- buf.append(Character.toLowerCase(c));
- break;
- default:
- buf.append(c);
- }
- }
- }
+ // TODO: finish support for tabs
+ txt.replace("\t", " ");
- return buf.toString();
+ switch (getTextCap()) {
+ case ALL:
+ txt = txt.toUpperCase(LocaleUtil.getUserLocale());
+ break;
+ case SMALL:
+ txt = txt.toLowerCase(LocaleUtil.getUserLocale());
+ break;
+ }
+ return txt;
}
@Override
public static String getConstName( String parentName, String constName,
int padTo )
{
- StringBuffer fieldName = new StringBuffer();
+ StringBuilder fieldName = new StringBuilder();
toConstIdentifier( parentName, fieldName );
fieldName.append( '_' );
toConstIdentifier( constName, fieldName );
public static String getFieldName( int position, String name, int padTo )
{
- StringBuffer fieldName = new StringBuffer( "field_" + position + "_" );
+ StringBuilder fieldName = new StringBuilder().append("field_").append(position).append('_');
toIdentifier( name, fieldName );
pad( fieldName, padTo );
public static String getFieldName( String name, int padTo )
{
- StringBuffer fieldName = new StringBuffer();
+ StringBuilder fieldName = new StringBuilder();
toIdentifier( name, fieldName );
pad( fieldName, padTo );
public static String getFieldName1stCap( String name, int padTo )
{
- StringBuffer fieldName = new StringBuffer();
+ StringBuilder fieldName = new StringBuilder();
toIdentifier( name, fieldName );
fieldName.setCharAt( 0, Character.toUpperCase( fieldName.charAt( 0 ) ) );
pad( fieldName, padTo );
public static String getType1stCap( String size, String type, int padTo )
{
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
result.append( type );
result = pad( result, padTo );
result.setCharAt( 0, Character.toUpperCase( result.charAt( 0 ) ) );
return result.toString();
}
- protected static StringBuffer pad( StringBuffer fieldName, int padTo )
+ protected static StringBuilder pad( StringBuilder fieldName, int padTo )
{
for ( int i = fieldName.length(); i < padTo; i++ )
fieldName.append( ' ' );
return fieldName;
}
- private static void toConstIdentifier( String name, StringBuffer fieldName )
+ private static void toConstIdentifier( String name, StringBuilder fieldName )
{
for ( int i = 0; i < name.length(); i++ )
{
}
}
- private static void toIdentifier( String name, StringBuffer fieldName )
+ private static void toIdentifier( String name, StringBuilder fieldName )
{
for ( int i = 0; i < name.length(); i++ )
{