-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
coltware
committed
Mar 9, 2011
0 parents
commit e3404c7
Showing
52 changed files
with
3,489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<actionScriptProperties analytics="false" mainApplicationPath="airxoox.as" projectUUID="afd0dba3-f17f-4ad3-a7d5-065c61a0693b" version="6"> | ||
<compiler additionalCompilerArguments="-locale ja_JP" autoRSLOrdering="true" copyDependentFiles="false" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" sourceFolderPath="as3" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true"> | ||
<compilerSourcePath> | ||
<compilerSourcePathEntry kind="1" linkType="1" path="samples"/> | ||
</compilerSourcePath> | ||
<libraryPath defaultLinkType="0"> | ||
<libraryPathEntry kind="4" path=""> | ||
<modifiedEntries> | ||
<libraryPathEntry index="6" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="true"> | ||
<crossDomainRsls> | ||
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.1.0.16076/rpc_4.1.0.16076.swz"/> | ||
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="rpc_4.1.0.16076.swz"/> | ||
</crossDomainRsls> | ||
</libraryPathEntry> | ||
<libraryPathEntry index="7" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="true"> | ||
<crossDomainRsls> | ||
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="spark_4.5.0.17855.swf"/> | ||
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.17855/spark_4.5.0.17855.swf"/> | ||
</crossDomainRsls> | ||
</libraryPathEntry> | ||
<libraryPathEntry index="5" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="true"> | ||
<crossDomainRsls> | ||
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.1.0.16076/sparkskins_4.1.0.16076.swz"/> | ||
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="sparkskins_4.1.0.16076.swz"/> | ||
</crossDomainRsls> | ||
</libraryPathEntry> | ||
</modifiedEntries> | ||
<excludedEntries> | ||
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/> | ||
</excludedEntries> | ||
</libraryPathEntry> | ||
<libraryPathEntry kind="1" linkType="1" path="libs"/> | ||
</libraryPath> | ||
<sourceAttachmentPath/> | ||
</compiler> | ||
<applications> | ||
<application path="airxoox.as"/> | ||
</applications> | ||
<modules/> | ||
<buildCSSFiles/> | ||
</actionScriptProperties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<flexLibProperties includeAllClasses="true" version="3"> | ||
<includeClasses/> | ||
<includeResources/> | ||
<namespaceManifests/> | ||
</flexLibProperties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>airxoox</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.adobe.flexbuilder.project.flexbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.adobe.flexbuilder.project.flexlibnature</nature> | ||
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Fri Nov 05 19:30:18 JST 2010 | ||
eclipse.preferences.version=1 | ||
encoding/<project>=utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright (c) 2009 coltware.com | ||
* http://www.coltware.com | ||
* | ||
* License: LGPL v3 ( http://www.gnu.org/licenses/lgpl-3.0-standalone.html ) | ||
* | ||
* @author [email protected] | ||
*/ | ||
package com.coltware.airxoox | ||
{ | ||
import com.coltware.airxoox.classes.OoxML; | ||
|
||
import com.coltware.airxlib.utils.FilenameUtils; | ||
|
||
import flash.filesystem.File; | ||
|
||
public final class Airxoox | ||
{ | ||
public static const EXTENSIONS:Array = ["xlsx","docx","pptx"]; | ||
|
||
public static function openFile(file:File,mode:String = null):OoxML{ | ||
|
||
var ext:String = FilenameUtils.getExtension(file.name); | ||
var oox:OoxML = null; | ||
if( ext == "xlsx"){ | ||
oox = new SpreadsheetML(); | ||
} | ||
else if( ext == "docx"){ | ||
oox = new WordML(); | ||
} | ||
else if(ext == "pptx"){ | ||
oox = new PresentationML(); | ||
} | ||
|
||
if(oox){ | ||
oox.openFile(file,mode); | ||
return oox; | ||
} | ||
return null; | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* Copyright (c) 2009 coltware.com | ||
* http://www.coltware.com | ||
* | ||
* License: LGPL v3 ( http://www.gnu.org/licenses/lgpl-3.0-standalone.html ) | ||
* | ||
* @author [email protected] | ||
*/ | ||
package com.coltware.airxoox { | ||
|
||
import com.coltware.airxoox.classes.*; | ||
import com.coltware.airxoox.dml.*; | ||
import com.coltware.airxoox.ppt.*; | ||
import com.coltware.airxzip.*; | ||
|
||
import flash.filesystem.*; | ||
import flash.net.*; | ||
|
||
|
||
public class PresentationML extends OoxML{ | ||
|
||
protected static const ROOT_TYPE:String = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; | ||
|
||
/** | ||
* ppt/_rels/presentaion.xml.rels | ||
*/ | ||
protected var pptRels:Relationships; | ||
|
||
protected var pptRoot:PPTRoot; | ||
|
||
protected var slideSize:Size; | ||
|
||
public function PresentationML() { | ||
|
||
} | ||
|
||
/** | ||
* override | ||
* | ||
*/ | ||
override protected function completeStartup():void{ | ||
var rootTypeFilename:String = appRelationShips.getTarget(PPTRoot.TYPE); | ||
|
||
pptRoot = new PPTRoot(getPackageXML(rootTypeFilename),this); | ||
slideSize = pptRoot.getSlideSize(); | ||
pptRels = new Relationships(getPackageXML("ppt/_rels/presentation.xml.rels")); | ||
|
||
} | ||
|
||
/** | ||
* スライドのID一覧を取得する | ||
* | ||
*/ | ||
public function getSlideIdList():Array{ | ||
var ret:Array = new Array(); | ||
var list:Array = pptRoot.getSlideIdList(); | ||
return list; | ||
} | ||
|
||
public function getSlide(rid:String):Slide{ | ||
var filename:String = pptRels.getTargetFromId(rid); | ||
if(filename){ | ||
filename = "ppt/" + filename; | ||
var xml:XML = getPackageXML(filename); | ||
var s:Slide = new Slide(xml); | ||
return s; | ||
} | ||
else{ | ||
return null; | ||
} | ||
} | ||
/** | ||
* width, height で指定されたサイズをもとに、表示するサイズ、位置を計算する | ||
* おもに、実際のCanvasなどに配置する際に使用する。 | ||
*/ | ||
public function computeXfrm(xfrm:Xfrm,width:uint,height:uint):Xfrm{ | ||
var w:uint = Math.floor((xfrm.width / slideSize.cx ) * width); | ||
var h:uint = Math.floor((xfrm.height / slideSize.cy ) * height); | ||
var x:uint = Math.floor((xfrm.x / slideSize.cx ) * width ); | ||
var y:uint = Math.floor((xfrm.y / slideSize.cy ) * height); | ||
|
||
xfrm.setScale(x,y,w,h); | ||
return xfrm; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/** | ||
* Copyright (c) 2009 coltware.com | ||
* http://www.coltware.com | ||
* | ||
* License: LGPL v3 ( http://www.gnu.org/licenses/lgpl-3.0-standalone.html ) | ||
* | ||
* @author [email protected] | ||
*/ | ||
package com.coltware.airxoox { | ||
|
||
import com.coltware.airxoox.classes.OoxML; | ||
import com.coltware.airxoox.core.AppProps; | ||
import com.coltware.airxoox.core.ContentTypes; | ||
import com.coltware.airxoox.excel.*; | ||
import com.coltware.airxoox.excel.SMLSharedStrings; | ||
import com.coltware.airxoox.excel.SMLWorkbook; | ||
import com.coltware.airxoox.excel.SMLWorksheet; | ||
import com.coltware.airxzip.*; | ||
|
||
import flash.events.*; | ||
import flash.filesystem.*; | ||
import flash.utils.*; | ||
|
||
import mx.logging.ILogger; | ||
import mx.logging.Log; | ||
|
||
use namespace airxoox_internal; | ||
|
||
public class SpreadsheetML extends OoxML{ | ||
|
||
private static var log:ILogger = Log.getLogger("com.coltware.airxoox.SpreadsheetML"); | ||
|
||
private var _relation:SMLWorkbookRelation; | ||
private var _workbook:SMLWorkbook; | ||
private var _sharedString:SMLSharedStrings; | ||
|
||
public function SpreadsheetML() { | ||
|
||
} | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
override protected function loadOnStartup(filename:String, entry:ZipEntry):Boolean{ | ||
|
||
if(filename == SMLWorkbookRelation.FILENAME){ | ||
_relation = new SMLWorkbookRelation(getEntryXML(entry)); | ||
} | ||
else if(filename == SMLSharedStrings.FILENAME){ | ||
_sharedString = new SMLSharedStrings(getEntryXML(entry)); | ||
} | ||
return false; | ||
} | ||
|
||
override public function saveFile(file:File):void{ | ||
|
||
var filename:String; | ||
|
||
if(_workbook.isUpdate){ | ||
filename = _workbook.getFilename(); | ||
writeXMLFile(filename,_workbook.getXML()); | ||
} | ||
if(_relation.isUpdate){ | ||
filename = SMLWorkbookRelation.FILENAME; | ||
writeXMLFile(filename,_relation.getXML()); | ||
} | ||
|
||
// if sheet is updated, save file | ||
var sheets:Array = _workbook.getSheetList(); | ||
var sheet:SMLWorksheet; | ||
for each(sheet in sheets){ | ||
if(sheet.isUpdate){ | ||
var rid:String = sheet.getRId(); | ||
filename = _relation.getFilename(rid); | ||
if(filename){ | ||
filename = "xl/" + filename; | ||
writeXMLFile(filename,sheet.getXML()); | ||
if(_fileList.indexOf(filename) == -1){ | ||
_fileList.push(filename); | ||
} | ||
} | ||
} | ||
} | ||
|
||
super.saveFile(file); | ||
} | ||
|
||
public function getWorkbook():SMLWorkbook{ | ||
var filename:String = $contentTypes.getFilename(SMLWorkbook.CONTENT_TYPE); | ||
var entry:ZipEntry = $packages[filename] as ZipEntry; | ||
var xml:XML = getEntryXML(entry); | ||
_workbook = new SMLWorkbook(this,xml); | ||
_workbook.setFilename(filename); | ||
return _workbook; | ||
} | ||
|
||
public function addSheetEntry(name:String,sheetId:String):String{ | ||
|
||
var filename:String = "worksheets/sheet" + sheetId + ".xml"; | ||
var rid:String = ""; | ||
|
||
// add workbook.xml.rels | ||
rid = _relation.addSheet(filename); | ||
|
||
// add xl/workbook.xml | ||
var workbook_xml:XML = _workbook.getXML(); | ||
var ns:Namespace = workbook_xml.namespace(); | ||
var ns_r:Namespace = workbook_xml.namespace("r"); | ||
var sheet_xml:XML = <sheet name={name} sheetId={sheetId} r:id={rid} xmlns:r={ns_r} />; | ||
var sheets:XML = workbook_xml.ns::sheets[0]; | ||
sheets.appendChild(sheet_xml); | ||
|
||
// add [Content-Types].xml | ||
var ct_xml:XML = $contentTypes.getXML(); | ||
ns = ct_xml.namespace(); | ||
var partName:String = "/xl/" + filename; | ||
var contentType:String = SMLWorksheet.CONTENT_TYPE; | ||
var override_xml:XML = <Override PartName={partName} ContentType={contentType} />; | ||
ct_xml.appendChild(override_xml); | ||
$contentTypes.isUpdate = true; | ||
|
||
return rid; | ||
} | ||
|
||
|
||
airxoox_internal function getSheetXML(sheet_rId:String):XML{ | ||
var filename:String = _relation.getFilename(sheet_rId); | ||
var entry:ZipEntry = getZipEntry(filename); | ||
if(entry){ | ||
return getEntryXML(entry); | ||
} | ||
return null; | ||
|
||
} | ||
|
||
/** | ||
* get zip entry | ||
*/ | ||
protected function getZipEntry(filename:String):ZipEntry{ | ||
if(filename.charAt(0) != "/"){ | ||
filename = "/" + filename; | ||
} | ||
filename = "/xl" + filename; | ||
return $packages[filename] as ZipEntry; | ||
} | ||
|
||
|
||
public function getSharedStringValue(index:int):String{ | ||
if(_sharedString){ | ||
return _sharedString.getStringValue(index); | ||
} | ||
else{ | ||
return ""; | ||
} | ||
} | ||
|
||
public function getSharedStrings():SMLSharedStrings{ | ||
return _sharedString; | ||
} | ||
} | ||
} |
Oops, something went wrong.