ASF Bugzilla – Attachment 32956 Details for
Bug 58206
provide a mechanism to find slide layouts by name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch with proposed changes
0001-ENH-provide-a-mechanism-to-find-slide-layouts-by-nam.patch (text/plain), 3.07 KB, created by
mark.o
on 2015-08-04 08:56:35 UTC
(
hide
)
Description:
patch with proposed changes
Filename:
MIME Type:
Creator:
mark.o
Created:
2015-08-04 08:56:35 UTC
Size:
3.07 KB
patch
obsolete
>From 2e903069e4371a43af1ba045b464a66aba50fe47 Mon Sep 17 00:00:00 2001 >From: Mark Olesen <Mark.Olesen@faurecia.com> >Date: Tue, 4 Aug 2015 10:48:00 +0200 >Subject: [PATCH] ENH: provide a mechanism to find slide layouts by name. > >- when there are several CUSTOM layouts being used, the layout name > is the only useful means of locating them. > >- provide a top-level findLayout() mechanism that searches the masters > in their declaration order. >--- > .../apache/poi/xslf/usermodel/XMLSlideShow.java | 22 ++++++++++++++++++++ > .../apache/poi/xslf/usermodel/XSLFSlideMaster.java | 20 ++++++++++++++++++ > 2 files changed, 42 insertions(+), 0 deletions(-) > >diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java >index 453c1b1..4551eae 100644 >--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java >+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java >@@ -476,6 +476,28 @@ public class XMLSlideShow extends POIXMLDocument implements SlideShow { > return null; > } > >+ >+ /** >+ * Scan the master slides for the first slide layout with the given name. >+ * >+ * @param name The layout name (case-insensitive). Cannot be null. >+ * >+ * @return the first layout found or null on failure >+ */ >+ public XSLFSlideLayout findLayout(String name) >+ { >+ for (XSLFSlideMaster master : getSlideMasters()) >+ { >+ XSLFSlideLayout layout = master.getLayout(name); >+ if (layout != null) >+ { >+ return layout; >+ } >+ } >+ return null; >+ } >+ >+ > public XSLFTableStyles getTableStyles(){ > return _tableStyles; > } >diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java >index 26b5dc0..970cdce 100644 >--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java >+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java >@@ -108,6 +108,13 @@ import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument; > return getLayouts().values().toArray(new XSLFSlideLayout[_layouts.size()]); > } > >+ /** >+ * Get the slide layout by type. >+ * >+ * @param type The layout type. Cannot be null. >+ * >+ * @return the layout found or null on failure >+ */ > public XSLFSlideLayout getLayout(SlideLayout type){ > for(XSLFSlideLayout layout : getLayouts().values()){ > if(layout.getType() == type) { >@@ -117,6 +124,19 @@ import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument; > return null; > } > >+ /** >+ * Get the slide layout by name. >+ * >+ * @param name The layout name (case-insensitive). Cannot be null. >+ * >+ * @return the layout found or null on failure >+ */ >+ public XSLFSlideLayout getLayout(String name) >+ { >+ return getLayouts().get(name.toLowerCase()); >+ } >+ >+ > @Override > public XSLFTheme getTheme(){ > if(_theme == null){ >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 58206
: 32956