/** * Rationalizes the sheet's xf index mapping * @param xfMapping the index mapping for XFRecords * @param fontMapping the index mapping for fonts * @param formatMapping the index mapping for formats */ public void rationalize(IndexMapping xfMapping, IndexMapping fontMapping, IndexMapping formatMapping) { if (!initialized) { initialize(); } // Read through the array, looking for the data types // This is a total hack bodge for now - it will eventually need to be // integrated properly int pos = 0; int code = 0; int length = 0; Type type = null; while (pos < data.Length) { code = IntegerHelper.getInt(data[pos], data[pos + 1]); length = IntegerHelper.getInt(data[pos + 2], data[pos + 3]); type = Type.getType(code); if (type == Type.FONTX) { int fontind = IntegerHelper.getInt(data[pos + 4], data[pos + 5]); IntegerHelper.getTwoBytes(fontMapping.getNewIndex(fontind), data, pos + 4); } else if (type == Type.FBI) { int fontind = IntegerHelper.getInt(data[pos + 12], data[pos + 13]); IntegerHelper.getTwoBytes(fontMapping.getNewIndex(fontind), data, pos + 12); } else if (type == Type.IFMT) { int formind = IntegerHelper.getInt(data[pos + 4], data[pos + 5]); IntegerHelper.getTwoBytes(formatMapping.getNewIndex(formind), data, pos + 4); } else if (type == Type.ALRUNS) { int numRuns = IntegerHelper.getInt(data[pos + 4], data[pos + 5]); int fontPos = pos + 6; for (int i = 0; i < numRuns; i++) { int fontind = IntegerHelper.getInt(data[fontPos + 2], data[fontPos + 3]); IntegerHelper.getTwoBytes(fontMapping.getNewIndex(fontind), data, fontPos + 2); fontPos += 4; } } pos += length + 4; } }
/** * Rationalizes the sheets xf index mapping * @param xfmapping the index mapping */ public void rationalize(IndexMapping xfmapping) { if (defaultFormat) { xfIndex = xfmapping.getNewIndex(xfIndex); } }
/** * Rationalizes the sheets xf index mapping * @param xfmapping the index mapping */ public void rationalize(IndexMapping xfmapping) { xfIndex = xfmapping.getNewIndex(xfIndex); }
/** * Rationalizes the sheet's xf index mapping * @param xfMapping the index mapping for XFRecords * @param fontMapping the index mapping for fonts * @param formatMapping the index mapping for formats */ public void rationalize(IndexMapping xfMapping, IndexMapping fontMapping, IndexMapping formatMapping) { if (!initialized) { initialize(); } // Read through the array, looking for the data types // This is a total hack bodge for now - it will eventually need to be // integrated properly int pos = 0; int code = 0; int length = 0; Type type = null; while (pos < data.Length) { code = IntegerHelper.getInt(data[pos],data[pos + 1]); length = IntegerHelper.getInt(data[pos + 2],data[pos + 3]); type = Type.getType(code); if (type == Type.FONTX) { int fontind = IntegerHelper.getInt(data[pos + 4],data[pos + 5]); IntegerHelper.getTwoBytes(fontMapping.getNewIndex(fontind), data,pos + 4); } else if (type == Type.FBI) { int fontind = IntegerHelper.getInt(data[pos + 12],data[pos + 13]); IntegerHelper.getTwoBytes(fontMapping.getNewIndex(fontind), data,pos + 12); } else if (type == Type.IFMT) { int formind = IntegerHelper.getInt(data[pos + 4],data[pos + 5]); IntegerHelper.getTwoBytes(formatMapping.getNewIndex(formind), data,pos + 4); } else if (type == Type.ALRUNS) { int numRuns = IntegerHelper.getInt(data[pos + 4],data[pos + 5]); int fontPos = pos + 6; for (int i = 0; i < numRuns; i++) { int fontind = IntegerHelper.getInt(data[fontPos + 2], data[fontPos + 3]); IntegerHelper.getTwoBytes(fontMapping.getNewIndex(fontind), data,fontPos + 2); fontPos += 4; } } pos += length + 4; } }