当前位置: 首页>>代码示例>>C++>>正文


C++ UT_UTF8String类代码示例

本文整理汇总了C++中UT_UTF8String的典型用法代码示例。如果您正苦于以下问题:C++ UT_UTF8String类的具体用法?C++ UT_UTF8String怎么用?C++ UT_UTF8String使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UT_UTF8String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的UT_UTF8String类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。