mirror of https://github.com/apache/poi.git
Pull out the parts of TextPainter needed by XSLF from HSLF to common-SL in core #57963
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1682209 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f2dba42227
commit
e4ef91f186
|
@ -0,0 +1,62 @@
|
|||
/* ====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.sl.usermodel;
|
||||
|
||||
import java.awt.RenderingHints;
|
||||
import java.text.AttributedString;
|
||||
|
||||
/**
|
||||
* Common parent for painting Text into a Graphics2D object
|
||||
* for rendering
|
||||
*/
|
||||
public interface TextPainter {
|
||||
public static final Key KEY_FONTFALLBACK = new Key(50, "Font fallback map");
|
||||
public static final Key KEY_FONTMAP = new Key(51, "Font map");
|
||||
|
||||
public static class TextElement {
|
||||
public AttributedString _text;
|
||||
public int _textOffset;
|
||||
public AttributedString _bullet;
|
||||
public int _bulletOffset;
|
||||
public int _align;
|
||||
public float ascent, descent;
|
||||
public float advance;
|
||||
public int textStartIndex, textEndIndex;
|
||||
}
|
||||
|
||||
public static class Key extends RenderingHints.Key {
|
||||
String description;
|
||||
|
||||
public Key(int paramInt, String paramString) {
|
||||
super(paramInt);
|
||||
this.description = paramString;
|
||||
}
|
||||
|
||||
public final int getIndex() {
|
||||
return intKey();
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public boolean isCompatibleValue(Object paramObject) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.hslf.model.TextPainter;
|
||||
import org.apache.poi.sl.model.TextPainter;
|
||||
import org.apache.poi.util.Beta;
|
||||
import org.apache.poi.util.Internal;
|
||||
import org.apache.poi.util.Units;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.awt.image.BufferedImage;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.hslf.model.TextPainter;
|
||||
import org.apache.poi.sl.model.TextPainter;
|
||||
import org.apache.poi.util.JvmBugs;
|
||||
import org.apache.poi.xslf.XSLFTestDataSamples;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.poi.hslf.model;
|
|||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.LineBreakMeasurer;
|
||||
import java.awt.font.TextAttribute;
|
||||
|
@ -41,13 +40,8 @@ import org.apache.poi.util.POILogger;
|
|||
|
||||
/**
|
||||
* Paint text into java.awt.Graphics2D
|
||||
*
|
||||
* @author Yegor Kozlov
|
||||
*/
|
||||
public final class TextPainter {
|
||||
public static final Key KEY_FONTFALLBACK = new Key(50, "Font fallback map");
|
||||
public static final Key KEY_FONTMAP = new Key(51, "Font map");
|
||||
|
||||
public final class TextPainter implements org.apache.poi.sl.usermodel.TextPainter {
|
||||
protected POILogger logger = POILogFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
|
@ -383,36 +377,4 @@ public final class TextPainter {
|
|||
TextElement[] elems = new TextElement[lines.size()];
|
||||
return lines.toArray(elems);
|
||||
}
|
||||
|
||||
public static class TextElement {
|
||||
public AttributedString _text;
|
||||
public int _textOffset;
|
||||
public AttributedString _bullet;
|
||||
public int _bulletOffset;
|
||||
public int _align;
|
||||
public float ascent, descent;
|
||||
public float advance;
|
||||
public int textStartIndex, textEndIndex;
|
||||
}
|
||||
|
||||
public static class Key extends RenderingHints.Key {
|
||||
String description;
|
||||
|
||||
public Key(int paramInt, String paramString) {
|
||||
super(paramInt);
|
||||
this.description = paramString;
|
||||
}
|
||||
|
||||
public final int getIndex() {
|
||||
return intKey();
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public boolean isCompatibleValue(Object paramObject) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue