Commit 4fdcd7fa authored by Matus Uzak's avatar Matus Uzak
Browse files

DOC: Improved processing of the msosptPictureFrame shape.

* Set the draw:z-index attribute of inline objects to ZERO.
* Check for diagram drawing canvas placed inline with surrounding text,
  which is of type msosptPictureFrame.
* Fixed the definition of DiagramBooleanProperties, which was identical
  to ProtectionBooleanProperties.

BUG:273096
parent 520a6191
......@@ -31,6 +31,12 @@ OfficeArtTertiaryFOPT
8b - txdir - pecifies the direction of the text (MAY be used)
bf - [Text Boolean Properties]
[Geometry Text Property Set]
c0 - gtextUNICODE - specifies the text for this shape’s geometry text
c2 - gtextAlign - specifies how geometry text is aligned on this shape
c4 - gtextSpacing - specifies the amount of spacing between characters in the text
c5 - gtextSize - specifies the font size, in points of the geometry text for this shape
c6 - gtextCSSFont - specifies extra font information
ff - [Geometry Text Boolean Properties]
[Blip Property Set]
......
......@@ -231,6 +231,9 @@ GETTER(qint32, PictureBrightness, pictureBrightness, 0)
} \
return DEFAULT; \
}
//TODO: CalloutBooleanProperties, ProtectionBooleanProperties
// FOPT NAME TEST DEFAULT
#define FOPT ShapeBooleanProperties
GETTER(fBackground, fUsefBackground, false)
......@@ -292,6 +295,12 @@ GETTER(fLineOpaqueBackColor, fUsefLineOpaqueBackColor, false)
GETTER(fShadowObscured, fUsefShadowObscured, false)
GETTER(fShadow, fUsefShadow, false)
#undef FOPT
#define FOPT DiagramBooleanProperties
GETTER(fPseudoInline, fUsefPseudoInline, false)
GETTER(fDoLayout, fUsefDoLayout, true)
GETTER(fReverse, fUsefReverse, false)
GETTER(fDoFormat, fUsefDoFormat, false)
#undef FOPT
#define FOPT TextBooleanProperties
GETTER(fFitShapeToText, fUsefFitShapeToText, false)
GETTER(fAutoTextMargin, fUsefAutoTextMargin, false)
......
......@@ -45,7 +45,7 @@ public:
const MSO::OfficeArtSpContainer* sp_ = 0)
: d(d_), mastersp(mastersp_), sp(sp_) {}
// Shape Property Set
// Shape property set
quint32 hspMaster() const;
quint32 cxstyle() const;
quint32 bWMode() const;
......@@ -60,7 +60,7 @@ public:
bool fPolicyBarcode() const;
bool fPolicyLabel() const;
// Group Shape Property Set
// Group Shape property set
quint32 pWrapPolygonVertices() const;
IMsoArray pWrapPolygonVertices_complex() const;
qint32 dxWrapDistLeft() const;
......@@ -110,7 +110,7 @@ public:
bool fUsefIsBullet() const;
bool fUsefLayoutInCell() const;
// Geometry Property Set
// Geometry property set
qint32 geoLeft() const;
qint32 geoTop() const;
qint32 geoRight() const;
......@@ -134,7 +134,7 @@ public:
bool f3DOK() const;
bool fShadowOK() const;
// Fill Style Property Set
// Fill Style property set
quint32 fillType() const;
MSO::OfficeArtCOLORREF fillColor() const;
MSO::FixedPoint fillOpacity() const;
......@@ -196,7 +196,7 @@ public:
bool fInsetPen() const;
bool fLineOpaqueBackColor() const;
// Shadow Style Property Set
// Shadow Style property set
quint32 shadowType() const;
MSO::OfficeArtCOLORREF shadowColor() const;
MSO::FixedPoint shadowOpacity() const;
......@@ -206,10 +206,17 @@ public:
bool fShadowObscured() const;
bool fShadow() const;
// Transformation Property set
// Diagram property set
// Diagram Boolean Properties
bool fPseudoInline() const;
bool fDoLayout() const;
bool fReverse() const;
bool fDoFormat() const;
// Transformation property set
MSO::FixedPoint rotation() const;
// Text Property Set
// Text property set
qint32 iTxid() const;
qint32 dxTextLeft() const;
qint32 dyTextTop() const;
......@@ -226,7 +233,7 @@ public:
bool fAutoTextMargin() const;
bool fSelectText() const;
// Blip Property Set
// Blip property set
MSO::FixedPoint cropFromTop() const;
MSO::FixedPoint cropFromBottom() const;
MSO::FixedPoint cropFromLeft() const;
......
......@@ -9143,28 +9143,22 @@ void MSO::parseDiagramBooleanProperties(LEInputStream& in, DiagramBooleanPropert
if (!(_s.opid.fComplex == false)) {
throw IncorrectValueException(in.getPosition(), "_s.opid.fComplex == false");
}
_s.fLockAgainstGrouping = in.readbit();
_s.fLockAdjustHandles = in.readbit();
_s.fLockText = in.readbit();
_s.fLockVertices = in.readbit();
_s.fLockCropping = in.readbit();
_s.fLockAgainstSelect = in.readbit();
_s.fLockPosition = in.readbit();
_s.fLockAspectRatio = in.readbit();
_s.fLockRotation = in.readbit();
_s.fLockAgainstUngrouping = in.readbit();
_s.unused6 = in.readuint6();
_s.fUsefLockAgainstGrouping = in.readbit();
_s.fUseLockAdjustHandles = in.readbit();
_s.fUseLockText = in.readbit();
_s.fUsefLockVertices = in.readbit();
_s.fUsefLockCropping = in.readbit();
_s.fUsefLockAgainstSelect = in.readbit();
_s.fUsefLockPosition = in.readbit();
_s.fUsefLockAspectRatio = in.readbit();
_s.fUsefLockRotation = in.readbit();
_s.fUsefLockAgainstUngrouping = in.readbit();
_s.unused2 = in.readuint6();
_s.fPseudoInline = in.readbit();
_s.fDoLayout = in.readbit();
_s.fReverse = in.readbit();
_s.fDoFormat = in.readbit();
_s.unused1 = in.readbit();
_s.unused2 = in.readbit();
_s.unused3a = in.readuint2();
_s.unused3b = in.readuint8();
_s.fUsefPseudoInline = in.readbit();
_s.fUsefDoLayout = in.readbit();
_s.fUsefReverse = in.readbit();
_s.fUsefDoFormat = in.readbit();
_s.unused4 = in.readbit();
_s.unused5 = in.readbit();
_s.unused6a = in.readuint2();
_s.unused6b = in.readuint8();
}
void MSO::parsePptOfficeArtClientAnchor(LEInputStream& in, PptOfficeArtClientAnchor& _s) {
_s.streamOffset = in.getPosition();
......
......@@ -4636,28 +4636,22 @@ public:
class DiagramBooleanProperties : public StreamOffset {
public:
OfficeArtFOPTEOPID opid;
bool fLockAgainstGrouping;
bool fLockAdjustHandles;
bool fLockText;
bool fLockVertices;
bool fLockCropping;
bool fLockAgainstSelect;
bool fLockPosition;
bool fLockAspectRatio;
bool fLockRotation;
bool fLockAgainstUngrouping;
quint8 unused6;
bool fUsefLockAgainstGrouping;
bool fUseLockAdjustHandles;
bool fUseLockText;
bool fUsefLockVertices;
bool fUsefLockCropping;
bool fUsefLockAgainstSelect;
bool fUsefLockPosition;
bool fUsefLockAspectRatio;
bool fUsefLockRotation;
bool fUsefLockAgainstUngrouping;
quint8 unused2;
bool fPseudoInline;
bool fDoLayout;
bool fReverse;
bool fDoFormat;
bool unused1;
bool unused2;
quint8 unused3a;
quint8 unused3b;
bool fUsefPseudoInline;
bool fUsefDoLayout;
bool fUsefReverse;
bool fUsefDoFormat;
bool unused4;
bool unused5;
quint8 unused6a;
quint8 unused6b;
DiagramBooleanProperties(void* /*dummy*/ = 0) {}
};
class PptOfficeArtClientAnchor : public StreamOffset {
......
......@@ -251,18 +251,18 @@ void ODrawToOdf::processBentConnector3(const OfficeArtSpContainer& o, Writer& ou
void ODrawToOdf::processPictureFrame(const OfficeArtSpContainer& o, Writer& out)
{
QString url;
const Pib* pib = get<Pib>(o);
if (pib && client) {
url = client->getPicturePath(pib->pib);
} else {
// Does not make much sense to display an empty frame, following
// PPT->ODP filters of both OOo and MS Office.
return;
}
DrawStyle ds(0, &o);
// A value of 0x00000000 MUST be ignored. [MS-ODRAW] — v20101219
if (!ds.pib()) return;
out.xml.startElement("draw:frame");
processStyleAndText(o, out);
QString url;
if (client) {
url = client->getPicturePath(ds.pib());
}
// if the image cannot be found, just place an empty frame
if (url.isEmpty()) {
out.xml.endElement(); //draw:frame
......
......@@ -917,6 +917,8 @@ void KWordGraphicsHandler::setZIndexAttribute(DrawingWriter& out)
// draw:z-index
if (m_objectType == Floating) {
out.xml.addAttribute("draw:z-index", m_zIndex);
} else {
out.xml.addAttribute("draw:z-index", 0);
}
}
......@@ -984,6 +986,12 @@ void KWordGraphicsHandler::processInlinePictureFrame(const MSO::OfficeArtSpConta
{
kDebug(30513) ;
// Shape instance contained in OfficeArtInlineSpContainer. BLIP properties
// contained in o.shapePrimaryOptions or o.shapeTertiaryOptions1 are stored
// in the order they are encountered, and the property values
// OfficeArtFOPTE.opid.fBid, OfficeArtFOPTE.opid.fComplex, and
// OfficeArtFOPTE.op MUST be ignored. [MS-ODRAW] — v20101219
QString styleName;
KoGenStyle style(KoGenStyle::GraphicAutoStyle, "graphic");
style.setAutoStyleInStylesDotXml(out.stylesxml);
......@@ -995,7 +1003,12 @@ void KWordGraphicsHandler::processInlinePictureFrame(const MSO::OfficeArtSpConta
definePositionAttributes(style, ds);
styleName = out.styles.insert(style);
out.xml.startElement("draw:frame");
// A diagram drawing canvas placed inline with surrounding text.
if (ds.fPseudoInline()) {
out.xml.startElement("draw:rect");
} else {
out.xml.startElement("draw:frame");
}
out.xml.addAttribute("draw:style-name", styleName);
setAnchorTypeAttribute(out);
setZIndexAttribute(out);
......@@ -1005,14 +1018,14 @@ void KWordGraphicsHandler::processInlinePictureFrame(const MSO::OfficeArtSpConta
out.xml.addAttributePt("svg:width", twipsToPt(m_picf->dxaGoal) * hscale);
out.xml.addAttributePt("svg:height", twipsToPt(m_picf->dyaGoal) * vscale);
QString url;
QString name = m_picNames.value(m_rgbUid);
QString url;
if (!name.isEmpty()) {
url.append("Pictures/");
url.append(name);
} else {
// if the image cannot be found, just place an empty frame
out.xml.endElement(); //draw:frame
out.xml.endElement(); //draw:frame (draw:rect)
return;
}
//TODO: process border information (complex properties)
......@@ -1031,11 +1044,15 @@ void KWordGraphicsHandler::processFloatingPictureFrame(const MSO::OfficeArtSpCon
{
kDebug(30513) ;
DrawStyle ds(&m_officeArtDggContainer, &o);
// A value of 0x00000000 MUST be ignored. [MS-ODRAW] — v20101219
if (!ds.pib()) return;
QString styleName;
KoGenStyle style(KoGenStyle::GraphicAutoStyle, "graphic");
style.setAutoStyleInStylesDotXml(out.stylesxml);
DrawStyle ds(&m_officeArtDggContainer, &o);
DrawClient drawclient(this);
ODrawToOdf odrawtoodf(drawclient);
odrawtoodf.defineGraphicProperties(style, ds, out.styles);
......@@ -1043,14 +1060,6 @@ void KWordGraphicsHandler::processFloatingPictureFrame(const MSO::OfficeArtSpCon
defineWrappingAttributes(style, ds);
styleName = out.styles.insert(style);
QString url;
if (ds.pib()) {
url = getPicturePath(ds.pib());
} else {
// Does not make much sense to display an empty frame, following
// PPT->ODP filters of both OOo and MS Office 2007.
return;
}
out.xml.startElement("draw:frame");
out.xml.addAttribute("draw:style-name", styleName);
setAnchorTypeAttribute(out);
......@@ -1061,6 +1070,8 @@ void KWordGraphicsHandler::processFloatingPictureFrame(const MSO::OfficeArtSpCon
out.xml.addAttribute("svg:x", mm(out.hOffset()));
out.xml.addAttribute("svg:y", mm(out.vOffset()));
QString url = getPicturePath(ds.pib());
//if the image cannot be found, just place an empty frame
if (url.isEmpty()) {
out.xml.endElement(); //draw:frame
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment