incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r795171 - /websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html
Date Fri, 02 Sep 2011 09:57:21 GMT
Author: buildbot
Date: Fri Sep  2 09:57:21 2011
New Revision: 795171

Log:
Staging update by buildbot

Modified:
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html

Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html Fri Sep  2
09:57:21 2011
@@ -78,215 +78,84 @@
   <div id="contenta">
   
     
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" href="../images/style.css" type="text/css" />
-<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
-<title>Demos - SimpleODF</title>
-<style type="text/css">
-<!--
-.STYLE1 {
-    color: #FFFFFF;
-    font-size: 24px;
-}
-.STYLE2 {font-size: 32px}
-.STYLE3 {font-size: 16px}
-.STYLE4 {font-size: 36px}
--->
-    </style>
-    <script type="text/javascript">
-
-<p>var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-22366020-1']);
-  _gaq.push(['_trackPageview']);</p>
-<p>(function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();</p>
-<p></script>
-</head>
-<body>
-<div id="page" align="center">
-  <div id="content" style="width:920px" class="contentpanel">
-    <div id="topheader">
-      <div class="topright"> </div>
-    </div>
-    <div id="menu">
-      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home">
</a> <a href="../downloads.html" class="download"></a> <a href="../documents.html"
class="document"></a> <a href="../demo/index.html" class="sample"> </a>
</div>
-    </div>
-    <div id="subcontent" align ="left">
-        <div align="left" class="titletext"> <span >
-        <a href="index.html">Simple Demos<a> &gt; 
-        <a href="demo5.html">Demo 4: Multiple Presentations Assembler<a>
-        </span> 
-        </div></p>
-<div class="codehilite"><pre>    <span class="sr">&lt;!----------------------------------------------------------------------------------------------------&gt;</span>
-</pre></div>
-
-
-<div class="contenttitle">
-
-<div class="codehilite"><pre><span class="nt">&lt;a</span> <span
class="na">name=</span><span class="s">&quot;overview&quot;</span><span
class="nt">&gt;</span>Overview<span class="nt">&lt;/a&gt;</span>
-</pre></div>
-
-
-</div>
-
-<div class="bodytext">
-
-<div class="codehilite"><pre><span class="nt">&lt;p&gt;</span>
If you make a lot of presentations in your daily work, you  know that you don&#39;t always
 create a presentation from scratch. 
-Assembling several different presentations together to make a new presentation, e.g. copying
several pages from presentation A 
-and copying another several pages from presentation B, is a common activity for the presentation
author.
-<span class="nt">&lt;br&gt;</span> This demo provides a Java application
that can assemble  specific pages of presentations together and make one presentation from
the command line.
-<span class="nt">&lt;br&gt;</span> Here is an example. I want to make
a presentation with the first page from presentation A, 
-the first page from presentation B and  the first page from presentation C. I can call the
following command:
-<span class="nt">&lt;br&gt;&lt;code&gt;</span>Java PresentationAssembler
-in PresentationA.odp(1) -in PresentationB.odp(1) -in PresentationC.odp(1-2) -out newPresentation.odp<span
class="nt">&lt;/code&gt;</span>
-<span class="nt">&lt;br/&gt;</span> <span class="nt">&lt;br/&gt;</span>
A new presentation will be generated which is showed in the following picture. You can see,
the pictures, the styles and master pages are copied also.<span class="nt">&lt;br/&gt;</span>
<span class="nt">&lt;br/&gt;</span> <span class="ni">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</span><span
class="nt">&lt;img</span>
-
-<span class="na">src=</span><span class="s">&quot;image/demo5_doc.jpg&quot;</span>
<span class="nt">&gt;&lt;br/&gt;</span> <span class="nt">&lt;br/&gt;</span>
In the next section, I will show how easy it is to create this assembling application using
the Simple API.
-
-<span class="nt">&lt;/p&gt;</span>
-</pre></div>
-
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-<div class="codehilite"><pre><span class="nt">&lt;a</span> <span
class="na">name=</span><span class="s">&quot;codeintroduction&quot;</span><span
class="nt">&gt;</span>Code Introduction<span class="nt">&lt;/a&gt;</span>
-</pre></div>
-
-
-</div>
-
-<div class="bodytext">
-
-<div class="codehilite"><pre><span class="nt">&lt;p&gt;</span>
-<span class="nt">&lt;code&gt;</span>assemble<span class="nt">&lt;/code&gt;</span>
is the method that accepts the command line parameters, analyzes them, and assembles presentations

-with the Simple Java API for ODF. In this method, a new presentation is created, and then,
pages from other presentation 
-documents are attached while the command line is being analyzed. Simple Java API for ODF
provides very simple methods to
-copy pages from other presentations:
- <span class="nt">&lt;br&gt;</span>
- <span class="nt">&lt;br&gt;&lt;code&gt;</span>PresentationDocument.copyForeignSlide(int
destIndex, PresentationDocument srcDoc, int srcIndex)<span class="nt">&lt;/code&gt;</span>
- <span class="nt">&lt;br&gt;</span>and
- <span class="nt">&lt;br&gt;&lt;code&gt;</span>PresentationDocument.appendPresentation(PresentationDocument
srcDoc)<span class="nt">&lt;/code&gt;</span>.
- <span class="nt">&lt;br&gt;</span>
- <span class="nt">&lt;br&gt;</span>After the slides are attached, the
first slide of the new presentation is deleted by invoking method 
- <span class="nt">&lt;code&gt;</span>PresentationDocument.deleteSlideByIndex(int
index)<span class="nt">&lt;/code&gt;</span>. 
- This is because the first slide is an empty slide which was created when the new presentation
was created with 
- method <span class="nt">&lt;code&gt;</span>PresentationDocument.newPresentationDocument()<span
class="nt">&lt;/code&gt;</span>
-
-<span class="nt">&lt;/p&gt;</span>
-<span class="nt">&lt;p&gt;</span>Below is the source code of method <span
class="nt">&lt;code&gt;</span>assemble<span class="nt">&lt;/code&gt;</span>.
Most of the code is used to analyze the command line
-parameters. Only a few statements are used to attach slides to the new presentation. So you
can see how powerful 
-functions Simple Java API for ODF provides.  <span class="nt">&lt;/p&gt;</span>
-
-<span class="c">&lt;!--java code--&gt;</span>
-
-<span class="nt">&lt;pre</span> <span class="na">class=</span><span
class="s">&quot;brush:java;&quot;</span><span class="nt">&gt;</span>
-
-public void assemble(String[] args) throws Exception
-{
-    String outputFileName=&quot;default.odp&quot;;
-    int pageIndex = 1;
-    PresentationDocument doc = PresentationDocument.newPresentationDocument();
-    int i=0;
-    while (i <span class="nt">&lt; args.length</span><span class="err">)</span>
-    <span class="err">{</span>
-        <span class="err">String</span> <span class="na">param =</span>
<span class="s">args[i];</span>
-        <span class="err">if</span> <span class="err">(param.equals(&quot;-out&quot;))</span>
<span class="err">//get</span> <span class="err">the</span> <span
class="err">output</span> <span class="err">file</span> <span class="err">name</span>
-            <span class="na">outputFileName =</span> <span class="s">args[++i];</span>
-        <span class="err">else</span> <span class="err">if</span>
<span class="err">(param.equals(&quot;-in&quot;))</span> <span class="err">//get</span>
<span class="err">the</span> <span class="err">input</span> <span
class="err">file</span> <span class="err">name</span> 
-        <span class="err">{</span>
-            <span class="err">String</span> <span class="na">pageDesc =</span>
<span class="s">args[++i];</span>
-            <span class="err">String</span> <span class="na">filename =</span>
<span class="s">pageDesc,</span> <span class="err">pagelist;</span>
-            <span class="err">int</span> <span class="na">indexStart =</span>
<span class="s">pageDesc.indexOf(&#39;(&#39;);</span> <span class="err">//get</span>
<span class="err">the</span> <span class="err">page</span> <span
class="err">numbers</span>
-            <span class="err">int[]</span> <span class="na">srcPages =</span>
<span class="s">null;</span>
-            <span class="err">if</span> <span class="err">(indexStart</span>
<span class="nt">&gt;</span> -1)
-            {
-                filename = pageDesc.substring(0, indexStart);
-                pagelist = pageDesc.substring(indexStart+1, pageDesc.length()-1);
-                srcPages = getPageNumbers(pagelist); //analysis the page number description

-                                                     //and return all page numbers that need
to be copied
-            }
-            PresentationDocument sourceDoc = PresentationDocument.loadDocument(new File(filename));
-            if (srcPages==null)
-            {
-                doc.appendPresentation(sourceDoc);
-                pageIndex += sourceDoc.getSlideCount();
-            } else for(int j=0;j <span class="nt">&lt; srcPages.length</span><span
class="err">;j++)</span>
-            <span class="err">{</span>
-                <span class="err">doc.copyForeignSlide(pageIndex,</span> <span
class="err">sourceDoc,</span> <span class="err">srcPages[j]);</span>
-                <span class="err">pageIndex++;</span>
-            <span class="err">}</span>
-        <span class="err">}</span>
-        <span class="err">i++;</span>
-    <span class="err">}</span>
-    <span class="err">doc.deleteSlideByIndex(0);</span>
-    <span class="err">doc.save(outputFileName);</span>
-    <span class="err">doc.close();</span>
-<span class="err">}</span>
-
-<span class="err">&lt;/pre</span><span class="nt">&gt;</span>
-</pre></div>
-
-
+    <p><strong><a href="index.html">Demos</a></strong> &gt;
 Multiple Presentations Assembler  <br />
 </p>
-
-<p>
-
+<p><strong>Overview</strong> <br />
 </p>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-<div class="codehilite"><pre><span class="nt">&lt;a</span> <span
class="na">name=</span><span class="s">&quot;download&quot;</span><span
class="nt">&gt;</span>Download<span class="nt">&lt;/a&gt;</span>
-</pre></div>
-
-
-</div>
-
-<div class="bodytext">
-
-<div class="codehilite"><pre><span class="nt">&lt;p&gt;</span>
-
-Powered by the Simple Java API for ODF version  <span class="nt">&lt;a</span>
<span class="na">target=</span><span class="s">&quot;_new&quot;</span>
<span class="na">href=</span><span class="s">&quot;../downloads.html&quot;</span><span
class="nt">&gt;&lt;img</span> <span class="na">src=</span><span
class="s">&quot;../images/link.png&quot;</span><span class="nt">&gt;&lt;/img&gt;</span>0.4.5<span
class="nt">&lt;/a&gt;</span>.
-
-<span class="nt">&lt;/p&gt;</span>
-
-<span class="nt">&lt;p&gt;</span>
-
-You can download the code of this demo from <span class="nt">&lt;a</span>
<span class="na">href=</span><span class="s">&quot;PresentationAssembler.zip&quot;</span><span
class="nt">&gt;</span>here<span class="nt">&lt;/a&gt;</span>.
-
-<span class="nt">&lt;/p&gt;</span>
-</pre></div>
-
-
-<p></div>
-<!---------------------------------------------------------------------------------------------------->
  <br />
+<p>If you make a lot of presentations in your daily work, you  know that you don't
always create a presentation from scratch.<br />
+</p>
+<p>Assembling several different presentations together to make a new presentation,
e.g. copying several pages from presentation A and copying another several pages from presentation
B, is a common activity for the presentation author.
+This demo provides a Java application that can assemble  specific pages of presentations
together and make one presentation from the command line.   <br />
+</p>
+<p>Here is an example. I want to make a presentation with the first page from presentation
A, the first page from presentation B and  the first page from presentation C. I can call
the following command: <br />
+</p>
+<p><code>Java PresentationAssembler -in PresentationA.odp(1) -in PresentationB.odp(1)
-in PresentationC.odp(1-2) -out newPresentation.odp</code>   <br />
+</p>
+<p>A new presentation will be generated which is showed in the following picture. You
can see, the pictures, the styles and master pages are copied too.<br />
+</p>
+<p><img alt="alt text" src="image/demo5_doc.jpg" /> <br />
+</p>
+<p>In the next section, I will show how easy it is to create this assembling application
using the Simple API.<br />
 </p>
-<div class="codehilite"><pre>        <span class="nt">&lt;/div&gt;</span>
-<span class="nt">&lt;div</span> <span class="na">id=</span><span
class="s">&quot;footer&quot;</span> <span class="na">class=</span><span
class="s">&quot;smallgraytext&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;a</span> <span class="na">href=</span><span
class="s">&quot;#&quot;</span><span class="nt">&gt;</span>Home<span
class="nt">&lt;/a&gt;</span> | <span class="nt">&lt;a</span>
<span class="na">href=</span><span class="s">&quot;#&quot;</span><span
class="nt">&gt;</span>About Us<span class="nt">&lt;/a&gt;</span>
| <span class="nt">&lt;a</span> <span class="na">href=</span><span
class="s">&quot;#&quot;</span><span class="nt">&gt;</span>Contact
Us<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;/div&gt;</span>
+<p><strong>Code Introduction</strong></p>
+<p><code>assemble</code> is the method that accepts the command line parameters,
analyzes them, and assembles presentations with the Simple API. In this method, a new presentation
is created, and then, pages from other presentation documents are attached while the command
line is being analyzed. Simple API provides very simple methods to copy pages from other presentations:
+<code>PresentationDocument.copyForeignSlide(int destIndex, PresentationDocument srcDoc,
int srcIndex)</code> and
+<code>PresentationDocument.appendPresentation(PresentationDocument srcDoc)</code>.
 <br />
+</p>
+<p>After the slides are attached, the first slide of the new presentation is deleted
by invoking method <code>PresentationDocument.deleteSlideByIndex(int index)</code>.
 <br />
+</p>
+<p>This is because the first slide is an empty slide which was created when the new
presentation was created with method <code>PresentationDocument.newPresentationDocument()</code>
<br />
+</p>
+<p>Below is the source code of method <code>assemble</code>. Most of the
code is used to analyze the command line parameters. Only a few statements are used to attach
slides to the new presentation. So you can see how powerful functions Simple API provides.<br
/>
+</p>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">void</span> <span class="n">assemble</span><span class="p">(</span><span
class="n">String</span><span class="o">[]</span> <span class="n">args</span><span
class="p">)</span> <span class="n">throws</span> <span class="n">Exception</span>
+<span class="p">{</span>
+    <span class="n">String</span> <span class="n">outputFileName</span><span
class="o">=</span><span class="s">&quot;default.odp&quot;</span><span
class="p">;</span>
+    <span class="nb">int</span> <span class="n">pageIndex</span>
<span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
+    <span class="n">PresentationDocument</span> <span class="n">doc</span>
<span class="o">=</span> <span class="n">PresentationDocument</span><span
class="o">.</span><span class="n">newPresentationDocument</span><span
class="p">();</span>
+    <span class="nb">int</span> <span class="n">i</span><span
class="o">=</span><span class="mi">0</span><span class="p">;</span>
+    <span class="k">while</span> <span class="p">(</span><span
class="n">i</span> <span class="o">&lt;</span> <span class="n">args</span><span
class="o">.</span><span class="nb">length</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">String</span> <span class="n">param</span>
<span class="o">=</span> <span class="n">args</span><span class="p">[</span><span
class="n">i</span><span class="p">];</span>
+        <span class="k">if</span> <span class="p">(</span><span
class="n">param</span><span class="o">.</span><span class="n">equals</span><span
class="p">(</span><span class="s">&quot;-out&quot;</span><span
class="p">))</span> <span class="sr">//g</span><span class="n">et</span>
<span class="n">the</span> <span class="n">output</span> <span
class="n">file</span> <span class="n">name</span>
+            <span class="n">outputFileName</span> <span class="o">=</span>
<span class="n">args</span><span class="p">[</span><span class="o">++</span><span
class="n">i</span><span class="p">];</span>
+        <span class="k">else</span> <span class="k">if</span> <span
class="p">(</span><span class="n">param</span><span class="o">.</span><span
class="n">equals</span><span class="p">(</span><span class="s">&quot;-in&quot;</span><span
class="p">))</span> <span class="sr">//g</span><span class="n">et</span>
<span class="n">the</span> <span class="n">input</span> <span class="n">file</span>
<span class="n">name</span> 
+        <span class="p">{</span>
+            <span class="n">String</span> <span class="n">pageDesc</span>
<span class="o">=</span> <span class="n">args</span><span class="p">[</span><span
class="o">++</span><span class="n">i</span><span class="p">];</span>
+            <span class="n">String</span> <span class="n">filename</span>
<span class="o">=</span> <span class="n">pageDesc</span><span class="p">,</span>
<span class="n">pagelist</span><span class="p">;</span>
+            <span class="nb">int</span> <span class="n">indexStart</span>
<span class="o">=</span> <span class="n">pageDesc</span><span class="o">.</span><span
class="n">indexOf</span><span class="p">(</span><span class="s">&#39;(&#39;</span><span
class="p">);</span> <span class="sr">//g</span><span class="n">et</span>
<span class="n">the</span> <span class="n">page</span> <span class="n">numbers</span>
+            <span class="nb">int</span><span class="o">[]</span>
<span class="n">srcPages</span> <span class="o">=</span> <span
class="n">null</span><span class="p">;</span>
+            <span class="k">if</span> <span class="p">(</span><span
class="n">indexStart</span> <span class="o">&gt;</span> <span
class="o">-</span><span class="mi">1</span><span class="p">)</span>
+            <span class="p">{</span>
+                <span class="n">filename</span> <span class="o">=</span>
<span class="n">pageDesc</span><span class="o">.</span><span class="n">substring</span><span
class="p">(</span><span class="mi">0</span><span class="p">,</span>
<span class="n">indexStart</span><span class="p">);</span>
+                <span class="n">pagelist</span> <span class="o">=</span>
<span class="n">pageDesc</span><span class="o">.</span><span class="n">substring</span><span
class="p">(</span><span class="n">indexStart</span><span class="o">+</span><span
class="mi">1</span><span class="p">,</span> <span class="n">pageDesc</span><span
class="o">.</span><span class="nb">length</span><span class="p">()</span><span
class="o">-</span><span class="mi">1</span><span class="p">);</span>
+                <span class="n">srcPages</span> <span class="o">=</span>
<span class="n">getPageNumbers</span><span class="p">(</span><span
class="n">pagelist</span><span class="p">);</span> <span class="sr">//</span><span
class="n">analysis</span> <span class="n">the</span> <span class="n">page</span>
<span class="n">number</span> <span class="n">description</span> 
+                                                     <span class="sr">//</span><span
class="ow">and</span> <span class="k">return</span> <span class="n">all</span>
<span class="n">page</span> <span class="n">numbers</span> <span
class="n">that</span> <span class="n">need</span> <span class="n">to</span>
<span class="n">be</span> <span class="n">copied</span>
+            <span class="p">}</span>
+            <span class="n">PresentationDocument</span> <span class="n">sourceDoc</span>
<span class="o">=</span> <span class="n">PresentationDocument</span><span
class="o">.</span><span class="n">loadDocument</span><span class="p">(</span><span
class="k">new</span> <span class="n">File</span><span class="p">(</span><span
class="n">filename</span><span class="p">));</span>
+            <span class="k">if</span> <span class="p">(</span><span
class="n">srcPages</span><span class="o">==</span><span class="n">null</span><span
class="p">)</span>
+            <span class="p">{</span>
+                <span class="n">doc</span><span class="o">.</span><span
class="n">appendPresentation</span><span class="p">(</span><span class="n">sourceDoc</span><span
class="p">);</span>
+                <span class="n">pageIndex</span> <span class="o">+=</span>
<span class="n">sourceDoc</span><span class="o">.</span><span class="n">getSlideCount</span><span
class="p">();</span>
+            <span class="p">}</span> <span class="k">else</span>
<span class="k">for</span><span class="p">(</span><span class="nb">int</span>
<span class="n">j</span><span class="o">=</span><span class="mi">0</span><span
class="p">;</span><span class="n">j</span> <span class="o">&lt;</span>
<span class="n">srcPages</span><span class="o">.</span><span class="nb">length</span><span
class="p">;</span><span class="n">j</span><span class="o">++</span><span
class="p">)</span>
+            <span class="p">{</span>
+                <span class="n">doc</span><span class="o">.</span><span
class="n">copyForeignSlide</span><span class="p">(</span><span class="n">pageIndex</span><span
class="p">,</span> <span class="n">sourceDoc</span><span class="p">,</span>
<span class="n">srcPages</span><span class="p">[</span><span class="n">j</span><span
class="p">]);</span>
+                <span class="n">pageIndex</span><span class="o">++</span><span
class="p">;</span>
+            <span class="p">}</span>
+        <span class="p">}</span>
+        <span class="n">i</span><span class="o">++</span><span
class="p">;</span>
+    <span class="p">}</span>
+    <span class="n">doc</span><span class="o">.</span><span class="n">deleteSlideByIndex</span><span
class="p">(</span><span class="mi">0</span><span class="p">);</span>
+    <span class="n">doc</span><span class="o">.</span><span class="n">save</span><span
class="p">(</span><span class="n">outputFileName</span><span class="p">);</span>
+    <span class="n">doc</span><span class="o">.</span><span class="nb">close</span><span
class="p">();</span>
+<span class="p">}</span>
 </pre></div>
 
 
-<p></div>
-</div>
-</body>
-</html></p>
-<script type="text/javascript" src="scripts/shCore.js"></script>
-
-<script type="text/javascript" src="scripts/shBrushJava.js"></script>
-
-<script type="text/javascript"> SyntaxHighlighter.all();</script>
+<p><strong>Download</strong><br />
+</p>
+<p>Powered by the Simple Java API for ODF version  <a target="_new" href="../downloads.html">0.4.5</a>.<br
/>
+You can download the code of this demo from <a href="PresentationAssembler.zip">here</a>.</p>
   </div>
 
   <div id="footera">



Mime
View raw message