// // AbiGoogle_invoke // ------------------- // This is the function that we actually call to invoke the on-line dictionary. // It should be called when the user selects from the context menu // static bool AbiGoogle_invoke(AV_View* /*v*/, EV_EditMethodCallData * /*d*/) { // Get the current view that the user is in. XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame(); FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView()); // If the user is on a word, but does not have it selected, we need // to go ahead and select that word so that the search/replace goes // correctly. if (pView->isSelectionEmpty()) { pView->moveInsPtTo(FV_DOCPOS_EOW_MOVE); pView->moveInsPtTo(FV_DOCPOS_BOW); pView->extSelTo(FV_DOCPOS_EOW_SELECT); } // Now we will figure out what word to look up UT_UTF8String url ("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q="); // url escaping should be moved somewhere more generic UT_UCS4Char *ucs4ST; pView->getSelectionText(*&ucs4ST); UT_UCS4String data (ucs4ST); bool last_was_space = false; for (size_t i = 0; i < data.length (); i++) { UT_UCS4Char ch = data[i]; if (!UT_UCS4_isspace (ch)) { url.appendUCS4 (&ch, 1); last_was_space = false; } else if (!last_was_space) { ch = '+'; url.appendUCS4 (&ch, 1); last_was_space = true; } } XAP_App::getApp()->openURL( url.utf8_str() ); FREEP(ucs4ST); return true; }
/*! * Read all Psion paragraphs and add them to the document. */ UT_Error IE_Imp_Psion::readParagraphs(const psiconv_text_and_layout psiontext, const psiconv_word_styles_section style_sec) // psiconv_list embobjlst) { unsigned int i,inline_nr; int loc; psiconv_paragraph paragraph; psiconv_in_line_layout in_line; UT_UCS4String text; psiconv_word_style style; const gchar *stylename; UT_Error res; // Iterate through all paragraphs for (i=0; i < psiconv_list_length(psiontext); i++) { UT_DEBUGMSG(("PSION: Importing paragraph %d\n",i)); if (!(paragraph = (psiconv_paragraph) psiconv_list_get(psiontext,i))) { // Something is really wrong... UT_ASSERT(paragraph != NULL); return UT_IE_IMPORTERROR; } // Determine the style name; set it to Normal if it is not available if (!style_sec || !(style = psiconv_get_style(style_sec,paragraph->base_style)) || (!style->name) || !(stylename = prepare_style_name(style->name))) stylename = (const gchar *) strdup("Normal"); if (!stylename) return UT_IE_NOMEMORY; UT_DEBUGMSG(("PSION: paragraph %d: style %s\n",i,stylename)); // Add all paragraph attributes to the document if ((res = applyParagraphAttributes(paragraph->base_paragraph,stylename))) return res; // Iterate through all Psion inlines. These contain the character // layout information, together with the number of characters they // apply to. loc = 0; for(inline_nr=0; inline_nr < psiconv_list_length(paragraph->in_lines); inline_nr++) { UT_DEBUGMSG(("Psion: paragraph %d inline %d\n",i,inline_nr)); if (!(in_line = (psiconv_in_line_layout) psiconv_list_get(paragraph->in_lines,inline_nr))) { // Something is really wrong... UT_ASSERT(in_line != NULL); return UT_IE_IMPORTERROR; } // This may be an object, which needs special handling. // Objects have layout associated with them, but we will ignore // it. I am not sure how it would apply anyway. We will also ignore // all text. It should just be a single character \016, which is the // object marker. if (in_line->object) { if ((res = insertObject(in_line))) return res; } else { // Put all characters belonging to the current inline into text text.clear(); if ((res = prepareCharacters(paragraph->text + loc,in_line->length, text))) return res; // Yes, text may be empty! if (text.length()) { // Add the character layout and the text itself to the document if ((res = applyCharacterAttributes(in_line->layout))) return res; if (!(appendSpan((text.ucs4_str()),text.length()))) return UT_IE_IMPORTERROR; } } loc += in_line->length; } // There may be text left after iterating through all inlines. // This remaining text gets the paragraph base_character layout. if (loc < psiconv_unicode_strlen(paragraph->text)) { // Get the remaining characters into text text.clear(); if ((res = prepareCharacters(paragraph->text+loc, psiconv_unicode_strlen(paragraph->text - loc),text))) return res; // Yes, text may be empty! if (text.length()) { // Add the character layout and the text itself to the document. if ((res = applyCharacterAttributes(paragraph->base_character))) return res; if (!appendSpan(text.ucs4_str(),text.length())) return UT_IE_IMPORTERROR; } } } return UT_OK; }
/*! * Take a packet, interpret it's contents and apply the implied operations on the document. */ bool ABI_Collab_Import::_import(const SessionPacket& packet, UT_sint32 iImportAdjustment, BuddyPtr pCollaborator, bool inGlob) { UT_DEBUGMSG(("ABI_Collab_Import::_import() - packet class type: %d, iImportAdjustment: %d\n", packet.getClassType(), iImportAdjustment)); UT_return_val_if_fail(pCollaborator, false); switch (packet.getClassType()) { case PCT_GlobSessionPacket: { const GlobSessionPacket* gp = static_cast<const GlobSessionPacket*>(&packet); UT_return_val_if_fail(gp->getPackets().size() > 0, false); // store the last seen revision from this collaborator (it is immediately used by the export) m_remoteRevs[pCollaborator] = gp->getRev(); for (UT_uint32 j = 0; j < gp->getPackets().size(); j++) { SessionPacket* pGlobPacket = gp->getPackets()[j]; if (pGlobPacket) { bool res = _import(*pGlobPacket, iImportAdjustment, pCollaborator, true); // yay for recursion :) if (!res) { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); } } } return true; } case PCT_SignalSessionPacket: { const SignalSessionPacket* sp = static_cast<const SignalSessionPacket*>(&packet); m_pDoc->signalListeners(sp->getSignalType()); return true; } case PCT_RevertSessionPacket: { const RevertSessionPacket* rrp = static_cast<const RevertSessionPacket*>(&packet); UT_DEBUGMSG(("Revert packet seen on import for rev: %d\n", rrp->getRev())); if (m_iAlreadyRevertedRevs.size() == 0 || m_iAlreadyRevertedRevs.front() != rrp->getRev()) { UT_DEBUGMSG(("Incoming revert for revision %d, which we didn't detect locally (m_iAlreadyRevertedRev: %d)!\n", rrp->getRev(), m_iAlreadyRevertedRevs.front())); UT_DEBUGMSG(("DOCUMENT OUT OF SYNC DETECTED!!!!\n")); UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); return false; } m_iAlreadyRevertedRevs.pop_front(); return true; } case PCT_RevertAckSessionPacket: { UT_DEBUGMSG(("RevertAck packet seen on import for rev: %d\n", static_cast<const RevertAckSessionPacket*>(&packet)->getRev())); // remove this collaborator from our revert ack list; he can play again... for (std::vector<std::pair<BuddyPtr, UT_sint32> >::iterator it = m_revertSet.begin(); it != m_revertSet.end(); it++) { if ((*it).first == pCollaborator) { UT_DEBUGMSG(("Found collaborator %s on our revert ack list with rev %d! Removing him from the list...\n", (*it).first->getDescription().utf8_str(), (*it).second)); UT_ASSERT_HARMLESS((*it).second == static_cast<const RevertAckSessionPacket*>(&packet)->getRev()); m_revertSet.erase(it); return true; } } UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); return false; } default: // silly C++ can't switch on ranges if (packet.getClassType() >= _PCT_FirstChangeRecord && packet.getClassType() <= _PCT_LastChangeRecord) { const ChangeRecordSessionPacket* crp = static_cast<const ChangeRecordSessionPacket*>(&packet); UT_DEBUGMSG(("It's safe to import this packet\n")); UT_DEBUGMSG(("For CR number %d requested point %d adjustment %d \n", crp->getRev(), crp->getPos(), iImportAdjustment)); PT_DocPosition pos = static_cast<PT_DocPosition>(crp->getPos() + iImportAdjustment); UT_ASSERT(pos <= getEndOfDoc()); if (!inGlob) { // store the last seen revision from this collaborator (it is immediately used by the export) // NOTE: if this changerecord is part of a glob, then we don't do this; we'll have // already set the revision of the glob itself as the last seen one m_remoteRevs[pCollaborator] = crp->getRev(); } // todo: remove these temp vars PT_DocPosition iPos2 = 0; // process the packet switch(crp->getPXType()) { case PX_ChangeRecord::PXT_GlobMarker: { UT_DEBUGMSG(("Found GLOB marker (ignoring)\n")); return true; } case PX_ChangeRecord::PXT_InsertSpan: { const InsertSpan_ChangeRecordSessionPacket* icrsp = static_cast<const InsertSpan_ChangeRecordSessionPacket*>( crp ); UT_UCS4String UCSChars = const_cast<UT_UTF8String&>(icrsp->m_sText).ucs4_str(); // ugly, ucs4_str should be const func! PP_AttrProp attrProp; attrProp.setAttributes(const_cast<const gchar**>(icrsp->getAtts())); attrProp.setProperties(const_cast<const gchar**>(icrsp->getProps())); m_pDoc->insertSpan(pos,UCSChars.ucs4_str(),UCSChars.length(), &attrProp); break; } case PX_ChangeRecord::PXT_DeleteSpan: { iPos2 = pos + crp->getLength(); PP_AttrProp *p_AttrProp_Before = NULL; UT_uint32 icnt = 0; m_pDoc->deleteSpan(pos,iPos2,p_AttrProp_Before,icnt,true); break; } case PX_ChangeRecord::PXT_ChangeSpan: { const Props_ChangeRecordSessionPacket* pcrsp = static_cast<const Props_ChangeRecordSessionPacket*>( crp ); gchar** szAtts = pcrsp->getAtts(); gchar** szProps = pcrsp->getProps(); iPos2 = pos + pcrsp->getLength(); if((szProps == NULL) && (szAtts == NULL)) { // // This happens if we remove all formats // we have to handle this seperately // // Get style of containing block // pf_Frag_Strux* sdh = NULL; m_pDoc->getStruxOfTypeFromPosition(pos,PTX_Block,&sdh); if(!sdh) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; } PD_Style * pStyle = m_pDoc->getStyleFromSDH(sdh); if(!pStyle) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; } const gchar * szName = pStyle->getName(); const gchar * atts[3] = {PT_STYLE_ATTRIBUTE_NAME,szName,NULL}; m_pDoc->changeSpanFmt(PTC_SetExactly, pos, iPos2, atts, const_cast<const gchar**>( szProps ) ); } else { m_pDoc->changeSpanFmt(PTC_SetExactly, pos, iPos2, const_cast<const gchar**>(szAtts), const_cast<const gchar**>( szProps ) ); } break; } case PX_ChangeRecord::PXT_InsertStrux: { const ChangeStrux_ChangeRecordSessionPacket* pcrsp = static_cast<const ChangeStrux_ChangeRecordSessionPacket*>( crp ); PTStruxType pts = pcrsp->m_eStruxType; gchar** szAtts = pcrsp->getAtts(); gchar** szProps = pcrsp->getProps(); if((szProps != NULL) || (szAtts != NULL)) { m_pDoc->insertStrux( pos, pts, const_cast<const gchar**>( szAtts ), const_cast<const gchar**>( szProps ) ); } else { m_pDoc->insertStrux(pos, pts); } break; } case PX_ChangeRecord::PXT_DeleteStrux: { const DeleteStrux_ChangeRecordSessionPacket* pcrsp = static_cast<const DeleteStrux_ChangeRecordSessionPacket*>( crp ); PTStruxType pts = pcrsp->m_eStruxType; m_pDoc->deleteStrux(pos,pts,true); break; } case PX_ChangeRecord::PXT_ChangeStrux: { const ChangeStrux_ChangeRecordSessionPacket* pcrsp = static_cast<const ChangeStrux_ChangeRecordSessionPacket*>( crp ); PTStruxType pts = pcrsp->m_eStruxType; gchar** szAtts = pcrsp->getAtts(); gchar** szProps = pcrsp->getProps(); UT_return_val_if_fail(szProps != NULL || szAtts != NULL, false); UT_DEBUGMSG(("Executing ChangeStrux pos= %d \n",pos)); m_pDoc->changeStruxFmt(PTC_SetExactly, pos, pos, const_cast<const gchar**>( szAtts ), const_cast<const gchar**>( szProps ), pts); // TODO: this mask is waaaay to generic XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame(); if (pFrame) { FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView()); if (pView) pView->notifyListeners(AV_CHG_TYPING | AV_CHG_FMTCHAR | AV_CHG_FMTBLOCK | AV_CHG_PAGECOUNT | AV_CHG_FMTSTYLE ); } break; } case PX_ChangeRecord::PXT_InsertObject: { const Object_ChangeRecordSessionPacket* ocrsp = static_cast<const Object_ChangeRecordSessionPacket*>( crp ); PTObjectType pto = ocrsp->getObjectType(); gchar** szAtts = ocrsp->getAtts(); gchar** szProps = ocrsp->getProps(); if((szProps == NULL) && (szAtts == NULL)) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; } m_pDoc->insertObject(pos, pto, const_cast<const gchar**>( szAtts ), const_cast<const gchar**>( szProps ) ); break; } case PX_ChangeRecord::PXT_DeleteObject: { iPos2 = pos + 1; PP_AttrProp *p_AttrProp_Before = NULL; UT_uint32 icnt = 0; m_pDoc->deleteSpan(pos, iPos2, p_AttrProp_Before, icnt, true); break; } case PX_ChangeRecord::PXT_ChangeObject: { const Object_ChangeRecordSessionPacket* ccrsp = static_cast<const Object_ChangeRecordSessionPacket*>( crp ); //PTObjectType pto = ccrsp->m_eObjectType; gchar** szAtts = ccrsp->getAtts(); gchar** szProps = ccrsp->getProps(); if ((szProps == NULL) && (szAtts == NULL)) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; } m_pDoc->changeSpanFmt(PTC_SetExactly, pos, pos + 1, const_cast<const gchar**>( szAtts ), const_cast<const gchar**>( szProps )); break; } case PX_ChangeRecord::PXT_ChangeDocRDF: { // down cast crp to get dcrp const RDF_ChangeRecordSessionPacket* dcrp = static_cast<const RDF_ChangeRecordSessionPacket*>( crp ); gchar** szAtts = dcrp->getAtts(); gchar** szProps = dcrp->getProps(); if ((szProps == NULL) && (szAtts == NULL)) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; } { // update the local document RDF to remove // szAtts RDF and then add the szProps RDF m_pDoc->getDocumentRDF()->handleCollabEvent( szAtts, szProps ); } break; } case PX_ChangeRecord::PXT_InsertFmtMark: { const Props_ChangeRecordSessionPacket* pcrsp = static_cast<const Props_ChangeRecordSessionPacket*>( crp ); gchar** szAtts = pcrsp->getAtts(); gchar** szProps = pcrsp->getProps(); if((szProps == NULL) && (szAtts == NULL)) { // nothing to do here, please move along // NOTE: why does this happen anyway? // This happens when for example when sending over tables: UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); return false; } return m_pDoc->changeSpanFmt(PTC_SetExactly, pos, pos, const_cast<const gchar**>( szAtts ), const_cast<const gchar**>( szProps )); } case PX_ChangeRecord::PXT_DeleteFmtMark: { return m_pDoc->deleteFmtMark(pos); } case PX_ChangeRecord::PXT_ChangeFmtMark: { const Props_ChangeRecordSessionPacket* pcrsp = static_cast<const Props_ChangeRecordSessionPacket*>( crp ); gchar** szAtts = pcrsp->getAtts(); gchar** szProps = pcrsp->getProps(); if ((szProps == NULL) && (szAtts == NULL)) { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; } return m_pDoc->changeSpanFmt(PTC_SetExactly, pos, pos, const_cast<const gchar**>( szAtts ), const_cast<const gchar**>( szProps )); } case PX_ChangeRecord::PXT_ChangePoint: { UT_DEBUGMSG(("Change Point CR \n")); return m_pDoc->createAndSendCR(pos, crp->getPXType(), true, 0); } case PX_ChangeRecord::PXT_ListUpdate: { UT_DEBUGMSG(("ListUpdate CR \n")); return m_pDoc->createAndSendCR(pos, crp->getPXType(), true,0); } case PX_ChangeRecord::PXT_StopList: { UT_DEBUGMSG(("StopList CR \n")); return m_pDoc->createAndSendCR(pos, crp->getPXType(), true,0); } case PX_ChangeRecord::PXT_UpdateField: { UT_DEBUGMSG(("UpdateFiled CR \n")); return m_pDoc->createAndSendCR(pos, crp->getPXType(), true,0); } case PX_ChangeRecord::PXT_RemoveList: { UT_DEBUGMSG(("RemoveList CR \n")); return m_pDoc->createAndSendCR(pos, crp->getPXType(), true,0); } case PX_ChangeRecord::PXT_UpdateLayout: { UT_DEBUGMSG(("UpdateLayout CR \n")); return m_pDoc->createAndSendCR(pos, crp->getPXType(), true,0); } case PX_ChangeRecord::PXT_CreateDataItem: { const Data_ChangeRecordSessionPacket* dp = static_cast<const Data_ChangeRecordSessionPacket*>( crp ); const char * szNameV = g_strdup(dp->getAttribute(PT_DATAITEM_ATTRIBUTE_NAME)); PD_DataItemHandle pHandle = NULL; std::string sToken = dp->m_bTokenSet ? dp->m_sToken : ""; UT_ByteBuf * pBuf= new UT_ByteBuf(); UT_DEBUGMSG(("PXT_CreateDataItem: append image buffer @ 0x%p, %lu bytes, sToken %s\n", &dp->m_vecData[0], (long unsigned)dp->m_vecData.size(), sToken.c_str())); pBuf->append(reinterpret_cast<const UT_Byte *>( &dp->m_vecData[0] ), dp->m_vecData.size() ); bool res = m_pDoc->createDataItem(szNameV,false,pBuf,sToken,&pHandle); delete pBuf; return res; } case PX_ChangeRecord::PXT_ChangeDocProp: { UT_DEBUGMSG(("ChangeDocProp CR \n")); const Props_ChangeRecordSessionPacket* pcrsp = static_cast<const Props_ChangeRecordSessionPacket*>( crp ); // // Assemble the Attributes for different properties // const gchar** szAtts = const_cast<const gchar **>(pcrsp->getAtts()); const gchar** szProps = const_cast<const gchar **>(pcrsp->getProps()); // // Now direct the document to make the changes // return m_pDoc->changeDocPropeties(szAtts,szProps); } default: { UT_DEBUGMSG(("Unimplemented crp->getPXType(): %d\n", crp->getPXType())); UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); break; } } return true; } else { UT_DEBUGMSG(("ABI_Collab_Import::import called with unhandled packet class type: %d!\n", packet.getClassType())); return false; } break; } return false; }
bool ODe_MetaDataWriter::writeMetaData(PD_Document* pDoc, GsfOutfile* oo) { GsfOutput* meta = gsf_outfile_new_child (oo, "meta.xml", FALSE); static const UT_UTF8String preamble = UT_UTF8String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<office:document-meta" " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"" " xmlns:xlink=\"http://www.w3.org/1999/xlink\"" " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" " xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"" " xmlns:ooo=\"http://openoffice.org/2004/office\"" " office:version=\"1.1\">\n" "<office:meta>\n" "<meta:generator>AbiWord/") + PACKAGE_VERSION + " (" + PLATFORM + ", " + TOOLKIT + ")</meta:generator>\n"; static const char * const postamble [] = { "</office:meta>\n", "</office:document-meta>\n" }; ODe_writeUTF8String(meta, preamble); UT_UTF8String meta_val, val; #define WRITE_METADATA_ELEMENT(abiwordKey, odElementName) if (pDoc->getMetaDataProp(abiwordKey, meta_val) && meta_val.size()) { \ meta_val.escapeXML(); \ val = UT_UTF8String_sprintf("<%s>%s</%s>\n", odElementName, meta_val.utf8_str(), odElementName); \ ODe_writeUTF8String (meta, val); \ } WRITE_METADATA_ELEMENT(PD_META_KEY_TITLE, "dc:title"); WRITE_METADATA_ELEMENT(PD_META_KEY_DESCRIPTION, "dc:description"); WRITE_METADATA_ELEMENT(PD_META_KEY_SUBJECT, "dc:subject"); //Each keyword needs to be exported individually: UT_UTF8String keywords; if (pDoc->getMetaDataProp (PD_META_KEY_KEYWORDS, keywords) && keywords.size()) { UT_UTF8String buf = ""; UT_UCS4String keyword = keywords.utf8_str(); for(UT_uint32 i = 0;i < keyword.length(); i++) { if(keyword[i] != ' ') { buf += keyword[i]; } else { if(buf.empty()) //only blank space encountered continue; buf.escapeXML(); val = UT_UTF8String_sprintf("<meta:keyword>%s</meta:keyword>\n", buf.utf8_str()); ODe_writeUTF8String(meta, val); buf.clear(); } } if(buf.length()) //there may only be one keyword (i.e. no spaces encountered) { buf.escapeXML(); val = UT_UTF8String_sprintf("<meta:keyword>%s</meta:keyword>\n", buf.utf8_str()); ODe_writeUTF8String(meta, val); } } // Should have a PD_META_KEY_INITIAL_CREATOR macro for this one, but only // if it gets implemented on the document properties dialog. WRITE_METADATA_ELEMENT("meta:initial-creator", "meta:initial-creator"); WRITE_METADATA_ELEMENT(PD_META_KEY_CREATOR, "dc:creator"); WRITE_METADATA_ELEMENT("meta:printed-by", "meta:printed-by"); // ATTENTION: I'm assuming that dc.date is used by AbiWord as // the document creation date & time. WRITE_METADATA_ELEMENT(PD_META_KEY_DATE, "meta:creation-date"); // Note that, for the OpenDocument standard, dc.date // is the last modification date & time. WRITE_METADATA_ELEMENT(PD_META_KEY_DATE_LAST_CHANGED, "dc:date"); WRITE_METADATA_ELEMENT("meta:print-date", "meta:print-date"); WRITE_METADATA_ELEMENT(PD_META_KEY_LANGUAGE, "dc:language"); #undef WRITE_METADATA_ELEMENT ODe_writeToStream(meta, postamble, G_N_ELEMENTS(postamble)); ODe_gsf_output_close(meta); return true; }
void ODe_AbiDocListener::_insertMath(PT_AttrPropIndex api) { const gchar* szMath = NULL; szMath = _getObjectKey(api, static_cast<const gchar*>("dataid")); UT_return_if_fail(szMath); const UT_ByteBuf * pByteBuf = NULL; bool bOK = m_pDocument->getDataItemDataByName(szMath, const_cast<const UT_ByteBuf **>(&pByteBuf), NULL, NULL); UT_return_if_fail(bOK); UT_UCS4_mbtowc myWC; UT_UTF8String sMathML; sMathML.appendBuf(*pByteBuf, myWC); UT_return_if_fail(!sMathML.empty()); UT_UCS4String buf = sMathML.utf8_str(); UT_UTF8String output = ""; const PP_AttrProp * pAP = NULL; bool bHaveProp = m_pDocument->getAttrProp(api,&pAP); UT_LocaleTransactor t(LC_NUMERIC, "C"); UT_UTF8String dimension; double dInch; UT_return_if_fail(bHaveProp && pAP); _openSpan(api); if(pAP->getProperty("width", szMath)) { dInch = static_cast<double>(atoi(szMath))/UT_LAYOUT_RESOLUTION; UT_UTF8String_sprintf(dimension,"%fin",dInch); output += "<draw:frame svg:width=\""; output += dimension; output += "\" svg:height=\""; } else { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); _closeSpan(); return; } if(pAP->getProperty("height", szMath)) { dInch = static_cast<double>(atoi(szMath))/UT_LAYOUT_RESOLUTION; dimension.clear(); UT_UTF8String_sprintf(dimension,"%fin",dInch); output += dimension; output += "\"><draw:object>"; } else { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); _closeSpan(); return; } for (UT_uint32 i = 0; i < buf.length(); i++) { if (buf[i] == '<') { if (((i + 1) < buf.length()) && (buf[i+1] == '/')) { output += "</math:"; i++; // skip the '/' } else if ((i + 1) < buf.length()) { output += "<math:"; } else { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); } } else { output += buf[i]; } } output += "</draw:object></draw:frame>"; m_pCurrentImpl->insertText(output); _closeSpan(); }