diff options
Diffstat (limited to 'l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java')
-rwxr-xr-x | l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java index 6b76b75b75d6..cb64f3381fdc 100755 --- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java +++ b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,7 +26,7 @@ ************************************************************************/ /* * Created on 2005 - * by Christian Schmidt + * by Christian Schmidt */ package com.sun.star.tooling.DirtyTags; @@ -35,12 +35,12 @@ import java.util.ArrayList; /** * Solves the problem with translating strings from the - * Star-Office Help. This Strings contain XML snippets + * Star-Office Help. This Strings contain XML snippets * (that means parts of an xml dokument). I call them 'dirty' * because the start of a tag (<) and the and of an tag (>) - * are quoted by a single backslash(\<.....\>). This is done + * are quoted by a single backslash(\<.....\>). This is done * because the text out of th tags should not contain '<' and '>' - * as Entity references (< or >) but as readable signs. + * as Entity references (< or >) but as readable signs. * This is for translation purposes. * Because translators get mad while find out the really translatable * parts between all the markup information, the XLIFF Specification @@ -48,20 +48,20 @@ import java.util.ArrayList; * special tags (<ept>, <bpt>). * This Class has two static methods that do the wrapping and unwrapping * NOTE: this won't work with not 'dirty' Strings. - * + * * @author Christian Schmidt 2005 * */ public class DirtyTagWrapper { - + private static boolean doWrap=true; public static void setWrapping(boolean doWrap){ DirtyTagWrapper.doWrap=doWrap; } - + /** * Unwraps the 'dirty' parts of a String from ept and bpt tags - * + * * @param checkString The String to unwrap * @return the unwrapped String */ @@ -85,11 +85,11 @@ public class DirtyTagWrapper { String returnString = new String(returnBuffer); return returnString; } - - + + /** * Wrap the dirty parts of a string - * + * * @param checkString The String to check if there are dirty Parts to wrap * @return A String with wrapped dirty parts * @throws TagWrapperException @@ -99,11 +99,11 @@ public class DirtyTagWrapper { // if no wrapping should be done return the given string if(!doWrap) return checkString; // let's wrap - String[] parts=null; + String[] parts=null; int idx=0; //split the string at tag ends String[] parts2 = checkString.split("\\\\>"); - + ArrayList tagString =new ArrayList(); // put the while splitting lost parts to the end of the single strings for(int j=0;j<parts2.length-1;j++){ @@ -113,10 +113,10 @@ public class DirtyTagWrapper { if (checkString.endsWith("\\>")){ parts2[parts2.length-1]+="\\>"; } - // split the leading text from the real tag string (<...>) + // split the leading text from the real tag string (<...>) for(int j=0;j<parts2.length;j++){ - //is it just a tag + //is it just a tag if(parts2[j].startsWith("\\<")){ tagString.add(parts2[j]); // or is it a tag with leading text? @@ -126,12 +126,12 @@ public class DirtyTagWrapper { tagString.add(parts2[j].substring(0,(parts2[j].indexOf("\\<")))); // ...and the tag tagString.add(parts2[j].substring(parts2[j].indexOf("\\<"))); - + }else{ //no tag...must be text only tagString.add(parts2[j]); } - + } ArrayList tagNames=new ArrayList(); String item=""; @@ -148,7 +148,7 @@ public class DirtyTagWrapper { isStandalone=true; } item=item.substring(start,end); - + if(item.indexOf(" ")>0){ item=item.substring(0,item.indexOf(" ")); } @@ -171,9 +171,9 @@ public class DirtyTagWrapper { }else { tagType.add("StartTag"); } - + } - + ArrayList tagList=new ArrayList(); for(int i=0;i<tagNames.size();i++){ tagList.add(new Tag( @@ -190,7 +190,7 @@ public class DirtyTagWrapper { while(tagList.size()>0){ try{ start=new TagPair(tagList); - returnBuffer.append(start.getWrapped()); + returnBuffer.append(start.getWrapped()); }catch(TagPair.TagPairConstructionException e){ throw (new DirtyTagWrapper()).new TagWrapperException(e); } @@ -206,43 +206,43 @@ public class DirtyTagWrapper { /** * Create a new Instance of TagWrapperException - * - * + * + * */ public TagWrapperException() { super(); - // + // } /** * Create a new Instance of TagWrapperException - * + * * @param arg0 */ public TagWrapperException(String arg0) { super(arg0); - // + // } /** * Create a new Instance of TagWrapperException - * + * * @param arg0 * @param arg1 */ public TagWrapperException(String arg0, Throwable arg1) { super(arg0, arg1); - // + // } /** * Create a new Instance of TagWrapperException - * + * * @param arg0 */ public TagWrapperException(Throwable arg0) { super(arg0); - // + // } } |