[Libreoffice-commits] .: 2 commits - src/docdirstream.py src/docdraw.py src/msodraw.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Dec 5 06:17:52 PST 2012
src/docdirstream.py | 5 +++
src/docdraw.py | 53 +------------------------------------
src/msodraw.py | 73 ++++++++++++++++++++++++++++++++++------------------
3 files changed, 56 insertions(+), 75 deletions(-)
New commits:
commit 88d9976621b49eb313f70a2e4606cad85754dbec
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Dec 5 15:17:46 2012 +0100
docdraw: use msodraw.FSP
diff --git a/src/docdraw.py b/src/docdraw.py
index 8252b14..4753d5a 100644
--- a/src/docdraw.py
+++ b/src/docdraw.py
@@ -49,37 +49,6 @@ class OfficeArtDggContainer(DOCDirStream):
assert pos == self.pos + self.rh.recLen
self.officeArtContent.pos = pos
-class OfficeArtFSP(DOCDirStream):
- """The OfficeArtFSP record specifies an instance of a shape."""
- def __init__(self, officeArtSpContainer, pos):
- DOCDirStream.__init__(self, officeArtSpContainer.bytes)
- self.pos = pos
- self.officeArtSpContainer = officeArtSpContainer
-
- def dumpXml(self, compat, rh):
- self.rh = rh
- print '<shapeProp type="OfficeArtFSP" offset="%d">' % (self.pos)
- pos = self.pos
- self.printAndSet("spid", self.readuInt32())
-
- buf = self.readuInt32()
- self.printAndSet("fGroup", self.getBit(buf, 0))
- self.printAndSet("fChild", self.getBit(buf, 1))
- self.printAndSet("fPatriarch", self.getBit(buf, 2))
- self.printAndSet("fDeleted", self.getBit(buf, 3))
- self.printAndSet("fOleShape", self.getBit(buf, 4))
- self.printAndSet("fHaveMaster", self.getBit(buf, 5))
- self.printAndSet("fFlipH", self.getBit(buf, 6))
- self.printAndSet("fFlipV", self.getBit(buf, 7))
- self.printAndSet("fConnector", self.getBit(buf, 8))
- self.printAndSet("fHaveAnchor", self.getBit(buf, 9))
- self.printAndSet("fBackground", self.getBit(buf, 10))
- self.printAndSet("fHaveSpt", self.getBit(buf, 11))
- self.printAndSet("unused1", (buf & 0xfffff000) >> 12) # 13..32th bits
-
- print '</shapeProp>'
- assert self.pos == pos + self.rh.recLen
-
class OfficeArtClientData(DOCDirStream):
def __init__(self, officeArtSpContainer, pos):
DOCDirStream.__init__(self, officeArtSpContainer.bytes)
@@ -274,7 +243,7 @@ recMap = {
0xf006: [msodraw.FDGGBlock],
0xf008: [msodraw.FDG],
0xf009: [msodraw.FSPGR],
- 0xf00a: [OfficeArtFSP, True],
+ 0xf00a: [msodraw.FSP],
0xf00b: [OfficeArtFOPT, True],
0xf011: [OfficeArtClientData, True],
0xf11e: [msodraw.SplitMenuColorContainer],
diff --git a/src/msodraw.py b/src/msodraw.py
index ccbb2f4..c487ef1 100644
--- a/src/msodraw.py
+++ b/src/msodraw.py
@@ -446,34 +446,51 @@ class FSP:
def __init__ (self, strm):
self.spid = strm.readUnsignedInt(4)
self.flag = strm.readUnsignedInt(4)
+ self.groupShape = (self.flag & 0x0001) != 0
+ self.childShape = (self.flag & 0x0002) != 0
+ self.topMostInGroup = (self.flag & 0x0004) != 0
+ self.deleted = (self.flag & 0x0008) != 0
+ self.oleObject = (self.flag & 0x0010) != 0
+ self.haveMaster = (self.flag & 0x0020) != 0
+ self.flipHorizontal = (self.flag & 0x0040) != 0
+ self.flipVertical = (self.flag & 0x0080) != 0
+ self.isConnector = (self.flag & 0x0100) != 0
+ self.haveAnchor = (self.flag & 0x0200) != 0
+ self.background = (self.flag & 0x0400) != 0
+ self.haveProperties = (self.flag & 0x0800) != 0
def appendLines (self, recHdl, rh):
recHdl.appendLine("FSP content (instance of a shape):")
recHdl.appendLine(" ID of this shape: %d"%self.spid)
- groupShape = (self.flag & 0x0001) != 0
- childShape = (self.flag & 0x0002) != 0
- topMostInGroup = (self.flag & 0x0004) != 0
- deleted = (self.flag & 0x0008) != 0
- oleObject = (self.flag & 0x0010) != 0
- haveMaster = (self.flag & 0x0020) != 0
- flipHorizontal = (self.flag & 0x0040) != 0
- flipVertical = (self.flag & 0x0080) != 0
- isConnector = (self.flag & 0x0100) != 0
- haveAnchor = (self.flag & 0x0200) != 0
- background = (self.flag & 0x0400) != 0
- haveProperties = (self.flag & 0x0800) != 0
- recHdl.appendLineBoolean(" group shape", groupShape)
- recHdl.appendLineBoolean(" child shape", childShape)
- recHdl.appendLineBoolean(" topmost in group", topMostInGroup)
- recHdl.appendLineBoolean(" deleted", deleted)
- recHdl.appendLineBoolean(" OLE object shape", oleObject)
- recHdl.appendLineBoolean(" have valid master", haveMaster)
- recHdl.appendLineBoolean(" horizontally flipped", flipHorizontal)
- recHdl.appendLineBoolean(" vertically flipped", flipVertical)
- recHdl.appendLineBoolean(" connector shape", isConnector)
- recHdl.appendLineBoolean(" have anchor", haveAnchor)
- recHdl.appendLineBoolean(" background shape", background)
- recHdl.appendLineBoolean(" have shape type property", haveProperties)
+ recHdl.appendLineBoolean(" group shape", self.groupShape)
+ recHdl.appendLineBoolean(" child shape", self.childShape)
+ recHdl.appendLineBoolean(" topmost in group", self.topMostInGroup)
+ recHdl.appendLineBoolean(" deleted", self.deleted)
+ recHdl.appendLineBoolean(" OLE object shape", self.oleObject)
+ recHdl.appendLineBoolean(" have valid master", self.haveMaster)
+ recHdl.appendLineBoolean(" horizontally flipped", self.flipHorizontal)
+ recHdl.appendLineBoolean(" vertically flipped", self.flipVertical)
+ recHdl.appendLineBoolean(" connector shape", self.isConnector)
+ recHdl.appendLineBoolean(" have anchor", self.haveAnchor)
+ recHdl.appendLineBoolean(" background shape", self.background)
+ recHdl.appendLineBoolean(" have shape type property", self.haveProperties)
+
+ def dumpXml(self, recHdl, rh):
+ recHdl.appendLine('<shapeProp type="OfficeArtFSPGR">')
+ recHdl.appendLine('<spid value="%d"/>' % self.spid)
+ recHdl.appendLine('<fGroup value="%d"/>' % self.groupShape)
+ recHdl.appendLine('<fChild value="%d"/>' % self.childShape)
+ recHdl.appendLine('<fPatriarch value="%d"/>' % self.topMostInGroup)
+ recHdl.appendLine('<fDeleted value="%d"/>' % self.deleted)
+ recHdl.appendLine('<fOleShape value="%d"/>' % self.oleObject)
+ recHdl.appendLine('<fHaveMaster value="%d"/>' % self.haveMaster)
+ recHdl.appendLine('<fFlipH value="%d"/>' % self.flipHorizontal)
+ recHdl.appendLine('<fFlipV value="%d"/>' % self.flipVertical)
+ recHdl.appendLine('<fConnector value="%d"/>' % self.isConnector)
+ recHdl.appendLine('<fHaveAnchor value="%d"/>' % self.haveAnchor)
+ recHdl.appendLine('<fBackground value="%d"/>' % self.background)
+ recHdl.appendLine('<fHaveSpt value="%d"/>' % self.haveProperties)
+ recHdl.appendLine('</shapeProp>')
class FSPGR:
commit e463dd63af7c179778a55f3bcff1d56fb6edc283
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Dec 5 15:06:30 2012 +0100
docdraw: use msodraw.FSPGR
diff --git a/src/docdirstream.py b/src/docdirstream.py
index 1ab5f61..c5e01f4 100644
--- a/src/docdirstream.py
+++ b/src/docdirstream.py
@@ -134,6 +134,11 @@ class DOCDirStream:
return self.readuInt32()
raise Exception
+ def readSignedInt(self, size):
+ if size == 4:
+ return self.readInt32()
+ raise Exception
+
def appendLine(self, line):
print line
diff --git a/src/docdraw.py b/src/docdraw.py
index 2c4d5f8..8252b14 100644
--- a/src/docdraw.py
+++ b/src/docdraw.py
@@ -49,24 +49,6 @@ class OfficeArtDggContainer(DOCDirStream):
assert pos == self.pos + self.rh.recLen
self.officeArtContent.pos = pos
-class OfficeArtFSPGR(DOCDirStream):
- """The OfficeArtFSPGR record specifies the coordinate system of the group shape that the anchors of the child shape are expressed in."""
- def __init__(self, officeArtSpContainer, pos):
- DOCDirStream.__init__(self, officeArtSpContainer.bytes)
- self.pos = pos
- self.officeArtSpContainer = officeArtSpContainer
-
- def dumpXml(self, compat, rh):
- self.rh = rh
- print '<shapeGroup type="OfficeArtFSPGR" offset="%d">' % (self.pos)
- pos = self.pos
- self.printAndSet("xLeft", self.readuInt32())
- self.printAndSet("yTop", self.readuInt32())
- self.printAndSet("xRight", self.readuInt32())
- self.printAndSet("yBottom", self.readuInt32())
- print '</shapeGroup>'
- assert self.pos == pos + self.rh.recLen
-
class OfficeArtFSP(DOCDirStream):
"""The OfficeArtFSP record specifies an instance of a shape."""
def __init__(self, officeArtSpContainer, pos):
@@ -291,7 +273,7 @@ recMap = {
0xf004: [OfficeArtSpContainer, True],
0xf006: [msodraw.FDGGBlock],
0xf008: [msodraw.FDG],
- 0xf009: [OfficeArtFSPGR, True],
+ 0xf009: [msodraw.FSPGR],
0xf00a: [OfficeArtFSP, True],
0xf00b: [OfficeArtFOPT, True],
0xf011: [OfficeArtClientData, True],
diff --git a/src/msodraw.py b/src/msodraw.py
index dd62660..ccbb2f4 100644
--- a/src/msodraw.py
+++ b/src/msodraw.py
@@ -490,6 +490,14 @@ class FSPGR:
recHdl.appendLine(" right boundary: %d"%self.right)
recHdl.appendLine(" bottom boundary: %d"%self.bottom)
+ def dumpXml(self, recHdl, rh):
+ recHdl.appendLine('<shapeGroup type="OfficeArtFSPGR">')
+ recHdl.appendLine('<xLeft value="%d"/>' % self.left)
+ recHdl.appendLine('<yTop value="%d"/>' % self.top)
+ recHdl.appendLine('<xRight value="%d"/>' % self.right)
+ recHdl.appendLine('<yBottom value="%d"/>' % self.bottom)
+ recHdl.appendLine('</shapeGroup>')
+
class FConnectorRule:
def __init__ (self, strm):
More information about the Libreoffice-commits
mailing list