From: Fridrich S. <str...@us...> - 2008-12-03 12:52:11
|
Update of /cvsroot/libwpd/writerperfect/filter In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3288/filter Modified Files: ListStyle.cxx OdgExporter.cxx PageSpan.cxx PageSpan.hxx TextRunStyle.cxx WordPerfectCollector.cxx Log Message: adapting to the fact that getFloat -> getDouble in WPXProperty class Index: PageSpan.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/PageSpan.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- PageSpan.cxx 7 Jul 2007 09:49:39 -0000 1.16 +++ PageSpan.cxx 3 Dec 2008 12:52:08 -0000 1.17 @@ -87,18 +87,18 @@ return 0; // should never happen } -float PageSpan::getMarginLeft() const +double PageSpan::getMarginLeft() const { if (mxPropList["fo:margin-left"]) - return mxPropList["fo:margin-left"]->getFloat(); + return mxPropList["fo:margin-left"]->getDouble(); return 0.0f; } -float PageSpan::getMarginRight() const +double PageSpan::getMarginRight() const { if (mxPropList["fo:margin-right"]) - return mxPropList["fo:margin-right"]->getFloat(); + return mxPropList["fo:margin-right"]->getDouble(); return 0.0f; } Index: OdgExporter.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/OdgExporter.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- OdgExporter.cxx 28 Nov 2008 12:26:16 -0000 1.26 +++ OdgExporter.cxx 3 Dec 2008 12:52:08 -0000 1.27 @@ -122,7 +122,7 @@ configItemOpenElement.addAttribute("config:type", "int"); configItemOpenElement.write(mpHandler); if (propList["svg:width"]) - mfWidth = propList["svg:width"]->getFloat(); + mfWidth = propList["svg:width"]->getDouble(); WPXString sWidth; sWidth.sprintf("%li", (unsigned long)(2540 * mfWidth)); mpHandler->characters(sWidth); mpHandler->endElement("config:config-item"); @@ -131,7 +131,7 @@ configItemOpenElement.addAttribute("config:type", "int"); configItemOpenElement.write(mpHandler); if (propList["svg:height"]) - mfHeight = propList["svg:height"]->getFloat(); + mfHeight = propList["svg:height"]->getDouble(); WPXString sHeight; sHeight.sprintf("%li", (unsigned long)(2540 * mfHeight)); mpHandler->characters(sHeight); mpHandler->endElement("config:config-item"); @@ -268,7 +268,10 @@ pDrawRectElement->addAttribute("svg:width", propList["svg:width"]->getStr()); pDrawRectElement->addAttribute("svg:height", propList["svg:height"]->getStr()); // FIXME: what to do when rx != ry ? - pDrawRectElement->addAttribute("draw:corner-radius", propList["svg:rx"]->getStr()); + if (propList["svg:rx"]) + pDrawRectElement->addAttribute("draw:corner-radius", propList["svg:rx"]->getStr()); + else + pDrawRectElement->addAttribute("draw:corner-radius", "0.0000in"); mBodyElements.push_back(pDrawRectElement); mBodyElements.push_back(new TagCloseElement("draw:rect")); } @@ -280,35 +283,35 @@ WPXString sValue; sValue.sprintf("gr%i", miGraphicsStyleIndex-1); pDrawEllipseElement->addAttribute("draw:style-name", sValue); - sValue = doubleToString(2 * propList["svg:rx"]->getFloat()); sValue.append("in"); + sValue = doubleToString(2 * propList["svg:rx"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:width", sValue); - sValue = doubleToString(2 * propList["svg:ry"]->getFloat()); sValue.append("in"); + sValue = doubleToString(2 * propList["svg:ry"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:height", sValue); - if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getFloat() != 0.0) + if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getDouble() != 0.0) { - double rotation = propList["libwpg:rotate"]->getFloat(); + double rotation = propList["libwpg:rotate"]->getDouble(); while(rotation < -180) rotation += 360; while(rotation > 180) rotation -= 360; double radrotation = rotation*M_PI/180.0; - double deltax = sqrt(pow(propList["svg:rx"]->getFloat(), 2.0) - + pow(propList["svg:ry"]->getFloat(), 2.0))*cos(atan(propList["svg:ry"]->getFloat()/propList["svg:rx"]->getFloat()) - - radrotation ) - propList["svg:rx"]->getFloat(); - double deltay = sqrt(pow(propList["svg:rx"]->getFloat(), 2.0) - + pow(propList["svg:ry"]->getFloat(), 2.0))*sin(atan(propList["svg:ry"]->getFloat()/propList["svg:rx"]->getFloat()) - - radrotation ) - propList["svg:ry"]->getFloat(); + double deltax = sqrt(pow(propList["svg:rx"]->getDouble(), 2.0) + + pow(propList["svg:ry"]->getDouble(), 2.0))*cos(atan(propList["svg:ry"]->getDouble()/propList["svg:rx"]->getDouble()) + - radrotation ) - propList["svg:rx"]->getDouble(); + double deltay = sqrt(pow(propList["svg:rx"]->getDouble(), 2.0) + + pow(propList["svg:ry"]->getDouble(), 2.0))*sin(atan(propList["svg:ry"]->getDouble()/propList["svg:rx"]->getDouble()) + - radrotation ) - propList["svg:ry"]->getDouble(); sValue = "rotate("; sValue.append(doubleToString(radrotation)); sValue.append(") "); - sValue.append("translate("); sValue.append(doubleToString(propList["svg:cx"]->getFloat() - propList["svg:rx"]->getFloat() - deltax)); + sValue.append("translate("); sValue.append(doubleToString(propList["svg:cx"]->getDouble() - propList["svg:rx"]->getDouble() - deltax)); sValue.append("in, "); - sValue.append(doubleToString(propList["svg:cy"]->getFloat() - propList["svg:ry"]->getFloat() - deltay)); sValue.append("in)"); + sValue.append(doubleToString(propList["svg:cy"]->getDouble() - propList["svg:ry"]->getDouble() - deltay)); sValue.append("in)"); pDrawEllipseElement->addAttribute("svg:transform", sValue); } else { - sValue = doubleToString(propList["svg:cx"]->getFloat()-propList["svg:rx"]->getFloat()); sValue.append("in"); + sValue = doubleToString(propList["svg:cx"]->getDouble()-propList["svg:rx"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:x", sValue); - sValue = doubleToString(propList["svg:cy"]->getFloat()-propList["svg:ry"]->getFloat()); sValue.append("in"); + sValue = doubleToString(propList["svg:cy"]->getDouble()-propList["svg:ry"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:y", sValue); } mBodyElements.push_back(pDrawEllipseElement); @@ -378,28 +381,28 @@ // try to find the bounding box // this is simple convex hull technique, the bounding box might not be // accurate but that should be enough for this purpose - double px = path[0]["svg:x"]->getFloat(); - double py = path[0]["svg:y"]->getFloat(); - double qx = path[0]["svg:x"]->getFloat(); - double qy = path[0]["svg:y"]->getFloat(); + double px = path[0]["svg:x"]->getDouble(); + double py = path[0]["svg:y"]->getDouble(); + double qx = path[0]["svg:x"]->getDouble(); + double qy = path[0]["svg:y"]->getDouble(); for(unsigned k = 0; k < path.count(); k++) { if (!path[k]["svg:x"] || !path[k]["svg:y"]) continue; - px = (px > path[k]["svg:x"]->getFloat()) ? path[k]["svg:x"]->getFloat() : px; - py = (py > path[k]["svg:y"]->getFloat()) ? path[k]["svg:y"]->getFloat() : py; - qx = (qx < path[k]["svg:x"]->getFloat()) ? path[k]["svg:x"]->getFloat() : qx; - qy = (qy < path[k]["svg:y"]->getFloat()) ? path[k]["svg:y"]->getFloat() : qy; + px = (px > path[k]["svg:x"]->getDouble()) ? path[k]["svg:x"]->getDouble() : px; + py = (py > path[k]["svg:y"]->getDouble()) ? path[k]["svg:y"]->getDouble() : py; + qx = (qx < path[k]["svg:x"]->getDouble()) ? path[k]["svg:x"]->getDouble() : qx; + qy = (qy < path[k]["svg:y"]->getDouble()) ? path[k]["svg:y"]->getDouble() : qy; if(path[k]["libwpg:path-action"]->getStr() == "C") { - px = (px > path[k]["svg:x1"]->getFloat()) ? path[k]["svg:x1"]->getFloat() : px; - py = (py > path[k]["svg:y1"]->getFloat()) ? path[k]["svg:y1"]->getFloat() : py; - qx = (qx < path[k]["svg:x1"]->getFloat()) ? path[k]["svg:x1"]->getFloat() : qx; - qy = (qy < path[k]["svg:y1"]->getFloat()) ? path[k]["svg:y1"]->getFloat() : qy; - px = (px > path[k]["svg:x2"]->getFloat()) ? path[k]["svg:x2"]->getFloat() : px; - py = (py > path[k]["svg:y2"]->getFloat()) ? path[k]["svg:y2"]->getFloat() : py; - qx = (qx < path[k]["svg:x2"]->getFloat()) ? path[k]["svg:x2"]->getFloat() : qx; - qy = (qy < path[k]["svg:y2"]->getFloat()) ? path[k]["svg:y2"]->getFloat() : qy; + px = (px > path[k]["svg:x1"]->getDouble()) ? path[k]["svg:x1"]->getDouble() : px; + py = (py > path[k]["svg:y1"]->getDouble()) ? path[k]["svg:y1"]->getDouble() : py; + qx = (qx < path[k]["svg:x1"]->getDouble()) ? path[k]["svg:x1"]->getDouble() : qx; + qy = (qy < path[k]["svg:y1"]->getDouble()) ? path[k]["svg:y1"]->getDouble() : qy; + px = (px > path[k]["svg:x2"]->getDouble()) ? path[k]["svg:x2"]->getDouble() : px; + py = (py > path[k]["svg:y2"]->getDouble()) ? path[k]["svg:y2"]->getDouble() : py; + qx = (qx < path[k]["svg:x2"]->getDouble()) ? path[k]["svg:x2"]->getDouble() : qx; + qy = (qy < path[k]["svg:y2"]->getDouble()) ? path[k]["svg:y2"]->getDouble() : qy; } } double vw = qx - px; @@ -431,22 +434,25 @@ if (path[i]["libwpg:path-action"]->getStr() == "M") { // 2540 is 2.54*1000, 2.54 in = 1 inch - sElement.sprintf("M%i %i", (unsigned)((path[i]["svg:x"]->getFloat()-px)*2540), (unsigned)((path[i]["svg:y"]->getFloat()-py)*2540)); + sElement.sprintf("M%i %i", (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } else if (path[i]["libwpg:path-action"]->getStr() == "L") { - sElement.sprintf("L%i %i", (unsigned)((path[i]["svg:x"]->getFloat()-px)*2540), (unsigned)((path[i]["svg:y"]->getFloat()-py)*2540)); + sElement.sprintf("L%i %i", (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } else if (path[i]["libwpg:path-action"]->getStr() == "C") { - sElement.sprintf("C%i %i %i %i %i %i", (unsigned)((path[i]["svg:x1"]->getFloat()-px)*2540), - (int)((path[i]["svg:y1"]->getFloat()-py)*2540), (unsigned)((path[i]["svg:x2"]->getFloat()-px)*2540), - (int)((path[i]["svg:y2"]->getFloat()-py)*2540), (unsigned)((path[i]["svg:x"]->getFloat()-px)*2540), (unsigned)((path[i]["svg:y"]->getFloat()-py)*2540)); + sElement.sprintf("C%i %i %i %i %i %i", (unsigned)((path[i]["svg:x1"]->getDouble()-px)*2540), + (int)((path[i]["svg:y1"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x2"]->getDouble()-px)*2540), + (int)((path[i]["svg:y2"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } - else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i == (path.count() - 1)) + else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i >= (path.count() - 1)) sValue.append(" Z"); } pDrawPathElement->addAttribute("svg:d", sValue); Index: PageSpan.hxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/PageSpan.hxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- PageSpan.hxx 25 Jun 2007 17:14:25 -0000 1.9 +++ PageSpan.hxx 3 Dec 2008 12:52:08 -0000 1.10 @@ -40,8 +40,8 @@ void writePageLayout(const int iNum, DocumentHandler *pHandler) const; void writeMasterPages(const int iStartingNum, const int iPageLayoutNum, const bool bLastPageSpan, DocumentHandler *pHandler) const; int getSpan() const; - float getMarginLeft() const; - float getMarginRight() const; + double getMarginLeft() const; + double getMarginRight() const; const std::vector<DocumentElement *> * getHeaderContent() const { return mpHeaderContent; } void setHeaderContent(std::vector<DocumentElement *> * pHeaderContent) { mpHeaderContent = pHeaderContent; } Index: WordPerfectCollector.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/WordPerfectCollector.cxx,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- WordPerfectCollector.cxx 9 Nov 2008 08:57:49 -0000 1.66 +++ WordPerfectCollector.cxx 3 Dec 2008 12:52:08 -0000 1.67 @@ -509,16 +509,16 @@ float fSectionMarginLeft = 0.0f; float fSectionMarginRight = 0.0f; if (propList["fo:margin-left"]) - fSectionMarginLeft = propList["fo:margin-left"]->getFloat(); + fSectionMarginLeft = propList["fo:margin-left"]->getDouble(); if (propList["fo:margin-right"]) - fSectionMarginRight = propList["fo:margin-right"]->getFloat(); + fSectionMarginRight = propList["fo:margin-right"]->getDouble(); if (iNumColumns > 1 || fSectionMarginLeft != 0 || fSectionMarginRight != 0) { if (propList["fo:margin-bottom"]) - mfSectionSpaceAfter = propList["fo:margin-bottom"]->getFloat(); + mfSectionSpaceAfter = propList["fo:margin-bottom"]->getDouble(); else if (propList["libwpd:margin-bottom"]) - mfSectionSpaceAfter = propList["libwpd:margin-bottom"]->getFloat(); + mfSectionSpaceAfter = propList["libwpd:margin-bottom"]->getDouble(); WPXString sSectionName; sSectionName.sprintf("Section%i", mSectionStyles.size()); Index: TextRunStyle.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/TextRunStyle.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- TextRunStyle.cxx 10 Sep 2007 14:34:43 -0000 1.17 +++ TextRunStyle.cxx 3 Dec 2008 12:52:08 -0000 1.18 @@ -80,10 +80,10 @@ propList.insert("fo:margin-top", i()->getStr()); if (strcmp(i.key(), "fo:margin-bottom") == 0) { - if (i()->getFloat() > 0.0f) + if (i()->getDouble() > 0.0) propList.insert("fo:margin-bottom", i()->getStr()); else - propList.insert("fo:margin-bottom", 0.0f); + propList.insert("fo:margin-bottom", 0.0); } if (strcmp(i.key(), "fo:line-height") == 0) propList.insert("fo:line-height", i()->getStr()); @@ -105,7 +105,7 @@ WPXPropertyListVector::Iter i(mxTabStops); for (i.rewind(); i.next();) { - if (i()["style:position"] && i()["style:position"]->getFloat() < 0) + if (i()["style:position"] && i()["style:position"]->getDouble() < 0.0) continue; TagOpenElement tabStopOpen("style:tab-stop"); @@ -148,7 +148,7 @@ if (mPropList["fo:font-size"]) { - if (mPropList["fo:font-size"]->getFloat() > 0.0f) + if (mPropList["fo:font-size"]->getDouble() > 0.0) { propList.insert("style:font-size-asian", mPropList["fo:font-size"]->getStr()); propList.insert("style:font-size-complex", mPropList["fo:font-size"]->getStr()); Index: ListStyle.cxx =================================================================== RCS file: /cvsroot/libwpd/writerperfect/filter/ListStyle.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ListStyle.cxx 17 Jul 2007 19:30:22 -0000 1.16 +++ ListStyle.cxx 3 Dec 2008 12:52:08 -0000 1.17 @@ -70,11 +70,11 @@ listLevelStyleOpen.write(pHandler); TagOpenElement stylePropertiesOpen("style:list-level-properties"); - if (mPropList["text:space-before"] && mPropList["text:space-before"]->getFloat() > 0.0f) + if (mPropList["text:space-before"] && mPropList["text:space-before"]->getDouble() > 0.0) stylePropertiesOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); - if (mPropList["text:min-label-width"] && mPropList["text:min-label-width"]->getFloat() > 0.0f) + if (mPropList["text:min-label-width"] && mPropList["text:min-label-width"]->getDouble() > 0.0) stylePropertiesOpen.addAttribute("text:min-label-width", mPropList["text:min-label-width"]->getStr()); - if (mPropList["text:min-label-distance"] && mPropList["text:min-label-distance"]->getFloat() > 0.0f) + if (mPropList["text:min-label-distance"] && mPropList["text:min-label-distance"]->getDouble() > 0.0) stylePropertiesOpen.addAttribute("text:min-label-distance", mPropList["text:min-label-distance"]->getStr()); stylePropertiesOpen.write(pHandler); @@ -117,11 +117,11 @@ listLevelStyleOpen.write(pHandler); TagOpenElement stylePropertiesOpen("style:list-level-properties"); - if (mPropList["text:space-before"] && mPropList["text:space-before"]->getFloat() > 0.0f) + if (mPropList["text:space-before"] && mPropList["text:space-before"]->getDouble() > 0.0) stylePropertiesOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); - if (mPropList["text:min-label-width"] && mPropList["text:min-label-width"]->getFloat() > 0.0f) + if (mPropList["text:min-label-width"] && mPropList["text:min-label-width"]->getDouble() > 0.0) stylePropertiesOpen.addAttribute("text:min-label-width", mPropList["text:min-label-width"]->getStr()); - if (mPropList["text:min-label-distance"] && mPropList["text:min-label-distance"]->getFloat() > 0.0f) + if (mPropList["text:min-label-distance"] && mPropList["text:min-label-distance"]->getDouble() > 0.0) stylePropertiesOpen.addAttribute("text:min-label-distance", mPropList["text:min-label-distance"]->getStr()); stylePropertiesOpen.addAttribute("style:font-name", "OpenSymbol"); stylePropertiesOpen.write(pHandler); |