/** get the widget value as string */ void XAP_UnixWidget::getValueString(UT_UTF8String &val) { if (GTK_IS_ENTRY(m_widget)) { val.assign(gtk_entry_get_text(GTK_ENTRY(m_widget))); } else if (GTK_IS_LABEL(m_widget)) { val.assign(gtk_label_get_text(GTK_LABEL(m_widget))); } else { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); } }
UT_Error OXML_Element_Math::addToPT(PD_Document * pDocument) { UT_uint32 id; id = pDocument->getUID(UT_UniqueId::Math); std::string mID = UT_std_string_sprintf("MathLatex%d", id); std::string lID = UT_std_string_sprintf("LatexMath%d", id); UT_ByteBuf mathBuf; UT_ByteBuf latexBuf; mathBuf.ins(0,reinterpret_cast<const UT_Byte *>(m_MathML.c_str()),static_cast<UT_uint32>(m_MathML.length())); UT_UTF8String sMathml; // TO DO : use std::string after enabling it in ie_math_convert UT_UTF8String sLatex,sitex; sMathml.assign(m_MathML.c_str()); pDocument->createDataItem(mID.c_str(),false,&mathBuf, "", NULL); if(convertMathMLtoLaTeX(sMathml, sLatex) && convertLaTeXtoEqn(sLatex,sitex)) { // Conversion of MathML to LaTeX and the Equation Form suceeds latexBuf.ins(0,reinterpret_cast<const UT_Byte *>(sitex.utf8_str()),static_cast<UT_uint32>(sitex.size())); pDocument->createDataItem(lID.c_str(), false, &latexBuf, "", NULL); } const gchar *atts[5] = { NULL, NULL, NULL, NULL, NULL }; atts[0] = PT_IMAGE_DATAID; atts[1] = static_cast<const gchar *>(mID.c_str()); atts[2] = static_cast<const gchar *>("latexid"); atts[3] = static_cast<const gchar *>(lID.c_str()); if(!pDocument->appendObject(PTO_Math, atts)) return UT_ERROR; return UT_OK; }
bool AP_Win32Dialog_Latex::getLatexFromGUI(void) { char buffer[2048]; // TODO: FIXME: BAD BAD FIXED LENGTH UT_UTF8String sLatex; getControlText(AP_RID_DIALOG_LATEX_EDIT_LATEX, (LPSTR) buffer, 2048); //sLatex = AP_Win32App::s_fromWinLocaleToUTF8(buffer); UT_DEBUGMSG(("LaTeX from widget is %s \n",buffer/*sLatex.utf8_str()*/)); sLatex.assign(buffer,0); setLatex(sLatex); return true; }