本文整理汇总了C++中UT_Win32LocaleString类的典型用法代码示例。如果您正苦于以下问题:C++ UT_Win32LocaleString类的具体用法?C++ UT_Win32LocaleString怎么用?C++ UT_Win32LocaleString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UT_Win32LocaleString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: UT_return_val_if_fail
int XAP_Win32DialogBase::addItemToCombo(UT_sint32 controlId, LPCSTR p_str)
{
UT_return_val_if_fail(IsWindow(m_hDlg), CB_ERR);
UT_Win32LocaleString str;
str.fromUTF8 (p_str);
return SendDlgItemMessageW(m_hDlg, controlId, CB_ADDSTRING, 0, (LPARAM)str.c_str());
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:7,代码来源:xap_Win32DialogBase.cpp
示例2:
/* From UCS4 To WinLocale */
UT_Win32LocaleString AP_Win32App::s_fromUCS4ToWinLocale(const UT_UCS4Char * szIn)
{
UT_Win32LocaleString sRslt;
sRslt.fromUCS4(szIn);
//UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
return sRslt;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:8,代码来源:ap_Win32App.cpp
示例3: UT_return_if_fail
void XAP_Win32DialogBase::setDialogTitle(const char* uft8_str)
{
UT_return_if_fail(IsWindow(m_hDlg));
UT_Win32LocaleString str;
str.fromUTF8 (uft8_str);
SetWindowTextW (m_hDlg, str.c_str());
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:7,代码来源:xap_Win32DialogBase.cpp
示例4: SendMessageW
void AP_Win32Dialog_Field::SetFieldsList(void)
{
fp_FieldTypesEnum FType = fp_FieldTypes[m_iTypeIndex].m_Type;
SendMessageW(m_hwndFormats, LB_RESETCONTENT, 0, 0);
int i;
for (i = 0;fp_FieldFmts[i].m_Tag != NULL;i++)
{
if( fp_FieldFmts[i].m_Type == FType )
break;
}
UT_Win32LocaleString str;
for (;fp_FieldFmts[i].m_Tag != NULL && fp_FieldFmts[i].m_Type == FType;i++)
{
if((fp_FieldFmts[i].m_Num != FPFIELD_endnote_anch) &&
(fp_FieldFmts[i].m_Num != FPFIELD_endnote_ref) &&
(fp_FieldFmts[i].m_Num != FPFIELD_footnote_anch) &&
(fp_FieldFmts[i].m_Num != FPFIELD_footnote_ref))
{
str.fromUTF8(fp_FieldFmts[i].m_Desc);
UT_sint32 index = SendMessageW(m_hwndFormats, LB_ADDSTRING, 0, (LPARAM)str.c_str());
if (index != LB_ERR && index != LB_ERRSPACE)
{
SendMessageW(m_hwndFormats, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
}
}
SendMessageW(m_hwndFormats, LB_SETCURSEL, 0, 0);
_FormatListBoxChange();
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:32,代码来源:ap_Win32Dialog_Field.cpp
示例5: CreatePen
/*
Draws the Format button with an arrow
*/
void AP_Win32Dialog_Styles::_onDrawButton(LPDRAWITEMSTRUCT lpDrawItemStruct, HWND hWnd)
{
UINT uiState = lpDrawItemStruct->itemState;
HPEN hPen;
HPEN pOldPen;
HDC hdc = lpDrawItemStruct->hDC;
int nWidth;
int nHeight;
int x, xEnd, xStart;
int y;
POINT p;
const char* pText;
HWND hParent;
LONG lData;
UT_Win32LocaleString str;
const XAP_StringSet * pSS = m_pApp->getStringSet();
pText= pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyFormat);
nWidth = lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left;
nHeight = lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top;
// set the pen color
if (uiState&ODS_DISABLED)
hPen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_GRAYTEXT));
else
hPen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNTEXT));
pOldPen = (HPEN) SelectObject(hdc, hPen);
// draw the border of the button
if(uiState&ODS_SELECTED)
DrawFrameControl(hdc, &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH|DFCS_PUSHED);
else
DrawFrameControl(hdc, &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH);
// Draw arrow
y = nHeight/2;
xStart = (nWidth/6)*5;
for (int i=0; i<4; i++)
{
x = xStart + i;
xEnd = xStart + 7 - i;
::MoveToEx(hdc, x, y, &p);
::LineTo(hdc, xEnd, y);
y++;
}
str.fromUTF8(pText);
ExtTextOutW(hdc, (nWidth/6)*1, ((nHeight/4)), 0, NULL, str.c_str(), str.length(), NULL);
// Clean Up
SelectObject(hdc, pOldPen);
DeleteObject(hPen);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:61,代码来源:ap_Win32Dialog_Styles.cpp
示例6:
void XAP_Win32DialogBase::getComboTextItem(UT_sint32 controlId, int index, UT_Win32LocaleString& str)
{
UT_return_if_fail(IsWindow(m_hDlg));
wchar_t szBuff[1024];
if (SendDlgItemMessageW(m_hDlg, controlId, CB_GETLBTEXT, index, (LPARAM)szBuff) != CB_ERR)
str.fromLocale(szBuff);
else
str.clear();
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:10,代码来源:xap_Win32DialogBase.cpp
示例7: getColumns
BOOL AP_Win32Dialog_Columns::_onDeltaPos(NM_UPDOWN * pnmud)
{
wchar_t buf[BUFSIZE];
UT_Win32LocaleString str;
switch( pnmud->hdr.idFrom )
{
case AP_RID_DIALOG_COLUMN_SPIN_NUMCOLUMNS:
if( pnmud->iDelta < 0 )
{
setColumns( getColumns() + 1 );
}
else
{
if( getColumns() > 1 )
{
setColumns( getColumns() - 1 );
}
}
SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS, _itow(getColumns(),buf,10));
checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE, (getColumns()==1));
checkButton(AP_RID_DIALOG_COLUMN_RADIO_TWO, (getColumns()==2));
checkButton(AP_RID_DIALOG_COLUMN_RADIO_THREE, (getColumns()==3));
return 1;
case AP_RID_DIALOG_COLUMN_SPIN_SPACEAFTER:
if( pnmud->iDelta < 0 )
{
incrementSpaceAfter( true );
}
else
{
incrementSpaceAfter( false );
}
str.fromUTF8 (getSpaceAfterString());
SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_SPACEAFTER, str.c_str ());
return 1;
case AP_RID_DIALOG_COLUMN_SPIN_MAXSIZE:
if( pnmud->iDelta < 0 )
{
incrementMaxHeight( true );
}
else
{
incrementMaxHeight( false );
}
str.fromUTF8 (getHeightString());
SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_MAXSIZE, str.c_str ());
return 1;
default:
return 0;
}
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:55,代码来源:ap_Win32Dialog_Columns.cpp
示例8:
void AP_Win32Dialog_Field::SetTypesList(void)
{
UT_Win32LocaleString str;
for (int i = 0;fp_FieldTypes[i].m_Desc != NULL;i++)
{
str.fromUTF8(fp_FieldTypes[i].m_Desc);
SendMessageW(m_hwndTypes, LB_ADDSTRING, (WPARAM)0, (LPARAM)str.c_str());
}
SendMessageW(m_hwndTypes, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
m_iTypeIndex = 0;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:11,代码来源:ap_Win32Dialog_Field.cpp
示例9: GetDlgItemTextW
bool XAP_Win32DialogBase::getDlgItemText(int nIDDlgItem, UT_Win32LocaleString& str)
{
wchar_t szBuff [1024];
bool rslt;
rslt = (bool) GetDlgItemTextW(m_hDlg, nIDDlgItem, szBuff, 1024);
if (rslt == true)
str.fromLocale(szBuff);
else
str.clear();
return rslt;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:14,代码来源:xap_Win32DialogBase.cpp
示例10: LoadCursor
bool AP_Win32LeftRuler::registerClass(XAP_Win32App * app)
{
ATOM a;
UT_Win32LocaleString str;
str.fromASCII (app->getApplicationName());
// register class for the left ruler
swprintf(s_LeftRulerWndClassName, L"%sLeftRuler", str.c_str());
a = UT_RegisterClassEx(CS_DBLCLKS | CS_OWNDC, AP_Win32LeftRuler::_LeftRulerWndProc, app->getInstance(),
NULL, LoadCursor(NULL, IDC_ARROW), GetSysColorBrush(COLOR_BTNFACE), NULL,
NULL, s_LeftRulerWndClassName);
UT_ASSERT_HARMLESS(a);
return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:17,代码来源:ap_Win32LeftRuler.cpp
示例11: UT_return_val_if_fail
int CALLBACK AP_Win32Toolbar_FontCombo::_EnumFontsProc(LPLOGFONTW lplf,
LPTEXTMETRICW lptm,
DWORD dwStyle,
LONG lParam)
{
AP_Win32Toolbar_FontCombo * ctl = (AP_Win32Toolbar_FontCombo *) lParam;
UT_return_val_if_fail (ctl, 0);
/*
WARNING: any changes to this function should be closely coordinated
with the equivalent logic in Win32Graphics::FindFont()
*/
// filter out fonts we don't use
if (dwStyle & RASTER_FONTTYPE)
return 1 ;
#if 0
// This is too restrictive. Since EnumFontFamilies chooses at random
// the character set for the chosen font family, we were missing things
// here. Perhaps use EnumFontFamiliesEx instead?
if (lplf->lfCharSet != ANSI_CHARSET)
return 1 ;
#endif
// filter out vertical fonts which aren't supported
if (lplf->lfFaceName[0]=='@')
return 1;
UT_Win32LocaleString str;
str.fromLocale (lplf->lfFaceName);
char * p = g_strdup((str.utf8_str().utf8_str()));
if (seenFonts.find(p)!=seenFonts.end()) {
FREEP(p);
return 1;
}
ctl->m_vecContents.addItem(p);
ctl->m_vecFontCharSet.addItem((void*)lplf->lfCharSet);
seenFonts.insert(p);
return 1;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:44,代码来源:ap_Win32Toolbar_FontCombo.cpp
示例12: resetContent
void AP_Win32Dialog_MailMerge::setFieldList()
{
if (!m_vecFields.size())
return;
resetContent(AP_RID_DIALOG_MAILMERGE_LISTBOX);
// build a list of all items
for (UT_sint32 i = 0; i < m_vecFields.size(); i++)
{
UT_continue_if_fail(m_vecFields[i]);
UT_Win32LocaleString str;
str.fromUTF8(((UT_UTF8String*)m_vecFields[i])->utf8_str());
SendMessageW(GetDlgItem(m_hDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_ADDSTRING,
0, (LPARAM)str.ucs2_str());
}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:20,代码来源:ap_Win32Dialog_MailMerge.cpp
示例13: s_createDirectoryIfNecessary
static bool s_createDirectoryIfNecessary(const char * szDir)
{
struct _stat statbuf;
UT_Win32LocaleString str;
str.fromUTF8(szDir);
if (_wstat(str.c_str(),&statbuf) == 0) // if it exists
{
if ( (statbuf.st_mode & _S_IFDIR) == _S_IFDIR ) // and is a directory
return true;
UT_DEBUGMSG(("Pathname [%s] is not a directory.\n",szDir));
return false;
}
if (CreateDirectoryW(str.c_str(),NULL))
return true;
UT_DEBUGMSG(("Could not create Directory [%s].\n",szDir));
return false;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:22,代码来源:ap_Win32App.cpp
示例14: UT_return_if_fail
void AP_Win32Dialog_CollaborationAccounts::_populateWindowData()
{
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
m_bPopulating = true;
// clear out the old contents, if any
ListView_DeleteAllItems(m_hAccountList);
for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
{
AccountHandler* pAccount = pManager->getAccounts()[i];
UT_continue_if_fail(pAccount);
UT_Win32LocaleString sAccountText = AP_Win32App::s_fromUTF8ToWinLocale(pAccount->getDescription().utf8_str());
UT_Win32LocaleString sAccountTypeText = AP_Win32App::s_fromUTF8ToWinLocale(pAccount->getDisplayType().utf8_str());
// insert a new account record
LVITEMW lviAccount;
lviAccount.mask = LVIF_STATE | LVIF_IMAGE | LVIF_PARAM;
lviAccount.state = 1;
lviAccount.iItem = i;
lviAccount.iSubItem = 0;
lviAccount.lParam = (LPARAM)pAccount;
SendMessageW(m_hAccountList, LVM_INSERTITEMW, 0, (LPARAM) &lviAccount);
ListView_SetCheckState(m_hAccountList, i, pAccount->isOnline());
lviAccount.iSubItem=1;
lviAccount.pszText= const_cast<LPWSTR>(sAccountText.c_str());
SendMessageW(m_hAccountList, LVM_SETITEMTEXTW, i, (LPARAM) &lviAccount);
lviAccount.iSubItem=2;
lviAccount.pszText= const_cast<LPWSTR>(sAccountTypeText.c_str());
SendMessageW(m_hAccountList, LVM_SETITEMTEXTW, i, (LPARAM) &lviAccount);
}
_updateSelection();
m_bPopulating = false;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:39,代码来源:ap_Win32Dialog_CollaborationAccounts.cpp
示例15: UT_return_val_if_fail
/*
Does a stringSet exist on disk?
*/
bool AP_Win32App::doesStringSetExist(const char* pLocale)
{
HANDLE in;
const char * szDirectory = NULL;
UT_return_val_if_fail(pLocale, false);
getPrefsValueDirectory(true,AP_PREF_KEY_StringSetDirectory,&szDirectory);
UT_return_val_if_fail(((szDirectory) && (*szDirectory)), false);
char *szPathname = (char*) UT_calloc(sizeof(char),strlen(szDirectory)+strlen(pLocale)+100);
UT_return_val_if_fail(szPathname, false);
char *szDest = szPathname;
strcpy(szDest, szDirectory);
szDest += strlen(szDest);
if ((szDest > szPathname) && (szDest[-1]!='\\'))
*szDest++='\\';
lstrcpyA(szDest,pLocale);
lstrcatA(szDest,".strings");
UT_Win32LocaleString wsFilename;
wsFilename.fromUTF8(szPathname);
in = CreateFileW(wsFilename.c_str(),0,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
OPEN_EXISTING,0,NULL);
g_free (szPathname);
if (in!=INVALID_HANDLE_VALUE)
{
CloseHandle(in);
return true;
}
return false;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:39,代码来源:ap_Win32App.cpp
示例16: HIWORD
//.........这里部分代码省略.........
}
destroyAbiPreview();
DELETEP(m_pAbiPreviewWidget);
}
}
return 1;
case AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_REMOVE:
{
char szTemp[128];
_win32DialogNewModify.getControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_REMOVE,
szTemp,
sizeof(szTemp) );
removeVecProp(szTemp);
rebuildDeleteProps();
updateCurrentStyle();
}
return 1;
case AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_TOGGLEITEMS:
{
RECT rect;
HMENU hMenu;
int x,y;
HWND hWndButton;
static int menu_items[]={AP_STRING_ID_DLG_Styles_ModifyParagraph,
AP_STRING_ID_DLG_Styles_ModifyFont,
AP_STRING_ID_DLG_Styles_ModifyTabs,
AP_STRING_ID_DLG_Styles_ModifyNumbering,
AP_STRING_ID_DLG_Styles_ModifyLanguage
};
UT_Win32LocaleString str;
hWndButton = GetDlgItem(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_BTN_TOGGLEITEMS);
XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
const XAP_StringSet * pSS = m_pApp->getStringSet();
// Get button position
GetWindowRect(hWndButton, &rect);
x = rect.left;
y = rect.bottom;
// Menu creation
hMenu = CreatePopupMenu();
str;
for (int i=0; i<5; i++) {
str.fromUTF8(pSS->getValue(menu_items[i]));
AppendMenuW(hMenu, MF_ENABLED|MF_STRING, i+1, (LPCWSTR)str.c_str());
}
// show and track the menu
m_selectToggle = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_NONOTIFY|TPM_RETURNCMD,
x,y,0, hWndButton, NULL);
switch(m_selectToggle)
{
case 0: // user has cancelled
break;
case 1:
ModifyParagraph();
break;
case 2:
ModifyFont();
break;
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:67,代码来源:ap_Win32Dialog_Styles.cpp
示例17: UT_return_val_if_fail
//.........这里部分代码省略.........
setWindowText(hWnd, pSS->getValue( (m_bisNewStyle) ?
AP_STRING_ID_DLG_Styles_NewTitle :
AP_STRING_ID_DLG_Styles_ModifyTitle ));
#define _DS(c,s) setDlgItemText(hWnd, AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
#define _DSX(c,s) setDlgItemText(hWnd, AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
_DS(STYLES_NEWMODIFY_LBL_NAME, DLG_Styles_ModifyName);
_DS(STYLES_NEWMODIFY_LBL_BASEDON, DLG_Styles_ModifyBasedOn);
_DS(STYLES_NEWMODIFY_LBL_TYPE, DLG_Styles_ModifyType);
_DS(STYLES_NEWMODIFY_LBL_FOLLOWPARA, DLG_Styles_ModifyFollowing);
_DS(STYLES_NEWMODIFY_LBL_REMOVE, DLG_Styles_RemoveLab);
_DS(STYLES_NEWMODIFY_GBX_PREVIEW, DLG_Styles_ModifyPreview);
_DS(STYLES_NEWMODIFY_GBX_DESC, DLG_Styles_ModifyDescription);
_DS(STYLES_NEWMODIFY_BTN_REMOVE, DLG_Styles_RemoveButton);
_DS(STYLES_NEWMODIFY_BTN_SHORTCUT, DLG_Styles_ModifyShortCut);
_DSX(STYLES_NEWMODIFY_BTN_OK, DLG_OK);
_DSX(STYLES_NEWMODIFY_BTN_CANCEL, DLG_Cancel);
#undef _DSX
#undef _DS
// Changes basic controls based upon either New or Modify Dialog
_win32DialogNewModify.showControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE ,
(m_bisNewStyle) ? SW_HIDE : SW_SHOW );
_win32DialogNewModify.showControl( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE ,
(m_bisNewStyle) ? SW_SHOW : SW_HIDE );
// Initialize the controls with appropriate data
size_t nStyles = getDoc()->getStyleCount();
const char * name = NULL;
const char * pLocalised = NULL;
const PD_Style * pcStyle = NULL;
int nIndex;
UT_Win32LocaleString str;
UT_UTF8String utf8;
UT_GenericVector<PD_Style*> * pStyles = NULL;
getDoc()->enumStyles(pStyles);
UT_return_val_if_fail( pStyles, FALSE );
for (UT_uint32 i = 0; i < nStyles; i++)
{
pcStyle = pStyles->getNthItem(i);
UT_return_val_if_fail( pcStyle, FALSE );
name = pcStyle->getName();
pt_PieceTable::s_getLocalisedStyleName(name, utf8);
pLocalised = utf8.utf8_str();
nIndex = _win32DialogNewModify.addItemToCombo(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, pLocalised);
_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON,
nIndex, i);
nIndex = _win32DialogNewModify.addItemToCombo(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, pLocalised);
_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA,
nIndex, i);
}
delete pStyles;
// Strings (not styles names)
const char* pDefCurrent = pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent);
const char* pDefNone = pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone);
nIndex = _win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA,
pDefCurrent );
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:67,代码来源:ap_Win32Dialog_Styles.cpp
示例18: UT_return_val_if_fail
BOOL AP_Win32Dialog_New::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
m_hThisDlg = hWnd;
XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
UT_return_val_if_fail (app,1);
const XAP_StringSet * pSS = m_pApp->getStringSet();
_win32Dialog.setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_NEW_Title));
// localize controls
_DSX(NEW_BTN_OK, DLG_OK);
_DSX(NEW_BTN_CANCEL, DLG_Cancel);
_DS(NEW_RDO_TEMPLATE, DLG_NEW_Create);
_DS(NEW_RDO_EXISTING, DLG_NEW_Open);
_DS(NEW_BTN_EXISTING, DLG_NEW_Choose);
// set initial state
_win32Dialog.setControlText(AP_RID_DIALOG_NEW_EBX_EXISTING,
pSS->getValue(AP_STRING_ID_DLG_NEW_NoFile));
HWND hControl = GetDlgItem(hWnd, AP_RID_DIALOG_NEW_LBX_TEMPLATE);
long findtag;
struct _finddata_t cfile;
UT_String templateName, searchDir;
templateName = XAP_App::getApp()->getUserPrivateDirectory();
searchDir = XAP_App::getApp()->getUserPrivateDirectory();
searchDir += "\\templates\\*.awt";
findtag = _findfirst( searchDir.c_str(), &cfile );
if( findtag != -1 )
{
do
{
templateName = XAP_App::getApp()->getUserPrivateDirectory();
templateName += "\\templates\\";
templateName += cfile.name;
if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names
templateName = templateName.substr ( 0, templateName.size () - 4 ) ;
UT_Win32LocaleString str;
str.fromASCII (templateName.c_str());
char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str());
UT_continue_if_fail(uri);
UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) );
SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 0 );
g_free(uri);
} while( _findnext( findtag, &cfile ) == 0 );
}
_findclose( findtag );
templateName = XAP_App::getApp()->getAbiSuiteLibDir();
searchDir = XAP_App::getApp()->getAbiSuiteLibDir();
searchDir += "\\templates\\*.awt";
findtag = _findfirst( searchDir.c_str(), &cfile );
if( findtag != -1 )
{
do
{
templateName = XAP_App::getApp()->getAbiSuiteLibDir();
templateName += "\\templates\\";
templateName += cfile.name;
if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names
templateName = templateName.substr ( 0, templateName.size () - 4 ) ;
UT_Win32LocaleString str;
str.fromASCII (templateName.c_str());
char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str());
UT_continue_if_fail(uri);
UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) );
SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 1 );
g_free(uri);
} while( _findnext( findtag, &cfile ) == 0 );
}
_findclose( findtag );
XAP_Win32DialogHelper::s_centerDialog(hWnd);
_updateControls();
return 1; // 1 == we did not call SetFocus()
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:85,代码来源:ap_Win32Dialog_New.cpp
示例19: HIWORD
BOOL AP_Win32Dialog_MailMerge::_onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
WORD wNotifyCode = HIWORD(wParam);
WORD wId = LOWORD(wParam);
HWND hWndCtrl = (HWND)lParam;
switch (wId)
{
case AP_RID_DIALOG_MAILMERGE_LISTBOX:
if (HIWORD(wParam)==LBN_DBLCLK)
{
UT_Win32LocaleString str;
int nItem = SendMessageW(GetDlgItem(m_hDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_GETCURSEL, 0, 0);
if (nItem!=LB_ERR)
{
// get the mail merge field from the listbox
HWND lBox = GetDlgItem(m_hDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX);
UT_sint32 len = SendMessageW(lBox, LB_GETTEXTLEN, nItem, (LPARAM)0);
wchar_t* szBuff = (wchar_t*)g_malloc(sizeof(wchar_t) * (len + 1));
SendMessageW(lBox, LB_GETTEXT, nItem, (LPARAM)szBuff);
str.fromLocale(szBuff);
FREEP(szBuff);
setMergeField(str.utf8_str());
addClicked();
}
return 1;
}
else
{
return 0;
}
case AP_RID_DIALOG_MAILMERGE_BTN_INSERT:
{
UT_Win32LocaleString str;
int nChars = getDlgItemText(AP_RID_DIALOG_MAILMERGE_EDIT_FIELD, str);
if (nChars > 0)
{
setMergeField(str.utf8_str ());
addClicked();
}
else
{
int nItem = SendMessageW(GetDlgItem(m_hDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX), LB_GETCURSEL, 0, 0);
if (nItem!=LB_ERR)
{
// get the mail merge field from the listbox
HWND lBox = GetDlgItem(m_hDlg, AP_RID_DIALOG_MAILMERGE_LISTBOX);
UT_sint32 len = SendMessageW(lBox, LB_GETTEXTLEN, nItem, (LPARAM)0);
wchar_t* szBuff = (wchar_t*)g_malloc(sizeof(wchar_t) * (len + 1));
SendMessageW(lBox, LB_GETTEXT, nItem, (LPARAM)szBuff);
str.fromLocale(szBuff);
FREEP(szBuff);
setMergeField(str.utf8_str());
addClicked();
}
}
return 1;
}
case AP_RID_DIALOG_MAILMERGE_BTN_OPEN:
{
eventOpen();
SetFocus(m_hDlg);
return 1;
}
case AP_RID_DIALOG_MAILMERGE_BTN_CLOSE:
case IDCANCEL: // We want to close button work
{
destroy();
return 1;
}
default: // we did not handle this notification
UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
return 0; // return zero to let windows take care of it.
}
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:84,代码来源:ap_Win32Dialog_MailMerge.cpp
示例20: UT_return_if_fail
void XAP_Win32Dialog_FontChooser::runModal(XAP_Frame * pFrame)
{
UT_return_if_fail(pFrame);
XAP_Win32App * pApp = static_cast<XAP_Win32App *>(XAP_App::getApp());
UT_return_if_fail(pApp);
const XAP_EncodingManager *pEncMan = pApp->getEncodingManager();
UT_return_if_fail(pEncMan);
UT_Win32LocaleString family;
UT_DEBUGMSG(("FontChooserStart: Family[%s] Size[%s] Weight[%s] Style[%s] Color[%s] Underline[%d] StrikeOut[%d]\n",
m_sFontFamily.c_str(),
m_sFontSize.c_str(),
m_sFontWeight.c_str(),
m_sFontStyle.c_str(),
m_sColor.c_str(),
m_bUnderline,
m_bStrikeout));
m_bWin32Overline = m_bOverline;
m_bWin32Hidden = m_bHidden;
m_bWin32SuperScript = m_bSuperScript;
m_bWin32SubScript = m_bSubScript;
/*
WARNING: any changes to this function should be closely coordinated
with the equivalent logic in Win32Graphics::FindFont()
*/
LOGFONTW lf;
memset(&lf, 0, sizeof(lf));
CHOOSEFONTW cf;
memset(&cf, 0, sizeof(cf));
cf.lStructSize = sizeof(cf);
cf.hwndOwner = static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow();
cf.lpLogFont = &lf;
cf.Flags = CF_SCREENFONTS |
CF_EFFECTS |
CF_ENABLEHOOK |
CF_ENABLETEMPLATE |
CF_INITTOLOGFONTSTRUCT;
cf.lpTemplateName = MAKEINTRESOURCEW(XAP_RID_DIALOG_FONT);
cf.lpfnHook = (LPCFHOOKPROC) s_hookProc;
cf.lCustData = (LPARAM) this;
cf.hInstance = pApp->getInstance();
if (!m_sFontFamily.empty())
{
family.fromUTF8 (m_sFontFamily.c_str());
lstrcpynW(lf.lfFaceName,family.c_str(),LF_FACESIZE);
}
else
cf.Flags |= CF_NOFACESEL;
if (!m_sFontSize.empty())
{
UT_ASSERT(sizeof(char) == sizeof(gchar));
lf.lfHeight = (long) -(UT_convertToPoints(m_sFontSize.c_str()))*4/3;
}
else
cf.Flags |= CF_NOSIZESEL;
if (!m_sFontWeight.empty())
{
if (g_ascii_strcasecmp(m_sFontWeight.c_str(),"bold") == 0)
lf.lfWeight = 700;
// TODO do we need any others here...
}
else
cf.Flags |= CF_NOSTYLESEL;
if (!m_sFontStyle.empty())
{
if (g_ascii_strcasecmp(m_sFontStyle.c_str(),"italic") == 0)
lf.lfItalic = TRUE;
}
else
cf.Flags |= CF_NOSTYLESEL;
if (!m_sColor.empty())
{
UT_RGBColor c;
UT_parseColor(m_sColor.c_str(),c);
cf.rgbColors = RGB(c.m_red,c.m_grn,c.m_blu);
}
if (m_bUnderline)
lf.lfUnderline = TRUE;
if (m_bStrikeout)
lf.lfStrikeOut = TRUE;
// run the actual dialog...
m_answer = (ChooseFontW(&cf) ? a_OK : a_CANCEL);
// Convert the font name returned by the Windows Font Chooser
// to UTF-8.
family.fromLocale (lf.lfFaceName);
UT_UTF8String family_utf = family.utf8_str();
const char *szFontFamily = family_utf.utf8_str();
//.........这里部分代码省略.........
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:101,代码来源:xap_Win32Dlg_FontChooser.cpp
注:本文中的UT_Win32LocaleString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论