メインページ | ファイル一覧 | ファイルメンバ

ExportPropertyPage1.cpp

00001 // ExportPropertyPage1.cpp : インプリメンテーション ファイル 00002 // 00003 00004 #include "stdafx.h" 00005 #include "resource.h" 00006 #include "nexpcsv.h" 00007 #include "ExportPropertyPage1.h" 00008 00009 #include "ColumnSelectDialog.h" 00010 00011 #ifdef _DEBUG 00012 #undef THIS_FILE 00013 static char BASED_CODE THIS_FILE[] = __FILE__; 00014 #endif 00015 00016 #define INI_OUT_DOC _T("OutputDocument") 00017 #define INI_OUT_COL _T("OutputColumn") 00018 #define INI_HEADER _T("OutputHeader") 00019 #define INI_FORMAT _T("ColumnFormat") 00020 #define INI_LIST_SPLIT _T("ListSeparater") 00021 #define INI_MODE _T("CSVFormatMode") 00022 #define INI_SPLIT _T("ColumnSeparater") 00023 #define INI_QUOTE _T("ColumnQuote") 00024 #define INI_ALT_SPLIT _T("AltSeparater") 00025 #define INI_ALT_CRLF _T("AltCrlf") 00026 00027 IMPLEMENT_DYNCREATE(CExportPropertyPage1, CPropertyPage) 00028 00029 00030 // CExportPropertyPage1 プロパティ ページ 00031 00032 CExportPropertyPage1::CExportPropertyPage1() : CPropertyPage(CExportPropertyPage1::IDD) 00033 { 00034 //{{AFX_DATA_INIT(CExportPropertyPage1) 00035 m_bHeader = TRUE; 00036 m_nFormat = 0; 00037 m_nQuote = 0; 00038 m_nSplit = 0; 00039 m_nAltCrlf = 0; 00040 m_nAltSplit = 0; 00041 m_nOutDoc = 1; 00042 m_nOutCol = 0; 00043 m_nListSplit = 0; 00044 m_nMode = 0; 00045 //}}AFX_DATA_INIT 00046 00047 m_szIniFile[0] = 0x00; 00048 char *s; 00049 DWORD n =SearchPath(NULL, _T("notes.ini"), NULL, sizeof(m_szIniFile), m_szIniFile ,&s); 00050 if ( n==0 || n>sizeof(m_szIniFile)) m_szIniFile[0] = 0x00; 00051 00052 m_nOutDoc = GetProperyInt(INI_OUT_DOC, m_nOutDoc, 0, 1); 00053 m_nOutCol = GetProperyInt(INI_OUT_COL, m_nOutCol, 0, 1); 00054 m_bHeader = GetProperyInt(INI_HEADER, m_bHeader, FALSE, TRUE); 00055 m_nFormat = GetProperyInt(INI_FORMAT, m_nFormat, 0, 1); 00056 m_nListSplit = GetProperyInt(INI_LIST_SPLIT, m_nListSplit, 0, 6); 00057 m_nMode = GetProperyInt(INI_MODE, m_nMode, 0, 2); 00058 m_nSplit = GetProperyInt(INI_SPLIT, m_nSplit, 0, 1); 00059 m_nQuote = GetProperyInt(INI_QUOTE, m_nQuote, 0, 2); 00060 m_nAltSplit = GetProperyInt(INI_ALT_SPLIT, m_nAltSplit, 0, 5); 00061 m_nAltCrlf = GetProperyInt(INI_ALT_CRLF, m_nAltCrlf, 0, 2); 00062 } 00063 00064 CExportPropertyPage1::~CExportPropertyPage1() 00065 { 00066 } 00067 00068 void CExportPropertyPage1::DoDataExchange(CDataExchange* pDX) 00069 { 00070 CPropertyPage::DoDataExchange(pDX); 00071 //{{AFX_DATA_MAP(CExportPropertyPage1) 00072 DDX_Control(pDX, IDC_CSV_MODE, m_cbMode); 00073 DDX_Control(pDX, IDC_ALT_SPLIT, m_cbAltSplit); 00074 DDX_Control(pDX, IDC_ALT_CRLF, m_cbAltCrlf); 00075 DDX_Control(pDX, IDC_COLUMN_SPLIT, m_cbSplit); 00076 DDX_Control(pDX, IDC_COLUMN_QUOTE, m_cbQuote); 00077 DDX_Check(pDX, IDC_OUTPUT_HEADER, m_bHeader); 00078 DDX_CBIndex(pDX, IDC_COLUMN_FORMAT, m_nFormat); 00079 DDX_CBIndex(pDX, IDC_COLUMN_QUOTE, m_nQuote); 00080 DDX_CBIndex(pDX, IDC_COLUMN_SPLIT, m_nSplit); 00081 DDX_CBIndex(pDX, IDC_ALT_CRLF, m_nAltCrlf); 00082 DDX_CBIndex(pDX, IDC_ALT_SPLIT, m_nAltSplit); 00083 DDX_Radio(pDX, IDC_DOC_ALL, m_nOutDoc); 00084 DDX_Radio(pDX, IDC_COL_SHOW, m_nOutCol); 00085 DDX_CBIndex(pDX, IDC_LIST_SPLIT, m_nListSplit); 00086 DDX_CBIndex(pDX, IDC_CSV_MODE, m_nMode); 00087 //}}AFX_DATA_MAP 00088 } 00089 00090 00091 BEGIN_MESSAGE_MAP(CExportPropertyPage1, CPropertyPage) 00092 //{{AFX_MSG_MAP(CExportPropertyPage1) 00093 ON_BN_CLICKED(IDC_COL_SEL, OnColSel) 00094 ON_CBN_SELCHANGE(IDC_CSV_MODE, OnSelchangeCsvMode) 00095 ON_BN_CLICKED(IDHELP, OnHelp) 00096 //}}AFX_MSG_MAP 00097 END_MESSAGE_MAP() 00098 00099 00100 BOOL CExportPropertyPage1::OnSetActive() 00101 { 00102 // TODO: この位置に固有の処理を追加するか、または基本クラスを呼び出してください 00103 CPropertySheet* psheet = (CPropertySheet*) GetParent(); 00104 psheet->SetWizardButtons(PSWIZB_FINISH); 00105 00106 OnSelchangeCsvMode(); 00107 return CPropertyPage::OnSetActive(); 00108 } 00109 00110 BOOL CExportPropertyPage1::OnWizardFinish() 00111 { 00112 // TODO: この位置に固有の処理を追加するか、または基本クラスを呼び出してください 00113 UpdateData(TRUE); 00114 00115 //---------------------------------------- 00116 // ビューの列情報を設定する 00117 //---------------------------------------- 00118 CnExpCsvApp* app = (CnExpCsvApp*)AfxGetApp(); 00119 00120 switch (m_nOutCol) { 00121 case 0: 00122 { 00123 int count = app->m_arrData.GetSize(); 00124 for (int n=0; n<count; n++) { 00125 CColumnData &column = app->m_arrData.ElementAt(n); 00126 column.SetDefaultOutput(); 00127 } 00128 break; 00129 } 00130 case 1: 00131 { 00132 int count = app->m_arrData.GetSize(); 00133 for (int n=0; n<count; n++) { 00134 CColumnData &column = app->m_arrData.ElementAt(n); 00135 column.SetOutput(TRUE); 00136 } 00137 break; 00138 } 00139 break; 00140 case 2: 00141 break; 00142 } 00143 00144 switch (m_nMode) { 00145 case 0: 00146 m_nSplit = 0; 00147 m_nQuote = 0; 00148 m_nAltSplit = 0; 00149 m_nAltCrlf = 0; 00150 break; 00151 case 1: 00152 m_nSplit = 0; 00153 m_nQuote = 2; 00154 m_nAltSplit = 1; 00155 m_nAltCrlf = 1; 00156 break; 00157 } 00158 00159 WriteProperyInt(INI_OUT_DOC, m_nOutDoc); 00160 WriteProperyInt(INI_OUT_COL, m_nOutCol); 00161 WriteProperyInt(INI_HEADER, m_bHeader); 00162 WriteProperyInt(INI_FORMAT, m_nFormat); 00163 WriteProperyInt(INI_LIST_SPLIT, m_nListSplit); 00164 WriteProperyInt(INI_MODE, m_nMode); 00165 WriteProperyInt(INI_SPLIT, m_nSplit); 00166 WriteProperyInt(INI_QUOTE, m_nQuote); 00167 WriteProperyInt(INI_ALT_SPLIT, m_nAltSplit); 00168 WriteProperyInt(INI_ALT_CRLF, m_nAltCrlf); 00169 00170 return CPropertyPage::OnWizardFinish(); 00171 } 00172 00173 void CExportPropertyPage1::OnColSel() 00174 { 00175 // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください 00176 CColumnSelectDialog dlg; 00177 dlg.DoModal(); 00178 } 00179 00180 void CExportPropertyPage1::OnSelchangeCsvMode() 00181 { 00182 // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください 00183 BOOL bShow = (m_cbMode.GetCurSel() == 2); 00184 00185 m_cbSplit.EnableWindow(bShow); 00186 m_cbQuote.EnableWindow(bShow); 00187 m_cbAltSplit.EnableWindow(bShow); 00188 m_cbAltCrlf.EnableWindow(bShow); 00189 } 00190 00191 UINT CExportPropertyPage1::GetProperyInt(LPCTSTR lpKeyName, INT nDefault, INT nMin, INT nMax) 00192 { 00193 if (m_szIniFile[0] == 0x00) return nDefault; 00194 INT nVal = ::GetPrivateProfileInt(_T("ExpCsv"), lpKeyName, nDefault, m_szIniFile); 00195 if (nVal<nMin) return nDefault; 00196 if (nVal>nMax) return nDefault; 00197 return nVal; 00198 } 00199 00200 BOOL CExportPropertyPage1::WriteProperyInt(LPCTSTR lpKeyName, INT nValue) 00201 { 00202 if (m_szIniFile[0] == 0x00) return FALSE; 00203 CString strFmt; 00204 strFmt.Format(_T("%d"), nValue); 00205 return WritePrivateProfileString(_T("ExpCsv"), lpKeyName, strFmt, m_szIniFile); 00206 } 00207 00208 void CExportPropertyPage1::OnHelp() 00209 { 00210 // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください 00211 AfxGetApp()->WinHelp(0L, HELP_INDEX); 00212 } 00213

LotusNotes CSV Export Plug-inに対してWed Jun 30 15:53:52 2004に生成されました。 doxygen 1.3.7