Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/sl/draw/DrawFactory.java
/* ====================================================================
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.draw;
import java.awt.Graphics2D;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.text.AttributedString;
import org.apache.poi.sl.usermodel.Background;
import org.apache.poi.sl.usermodel.ConnectorShape;
import org.apache.poi.sl.usermodel.FreeformShape;
import org.apache.poi.sl.usermodel.GraphicalFrame;
import org.apache.poi.sl.usermodel.GroupShape;
import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.sl.usermodel.PictureShape;
import org.apache.poi.sl.usermodel.PlaceableShape;
import org.apache.poi.sl.usermodel.Shape;
import org.apache.poi.sl.usermodel.Sheet;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.TableShape;
import org.apache.poi.sl.usermodel.TextBox;
import org.apache.poi.sl.usermodel.TextParagraph;
import org.apache.poi.sl.usermodel.TextShape;
public class DrawFactory {
private static final ThreadLocal<DrawFactory> defaultFactory = new ThreadLocal<>();
/**
* Set a custom draw factory for the current thread.
* This is a fallback, for operations where usercode can't set a graphics context.
* Preferably use the rendering hint {@link Drawable#DRAW_FACTORY} to set the factory.
*
* @param factory the custom factory or {@code null} to reset/remove the default factory
*/
@SuppressWarnings("unused")
public static void setDefaultFactory(DrawFactory factory) {
if (factory == null) {
defaultFactory.remove();
} else {
defaultFactory.set(factory);
}
}
/**
* Returns the DrawFactory, preferably via a graphics instance.
* If graphics is null, the current thread local is checked or
* if it is not set, a new factory is created.
*
* @param graphics the current graphics context or null
* @return the draw factory
*/
public static DrawFactory getInstance(Graphics2D graphics) {
// first try to find the factory over the rendering hint
DrawFactory factory = null;
boolean isHint = false;
if (graphics != null) {
factory = (DrawFactory)graphics.getRenderingHint(Drawable.DRAW_FACTORY);
isHint = (factory != null);
}
// secondly try the thread local default
if (factory == null) {
factory = defaultFactory.get();
}
// and at last, use the default factory
if (factory == null) {
factory = new DrawFactory();
}
if (graphics != null && !isHint) {
graphics.setRenderingHint(Drawable.DRAW_FACTORY, factory);
}
return factory;
}
public Drawable getDrawable(Shape<?,?> shape) {
if (shape instanceof TextBox) {
return getDrawable((TextBox<?,?>)shape);
} else if (shape instanceof FreeformShape) {
return getDrawable((FreeformShape<?,?>)shape);
} else if (shape instanceof TextShape) {
return getDrawable((TextShape<?,?>)shape);
} else if (shape instanceof TableShape) {
return getDrawable((TableShape<?,?>)shape);
} else if (shape instanceof GroupShape) {
return getDrawable((GroupShape<?,?>)shape);
} else if (shape instanceof PictureShape) {
return getDrawable((PictureShape<?,?>)shape);
} else if (shape instanceof GraphicalFrame) {
return getDrawable((GraphicalFrame<?,?>)shape);
} else if (shape instanceof Background) {
return getDrawable((Background<?,?>)shape);
} else if (shape instanceof ConnectorShape) {
return getDrawable((ConnectorShape<?,?>)shape);
} else if (shape instanceof Slide) {
return getDrawable((Slide<?,?>)shape);
} else if (shape instanceof MasterSheet) {
return getDrawable((MasterSheet<?,?>)shape);
} else if (shape instanceof Sheet) {
return getDrawable((Sheet<?,?>)shape);
} else if (shape.getClass().isAnnotationPresent(DrawNotImplemented.class)) {
return new DrawNothing(shape);
}
throw new IllegalArgumentException("Unsupported shape type: "+shape.getClass());
}
public DrawSlide getDrawable(Slide<?,?> sheet) {
return new DrawSlide(sheet);
}
public DrawSheet getDrawable(Sheet<?,?> sheet) {
return new DrawSheet(sheet);
}
public DrawMasterSheet getDrawable(MasterSheet<?,?> sheet) {
return new DrawMasterSheet(sheet);
}
public DrawTextBox getDrawable(TextBox<?,?> shape) {
return new DrawTextBox(shape);
}
public DrawFreeformShape getDrawable(FreeformShape<?,?> shape) {
return new DrawFreeformShape(shape);
}
public DrawConnectorShape getDrawable(ConnectorShape<?,?> shape) {
return new DrawConnectorShape(shape);
}
public DrawTableShape getDrawable(TableShape<?,?> shape) {
return new DrawTableShape(shape);
}
public DrawTextShape getDrawable(TextShape<?,?> shape) {
return new DrawTextShape(shape);
}
public DrawGroupShape getDrawable(GroupShape<?,?> shape) {
return new DrawGroupShape(shape);
}
public DrawPictureShape getDrawable(PictureShape<?,?> shape) {
return new DrawPictureShape(shape);
}
public DrawGraphicalFrame getDrawable(GraphicalFrame<?,?> shape) {
return new DrawGraphicalFrame(shape);
}
public DrawTextParagraph getDrawable(TextParagraph<?,?,?> paragraph) {
return new DrawTextParagraph(paragraph);
}
public DrawBackground getDrawable(Background<?,?> shape) {
return new DrawBackground(shape);
}
@SuppressWarnings("WeakerAccess")
public DrawTextFragment getTextFragment(TextLayout layout, AttributedString str) {
return new DrawTextFragment(layout, str);
}
public DrawPaint getPaint(PlaceableShape<?,?> shape) {
return new DrawPaint(shape);
}
/**
* Convenience method for drawing single shapes.
* For drawing whole slides, use {@link Slide#draw(Graphics2D)}
*
* @param graphics the graphics context to draw to
* @param shape the shape
* @param bounds the bounds within the graphics context to draw to
*/
public void drawShape(Graphics2D graphics, Shape<?,?> shape, Rectangle2D bounds) {
Rectangle2D shapeBounds = shape.getAnchor();
if (shapeBounds.isEmpty() || (bounds != null && bounds.isEmpty())) {
return;
}
AffineTransform txg = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
AffineTransform tx = new AffineTransform();
try {
if (bounds != null) {
double scaleX = bounds.getWidth()/shapeBounds.getWidth();
double scaleY = bounds.getHeight()/shapeBounds.getHeight();
tx.translate(bounds.getCenterX(), bounds.getCenterY());
tx.scale(scaleX, scaleY);
tx.translate(-shapeBounds.getCenterX(), -shapeBounds.getCenterY());
}
graphics.setRenderingHint(Drawable.GROUP_TRANSFORM, tx);
Drawable d = getDrawable(shape);
d.applyTransform(graphics);
d.draw(graphics);
} finally {
graphics.setRenderingHint(Drawable.GROUP_TRANSFORM, txg);
}
}
/**
* Return a FontManager, either registered beforehand or a default implementation
*
* @param graphics the graphics context holding potentially a font manager
* @return the font manager
*/
public DrawFontManager getFontManager(Graphics2D graphics) {
DrawFontManager fontHandler = (DrawFontManager)graphics.getRenderingHint(Drawable.FONT_HANDLER);
return (fontHandler != null) ? fontHandler : new DrawFontManagerDefault();
}
}⏎ org/apache/poi/sl/draw/DrawFactory.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, ≈326🔥, 0💬
Popular Posts:
maven-compat-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Compact module. The JAR file name may ...
Java Servlet API 4.0.1 Source Code Files are important if you want to compile them with different JD...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
HttpComponents Client Source Code Files are provided in the source package file, httpcomponents-clie...
What Is jtds-1.2.2.jar? jtds-1.2.2.jar is the JAR files of jTDS Java library 1.2.2, which is a JDBC ...