本文整理汇总了C++中UT_UTF8String类的典型用法代码示例。如果您正苦于以下问题:C++ UT_UTF8String类的具体用法?C++ UT_UTF8String怎么用?C++ UT_UTF8String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UT_UTF8String类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AbiGOComponent_FileInsert
//
// AbiGOComponent_FileInsert
// -------------------
// This is the function that we actually call to insert a component using
// data from a file.
//
bool
AbiGOComponent_FileInsert(G_GNUC_UNUSED AV_View* v, G_GNUC_UNUSED EV_EditMethodCallData *d)
{
// Get the current view that the user is in.
XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
PD_Document * pDoc = static_cast<PD_Document *>(pFrame->getCurrentDoc());
char* pNewFile = NULL;
IEGraphicFileType iegft = IEGFT_Unknown;
bool bOK = s_AskForGOComponentPathname(pFrame,&pNewFile,&iegft);
if (!bOK || !pNewFile)
{
UT_DEBUGMSG(("ARRG! bOK = %d pNewFile = %s \n",bOK,pNewFile));
return false;
}
UT_UTF8String sNewFile = pNewFile;
// we own storage for pNewFile and must free it.
FREEP(pNewFile);
UT_DEBUGMSG(("fileInsertObject: loading [%s]\n",sNewFile.utf8_str()));
char *mime_type = go_get_mime_type(sNewFile.utf8_str());
IE_Imp_Component * pImpComponent = new IE_Imp_Component(pDoc, mime_type);
g_free(mime_type);
UT_Error errorCode = pImpComponent->importFile(sNewFile.utf8_str());
DELETEP(pImpComponent);
if(errorCode != UT_OK)
{
s_CouldNotLoadFileMessage(pFrame, sNewFile.utf8_str(), errorCode);
return false;
}
return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:45,代码来源:AbiGOComponent.cpp
示例2: _tagOpen
void s_XSL_FO_Listener::_tagOpen(UT_uint32 tagID, const UT_UTF8String & content, bool newline)
{
m_pie->write("<");
m_pie->write("fo:"); //this might be unnecessary one day, so keep this here for easier removal (see bug 4355, comment 6)
m_pie->write(content.utf8_str());
m_pie->write(">");
if(newline)
m_pie->write("\n");
m_utnsTagStack.push(tagID);
xxx_UT_DEBUGMSG(("XSL-FO export: Pushing %d onto stack\n",tagID));
}
开发者ID:Distrotech,项目名称:abiword,代码行数:13,代码来源:ie_exp_XSL-FO.cpp
示例3: UT_DEBUGMSG
UT_UTF8String IE_Exp_HTML_NavigationHelper::getBookmarkFilename(
const UT_UTF8String& id) const
{
std::map<UT_UTF8String, UT_UTF8String>::const_iterator bookmarkIter = m_bookmarks.find(id);
if (bookmarkIter != m_bookmarks.end())
{
UT_DEBUGMSG(("Found bookmark %s at file %s", id.utf8_str(), bookmarkIter->second.utf8_str()));
return bookmarkIter->second;
} else
{
return UT_UTF8String();
}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:13,代码来源:ie_exp_HTML_NavigationHelper.cpp
示例4: setLabel
/** set the widget label */
void XAP_UnixWidget::setLabel(const UT_UTF8String &val)
{
if (GTK_IS_BUTTON(m_widget)) {
gtk_button_set_label(GTK_BUTTON(m_widget), val.utf8_str());
}
else if (GTK_IS_LABEL(m_widget)) {
if(!gtk_label_get_use_markup(GTK_LABEL(m_widget))) {
gtk_label_set_text(GTK_LABEL(m_widget), val.utf8_str());
}
else {
std::string markup = UT_std_string_sprintf(m_data.c_str(),
val.utf8_str());
gtk_label_set_label(GTK_LABEL(m_widget), markup.c_str());
}
}
else if (GTK_IS_WINDOW(m_widget)) {
gtk_window_set_title(GTK_WINDOW(m_widget), val.utf8_str());
}
else {
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:23,代码来源:xap_UnixWidget.cpp
示例5: _constructWindowContents
void AP_UnixDialog_ToggleCase::_constructWindowContents (GtkWidget *vbox1)
{
GSList *vbox1_group = NULL;
GtkWidget *sentenceCase;
GtkWidget *lowerCase;
GtkWidget *upperCase;
GtkWidget *firstUpperCase;
GtkWidget *toggleCase;
const XAP_StringSet * pSS = m_pApp->getStringSet();
UT_UTF8String s;
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_SentenceCase,s);
sentenceCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (sentenceCase));
gtk_widget_show (sentenceCase);
gtk_box_pack_start (GTK_BOX (vbox1), sentenceCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_LowerCase,s);
lowerCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (lowerCase));
gtk_widget_show (lowerCase);
gtk_box_pack_start (GTK_BOX (vbox1), lowerCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_UpperCase,s);
upperCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (upperCase));
gtk_widget_show (upperCase);
gtk_box_pack_start (GTK_BOX (vbox1), upperCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_FirstUpperCase,s);
firstUpperCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (firstUpperCase));
gtk_widget_show (firstUpperCase);
gtk_box_pack_start (GTK_BOX (vbox1), firstUpperCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_ToggleCase,s);
toggleCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggleCase));
gtk_widget_show (toggleCase);
gtk_box_pack_start (GTK_BOX (vbox1), toggleCase, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT(sentenceCase), "user_data", GINT_TO_POINTER(CASE_SENTENCE));
g_object_set_data (G_OBJECT(lowerCase), "user_data", GINT_TO_POINTER(CASE_LOWER));
g_object_set_data (G_OBJECT(upperCase), "user_data", GINT_TO_POINTER(CASE_UPPER));
g_object_set_data (G_OBJECT(firstUpperCase), "user_data", GINT_TO_POINTER(CASE_FIRST_CAPITAL));
g_object_set_data (G_OBJECT(toggleCase), "user_data", GINT_TO_POINTER(CASE_TOGGLE));
g_signal_connect (G_OBJECT(sentenceCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(lowerCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(upperCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(firstUpperCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(toggleCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:58,代码来源:ap_UnixDialog_ToggleCase.cpp
示例6: UT_UTF8String_setProperty
/*!
* Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in"
* Add the property sProp with value sVal to the string of properties. If the property is already present, replace the
* old value with the new value.
*/
void UT_UTF8String_setProperty(UT_UTF8String & sPropertyString, const UT_UTF8String & sProp, const UT_UTF8String & sVal)
{
//
// Remove the old value if it exists and tack the new property on the end.
//
UT_UTF8String_removeProperty(sPropertyString, sProp);
if(sPropertyString.size() > 0)
{
sPropertyString += "; ";
}
sPropertyString += sProp;
sPropertyString += ":";
sPropertyString += sVal;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:19,代码来源:ut_string_class.cpp
示例7:
const char * AP_UnixDialog_Styles::getCurrentStyle (void) const
{
static UT_UTF8String sStyleBuf;
UT_ASSERT(m_tvStyles);
if (!m_selectedStyle)
return NULL;
gchar * style = NULL;
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(m_tvStyles));
GtkTreeIter iter;
gtk_tree_model_get_iter(model, &iter, m_selectedStyle);
gtk_tree_model_get(model, &iter, 0, &style, -1);
if (!style)
return NULL;
sStyleBuf = style;
g_free(style);
return sStyleBuf.utf8_str();
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:23,代码来源:ap_UnixDialog_Styles.cpp
示例8: gtk_tree_view_get_model
void AP_UnixDialog_Styles::event_DeleteClicked(void)
{
if (m_selectedStyle)
{
m_sNewStyleName = "";
gchar * style = NULL;
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(m_tvStyles));
GtkTreeIter iter;
gtk_tree_model_get_iter(model, &iter, m_selectedStyle);
gtk_tree_model_get(model, &iter, 0, &style, -1);
if (!style)
return; // ok, nothing's selected. that's fine
UT_DEBUGMSG(("DOM: attempting to delete style %s\n", style));
if (!getDoc()->removeStyle(style)) // actually remove the style
{
const XAP_StringSet * pSS = m_pApp->getStringSet();
UT_UTF8String s;
pSS->getValueUTF8 (AP_STRING_ID_DLG_Styles_ErrStyleCantDelete,s);
const gchar * msg = s.utf8_str();
getFrame()->showMessageBox (static_cast<const char *>(msg),
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK);
return;
}
g_free(style);
getFrame()->repopulateCombos();
_populateWindowData(); // force a refresh
getDoc()->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:37,代码来源:ap_UnixDialog_Styles.cpp
示例9: UT_return_if_fail
void ODe_DocumentData::handleDefaultTabInterval(ODe_Style_Style* pStyle) {
UT_return_if_fail(pStyle);
UT_UTF8String defaultTabInterval = pStyle->getDefaultTabInterval();
if (defaultTabInterval.empty())
return;
// remove the default tab interval property from the style
pStyle->setDefaultTabInterval("");
// ... and create a default style to hold the default tab interval property
ODe_Style_Style* pDefaultStyle = m_styles.getDefaultStyles().getStyle("paragraph");
if (!pDefaultStyle) {
pDefaultStyle = new ODe_Style_Style();
pDefaultStyle->setFamily("paragraph");
pDefaultStyle->makeDefaultStyle();
m_styles.getDefaultStyles().storeStyle("paragraph", pDefaultStyle);
}
// NOTE: if a paragraph default style already exists with a default tab interval
// property set, then we'll just overwrite it. This can happen because AbiWord
// supports such a property on every paragraph and paragraph style, but ODT only
// supports one on the default paragraph style.
pDefaultStyle->setDefaultTabInterval(defaultTabInterval);
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:24,代码来源:ODe_DocumentData.cpp
示例10: setMainLevel
void AP_UnixDialog_FormatTOC::setMainLevel(UT_sint32 iLevel)
{
AP_Dialog_FormatTOC::setMainLevel(iLevel);
UT_UTF8String sVal;
sVal = getTOCPropVal("toc-dest-style",getMainLevel());
GtkWidget * pW= _getWidget("wDispStyle");
gtk_label_set_text(GTK_LABEL(pW),sVal.utf8_str());
sVal = getTOCPropVal("toc-has-label",getMainLevel());
pW = _getWidget("wHasLabel");
if(g_ascii_strcasecmp(sVal.utf8_str(),"1") == 0)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pW),TRUE);
}
else
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pW),FALSE);
}
sVal = getTOCPropVal("toc-source-style",getMainLevel());
pW = _getWidget("wFillStyle");
gtk_label_set_text(GTK_LABEL(pW),sVal.utf8_str());
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:24,代码来源:ap_UnixDialog_FormatTOC.cpp
示例11: UT_UTF8String_sprintf
void s_XSL_FO_Listener::_handleDataItems(void)
{
const char * szName = NULL;
std::string mimeType;
const UT_ByteBuf * pByteBuf;
for (UT_uint32 k=0; (m_pDocument->enumDataItems(k, NULL, &szName, &pByteBuf, &mimeType)); k++)
{
UT_sint32 loc = -1;
for (UT_sint32 i = 0; i < m_utvDataIDs.getItemCount(); i++)
{
if(strcmp(reinterpret_cast<const char*>(m_utvDataIDs[i]), szName) == 0)
{
loc = i;
break;
}
}
if(loc > -1)
{
UT_UTF8String fname;
UT_UTF8String_sprintf(fname, "%s_data", m_pie->getFileName());
UT_go_directory_create(fname.utf8_str(), 0750, NULL);
if (mimeType == "image/svg+xml")
UT_UTF8String_sprintf(fname, "%s/%d.svg", fname.utf8_str(), loc);
else if (mimeType == "application/mathml+xml")
UT_UTF8String_sprintf(fname, "%s/%d.mathml", fname.utf8_str(), loc);
else // raster Image
{
const char * extension = "png";
if(mimeType == "image/jpeg") {
extension = "jpg";
}
char * temp = _stripSuffix(UT_go_basename(szName), '_');
char * fstripped = _stripSuffix(temp, '.');
UT_UTF8String_sprintf(fname, "%s/%s.%s", fname.utf8_str(), fstripped, extension);
FREEP(temp);
FREEP(fstripped);
}
GsfOutput *fp = UT_go_file_create (fname.utf8_str(), NULL);
if(!fp)
continue;
gsf_output_write(fp, pByteBuf->getLength(), (const guint8 *)pByteBuf->getPointer(0));
gsf_output_close(fp);
g_object_unref(fp);
}
}
return;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:56,代码来源:ie_exp_XSL-FO.cpp
示例12: gtk_entry_get_text
bool AP_UnixDialog_Styles::event_Modify_OK(void)
{
const char * text = gtk_entry_get_text (GTK_ENTRY (m_wStyleNameEntry));
if (!text || !strlen (text))
{
// error message!
const XAP_StringSet * pSS = m_pApp->getStringSet ();
UT_UTF8String s;
pSS->getValueUTF8 (AP_STRING_ID_DLG_Styles_ErrBlankName,s);
const char * msg = s.utf8_str();
getFrame()->showMessageBox (static_cast<const char *>(msg),
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK);
return false;
}
// TODO save out state of radio items
m_answer = AP_Dialog_Styles::a_OK;
return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:24,代码来源:ap_UnixDialog_Styles.cpp
示例13: getSnapShots
bool GR_EmbedView::getSnapShots(void)
{
UT_UTF8String sName = "snapshot-png-";
sName += m_sDataID;
bool bFound = false;
PD_DataItemHandle pHandle = NULL;
UT_ConstByteBufPtr pPNG;
UT_ConstByteBufPtr pSVG;
bFound = m_pDoc->getDataItemDataByName(sName.utf8_str(), pPNG, NULL, &pHandle);
if(!bFound)
{
m_bHasPNGSnapshot = false;
}
else
{
auto buf = UT_ByteBufPtr(new UT_ByteBuf);
buf->ins(0, pPNG->getPointer(0), pPNG->getLength());
m_PNGBuf = buf;
m_bHasPNGSnapshot = true;
}
sName = "snapshot-svg-";
sName += m_sDataID;
bFound = m_pDoc->getDataItemDataByName(sName.utf8_str(), pSVG, NULL, &pHandle);
if(!bFound)
{
m_bHasSVGSnapshot = false;
}
else
{
auto buf = UT_ByteBufPtr(new UT_ByteBuf);
buf->ins(0, pSVG->getPointer(0), pSVG->getLength());
m_SVGBuf = buf;
m_bHasSVGSnapshot = true;
}
return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:36,代码来源:gr_EmbedManager.cpp
示例14: AbiMathView_FileInsert
//
// AbiMathView_FileInsert
// -------------------
// This is the function that we actually call to insert the MathML.
//
bool
AbiMathView_FileInsert(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());
PD_Document * pDoc = static_cast<PD_Document *>(pFrame->getCurrentDoc());
char* pNewFile = NULL;
bool bOK = s_AskForMathMLPathname(pFrame,&pNewFile);
if (!bOK || !pNewFile)
{
UT_DEBUGMSG(("ARRG! bOK = %d pNewFile = %s \n",bOK,pNewFile));
return false;
}
UT_UTF8String sNewFile = pNewFile;
// we own storage for pNewFile and must free it.
FREEP(pNewFile);
UT_DEBUGMSG(("fileInsertMathML: loading [%s]\n",sNewFile.utf8_str()));
IE_Imp_MathML * pImpMathML = new IE_Imp_MathML(pDoc, pMathManager->EntityTable());
UT_Error errorCode = pImpMathML->importFile(sNewFile.utf8_str());
if (errorCode != UT_OK)
{
s_CouldNotLoadFileMessage(pFrame, sNewFile.utf8_str(), errorCode);
DELETEP(pImpMathML);
return false;
}
/* Create the data item */
UT_uint32 uid = pDoc->getUID(UT_UniqueId::Image);
UT_UTF8String sUID;
UT_UTF8String_sprintf(sUID,"%d",uid);
pDoc->createDataItem(sUID.utf8_str(), false, pImpMathML->getByteBuf(),
"application/mathml+xml", NULL);
/* Insert the MathML Object */
PT_DocPosition pos = pView->getPoint();
pView->cmdInsertMathML(sUID.utf8_str(),pos);
DELETEP(pImpMathML);
return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:54,代码来源:AbiMathView.cpp
示例15: slaveInit
void ABI_Collab_Export::slaveInit(const UT_UTF8String& docUUID, UT_sint32 iRemoteRev)
{
UT_DEBUGMSG(("ABI_Collab_Export::slaveInit() - docUUID: %s, iRev: %d\n", docUUID.utf8_str(), iRemoteRev));
// NOTE: it's important that this function resets all state, as it can be
// called in the middle of an already running collaboration session
// (eg. when a session takeover happens)
_cleanup();
_init();
// initialize the adjustment stack
ChangeRecordSessionPacket voidPacket;
voidPacket.setDocUUID(docUUID);
voidPacket.setRev(iRemoteRev);
m_pAbiCollab->addChangeAdjust(new ChangeAdjust(voidPacket, static_cast<PT_DocPosition>(0), docUUID));
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:17,代码来源:AbiCollab_Export.cpp
示例16: UT_UTF8String_sprintf
void IE_Exp_EPUB_EPUB3Writer::insertAnnotations(
const std::vector<UT_UTF8String> &titles,
const std::vector<UT_UTF8String> &authors,
const std::vector<UT_UTF8String> &annotations)
{
m_pTagWriter->openTag("section");
m_pTagWriter->addAttribute("epub:type", "annotations");
for(size_t i = 0; i < annotations.size(); i++)
{
UT_UTF8String title = titles.at(i);
UT_UTF8String author = authors.at(i);
UT_UTF8String annotation = annotations.at(i);
m_pTagWriter->openTag("section");
// m_pTagWriter->addAttribute("class", "annotation");
m_pTagWriter->addAttribute("epub:type", "annotation");
m_pTagWriter->addAttribute("id", UT_UTF8String_sprintf("annotation-%d",
i + 1).utf8_str());
if (title.length())
{
m_pTagWriter->openTag("h4");
m_pTagWriter->writeData(title.utf8_str());
m_pTagWriter->closeTag();
}
/*if (author.length())
{
m_pTagWriter->openTag("span");
m_pTagWriter->addAttribute("class", "annotation-author");
m_pTagWriter->writeData(author.utf8_str());
m_pTagWriter->closeTag();
m_pTagWriter->openTag("br", false, true);
m_pTagWriter->closeTag();
}*/
if (annotation.length())
{
m_pTagWriter->openTag("blockquote");
// m_pTagWriter->addAttribute("class", "annotation-content");
m_pTagWriter->writeData(annotation.utf8_str());
m_pTagWriter->closeTag();
}
m_pTagWriter->closeTag();
}
m_pTagWriter->closeTag();
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:49,代码来源:ie_exp_EPUB_EPUB3Writer.cpp
示例17: setBorderThicknessInGUI
void AP_UnixDialog_FormatFrame::setBorderThicknessInGUI(UT_UTF8String & sThick)
{
double thickness = UT_convertToInches(sThick.utf8_str());
guint i =0;
guint closest = 0;
double dClose = 100000000.;
for(i=0; i<FORMAT_FRAME_NUMTHICKNESS; i++)
{
double diff = thickness - m_dThickness[i];
if(diff < 0)
diff = -diff;
if(diff < dClose)
{
closest = i;
dClose = diff;
}
}
XAP_GtkSignalBlocker b(G_OBJECT(m_wBorderThickness),m_iBorderThicknessConnect);
gtk_combo_box_set_active(GTK_COMBO_BOX(m_wBorderThickness), closest);
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:20,代码来源:ap_UnixDialog_FormatFrame.cpp
示例18: _tagClose
void s_XSL_FO_Listener::_tagClose(UT_uint32 tagID, const UT_UTF8String & content, bool newline)
{
UT_uint32 i = 0;
m_pie->write("</");
m_pie->write("fo:"); //this might be unnecessary one day, so keep this here for easier removal (see bug 4355, comment 6)
m_pie->write(content.utf8_str());
m_pie->write(">");
if(newline)
m_pie->write("\n");
m_utnsTagStack.pop((UT_sint32*)&i);
m_iLastClosed = i;
xxx_UT_DEBUGMSG(("XSL-FO export: Popping %d off of stack\n",i));
if(i != tagID)
{
UT_DEBUGMSG(("XSL-FO export: possible mismatched tag. Requested: %d, Popped: %d\n",tagID,i));
}
}
开发者ID:Distrotech,项目名称:abiword,代码行数:21,代码来源:ie_exp_XSL-FO.cpp
示例19: itex2MML_parse
bool GR_MathManager::convert(UT_uint32 iConType, UT_ByteBuf & From, UT_ByteBuf & To)
{
XAP_App * pApp = XAP_App::getApp();
XAP_Frame * pFrame = pApp->getLastFocussedFrame();
if (iConType != 0)
{
return false;
}
/* add a pair of enclosing brackets \[ \] */
UT_UTF8String sLatex;
UT_UCS4_mbtowc myWC;
sLatex += "\\[";
sLatex.appendBuf(From, myWC);
sLatex += "\\]";
char * mathml = itex2MML_parse(sLatex.utf8_str(), sLatex.size());
if (!mathml)
{
pFrame->showMessageBox("itex2MML failed to convert the LaTeX equation into MathML, sorry!\n", // TODO: fix message
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK);
return false;
}
UT_UTF8String sMathML(mathml);
itex2MML_free_string(mathml);
if (sMathML.size() == 0)
{
UT_UTF8String sErrMessage = "itex2MML conversion from LaTex equation resulted in zero-length MathML!\n"; // TODO: fix message
//sErrMessage += sLatex;
sErrMessage += "\n";
// sErrMessage += FullLine;
pFrame->showMessageBox(sErrMessage.utf8_str(),
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK);
return false;
}
UT_DEBUGMSG(("Input MathML %s \n", sMathML.utf8_str()));
return EntityTable().convert(sMathML.utf8_str(), sMathML.size(), To);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:46,代码来源:AbiMathView.cpp
示例20: gtk_text_view_get_buffer
void
AP_UnixDialog_Spell::_updateWindow (void)
{
GtkTextBuffer * buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_txWrong));
GtkTextIter iter2;
// Empty buffer
gtk_text_buffer_set_text(buffer, "", -1);
const UT_UCSChar *p;
UT_sint32 iLength;
// insert start of sentence
p = m_pWordIterator->getPreWord(iLength);
if (0 < iLength)
{
gchar * preword = (gchar*) _convertToMB(p, iLength);
gtk_text_buffer_set_text(buffer, preword, -1);
FREEP(preword);
}
// insert misspelled word (in highlight color)
p = m_pWordIterator->getCurrentWord(iLength);
gchar * word = (gchar*) _convertToMB(p, iLength);
GtkTextTag * txt_tag = gtk_text_buffer_create_tag(buffer, NULL, "foreground-gdk", &m_highlight, NULL);
gtk_text_buffer_get_end_iter(buffer, &iter2);
gtk_text_buffer_insert_with_tags(buffer, &iter2, word, -1, txt_tag, NULL);
// word is freed at the end of the method...
// insert end of sentence
p = m_pWordIterator->getPostWord(iLength);
if (0 < iLength)
{
gchar * postword = (gchar*) _convertToMB(p, iLength);
gtk_text_buffer_get_end_iter(buffer, &iter2);
gtk_text_buffer_insert(buffer, &iter2, postword, -1);
FREEP(postword);
}
else
{
// Insert space to make gtk_text_buffer understand that it
// really should highlight the selected word. This is a
// workaround for bug 5459. It really should be fixed in GTK.
gtk_text_buffer_get_end_iter(buffer, &iter2);
gtk_text_buffer_insert(buffer, &iter2, " ", -1);
}
// TODO: set scroll position so misspelled word is centered
GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (m_lvSuggestions));
// Detach model for faster updates
g_object_ref (G_OBJECT (model));
gtk_tree_view_set_model (GTK_TREE_VIEW (m_lvSuggestions), NULL);
gtk_list_store_clear (GTK_LIST_STORE (model));
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_lvSuggestions));
UT_DEBUGMSG (("ROB: AP_UnixDialog_Spell::_updateWindow() itemcount=%d\n", m_Suggestions->getItemCount ()));
if (m_Suggestions->getItemCount () == 0) {
GtkTreeIter iter;
gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
const XAP_StringSet * pSS = m_pApp->getStringSet();
UT_UTF8String s;
pSS->getValueUTF8(AP_STRING_ID_DLG_Spell_NoSuggestions,s);
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
COLUMN_SUGGESTION, s.utf8_str (),
COLUMN_NUMBER, -1,
-1);
g_signal_handler_block(G_OBJECT(m_eChange), m_replaceHandlerID);
gtk_entry_set_text(GTK_ENTRY(m_eChange), word);
g_signal_handler_unblock(G_OBJECT(m_eChange), m_replaceHandlerID);
}
else
{
GtkTreeIter iter;
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
gchar * suggest = NULL;
for (UT_sint32 i = 0; i < m_Suggestions->getItemCount(); i++)
{
suggest = (gchar*) _convertToMB((UT_UCSChar*)m_Suggestions->getNthItem(i));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
COLUMN_SUGGESTION, suggest,
COLUMN_NUMBER, i,
-1);
}
// put the first suggestion in the entry
suggest = (gchar*) _convertToMB((UT_UCSChar*)m_Suggestions->getNthItem(0));
g_signal_handler_block(G_OBJECT(m_eChange), m_replaceHandlerID);
gtk_entry_set_text(GTK_ENTRY(m_eChange), suggest);
g_signal_handler_unblock(G_OBJECT(m_eChange), m_replaceHandlerID);
}
//.........这里部分代码省略.........
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:101,代码来源:ap_UnixDialog_Spell.cpp
注:本文中的UT_UTF8String类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论